diff mbox series

tools/xenstore: set maximum number of grants needed

Message ID 20200924143648.27861-1-jgross@suse.com (mailing list archive)
State New, archived
Headers show
Series tools/xenstore: set maximum number of grants needed | expand

Commit Message

Jürgen Groß Sept. 24, 2020, 2:36 p.m. UTC
When running as a stubdom Xenstore should set the maximum number of
grants needed via a call of xengnttab_set_max_grants(), as otherwise
the number of domains which can be supported will be 128 only (the
default number of grants supported by Mini-OS).

Signed-off-by: Juergen Gross <jgross@suse.com>
---
This is a backport candidate IMO.
---
 tools/xenstore/xenstored_domain.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Wei Liu Sept. 30, 2020, 3:14 p.m. UTC | #1
On Thu, Sep 24, 2020 at 04:36:48PM +0200, Juergen Gross wrote:
> When running as a stubdom Xenstore should set the maximum number of
> grants needed via a call of xengnttab_set_max_grants(), as otherwise
> the number of domains which can be supported will be 128 only (the
> default number of grants supported by Mini-OS).
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>
> ---
> This is a backport candidate IMO.
> ---
>  tools/xenstore/xenstored_domain.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c
> index 06359503f0..f740aa02f5 100644
> --- a/tools/xenstore/xenstored_domain.c
> +++ b/tools/xenstore/xenstored_domain.c
> @@ -630,6 +630,8 @@ void domain_init(void)
>  	*xgt_handle = xengnttab_open(NULL, 0);
>  	if (*xgt_handle == NULL)
>  		barf_perror("Failed to open connection to gnttab");
> +	/* Allow max number of domains for mappings. */
> +	xengnttab_set_max_grants(*xgt_handle, DOMID_FIRST_RESERVED);

Why DOMID_FIRST_RESERVED as the count argument? Is the expectation here
xenstored maps one grant per domain?

Wei.

>  
>  	talloc_set_destructor(xgt_handle, close_xgt_handle);
>  
> -- 
> 2.26.2
>
Jürgen Groß Sept. 30, 2020, 3:23 p.m. UTC | #2
On 30.09.20 17:14, Wei Liu wrote:
> On Thu, Sep 24, 2020 at 04:36:48PM +0200, Juergen Gross wrote:
>> When running as a stubdom Xenstore should set the maximum number of
>> grants needed via a call of xengnttab_set_max_grants(), as otherwise
>> the number of domains which can be supported will be 128 only (the
>> default number of grants supported by Mini-OS).
>>
>> Signed-off-by: Juergen Gross <jgross@suse.com>
>> ---
>> This is a backport candidate IMO.
>> ---
>>   tools/xenstore/xenstored_domain.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c
>> index 06359503f0..f740aa02f5 100644
>> --- a/tools/xenstore/xenstored_domain.c
>> +++ b/tools/xenstore/xenstored_domain.c
>> @@ -630,6 +630,8 @@ void domain_init(void)
>>   	*xgt_handle = xengnttab_open(NULL, 0);
>>   	if (*xgt_handle == NULL)
>>   		barf_perror("Failed to open connection to gnttab");
>> +	/* Allow max number of domains for mappings. */
>> +	xengnttab_set_max_grants(*xgt_handle, DOMID_FIRST_RESERVED);
> 
> Why DOMID_FIRST_RESERVED as the count argument? Is the expectation here
> xenstored maps one grant per domain?

Yes. This is the theoretical maximum.


Juergen
Wei Liu Sept. 30, 2020, 3:28 p.m. UTC | #3
On Wed, Sep 30, 2020 at 05:23:58PM +0200, Jürgen Groß wrote:
> On 30.09.20 17:14, Wei Liu wrote:
> > On Thu, Sep 24, 2020 at 04:36:48PM +0200, Juergen Gross wrote:
> > > When running as a stubdom Xenstore should set the maximum number of
> > > grants needed via a call of xengnttab_set_max_grants(), as otherwise
> > > the number of domains which can be supported will be 128 only (the
> > > default number of grants supported by Mini-OS).
> > > 
> > > Signed-off-by: Juergen Gross <jgross@suse.com>
> > > ---
> > > This is a backport candidate IMO.
> > > ---
> > >   tools/xenstore/xenstored_domain.c | 2 ++
> > >   1 file changed, 2 insertions(+)
> > > 
> > > diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c
> > > index 06359503f0..f740aa02f5 100644
> > > --- a/tools/xenstore/xenstored_domain.c
> > > +++ b/tools/xenstore/xenstored_domain.c
> > > @@ -630,6 +630,8 @@ void domain_init(void)
> > >   	*xgt_handle = xengnttab_open(NULL, 0);
> > >   	if (*xgt_handle == NULL)
> > >   		barf_perror("Failed to open connection to gnttab");
> > > +	/* Allow max number of domains for mappings. */
> > > +	xengnttab_set_max_grants(*xgt_handle, DOMID_FIRST_RESERVED);
> > 
> > Why DOMID_FIRST_RESERVED as the count argument? Is the expectation here
> > xenstored maps one grant per domain?
> 
> Yes. This is the theoretical maximum.
> 

