lkml.org 
[lkml]   [2020]   [Jun]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] KVM: X86: Move ignore_msrs handling upper the stack
On Thu, Jun 25, 2020 at 08:44:16PM +0200, Paolo Bonzini wrote:
> On 25/06/20 18:25, Sean Christopherson wrote:
> > I get the "what" of the change, and even the "why" to some extent, but I
> > dislike the idea of supporting/encouraging blind reads/writes to MSRs.
> > Blind writes are just asking for problems, and suppressing warnings on reads
> > is almost guaranteed to be suppressing a KVM bug.
>
> Right, that's why this patch does not just suppress warnings: it adds a
> different return value to detect the case.
>
> > TSC_CTRL aside, if we insist on pointing a gun at our foot at some point,
> > this should be a dedicated flavor of MSR access, e.g. msr_data.kvm_initiated,
> > so that it at least requires intentionally loading the gun.
>
> With this patch, __kvm_get_msr does not know about ignore_msrs at all,
> that seems to be strictly an improvement; do you agree with that?

Not really? It's solving a problem that doesn't exist in the current code
base (assuming TSC_CTRL is fixed), and IMO solving it in an ugly fashion.

I would much prefer that, _if_ we want to support blind KVM-internal MSR
accesses, we end up with code like:

if (msr_info->kvm_internal) {
return 1;
} else if (!ignore_msrs) {
vcpu_debug_ratelimited(vcpu, "unhandled wrmsr: 0x%x data 0x%llx\n",
msr, data);
return 1;
} else {
if (report_ignored_msrs)
vcpu_unimpl(vcpu,
"ignored wrmsr: 0x%x data 0x%llx\n",
msr, data);
break;
}

But I'm still not convinced that there is a legimiate scenario for setting
kvm_internal=true.

> What would you think about adding warn_unused_result to __kvm_get_msr?

I guess I wouldn't object to it, but that seems like an orthogonal issue.

\
 
 \ /
  Last update: 2020-06-26 17:57    [W:0.107 / U:0.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site