All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthias Kaehlcke <mka@chromium.org>
To: Guenter Roeck <linux@roeck-us.net>
Cc: David Howells <dhowells@redhat.com>,
	Sudip Mukherjee <sudipm.mukherjee@gmail.com>,
	linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: frv build failure in mainline kernel
Date: Tue, 16 May 2017 10:58:20 -0700	[thread overview]
Message-ID: <20170516175820.GC141096@google.com> (raw)
In-Reply-To: <20170516172130.GA32182@roeck-us.net>

El Tue, May 16, 2017 at 10:21:30AM -0700 Guenter Roeck ha dit:

> On Tue, May 16, 2017 at 05:04:32PM +0100, David Howells wrote:
> > Guenter Roeck <linux@roeck-us.net> wrote:
> > 
> > > Turns out not here because ____cacheline_aligned_in_smp includes
> > > __page_aligned_data which also declares the section, at least on x86.
> > 
> > If there's any sort of section specification, that should suffice, I think.
> > The problem might come that jiffies and jiffies_64 don't coincide at the same
> > address because FRV is BE not LE.
> > 
> > It ought to be possible to make jiffies 64-bit on FRV since it has double-word
> > instructions that can load/store aligned 64-bit values atomically to/from a
> > register pair.  That might require some compiler magic, though.  I'll have to
> > try and work out if that's possible.
> > 
> I tried:
> 
> diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
> index 36872fbb815d..26d0655c4422 100644
> --- a/include/linux/jiffies.h
> +++ b/include/linux/jiffies.h
> @@ -64,13 +64,15 @@ 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)
>  
> +#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 __cacheline_aligned_in_smp jiffies_64;
> -extern unsigned long volatile __cacheline_aligned_in_smp jiffies;
> +extern u64 __cacheline_aligned_in_smp __jiffy_data jiffies_64;
> +extern unsigned long volatile __cacheline_aligned_in_smp __jiffy_data jiffies;
> 
> This is what I get when building defconfig:
> 
>   CC      arch/x86/kernel/asm-offsets.s
> In file included from ./include/linux/ktime.h:25:0,
>                  from ./include/linux/rcupdate.h:46,
>                  from ./include/linux/srcu.h:33,
>                  from ./include/linux/notifier.h:15,
>                  from ./include/linux/memory_hotplug.h:6,
>                  from ./include/linux/mmzone.h:757,
>                  from ./include/linux/gfp.h:5,
>                  from ./include/linux/slab.h:14,
>                  from ./include/linux/crypto.h:24,
>                  from arch/x86/kernel/asm-offsets.c:8:
> ./include/linux/jiffies.h:74:52: error: section of ‘jiffies_64’ conflicts with previous declaration
>  extern u64 __cacheline_aligned_in_smp __jiffy_data jiffies_64;
>                                                     ^
> ./include/linux/jiffies.h:75:71: error: section of ‘jiffies’ conflicts with previous declaration
>  extern unsigned long volatile __cacheline_aligned_in_smp __jiffy_data jiffies;
>                                                                        ^
> Kbuild:56: recipe for target 'arch/x86/kernel/asm-offsets.s' failed
> make[1]: *** [arch/x86/kernel/asm-offsets.s] Error 1
> Makefile:1061: recipe for target 'prepare0' failed
> make: *** [prepare0] Error 2

Thanks for giving it a try!

What would work is this:

diff --git a/arch/frv/include/asm/cache.h b/arch/frv/include/asm/cache.h
index 2797163b8f4f..25bf4e85f582 100644
--- a/arch/frv/include/asm/cache.h
+++ b/arch/frv/include/asm/cache.h
@@ -20,4 +20,6 @@
 #define __cacheline_aligned    __attribute__((aligned(L1_CACHE_BYTES)))
 #define ____cacheline_aligned  __attribute__((aligned(L1_CACHE_BYTES)))
 
+#define __jiffies_arch_xyz     __attribute__((__section__(".data")))
+
 #endif
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index 36872fbb815d..8904eb52928d 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -70,7 +70,7 @@ extern int register_refined_jiffies(long clock_tick_rate);
  * get_jiffies_64() will do this for you as appropriate.
  */
 extern u64 __cacheline_aligned_in_smp jiffies_64;
-extern unsigned long volatile __cacheline_aligned_in_smp jiffies;
+extern unsigned long volatile __cacheline_aligned_in_smp __jiffies_arch_xyz jiffies;
 
 #if (BITS_PER_LONG < 64)
 u64 get_jiffies_64(void);


We'd only have to find a halfway decent name for __jiffies_arch_xyz.

Matthias

  reply	other threads:[~2017-05-16 17:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-15 17:02 frv build failure in mainline kernel Guenter Roeck
2017-05-15 19:13 ` Matthias Kaehlcke
2017-05-16  4:42   ` Guenter Roeck
2017-05-16 12:44     ` David Howells
2017-05-16 14:06       ` Guenter Roeck
2017-05-16 16:04         ` David Howells
2017-05-16 17:21           ` Guenter Roeck
2017-05-16 17:58             ` Matthias Kaehlcke [this message]
2017-05-16 18:22               ` Guenter Roeck
2017-05-16 20:44                 ` Matthias Kaehlcke

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=20170516175820.GC141096@google.com \
    --to=mka@chromium.org \
    --cc=akpm@linux-foundation.org \
    --cc=dhowells@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=sudipm.mukherjee@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.