[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 4/4] x86/spec-ctrl: Remove opencoded MSR_ARCH_CAPS check


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 22 May 2023 09:10:29 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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=hUMvqFL4iMCDcp5HMfniT+gD/ju1GWE6oPi/bHszLQw=; b=OKBnMFAcarvGCw8LXb2ktliP8dQloqApTFljT+gAM2LRwUuc40PLBsB22EE8AsN5xxLCXQx1kAOZTFei4IdVhSStw+zj0ygp1o9WtYR9z1qbVnnF6+MgdZaKpwO2nPCsFTGxl1pRZDeCUUtV8uWcrmhXgW0gdL7zE2Y6davcmmODlQqact66+3kGRLUO0lVvZhUzYbJ2Gz8WtR8sGotDijC6OXzE6tQ+/H8FwCL6W0GhZDVWs9Zc3sG5kEpKvOlZCS6swBb59c5dOtUnfybXc51s+5xzB2heevlsiRX2CKAB1dyOImv4Vta5YFzbF0raZJrWMKoF2/MzN/swfc3xwg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YlccuHh8rAaiZiaAoVBeQvI2zAht4UYBMvUb0DQScLgpq6KJLZEGxv6/hnlSZptGzkvfsZgbIZrrB5mQt+nDJLRI7QohFaCBFzcPyufKBZuDRoHsR/E1wcvR3swxEIjoW/DIUmeKtoSUcc8IrXwNLbseUv4xfSeobjNJDk//RRZGoZ1jXbeUmJklbjpE9P7qff/Qd3WKz39zbuHn3d/eundMCMwXWmbEUYUU480AeGWPzodom5TQSSQQlCvvWJiJ3Zhk4SX0O+LyVRcDbkueZNDgo0qb7E29RG5gQBvEDVOCdQBFsXvoCKEmZSGaXXB+mjEBzRnwsut8BaT2NSiLMQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 22 May 2023 07:11:08 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 19.05.2023 16:38, Andrew Cooper wrote:
> On 19/05/2023 7:00 am, Jan Beulich wrote:
>> On 17.05.2023 18:35, Andrew Cooper wrote:
>>> On 17/05/2023 3:47 pm, Jan Beulich wrote:
>>>> On 16.05.2023 16:53, Andrew Cooper wrote:
>>>>> @@ -401,6 +400,8 @@ static void __init print_details(enum ind_thunk 
>>>>> thunk, uint64_t caps)
>>>>>          cpuid_count(7, 2, &tmp, &tmp, &tmp, &_7d2);
>>>>>      if ( boot_cpu_data.extended_cpuid_level >= 0x80000008 )
>>>>>          cpuid(0x80000008, &tmp, &e8b, &tmp, &tmp);
>>>>> +    if ( cpu_has_arch_caps )
>>>>> +        rdmsrl(MSR_ARCH_CAPABILITIES, caps);
>>>> Why do you read the MSR again? I would have expected this to come out
>>>> of raw_cpu_policy now (and incrementally the CPUID pieces as well,
>>>> later on).
>>> Consistency with the surrounding logic.
>> I view this as relevant only when the code invoking CPUID directly is
>> intended to stay.
> 
> Quite the contrary.  It stays because this patch, and changing the
> semantics of the print block are unrelated things and should not be
> mixed together.

Hmm. On one hand I can see your point, yet otoh we move things in a longer
term intended direction in other cases where we need to touch code anyway.
While I'm not going to refuse to ack this change just because of this, I
don't fell like you've answered the original question. In particular I
don't see how taking the value from a memory location we've already cached
it in is changing any semantics here. While some masking may apply even to
the raw policy (to zap unknown bits), this should be meaningless here. No
bit used here should be unmentioned in the policy.

>>> Also because the raw and host policies don't get sorted until much later
>>> in boot.
>> identify_cpu(), which invokes init_host_cpu_policies(), is called
>> ahead of init_speculation_mitigations(), isn't it?
> 
> What is init_host_cpu_policies() ?

Oops. I did use my own tree as reference during review. See the long
pending "x86/xstate: drop xstate_offsets[] and xstate_sizes[]" [1]. Maybe
you simply didn't tell me yet ...

> I have a plan for what it's going to be if prior MSR work hadn't ground
> to a halt, but it's a bit too late for that now.
> 
> (To answer the question properly, no the policies aren't set up until
> just before building dom0, and that's not something that is trivial to
> change.)

... that what I'm doing there is too simplistic?

Jan

[1] https://lists.xen.org/archives/html/xen-devel/2021-04/msg01335.html



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.