In that case:

Acked-by: Wei Liu <wl@xen.org>

I will also add that information to the commit message.

> 
> Juergen
Andrew Cooper Sept. 30, 2020, 3:30 p.m. UTC | #4
On 30/09/2020 16:28, Wei Liu wrote:
> On Wed, Sep 30, 2020 at 05:23:58PM +0200, Jürgen Groß wrote:
>> On 30.09.20 17:14, Wei Liu wrote:
>>> On Thu, Sep 24, 2020 at 04:36:48PM +0200, Juergen Gross wrote:
>>>> When running as a stubdom Xenstore should set the maximum number of
>>>> grants needed via a call of xengnttab_set_max_grants(), as otherwise
>>>> the number of domains which can be supported will be 128 only (the
>>>> default number of grants supported by Mini-OS).
>>>>
>>>> Signed-off-by: Juergen Gross <jgross@suse.com>
>>>> ---
>>>> This is a backport candidate IMO.
>>>> ---
>>>>   tools/xenstore/xenstored_domain.c | 2 ++
>>>>   1 file changed, 2 insertions(+)
>>>>
>>>> diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c
>>>> index 06359503f0..f740aa02f5 100644
>>>> --- a/tools/xenstore/xenstored_domain.c
>>>> +++ b/tools/xenstore/xenstored_domain.c
>>>> @@ -630,6 +630,8 @@ void domain_init(void)
>>>>   	*xgt_handle = xengnttab_open(NULL, 0);
>>>>   	if (*xgt_handle == NULL)
>>>>   		barf_perror("Failed to open connection to gnttab");
>>>> +	/* Allow max number of domains for mappings. */
>>>> +	xengnttab_set_max_grants(*xgt_handle, DOMID_FIRST_RESERVED);
>>> Why DOMID_FIRST_RESERVED as the count argument? Is the expectation here
>>> xenstored maps one grant per domain?
>> Yes. This is the theoretical maximum.
>>
> In that case:
>
> Acked-by: Wei Liu <wl@xen.org>
>
> I will also add that information to the commit message.

And the comment if possible please.  That's where it will be most useful
to the next person doing a doubletake at this code.  :)

~Andrew
Wei Liu Sept. 30, 2020, 3:31 p.m. UTC | #5
On Wed, Sep 30, 2020 at 04:30:16PM +0100, Andrew Cooper wrote:
> On 30/09/2020 16:28, Wei Liu wrote:
> > On Wed, Sep 30, 2020 at 05:23:58PM +0200, Jürgen Groß wrote:
> >> On 30.09.20 17:14, Wei Liu wrote:
> >>> On Thu, Sep 24, 2020 at 04:36:48PM +0200, Juergen Gross wrote:
> >>>> When running as a stubdom Xenstore should set the maximum number of
> >>>> grants needed via a call of xengnttab_set_max_grants(), as otherwise
> >>>> the number of domains which can be supported will be 128 only (the
> >>>> default number of grants supported by Mini-OS).
> >>>>
> >>>> Signed-off-by: Juergen Gross <jgross@suse.com>
> >>>> ---
> >>>> This is a backport candidate IMO.
> >>>> ---
> >>>>   tools/xenstore/xenstored_domain.c | 2 ++
> >>>>   1 file changed, 2 insertions(+)
> >>>>
> >>>> diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c
> >>>> index 06359503f0..f740aa02f5 100644
> >>>> --- a/tools/xenstore/xenstored_domain.c
> >>>> +++ b/tools/xenstore/xenstored_domain.c
> >>>> @@ -630,6 +630,8 @@ void domain_init(void)
> >>>>   	*xgt_handle = xengnttab_open(NULL, 0);
> >>>>   	if (*xgt_handle == NULL)
> >>>>   		barf_perror("Failed to open connection to gnttab");
> >>>> +	/* Allow max number of domains for mappings. */
> >>>> +	xengnttab_set_max_grants(*xgt_handle, DOMID_FIRST_RESERVED);
> >>> Why DOMID_FIRST_RESERVED as the count argument? Is the expectation here
> >>> xenstored maps one grant per domain?
> >> Yes. This is the theoretical maximum.
> >>
> > In that case:
> >
> > Acked-by: Wei Liu <wl@xen.org>
> >
> > I will also add that information to the commit message.
> 
> And the comment if possible please.  That's where it will be most useful
> to the next person doing a doubletake at this code.  :)

Yes sure.

Wei.

> 
> ~Andrew
diff mbox series

Patch

diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c
index 06359503f0..f740aa02f5 100644
--- a/tools/xenstore/xenstored_domain.c
+++ b/tools/xenstore/xenstored_domain.c
@@ -630,6 +630,8 @@  void domain_init(void)
 	*xgt_handle = xengnttab_open(NULL, 0);
 	if (*xgt_handle == NULL)
 		barf_perror("Failed to open connection to gnttab");
+	/* Allow max number of domains for mappings. */
+	xengnttab_set_max_grants(*xgt_handle, DOMID_FIRST_RESERVED);
 
 	talloc_set_destructor(xgt_handle, close_xgt_handle);