Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp594867iob; Wed, 18 May 2022 08:47:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwO/7cngLI+PBQfaDtw+auQ1kUHtinpkoFeSgywt3/FqedwSJUBl7kRtRwf3IIubWaw9pby X-Received: by 2002:a05:6a00:1a12:b0:512:6f59:f5cf with SMTP id g18-20020a056a001a1200b005126f59f5cfmr221596pfv.45.1652888820975; Wed, 18 May 2022 08:47:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652888820; cv=none; d=google.com; s=arc-20160816; b=pD6VTiMRRMl4BoeWVfAPyJjtiPumIVoaBZuJK8Y0clnmng55LhIETEN0W5tM8vI8Rd NLH61JXUg+ufM0FpBEtPocappy4mUFph6QwtgqwHECz5U+AxHWXcyoW8+qGG6uMTCvcQ I2we4gyFqP+kthVHrfBc4OvwVwXuiBWrgviuI4RRpyEOuVE/h5D//YuEBzuFktGxQRtY U4heVHjLry30fEUy9halbpOSkIXrJGQ6WoqpfOB4LR+OD8yYuesxESZ2Tg3XSSU6WLz6 FrFdtkOyMC4XB9MYYLVRSZmgVWke1RymZxDFD0szKPylnNOuhW0B4oXNR8crwEwEPmRl VMyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Z/HMrrvCFWNmAHmvXNwS49dfDiOpl1n+gYXOKnIc4zI=; b=ZlSOBRUk9ExJjimXaV6xwnZcu3M9QeN7c93+o0DzX34Ih0cJEJb/NJW1edQodPHNnR 6eZg1WDm2sjqnNDSVUwhkdCbgJ1kb79qTRo0jGzwp+mts7r0oF2MyH/D7LVwmogmFiDZ ecsFx7V5Cc+11waZIw53G2/jv4c+31elzTmmFe5yPs5MreeUGCkbB3azzWo+z7Y5aHzg Yx+Uz3MIMX1UGmsccHRU2S907lI4q2PJX74DMpb1L1UOEDmjq7eLZB5SSLXawmMvCW4P 95wXBOU8Wt4yb6ZBeHQy8k05fRsY/NBdw9kiRl/ZWP/fVal7sYZs8ya8CRLZafvPjko0 eoyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="dar/R+iw"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id bc3-20020a170902930300b0016196bc9c75si3030172plb.74.2022.05.18.08.47.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 May 2022 08:47:00 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="dar/R+iw"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4BB5217A8A; Wed, 18 May 2022 08:40:48 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239485AbiERPjo (ORCPT + 99 others); Wed, 18 May 2022 11:39:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239459AbiERPjg (ORCPT ); Wed, 18 May 2022 11:39:36 -0400 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1B2FAFB1D for ; Wed, 18 May 2022 08:39:35 -0700 (PDT) Received: by mail-pl1-x633.google.com with SMTP id n18so2138856plg.5 for ; Wed, 18 May 2022 08:39:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Z/HMrrvCFWNmAHmvXNwS49dfDiOpl1n+gYXOKnIc4zI=; b=dar/R+iwJh6De/GxHOwX6pHMbcfNFw2VosEiMVS9rUR0uhV04veQWjUvNn1Um9Mals wRoCyapdixfM61qMc2HADICJWAjNnbA0wtGr+uJWt1QyWrw8PNXt7Yv4NGDLvF2Gd909 XcWfnB1NhBE0JV5FT3WZn8Q7ynTgoH7QPo1cYLo2usyEG3DmpqGOF4Wvrv4j9nv286VG lcdB7BWKcl6xOcJUlig3kblVxHP0L0b6ubldhuv/9M5eUxiQc66zPE9PTz5a6oeBRpRm cN/wh3MpbOvQlWkpL/q6/zoIwYwptqGj6VxyDCscWcLs6MIpRyajD/xgVpEZAEStq968 ahlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Z/HMrrvCFWNmAHmvXNwS49dfDiOpl1n+gYXOKnIc4zI=; b=IiVSUhMy0Pm7spda8HUf52OG0qBufqYXs8WJ/U4D85xguIlEHn+mZdUoAq4/jrEMZW TdZ/PYz5fCGV/PyCaaLhSu3C2ETvO1fAVOM99CbzFWDEldiE4qKcqeUrlb9XNVhdh/I7 xFvK8ADcQSXGIL6rrAjZ4NuW8nzYjNEUkvf58MP3/UpTB3oh2o0D6quTqr22tMJ2xzfU kTUKNa72XFeW9DPY99GFHPO6FXxxxyrBWGrILuoaZ0r4sdcbkfPSCVGROYdUgelYxBjQ Uj6jGwaLY0EKDqtCo0OythHlbmONoXWX01mnWSKTAItLTbgCCixCoPQtswZhPDyZFVki PG9g== X-Gm-Message-State: AOAM530d40V0o86Kem8KmyBP1FE8IoDjzuy0WKRPXx+UuEJW8hBdp4rf YyZd+tEAz5rL3OAfjRBrkBz8GQ== X-Received: by 2002:a17:902:f814:b0:161:505d:a4f4 with SMTP id ix20-20020a170902f81400b00161505da4f4mr318446plb.6.1652888374834; Wed, 18 May 2022 08:39:34 -0700 (PDT) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id gv3-20020a17090b11c300b001da160621d1sm1671704pjb.45.2022.05.18.08.39.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 May 2022 08:39:34 -0700 (PDT) Date: Wed, 18 May 2022 15:39:30 +0000 From: Sean Christopherson To: Maxim Levitsky Cc: Chao Gao , kvm@vger.kernel.org, Wanpeng Li , Vitaly Kuznetsov , Jani Nikula , Paolo Bonzini , Tvrtko Ursulin , Rodrigo Vivi , Zhenyu Wang , Joonas Lahtinen , Tom Lendacky , Ingo Molnar , David Airlie , Thomas Gleixner , Dave Hansen , x86@kernel.org, intel-gfx@lists.freedesktop.org, Daniel Vetter , Borislav Petkov , Joerg Roedel , linux-kernel@vger.kernel.org, Jim Mattson , Zhi Wang , Brijesh Singh , "H. Peter Anvin" , intel-gvt-dev@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: Re: [RFC PATCH v3 02/19] KVM: x86: inhibit APICv/AVIC when the guest and/or host changes apic id/base from the defaults. Message-ID: References: <20220427200314.276673-1-mlevitsk@redhat.com> <20220427200314.276673-3-mlevitsk@redhat.com> <20220518082811.GA8765@gao-cwp> <8c78939bf01a98554696add10e17b07631d97a28.camel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8c78939bf01a98554696add10e17b07631d97a28.camel@redhat.com> X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=no 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, May 18, 2022, Maxim Levitsky wrote: > On Wed, 2022-05-18 at 16:28 +0800, Chao Gao wrote: > > > struct kvm_arch { > > > @@ -1258,6 +1260,7 @@ struct kvm_arch { > > > hpa_t hv_root_tdp; > > > spinlock_t hv_root_tdp_lock; > > > #endif > > > + bool apic_id_changed; > > > > What's the value of this boolean? No one reads it. > > I use it in later patches to kill the guest during nested VM entry > if it attempts to use nested AVIC after any vCPU changed APIC ID. Then the flag should be introduced in the later patch, because (a) it's dead code if that patch is never merged and (b) it's impossible to review this patch for correctness without seeing the usage, e.g. setting apic_id_changed isn't guarded with a lock and so the usage may or may not be susceptible to races. > > > + apic->vcpu->kvm->arch.apic_id_changed = true; > > > +} > > > +