Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp1819321ybg; Thu, 30 Jul 2020 03:35:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxEWRMtAjtt87pPUcVFei7+T2cs0TaqmbPFWZW7dIqbU+M6hQDyvm22+ZAK7ZDdxh43uP/i X-Received: by 2002:a17:906:ca4f:: with SMTP id jx15mr2013007ejb.449.1596105322875; Thu, 30 Jul 2020 03:35:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596105322; cv=none; d=google.com; s=arc-20160816; b=l87ZznS75SKMvQp1SBQT1WwFWoetNHB7fx+Z4Jp5/7UgzheiB8VVGqWYRwYFLVnXsv Adrp6PExd61SrHrykoCIBJvCQZPKoFldtZiWVIMiQkvJN0WQm1WXXuDZ0cEakTv7Bt1z 7n8Sz7gUhY3bQ5P6SaAaOdnfhCgeM0BSZnAaLUEv7N7j4nr8fqld8yEFDa+GS6VJc99H EHGSRL0Kj2/+/BLQ6vCuEJbg5/QmdefF5tc2Wx2XlfehcCH+KahiA1bF57wIZASGOs2j EO1kBreifTPiWflTdmogAZXOu5w+CqWPb9ncC5gYEhTiM5Xgt/I0rrQ63fN0b2WofsUx 2UoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:dkim-signature :dkim-signature:date; bh=hu8K0lEmTpVCuDSPeCbbvbJVVrXge13M0xm2T41HKKM=; b=DOocE3JXC1ajQpvqs2QLtq5dk+qWZt1u7JHTVNkIUS3OFzA1O0AnzBopMgYN58c2ko 6C9AZ2CMxX3sk93ziwSIiVOQZe6xZZduKsCZ7KaB3++sLwl/v4O/t4a/vhpSgGw0CAy6 O7m7Sg4/lvYJfBUQ9B08jYtJR2n3EK5Oh77pIyCMOF5gU8Z3Rwtbu3EAedmjS2In/qlm JRys2XmBAYvue1eg+SVo7wIw4weFNSPNdARBfbp42+gcLA+xLnUrUKwbIwGIzi6PvJab lp/3Wq0G3FDY0DtlI2pghv1XH0FW+yjsMQ0mJDHsZL7vq2wOOzQYejIfkQQKmE5CVtr+ qUBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linutronix.de header.s=2020 header.b=jwFK2Uoa; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 30si3026712edq.190.2020.07.30.03.35.00; Thu, 30 Jul 2020 03:35:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@linutronix.de header.s=2020 header.b=jwFK2Uoa; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728880AbgG3Ker (ORCPT + 99 others); Thu, 30 Jul 2020 06:34:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725892AbgG3Keq (ORCPT ); Thu, 30 Jul 2020 06:34:46 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 292D3C061794; Thu, 30 Jul 2020 03:34:46 -0700 (PDT) Date: Thu, 30 Jul 2020 10:34:43 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1596105284; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hu8K0lEmTpVCuDSPeCbbvbJVVrXge13M0xm2T41HKKM=; b=jwFK2UoaHNwl+c8ZfFIcX9uXFSWTZ77gw9Lna9tyS7NekiC6KsOWi0IV2UKYaXfBwhhi7X 5VKrJchsxaf/2+NGchh28zVF2n7HsqiE7rxm3ZIYkf1YupOngn4C5frsVh2kumurhleIVy BUz14LIzSYIBge0RbJxfuzUGnacEU80nWly5BiR292q6lQVnc+nhQW0thHJEDiqi2JqC/+ AA1PMPITDiFKq6ud0rzD1LoB/dvkJS5dMsUcvCQSw8LnsuVSu4zCoUm2ylnUdos1aBmn4U swJ+/F5rkKecJEYo3sQnilO0/PGZ+AydpWhQAoIFNrjmx/LaakYqzDjroytd6g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1596105284; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hu8K0lEmTpVCuDSPeCbbvbJVVrXge13M0xm2T41HKKM=; b=ihc2FyucQ1Ypbr/v0/RGzH9FPwfKqlQ1upNiTYAReiEyZ88lQGq8Lgjg6rInmc/+6Fbbwd bERiJGPYcRPZDBDQ== From: "tip-bot2 for Thomas Gleixner" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/entry] x86/kvm: Use __xfer_to_guest_mode_work_pending() in kvm_run_vcpu() Cc: Qian Cai , Thomas Gleixner , x86 , LKML In-Reply-To: <87bljxa2sa.fsf@nanos.tec.linutronix.de> References: <87bljxa2sa.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Message-ID: <159610528353.4006.8299813904303562704.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam: Yes Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the x86/entry branch of tip: Commit-ID: f3020b8891b890b48d9e1a83241e3cce518427c1 Gitweb: https://git.kernel.org/tip/f3020b8891b890b48d9e1a83241e3cce518427c1 Author: Thomas Gleixner AuthorDate: Thu, 30 Jul 2020 09:19:01 +02:00 Committer: Thomas Gleixner CommitterDate: Thu, 30 Jul 2020 12:31:47 +02:00 x86/kvm: Use __xfer_to_guest_mode_work_pending() in kvm_run_vcpu() The comments explicitely explain that the work flags check and handling in kvm_run_vcpu() is done with preemption and interrupts enabled as KVM invokes the check again right before entering guest mode with interrupts disabled which guarantees that the work flags are observed and handled before VMENTER. Nevertheless the flag pending check in kvm_run_vcpu() uses the helper variant which requires interrupts to be disabled triggering an instant lockdep splat. This was caught in testing before and then not fixed up in the patch before applying. :( Use the relaxed and intentionally racy __xfer_to_guest_mode_work_pending() instead. Fixes: 72c3c0fe54a3 ("x86/kvm: Use generic xfer to guest work function") Reported-by: Qian Cai writes: Signed-off-by: Thomas Gleixner Link: https://lkml.kernel.org/r/87bljxa2sa.fsf@nanos.tec.linutronix.de --- arch/x86/kvm/x86.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 82d4a9e..5325972 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -8682,7 +8682,7 @@ static int vcpu_run(struct kvm_vcpu *vcpu) break; } - if (xfer_to_guest_mode_work_pending()) { + if (__xfer_to_guest_mode_work_pending()) { srcu_read_unlock(&kvm->srcu, vcpu->srcu_idx); r = xfer_to_guest_mode_handle_work(vcpu); if (r)