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

Re: [PATCH v2 3/3] x86: Add support for CpuidUserDis


  • To: Alejandro Vallejo <alejandro.vallejo@xxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 11 May 2023 14:49:15 +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=gQr4reaGCJlX4uKI3hEcVgTD1SfoXUe/v5PK4yMw4vI=; b=P5qrgFAGO7s35CdEIx9Syac03d/Ueg87iTe1AoDQKuJr6fYljg7D1TjDVLYl1VyfBcYaxOp5nciJGacl/MQ1h5rlSjAxRS0E7fgRgUePUoklUVo/3rS17lL2GYnRFgRoeo+QS8yiMfEC1+ec/bAhW+Rk8uejfDlDHiLelIbttGZyXNBIfih1OUcv8qFB5qBAuv/kwIZeyVLfljkksDILZli7HtKeidxHebHIfvT4sUKzts0WbsYWH+LX2PzV7aszV2meHoKQBCJCn/ZYZlf1t2HaICQyWD4CUtLRhg6NLojpI2Rx21xlwicjvgnKhP2fOfOKukRQHn+GqNXn9fplGg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X2+81VKc7/LcpK5BjKBRNN9DH0YIygbDezTzyJ5pIWX4NC7QqdfpchBgM0whqe/Rm1XWc1l2Z/ACoFIW3o11AyqDblk4BBCB1MVqd9wmWrpjcK+1b4k24+MK88HDPdo5mXnb8ltCH8/lkGRNNWuYncgebw38Bt9JZZfHrHns+aXbCvxNsEotTcxnlCyZnbS7Zefu5mzKM3zaU2tI7CsIUMDa3bctK1YT8m5avVK8xOEVqq0aMuSW45wjhNZK6Dm3j43AO8WAZcvQF4ZvIhvIon2pt+XkFrqVe2AOwNTe7M5+fHqh8J1JyREUX4bPUSpTdNT1WsLMAtFdEuNm+X5IVQ==
  • 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: Thu, 11 May 2023 12:49:33 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 11.05.2023 14:12, Alejandro Vallejo wrote:
> On Thu, May 11, 2023 at 01:05:42PM +0200, Jan Beulich wrote:
>>> --- a/xen/arch/x86/cpu/amd.c
>>> +++ b/xen/arch/x86/cpu/amd.c
>>> @@ -279,8 +279,12 @@ static void __init noinline amd_init_levelling(void)
>>>      * that can only be present when Xen is itself virtualized (because
>>>      * it can be emulated)
>>>      */
>>> -   if (cpu_has_hypervisor && probe_cpuid_faulting())
>>> +   if ((cpu_has_hypervisor && probe_cpuid_faulting()) ||
>>> +       boot_cpu_has(X86_FEATURE_CPUID_USER_DIS)) {
>>
>> ... imo the probe_cpuid_faulting() call would better be avoided when
>> the CPUID bit is set.
> 
> I wrote it like that originally. However, it felt wrong to leave
> raw_policy.platform_info unset, as it's set inside probe_cpuid_faulting().
> While it's highly unlikely a real AMD machine will have CPUID faulting
> support, Xen might see both if it's itself virtualized under Xen.
> 
> The crux of the matter here is whether we want the raw policy to be an
> accurate representation of _all_ the features of the machine (real or
> virtual) or we're ok with it not having features we don't intend to use in
> practice. It certainly can be argued either way. CpuidUserDis naturally
> gets to the policy through CPUID leaf enumeration, so that's done
> regardless.
> 
> My .02 is that raw means uncooked and as such should have the actual
> physical features reported by the machine, but I could be persuaded either
> way.

I think I would be okay if that was (in perhaps slightly abridged form)
made part of the description (or if the code comment there said so, then
also preventing someone [like me] coming and re-ordering the conditional).

Nevertheless having raw_policy populated like this seems a little fragile
in the first place. Andrew - any particular thoughts from you in this
regard?

Jan



 


Rackspace

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