All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@kernel.org>
To: Vaibhav Jain <vaibhav@linux.ibm.com>,
	linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org,
	kvm-ppc@vger.kernel.org
Cc: Nicholas Piggin <npiggin@gmail.com>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Jordan Niethe <jniethe5@gmail.com>,
	Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>,
	mikey@neuling.org, paulus@ozlabs.org, sbhat@linux.ibm.com,
	gautam@linux.ibm.com, kconsul@linux.vnet.ibm.com,
	amachhiw@linux.vnet.ibm.com, David.Laight@ACULAB.COM
Subject: Re: [PATCH 09/12] KVM: PPC: Book3S HV nestedv2: Do not call H_COPY_TOFROM_GUEST
Date: Mon, 11 Dec 2023 09:31:17 +0530	[thread overview]
Message-ID: <086fb48f-ea7c-4b4e-b3b5-c930aa74bbb2@kernel.org> (raw)
In-Reply-To: <87jzplmlx5.fsf@vajain21.in.ibm.com>

On 12/11/23 9:26 AM, Vaibhav Jain wrote:
> Hi Aneesh,
> 
> Thanks for looking into this patch. My responses inline:
> 
> "Aneesh Kumar K.V (IBM)" <aneesh.kumar@kernel.org> writes:
> 
> <snip>
>> May be we should use 
>> firmware_has_feature(FW_FEATURE_H_COPY_TOFROM_GUEST))?
>> 
>> the nestedv2 can end up using the above hcall if it is supported by
>> the hypervisor right? In its absence we will have to translate the
>> guest ea using xlate and then use kvm_guest_read to read location
>> using the guest real address right? That xlate will also involves
>> multiple kvm_guest_read.
>> 
>> 
> Yes, Agreed and thats a nice suggestion. However ATM the hypervisor 
> supporting Nestedv2 doesnt have support for this hcall. In future
> once we have support for this hcall for nestedv2 from the hypervisor
> we can replace this branch with a firmware_has_feature() test.
> 

What I am suggesting is we convert that conditional to firmware_has_feature so that
later when hypervisor supports this hcall all older kernel can make
use of the copy_tofrom_guest without any code change.

