From patchwork Tue Mar 14 00:05:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: James Hogan X-Patchwork-Id: 9622355 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6D434604CC for ; Tue, 14 Mar 2017 00:05:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5EF342851E for ; Tue, 14 Mar 2017 00:05:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 537F22851A; Tue, 14 Mar 2017 00:05:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B5FC2851A for ; Tue, 14 Mar 2017 00:05:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752300AbdCNAFh (ORCPT ); Mon, 13 Mar 2017 20:05:37 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:46368 "EHLO mailapp01.imgtec.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750846AbdCNAFf (ORCPT ); Mon, 13 Mar 2017 20:05:35 -0400 Received: from hhmail02.hh.imgtec.org (unknown [10.100.10.20]) by Forcepoint Email with ESMTPS id 2EED962D85842; Tue, 14 Mar 2017 00:05:28 +0000 (GMT) Received: from jhogan-linux.le.imgtec.org (192.168.154.110) by hhmail02.hh.imgtec.org (10.100.10.21) with Microsoft SMTP Server (TLS) id 14.3.294.0; Tue, 14 Mar 2017 00:05:32 +0000 From: James Hogan To: CC: Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Ralf Baechle , , , James Hogan Subject: [PATCH] KVM: MIPS/Emulate: Fix preemption warning Date: Tue, 14 Mar 2017 00:05:15 +0000 Message-ID: <20170314000515.26573-1-james.hogan@imgtec.com> X-Mailer: git-send-email 2.11.1 MIME-Version: 1.0 X-Originating-IP: [192.168.154.110] Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Host kernels with preemption enabled will emit the following preemption warning when the guest FPU is used: BUG: using smp_processor_id() in preemptible [00000000] code: qemu-system-mip/1495 caller is kvm_mips_emulate_CP0+0xa48/0xea0 [kvm] ... Call Trace: [] show_stack+0x88/0xa8 [] dump_stack+0x9c/0xd0 [] check_preemption_disabled+0x124/0x130 [] kvm_mips_emulate_CP0+0xa48/0xea0 [kvm] [] kvm_mips_emulate_inst+0x190/0x268 [kvm] [] kvm_trap_emul_handle_cop_unusable+0x48/0x160 [kvm] [] kvm_mips_handle_exit+0x520/0x7e0 [kvm] This is due to the use of current_cpu_data.fpu_id from a preemptible context to read the MIPS_FPIR_F64 bit. We don't currently support asymmetric FPU capabilities with KVM, so just use boot_cpu_data instead to silence the warning. Fixes: 6cdc65e31d4f ("MIPS: KVM: Emulate FPU bits in COP0 interface") Signed-off-by: James Hogan Cc: Paolo Bonzini Cc: "Radim Krčmář" Cc: Ralf Baechle Cc: linux-mips@linux-mips.org Cc: kvm@vger.kernel.org Cc: # 4.1.x- Acked-by: Ralf Baechle --- arch/mips/kvm/emulate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/kvm/emulate.c b/arch/mips/kvm/emulate.c index d40cfaad4529..9bc55619252a 100644 --- a/arch/mips/kvm/emulate.c +++ b/arch/mips/kvm/emulate.c @@ -1279,7 +1279,7 @@ enum emulation_result kvm_mips_emulate_CP0(union mips_instruction inst, * Also don't allow FR to be set if host doesn't * support it. */ - if (!(current_cpu_data.fpu_id & MIPS_FPIR_F64)) + if (!(boot_cpu_data.fpu_id & MIPS_FPIR_F64)) val &= ~ST0_FR;