linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: hoeun.ryu@gmail.com (Hoeun Ryu)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC 1/3] arch: add 64BIT_ATOMIC_ACCESS to support 64bit atomic access on 32bit machines
Date: Thu, 24 Aug 2017 14:42:55 +0900	[thread overview]
Message-ID: <1503553377-3646-2-git-send-email-hoeun.ryu@gmail.com> (raw)
In-Reply-To: <1503553377-3646-1-git-send-email-hoeun.ryu@gmail.com>

 On some 32-bit architectures, 64bit accesses are atomic when certain
conditions are satisfied.
 For example, on LPAE (Large Physical Address Extension) enabled ARM
architecture, 'ldrd/strd' (load/store doublewords) instructions are 64bit
atomic as long as the address is 64-bit aligned. This feature is to
guarantee atomic accesses on newly introduced 64bit wide descriptors in
the translation tables, and 's/u64' variables can be accessed atomically
when they are aligned(8) on LPAE enabled ARM architecture machines.

 Introducing 64BIT_ATOMIC_ACCESS and 64BIT_ATOMIC_ALIGNED_ACCESS, which
can be true for the 32bit architectures as well as 64bit architectures,
we can optimize some kernel codes using seqlock (timekeeping) or mimics
of it (like in sched/cfq) simply to read or write 64bit variables.
 The existing codes depend on CONFIG_64BIT to determine whether the 64bit
variables can be directly accessed or need additional synchronization
primitives like seqlock. CONFIG_64BIT_ATOMIC_ACCESS can be used instead of
CONFIG_64BIT in the cases.
 64BIT_ATOMIC_ALIGNED_ACCESS can be used in the variable declaration to
indicate the alignment requirement to the compiler
(__attribute__((aligned(8)))) in the way of #ifdef.

Signed-off-by: Hoeun Ryu <hoeun.ryu@gmail.com>
---
 arch/Kconfig | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/arch/Kconfig b/arch/Kconfig
index 21d0089..1def331 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -115,6 +115,26 @@ config UPROBES
 	    managed by the kernel and kept transparent to the probed
 	    application. )
 
+config 64BIT_ATOMIC_ACCESS
+	def_bool 64BIT
+	help
+	  On some 32bit architectures as well as 64bit architectures,
+	  64bit accesses are atomic when certain conditions are satisfied.
+
+	  This symbol should be selected by an architecture if 64 bit
+	  accesses can be atomic.
+
+config 64BIT_ATOMIC_ALIGNED_ACCESS
+	def_bool n
+	depends on 64BIT_ATOMIC_ACCESS
+	help
+	  On 64BIT_ATOMIC_ACCESS enabled system, the address should be
+	  aligned by 8 to guarantee the accesses are atomic.
+
+	  This symbol should be selected by an architecture if 64 bit
+	  accesses are required to be 64 bit aligned to guarantee that
+	  the 64bit accesses are atomic.
+
 config HAVE_64BIT_ALIGNED_ACCESS
 	def_bool 64BIT && !HAVE_EFFICIENT_UNALIGNED_ACCESS
 	help
-- 
2.7.4

  reply	other threads:[~2017-08-24  5:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-24  5:42 [RFC 0/3] add 64BIT_ATOMIC_ACCESS and 64BIT_ATOMIC_ALIGNED_ACCESS Hoeun Ryu
2017-08-24  5:42 ` Hoeun Ryu [this message]
2017-08-24  5:42 ` [RFC 2/3] arm: enable 64BIT_ATOMIC(_ALIGNED)_ACCESS on LPAE enabled machines Hoeun Ryu
2017-08-24  5:42 ` [RFC 3/3] sched: depend on 64BIT_ATOMIC_ACCESS to determine if to use min_vruntime_copy Hoeun Ryu
2017-08-24  8:49   ` Peter Zijlstra

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=1503553377-3646-2-git-send-email-hoeun.ryu@gmail.com \
    --to=hoeun.ryu@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.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).