Re: [PATCH 1/2] KVM: Don't fail KVM_GET_SUPPORTED_CPUID if nent is just right

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/24/2011 12:37 PM, Sasha Levin wrote:
> On Thu, 2011-11-24 at 12:33 +0200, Avi Kivity wrote:
> > On 11/24/2011 12:31 PM, Sasha Levin wrote:
> > > > 
> > > > The protocol goes like "try size x, if it fails with -E2BIG, increase x,
> > > > try again". Its awkward.
> > >
> > > We can set nent to be the amount of entries required like we do in the
> > > opposite case where we passed too many entries.
> > 
> > There's no point, since userspace will want to support older kernels.
>
> In the case of old kernels the cpuid->nent value will not be modified,
> so userspace can handle both cases easily:
>
> - If KVM_GET_SUPPORTED_CPUID returned -E2BIG, check cpuid->nent
> 	- If zero, do same -E2BIG loop as we do now.
> 	- If not, allocate amount needed and pass it to the ioctl again.
>

What's the point?  The code becomes more complicated.

Something like 'while (try_get_cpuid(x) == -E2BIG) { x *= 2; }' is
simple and works everywhere.

-- 
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux