Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: David Daney <ddaney@caviumnetworks.com>
To: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
Subject: Re: [PATCH] MIPS: Optimize spinlocks.
Date: Thu, 25 Feb 2010 09:31:38 -0800	[thread overview]
Message-ID: <4B86B3FA.2030902@caviumnetworks.com> (raw)
In-Reply-To: <20100225141548.GB29565@linux-mips.org>

On 02/25/2010 06:15 AM, Ralf Baechle wrote:
> On Wed, Feb 24, 2010 at 08:55:12AM -0800, David Daney wrote:
>
>> It is possible that by choosing a better nudge_writes()
>> implementation for R10K, that the 3% degradation could be erased.
>> Perhaps:
>>
>> #define nudge_writes() do { } while (0)
>
> raw_spin_unlock must provide a barrier so this wouldn't be a valid
> implementation for nudge_writes().

That barrier is separate (and present).  The sole purpose of 
nudge_writes() is to make speed up the global visibility of the 
releasing write, it does not have anything to do with locking semantics.

>  Implementing it as barrier() this
> is a pure compiler barrier is the most liberal valid implementation.

No, the most liberal would be a true NOP: 'do { } while (0)'.

>
>> Basically you want something that is fast, but that also forces the
>> write to be globally visible as soon as possible.  Some processors
>> have a prefetch instruction that does this.  On other processors a
>> NOP is optimal as they don't combine writes in the write back
>> buffer.
>>
>> There is a wbflush() function that could potentially be used, but
>> its implementation is too heavy on Octeon.
>
> For IP27 which is a strongly ordered system nudge_writes() is implemented
> as barrier().
>
> Another experiment I did was alignment.  A branch on an R10000 has a
> significant execution time penalty if it's delay slot is overlapping a
> 128 byte S-cache boundary.  Suitable alignment however didn't not seem
> to make any difference at all on R10000.
>
>    Ralf
>

      reply	other threads:[~2010-02-25 17:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-04 19:31 [PATCH] MIPS: Optimize spinlocks David Daney
2010-02-24 15:53 ` Ralf Baechle
2010-02-24 15:54   ` Ralf Baechle
2010-02-24 16:55   ` David Daney
2010-02-25 14:15     ` Ralf Baechle
2010-02-25 17:31       ` David Daney [this message]

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=4B86B3FA.2030902@caviumnetworks.com \
    --to=ddaney@caviumnetworks.com \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.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