linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
To: Laurent Dufour <ldufour@linux.vnet.ibm.com>,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Cc: mpe@ellerman.id.au, benh@kernel.crashing.org, paulus@samba.org,
	npiggin@gmail.com
Subject: Re: [PATCH 2/3] powerpc/pseries/mm: factorize PTE slot computation
Date: Mon, 30 Jul 2018 19:49:17 +0530	[thread overview]
Message-ID: <87in4wolga.fsf@linux.ibm.com> (raw)
In-Reply-To: <1532699493-10883-3-git-send-email-ldufour@linux.vnet.ibm.com>

Laurent Dufour <ldufour@linux.vnet.ibm.com> writes:

> This part of code will be called also when dealing with H_BLOCK_REMOVE.
>
> Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
> Cc: Nicholas Piggin <npiggin@gmail.com>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>

Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>

> ---
>  arch/powerpc/platforms/pseries/lpar.c | 27 ++++++++++++++++++++-------
>  1 file changed, 20 insertions(+), 7 deletions(-)
>
> diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
> index 52eeff1297f4..96b8cd8a802d 100644
> --- a/arch/powerpc/platforms/pseries/lpar.c
> +++ b/arch/powerpc/platforms/pseries/lpar.c
> @@ -547,6 +547,24 @@ static int pSeries_lpar_hpte_removebolted(unsigned long ea,
>  	return 0;
>  }
>  
> +
> +static inline unsigned long compute_slot(real_pte_t pte,
> +					 unsigned long vpn,
> +					 unsigned long index,
> +					 unsigned long shift,
> +					 int ssize)
> +{
> +	unsigned long slot, hash, hidx;
> +
> +	hash = hpt_hash(vpn, shift, ssize);
> +	hidx = __rpte_to_hidx(pte, index);
> +	if (hidx & _PTEIDX_SECONDARY)
> +		hash = ~hash;
> +	slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;
> +	slot += hidx & _PTEIDX_GROUP_IX;
> +	return slot;
> +}
> +
>  /*
>   * Take a spinlock around flushes to avoid bouncing the hypervisor tlbie
>   * lock.
> @@ -559,7 +577,7 @@ static void pSeries_lpar_flush_hash_range(unsigned long number, int local)
>  	struct ppc64_tlb_batch *batch = this_cpu_ptr(&ppc64_tlb_batch);
>  	int lock_tlbie = !mmu_has_feature(MMU_FTR_LOCKLESS_TLBIE);
>  	unsigned long param[PLPAR_HCALL9_BUFSIZE];
> -	unsigned long hash, index, shift, hidx, slot;
> +	unsigned long index, shift, slot;
>  	real_pte_t pte;
>  	int psize, ssize;
>  
> @@ -573,12 +591,7 @@ static void pSeries_lpar_flush_hash_range(unsigned long number, int local)
>  		vpn = batch->vpn[i];
>  		pte = batch->pte[i];
>  		pte_iterate_hashed_subpages(pte, psize, vpn, index, shift) {
> -			hash = hpt_hash(vpn, shift, ssize);
> -			hidx = __rpte_to_hidx(pte, index);
> -			if (hidx & _PTEIDX_SECONDARY)
> -				hash = ~hash;
> -			slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;
> -			slot += hidx & _PTEIDX_GROUP_IX;
> +			slot = compute_slot(pte, vpn, index, shift, ssize);
>  			if (!firmware_has_feature(FW_FEATURE_BULK_REMOVE)) {
>  				/*
>  				 * lpar doesn't use the passed actual page size
> -- 
> 2.7.4

  reply	other threads:[~2018-07-30 14:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-27 13:51 [resend] [PATCH 0/3] powerpc/pseries: use H_BLOCK_REMOVE Laurent Dufour
2018-07-27 13:51 ` [PATCH 1/3] powerpc/pseries/mm: Introducing FW_FEATURE_BLOCK_REMOVE Laurent Dufour
2018-07-30 14:18   ` Aneesh Kumar K.V
2018-07-27 13:51 ` [PATCH 2/3] powerpc/pseries/mm: factorize PTE slot computation Laurent Dufour
2018-07-30 14:19   ` Aneesh Kumar K.V [this message]
2018-07-27 13:51 ` [PATCH 3/3] powerpc/pseries/mm: call H_BLOCK_REMOVE Laurent Dufour
2018-07-30 13:47   ` Michael Ellerman
2018-07-30 14:22     ` Aneesh Kumar K.V
2018-08-16 17:27       ` Laurent Dufour
2018-08-16  9:41     ` Laurent Dufour
2018-08-01  1:55 ` [resend] [PATCH 0/3] powerpc/pseries: use H_BLOCK_REMOVE Nicholas Piggin
2018-08-03  2:29   ` Michael Ellerman
  -- strict thread matches above, loose matches on Subject: below --
2018-07-27 13:22 Laurent Dufour
2018-07-27 13:22 ` [PATCH 2/3] powerpc/pseries/mm: factorize PTE slot computation Laurent Dufour

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=87in4wolga.fsf@linux.ibm.com \
    --to=aneesh.kumar@linux.ibm.com \
    --cc=benh@kernel.crashing.org \
    --cc=ldufour@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=paulus@samba.org \
    /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 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).