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

Re: [PATCH v5 08/10] x86/mm: make code robust to future PAT changes


  • To: Demi Marie Obenour <demi@xxxxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 22 Dec 2022 11:03:06 +0100
  • 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=+mgYqquBmVdXPJenKon82tBCG5zaN6dmlRekcDrR1xs=; b=k7y54b+qUZQK/kVdwjDHHNBftUHotB/TP3y11byWpYqm9XoYoZ2PKMqB03Db9EU/1J1uPnVXKIOkA3/PuAuwSIBk91/1OmoEhJ/Ha8gU8zUo6FmktjoQpVBb+ABNJQ/XO5UI9pxWBTm0Ope2sU9kZu5T1nJaM5MrCjR8E9P/QQVNnOgD1RKVYhQbkTCX4oRyKeuaRrxSg+stWp/Jdfz+nG/78NmGvvAghKM3z+lfuXigJkP3zgIkAmHkw2XwUwoNBK45WdreXwvydSLxCUlp6ung1l723W8whfI4uTMrGSIV/YC5U8vyy5yK/B26/mlyz/Kyd/LE6DCljiDmv9iiHQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nn7WAwtQKHWJH3hiNUvNI05hMRVtaJ3FsvQILYWTdtcOg2E0MFAPihtEZPDwUx4Avh7s+8QW0FU0d5v8lv/Ov8kiyJ71+ohfCGVDl44K3rGUeDNHwfjsYfE6e0QQql90gwUgWOs2yt2s+7kry4szHWk3CHsOGrBIoX7ig6HDZyVdbtVZBueErmxB1B8fOoRUNEdiZV8flMv/KnzS2E/P/tBTPZ+e7schICNHI8Do/T4VsuBmQQPBlaMSNi7ibKqt/VdXp9xJVlKaiUb/IeEQv+f3uLjxDMK/N5W+RDhfLTweJe/MOa4R05zViM/o6y2yattSRhRMXUky31c5lhW11A==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Jun Nakajima <jun.nakajima@xxxxxxxxx>, Kevin Tian <kevin.tian@xxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Tim Deegan <tim@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 22 Dec 2022 10:03:15 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 22.12.2022 11:00, Demi Marie Obenour wrote:
> On Thu, Dec 22, 2022 at 10:54:48AM +0100, Jan Beulich wrote:
>> On 22.12.2022 10:50, Demi Marie Obenour wrote:
>>> On Thu, Dec 22, 2022 at 10:35:08AM +0100, Jan Beulich wrote:
>>>> On 20.12.2022 02:07, Demi Marie Obenour wrote:
>>>>> @@ -6361,6 +6366,72 @@ static void __init __maybe_unused 
>>>>> build_assertions(void)
>>>>>       * using different PATs will not work.
>>>>>       */
>>>>>      BUILD_BUG_ON(XEN_MSR_PAT != 0x050100070406ULL);
>>>>> +
>>>>> +    /*
>>>>> +     * _PAGE_WB must be zero for several reasons, not least because Linux
>>>>> +     * assumes it.
>>>>> +     */
>>>>> +    BUILD_BUG_ON(_PAGE_WB);
>>>>
>>>> Strictly speaking this is a requirement only for PV guests. We may not
>>>> want to go as far as putting "#ifdef CONFIG_PV" around it, but at least
>>>> the code comment (and then also the part of the description referring
>>>> to this) will imo want to say so.
>>>
>>> Does Xen itself depend on this?
>>
>> With the wording in the description I was going from the assumption that
>> you have audited code and found that we properly use _PAGE_* constants
>> everywhere.
> 
> There could be other hard-coded uses of magic numbers I haven’t found,
> and _PAGE_WB is currently zero so I would be quite surpised if no code
> in Xen omits it.  Linux also has a BUILD_BUG_ON() to check the same
> thing.

Fair enough - please adjust description and comment text accordingly then.

Jan



 


Rackspace

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