diff options
| author | Tiezhu Yang <yangtiezhu@loongson.cn> | 2026-08-17 22:07:14 +0800 |
|---|---|---|
| committer | Huacai Chen <chenhuacai@loongson.cn> | 2026-08-17 22:07:14 +0800 |
| commit | 18210a104bb97e28c26dc31fd9fc7b5c381fec62 (patch) | |
| tree | 42f4e06e9a0577fc60d76df19bead230aa468072 /scripts | |
| parent | 2677f97a67fdbc62a82ce1faa67791f54451d36f (diff) | |
| download | linux-18210a104bb97e28c26dc31fd9fc7b5c381fec62.tar.gz linux-18210a104bb97e28c26dc31fd9fc7b5c381fec62.zip | |
LoongArch: Expand module virtual address space to 2GB
The current 256MB module virtual address space is easily exhausted when
loading massive graphics drivers such as amdgpu along with the large
unstripped symbol tables, resulting in allocation failures of "execmem:
unable to allocate memory".
Thus, expand the module virtual address space to 2GB while keeping
the current normal code model '-mcmodel=normal', rather than using the
medium code model '-mcmodel=medium'. This approach avoids the extra
performance overhead and larger binary size of forcing every function
call into a 2-instruction sequence of 'pcaddu18i + jirl'.
Given that individual module code segments rarely exceed 128MB, most
jumps remain fast direct calls by using the bl instruction. For the
long-distance jumps exceeding the +/-128MB limit, apply_r_larch_b26()
emits PLT entries, while signed_imm_check() guarantees the run-time
safety by rejecting any out-of-bound instruction offsets.
There is still a risk that the distance between .init.text and .text of
the same module exceeds 128MB. So we divide the 2GB virtual space to be
two sub-regions: the first 256MB is for module text, and the rest is for
module data.
Cc: stable@vger.kernel.org
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Diffstat (limited to 'scripts')
0 files changed, 0 insertions, 0 deletions
