[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <334212ae74dcf1ecf112ff00cfea61b92342d287.camel@redhat.com>
Date: Wed, 17 Feb 2021 20:49:43 +0200
From: Maxim Levitsky <mlevitsk@...hat.com>
To: Paolo Bonzini <pbonzini@...hat.com>,
Sean Christopherson <seanjc@...gle.com>
Cc: kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
Wanpeng Li <wanpengli@...cent.com>,
Borislav Petkov <bp@...en8.de>, Joerg Roedel <joro@...tes.org>,
Jim Mattson <jmattson@...gle.com>,
"H. Peter Anvin" <hpa@...or.com>,
"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <x86@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Ingo Molnar <mingo@...hat.com>
Subject: Re: [PATCH 4/7] KVM: nVMX: move inject_page_fault tweak to
.complete_mmu_init
On Wed, 2021-02-17 at 18:37 +0100, Paolo Bonzini wrote:
> On 17/02/21 18:29, Sean Christopherson wrote:
> > All that being said, I'm pretty we can eliminate setting
> > inject_page_fault dynamically. I think that would yield more
> > maintainable code. Following these flows is a nightmare. The change
> > itself will be scarier, but I'm pretty sure the end result will be a lot
> > cleaner.
I agree with that.
>
> I had a similar reaction, though my proposal was different.
>
> The only thing we're changing in complete_mmu_init is the page fault
> callback for init_kvm_softmmu, so couldn't that be the callback directly
> (i.e. something like context->inject_page_fault =
> kvm_x86_ops.inject_softmmu_page_fault)? And then adding is_guest_mode
> to the conditional that is already in vmx_inject_page_fault_nested and
> svm_inject_page_fault_nested.
I was thinking about this a well, I tried to make an as simple as possible
solution that doesn't make things worse.
>
> That said, I'm also rusty on _why_ this code is needed. Why isn't it
> enough to inject the exception normally, and let
> nested_vmx_check_exception decide whether to inject a vmexit to L1 or an
> exception into L2?
>
> Also, bonus question which should have been in the 5/7 changelog: are
> there kvm-unit-tests testcases that fail with npt=0, and if not could we
> write one? [Answer: the mode_switch testcase fails, but I haven't
> checked why].
I agree with all of this. I'll see why this code is needed (it is needed,
since I once removed it accidentaly on VMX, and it broke nesting with ept=0,
in exact the same way as it was broken on AMD).
I''l debug this a bit to see if I can make it work as you suggest.
Best regards,
Maxim Levitsky
>
>
> Paolo
>
Powered by blists - more mailing lists