From: Romain Dolbeau <romain.dolbeau@european-processor-initiative.eu>
To: Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@sifive.com>,
Albert Ou <aou@eecs.berkeley.edu>
Cc: "linux-riscv@lists.infradead.org"
<linux-riscv@lists.infradead.org>,
"romain@dolbeau.org" <romain@dolbeau.org>
Subject: 32-bits offset issue preventing module to load,
Date: Mon, 28 Oct 2019 16:57:20 +0000 [thread overview]
Message-ID: <1572281840733.3517@european-processor-initiative.eu> (raw)
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
next reply other threads:[~2019-10-28 16:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-28 16:57 Romain Dolbeau [this message]
2019-10-29 10:50 ` 32-bits offset issue preventing module to load, Aurelien Jarno
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=1572281840733.3517@european-processor-initiative.eu \
--to=romain.dolbeau@european-processor-initiative.eu \
--cc=aou@eecs.berkeley.edu \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@sifive.com \
--cc=paul.walmsley@sifive.com \
--cc=romain@dolbeau.org \
/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 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).