]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
riscv: use local label names instead of global ones in assembly
authorClément Léger <cleger@rivosinc.com>
Fri, 3 Jan 2025 14:17:58 +0000 (15:17 +0100)
committerPalmer Dabbelt <palmer@rivosinc.com>
Wed, 8 Jan 2025 18:46:14 +0000 (10:46 -0800)
Local labels should be prefix by '.L' or they'll be exported in the
symbol table. Additionally, this messes up the backtrace by displaying
an incorrect symbol:

  ...
  [   12.751810] [<ffffffff80441628>] _copy_from_user+0x28/0xc2
  [   12.752035] [<ffffffff800152ca>] handle_misaligned_load+0x1ca/0x2fc
  [   12.752310] [<ffffffff80a033e8>] do_trap_load_misaligned+0x24/0xee
  [   12.752596] [<ffffffff80a0dcae>] _new_vmalloc_restore_context_a0+0xc2/0xce

After:
  ...
  [   10.243916] [<ffffffff804415e4>] _copy_from_user+0x28/0xc2
  [   10.244026] [<ffffffff800152ca>] handle_misaligned_load+0x1ca/0x2fc
  [   10.244150] [<ffffffff80a033a0>] do_trap_load_misaligned+0x24/0xee
  [   10.244268] [<ffffffff80a0dc66>] handle_exception+0x146/0x152

Signed-off-by: Clément Léger <cleger@rivosinc.com>
Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Fixes: 503638e0babf3 ("riscv: Stop emitting preventive sfence.vma for new vmalloc mappings")
Link: https://lore.kernel.org/r/20250103141814.508865-1-cleger@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/kernel/entry.S

index 7a6c48e6d211b0ffc36e7f94e761d25e821a4509..33a5a9f2a0d4e1eeccfb3621b9e518b88e1b0704 100644 (file)
        REG_S   a0, TASK_TI_A0(tp)
        csrr    a0, CSR_CAUSE
        /* Exclude IRQs */
-       blt     a0, zero, _new_vmalloc_restore_context_a0
+       blt     a0, zero, .Lnew_vmalloc_restore_context_a0
 
        REG_S   a1, TASK_TI_A1(tp)
        /* Only check new_vmalloc if we are in page/protection fault */
        li      a1, EXC_LOAD_PAGE_FAULT
-       beq     a0, a1, _new_vmalloc_kernel_address
+       beq     a0, a1, .Lnew_vmalloc_kernel_address
        li      a1, EXC_STORE_PAGE_FAULT
-       beq     a0, a1, _new_vmalloc_kernel_address
+       beq     a0, a1, .Lnew_vmalloc_kernel_address
        li      a1, EXC_INST_PAGE_FAULT
-       bne     a0, a1, _new_vmalloc_restore_context_a1
+       bne     a0, a1, .Lnew_vmalloc_restore_context_a1
 
-_new_vmalloc_kernel_address:
+.Lnew_vmalloc_kernel_address:
        /* Is it a kernel address? */
        csrr    a0, CSR_TVAL
-       bge     a0, zero, _new_vmalloc_restore_context_a1
+       bge     a0, zero, .Lnew_vmalloc_restore_context_a1
 
        /* Check if a new vmalloc mapping appeared that could explain the trap */
        REG_S   a2, TASK_TI_A2(tp)
@@ -69,7 +69,7 @@ _new_vmalloc_kernel_address:
        /* Check the value of new_vmalloc for this cpu */
        REG_L   a2, 0(a0)
        and     a2, a2, a1
-       beq     a2, zero, _new_vmalloc_restore_context
+       beq     a2, zero, .Lnew_vmalloc_restore_context
 
        /* Atomically reset the current cpu bit in new_vmalloc */
        amoxor.d        a0, a1, (a0)
@@ -83,11 +83,11 @@ _new_vmalloc_kernel_address:
        csrw    CSR_SCRATCH, x0
        sret
 
-_new_vmalloc_restore_context:
+.Lnew_vmalloc_restore_context:
        REG_L   a2, TASK_TI_A2(tp)
-_new_vmalloc_restore_context_a1:
+.Lnew_vmalloc_restore_context_a1:
        REG_L   a1, TASK_TI_A1(tp)
-_new_vmalloc_restore_context_a0:
+.Lnew_vmalloc_restore_context_a0:
        REG_L   a0, TASK_TI_A0(tp)
 .endm