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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EBFF8C4167D for ; Mon, 18 Apr 2022 13:36:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244021AbiDRNiw (ORCPT ); Mon, 18 Apr 2022 09:38:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243998AbiDRNKl (ORCPT ); Mon, 18 Apr 2022 09:10:41 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4BC1D396AA for ; Mon, 18 Apr 2022 05:50:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650286220; h=from:from: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=Rb4fPpjVJBt57bzKiDeFjoDPvn2xKg179ojAIvSnHfY=; b=GV3EBuD3YRMfrI7XOXcHyGWbVbs55nBE6HFfp10JRd/CuRAF0rgKRZrQpkq/2mOIEZcXln +VEXcez592r+jd6hUr/XfzUbUfgsA4Bwy6IEJaguwBKM1EPhvNoPIjoNj+9+Rzu7Waf5mG 6WYpDrtjU9sm3w4ZZooG2WhuvGneTmg= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-612-Gt6VQVJfNvyuupZvkCYwfg-1; Mon, 18 Apr 2022 08:50:17 -0400 X-MC-Unique: Gt6VQVJfNvyuupZvkCYwfg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 85FC638149B4; Mon, 18 Apr 2022 12:50:16 +0000 (UTC) Received: from starship (unknown [10.40.194.231]) by smtp.corp.redhat.com (Postfix) with ESMTP id BD5E82026D07; Mon, 18 Apr 2022 12:50:01 +0000 (UTC) Message-ID: Subject: Re: [PATCH 4/4] KVM: x86: Skip KVM_GUESTDBG_BLOCKIRQ APICv update if APICv is disabled From: Maxim Levitsky To: Sean Christopherson , Paolo Bonzini Cc: Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Gaoning Pan , Yongkang Jia Date: Mon, 18 Apr 2022 15:50:00 +0300 In-Reply-To: <20220416034249.2609491-5-seanjc@google.com> References: <20220416034249.2609491-1-seanjc@google.com> <20220416034249.2609491-5-seanjc@google.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 2022-04-16 at 03:42 +0000, Sean Christopherson wrote: > Skip the APICv inhibit update for KVM_GUESTDBG_BLOCKIRQ if APICv is > disabled at the module level to avoid having to acquire the mutex and > potentially process all vCPUs. The DISABLE inhibit will (barring bugs) > never be lifted, so piling on more inhibits is unnecessary. > > Fixes: cae72dcc3b21 ("KVM: x86: inhibit APICv when KVM_GUESTDBG_BLOCKIRQ active") > Cc: Maxim Levitsky > Signed-off-by: Sean Christopherson > --- > arch/x86/kvm/x86.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index 09a270cc1c8f..16c5fa7d165d 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -11048,6 +11048,9 @@ static void kvm_arch_vcpu_guestdbg_update_apicv_inhibit(struct kvm *kvm) > struct kvm_vcpu *vcpu; > unsigned long i; > > + if (!enable_apicv) > + return; > + > down_write(&kvm->arch.apicv_update_lock); > > kvm_for_each_vcpu(i, vcpu, kvm) { Makes sense as a precation. Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky