* 32-bits offset issue preventing module to load,
@ 2019-10-28 16:57 Romain Dolbeau
2019-10-29 10:50 ` Aurelien Jarno
0 siblings, 1 reply; 2+ messages in thread
From: Romain Dolbeau @ 2019-10-28 16:57 UTC (permalink / raw)
To: Paul Walmsley, Palmer Dabbelt, Albert Ou; +Cc: linux-riscv, romain
Hello,
I have a Fedora RISC-V running fine in QEMU, using packaged kernel "5.4.0-0.rc4.git0.300.1.riscv64.fc32.riscv64".
Some modules won't load, such as openvswitch:
#####
$ sudo modprobe openvswitch ; dmesg | tail -1
modprobe: ERROR: could not insert 'openvswitch': Invalid argument
[ 227.833317] openvswitch: target ffffffe0000d1fd8 can not be addressed by the 32-bit offset from PC = 00000000bcd11221
#####
The message is explicit, a 32-bits offset is not enough to access the data @ 0xffffffe0000d1fd8 from 0x00000000bcd11221. The relevant (I think) part of the System.map is:
#####
/usr/src/kernels/5.4.0-0.rc4.git0.300.1.riscv64.fc32.riscv64/System.map:ffffffe0000d1fd8 D __init_end
/usr/src/kernels/5.4.0-0.rc4.git0.300.1.riscv64.fc32.riscv64/System.map:ffffffe0000d1fd8 D __per_cpu_end
/usr/src/kernels/5.4.0-0.rc4.git0.300.1.riscv64.fc32.riscv64/System.map:ffffffe0000d1fd8 T _stext
/usr/src/kernels/5.4.0-0.rc4.git0.300.1.riscv64.fc32.riscv64/System.map:ffffffe0000d1fd8 T _text
/usr/src/kernels/5.4.0-0.rc4.git0.300.1.riscv64.fc32.riscv64/System.map:ffffffe0000d1fd8 t trace_initcall_finish_cb
#####
As far as I can tell, the issue lies with the fact that the offending modules are using per-cpu data, an uncommon occurrence in modules (according to 'grep' ;-) ). I have a small reproducer that fails in the same way on my QEMU machine. It's small enough I can put it inline at the end of this mail (sometimes attachment gets stripped...). I get the same error in dmesg when trying to load it:
[ 585.528200] toto: target ffffffe0000d1fd8 can not be addressed by the 32-bit offset from PC = 00000000465adc9c
The test code works just fine on x86-64, I couldn't try another architecture.
Cordially,
Romain Dolbeau
##### toto.c
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/kmod.h>
MODULE_LICENSE("GPL");
MODULE_AUTHOR("None will accept the blame");
MODULE_DESCRIPTION("Bug reproducer");
MODULE_VERSION("0.01");
static DEFINE_PER_CPU(uint64_t[2], test_data);
static int __init toto_init(void) {
int i;
printk(KERN_INFO "Hello, World!\n");
for_each_possible_cpu(i) {
uint64_t *data = per_cpu(test_data, i);
printk(KERN_INFO "data for %d is %p\n", i, data);
}
return 0;
}
static void __exit toto_exit(void) {
printk(KERN_INFO "Goodbye, World!\n");
}
module_init(toto_init);
module_exit(toto_exit);
##### Makefile
obj-m += toto.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
test:
sudo insmod toto.ko && sudo rmmod toto || true
sudo dmesg | tail -5
#####
--
Romain Dolbeau
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: 32-bits offset issue preventing module to load,
2019-10-28 16:57 32-bits offset issue preventing module to load, Romain Dolbeau
@ 2019-10-29 10:50 ` Aurelien Jarno
0 siblings, 0 replies; 2+ messages in thread
From: Aurelien Jarno @ 2019-10-29 10:50 UTC (permalink / raw)
To: Romain Dolbeau
Cc: linux-riscv, Palmer Dabbelt, romain, Albert Ou, Paul Walmsley
Hi,
On 2019-10-28 16:57, Romain Dolbeau wrote:
> Hello,
>
> I have a Fedora RISC-V running fine in QEMU, using packaged kernel "5.4.0-0.rc4.git0.300.1.riscv64.fc32.riscv64".
> Some modules won't load, such as openvswitch:
>
> #####
> $ sudo modprobe openvswitch ; dmesg | tail -1
> modprobe: ERROR: could not insert 'openvswitch': Invalid argument
> [ 227.833317] openvswitch: target ffffffe0000d1fd8 can not be addressed by the 32-bit offset from PC = 00000000bcd11221
> #####
The same problem also happens on a 5.2.17 kernel (from the Debian
package) with the scsi_mod loading (dependency of virtio_scsi):
[ 330.737763] scsi_mod: target ffffffe00007fa20 can not be addressed by the 32-bit offset from PC = 00000000e0712647
> The message is explicit, a 32-bits offset is not enough to access the data @ 0xffffffe0000d1fd8 from 0x00000000bcd11221. The relevant (I think) part of the System.map is:
>
> #####
> /usr/src/kernels/5.4.0-0.rc4.git0.300.1.riscv64.fc32.riscv64/System.map:ffffffe0000d1fd8 D __init_end
> /usr/src/kernels/5.4.0-0.rc4.git0.300.1.riscv64.fc32.riscv64/System.map:ffffffe0000d1fd8 D __per_cpu_end
> /usr/src/kernels/5.4.0-0.rc4.git0.300.1.riscv64.fc32.riscv64/System.map:ffffffe0000d1fd8 T _stext
> /usr/src/kernels/5.4.0-0.rc4.git0.300.1.riscv64.fc32.riscv64/System.map:ffffffe0000d1fd8 T _text
> /usr/src/kernels/5.4.0-0.rc4.git0.300.1.riscv64.fc32.riscv64/System.map:ffffffe0000d1fd8 t trace_initcall_finish_cb
> #####
In my case, it points to the same symbols:
ffffffe00007fa18 D __init_end
ffffffe00007fa18 D __per_cpu_end
ffffffe00007fa18 T _stext
ffffffe00007fa18 T _text
ffffffe00007fa18 t trace_initcall_finish_cb
Aurelien
--
Aurelien Jarno GPG: 4096R/1DDD8C9B
aurelien@aurel32.net http://www.aurel32.net
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-10-29 10:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-28 16:57 32-bits offset issue preventing module to load, Romain Dolbeau
2019-10-29 10:50 ` Aurelien Jarno
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).