linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kvm:powerpc:Fix return statements for wrapper functions in the file book3s_64_mmu_hv.c
@ 2015-08-10 15:27 Nicholas Krause
  2015-08-12 19:06 ` Alexander Graf
  2015-08-20 16:58 ` Paul Mackerras
  0 siblings, 2 replies; 4+ messages in thread
From: Nicholas Krause @ 2015-08-10 15:27 UTC (permalink / raw)
  To: gleb; +Cc: pbonzini, agraf, benh, kvm, kvm-ppc, linuxppc-dev, linux-kernel

This fixes the wrapper functions kvm_umap_hva_hv and the function
kvm_unmap_hav_range_hv to return the return value of the function
kvm_handle_hva or kvm_handle_hva_range that they are wrapped to
call internally rather then always making the caller of these
wrapper functions think they always run successfully by returning
the value of zero directly.

Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
---
 arch/powerpc/kvm/book3s_64_mmu_hv.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c
index dab68b7..0905c8f 100644
--- a/arch/powerpc/kvm/book3s_64_mmu_hv.c
+++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c
@@ -774,14 +774,12 @@ static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp,
 
 int kvm_unmap_hva_hv(struct kvm *kvm, unsigned long hva)
 {
-	kvm_handle_hva(kvm, hva, kvm_unmap_rmapp);
-	return 0;
+	return kvm_handle_hva(kvm, hva, kvm_unmap_rmapp);
 }
 
 int kvm_unmap_hva_range_hv(struct kvm *kvm, unsigned long start, unsigned long end)
 {
-	kvm_handle_hva_range(kvm, start, end, kvm_unmap_rmapp);
-	return 0;
+	return kvm_handle_hva_range(kvm, start, end, kvm_unmap_rmapp);
 }
 
 void kvmppc_core_flush_memslot_hv(struct kvm *kvm,
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] kvm:powerpc:Fix return statements for wrapper functions in the file book3s_64_mmu_hv.c
  2015-08-10 15:27 [PATCH] kvm:powerpc:Fix return statements for wrapper functions in the file book3s_64_mmu_hv.c Nicholas Krause
@ 2015-08-12 19:06 ` Alexander Graf
  2015-08-14  2:49   ` Michael Ellerman
  2015-08-20 16:58 ` Paul Mackerras
  1 sibling, 1 reply; 4+ messages in thread
From: Alexander Graf @ 2015-08-12 19:06 UTC (permalink / raw)
  To: Nicholas Krause, gleb
  Cc: benh, linuxppc-dev, pbonzini, kvm, kvm-ppc, linux-kernel,
	Paul Mackerras



On 10.08.15 17:27, Nicholas Krause wrote:
> This fixes the wrapper functions kvm_umap_hva_hv and the function
> kvm_unmap_hav_range_hv to return the return value of the function
> kvm_handle_hva or kvm_handle_hva_range that they are wrapped to
> call internally rather then always making the caller of these
> wrapper functions think they always run successfully by returning
> the value of zero directly.
> 
> Signed-off-by: Nicholas Krause <xerofoify@gmail.com>

Paul, could you please take on this one?

Thanks,

Alex

> ---
>  arch/powerpc/kvm/book3s_64_mmu_hv.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c
> index dab68b7..0905c8f 100644
> --- a/arch/powerpc/kvm/book3s_64_mmu_hv.c
> +++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c
> @@ -774,14 +774,12 @@ static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp,
>  
>  int kvm_unmap_hva_hv(struct kvm *kvm, unsigned long hva)
>  {
> -	kvm_handle_hva(kvm, hva, kvm_unmap_rmapp);
> -	return 0;
> +	return kvm_handle_hva(kvm, hva, kvm_unmap_rmapp);
>  }
>  
>  int kvm_unmap_hva_range_hv(struct kvm *kvm, unsigned long start, unsigned long end)
>  {
> -	kvm_handle_hva_range(kvm, start, end, kvm_unmap_rmapp);
> -	return 0;
> +	return kvm_handle_hva_range(kvm, start, end, kvm_unmap_rmapp);
>  }
>  
>  void kvmppc_core_flush_memslot_hv(struct kvm *kvm,
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] kvm:powerpc:Fix return statements for wrapper functions in the file book3s_64_mmu_hv.c
  2015-08-12 19:06 ` Alexander Graf
