lkml.org 
[lkml]   [2020]   [Feb]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 16/61] KVM: x86: Encapsulate CPUID entries and metadata in struct
Date
Sean Christopherson <sean.j.christopherson@intel.com> writes:

> On Fri, Feb 21, 2020 at 03:58:47PM +0100, Vitaly Kuznetsov wrote:
>> Sean Christopherson <sean.j.christopherson@intel.com> writes:
>>
>
>> > + if (!entry)
>> > goto out;
>> > }
>> > break;
>> > @@ -802,22 +814,22 @@ static inline int __do_cpuid_func(struct kvm_cpuid_entry2 *entry, u32 function,
>> > return r;
>> > }
>> >
>> > -static int do_cpuid_func(struct kvm_cpuid_entry2 *entry, u32 func,
>> > - int *nent, int maxnent, unsigned int type)
>> > +static int do_cpuid_func(struct kvm_cpuid_array *array, u32 func,
>> > + unsigned int type)
>> > {
>> > - if (*nent >= maxnent)
>> > + if (array->nent >= array->maxnent)
>> > return -E2BIG;
>> >
>> > if (type == KVM_GET_EMULATED_CPUID)
>> > - return __do_cpuid_func_emulated(entry, func, nent, maxnent);
>> > + return __do_cpuid_func_emulated(array, func);
>>
>> Would it make sense to move 'if (array->nent >= array->maxnent)' check
>> to __do_cpuid_func_emulated() to match do_host_cpuid()?
>
> I considered doing exactly that. IIRC, I opted not to because at this
> point in the series, the initial call to do_host_cpuid() is something like
> halfway down the massive __do_cpuid_func(), and eliminating the early check
> didn't feel quite right, e.g. there is a fair amount of unnecessary code
> that runs before hitting the first do_host_cpuid().
>
> What if I add a patch towards the end of the series to move this check into
> __do_cpuid_func_emulated(), i.e. after __do_cpuid_func() has been trimmed
> down to size and the early check really is superfluous.
>

Works for me, thanks!

--
Vitaly

\
 
 \ /
  Last update: 2020-02-25 00:13    [W:0.095 / U:0.172 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site