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

Re: [Xen-devel] [PATCH] x86/mm: Make PV linear pagetables optional



On 10/18/2017 10:39 AM, Jan Beulich wrote:
>>>> On 17.10.17 at 19:10, <george.dunlap@xxxxxxxxxx> wrote:
>> --- a/docs/misc/xen-command-line.markdown
>> +++ b/docs/misc/xen-command-line.markdown
>> @@ -1422,6 +1422,22 @@ The following resources are available:
>>      CDP, one COS will corespond two CBMs other than one with CAT, due to the
>>      sum of CBMs is fixed, that means actual `cos_max` in use will 
>> automatically
>>      reduce to half when CDP is enabled.
>> +    
>> +### pv-linear-pt
>> +> `= <boolean>`
>> +
>> +> Default: `false`
> 
> This looks to be wrong now.
> 
>> --- a/xen/arch/x86/Kconfig
>> +++ b/xen/arch/x86/Kconfig
>> @@ -97,6 +97,27 @@ config TBOOT
>>        Technology (TXT)
>>  
>>        If unsure, say Y.
>> +
>> +config PV_LINEAR_PT
>> +       bool "Support for PV linear pagetables"
>> +       depends on PV
> 
> For this to look reasonable in a hierarchical menu, it should follow
> PV (with - if there were any - only other options also depending on
> PV in between) rather than being added at a random place.

AFAICT there's no way to select PV or HVM options in the menu at the
moment.  I could move this below the 'PV' option in case that should
ever change.

>> +       default y
>> +       ---help---
>> +         Linear pagetables (also called "recursive pagetables") refers
>> +     to the practice of a guest operating system having pagetable
> 
> The two lines above should match in how they're being indented.

Gah -- this isn't a .c file so my .c style isn't being applied.  Let me
see what I can do.

> 
>> --- a/xen/arch/x86/mm.c
>> +++ b/xen/arch/x86/mm.c
>> @@ -587,6 +587,12 @@ static void put_data_page(
>>          put_page(page);
>>  }
>>  
>> +#ifdef CONFIG_PV_LINEAR_PT
>> +static void zero_linear_entries(struct page_info *pg)
> 
> When framing multiple functions, I think it is better to have a blank
> line between #ifdef and first piece of code (as well as around the
> #else and prior to the #endif), and I think the #else and #endif
> would also benefit from having /* PV_LINEAR_PT */ or some such
> added on their lines.

Ack

> 
>> @@ -719,6 +735,20 @@ get_##level##_linear_pagetable(                         
>>                     \
>>                                                                              
>> \
>>      return 1;                                                               
>> \
>>  }
>> +#define LPT_ASSERT ASSERT
>> +#else
>> +#define define_get_linear_pagetable(level)                              \
>> +static int                                                              \
>> +get_##level##_linear_pagetable(                                         \
>> +        level##_pgentry_t pde, unsigned long pde_pfn, struct domain *d) \
>> +{                                                                       \
>> +        return 0;                                                       \
>> +}
>> +#define zero_linear_entries(pg)
>> +#define dec_linear_uses(pg)
>> +#define dec_linear_entries(pg)
> 
> Would perhaps be better if these evaluated their arguments.

Following Andy's suggestion I'm changing them to static inlines and
adding an ASSERT().

>> +#define LPT_ASSERT(x)
>> +#endif
>>  
>>  
>>  bool is_iomem_page(mfn_t mfn)
> 
> Could you arrange for the double blank lines to go away here with
> the blank line additions asked for above?

Ack

> 
>> @@ -2330,8 +2360,8 @@ static int _put_page_type(struct page_info *page, bool 
>> preemptible,
>>                   * necessary anymore for a dying domain.
>>                   */
>>                  ASSERT(page_get_owner(page)->is_dying);
>> -                ASSERT(page->linear_pt_count < 0);
>> -                ASSERT(ptpg->linear_pt_count > 0);
>> +                LPT_ASSERT(page->linear_pt_count < 0);
>> +                LPT_ASSERT(ptpg->linear_pt_count > 0);
> 
> Other than Andrew has suggested, with these I don't think
> LPT_ASSERT() can go away, unless you played tricks and forced
> the function's ptpg to be NULL regardless of caller, or unless you
> put the entire if() into an #ifdef.

Good point -- I'll see what I can do.

 -George

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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