|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v3 14/14] libxl: build a device tree for ARM guests
On Thu, 2013-11-07 at 17:47 +0000, Ian Jackson wrote:
> Ian Campbell writes ("Re: [PATCH v3 14/14] libxl: build a device tree for ARM
> guests"):
> > On Thu, 2013-11-07 at 17:30 +0000, Ian Jackson wrote:
> > > > + if (fdt_size) {
> > > > + fdt_size <<= 1;
> > > > + LOG(DEBUG, "Increasing FDT size to %zd and retrying",
> > > > fdt_size);
> > > > + } else {
> > > > + fdt_size = 4096;
> > > > + }
> > >
> > > Can we rule out this loop getting out of control ?
> >
> > The FDT macro has a check and error if it gets too big. I'll see about
> > moving the <<= into the macro, which I suspect will seem more natural
> > with a loop called "retry".
>
> Oh, please don't do that. I much prefer to keep anything out of a
> macro that doesn't have to be there.
OK.
> The fdt_size increase is part of the loop control. Now you can't put
> it inside the for(;;) brackets but putting it at the top of the loop
> will make it nice and obvious.
>
> Personally I normally do something like this
> fdt_size += 4096;
> fdt_size <<= 2;
> which avoids the if (fdt_size). The only downside is that the
> answers aren't uniformly powers of 2.
TBH I could just go with += and avoid the <<=, I don't actually expect
an FDT to be so large that exponentially increasing size is that
important.
How would
for(fdt_size = 4096; fdt_size < FDT_SIZE_MAX; fdt_size <<= 2)
and use continue on error in the macro, with a break at the bottom of
the loop (success) sit with you?
Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |