From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03930C433FE for ; Wed, 20 Oct 2021 19:42:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C827060FF2 for ; Wed, 20 Oct 2021 19:42:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231652AbhJTTo1 (ORCPT ); Wed, 20 Oct 2021 15:44:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231360AbhJTToZ (ORCPT ); Wed, 20 Oct 2021 15:44:25 -0400 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13F4AC06161C for ; Wed, 20 Oct 2021 12:42:11 -0700 (PDT) Received: by mail-pl1-x631.google.com with SMTP id y1so16860269plk.10 for ; Wed, 20 Oct 2021 12:42:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=wpm3Gl8wXKPGXafIgFGP0xD6h/zadXUfu6GUjVrj6ns=; b=acg+FfyUS0RRG91XmDNK9hsP2+A1X4msHJW9htVgi4KwyGHvgm+Agooulgt0iLmMbz rbct5fnAphkQ/y2uOT5Z1Q9GnwNbVkE/uiNp1fYDMAKUJw/SHsgT5zj0a5JWFz/JJXBv 6bg1M5hK/hvlZmBXZwwSVJGtuB4y2VY6BV/plwRqiyOgN/lDzgNm4i6dlgUSk//Xi3xW rgkZvwYT63T8EXp1eph1nZn6F+uirjFGAM0ZEc7DPfJmlcehlpg54aY9wdo9PL/9+s4n BRP4QYLigPWg91zIFhOyWBu1q5lhskwgHHNT5ZSAXglNTNXO2QKcS95IEm1M8xUkHlc5 OMgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=wpm3Gl8wXKPGXafIgFGP0xD6h/zadXUfu6GUjVrj6ns=; b=1DXU071EGQbd/ovSUiUx8aYjot+rt1itWMQokRC3A/EsT9bks77ZWD60Px/9at6Dvk zLI8gRnKkwwPRplsmijc59ldi/Q8O2tQnYIzYN2NL80/IW3hW7J1bVIdFqzqw7No8WMA fmhj/WQiIbLYK4etPcJwpPWzM7yS7d8A90/iGBoWSn2YVUq+jJKPAj9FOV65Aa5HRdqe WMsZGjDZyDbmhJlgueaD9qTJ/WGVcp0BZ+zRXXZEqLdV+4U4hugsJTOltmZ4Z7Q3yByL /ZmgacoYEQ2dTIaF91vrh1IRKutjKt14TB7cBWJjQgA10/QTrydmpzmpjOX16LgASLiQ P+Ag== X-Gm-Message-State: AOAM533Gp7MrTb0d2qlxCaiNnMzf2RtUa8RUEAVJ1fnNY1aTcDroKUdW h39hJg1UIQRnUt8fe535VqJycBpP/Pp/Sw== X-Google-Smtp-Source: ABdhPJxy4kapndcHpucNwp6t7qxDpD1XglobjefCoqmc4trIw1WxM5NQumPUzkOK+VHDnc46UWVtpw== X-Received: by 2002:a17:90b:33c3:: with SMTP id lk3mr943772pjb.237.1634758930294; Wed, 20 Oct 2021 12:42:10 -0700 (PDT) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id nv5sm3583377pjb.10.2021.10.20.12.42.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 12:42:09 -0700 (PDT) Date: Wed, 20 Oct 2021 19:42:05 +0000 From: Sean Christopherson To: Paolo Bonzini Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, wanpengli@tencent.com, stable@vger.kernel.org Subject: Re: [PATCH] KVM: x86: check for interrupts before deciding whether to exit the fast path Message-ID: References: <20211020145231.871299-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211020145231.871299-1-pbonzini@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 20, 2021, Paolo Bonzini wrote: > The kvm_x86_sync_pir_to_irr callback can sometimes set KVM_REQ_EVENT. > If that happens exactly at the time that an exit is handled as > EXIT_FASTPATH_REENTER_GUEST, vcpu_enter_guest will go incorrectly > through the loop that calls kvm_x86_run, instead of processing > the request promptly. > > Fixes: 379a3c8ee444 ("KVM: VMX: Optimize posted-interrupt delivery for timer fastpath") > Cc: stable@vger.kernel.org > Signed-off-by: Paolo Bonzini > --- Reviewed-by: Sean Christopherson > arch/x86/kvm/x86.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index fa48948b4934..b9b31e5f72b0 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -9781,14 +9781,14 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) > if (likely(exit_fastpath != EXIT_FASTPATH_REENTER_GUEST)) > break; > > - if (unlikely(kvm_vcpu_exit_request(vcpu))) { > + if (vcpu->arch.apicv_active) > + static_call(kvm_x86_sync_pir_to_irr)(vcpu); > + > + if (unlikely(kvm_vcpu_exit_request(vcpu))) { > exit_fastpath = EXIT_FASTPATH_EXIT_HANDLED; > break; > } > - > - if (vcpu->arch.apicv_active) > - static_call(kvm_x86_sync_pir_to_irr)(vcpu); > - } > + } I think someone working on git has a meta-entry in the obfuscated C context. This is the most convoluted diff possible for a simple code move :-) > /* > * Do this here before restoring debug registers on the host. And > -- > 2.27.0 >