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

Re: [PATCH v4 02/10] x86/mm: Avoid hard-coding PAT in get_page_from_l1e()


  • To: Demi Marie Obenour <demi@xxxxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 16 Dec 2022 08:46:36 +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=KozOlaVwm4ZSiH5TUzXqtRoo4M5Y8JY11JQYlZ3cV7o=; b=QlJ+CmfF8xF0RT2hhqS3mHxv8cJ/zsmnXRwUdm98jUAP+kR8lkANEK8A4Nhll5GcpRxTrkglagKgtct7QzA7WflERcin6gvzxrFZV7DmMQ4+G7M6uYEvnunKgE1+OJb8RCQka95bggrX3vxtT9+Q7A7c6SV2hqTxvKZuAtzJmXV7HHaNgXoOwm+9Zj0JrxvkAnlL6IQRLMFgxGmzWFNXJMNmvlah6h+VamKEWSCRSVFJqpH/H3c7JIWUy+foJ8DMC+gpcoKMIYdP1XxSnGk9nOHB7uLuVuGsolL97RW3KgY71GnU6Zx4oPJ983BzuM5Ik01uDxKIgZ127/xX7diZXg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OrGz+PS25lMN1jKa4ab6oock/cwsFagyBsFP5R6145PBcPJd6MnLEwB7XVeH2wVbPBRF9wSRnTq302U1wqnL+n6vvcUFFNNiLTVfqut7FBiau/FRpHqGwFJ6DMYK5RLaDvxw+z1QlVRAJzuI978oek/K5V2DGcvufEJMiq/8TtNmvt+3ykpxbTdICII9lW3+Cdx7Duk0UOqO+fVG1ThsxbWRXBIuzAldhVNZcpZBYFKeG824MHBeSc2lCaUodOcGpA7zyqMEVpR6+M9E4vmg9QV7hsFOjVbmuNjlwotkeYM01celOoP1emhb3V3KOYY+1ETVNHi5A2fYlB+KbjYhvA==
  • 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: Fri, 16 Dec 2022 07:46:42 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 16.12.2022 03:25, Demi Marie Obenour wrote:
>> --- a/xen/arch/x86/include/asm/processor.h
>> +++ b/xen/arch/x86/include/asm/processor.h
>> @@ -100,6 +100,14 @@
>>  
>>  #ifndef __ASSEMBLY__
>>  
>> +/* Convert from PAT/PCD/PWT embedded in PTE flags to actual cacheability 
>> value */
>> +static inline unsigned int pte_flags_to_cacheability(unsigned int flags)
>> +{
>> +    unsigned int pat_shift = ((flags & _PAGE_PAT) >> 2) |
>> +                             (flags & (_PAGE_PCD|_PAGE_PWT));
> 
> This could also be written as
> 
>     unsigned int pat_shift = pte_flags_to_cacheattr(flags) << 3;
> 
> which might be easiser to read.

Indeed. And then also be placed next to the other function (provided
we want this to be a globally visible helper in the first place).
But first of all Andrew's comment wants addressing - if the code
using this new helper is to be deleted, then the new helper doesn't
need getting into proper shape and place.

Jan



 


Rackspace

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