[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 4/4] amd/virt_ssbd: add to max HVM policy when SSB_NO is available
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
- Date: Thu, 13 Oct 2022 16:06:52 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=xi17J4/zjM9vCnKOawrM8zHpxGTKfT8tBrMmDc9pbf4=; b=fAzwtTHPe5Dcmo1FA7N1ZjNYTTrKRdoh+brQF59AkIsTbdDBitGTZ1HYlibb9GUVmhGBTc7rSANwPNajJx4yxQI1lrFZsySzT3t1B0BK2iMzl3ALOcQDFiALOXdlxPZb/u2FyFiVeLqGUe9SLg4uNmV1ON7lOvgtN/i0BHku5NkXbrmNBBsP+tbUznyZSIDv1OzRLC2L3d9Bgxd0Ej9/xVgxyks1xhG7z3Af6n4ysk35pyyIgmC6AAHDD47QIiFBF8bKbQMTv1m48SGrEjRHg0S07cAnFlU/WBxAiMM/e1xc/HP7YX7d59Tv6eVwtL+/fz4Iu42D7ez5V6d+lEBhFg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bgIVmSgVnDeKp3F1s25BW4SF/tTGtDKSJKGSLHtUY5kblCtMrNjLxQWcTQyy9Pwui9SZ8tauUD3G9YFjp+DD0V/DbvvZzdvvi/Gtwv5Q5bHa3/BZGjsJaqx83LFPoOTjk3L/GwFnaXwaNkH8ZUaP2gUdc7xKndnWQYfPhk1dhcd3mG5T4tcMGALmcXcYykR41A9hK8h2ZPF6mcBOJ92Cv+QjfMhgkdj9yHGcQgzOS9zZLEzNrE2T00QzYw3NCnQ/yA5RTwWWuNktSigxqzJcTFdacscnISuUqtqGteoby7euyWzPpt5NCEeSjAAMC77Xw+dFxjZhK8BqfrOp+58lDg==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
- Cc: Henry.Wang@xxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
- Delivery-date: Thu, 13 Oct 2022 14:07:34 +0000
- Ironport-data: A9a23:xdZ6Aamhti0ZMzB16356vDno5mJPLRPFfQ1M2KgaY13mRzABGkScWkptc8ngYBzUGyFykm/wyE+D3Ja0mr1dQsJyx8xlu9CrOUd/HK08XwqWoLOrNI02NE6BQa63M8AfmJr28CW4dSCZRVBU63lCgdePy/uRw4lT/srhmdHUsbwFvVfPADaDYqCXPgBffYrCDdtKEVkUXj0hex0Xd8LxH1mq/hZPdPMcpX5Y5McrtK+KKX8AXinVOor7AgYLjevKvMUMW2qEDGndgTYAwcqGKrUvgNmIL8D1b0o/5cJcG9q0P0pFE4zpvuhBQzsMrTc2gmC5OLlALa4M8OpLvG68zUFgSGQljKRabI/d82Pz7kAfE2svRoHt/h2FZgt7vAYbcOV+fP9cbyPoLvPq5IXqPecN6lEgfFAA29LPPrWSVZnIjwwKjEtCWs6EwaKrspLaO4OCAvS3giYDcl6SKUeW4x+aEB8ybZNIfsIzQcHJZbSFelBjeaJyIxRrT0EA5NQzOQqitDc6BnrMvjW6nEp4xmIYnBVcQlOT2em5zz0O7klQiuEN2nLdD967amaF7vAPLdm2OM03xMZSyK1D0yBuWsYn+2oGa4PnHR8AkLCmeNB9pzjnqPRDSoPrdwFrn/7OxdidS0IP5IPSHa4ubtqKuvYeQVeevU3QeHCunQSwRfeKwPB81XkbffNUsUt1242i3rS9dAL4jIre59fd6ro2R7oWT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P56EpgCvh2qjsgYvpiXmMgB8DWFCrKsxb/TIX+hGVlOZ5hiv2Ti5Ljq5rr1zpLBjcFouHvDovdfvNjiiFQHNB2wcXjdt3HfBmudjbLQofT73arQ47BxNqGTRRAqRtO+3uEafQ8q8uK3X8dGtNAMmZ5Sb2CtQ8OB8R7GpKT2mIZ3pQKKvGikhIxj0MtfGpfp/c/aNYFQ7DvrUSPfOR1/7XRfJFHx8qquRJSE6QOKpNb/RYY1gsoBQMAKKm1BoohEJpYLeN10nx9xXvB5Nd5BPauBKVkgPHjqJadb6eILhbskhm+23lK67vhrDUWXQZzUV37qnxB7IodpSQEo0iFlO7vv4cJCYoZU3YLtLHR/5dzopx4IE3Gt6HCSz0VqcK54DIaikHFG1tKYQdBIyfvBPIGlQI43AP1AertdAhlDkvGdMAPB7CDLgbzKNPzjxbInhm+6pI0/Wa5cd7bqenV8kOFq2egr378C/N1bBVX68n8FkyJYt8qRA/XcmLndeEzZrW+Aaqhlve5XVpG7P1QFCcX46nVNKynxgS0R0xd4+OrtEf3wdLBYB+D+lELkVLg63q0vGF4+HnvZi+NqvAgyeT6kppJGPs2LNIhudkB6BVqpeEghFrJnAkYUkt+wxwT6hkWlcsGQ==
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On Wed, Oct 12, 2022 at 10:36:57AM +0200, Jan Beulich wrote:
> On 11.10.2022 18:02, Roger Pau Monne wrote:
> > --- a/xen/arch/x86/cpu/amd.c
> > +++ b/xen/arch/x86/cpu/amd.c
> > @@ -814,7 +814,9 @@ void amd_set_ssbd(bool enable)
> > wrmsr(MSR_VIRT_SPEC_CTRL, enable ? SPEC_CTRL_SSBD : 0, 0);
> > else if ( amd_legacy_ssbd )
> > core_set_legacy_ssbd(enable);
> > - else
> > + else if ( cpu_has_ssb_no ) {
>
> Nit: While already an issue in patch 1, it is actually the combination
> of inner blanks and brace placement which made me spot the style issue
> here.
Oh, indeed, extra spaces.
> > + /* Nothing to do. */
>
> How is the late placement here in line with ...
>
> > --- a/xen/arch/x86/cpuid.c
> > +++ b/xen/arch/x86/cpuid.c
> > @@ -558,11 +558,16 @@ static void __init calculate_hvm_max_policy(void)
> > __clear_bit(X86_FEATURE_IBRSB, hvm_featureset);
> > __clear_bit(X86_FEATURE_IBRS, hvm_featureset);
> > }
> > - else if ( boot_cpu_has(X86_FEATURE_AMD_SSBD) )
> > + else if ( boot_cpu_has(X86_FEATURE_AMD_SSBD) ||
> > + boot_cpu_has(X86_FEATURE_SSB_NO) )
> > /*
> > * If SPEC_CTRL.SSBD is available VIRT_SPEC_CTRL.SSBD can be
> > exposed
> > * and implemented using the former. Expose in the max policy only
> > as
> > * the preference is for guests to use SPEC_CTRL.SSBD if available.
> > + *
> > + * Allow VIRT_SSBD in the max policy if SSB_NO is exposed for
> > migration
> > + * compatibility reasons. If SSB_NO is present setting
> > + * VIRT_SPEC_CTRL.SSBD is a no-op.
> > */
> > __set_bit(X86_FEATURE_VIRT_SSBD, hvm_featureset);
>
> ... this comment addition talking about "no-op"?
We need the empty `else if ...` body in order to avoid hitting the
ASSERT, but a guest setting VIRT_SPEC_CTRl.SSBD on a system that has
SSB_NO will not result in any setting being propagated to the
hardware. I can make that clearer. In any case I'm unable to test
the patch because there's no hw with the feature that I'm aware of.
Thanks, Roger.
|