mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Waiman Long <Waiman.Long@hp.com>
To: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	Arnd Bergmann <arnd@arndb.de>
Cc: linux-arch@vger.kernel.org, x86@kernel.org,
	linux-kernel@vger.kernel.org,
	Peter Zijlstra <peterz@infradead.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Michel Lespinasse <walken@google.com>,
	Andi Kleen <andi@firstfloor.org>, Rik van Riel <riel@redhat.com>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>,
	George Spelvin <linux@horizon.com>,
	Tim Chen <tim.c.chen@linux.intel.com>,
	"Aswin Chandramouleeswaran\"" <aswin@hp.com>,
	Scott J Norton <scott.norton@hp.com>,
	Waiman Long <Waiman.Long@hp.com>
Subject: [PATCH v8 4/4] qrwlock: Use smp_store_release() in write_unlock()
Date: Wed,  8 Jan 2014 11:59:36 -0500	[thread overview]
Message-ID: <1389200376-62792-5-git-send-email-Waiman.Long@hp.com> (raw)
In-Reply-To: <1389200376-62792-1-git-send-email-Waiman.Long@hp.com>

This patch modifies the queue_write_unlock() function to use the
new smp_store_release() function in another pending patch. It also
removes the temporary implementation of smp_load_acquire() and
smp_store_release() function in qrwlock.c.

This patch should only be merged if PeterZ's linux-arch patch patch
was merged.

Signed-off-by: Waiman Long <Waiman.Long@hp.com>
Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 include/asm-generic/qrwlock.h |    4 +---
 kernel/locking/qrwlock.c      |   34 ----------------------------------
 2 files changed, 1 insertions(+), 37 deletions(-)

diff --git a/include/asm-generic/qrwlock.h b/include/asm-generic/qrwlock.h
index 2b9a7b4..4d4bd04 100644
--- a/include/asm-generic/qrwlock.h
+++ b/include/asm-generic/qrwlock.h
@@ -179,9 +179,7 @@ static inline void queue_write_unlock(struct qrwlock *lock)
 	/*
 	 * Make sure that none of the critical section will be leaked out.
 	 */
-	smp_mb__before_clear_bit();
-	ACCESS_ONCE(lock->cnts.writer) = 0;
-	smp_mb__after_clear_bit();
+	smp_store_release(&lock->cnts.writer, 0)
 }
 
 /*
diff --git a/kernel/locking/qrwlock.c b/kernel/locking/qrwlock.c
index 1b3ffb2..3d3ba2b 100644
--- a/kernel/locking/qrwlock.c
+++ b/kernel/locking/qrwlock.c
@@ -48,40 +48,6 @@
 # define arch_mutex_cpu_relax() cpu_relax()
 #endif
 
-#ifndef smp_load_acquire
-# ifdef CONFIG_X86
-#   define smp_load_acquire(p)				\
-	({						\
-		typeof(*p) ___p1 = ACCESS_ONCE(*p);	\
-		barrier();				\
-		___p1;					\
-	})
-# else
-#   define smp_load_acquire(p)				\
-	({						\
-		typeof(*p) ___p1 = ACCESS_ONCE(*p);	\
-		smp_mb();				\
-		___p1;					\
-	})
-# endif
-#endif
-
-#ifndef smp_store_release
-# ifdef CONFIG_X86
-#   define smp_store_release(p, v)			\
-	do {						\
-		barrier();				\
-		ACCESS_ONCE(*p) = v;			\
-	} while (0)
-# else
-#   define smp_store_release(p, v)			\
-	do {						\
-		smp_mb();				\
-		ACCESS_ONCE(*p) = v;			\
-	} while (0)
-# endif
-#endif
-
 /*
  * If an xadd (exchange-add) macro isn't available, simulate one with
  * the atomic_add_return() function.
-- 
1.7.1


  parent reply	other threads:[~2014-01-08 17:01 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-08 16:59 [PATCH v8 0/4] qrwlock: Introducing a queue read/write lock implementation Waiman Long
2014-01-08 16:59 ` [PATCH v8 1/4] qrwlock: A " Waiman Long
2014-01-10  6:41   ` Paul E. McKenney
2014-01-08 16:59 ` [PATCH v8 2/4] qrwlock x86: Enable x86 to use queue read/write lock Waiman Long
2014-01-08 16:59 ` [PATCH v8 3/4] qrwlock: Use the mcs_spinlock helper functions for MCS queuing Waiman Long
2014-01-08 16:59 ` Waiman Long [this message]
2014-01-10  6:42 ` [PATCH v8 0/4] qrwlock: Introducing a queue read/write lock implementation Paul E. McKenney
2014-01-10 15:34   ` Waiman Long
2014-01-13  2:47 [PATCH v8 4/4] qrwlock: Use smp_store_release() in write_unlock() Daniel J Blueman
2014-01-13  3:49 ` Paul E. McKenney
2014-01-13 16:41 ` Waiman Long
2014-01-14  2:28   ` Daniel J Blueman
2014-01-14 11:03     ` Peter Zijlstra
2014-01-14 15:25       ` Waiman Long
2014-01-14 17:08       ` Matt Turner
2014-01-14 18:01         ` Richard Henderson
2014-01-14 19:09           ` Waiman Long
2014-01-14 20:20             ` Peter Zijlstra
2014-01-14 23:44           ` Paul E. McKenney
2014-01-15  0:25             ` Linus Torvalds
2014-01-15  2:39               ` Paul E. McKenney
2014-01-15  8:07                 ` Peter Zijlstra
2014-01-15 20:53                   ` Paul E. McKenney
2014-01-15 23:21                     ` Peter Zijlstra
     [not found]                       ` <CA+55aFydYLQeBq=4AQQp_4dAnq09ocLmde1LFaXiNAJ=wJzfFA@mail.gmail.com>
2014-01-16 10:36                         ` Peter Zijlstra
2014-01-18 10:01                           ` Paul E. McKenney
2014-01-18 11:34                             ` Peter Zijlstra
2014-01-18 12:25                               ` Paul E. McKenney
2014-01-18 12:41                                 ` Peter Zijlstra
2014-01-18 21:22                                   ` Paul E. McKenney
2014-01-19  0:57                                     ` Linus Torvalds
2014-01-19  8:04                                       ` Paul E. McKenney
2014-01-19 19:56                                         ` Linus Torvalds
2014-01-20  0:52                                           ` Paul E. McKenney
2014-01-21 15:02                                         ` Waiman Long
2014-01-21 15:41                                           ` Peter Zijlstra
2014-01-21 16:16                                             ` Waiman Long
2014-01-15  3:08             ` Daniel J Blueman

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=1389200376-62792-5-git-send-email-Waiman.Long@hp.com \
    --to=waiman.long@hp.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=arnd@arndb.de \
    --cc=aswin@hp.com \
    --cc=hpa@zytor.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@horizon.com \
    --cc=mingo@redhat.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=raghavendra.kt@linux.vnet.ibm.com \
    --cc=riel@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=scott.norton@hp.com \
    --cc=tglx@linutronix.de \
    --cc=tim.c.chen@linux.intel.com \
    --cc=torvalds@linux-foundation.org \
    --cc=walken@google.com \
    --cc=x86@kernel.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

Powered by JetHome