Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1600855 > unrolled thread

[PATCH] jiffies.h: Declare jiffies and jiffies_64 with ____cacheline_aligned_in_smp

Started byMatthias Kaehlcke <mka@chromium.org>
First post2017-03-14 20:50 +0100
Last post2017-03-23 22:00 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] jiffies.h: Declare jiffies and jiffies_64 with ____cacheline_aligned_in_smp Matthias Kaehlcke <mka@chromium.org> - 2017-03-14 20:50 +0100
    Re: [PATCH] jiffies.h: Declare jiffies and jiffies_64 with ____cacheline_aligned_in_smp Grant Grundler <grundler@chromium.org> - 2017-03-23 22:00 +0100

#1600855 — [PATCH] jiffies.h: Declare jiffies and jiffies_64 with ____cacheline_aligned_in_smp

FromMatthias Kaehlcke <mka@chromium.org>
Date2017-03-14 20:50 +0100
Subject[PATCH] jiffies.h: Declare jiffies and jiffies_64 with ____cacheline_aligned_in_smp
Message-ID<tl0Cd-4V8-5@gated-at.bofh.it>
jiffies_64 is defined in kernel/time/timer.c with ____cacheline_aligned_in_smp,
however this macro is not part of the declaration of jiffies and jiffies_64
in jiffies.h.

As a result clang generates the following warning:

kernel/time/timer.c:57:26: error: section does not match previous declaration [-Werror,-Wsection]
__visible u64 jiffies_64 __cacheline_aligned_in_smp = INITIAL_JIFFIES;
                         ^
include/linux/cache.h:39:36: note: expanded from macro '__cacheline_aligned_in_smp'
                                   ^
include/linux/cache.h:34:4: note: expanded from macro '__cacheline_aligned'
                 __section__(".data..cacheline_aligned")))
                 ^
include/linux/jiffies.h:77:12: note: previous attribute is here
extern u64 __jiffy_data jiffies_64;
           ^
include/linux/jiffies.h:70:38: note: expanded from macro '__jiffy_data'

Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
---
 include/linux/jiffies.h | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index 589d14e970ad..175873a814fd 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -1,6 +1,7 @@
 #ifndef _LINUX_JIFFIES_H
 #define _LINUX_JIFFIES_H
 
+#include <linux/cache.h>
 #include <linux/math64.h>
 #include <linux/kernel.h>
 #include <linux/types.h>
@@ -63,19 +64,13 @@ extern int register_refined_jiffies(long clock_tick_rate);
 /* TICK_USEC is the time between ticks in usec assuming fake USER_HZ */
 #define TICK_USEC ((1000000UL + USER_HZ/2) / USER_HZ)
 
-/* some arch's have a small-data section that can be accessed register-relative
- * but that can only take up to, say, 4-byte variables. jiffies being part of
- * an 8-byte variable may not be correctly accessed unless we force the issue
- */
-#define __jiffy_data  __attribute__((section(".data")))
-
 /*
  * The 64-bit value is not atomic - you MUST NOT read it
  * without sampling the sequence number in jiffies_lock.
  * get_jiffies_64() will do this for you as appropriate.
  */
-extern u64 __jiffy_data jiffies_64;
-extern unsigned long volatile __jiffy_data jiffies;
+extern u64 __cacheline_aligned_in_smp jiffies_64;
+extern unsigned long volatile __cacheline_aligned_in_smp jiffies;
 
 #if (BITS_PER_LONG < 64)
 u64 get_jiffies_64(void);
-- 
2.12.0.367.g23dc2f6d3c-goog

[toc] | [next] | [standalone]


#1607908

FromGrant Grundler <grundler@chromium.org>
Date2017-03-23 22:00 +0100
Message-ID<tohZU-7Mb-13@gated-at.bofh.it>
In reply to#1600855
Ping? Any feedback on this patch?
Is this in someone's queue for review?

thanks,
grant

On Tue, Mar 14, 2017 at 12:40 PM, Matthias Kaehlcke <mka@chromium.org> wrote:
> jiffies_64 is defined in kernel/time/timer.c with ____cacheline_aligned_in_smp,
> however this macro is not part of the declaration of jiffies and jiffies_64
> in jiffies.h.
>
> As a result clang generates the following warning:
>
> kernel/time/timer.c:57:26: error: section does not match previous declaration [-Werror,-Wsection]
> __visible u64 jiffies_64 __cacheline_aligned_in_smp = INITIAL_JIFFIES;
>                          ^
> include/linux/cache.h:39:36: note: expanded from macro '__cacheline_aligned_in_smp'
>                                    ^
> include/linux/cache.h:34:4: note: expanded from macro '__cacheline_aligned'
>                  __section__(".data..cacheline_aligned")))
>                  ^
> include/linux/jiffies.h:77:12: note: previous attribute is here
> extern u64 __jiffy_data jiffies_64;
>            ^
> include/linux/jiffies.h:70:38: note: expanded from macro '__jiffy_data'
>
> Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
> ---
>  include/linux/jiffies.h | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
>
> diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
> index 589d14e970ad..175873a814fd 100644
> --- a/include/linux/jiffies.h
> +++ b/include/linux/jiffies.h
> @@ -1,6 +1,7 @@
>  #ifndef _LINUX_JIFFIES_H
>  #define _LINUX_JIFFIES_H
>
> +#include <linux/cache.h>
>  #include <linux/math64.h>
>  #include <linux/kernel.h>
>  #include <linux/types.h>
> @@ -63,19 +64,13 @@ extern int register_refined_jiffies(long clock_tick_rate);
>  /* TICK_USEC is the time between ticks in usec assuming fake USER_HZ */
>  #define TICK_USEC ((1000000UL + USER_HZ/2) / USER_HZ)
>
> -/* some arch's have a small-data section that can be accessed register-relative
> - * but that can only take up to, say, 4-byte variables. jiffies being part of
> - * an 8-byte variable may not be correctly accessed unless we force the issue
> - */
> -#define __jiffy_data  __attribute__((section(".data")))
> -
>  /*
>   * The 64-bit value is not atomic - you MUST NOT read it
>   * without sampling the sequence number in jiffies_lock.
>   * get_jiffies_64() will do this for you as appropriate.
>   */
> -extern u64 __jiffy_data jiffies_64;
> -extern unsigned long volatile __jiffy_data jiffies;
> +extern u64 __cacheline_aligned_in_smp jiffies_64;
> +extern unsigned long volatile __cacheline_aligned_in_smp jiffies;
>
>  #if (BITS_PER_LONG < 64)
>  u64 get_jiffies_64(void);
> --
> 2.12.0.367.g23dc2f6d3c-goog
>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web