[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: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Mon, 22 May 2023 15:14:17 +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:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=iXDCI8hGzOzqJwY/J8wzbDgmUQRsgCSILaSDg0F0HzE=; b=oJ592Alg1lUL62fFoaRVUM7wimjRje0iFYxbbJZeB+Jiy81GO1IkwLrq3eQYFcNr7BObPK1TcUHQ0SJJpKTV6Qy2LHMBdNJ8YfGq9N6STviVLaECFNXIjPYgdT0eepYZiXczCWUpNPYPHbAzMok/fv257JqguOUtY2yOfsA65uoz0f369gWe/a5S0LicVY2Fg1XmvzH4QxybbbG+FAy3G+UcQKZwBKbhkALdEA0RLVKD6DHOGErT+ORK8b7M4Rl43HeldEBjW9Qy3+TxRUsnxGQIb34KhxlUWRM7bcHvnrWiYI0xVc2kw2P/0r7ieUV+kHJhQ6ldZ005FenozQF7Ow==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Awo3VaTwwS3sUZqLpuXDJOASPXhNmN5u1FFnKCyDuVczZsNv+WI8lAE8d/JlFcjz9Y/Zok8pIJdGYinDhcSOP/1/L7+hCnnCzekk3QHSkTzXRVAjapSH0Ve5j73Nt+tkhbNClQXtDcwya6MGe9fqgD9zDjZ9rjSKxHued/qKG9d3JBk7yRQ088CufZkV1hw0YlczsFerkjoVqxJUApgxszvNAlP2Q+1vRBCVa4aAuetvI6/Jw39aj4XV+IG5yXceDa9ad4L0PlFS7i374EcK2Wha65Di4LrH6Wp8Tc1LwMmkxt3+1rUGdegVU/hPG0n3BCXkFuSHeGodO0YUgkEa8w==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 22 May 2023 14:15:03 +0000
  • Ironport-data: A9a23:ngfITKlXbRJ/KyNtYPjGInLo5gytJ0RdPkR7XQ2eYbSJt1+Wr1Gzt xIYDDiGO/uMYGH1c9t1bt+2/B5S68SExoJgQQplpCkwESMWpZLJC+rCIxarNUt+DCFhoGFPt JxCN4aafKjYaleG+39B55C49SEUOZmgH+a6U6icfHgqH2eIcQ954Tp7gek1n4V0ttawBgKJq LvartbWfVSowFaYCEpNg064gE0p5KyaVA8w5ARkPqgW5gWGzhH5MbpETU2PByqgKmVrNrbSq 9brlNmR4m7f9hExPdKp+p6TnpoiG+O60aCm0xK6aoD66vRwjnVaPpUTbZLwXXx/mTSR9+2d/ f0W3XCGpaXFCYWX8AgVe0Ew/yiTpsSq8pefSZS0mZT7I0Er7xIAahihZa07FdRwxwp5PY1B3 aEGC2gpagGvvMC364m5T+9Fu5gBcNa+aevzulk4pd3YJdAPZMmaBonvu5pf1jp2gd1SF/HDY cZfcSBocBnLfxxIPBEQFY46m+CrwHL4dlW0qnrM/fZxvzeVkVM3iee2WDbWUoXiqcF9t0CUv G/ZuU/+BQkXLoe3wjuZ6HO8wOTImEsXXapLTefjp68z3AX7Kmo7GhQuZQWF+seCzUe3YINCF ldN93IehP1nnKCsZpynN/Gim1aGtBMBX9tbE8Uh9RqAjKHT5m6xGWwsXjNHLts8u6ceVTEsk 1OEgd7tLThuq6GOD2KQ8K+OqjG/MjRTKnUNDRLoViMA6tjn5Y020BTGS486FLbv14KuXzbt3 zqNsS4ywa0JitIG3Lm6+laBhC+wop/OTUg+4QC/sn+Z0z6VrbWNP+SAgWU3J94bd+51knHpU KA4pvWj
  • Ironport-hdrordr: A9a23:8fCIUqyDWGyGN9P2kzzxKrPxMegkLtp133Aq2lEZdPULSKGlfp GV9sjziyWetN9wYh4dcB67SdC9qADnhPlICO4qTMqftWjdyRGVxeRZgbcKrAeQeBEWmtQtsJ uINpIOc+EYbmIK8/oSgjPZLz9I+rDunsGVbKXlvg9QpGlRGt5dBmxCe2Km+yNNNW977NYCZf ihDp0tnUvdRZ1bVLXyOpFDNNKz1eHjpdbDW1orFhQn4A6BgXeB76P7KQGR2lMzQi5C2rAr9E nCikjc6r+4u/+25xfA3yuLhq4m1OfJ+59mPoihm8IVIjLjhkKBY5lgYaSLuHQYsfyi81Ejlf jLulMFM95o433cU2mpqV/G2hXm0hwp93j+oGXozEfLkIjcfnYXGsBBjYVWfl/w7Fchhsh11O Zu03iCv5RaIBvclGCljuK4HS1Cpw6Rmz4PgOQTh3tQXc83b6JQl5UW+AdwHI0bFCz3xYg7GK 1FDd3a5txRbVSGBkqp9VVH8ZiJZDAeDx2GSk8Ntoi81CVXpmlwyw8iyMkWjh47heUAYqgBw9 6BHrVjlblIQMNTR7l6Hv09Tcy+DXGIaQ7QMUqJSG6XVJ0vCjbokdra8b817OaldNgj150pgq nMV1teqCobZ1/uM8uTx5dGmyq9AVlVZQ6diP222qIJ/4EVHNHQQGm+oREV4oWdSswkc47ms6 3ZAuMQPxfhRVGebbqhkTeOHaW6EkNuI/H9iuxLKm5mnfi7WrECltarBso7d4CdWAoMayfYPk YpegTVCYFp0n2LM0WI9SQ5HUmdNXDCwQ==
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 22/05/2023 8:10 am, Jan Beulich wrote:
> 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.

The very next thing I'm going to need to do is start synthesizing arch
caps bits for the hardware with known properties but without appropriate
enumerations.  This is necessary to make migration work.

Because we have not taken a decision about the what printed block means,
it needs to not change when I start using setup_force_cpu_cap().

>>>> 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?

Raw is fine.  I found complexities with Host when doing that.

~Andrew



 


Rackspace

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