[libvirt] [PATCH v5 06/13] conf: Introduce address caching for PCI extensions

Andrea Bolognani abologna at redhat.com
Wed Sep 12 10:37:09 UTC 2018


On Wed, 2018-09-12 at 16:34 +0800, Yi Min Zhao wrote:
> 在 2018/9/12 下午3:35, Yi Min Zhao 写道:
> > > This makes sense and seems to work just fine; however, you are
> > > allocating and releasing a bunch of small integers, which seems
> > > a bit wasteful.
> > > 
> > > vircgroup is AFAICT avoiding all that extra memory management by
> > > stuffing the values straight into the pointers themselves, which
> > > you should also be able to do since the biggest legal ID is a
> > > 32-bit integer.
> > > 
> > > That said, I haven't been able to get that to actually work, at
> > > least with a quick attempt :( Would you mind exploring that route
> > > and figuring out whether it's feasible at all?
> > 
> > I'm testing this. Actually I wanted to do so like vircgroup. I 
> > remembered there's
> > error due to the previous code logic. I will reply to you later. 
> 
> I remebered the reason and test again. FID might be 0. It is treated as 
> an error
> if we save 0 in void* pointer.

Right.

Too bad fid can go all the way to UINT32_MAX, otherwise we could
have just stored them in the pointer after offsetting them by one
and thus worked around the issue...

I guess forbidding users from using UINT32_MAX as a fid is not an
option, right?

-- 
Andrea Bolognani / Red Hat / Virtualization




More information about the libvir-list mailing list