From patchwork Wed Apr 4 13:50:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 10322631 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 9DC996053F for ; Wed, 4 Apr 2018 13:51:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8B86B28EA3 for ; Wed, 4 Apr 2018 13:51:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8053628EAB; Wed, 4 Apr 2018 13:51:20 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0BF2728EA3 for ; Wed, 4 Apr 2018 13:51:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Subject:To:From :Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=3uk1NoB251gygdOt4KBMgqy3gShqdsNPMOqcE9QcEFk=; b=fU8vNddDeFHNuu ThHREiUpMYL4JAz1yHNwF/PX2G6uzihP9TLoZIVCLPJtKh+ZPdLkOc7wwWQX8AlG0tR9LZpTCO0eS z3Qxfqw4KjiZMWBTAxempmFA0CUKUMm+p2NQ8r1S5iiLJAsCOwdZtmr0VNZr3SF/rbemMwqW7uuE+ gxuH9WMGP78GVz/OWqNi+FPKc+XkYTTDKJq3d9TcafJiz/ATw7bqUDaxWoH6p443etWD3losq03ip QTVMvM98i4b2mFj8i8rp/6Yti71O4udo/42EuDTdDHoyCjbSNsDFsUXnXEtunemfbQ55maKKN92vz gtMhxk9MEDfpIOA+qqOA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1f3ioj-0005Gf-Gd; Wed, 04 Apr 2018 13:51:13 +0000 Received: from galois.linutronix.de ([2a01:7a0:2:106d:700::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f3iof-0005Ez-8Z for linux-arm-kernel@lists.infradead.org; Wed, 04 Apr 2018 13:51:11 +0000 Received: from bigeasy by Galois.linutronix.de with local (Exim 4.80) (envelope-from ) id 1f3ioO-0005rZ-H9; Wed, 04 Apr 2018 15:50:52 +0200 Date: Wed, 4 Apr 2018 15:50:52 +0200 From: Sebastian Andrzej Siewior To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Subject: [PATCH] kvm: arm: remove BUG(preemptible()) check Message-ID: <20180404135052.jsduo4s4pxoelnn6@linutronix.de> MIME-Version: 1.0 Content-Disposition: inline User-Agent: NeoMutt/20180323 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180404_065109_453943_00DC392E X-CRM114-Status: GOOD ( 10.06 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marc Zyngier , tglx@linutronix.de, Christoffer Dall Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP native KVM crashes on -RT: |------------[ cut here ]------------ |kernel BUG virt/kvm/arm/arm.c:82! |Internal error: Oops - BUG: 0 [#1] PREEMPT SMP |Modules linked in: |CPU: 3 PID: 1527 Comm: qemu-system-aar Tainted: G W 4.14.29-rt25+ #48 |Hardware name: Freescale Layerscape 2088A RDB Board (DT) |PC is at kvm_arm_get_running_vcpu+0x48/0x50 |LR is at vgic_mmio_change_active.isra.1+0x2c/0xe0 |Process qemu-system-aar (pid: 1527, stack limit = 0xffff0000128c8000) |Call trace: | kvm_arm_get_running_vcpu+0x48/0x50 | vgic_mmio_change_active.isra.1+0x2c/0xe0 | __vgic_mmio_write_cactive+0x7c/0xd0 | vgic_mmio_uaccess_write_cactive+0xc/0x18 | vgic_uaccess+0xac/0xd8 | vgic_v2_dist_uaccess+0x3c/0x48 | vgic_v2_attr_regs_access.isra.3+0x144/0x158 | vgic_v2_set_attr+0xbc/0xe0 | kvm_device_ioctl_attr+0x80/0xb0 | kvm_device_ioctl+0x60/0xa8 | do_vfs_ioctl+0xa4/0xa18 | SyS_ioctl+0x44/0x80 vgic_mmio_change_active() holds &irq->irq_lock spin lock which makes context not-preemptible. On -RT the same lock is a sleeping lock and thus it remains preemptible but can not be migrated to another CPU. I *think* that the BUG() statement in kvm_arm_get_running_vcpu() is to ensure that we don't switch CPUs while accessing per-CPU variables. __this_cpu_write() + __this_cpu_read() will trigger a warning (with CONFIG_DEBUG_PREEMPT enabled) to spot such usage without crashing the whole machine. Therefore I suggest to remove this check. Signed-off-by: Sebastian Andrzej Siewior --- virt/kvm/arm/arm.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/virt/kvm/arm/arm.c b/virt/kvm/arm/arm.c index 3db4af5d0197..60a3f23927d9 100644 --- a/virt/kvm/arm/arm.c +++ b/virt/kvm/arm/arm.c @@ -69,7 +69,6 @@ static DEFINE_PER_CPU(unsigned char, kvm_arm_hardware_enabled); static void kvm_arm_set_running_vcpu(struct kvm_vcpu *vcpu) { - BUG_ON(preemptible()); __this_cpu_write(kvm_arm_running_vcpu, vcpu); } @@ -79,7 +78,6 @@ static void kvm_arm_set_running_vcpu(struct kvm_vcpu *vcpu) */ struct kvm_vcpu *kvm_arm_get_running_vcpu(void) { - BUG_ON(preemptible()); return __this_cpu_read(kvm_arm_running_vcpu); }