Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1730969rwb; Thu, 8 Dec 2022 14:40:33 -0800 (PST) X-Google-Smtp-Source: AA0mqf6muL9JvuqZyCk+kIGylAhfu6VoRqn5+eLK0XrsR5XrjiEYrgUkUKvoINv0iHE0yWFM3cm+ X-Received: by 2002:a17:906:5ad2:b0:7c1:98e:ed20 with SMTP id x18-20020a1709065ad200b007c1098eed20mr2985378ejs.35.1670539232852; Thu, 08 Dec 2022 14:40:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670539232; cv=none; d=google.com; s=arc-20160816; b=hWaq1Jg675qC43PIBvslvJkkip97FHmsmn7FM5fJoOGvozRDX72o610hmRD308xnqA EUmKNUTlZ3uBmrVXtaTmV/tOriDKMQu5eVNfOKBX2GghY97iXCPprccE+tirawio/nJS RZMylxJ0+dCzC/VeduB45mb9ati9OPjJb4FZXWAHLgJdliKjRC5tbquPBj3Vwt32tmyu Lh0gRNL4rE5nmEDUYf/ICNXsPsS6EKwjjowImmmRmnyP0bSYcx9ukM55iU9GgTJG7fBC Vo/OH36lk47IZYIoA5jMeoI9JjN+DvM2WA1a6QBqNbI3COfzNYjQ0ubWYy8yC8jrXXCc sJ7Q== 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=W56nw/gVQin27dLjIPTk42vv2xQm3EpOtvU1wsvTbig=; b=nn9jM2gPduicNqhcCsrbuqV68G0Ya+5sLZOnyg9Hxq2JnTc+XgpOAyCgS4rhffdidP XgZpkuFZ9228nh3hR0QmCAUu23ubh3I6OtYamJu9Apr+carfph6sn4h8CdAuuiOdXVuY 9aV1iF1617aVs+RFRLCcBrqa7w39FwwGTzzE2zpkaSmLqc5pwNcZj0IfvAub73AYDWUJ jUwiYdBIh4VeRuLhgF5bDrKvHoaBaMCsSyMfah9l5++h3XwWXKIB/Mcu+5bNbKONKzKX IWLafI7CDuK5vCC2eIqrO/OG8I8jsGjUzeYgS1dXItMCR9cl6RgH6PlbPXcYLFnFNUlP omjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TfOV7LIq; 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 qo14-20020a170907874e00b007a00aaf659csi14298387ejc.198.2022.12.08.14.40.15; Thu, 08 Dec 2022 14:40:32 -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=TfOV7LIq; 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 S230158AbiLHWDw (ORCPT + 73 others); Thu, 8 Dec 2022 17:03:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230150AbiLHWDY (ORCPT ); Thu, 8 Dec 2022 17:03:24 -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 4427779C15 for ; Thu, 8 Dec 2022 14:01:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1670536870; 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=W56nw/gVQin27dLjIPTk42vv2xQm3EpOtvU1wsvTbig=; b=TfOV7LIqtlZEyIt61IyASBtsYMqymteUudxdVvihCyW22Jl9WWDbm+vVxslbyKqplPf0rG ZxdIhENgNRqj4mSUB1+VqsnfsNJEkziOvGXwImFeTXV40eCxfUgPYMCJCjXq0STKWpIKwT EAL81e0DEo07ePBBCF94MseoYSmm1C0= 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-534-hDh6gXq-MZGItvwgjMpRbQ-1; Thu, 08 Dec 2022 17:01:07 -0500 X-MC-Unique: hDh6gXq-MZGItvwgjMpRbQ-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 B136686C15F; Thu, 8 Dec 2022 22:01:06 +0000 (UTC) Received: from starship (unknown [10.35.206.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1FADA40C6EC2; Thu, 8 Dec 2022 22:01:04 +0000 (UTC) Message-ID: <85ae65b205612d7a65f3ebfb58c7e8205efe7cfa.camel@redhat.com> Subject: Re: [PATCH v4 31/32] 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, Alejandro Jimenez , Suravee Suthikulpanit , Li RongQing Date: Fri, 09 Dec 2022 00:01:04 +0200 In-Reply-To: <20221001005915.2041642-32-seanjc@google.com> References: <20221001005915.2041642-1-seanjc@google.com> <20221001005915.2041642-32-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.2 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=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 Sat, 2022-10-01 at 00:59 +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 953b1fd14b6d..35b0ef877e53 100644 > --- a/arch/x86/kvm/svm/avic.c > +++ b/arch/x86/kvm/svm/avic.c > @@ -1038,6 +1038,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); Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky