[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7f944dd3-aed3-be94-624b-35e7d35cb2db@redhat.com>
Date: Tue, 25 Feb 2020 16:02:47 +0100
From: Paolo Bonzini <pbonzini@...hat.com>
To: Sean Christopherson <sean.j.christopherson@...el.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>
Cc: Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 29/61] KVM: x86: Add Kconfig-controlled auditing of
reverse CPUID lookups
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
Powered by blists - more mailing lists