[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] x86/amd: Introduce and use X86_BUG_NULL_SEG
- To: Jan Beulich <jbeulich@xxxxxxxx>, Pu Wen <puwen@xxxxxxxx>
- From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
- Date: Wed, 8 Sep 2021 16:52:27 +0100
- 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; bh=cqjBOhqeeDex+h7447RBggMUvcd6fvUwsbvwQzNF4rI=; b=NeBl3B70lWpQgYMHd/9POp6o2reksvto2E1vOYKjDyKVJ5XUH6ipqY6+39Rez+2J8v3UpUqXwMCy0BBFrymM0RgmPaRXFyM9VntItV1DRFal2DEtMUaC657ME6MOvxLOBDd8+jFXlBvOaODVw32aNFWxSYa51fYP6Z/JugjmLgkrPGxPjd8dwg/hfojxJyUsPNe4NKMyg11obYMJAb/rzU0Afz4U2zXXR+pmSy5wQ3gtGJZm+JaCG66USLLsDnhR+LpUV2qJSck7sUk3FZiEmhyZLYSnqoQI0yTv2njhPAYxqqPp4w3YosbXNlucq/7ZD8MgIHVj1rOY9F9pyMP5xg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mKwTmdsHdGRC6HSo8ExStgLb3rLxfm/41Z6FehcPI+OajPCBikiq3QMlNogZ9Zai8eCE9bNj/tQ/yGM3jKvfIJXxVxMERzcXHp0mojErmM69RGYjLdSWr+a29xH6HXNyOGMpo4rACVxCF597KzkCJsKWler9zycLTbXFRngBZ+yq93atI5FXdMKi1hsXl4p8qXM44S6Zz99S0gAg4dC8jgGHxrsk4wBxsoqpoQtmSuiopFaVUA/kBjDtsAufBJhCeBOsdfwJjxq0hGBZ4QNJyhYmGa5m6Fsu1pWsao4flyJGrVV17B0ecxVLm6jBTkttG2wc608iaUsmjis3I7NLCA==
- Authentication-results: esa6.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
- Cc: Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- Delivery-date: Wed, 08 Sep 2021 15:52:47 +0000
- Ironport-hdrordr: A9a23:3fe38a7LKKbwfIBpKwPXwKvXdLJyesId70hD6qkXc3xom62j9v xG885x6faZslwssRIb9+xoWpPtfZq0z/cc3WB7B9iftWfd1VeVEA==
- Ironport-sdr: dyUNGmK3EyFGR/8cEav43aTX3GNY1ZUNZ5FobnGGBq3NfBFiED8ViNb/416gxE+Sf1LW75pwAO esmZow9MpEHL4r7pzhPKUvup9q2J1Xlww+HKnONjqX0tCtogzCW7i/pIb5jSPU10QIHwnS1+8m bRVIbM1F/P6THVfQnLKpcVKZgV4uiGiYS6oup3fbihjBRSRulp3Z9EfiLSCP4k6TTPO4RrQxrO B1e6tYDxMpNzVGFOqb+ZCgKPzQZUvJhkjTPKQCXPL1MFrK28bqTV3OogM3TsjabipvbQ+ORpwN oSYpwaQsAYllfUQDMhYhw/i1
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 08/09/2021 16:06, Jan Beulich wrote:
> On 08.09.2021 15:59, Andrew Cooper wrote:
>> AMD/Hygon processors before the Zen2 microarchitecture don't clear the base
>> or
>> limit fields when loading a NULL segment.
>>
>> Express the logic in terms of cpu_bug_null_seg, and adjust the workaround in
>> do_set_segment_base().
>>
>> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
Thanks.
> albeit with a question (perhaps to Pu):
>
>> --- a/xen/arch/x86/cpu/hygon.c
>> +++ b/xen/arch/x86/cpu/hygon.c
>> @@ -40,6 +40,13 @@ static void init_hygon(struct cpuinfo_x86 *c)
>> c->x86 == 0x18)
>> detect_zen2_null_seg_behaviour();
>>
>> + /*
>> + * Hygon CPUs before Zen2 don't clear segment bases/limits when
>> + * loading a NULL selector.
>> + */
>> + if (c == &boot_cpu_data && !cpu_has_nscb)
>> + setup_force_cpu_cap(X86_BUG_NULL_SEG);
> Are there any affected CPUs in reality?
Yes - the Hygon Zen1 uarch CPUs are affected.
>
> And actually (only noticing when seeing the malformed context
> above) there look to be indentation issues in the changes to
> both this file and amd.c.
Ah yes - I'll fix on commit.
~Andrew
|