Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Ralf Baechle <ralf@linux-mips.org>
To: "Steven J. Hill" <steven.hill@cavium.com>
Cc: linux-mips@linux-mips.org, Chad Reese <kreese@caviumnetworks.com>,
	David Daney <david.daney@cavium.com>
Subject: Re: [PATCH v3 01/11] MIPS: Add nudges to writes for bit unlocks.
Date: Tue, 14 Nov 2017 16:39:58 +0100	[thread overview]
Message-ID: <20171114153958.GA16044@linux-mips.org> (raw)
In-Reply-To: <1510633827-23548-2-git-send-email-steven.hill@cavium.com>

On Mon, Nov 13, 2017 at 10:30:17PM -0600, Steven J. Hill wrote:

> From: Chad Reese <kreese@caviumnetworks.com>
> 
> Flushing the writes lets other CPUs waiting for the lock to get it
> sooner.
> 
> Signed-off-by: Chad Reese <kreese@caviumnetworks.com>
> Signed-off-by: David Daney <david.daney@cavium.com>
> Signed-off-by: Steven J. Hill <steven.hill@cavium.com>
> ---
>  arch/mips/include/asm/bitops.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/mips/include/asm/bitops.h b/arch/mips/include/asm/bitops.h
> index fa57cef..da1b871 100644
> --- a/arch/mips/include/asm/bitops.h
> +++ b/arch/mips/include/asm/bitops.h
> @@ -456,6 +456,7 @@ static inline void __clear_bit_unlock(unsigned long nr, volatile unsigned long *
>  {
>  	smp_mb__before_llsc();
>  	__clear_bit(nr, addr);
> +	nudge_writes();
>  }

Hmm...

This patch looks ok, it's more the definition of nudge_writes() which I'm
concerned about.  __clear_bit_unlock() does not need a memory barrier
after __clear_bit() but for non-Octeon processors nudge_writes() expands
into one anyway.

The good news is nudge_writes() is currently unused anyway so we can
change the definition to something like nudge_writes do { } while (0)
for the Octeon.  Suggested patch below.

The Octeon definition of nudge_writes() has a memory clobber and I'm
wondering if that one is actually required or if we could make things a
little easier on the compiler by removing it.

  Ralf

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

 arch/mips/include/asm/barrier.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/include/asm/barrier.h b/arch/mips/include/asm/barrier.h
index a5eb1bb199a7..0e8e6afbf80a 100644
--- a/arch/mips/include/asm/barrier.h
+++ b/arch/mips/include/asm/barrier.h
@@ -216,7 +216,7 @@
 #else
 #define smp_mb__before_llsc() smp_llsc_mb()
 #define __smp_mb__before_llsc() smp_llsc_mb()
-#define nudge_writes() mb()
+#define nudge_writes() do { } while (0)
 #endif
 
 #define __smp_mb__before_atomic()	__smp_mb__before_llsc()

  reply	other threads:[~2017-11-14 15:40 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-14  4:30 [PATCH v3 00/11] Add Octeon Hotplug CPU Support Steven J. Hill
2017-11-14  4:30 ` [PATCH v3 01/11] MIPS: Add nudges to writes for bit unlocks Steven J. Hill
2017-11-14 15:39   ` Ralf Baechle [this message]
2017-11-14 15:43     ` Ralf Baechle
2017-11-14 17:57     ` David Daney
2017-11-14  4:30 ` [PATCH v3 02/11] MIPS: Remove unused variable 'lastpfn' Steven J. Hill
2017-11-14 15:40   ` Ralf Baechle
2017-11-14  4:30 ` [PATCH v3 03/11] MIPS: Allow __cpu_number_map to be larger than NR_CPUS Steven J. Hill
2017-11-14  4:30 ` [PATCH v3 04/11] MIPS: Octeon: Remove usage of cvmx_wait() everywhere Steven J. Hill
2017-11-14 19:08   ` Ralf Baechle
2017-11-14 20:30     ` James Hogan
2017-11-14 20:30       ` James Hogan
2017-11-14 20:45       ` Ralf Baechle
2017-11-27 18:56   ` David Daney
2017-11-28 11:04     ` James Hogan
2017-11-28 11:04       ` James Hogan
2017-11-28 18:44       ` David Daney
2017-11-14  4:30 ` [PATCH v3 05/11] MIPS: Octeon: Header and file cleaning Steven J. Hill
2017-11-14  4:30 ` [PATCH v3 06/11] MIPS: Octeon: Update values for CVMX_CIU_FUSE register Steven J. Hill
2017-11-14  4:30 ` [PATCH v3 07/11] MIPS: Octeon: Add Octeon III platforms for console output Steven J. Hill
2017-11-14  4:30 ` [PATCH v3 08/11] MIPS: Octeon: Remove crufty KEXEC and CRASH_DUMP code Steven J. Hill
2017-11-14  4:30 ` [PATCH v3 09/11] MIPS: Octeon: Populate kernel memory from cvmx_bootmem named blocks Steven J. Hill
2017-11-14  4:30 ` [PATCH v3 10/11] MIPS: Add the concept of BOOT_MEM_KERNEL to boot_mem_map Steven J. Hill
2017-11-14  4:30 ` [PATCH v3 11/11] MIPS: Octeon: Add working hotplug CPU support Steven J. Hill

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=20171114153958.GA16044@linux-mips.org \
    --to=ralf@linux-mips.org \
    --cc=david.daney@cavium.com \
    --cc=kreese@caviumnetworks.com \
    --cc=linux-mips@linux-mips.org \
    --cc=steven.hill@cavium.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox