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.