在 2018/9/12 下午6:37, Andrea Bolognani 写道:
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...
Yes. Just one value makes all things complex.
I guess forbidding users from using UINT32_MAX as a fid is not an
option, right?
Actually as my understanding, it's just a value to identify the pci
function.
IMO, it's not a big deal to decrease usable FID values. After all, UID set
is smaller than FID set. The maximum number of pci devices is limited
by UID. Anyway, I have to discuss this with my colleagues internally.
I will tell you our discussion result first time.
--
Yi Min
--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list