* Re: xen/pvh linux: Use ballooning to allocate grant table pages
@ 2013-02-07 10:54 Dan Carpenter
2013-02-08 23:50 ` Mukesh Rathor
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2013-02-07 10:54 UTC (permalink / raw)
To: mukesh.rathor; +Cc: kbuild, xen-devel
Hello Mukesh Rathor,
The patch 40f633eb0def: "xen/pvh linux: Use ballooning to allocate
grant table pages" from Jan 31, 2013, leads to the following Sparse
warning: "drivers/xen/grant-table.c:1095:28: error: bad constant
expression"
drivers/xen/grant-table.c
1092 static int xlated_setup_gnttab_pages(int numpages, void **addr)
1093 {
1094 int i, rc;
1095 unsigned long pfns[numpages];
1096 struct page *pages[numpages];
^^^^^^^^
Because the kernel uses an 8k stack if this is over 500 it will cause
a kernel crash. It will crash before we reach 500 actually. It looks
like typical values for this are around 4 so we're probably safe, but
it's still a bit nasty.
1097
1098 rc = alloc_xenballooned_pages(numpages, pages, 0);
1099 if (rc != 0) {
1100 pr_warn("%s Could not balloon alloc %d pfns rc:%d\n", __func__,
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: xen/pvh linux: Use ballooning to allocate grant table pages
2013-02-07 10:54 xen/pvh linux: Use ballooning to allocate grant table pages Dan Carpenter
@ 2013-02-08 23:50 ` Mukesh Rathor
2013-02-09 5:02 ` Dan Carpenter
0 siblings, 1 reply; 3+ messages in thread
From: Mukesh Rathor @ 2013-02-08 23:50 UTC (permalink / raw)
To: Dan Carpenter; +Cc: kbuild, xen-devel, Konrad Rzeszutek Wilk
On Thu, 7 Feb 2013 13:54:25 +0300
Dan Carpenter <dan.carpenter@oracle.com> wrote:
> Hello Mukesh Rathor,
>
> The patch 40f633eb0def: "xen/pvh linux: Use ballooning to allocate
> grant table pages" from Jan 31, 2013, leads to the following Sparse
> warning: "drivers/xen/grant-table.c:1095:28: error: bad constant
> expression"
>
> drivers/xen/grant-table.c
> 1092 static int xlated_setup_gnttab_pages(int numpages, void
> **addr) 1093 {
> 1094 int i, rc;
> 1095 unsigned long pfns[numpages];
> 1096 struct page *pages[numpages];
> ^^^^^^^^
> Because the kernel uses an 8k stack if this is over 500 it will cause
> a kernel crash. It will crash before we reach 500 actually. It looks
> like typical values for this are around 4 so we're probably safe, but
> it's still a bit nasty.
>
> 1097
> 1098 rc = alloc_xenballooned_pages(numpages, pages, 0);
> 1099 if (rc != 0) {
> 1100 pr_warn("%s Could not balloon alloc %d pfns
> rc:%d\n", __func__,
>
> regards,
> dan carpenter
Hi Dan,
Yeah, I know. Currently, there is a hard max on num of grant pages to
32, but on average are lot less. So I think it should be OK. Konrad, do
you still want me to change it to kmalloc?
Thanks
Mukesh
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: xen/pvh linux: Use ballooning to allocate grant table pages
2013-02-08 23:50 ` Mukesh Rathor
@ 2013-02-09 5:02 ` Dan Carpenter
0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2013-02-09 5:02 UTC (permalink / raw)
To: Mukesh Rathor; +Cc: kbuild, xen-devel, Konrad Rzeszutek Wilk
On Fri, Feb 08, 2013 at 03:50:43PM -0800, Mukesh Rathor wrote:
> On Thu, 7 Feb 2013 13:54:25 +0300
> Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> > Hello Mukesh Rathor,
> >
> > The patch 40f633eb0def: "xen/pvh linux: Use ballooning to allocate
> > grant table pages" from Jan 31, 2013, leads to the following Sparse
> > warning: "drivers/xen/grant-table.c:1095:28: error: bad constant
> > expression"
> >
> > drivers/xen/grant-table.c
> > 1092 static int xlated_setup_gnttab_pages(int numpages, void
> > **addr) 1093 {
> > 1094 int i, rc;
> > 1095 unsigned long pfns[numpages];
> > 1096 struct page *pages[numpages];
> > ^^^^^^^^
> > Because the kernel uses an 8k stack if this is over 500 it will cause
> > a kernel crash. It will crash before we reach 500 actually. It looks
> > like typical values for this are around 4 so we're probably safe, but
> > it's still a bit nasty.
> >
> > 1097
> > 1098 rc = alloc_xenballooned_pages(numpages, pages, 0);
> > 1099 if (rc != 0) {
> > 1100 pr_warn("%s Could not balloon alloc %d pfns
> > rc:%d\n", __func__,
> >
> > regards,
> > dan carpenter
>
> Hi Dan,
>
> Yeah, I know. Currently, there is a hard max on num of grant pages to
> 32, but on average are lot less. So I think it should be OK. Konrad, do
> you still want me to change it to kmalloc?
If there is a hard limit then it should be ok.
The place where dynamically allocated arrays are forbiden is inside
loops. On some arches the stack memory isn't freed until the end of
the function.
regards,
dan carpenter
>
> Thanks
> Mukesh
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-02-09 5:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-07 10:54 xen/pvh linux: Use ballooning to allocate grant table pages Dan Carpenter
2013-02-08 23:50 ` Mukesh Rathor
2013-02-09 5:02 ` Dan Carpenter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.