From: Scott Wood <scottwood@freescale.com>
To: Kevin Hao <haokexin@gmail.com>
Cc: <linuxppc-dev@lists.ozlabs.org>
Subject: Re: [PATCH 2/3] powerpc/e6500: hw tablewalk: optimize a bit for tcd lock acquiring codes
Date: Thu, 13 Aug 2015 13:44:43 -0500 [thread overview]
Message-ID: <1439491483.4099.101.camel@freescale.com> (raw)
In-Reply-To: <1439466697-18989-2-git-send-email-haokexin@gmail.com>
On Thu, 2015-08-13 at 19:51 +0800, Kevin Hao wrote:
> It makes no sense to put the instructions for calculating the lock
> value (cpu number + 1) and the clearing of eq bit of cr1 in lbarx/stbcx
> loop. And when the lock is acquired by the other thread, the current
> lock value has no chance to equal with the lock value used by current
> cpu. So we can skip the comparing for these two lock values in the
> lbz/bne loop.
>
> Signed-off-by: Kevin Hao <haokexin@gmail.com>
> ---
> arch/powerpc/mm/tlb_low_64e.S | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/arch/powerpc/mm/tlb_low_64e.S b/arch/powerpc/mm/tlb_low_64e.S
> index 765b419883f2..e4185581c5a7 100644
> --- a/arch/powerpc/mm/tlb_low_64e.S
> +++ b/arch/powerpc/mm/tlb_low_64e.S
> @@ -308,11 +308,11 @@ BEGIN_FTR_SECTION /* CPU_FTR_SMT */
> *
> * MAS6:IND should be already set based on MAS4
> */
> -1: lbarx r15,0,r11
> lhz r10,PACAPACAINDEX(r13)
> - cmpdi r15,0
> - cmpdi cr1,r15,1 /* set cr1.eq = 0 for non-recursive */
> addi r10,r10,1
> + crclr cr1*4+eq /* set cr1.eq = 0 for non-recursive */
> +1: lbarx r15,0,r11
> + cmpdi r15,0
> bne 2f
You're optimizing the contended case at the expense of introducing stalls in
the uncontended case. Does it really matter if there are more instructions
in the loop? This change just means that you'll spin in the loop for more
iterations (if it even does that -- I think the cycles per loop iteration
might be the same before and after, due to load latency and pairing) while
waiting for the other thread to release the lock.
Do you have any benchmark results for this patch?
-Scott
next prev parent reply other threads:[~2015-08-13 18:45 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-13 11:51 [PATCH 1/3] powerpc/e6500: remove the stale TCD_LOCK macro Kevin Hao
2015-08-13 11:51 ` [PATCH 2/3] powerpc/e6500: hw tablewalk: optimize a bit for tcd lock acquiring codes Kevin Hao
2015-08-13 18:44 ` Scott Wood [this message]
2015-08-14 7:13 ` Kevin Hao
2015-08-15 2:44 ` Scott Wood
2015-08-17 11:16 ` Kevin Hao
2015-08-17 21:08 ` Scott Wood
2015-08-13 11:51 ` [PATCH 3/3] powerpc/e6500: hw tablewalk: order the memory access when acquire/release tcd lock Kevin Hao
2015-08-14 3:39 ` Scott Wood
2015-08-14 7:13 ` Kevin Hao
2015-08-15 0:44 ` Scott Wood
2015-08-17 11:19 ` Kevin Hao
2015-08-18 7:55 ` [PATCH v2] powerpc/e6500: hw tablewalk: make sure we invalidate and write to the same tlb entry Kevin Hao
2015-10-17 0:01 ` [v2] " Scott Wood
2015-10-22 12:19 ` Kevin Hao
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=1439491483.4099.101.camel@freescale.com \
--to=scottwood@freescale.com \
--cc=haokexin@gmail.com \
--cc=linuxppc-dev@lists.ozlabs.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).