Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp172217rwe; Wed, 31 Aug 2022 00:08:28 -0700 (PDT) X-Google-Smtp-Source: AA6agR7a5YbXc+hN8CCSqfnihVfhOPuXAP+n/UJp8A5bh3djmai0Gx/TOgxTc7TZKnYvOZtG+CFb X-Received: by 2002:a17:902:bd08:b0:16d:4230:cb45 with SMTP id p8-20020a170902bd0800b0016d4230cb45mr24560544pls.59.1661929708262; Wed, 31 Aug 2022 00:08:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661929708; cv=none; d=google.com; s=arc-20160816; b=dvowIXiSAGtSXRH/3HK+18Qn7llUupBDGEMK39uWI96vQDFCkyxf/1z6J5WNJFtwpS VGys1OziKLEJQEDaM6SR32fYoVB+TLjhtFa8DwsfG22S/lbk6tYXrhWfCll3MUVLd9Ow LD9K6OyyyRXnEgK4Apruabrf8JrCk9KaAQGMHQ7fJHPfp8A9QqJeQ3h3Q8ZUNBbw2C2l LsfUNRH8Z20OAvGxqdtfVYJWAuDELRed2uSauve3x3R3zqS1vBseM3Wl9s9tQ8zyR+Bj TlGZ7oJJr+tO7FpSEcBSYXP+wZ2jCgMzxA2IrHoRTgQzLjkFcwll8Cpg/kW0BffXqy1K GVEw== 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=F4hkpM3t1SPDuL+oYdpd1nLRpbIa0E4FQzXvygiJGl0=; b=ciV/c3HSBIt7I7MSFxuW2EPWFSYlO5Eip8jXi42Bpf7e/sm7eGHC4/e9ZQO430LvRv SSJVVAMMEHdFbvRFDQuK5aJwVn2zDQkTUyw8iwnPvUERIRGB+sshY4iQMcUXR0Epa5aM bBWwtlNocGwjThMYPO0bf/V4GWO65TrWKCbCgArJ783sexbrPsBZdKDAVHREfGzmlQCk Z+bh4cTkw9wLUKByVbqbYPVbEluVS+/D8KKqfyXwcs4QAyqLUIwOjaF2NRZcE2xPiZS7 cFnS8VUrAtONOfVQfizMKSOWlqcuTQzi/rc4v7USQ05nAGJjdKpmqvQZTLfjML16Mnw0 ZCVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bs6t5ctz; 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 j32-20020a635520000000b00403f98eb964si3941969pgb.202.2022.08.31.00.08.16; Wed, 31 Aug 2022 00:08:28 -0700 (PDT) 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=bs6t5ctz; 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 S230399AbiHaHDz (ORCPT + 99 others); Wed, 31 Aug 2022 03:03:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230335AbiHaHDw (ORCPT ); Wed, 31 Aug 2022 03:03:52 -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 60782BB01E for ; Wed, 31 Aug 2022 00:03:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661929429; 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=F4hkpM3t1SPDuL+oYdpd1nLRpbIa0E4FQzXvygiJGl0=; b=bs6t5ctzhPWN31Jxh82uC74a/U4xDdOd5WRSsGLu9Z4+tTCbF0pyEsIFCcwUfYYgl+9An0 K/kGkh5GKwLan800O8ngEYrKplZbDQuMOq8IRpAeV9HUoYIK2ayug0CZK4ogSYN1cBwR2k tLK7fElFWmSr8DZUFngTlzW4dr/3yvA= 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-657-kCVIJ8jZOO-kl_vEArdlUg-1; Wed, 31 Aug 2022 03:03:46 -0400 X-MC-Unique: kCVIJ8jZOO-kl_vEArdlUg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 134EC3C0CD3C; Wed, 31 Aug 2022 07:03:46 +0000 (UTC) Received: from starship (unknown [10.40.194.96]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5EED84010E3C; Wed, 31 Aug 2022 07:03:44 +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 10:03:43 +0300 In-Reply-To: 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.84 on 10.11.54.2 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Wed, 2022-08-31 at 09:07 +0300, Maxim Levitsky wrote: > 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. Ah I see that you fixed the apic reloading to not trigger this code, need more coffee - in this case this patch makes lot of sense. I'll review it again when I review rest of the patches in the patch series. Best regards, Maxim Levitsky > > Best regards, > Maxim Levitsky