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 38152ECAAD8 for ; Wed, 31 Aug 2022 06:07:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230027AbiHaGHW (ORCPT ); Wed, 31 Aug 2022 02:07:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229599AbiHaGHU (ORCPT ); Wed, 31 Aug 2022 02:07:20 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D62E9AFD4 for ; Tue, 30 Aug 2022 23:07:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661926038; 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=28ym5xn5CncpI4sc7VXIv13Zg85Y3cioTTzu0mfpAeI=; b=c++KBbk8rdjZPyKwmDrS8d/6mAUouMZqLapYb1J3KCYd7ckdesQh1EEnJhaAP/BbDSHofw CaqBZUaB8Qet6A7e/4pQl3WJMZIvuOd7Vs1eeF6Il1HVh2Wb3I6GICxvD/Lqy/l6JyExOE 5H651q4sZJA1Cw5+T1LuysxmYvG9fYk= 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-633-fuK6VMlWONKxGmZlQLnjvQ-1; Wed, 31 Aug 2022 02:07:15 -0400 X-MC-Unique: fuK6VMlWONKxGmZlQLnjvQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BDD0F811E80; Wed, 31 Aug 2022 06:07:14 +0000 (UTC) Received: from starship (unknown [10.40.194.96]) by smtp.corp.redhat.com (Postfix) with ESMTP id 26F69141512E; Wed, 31 Aug 2022 06:07:12 +0000 (UTC) Message-ID: Subject: Re: [PATCH 19/19] Revert "KVM: SVM: Do not throw warning when calling avic_vcpu_load on a running vcpu" From: Maxim Levitsky To: Sean Christopherson , Paolo Bonzini Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Suravee Suthikulpanit , Li RongQing Date: Wed, 31 Aug 2022 09:07:11 +0300 In-Reply-To: <20220831003506.4117148-20-seanjc@google.com> References: <20220831003506.4117148-1-seanjc@google.com> <20220831003506.4117148-20-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.85 on 10.11.54.7 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2022-08-31 at 00:35 +0000, Sean Christopherson wrote: > Turns out that some warnings exist for good reasons. Restore the warning > in avic_vcpu_load() that guards against calling avic_vcpu_load() on a > running vCPU now that KVM avoids doing so when switching between x2APIC > and xAPIC. The entire point of the WARN is to highlight that KVM should > not be reloading an AVIC. > > Opportunistically convert the WARN_ON() to WARN_ON_ONCE() to avoid > spamming the kernel if it does fire. > > This reverts commit c0caeee65af3944b7b8abbf566e7cc1fae15c775. > > Signed-off-by: Sean Christopherson > --- > arch/x86/kvm/svm/avic.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/x86/kvm/svm/avic.c b/arch/x86/kvm/svm/avic.c > index b2033a56010c..3c300113d40b 100644 > --- a/arch/x86/kvm/svm/avic.c > +++ b/arch/x86/kvm/svm/avic.c > @@ -1080,6 +1080,7 @@ void avic_vcpu_load(struct kvm_vcpu *vcpu, int cpu) > return; > > entry = READ_ONCE(*(svm->avic_physical_id_cache)); > + WARN_ON_ONCE(entry & AVIC_PHYSICAL_ID_ENTRY_IS_RUNNING_MASK); > > entry &= ~AVIC_PHYSICAL_ID_ENTRY_HOST_PHYSICAL_ID_MASK; > entry |= (h_physical_id & AVIC_PHYSICAL_ID_ENTRY_HOST_PHYSICAL_ID_MASK); Note that this warning was removed because it would trigger wheh x2avic code would switch between xapic and x2apic. I do agree 100% that this warning is useful. Best regards, Maxim Levitsky