Skip to contentSkip to conversation

frv build failure in mainline kernel

DISCUSSION Guenter Roeck 3 participants 10 messages May 15, 2017 – May 16, 2017

lore
Share & tools
lore
#0 lore raw

Hi all,

frv fails to build in mainline with the following build errors.

kernel/built-in.o: In function `__do_softirq':
(.text+0x6460): relocation truncated to fit: R_FRV_GPREL12 against symbol `jiffies' defined in *ABS* section in .tmp_vmlinux1
kernel/built-in.o: In function `__do_softirq':
(.text+0x6574): relocation truncated to fit: R_FRV_GPREL12 against symbol `jiffies' defined in *ABS* section in .tmp_vmlinux1
kernel/built-in.o: In function `pwq_activate_delayed_work':
workqueue.c:(.text+0x15b9c): relocation truncated to fit: R_FRV_GPREL12 against symbol jiffies' defined in *ABS* section in .tmp_vmlinux1 kernel/built-in.o: In function worker_enter_idle':
workqueue.c:(.text+0x1612c): relocation truncated to fit: R_FRV_GPREL12 against symbol jiffies' defined in *ABS* section in .tmp_vmlinux1 workqueue.c:(.text+0x161f0): relocation truncated to fit: R_FRV_GPREL12 against symbol jiffies' defined in *ABS* section in .tmp_vmlinux1 kernel/built-in.o: In function `pool_mayday_timeout':
workqueue.c:(.text+0x1630c): relocation truncated to fit: R_FRV_GPREL12 against symbol jiffies' defined in *ABS* section in .tmp_vmlinux1 kernel/built-in.o: In function idle_worker_timeout':
workqueue.c:(.text+0x1649c): relocation truncated to fit: R_FRV_GPREL12 against symbol jiffies' defined in *ABS* section in .tmp_vmlinux1 workqueue.c:(.text+0x164f8): relocation truncated to fit: R_FRV_GPREL12 against symbol jiffies' defined in *ABS* section in .tmp_vmlinux1 kernel/built-in.o: In function `__queue_work':
workqueue.c:(.text+0x170f4): relocation truncated to fit: R_FRV_GPREL12 against symbol jiffies' defined in *ABS* section in .tmp_vmlinux1 kernel/built-in.o: In function __queue_delayed_work':
workqueue.c:(.text+0x1745c): relocation truncated to fit: R_FRV_GPREL12 against symbol jiffies' defined in *ABS* section in .tmp_vmlinux1 kernel/built-in.o: In function worker_thread':
workqueue.c:(.text+0x182e4): additional relocation overflows omitted from the output

Bisect points to commit 7c30f352c852 ("jiffies.h: declare jiffies and jiffies_64 with ____cacheline_aligned_in_smp"). Bisect log is attached.

Guenter

---
# bad: [2ea659a9ef488125eb46da6eb571de5eae5c43f6] Linux 4.12-rc1
# good: [13e0988140374123bead1dd27c287354cb95108e] docs: complete bumping minimal GNU Make version to 3.81
git bisect start 'HEAD' '13e098814037'
# bad: [c6778ff813d2ca3e3c8733c87dc8b6831a64578b] Merge tag 'armsoc-dt64' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
git bisect bad c6778ff813d2ca3e3c8733c87dc8b6831a64578b
# bad: [11fbf53d66ec302fe50b06bd7cb4863dbb98775a] Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
git bisect bad 11fbf53d66ec302fe50b06bd7cb4863dbb98775a
# good: [2d3e4866dea96b0506395b47bfefb234f2088dac] Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
git bisect good 2d3e4866dea96b0506395b47bfefb234f2088dac
# bad: [8f3207c7eab9d885cc64c778416537034a7d9c5b] Merge tag 'tty-4.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
git bisect bad 8f3207c7eab9d885cc64c778416537034a7d9c5b
# bad: [063246641d4a9e9de84a2466fbad50112faf88dc] format-security: move static strings to const
git bisect bad 063246641d4a9e9de84a2466fbad50112faf88dc
# bad: [f61e869d519c0c11a8d80a503cfdfb4897df855a] kcov: simplify interrupt check
git bisect bad f61e869d519c0c11a8d80a503cfdfb4897df855a
# bad: [0b523769ebb9473c60df1b0f70615aa82ebac2c9] checkpatch: add ability to find bad uses of vsprintf %p<foo> extensions git bisect bad 0b523769ebb9473c60df1b0f70615aa82ebac2c9
# good: [3d88936f35bc67f7bee2efd4eec69baf26c17a5a] drivers/virt/fsl_hypervisor.c: use get_user_pages_unlocked() git bisect good 3d88936f35bc67f7bee2efd4eec69baf26c17a5a
# bad: [8128a31eaadbcdfa37774bbd28f3f00bac69996a] drivers/misc/c2port/c2port-duramar2150.c: checking for NULL instead of IS_ERR() git bisect bad 8128a31eaadbcdfa37774bbd28f3f00bac69996a
# bad: [31b8cc80776c1b5a17abda6e0bbb5c615b9d90e4] make help: add tools help target
git bisect bad 31b8cc80776c1b5a17abda6e0bbb5c615b9d90e4
# bad: [7c30f352c852bae2715ad65ac4a38ca9af7d7696] jiffies.h: declare jiffies and jiffies_64 with ____cacheline_aligned_in_smp git bisect bad 7c30f352c852bae2715ad65ac4a38ca9af7d7696

# first bad commit: [7c30f352c852bae2715ad65ac4a38ca9af7d7696] jiffies.h: declare jiffies and jiffies_64 with ____cacheline_aligned_in_smp
#1 lore raw

El Mon, May 15, 2017 at 10:02:15AM -0700 Guenter Roeck ha dit:

Quoted 66 lines

Hi all,

frv fails to build in mainline with the following build errors.

kernel/built-in.o: In function `__do_softirq':
(.text+0x6460): relocation truncated to fit: R_FRV_GPREL12 against symbol `jiffies' defined in *ABS* section in .tmp_vmlinux1
kernel/built-in.o: In function `__do_softirq':
(.text+0x6574): relocation truncated to fit: R_FRV_GPREL12 against symbol `jiffies' defined in *ABS* section in .tmp_vmlinux1
kernel/built-in.o: In function `pwq_activate_delayed_work':
workqueue.c:(.text+0x15b9c): relocation truncated to fit: R_FRV_GPREL12 against symbol jiffies' defined in *ABS* section in .tmp_vmlinux1 kernel/built-in.o: In function worker_enter_idle':
workqueue.c:(.text+0x1612c): relocation truncated to fit: R_FRV_GPREL12 against symbol jiffies' defined in *ABS* section in .tmp_vmlinux1 workqueue.c:(.text+0x161f0): relocation truncated to fit: R_FRV_GPREL12 against symbol jiffies' defined in *ABS* section in .tmp_vmlinux1 kernel/built-in.o: In function `pool_mayday_timeout':
workqueue.c:(.text+0x1630c): relocation truncated to fit: R_FRV_GPREL12 against symbol jiffies' defined in *ABS* section in .tmp_vmlinux1 kernel/built-in.o: In function idle_worker_timeout':
workqueue.c:(.text+0x1649c): relocation truncated to fit: R_FRV_GPREL12 against symbol jiffies' defined in *ABS* section in .tmp_vmlinux1 workqueue.c:(.text+0x164f8): relocation truncated to fit: R_FRV_GPREL12 against symbol jiffies' defined in *ABS* section in .tmp_vmlinux1 kernel/built-in.o: In function `__queue_work':
workqueue.c:(.text+0x170f4): relocation truncated to fit: R_FRV_GPREL12 against symbol jiffies' defined in *ABS* section in .tmp_vmlinux1 kernel/built-in.o: In function __queue_delayed_work':
workqueue.c:(.text+0x1745c): relocation truncated to fit: R_FRV_GPREL12 against symbol jiffies' defined in *ABS* section in .tmp_vmlinux1 kernel/built-in.o: In function worker_thread':
workqueue.c:(.text+0x182e4): additional relocation overflows omitted from the output

