Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1693461rwb; Thu, 8 Dec 2022 14:07:09 -0800 (PST) X-Google-Smtp-Source: AA0mqf5HPs17WAOlKPbUzU86Hi45SfkjfiH1A5rTyp9mbhmsNFlJNSBGMosQDUZf3h4iHTjvffka X-Received: by 2002:aa7:9195:0:b0:574:7558:9bd6 with SMTP id x21-20020aa79195000000b0057475589bd6mr69719829pfa.80.1670537229617; Thu, 08 Dec 2022 14:07:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670537229; cv=none; d=google.com; s=arc-20160816; b=CUSWyBL1VmaSArI+C/Nus2o5EOT1heVuCjhWdLoOUilVykHv68pudXOfRssGR9jMd4 5ai3fb18CZNlIa57Al4cEjgPgQ/V8Eo8hK0yK5Jdw5/+chHhgjRXzF0hUNwBPXwNZl0y kPF1rSBE7QVj1nWTPlNdkTybxXK5qw4gYit0unvCkYXCIydsM4/O1v5KRRnFqHzBJ1OF vLv3zx33regjmbpGgp+UpW9Q4dcfELBHzBkjfQ1fts11Oq6viI219TFhICRvL5SUorJg 1ntB+8cw2g1mrUNG4OUEuxZZIcdmT1vefGOI9+qlJL+YXo7ZG3m806ndmwBR5lj9P+/v RDWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=JrJq5pFdcBwIApACklja7/lOG0etsZT07B9kvDYqyYM=; b=CQN0NAp3nCMyM473I/LsTC0t0vBkN98O9up0bVPj7dHI33bXKqM6+qju0cGSfhg+LX Nq7giJ5Fa0iHIXOCa2cdqQj65uSuavVr8dGBqRun8Qe8RviZwP39CrniTEW5HwRbnQAY 5uN8+KTeyTx8E9yPSpIOGmiwd6CM+aemtcQNXku0wzsVigXrRNym+2841ukM6N135sSo r4XUXbzGZKE+ayjD1UZs+DVIor1oh02m8OP2rPlwe8OQqrTI/nr3DV8PbtTDgSHmuARh YLfTro/GI1w4l+v1XdFss2EMg/hqSZtU6ICFat+sdrRJPUMKwc++5D0IzHLvSCk1F4Cm nCVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HUmIplmm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c19-20020a631c13000000b0046154b597cfsi18506262pgc.565.2022.12.08.14.06.59; Thu, 08 Dec 2022 14:07:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HUmIplmm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229943AbiLHVyW (ORCPT + 73 others); Thu, 8 Dec 2022 16:54:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229895AbiLHVyS (ORCPT ); Thu, 8 Dec 2022 16:54:18 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9666A26493 for ; Thu, 8 Dec 2022 13:53:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1670536394; 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=JrJq5pFdcBwIApACklja7/lOG0etsZT07B9kvDYqyYM=; b=HUmIplmm1Ve9YFOV+22wMfYrLGQeW598KkKHxwjkPFBKUUBtOCESw9yuYJKHayGOweN47a DaWhKt1xs41jrZNTCu/8/BJuaHuHqwZ7sNtynm6+LkxNT+4IV8A1/leCze7Wx4ke324dSM zM8pW6OHw3DXW7x1nVSj+sg/22jscJw= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-620-gdRG-3ItPnab8vysSVe-jw-1; Thu, 08 Dec 2022 16:53:10 -0500 X-MC-Unique: gdRG-3ItPnab8vysSVe-jw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1B62886C043; Thu, 8 Dec 2022 21:53:10 +0000 (UTC) Received: from starship (unknown [10.35.206.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id AAF6040C2065; Thu, 8 Dec 2022 21:53:08 +0000 (UTC) Message-ID: <5476ef637f70def68b8f9ec50579d5580659fe9a.camel@redhat.com> Subject: Re: [PATCH v4 05/32] KVM: x86: Don't inhibit APICv/AVIC on xAPIC ID "change" if APIC is disabled From: Maxim Levitsky To: Sean Christopherson , Paolo Bonzini Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Alejandro Jimenez , Suravee Suthikulpanit , Li RongQing Date: Thu, 08 Dec 2022 23:53:07 +0200 In-Reply-To: <20221001005915.2041642-6-seanjc@google.com> References: <20221001005915.2041642-1-seanjc@google.com> <20221001005915.2041642-6-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 3.1 on 10.11.54.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 2022-10-01 at 00:58 +0000, Sean Christopherson wrote: > Don't inhibit APICv/AVIC due to an xAPIC ID mismatch if the APIC is > hardware disabled. The ID cannot be consumed while the APIC is disabled, > and the ID is guaranteed to be set back to the vcpu_id when the APIC is > hardware enabled (architectural behavior correctly emulated by KVM). > > Fixes: 3743c2f02517 ("KVM: x86: inhibit APICv/AVIC on changes to APIC ID or APIC base") > Cc: stable@vger.kernel.org > Signed-off-by: Sean Christopherson > --- > arch/x86/kvm/lapic.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c > index 5de1c7aa1ce9..67260f7ce43a 100644 > --- a/arch/x86/kvm/lapic.c > +++ b/arch/x86/kvm/lapic.c > @@ -2072,6 +2072,9 @@ static void kvm_lapic_xapic_id_updated(struct kvm_lapic *apic) > { > struct kvm *kvm = apic->vcpu->kvm; > > + if (!kvm_apic_hw_enabled(apic)) > + return; > + > if (KVM_BUG_ON(apic_x2apic_mode(apic), kvm)) > return; > Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky