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

Re: [PATCH 7/8] x86/mm: make code robust to future PAT changes


  • To: Demi Marie Obenour <demi@xxxxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 7 Dec 2022 10:41: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=aKSEHUhX2jtai0/iJM5juOrzpSze192SuhzIki+6c6Q=; b=Riync7m2t/Gnk/pEJqPj6MfcoP7mpmlC1FNt2AkySXwinXX7oSs2vHh6y2VzvnDyO/6dQ6U48I4SMfZ+J7sv2Jv+QZgPsG8rWY9kH/SF/6fODCuMW23PRb8oPQNc7NzanUovx93xi7cvtly8T9DXelvn0xzeTvNA5zyKZxta5aeY2npE0etLn0mllkPXsjeUVjIPRCfHArTxSECSFrWYbCfZ2nOtqywePqECqZl75dwgmlpL+zk2Cmj67yK1BFt0oNnei37Ena8VQyocxgNBULFeYRGSUU+Jbu3nnOBHRps+tDTGzCOwzw5CsWGO0A8nT+HWRpXYFbFn/g5d+8VrVw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AdKr9S46yXlcswAuNviYRmf9P7AjjywmLs8o+kVptuoBdMWvvVwlM6BCvxgzHwCovUrR1fXQmhGqIcEHCHLOexHtplE0ouymJDvDid09LLq23I0IkMWs516cAYu0wsKSRQB6sO1DKoA/ycLcv5SR0Uk+CpPoip4X3O8zE0bsE6SdHf7gqPHtpbhvxTtN4GcSYizJJSj0wUbZWhCHUTDRQOs5YLObDwoifcOTpZXdwuQIODveNvbwJaZPTnUBqGXqBS2ar0wU79fn2rUE+c4V/SG7srismh5L+0aY5Ppqrivi6ZLECOrkZOA8KFQx13D0z7y5grHIoTRdW0QG8KOIKw==
  • 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>, Roger Pau Monne <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, George Dunlap <George.Dunlap@xxxxxxxxxx>, "Tim (Xen.org)" <tim@xxxxxxx>, Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Wed, 07 Dec 2022 09:41:19 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 06.12.2022 18:55, Demi Marie Obenour wrote:
> On Tue, Dec 06, 2022 at 12:06:24PM +0000, Andrew Cooper wrote:
>> On 06/12/2022 04:33, Demi Marie Obenour wrote:
>>> @@ -961,13 +1000,24 @@ get_page_from_l1e(
>>>  
>>>          switch ( l1f & PAGE_CACHE_ATTRS )
>>>          {
>>> -        case _PAGE_WB:
>>> +        default:
>>> +#ifndef NDEBUG
>>> +            printk(XENLOG_G_WARNING
>>> +                   "d%d: Guest tried to use bad cachability attribute %u 
>>> for MFN %lx\n",
>>> +                   l1e_owner->domain_id, l1f & PAGE_CACHE_ATTRS, mfn);
>>
>> %pd.  You absolutely want to convert the PTE bits to a PAT value before
>> priniting (decimal on a PTE value is useless), and %PRI_mfn.
> 
> I’ll have to look at the rest of the Xen tree to see how to use this.
> 
>>> +            pv_inject_hw_exception(TRAP_gp_fault, 0);
>>
>> As I said on IRC, we do want this, but I'm not certain if we can get
>> away with just enabling it in debug builds.  _PAGE_GNTTAB was ok because
>> it has always been like that, but there's a non-trivial chance that
>> there are existing dom0 kernels which violate this constraint.
> 
> I chose this approach because it is very simple to implement.  Anything
> more complex ought to be in a separate patch, IMO.
> 
>>> +            return -EINVAL;
>>> +#endif

As to "complex": Just the "return -EINVAL" would be yet less complex.
Irrespective of the remark my understanding of Andrew's response is that
the concern extends to the error return as well.

Jan



 


Rackspace

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