Bisect points to commit 7c30f352c852 ("jiffies.h: declare jiffies and jiffies_64 with ____cacheline_aligned_in_smp"). Bisect log is attached.

Guenter

---
# bad: [2ea659a9ef488125eb46da6eb571de5eae5c43f6] Linux 4.12-rc1
# good: [13e0988140374123bead1dd27c287354cb95108e] docs: complete bumping minimal GNU Make version to 3.81
git bisect start 'HEAD' '13e098814037'
# bad: [c6778ff813d2ca3e3c8733c87dc8b6831a64578b] Merge tag 'armsoc-dt64' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
git bisect bad c6778ff813d2ca3e3c8733c87dc8b6831a64578b
# bad: [11fbf53d66ec302fe50b06bd7cb4863dbb98775a] Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
git bisect bad 11fbf53d66ec302fe50b06bd7cb4863dbb98775a
# good: [2d3e4866dea96b0506395b47bfefb234f2088dac] Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
git bisect good 2d3e4866dea96b0506395b47bfefb234f2088dac
# bad: [8f3207c7eab9d885cc64c778416537034a7d9c5b] Merge tag 'tty-4.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
git bisect bad 8f3207c7eab9d885cc64c778416537034a7d9c5b
# bad: [063246641d4a9e9de84a2466fbad50112faf88dc] format-security: move static strings to const
git bisect bad 063246641d4a9e9de84a2466fbad50112faf88dc
# bad: [f61e869d519c0c11a8d80a503cfdfb4897df855a] kcov: simplify interrupt check
git bisect bad f61e869d519c0c11a8d80a503cfdfb4897df855a
# bad: [0b523769ebb9473c60df1b0f70615aa82ebac2c9] checkpatch: add ability to find bad uses of vsprintf %p<foo> extensions git bisect bad 0b523769ebb9473c60df1b0f70615aa82ebac2c9
# good: [3d88936f35bc67f7bee2efd4eec69baf26c17a5a] drivers/virt/fsl_hypervisor.c: use get_user_pages_unlocked() git bisect good 3d88936f35bc67f7bee2efd4eec69baf26c17a5a
# bad: [8128a31eaadbcdfa37774bbd28f3f00bac69996a] drivers/misc/c2port/c2port-duramar2150.c: checking for NULL instead of IS_ERR() git bisect bad 8128a31eaadbcdfa37774bbd28f3f00bac69996a
# bad: [31b8cc80776c1b5a17abda6e0bbb5c615b9d90e4] make help: add tools help target
git bisect bad 31b8cc80776c1b5a17abda6e0bbb5c615b9d90e4
# bad: [7c30f352c852bae2715ad65ac4a38ca9af7d7696] jiffies.h: declare jiffies and jiffies_64 with ____cacheline_aligned_in_smp git bisect bad 7c30f352c852bae2715ad65ac4a38ca9af7d7696

