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

Re: [PATCH 2/8] p2m-pt: Avoid hard-coding Xen's PAT


  • To: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 6 Dec 2022 12:10:51 +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=F4eBDWBRgj7UQ4odhOT2Orz0l9PloJ/4EeyaDRtqh2o=; b=NAf5mlcHWLJAkPtUsOvFC1X1oomnpkgfqwNMU88MXp49xmumkFWI5ZZ721SjTZ9u+o37XeKtcLi8LamIpvgNZdsTiS1PJoPSiih2Io8gg4y3K+ijlDWQjFAZcKxLLe60NIm2pfN3ox2WmCxn7BEFn+atybuqp3YLUjW/y3KHgvgGAbojuy6+RLt8bbQwfNewQftYJ5HHwcqgl8r1dexpDTVfeIFzq88hk+qkPqa/Usucd43pm3uwFnq0VqQFwDlE9nxGpC7wW5V858fmjcoLmZYsO5lbBvYdY5gV5MDVw2UCPxBKxwUO76Io+516EN36R2yZhRXEdaszV5zgbJ13uQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YgSe79hBPGM2UNim2Tv7dVd/a0dtGazZX7dbw8PouE1ak51c+slM2yF0EWI4On2Bkrw3I5pkdD9mh/vF2T9eFd5gwV6Cokzda+KoiaCm0OhNnHoGMTfP+uOuC/iNWRMkud8PTJvSCb8nWfijRKRC718i4K82N7wtr242+lVQUChOSWKfNA7kAbWbUxEl7h11BpV+Zr/eGUDTqEyiW3IBKYVDFWA79UyqP0d8MVHTS9fwL4vGATxo3055TJYpqfn2joWWtmeSLjsj0csvjhaCicQwONeC+mtikHvFN0JnwTg/HdpbWn7ze0xGakzfwgi/PTbfo0eAMkEI/4TCg7274A==
  • 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>, Demi Marie Obenour <demi@xxxxxxxxxxxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 06 Dec 2022 11:11:28 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 06.12.2022 11:59, Andrew Cooper wrote:
> On 06/12/2022 04:33, Demi Marie Obenour wrote:
>> This makes the code much easier to understand.
>>
>> Signed-off-by: Demi Marie Obenour <demi@xxxxxxxxxxxxxxxxxxxxxx>
>> ---
>>  xen/arch/x86/mm/p2m-pt.c | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/xen/arch/x86/mm/p2m-pt.c b/xen/arch/x86/mm/p2m-pt.c
>> index 
>> eaba2b0fb4e6830f52b7d112fba8175dfe6d2770..cd1af33b6772ab1016e8d4c3284a6bc5d282869d
>>  100644
>> --- a/xen/arch/x86/mm/p2m-pt.c
>> +++ b/xen/arch/x86/mm/p2m-pt.c
>> @@ -99,13 +99,13 @@ static unsigned long p2m_type_to_flags(const struct 
>> p2m_domain *p2m,
>>          return flags | P2M_BASE_FLAGS | _PAGE_RW | _PAGE_NX_BIT;
>>      case p2m_mmio_direct:
>>          if ( !rangeset_contains_singleton(mmio_ro_ranges, mfn_x(mfn)) )
>> -            flags |= _PAGE_RW;
>> +            flags |= _PAGE_RW | _PAGE_UCM;
>>          else
>>          {
>> -            flags |= _PAGE_PWT;
>> +            flags |= _PAGE_UC;
>>              ASSERT(!level);
>>          }
>> -        return flags | P2M_BASE_FLAGS | _PAGE_PCD;
>> +        return flags | P2M_BASE_FLAGS;
> 
> I agree that this is a correct transformation of the logic, but the
> logic cannot possibly be correct in the first place.
> 
> The read-only-ness of the MMIO range has no legitimate bearing on UC vs
> UC-.  I have a feeling this is another attempt to control mixed
> cacheability

I think so, yes - at the time the goal was to disallow cachability other
than the one used by Xen for those pages where we know Xen has a mapping.

Jan

> - the HVM side cleanup from XSA-402 is still very much pending.
> 
> I'm tempted to R-by and commit the patch, with a note in the commit
> message saying that the transformation is correct but that it highlights
> that the pre-existing logic is suspect.
> 
> ~Andrew




 


Rackspace

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