From: Babu Moger <babu.moger@oracle.com>
To: davem@davemloft.net, peterz@infradead.org, mingo@redhat.com,
arnd@arndb.de
Cc: babu.moger@oracle.com, shannon.nelson@oracle.com,
haakon.bugge@oracle.com, steven.sistare@oracle.com,
vijay.ac.kumar@oracle.com, jane.chu@oracle.com,
sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arch@vger.kernel.org
Subject: [PATCH 4/6] arch/sparc: Enable queued rwlocks for SPARC
Date: Thu, 18 May 2017 18:36:08 -0600 [thread overview]
Message-ID: <1495154170-854693-5-git-send-email-babu.moger@oracle.com> (raw)
In-Reply-To: <1495154170-854693-1-git-send-email-babu.moger@oracle.com>
Enable queued rwlocks for SPARC. Here are the discussions on this feature
when this was introduced.
https://lwn.net/Articles/572765/
https://lwn.net/Articles/582200/
Signed-off-by: Babu Moger <babu.moger@oracle.com>
Reviewed-by: Håkon Bugge <haakon.bugge@oracle.com>
Reviewed-by: Jane Chu <jane.chu@oracle.com>
Reviewed-by: Shannon Nelson <shannon.nelson@oracle.com>
Reviewed-by: Vijay Kumar <vijay.ac.kumar@oracle.com>
---
arch/sparc/Kconfig | 1 +
arch/sparc/include/asm/qrwlock.h | 7 +++++++
arch/sparc/include/asm/spinlock_64.h | 9 ++++++---
arch/sparc/include/asm/spinlock_types.h | 5 ++++-
4 files changed, 18 insertions(+), 4 deletions(-)
create mode 100644 arch/sparc/include/asm/qrwlock.h
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 8787fc4..caeda1c 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -82,6 +82,7 @@ config SPARC64
select HAVE_ARCH_AUDITSYSCALL
select ARCH_SUPPORTS_ATOMIC_RMW
select HAVE_NMI
+ select ARCH_USE_QUEUED_RWLOCKS
config ARCH_DEFCONFIG
string
diff --git a/arch/sparc/include/asm/qrwlock.h b/arch/sparc/include/asm/qrwlock.h
new file mode 100644
index 0000000..d68a4b1
--- /dev/null
+++ b/arch/sparc/include/asm/qrwlock.h
@@ -0,0 +1,7 @@
+#ifndef _ASM_SPARC_QRWLOCK_H
+#define _ASM_SPARC_QRWLOCK_H
+
+#include <asm-generic/qrwlock_types.h>
+#include <asm-generic/qrwlock.h>
+
+#endif /* _ASM_SPARC_QRWLOCK_H */
diff --git a/arch/sparc/include/asm/spinlock_64.h b/arch/sparc/include/asm/spinlock_64.h
index 07c9f2e..562dbd8 100644
--- a/arch/sparc/include/asm/spinlock_64.h
+++ b/arch/sparc/include/asm/spinlock_64.h
@@ -94,6 +94,7 @@ static inline void arch_spin_lock_flags(arch_spinlock_t *lock, unsigned long fla
: "memory");
}
+#ifndef CONFIG_QUEUED_RWLOCKS
/* Multi-reader locks, these are much saner than the 32-bit Sparc ones... */
static inline void arch_read_lock(arch_rwlock_t *lock)
@@ -214,12 +215,14 @@ static inline int arch_write_trylock(arch_rwlock_t *lock)
return result;
}
-#define arch_read_lock_flags(p, f) arch_read_lock(p)
-#define arch_write_lock_flags(p, f) arch_write_lock(p)
-
#define arch_read_can_lock(rw) (!((rw)->lock & 0x80000000UL))
#define arch_write_can_lock(rw) (!(rw)->lock)
+#endif /* #ifndef CONFIG_QUEUED_RWLOCKS */
+#include <asm/qrwlock.h>
+#define arch_read_lock_flags(p, f) arch_read_lock(p)
+#define arch_write_lock_flags(p, f) arch_write_lock(p)
+
#define arch_spin_relax(lock) cpu_relax()
#define arch_read_relax(lock) cpu_relax()
#define arch_write_relax(lock) cpu_relax()
diff --git a/arch/sparc/include/asm/spinlock_types.h b/arch/sparc/include/asm/spinlock_types.h
index 9c454fd..e052d28 100644
--- a/arch/sparc/include/asm/spinlock_types.h
+++ b/arch/sparc/include/asm/spinlock_types.h
@@ -11,10 +11,13 @@
#define __ARCH_SPIN_LOCK_UNLOCKED { 0 }
+#ifdef CONFIG_QUEUED_RWLOCKS
+#include <asm-generic/qrwlock_types.h>
+#else
typedef struct {
volatile unsigned int lock;
} arch_rwlock_t;
#define __ARCH_RW_LOCK_UNLOCKED { 0 }
-
+#endif /* CONFIG_QUEUED_RWLOCKS */
#endif
--
1.7.1
next prev parent reply other threads:[~2017-05-19 0:36 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-19 0:36 [PATCH 0/6] Enable queued rwlock and queued spinlock for SPARC Babu Moger
2017-05-19 0:36 ` Babu Moger
2017-05-19 0:36 ` [PATCH 1/6] kernel/locking: Fix compile error with qrwlock.c Babu Moger
2017-05-19 0:36 ` Babu Moger
2017-05-19 2:27 ` David Miller
2017-05-19 2:27 ` David Miller
2017-05-19 16:35 ` Babu Moger
2017-05-19 0:36 ` [PATCH 2/6] arch/sparc: Define config parameter CPU_BIG_ENDIAN Babu Moger
2017-05-19 0:36 ` Babu Moger
2017-05-19 2:26 ` David Miller
2017-05-19 16:26 ` Babu Moger
2017-05-19 0:36 ` [PATCH 3/6] arch/sparc: Introduce cmpxchg_u8 SPARC Babu Moger
2017-05-19 0:36 ` Babu Moger [this message]
2017-05-19 0:36 ` [PATCH 4/6] arch/sparc: Enable queued rwlocks for SPARC Babu Moger
2017-05-19 2:31 ` David Miller
2017-05-19 2:31 ` David Miller
2017-05-19 9:03 ` Peter Zijlstra
2017-05-19 16:43 ` Babu Moger
2017-05-19 19:15 ` David Miller
2017-05-19 19:15 ` David Miller
2017-05-19 19:31 ` Peter Zijlstra
2017-05-19 19:31 ` Peter Zijlstra
2017-05-19 19:35 ` David Miller
2017-05-19 19:35 ` David Miller
2017-05-19 16:36 ` Babu Moger
2017-05-19 0:36 ` [PATCH 5/6] arch/sparc: Introduce xchg16 " Babu Moger
2017-05-19 0:36 ` [PATCH 6/6] arch/sparc: Enable queued spinlock support " Babu Moger
2017-05-19 2:32 ` David Miller
2017-05-19 16:37 ` Babu Moger
2017-05-19 16:37 ` Babu Moger
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=1495154170-854693-5-git-send-email-babu.moger@oracle.com \
--to=babu.moger@oracle.com \
--cc=arnd@arndb.de \
--cc=davem@davemloft.net \
--cc=haakon.bugge@oracle.com \
--cc=jane.chu@oracle.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=shannon.nelson@oracle.com \
--cc=sparclinux@vger.kernel.org \
--cc=steven.sistare@oracle.com \
--cc=vijay.ac.kumar@oracle.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;
as well as URLs for NNTP newsgroup(s).