Quoted 3 lines
# first bad commit: [7c30f352c852bae2715ad65ac4a38ca9af7d7696]
jiffies.h: declare jiffies and jiffies_64 with
____cacheline_aligned_in_smp

This is apparently related with the removal of the __jiffy_data 'attribute' by this patch:

-/* 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")))

On frv the 'jiffies' symbol isn't part of the .data section:

c03a6b00 g O .data 00000008 jiffies_64
c03a6b04 g *ABS* 00000000 jiffies

Which is different from x86:

ffffffff81c0a000 g O .data 0000000000000008 jiffies
ffffffff81c0a000 g O .data 0000000000000008 jiffies_64

or arm64:

ffffffc001062180 g O .data 0000000000000008 jiffies_64
ffffffc001062180 g O .data 0000000000000000 jiffies

Not sure what the appropriate fix would be. Maybe someone more familiar with the platform has an idea?

Thanks

Matthias

#2 lore raw
Quoted 76 lines · Matthias Kaehlcke

El Mon, May 15, 2017 at 10:02:15AM -0700 Guenter Roeck ha dit:

Quoted 66 lines

Hi all,

frv fails to build in mainline with the following build errors.

kernel/built-in.o: In function `__do_softirq':
(.text+0x6460): relocation truncated to fit: R_FRV_GPREL12 against symbol `jiffies' defined in *ABS* section in .tmp_vmlinux1
kernel/built-in.o: In function `__do_softirq':
(.text+0x6574): relocation truncated to fit: R_FRV_GPREL12 against symbol `jiffies' defined in *ABS* section in .tmp_vmlinux1
kernel/built-in.o: In function `pwq_activate_delayed_work':
workqueue.c:(.text+0x15b9c): relocation truncated to fit: R_FRV_GPREL12 against symbol jiffies' defined in *ABS* section in .tmp_vmlinux1 kernel/built-in.o: In function worker_enter_idle':
workqueue.c:(.text+0x1612c): relocation truncated to fit: R_FRV_GPREL12 against symbol jiffies' defined in *ABS* section in .tmp_vmlinux1 workqueue.c:(.text+0x161f0): relocation truncated to fit: R_FRV_GPREL12 against symbol jiffies' defined in *ABS* section in .tmp_vmlinux1 kernel/built-in.o: In function `pool_mayday_timeout':
workqueue.c:(.text+0x1630c): relocation truncated to fit: R_FRV_GPREL12 against symbol jiffies' defined in *ABS* section in .tmp_vmlinux1 kernel/built-in.o: In function idle_worker_timeout':
workqueue.c:(.text+0x1649c): relocation truncated to fit: R_FRV_GPREL12 against symbol jiffies' defined in *ABS* section in .tmp_vmlinux1 workqueue.c:(.text+0x164f8): relocation truncated to fit: R_FRV_GPREL12 against symbol jiffies' defined in *ABS* section in .tmp_vmlinux1 kernel/built-in.o: In function `__queue_work':
workqueue.c:(.text+0x170f4): relocation truncated to fit: R_FRV_GPREL12 against symbol jiffies' defined in *ABS* section in .tmp_vmlinux1 kernel/built-in.o: In function __queue_delayed_work':
workqueue.c:(.text+0x1745c): relocation truncated to fit: R_FRV_GPREL12 against symbol jiffies' defined in *ABS* section in .tmp_vmlinux1 kernel/built-in.o: In function worker_thread':
workqueue.c:(.text+0x182e4): additional relocation overflows omitted from the output

Bisect points to commit 7c30f352c852 ("jiffies.h: declare jiffies and jiffies_64 with ____cacheline_aligned_in_smp"). Bisect log is attached.

Guenter

---
# bad: [2ea659a9ef488125eb46da6eb571de5eae5c43f6] Linux 4.12-rc1
# good: [13e0988140374123bead1dd27c287354cb95108e] docs: complete bumping minimal GNU Make version to 3.81
git bisect start 'HEAD' '13e098814037'
# bad: [c6778ff813d2ca3e3c8733c87dc8b6831a64578b] Merge tag 'armsoc-dt64' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
git bisect bad c6778ff813d2ca3e3c8733c87dc8b6831a64578b
# bad: [11fbf53d66ec302fe50b06bd7cb4863dbb98775a] Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
git bisect bad 11fbf53d66ec302fe50b06bd7cb4863dbb98775a
# good: [2d3e4866dea96b0506395b47bfefb234f2088dac] Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
git bisect good 2d3e4866dea96b0506395b47bfefb234f2088dac
# bad: [8f3207c7eab9d885cc64c778416537034a7d9c5b] Merge tag 'tty-4.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
git bisect bad 8f3207c7eab9d885cc64c778416537034a7d9c5b
# bad: [063246641d4a9e9de84a2466fbad50112faf88dc] format-security: move static strings to const
git bisect bad 063246641d4a9e9de84a2466fbad50112faf88dc
# bad: [f61e869d519c0c11a8d80a503cfdfb4897df855a] kcov: simplify interrupt check
git bisect bad f61e869d519c0c11a8d80a503cfdfb4897df855a
# bad: [0b523769ebb9473c60df1b0f70615aa82ebac2c9] checkpatch: add ability to find bad uses of vsprintf %p<foo> extensions git bisect bad 0b523769ebb9473c60df1b0f70615aa82ebac2c9
# good: [3d88936f35bc67f7bee2efd4eec69baf26c17a5a] drivers/virt/fsl_hypervisor.c: use get_user_pages_unlocked() git bisect good 3d88936f35bc67f7bee2efd4eec69baf26c17a5a
# bad: [8128a31eaadbcdfa37774bbd28f3f00bac69996a] drivers/misc/c2port/c2port-duramar2150.c: checking for NULL instead of IS_ERR() git bisect bad 8128a31eaadbcdfa37774bbd28f3f00bac69996a
# bad: [31b8cc80776c1b5a17abda6e0bbb5c615b9d90e4] make help: add tools help target
git bisect bad 31b8cc80776c1b5a17abda6e0bbb5c615b9d90e4
# bad: [7c30f352c852bae2715ad65ac4a38ca9af7d7696] jiffies.h: declare jiffies and jiffies_64 with ____cacheline_aligned_in_smp git bisect bad 7c30f352c852bae2715ad65ac4a38ca9af7d7696

Quoted 3 lines
# first bad commit: [7c30f352c852bae2715ad65ac4a38ca9af7d7696]
jiffies.h: declare jiffies and jiffies_64 with
____cacheline_aligned_in_smp

This is apparently related with the removal of the __jiffy_data 'attribute' by this patch:

Review

Quoted 5 lines
(quoted diff) +0 -5
-/* 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")))

Guess now we know which architecture that referred to.

Quoted 12 lines

On frv the 'jiffies' symbol isn't part of the .data section:

c03a6b00 g O .data 00000008 jiffies_64
c03a6b04 g *ABS* 00000000 jiffies

Which is different from x86:

ffffffff81c0a000 g O .data 0000000000000008 jiffies
ffffffff81c0a000 g O .data 0000000000000008 jiffies_64

Quoted 8 lines

or arm64:

ffffffc001062180 g O .data 0000000000000008 jiffies_64
ffffffc001062180 g O .data 0000000000000000 jiffies

Not sure what the appropriate fix would be. Maybe someone more familiar with the platform has an idea?

I assume declaring both __jiffy_data and ____cacheline_aligned_in_smp attributes doesn't work ?

Maybe mark the architecture as BROKEN if no one cares ?

Guenter

#3 lore raw
Quoted 2 lines · Guenter Roeck

I assume declaring both __jiffy_data and ____cacheline_aligned_in_smp attributes doesn't work ?

You should be able to stack attributes, I think.

David

#4 lore raw
Quoted 7 lines · David Howells
Quoted 2 lines · Guenter Roeck

I assume declaring both __jiffy_data and ____cacheline_aligned_in_smp attributes doesn't work ?

You should be able to stack attributes, I think.

Turns out not here because ____cacheline_aligned_in_smp includes __page_aligned_data which also declares the section, at least on x86.

Guenter

#5 lore raw
Quoted 2 lines · Guenter Roeck

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.

David

#6 lore raw
Quoted 5 lines · David Howells
Quoted 2 lines · Guenter Roeck

Turns out not here because ____cacheline_aligned_in_smp includes __page_aligned_data which also declares the section, at least on x86.

Quoted 9 lines

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:

include/linux/jiffies.h +4 -2
index 36872fbb815d..26d0655c4422 100644
@@ -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

Guenter

#7 lore raw

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

Quoted 56 lines · David Howells
Quoted 5 lines
Quoted 2 lines · Guenter Roeck

Turns out not here because ____cacheline_aligned_in_smp includes __page_aligned_data which also declares the section, at least on x86.

Quoted 9 lines

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:

include/linux/jiffies.h +4 -2
index 36872fbb815d..26d0655c4422 100644
@@ -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;
                                                                       ^
Quoted 4 lines

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:

arch/frv/include/asm/cache.h +2 -0
index 2797163b8f4f..25bf4e85f582 100644
@@ -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
include/linux/jiffies.h +1 -1
index 36872fbb815d..8904eb52928d 100644
@@ -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

#8 lore raw
Quoted 93 lines · Matthias Kaehlcke

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

Quoted 56 lines · David Howells
Quoted 5 lines
Quoted 2 lines · Guenter Roeck

Turns out not here because ____cacheline_aligned_in_smp includes __page_aligned_data which also declares the section, at least on x86.

Quoted 9 lines

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:

include/linux/jiffies.h +4 -2
index 36872fbb815d..26d0655c4422 100644
@@ -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;
                                                                       ^
Quoted 4 lines

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:

arch/frv/include/asm/cache.h +2 -0
index 2797163b8f4f..25bf4e85f582 100644
@@ -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
include/linux/jiffies.h +1 -1
index 36872fbb815d..8904eb52928d 100644
@@ -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);
Quoted 3 lines

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

From __jiffy_data: __jiffy_arch_data or __jiffies_arch_data.

You'd also need

#ifndef __jiffy_arch_data
#define __jiffy_arch_data
#endif

That assumes that __cacheline_aligned_in_smp is not defined to be part of a different section for the architecture, which I guess should be acceptable here (but maybe asks for a respective comment).

Guenter

#9 lore raw

El Tue, May 16, 2017 at 11:22:07AM -0700 Guenter Roeck ha dit:

Quoted 90 lines · Matthias Kaehlcke
Quoted 89 lines

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

Quoted 56 lines · David Howells
Quoted 5 lines
Quoted 2 lines · Guenter Roeck

Turns out not here because ____cacheline_aligned_in_smp includes __page_aligned_data which also declares the section, at least on x86.

Quoted 9 lines

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:

include/linux/jiffies.h +4 -2
index 36872fbb815d..26d0655c4422 100644
@@ -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;
                                                                       ^
Quoted 4 lines

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:

arch/frv/include/asm/cache.h +2 -0
index 2797163b8f4f..25bf4e85f582 100644
@@ -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
include/linux/jiffies.h +1 -1
index 36872fbb815d..8904eb52928d 100644
@@ -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;
 
Quoted 7 lines
Quoted 5 lines
include/linux/jiffies.h +0 -0
 #if (BITS_PER_LONG < 64)
 u64 get_jiffies_64(void);

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

From __jiffy_data: __jiffy_arch_data or __jiffies_arch_data.

Sounds good(ish)

Quoted 5 lines

You'd also need

#ifndef __jiffy_arch_data
#define __jiffy_arch_data
#endif

Yep

Quoted 3 lines

That assumes that __cacheline_aligned_in_smp is not defined to be part of a different section for the architecture, which I guess should be acceptable here (but maybe asks for a respective comment).

Ack

This solution looks reasonable, I'll prepare a patch shortly.

Thanks

Matthias