@ 2015-08-14  2:49   ` Michael Ellerman
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2015-08-14  2:49 UTC (permalink / raw)
  To: Alexander Graf
  Cc: Nicholas Krause, gleb, kvm, linux-kernel, kvm-ppc, Paul Mackerras,
	pbonzini, linuxppc-dev

On Wed, 2015-08-12 at 21:06 +0200, Alexander Graf wrote:
> 
> On 10.08.15 17:27, Nicholas Krause wrote:
> > This fixes the wrapper functions kvm_umap_hva_hv and the function
> > kvm_unmap_hav_range_hv to return the return value of the function
> > kvm_handle_hva or kvm_handle_hva_range that they are wrapped to
> > call internally rather then always making the caller of these
> > wrapper functions think they always run successfully by returning
> > the value of zero directly.
> > 
> > Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
> 
> Paul, could you please take on this one?

Paul's away for a while can you take it directly?

cheers

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] kvm:powerpc:Fix return statements for wrapper functions in the file book3s_64_mmu_hv.c
  2015-08-10 15:27 [PATCH] kvm:powerpc:Fix return statements for wrapper functions in the file book3s_64_mmu_hv.c Nicholas Krause
  2015-08-12 19:06 ` Alexander Graf
@ 2015-08-20 16:58 ` Paul Mackerras
  1 sibling, 0 replies; 4+ messages in thread
From: Paul Mackerras @ 2015-08-20 16:58 UTC (permalink / raw)
  To: Nicholas Krause
  Cc: gleb, kvm, linux-kernel, kvm-ppc, pbonzini, linuxppc-dev, agraf

On Mon, Aug 10, 2015 at 11:27:31AM -0400, Nicholas Krause wrote:
> This fixes the wrapper functions kvm_umap_hva_hv and the function
> kvm_unmap_hav_range_hv to return the return value of the function
> kvm_handle_hva or kvm_handle_hva_range that they are wrapped to
> call internally rather then always making the caller of these
> wrapper functions think they always run successfully by returning
> the value of zero directly.

In fact these functions do always run successfully, and there is no
bug fixed here (see below).

I don't object to the change per se, since it reduces the code size
very slightly, but the commit message and headline needs to be
reworded to avoid giving the impression that this fixes something.

>  int kvm_unmap_hva_hv(struct kvm *kvm, unsigned long hva)
>  {
> -	kvm_handle_hva(kvm, hva, kvm_unmap_rmapp);
> -	return 0;
> +	return kvm_handle_hva(kvm, hva, kvm_unmap_rmapp);
>  }
>  
>  int kvm_unmap_hva_range_hv(struct kvm *kvm, unsigned long start, unsigned long end)
>  {
> -	kvm_handle_hva_range(kvm, start, end, kvm_unmap_rmapp);
> -	return 0;
> +	return kvm_handle_hva_range(kvm, start, end, kvm_unmap_rmapp);

kvm_handle_hva and kvm_handle_hva_range call the handler function
(kvm_unmap_rmapp in this case) one or more times, and return the
logical OR of the return values from the handler.  Since
kvm_unmap_rmapp always returns 0, the return value from
kvm_handle_hva{,_range} will always be 0 here.

Paul.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-08-20 16:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-10 15:27 [PATCH] kvm:powerpc:Fix return statements for wrapper functions in the file book3s_64_mmu_hv.c Nicholas Krause
2015-08-12 19:06 ` Alexander Graf
2015-08-14  2:49   ` Michael Ellerman
2015-08-20 16:58 ` Paul Mackerras

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).