[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200526125028.GB108774@redhat.com>
Date: Tue, 26 May 2020 08:50:28 -0400
From: Vivek Goyal <vgoyal@...hat.com>
To: Vitaly Kuznetsov <vkuznets@...hat.com>
Cc: kvm@...r.kernel.org, x86@...nel.org,
Paolo Bonzini <pbonzini@...hat.com>,
Andy Lutomirski <luto@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Borislav Petkov <bp@...en8.de>,
"H. Peter Anvin" <hpa@...or.com>,
Wanpeng Li <wanpengli@...cent.com>,
Sean Christopherson <sean.j.christopherson@...el.com>,
Jim Mattson <jmattson@...gle.com>,
Gavin Shan <gshan@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/8] KVM: x86: extend struct kvm_vcpu_pv_apf_data with
token info
On Sat, May 23, 2020 at 06:34:17PM +0200, Vitaly Kuznetsov wrote:
> Vivek Goyal <vgoyal@...hat.com> writes:
>
> > On Mon, May 11, 2020 at 06:47:46PM +0200, Vitaly Kuznetsov wrote:
> >> Currently, APF mechanism relies on the #PF abuse where the token is being
> >> passed through CR2. If we switch to using interrupts to deliver page-ready
> >> notifications we need a different way to pass the data. Extent the existing
> >> 'struct kvm_vcpu_pv_apf_data' with token information for page-ready
> >> notifications.
> >>
> >> The newly introduced apf_put_user_ready() temporary puts both reason
> >> and token information, this will be changed to put token only when we
> >> switch to interrupt based notifications.
> >>
> >> Signed-off-by: Vitaly Kuznetsov <vkuznets@...hat.com>
> >> ---
> >> arch/x86/include/uapi/asm/kvm_para.h | 3 ++-
> >> arch/x86/kvm/x86.c | 17 +++++++++++++----
> >> 2 files changed, 15 insertions(+), 5 deletions(-)
> >>
> >> diff --git a/arch/x86/include/uapi/asm/kvm_para.h b/arch/x86/include/uapi/asm/kvm_para.h
> >> index 2a8e0b6b9805..e3602a1de136 100644
> >> --- a/arch/x86/include/uapi/asm/kvm_para.h
> >> +++ b/arch/x86/include/uapi/asm/kvm_para.h
> >> @@ -113,7 +113,8 @@ struct kvm_mmu_op_release_pt {
> >>
> >> struct kvm_vcpu_pv_apf_data {
> >> __u32 reason;
> >
> > Hi Vitaly,
> >
> > Given we are redoing it, can we convert "reason" into a flag instead
> > and use bit 0 for signalling "page not present" Then rest of the 31
> > bits can be used for other purposes. I potentially want to use one bit to
> > signal error (if it is known at the time of injecting #PF).
>
> Yes, I think we can do that. The existing KVM_PV_REASON_PAGE_READY and
> KVM_PV_REASON_PAGE_NOT_PRESENT are mutually exclusive and can be
> converted to flags (we'll only have KVM_PV_REASON_PAGE_NOT_PRESENT in
> use when this series is merged).
>
> >
> >> - __u8 pad[60];
> >> + __u32 pageready_token;
> >> + __u8 pad[56];
> >
> > Given token is 32 bit, for returning error in "page ready" type messages,
> > I will probably use padding bytes and create pagready_flag and use one
> > of the bits to signal error.
>
> In case we're intended to pass more data in synchronous notifications,
> shall we leave some blank space after 'flags' ('reason' previously) and
> before 'token'?
Given you are planning to move away from using kvm_vcpu_pv_apf_data
for synchronous notifications, I will not be too concerned about it.
Thanks
Vivek
Powered by blists - more mailing lists