>>> Signed-off-by: Jordan Niethe <jniethe5@gmail.com> --- 
>>> arch/powerpc/kvm/book3s_64_mmu_radix.c | 3 +++ 1 file changed, 3
>>> insertions(+)
>>> 
>>> diff --git a/arch/powerpc/kvm/book3s_64_mmu_radix.c
>>> b/arch/powerpc/kvm/book3s_64_mmu_radix.c index
>>> 916af6c153a5..4a1abb9f7c05 100644 ---
>>> a/arch/powerpc/kvm/book3s_64_mmu_radix.c +++
>>> b/arch/powerpc/kvm/book3s_64_mmu_radix.c @@ -40,6 +40,9 @@
>>> unsigned long __kvmhv_copy_tofrom_guest_radix(int lpid, int pid, 
>>> unsigned long quadrant, ret = n; bool is_load = !!to;
>>> 
>>> +	if (kvmhv_is_nestedv2()) +		return H_UNSUPPORTED; + /* Can't
>>> access quadrants 1 or 2 in non-HV mode, call the HV to do it */ 
>>> if (kvmhv_on_pseries()) return
>>> plpar_hcall_norets(H_COPY_TOFROM_GUEST, lpid, pid, eaddr, -- 
>>> 2.42.0
> 


WARNING: multiple messages have this Message-ID (diff)
From: "Aneesh Kumar K.V" <aneesh.kumar@kernel.org>
To: Vaibhav Jain <vaibhav@linux.ibm.com>,
	linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org,
	kvm-ppc@vger.kernel.org
Cc: mikey@neuling.org, sbhat@linux.ibm.com,
	amachhiw@linux.vnet.ibm.com, gautam@linux.ibm.com,
	Nicholas Piggin <npiggin@gmail.com>,
	David.Laight@ACULAB.COM, kconsul@linux.vnet.ibm.com,
	Jordan Niethe <jniethe5@gmail.com>,
	Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
Subject: Re: [PATCH 09/12] KVM: PPC: Book3S HV nestedv2: Do not call H_COPY_TOFROM_GUEST
Date: Mon, 11 Dec 2023 09:31:17 +0530	[thread overview]
Message-ID: <086fb48f-ea7c-4b4e-b3b5-c930aa74bbb2@kernel.org> (raw)
In-Reply-To: <87jzplmlx5.fsf@vajain21.in.ibm.com>

On 12/11/23 9:26 AM, Vaibhav Jain wrote:
> Hi Aneesh,
> 
> Thanks for looking into this patch. My responses inline:
> 
> "Aneesh Kumar K.V (IBM)" <aneesh.kumar@kernel.org> writes:
> 
> <snip>
>> May be we should use 
>> firmware_has_feature(FW_FEATURE_H_COPY_TOFROM_GUEST))?
>> 
>> the nestedv2 can end up using the above hcall if it is supported by
>> the hypervisor right? In its absence we will have to translate the
>> guest ea using xlate and then use kvm_guest_read to read location
>> using the guest real address right? That xlate will also involves
>> multiple kvm_guest_read.
>> 
>> 
> Yes, Agreed and thats a nice suggestion. However ATM the hypervisor 
> supporting Nestedv2 doesnt have support for this hcall. In future
> once we have support for this hcall for nestedv2 from the hypervisor
> we can replace this branch with a firmware_has_feature() test.
> 

What I am suggesting is we convert that conditional to firmware_has_feature so that
later when hypervisor supports this hcall all older kernel can make
use of the copy_tofrom_guest without any code change.

>>> Signed-off-by: Jordan Niethe <jniethe5@gmail.com> --- 
>>> arch/powerpc/kvm/book3s_64_mmu_radix.c | 3 +++ 1 file changed, 3
>>> insertions(+)
>>> 
>>> diff --git a/arch/powerpc/kvm/book3s_64_mmu_radix.c
>>> b/arch/powerpc/kvm/book3s_64_mmu_radix.c index
>>> 916af6c153a5..4a1abb9f7c05 100644 ---
>>> a/arch/powerpc/kvm/book3s_64_mmu_radix.c +++
>>> b/arch/powerpc/kvm/book3s_64_mmu_radix.c @@ -40,6 +40,9 @@
>>> unsigned long __kvmhv_copy_tofrom_guest_radix(int lpid, int pid, 
>>> unsigned long quadrant, ret = n; bool is_load = !!to;
>>> 
>>> +	if (kvmhv_is_nestedv2()) +		return H_UNSUPPORTED; + /* Can't
>>> access quadrants 1 or 2 in non-HV mode, call the HV to do it */ 
>>> if (kvmhv_on_pseries()) return
>>> plpar_hcall_norets(H_COPY_TOFROM_GUEST, lpid, pid, eaddr, -- 
>>> 2.42.0
> 


  reply	other threads:[~2023-12-11  4:01 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-01 13:26 [PATCH 00/12] KVM: PPC: Nested APIv2 : Performance improvements Vaibhav Jain
2023-12-01 13:26 ` Vaibhav Jain
2023-12-01 13:26 ` [PATCH 01/12] KVM: PPC: Book3S HV nestedv2: Invalidate RPT before deleting a guest Vaibhav Jain
2023-12-01 13:26   ` Vaibhav Jain
2023-12-07  9:15   ` Aneesh Kumar K.V
2023-12-07  9:15     ` Aneesh Kumar K.V
2023-12-08 13:45     ` Vaibhav Jain
2023-12-15 16:12       ` Aneesh Kumar K.V
2023-12-18  4:54         ` Vaibhav Jain
2023-12-01 13:26 ` [PATCH 02/12] KVM: PPC: Book3S HV nestedv2: Avoid reloading the tb offset Vaibhav Jain
2023-12-01 13:26   ` Vaibhav Jain
2023-12-01 13:26 ` [PATCH 03/12] KVM: PPC: Book3S HV nestedv2: Do not check msr on hcalls Vaibhav Jain
2023-12-01 13:26   ` Vaibhav Jain
2023-12-01 13:26 ` [PATCH 04/12] KVM: PPC: Book3S HV nestedv2: Get the PID only if needed to copy tofrom a guest Vaibhav Jain
2023-12-01 13:26   ` Vaibhav Jain
2023-12-01 13:26 ` [PATCH 05/12] KVM: PPC: Book3S HV nestedv2: Ensure LPCR_MER bit is passed to the L0 Vaibhav Jain
2023-12-01 13:26   ` Vaibhav Jain
2023-12-01 13:26 ` [PATCH 06/12] KVM: PPC: Book3S HV: Handle pending exceptions on guest entry with MSR_EE Vaibhav Jain
2023-12-01 13:26   ` Vaibhav Jain
2023-12-01 13:26 ` [PATCH 07/12] KVM: PPC: Book3S HV nestedv2: Do not inject certain interrupts Vaibhav Jain
2023-12-01 13:26   ` Vaibhav Jain
2023-12-01 13:26 ` [PATCH 08/12] KVM: PPC: Book3S HV nestedv2: Avoid msr check in kvmppc_handle_exit_hv() Vaibhav Jain
2023-12-01 13:26   ` Vaibhav Jain
2023-12-01 13:26 ` [PATCH 09/12] KVM: PPC: Book3S HV nestedv2: Do not call H_COPY_TOFROM_GUEST Vaibhav Jain
2023-12-01 13:26   ` Vaibhav Jain
2023-12-08  8:15   ` Aneesh Kumar K.V
2023-12-08  8:15     ` Aneesh Kumar K.V
2023-12-11  3:56     ` Vaibhav Jain
2023-12-11  3:56       ` Vaibhav Jain
2023-12-11  4:01       ` Aneesh Kumar K.V [this message]
2023-12-11  4:01         ` Aneesh Kumar K.V
2023-12-18  7:02         ` Vaibhav Jain
2023-12-18  7:02           ` Vaibhav Jain
2023-12-18  7:29           ` Aneesh Kumar K.V
2023-12-18  7:29             ` Aneesh Kumar K.V
2023-12-01 13:26 ` [PATCH 10/12] KVM: PPC: Book3S HV nestedv2: Register the VPA with the L0 Vaibhav Jain
2023-12-01 13:26   ` Vaibhav Jain
2023-12-01 13:26 ` [PATCH 11/12] KVM: PPC: Reduce reliance on analyse_instr() in mmio emulation Vaibhav Jain
2023-12-01 13:26   ` Vaibhav Jain
2023-12-01 13:26 ` [PATCH 12/12] KVM: PPC: Book3S HV nestedv2: Do not cancel pending decrementer exception Vaibhav Jain
2023-12-01 13:26   ` Vaibhav Jain
2023-12-21 10:44 ` [PATCH 00/12] KVM: PPC: Nested APIv2 : Performance improvements Michael Ellerman
2023-12-21 10:44   ` Michael Ellerman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=086fb48f-ea7c-4b4e-b3b5-c930aa74bbb2@kernel.org \
    --to=aneesh.kumar@kernel.org \
    --cc=David.Laight@ACULAB.COM \
    --cc=amachhiw@linux.vnet.ibm.com \
    --cc=gautam@linux.ibm.com \
    --cc=jniethe5@gmail.com \
    --cc=kconsul@linux.vnet.ibm.com \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mikey@neuling.org \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=paulus@ozlabs.org \
    --cc=sbhat@linux.ibm.com \
    --cc=svaidy@linux.vnet.ibm.com \
    --cc=vaibhav@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.