lkml.org 
[lkml]   [2020]   [Feb]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 29/61] KVM: x86: Add Kconfig-controlled auditing of reverse CPUID lookups
From
Date
On 24/02/20 23:46, Sean Christopherson wrote:
>>> static __always_inline u32 *__cpuid_entry_get_reg(struct kvm_cpuid_entry2 *entry,
>>> const struct cpuid_reg *cpuid)
>>> {
>>> +#ifdef CONFIG_KVM_CPUID_AUDIT
>>> + WARN_ON_ONCE(entry->function != cpuid->function);
>>> + WARN_ON_ONCE(entry->index != cpuid->index);
>>> +#endif
>>> +
>>> switch (cpuid->reg) {
>>> case CPUID_EAX:
>>> return &entry->eax;
>>
>> Honestly, I was thinking we should BUG_ON() and even in production builds
>> but not everyone around is so rebellious I guess, so
>
> LOL. It's a waste of cycles for something that will "never" be hit, i.e.
> we _really_ dropped the ball if a bug of this natures makes it into a
> kernel release.

There are quite a few WARN_ONs like that already. I'd say each
non-constant-folded call to __cpuid_enty_get_reg is a waste of cycles,
if you're counting them. :)

Paolo

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