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

Re: [Xen-devel] [PATCH v8 14/15] xen: make grant table limits boot parameters dom0 only



On 20/09/17 14:07, Jan Beulich wrote:
>>>> On 20.09.17 at 08:34, <jgross@xxxxxxxx> wrote:
>> --- a/xen/arch/arm/domain_build.c
>> +++ b/xen/arch/arm/domain_build.c
>> @@ -2098,7 +2098,7 @@ static void __init find_gnttab_region(struct domain *d,
>>      kinfo->gnttab_size = (_etext - _stext) & PAGE_MASK;
>>  
>>      /* Make sure the grant table will fit in the region */
>> -    if ( (kinfo->gnttab_size >> PAGE_SHIFT) < max_grant_frames )
>> +    if ( grant_table_verify_size(d, kinfo->gnttab_size >> PAGE_SHIFT) )
>>          panic("Cannot find a space for the grant table region\n");
> 
> I can see how this may cause complications with my alternative
> proposal for the meaning of the command line options, but that's
> solvable for sure.
> 
>> @@ -3462,6 +3449,10 @@ grant_table_create(
>>      struct domain *d)
>>  {
>>      struct grant_table *t;
>> +    static unsigned int max_grant_frames;
>> +    static unsigned int max_maptrack_frames;
>> +    integer_param("gnttab_max_frames", max_grant_frames);
>> +    integer_param("gnttab_max_maptrack_frames", max_maptrack_frames);
>>  
>>      if ( (t = xzalloc(struct grant_table)) == NULL )
>>          return -ENOMEM;
>> @@ -3469,14 +3460,17 @@ grant_table_create(
>>      /* Simple stuff. */
>>      percpu_rwlock_resource_init(&t->lock, grant_rwlock);
>>      spin_lock_init(&t->maptrack_lock);
>> -    t->max_grant_frames = max_grant_frames;
>> -    t->max_maptrack_frames = max_maptrack_frames;
>>  
>>      /* Okay, install the structure. */
>>      d->grant_table = t;
>>  
>>      if ( d->domain_id == 0 )
>> +    {
>> +        t->max_grant_frames = max_grant_frames ? : 
>> DEFAULT_MAX_NR_GRANT_FRAMES;
>> +        t->max_maptrack_frames =
>> +                           max_maptrack_frames ? : 
>> DEFAULT_MAX_MAPTRACK_FRAMES;
>>          return grant_table_init(t);
>> +    }
> 
> The use here makes it that in effect the two variables could then
> become __initdata. Maybe their definition should then even move
> here (if the other proposal would be discarded).

Is it possible in the hypervisor to access __initdata variables from non
__init functions? In the Linux kernel this is forbidden.

>> +bool __init grant_table_verify_size(struct domain *d, unsigned int frames)
> 
> const

Yes.


Juergen


_______________________________________________
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®.