All of lore.kernel.org
 help / color / mirror / Atom feed
* frv build failure in mainline kernel
@ 2017-05-15 17:02 Guenter Roeck
  2017-05-15 19:13 ` Matthias Kaehlcke
  0 siblings, 1 reply; 10+ messages in thread
From: Guenter Roeck @ 2017-05-15 17:02 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andrew Morton, Matthias Kaehlcke

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: frv build failure in mainline kernel
  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
  0 siblings, 2 replies; 10+ messages in thread
From: Matthias Kaehlcke @ 2017-05-15 19:13 UTC (permalink / raw)
  To: Guenter Roeck, David Howells, Sudip Mukherjee; +Cc: linux-kernel, Andrew Morton

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

> 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

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: frv build failure in mainline kernel
  2017-05-15 19:13 ` Matthias Kaehlcke
@ 2017-05-16  4:42   ` Guenter Roeck
  2017-05-16 12:44   ` David Howells
  1 sibling, 0 replies; 10+ messages in thread
From: Guenter Roeck @ 2017-05-16  4:42 UTC (permalink / raw)
  To: Matthias Kaehlcke, David Howells, Sudip Mukherjee
  Cc: linux-kernel, Andrew Morton

On 05/15/2017 12:13 PM, Matthias Kaehlcke wrote:
> El Mon, May 15, 2017 at 10:02:15AM -0700 Guenter Roeck ha dit:
>
>> 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
>
> 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")))
>

Guess now we know which architecture that referred to.

>
> 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?
>

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: frv build failure in mainline kernel
  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
  1 sibling, 2 replies; 10+ messages in thread
From: David Howells @ 2017-05-16 12:44 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: dhowells, Matthias Kaehlcke, Sudip Mukherjee, linux-kernel,
	Andrew Morton

Guenter Roeck <linux@roeck-us.net> wrote:

> 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: frv build failure in mainline kernel
  2017-05-16 12:44   ` David Howells
@ 2017-05-16 14:06     ` Guenter Roeck
  2017-05-16 16:04     ` David Howells
  1 sibling, 0 replies; 10+ messages in thread
From: Guenter Roeck @ 2017-05-16 14:06 UTC (permalink / raw)
  To: David Howells
  Cc: Matthias Kaehlcke, Sudip Mukherjee, linux-kernel, Andrew Morton

On 05/16/2017 05:44 AM, David Howells wrote:
> Guenter Roeck <linux@roeck-us.net> wrote:
>
>> 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: frv build failure in mainline kernel
  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
  1 sibling, 1 reply; 10+ messages in thread
From: David Howells @ 2017-05-16 16:04 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: dhowells, Matthias Kaehlcke, Sudip Mukherjee, linux-kernel,
	Andrew Morton

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.

David

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: frv build failure in mainline kernel
  2017-05-16 16:04     ` David Howells
@ 2017-05-16 17:21       ` Guenter Roeck
  2017-05-16 17:58         ` Matthias Kaehlcke
  0 siblings, 1 reply; 10+ messages in thread
From: Guenter Roeck @ 2017-05-16 17:21 UTC (permalink / raw)
  To: David Howells
  Cc: Matthias Kaehlcke, Sudip Mukherjee, linux-kernel, Andrew Morton

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

Guenter

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: frv build failure in mainline kernel
  2017-05-16 17:21       ` Guenter Roeck
@ 2017-05-16 17:58         ` Matthias Kaehlcke
  2017-05-16 18:22           ` Guenter Roeck
  0 siblings, 1 reply; 10+ messages in thread
From: Matthias Kaehlcke @ 2017-05-16 17:58 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: David Howells, Sudip Mukherjee, linux-kernel, Andrew Morton

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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: frv build failure in mainline kernel
  2017-05-16 17:58         ` Matthias Kaehlcke
@ 2017-05-16 18:22           ` Guenter Roeck
  2017-05-16 20:44             ` Matthias Kaehlcke
  0 siblings, 1 reply; 10+ messages in thread
From: Guenter Roeck @ 2017-05-16 18:22 UTC (permalink / raw)
  To: Matthias Kaehlcke
  Cc: David Howells, Sudip Mukherjee, linux-kernel, Andrew Morton

On Tue, May 16, 2017 at 10:58:20AM -0700, Matthias Kaehlcke wrote:
> 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.

>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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: frv build failure in mainline kernel
  2017-05-16 18:22           ` Guenter Roeck
@ 2017-05-16 20:44             ` Matthias Kaehlcke
  0 siblings, 0 replies; 10+ messages in thread
From: Matthias Kaehlcke @ 2017-05-16 20:44 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: David Howells, Sudip Mukherjee, linux-kernel, Andrew Morton

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

> On Tue, May 16, 2017 at 10:58:20AM -0700, Matthias Kaehlcke wrote:
> > 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.
> 
> From __jiffy_data: __jiffy_arch_data or __jiffies_arch_data.

Sounds good(ish)

> You'd also need
> 
> #ifndef __jiffy_arch_data
> #define __jiffy_arch_data
> #endif

Yep

> 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-05-16 20:44 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2017-05-16 18:22           ` Guenter Roeck
2017-05-16 20:44             ` Matthias Kaehlcke

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.