Skip to contentSkip to conversation

next-20170125 hangs on aarch64

DISCUSSION Yury Norov 3 participants 5 messages Jan 29, 2017 – Jan 31, 2017 arm64

lore
Share & tools
lore

Yury Norov

author
#0 lore raw

Hi all,

I pulled next-20170125 kernel, and found it hanged on boot. The exact reason is panic on dereferencing of the 0xffffffc8 address, which is most probably the attempt to dereference the ENOSYS error code as the address. next-20170124 works fine, at least it boots.

Does anyone have details on that?

Yury

#0 arch_counter_get_cntvct () at ./arch/arm64/include/asm/arch_timer.h:151
#1 __delay (cycles=1024) at arch/arm64/lib/delay.c:31
#2 0xffff00000838b430 in __const_udelay (xloops=<optimized out>) at arch/arm64/lib/delay.c:41
#3 0xffff00000816a894 in panic (fmt=<optimized out>) at kernel/panic.c:295
#4 0xffff0000080c1238 in do_exit (code=11) at kernel/exit.c:780 #5 0xffff0000080888f0 in die (str=<optimized out>,

    regs=0xffff000008d63d30 <init_thread_union+15664>, err=<optimized out>)
    at arch/arm64/kernel/traps.c:295
#6  0xffff0000080998c4 in __do_kernel_fault (mm=0x0, addr=4294967240, esr=2483027972, 
    regs=0xffff000008d63d30 <init_thread_union+15664>) at arch/arm64/mm/fault.c:185
#7  0xffff000008097244 in __do_kernel_fault (regs=<optimized out>, esr=<optimized out>, 
     addr=<optimized out>, mm=<optimized out>) at arch/arm64/mm/fault.c:419
#8  do_page_fault (addr=4294967240, esr=2483027972, 
    regs=0xffff000008d63d30 <init_thread_union+15664>) at arch/arm64/mm/fault.c:443
#9  0xffff000008097334 in do_translation_fault (addr=<optimized out>, esr=<optimized out>, 
    regs=<optimized out>) at arch/arm64/mm/fault.c:469
#10 0xffff000008081298 in do_mem_abort (addr=4294967240, esr=2483027972, 
    regs=0xffff000008d63d30 <init_thread_union+15664>) at arch/arm64/mm/fault.c:577

#11 0xffff000008082604 in el1_sync () at arch/arm64/kernel/entry.S:438 #12 0xffff000008082604 in el1_sync () at arch/arm64/kernel/entry.S:438 [...]

author
#1 lore raw
Quoted 10 lines · Yury Norov

Hi all,

I pulled next-20170125 kernel, and found it hanged on boot. The exact reason is panic on dereferencing of the 0xffffffc8 address, which is most probably the attempt to dereference the ENOSYS error code as the address. next-20170124 works fine, at least it boots.

Does anyone have details on that?

Yury

UPD:

I run qemu for testing.

The true failure backtrace is like below. The bad dereference happens for me in arm_smccc_hvc() function in macro SMCCC.

Yury

Backtrace:

#0 0xffff00000808f7a8 in arm_smccc_hvc () at
arch/arm64/kernel/smccc-call.S:50
#1 0xffff000008745ea0 in __invoke_psci_fn_hvc (function_id=<optimized out>, arg0=<optimized out>,
arg1=<optimized out>, arg2=<optimized out>) at drivers/firmware/psci.c:119

#2  0xffff000008745d18 in psci_migrate_info_type () at drivers/firmware/psci.c:204
#3  0xffff000008ca150c in psci_init_migrate () at drivers/firmware/psci.c:465
#4  psci_probe () at drivers/firmware/psci.c:539
#5  0xffff000008ca1684 in psci_0_2_init (np=<optimized out>) at drivers/firmware/psci.c:571
#6  0xffff000008ca16d8 in psci_dt_init () at drivers/firmware/psci.c:637
#7  0xffff000008c62914 in setup_arch (cmdline_p=<optimized out>) at arch/arm64/kernel/setup.c:287
#8  0xffff000008c6082c in start_kernel () at init/main.c:509
#9  0xffff000008c601e0 in __primary_switched () at arch/arm64/kernel/head.S:452

Listing:

 ?0xffff00000808f790 <arm_smccc_hvc>        hvc    #0x0
 ?0xffff00000808f794 <arm_smccc_hvc+4>      ldr    x4, [sp]
 ?0xffff00000808f798 <arm_smccc_hvc+8>      stp    x0, x1, [x4]          
 ?0xffff00000808f79c <arm_smccc_hvc+12>     stp x2, x3, [x4,#16]
 ?0xffff00000808f7a0 <arm_smccc_hvc+16>     ldr x4, [sp,#8] 
 ?0xffff00000808f7a4 <arm_smccc_hvc+20>     cbz x4, 0xffff00000808f7b8 <arm_smccc_hvc+40>
>?0xffff00000808f7a8 <arm_smccc_hvc+24      ldr    x9, [x4]
 ?0xffff00000808f7ac <arm_smccc_hvc+28>     cmp    x9, #0x1
 ?0xffff00000808f7b0 <arm_smccc_hvc+32>     b.ne   0xffff00000808f7b8 <arm_smccc_hvc+40>
 ?0xffff00000808f7b4 <arm_smccc_hvc+36>     str    x6, [x4,#8]
 ?0xffff00000808f7b8 <arm_smccc_hvc+40>     ret
#2 lore raw

Hi Yury,

[CC: Andy Gross]

Quoted 9 lines · Yury Norov
Quoted 8 lines · Yury Norov

Hi all,

I pulled next-20170125 kernel, and found it hanged on boot. The exact reason is panic on dereferencing of the 0xffffffc8 address, which is most probably the attempt to dereference the ENOSYS error code as the address. next-20170124 works fine, at least it boots.

Does anyone have details on that?

I hit this with next-20170130 too, in /arch/arm64/kernel/smccc-call.S aabde95fc543 changed the SMCCC macro to check for an optional quirk structure.

A previous patch provided:

Quoted 1 line

#define arm_smccc_smc(...) __arm_smccc_smc(__VA_ARGS__, NULL)

to handle the 'no quirk' case, but this missed HVC calls. The following hunk fixes/hides it for me:

----------------------------%<----------------------------

arch/arm64/kernel/smccc-call.S +4 -2
index 72ecdca929b1..9e287a7d1822 100644
@@ -15,18 +15,20 @@
 #include <linux/arm-smccc.h>
 #include <asm/asm-offsets.h>
 
-       .macro SMCCC instr
+       .macro SMCCC instr, maybe_quirk = 0
        .cfi_startproc
        \instr  #0
        ldr     x4, [sp]
        stp     x0, x1, [x4, #ARM_SMCCC_RES_X0_OFFS]
        stp     x2, x3, [x4, #ARM_SMCCC_RES_X2_OFFS]
        ldr     x4, [sp, #8]
+       .if \maybe_quirk != 0
        cbz     x4, 1f /* no quirk structure */
        ldr     x9, [x4, #ARM_SMCCC_QUIRK_ID_OFFS]
        cmp     x9, #ARM_SMCCC_QUIRK_QCOM_A6
        b.ne    1f
        str     x6, [x4, ARM_SMCCC_QUIRK_STATE_OFFS]
+       .endif
 1:     ret
        .cfi_endproc
        .endm
@@ -38,7 +40,7 @@
  *               struct arm_smccc_quirk *quirk)
  */
 ENTRY(__arm_smccc_smc)
-       SMCCC   smc
+       SMCCC   smc, 1
 ENDPROC(__arm_smccc_smc)
 
 /*

----------------------------%<----------------------------

Thanks,

James

author
#3 lore raw
Quoted 15 lines · James Morse

Hi Yury,

[CC: Andy Gross]

Quoted 9 lines · Yury Norov
Quoted 8 lines · Yury Norov

Hi all,

I pulled next-20170125 kernel, and found it hanged on boot. The exact reason is panic on dereferencing of the 0xffffffc8 address, which is most probably the attempt to dereference the ENOSYS error code as the address. next-20170124 works fine, at least it boots.

Does anyone have details on that?

Quoted 8 lines

I hit this with next-20170130 too, in /arch/arm64/kernel/smccc-call.S aabde95fc543 changed the SMCCC macro to check for an optional quirk structure.

A previous patch provided:

Quoted 1 line

#define arm_smccc_smc(...) __arm_smccc_smc(__VA_ARGS__, NULL)

to handle the 'no quirk' case, but this missed HVC calls. The following hunk fixes/hides it for me:

It works for me too, but I think "ldr x4, [sp, #8]" should also go under (.if \maybe_quirk != 0) condition - like below.

Yury

----------------------------%<----------------------------

arch/arm64/kernel/smccc-call.S +4 -2
index 72ecdca929b1..9e287a7d1822 100644
@@ -15,18 +15,20 @@
 #include <linux/arm-smccc.h>
 #include <asm/asm-offsets.h>
 
-       .macro SMCCC instr
+       .macro SMCCC instr, maybe_quirk = 0
        .cfi_startproc
        \instr  #0
        ldr     x4, [sp]
        stp     x0, x1, [x4, #ARM_SMCCC_RES_X0_OFFS]
        stp     x2, x3, [x4, #ARM_SMCCC_RES_X2_OFFS]
+       .if \maybe_quirk != 0
        ldr     x4, [sp, #8]
        cbz     x4, 1f /* no quirk structure */
        ldr     x9, [x4, #ARM_SMCCC_QUIRK_ID_OFFS]
        cmp     x9, #ARM_SMCCC_QUIRK_QCOM_A6
        b.ne    1f
        str     x6, [x4, ARM_SMCCC_QUIRK_STATE_OFFS]
+       .endif
 1:     ret
        .cfi_endproc
        .endm
@@ -38,7 +40,7 @@
  *               struct arm_smccc_quirk *quirk)
  */
 ENTRY(__arm_smccc_smc)
-       SMCCC   smc
+       SMCCC   smc, 1
 ENDPROC(__arm_smccc_smc)
 
 /*

----------------------------%<----------------------------

#4 lore raw
Quoted 16 lines · Yury Norov
Quoted 15 lines · James Morse

Hi Yury,

[CC: Andy Gross]

Quoted 9 lines · Yury Norov
Quoted 8 lines · Yury Norov

Hi all,

I pulled next-20170125 kernel, and found it hanged on boot. The exact reason is panic on dereferencing of the 0xffffffc8 address, which is most probably the attempt to dereference the ENOSYS error code as the address. next-20170124 works fine, at least it boots.

Does anyone have details on that?

Quoted 8 lines
Quoted 8 lines

I hit this with next-20170130 too, in /arch/arm64/kernel/smccc-call.S aabde95fc543 changed the SMCCC macro to check for an optional quirk structure.

A previous patch provided:

Quoted 1 line

#define arm_smccc_smc(...) __arm_smccc_smc(__VA_ARGS__, NULL)

to handle the 'no quirk' case, but this missed HVC calls. The following hunk fixes/hides it for me:

Wow, I botched this completely. I missed the hvc using the same macro. I'll rework with the fixes below.

Quoted 3 lines

It works for me too, but I think "ldr x4, [sp, #8]" should also go under (.if \maybe_quirk != 0) condition - like below.

Yes I believe so.

Quoted 42 lines

----------------------------%<----------------------------

arch/arm64/kernel/smccc-call.S +4 -3
index 72ecdca929b1..9e287a7d1822 100644
@@ -15,18 +15,20 @@
 #include <linux/arm-smccc.h>
 #include <asm/asm-offsets.h>
 
-       .macro SMCCC instr
+       .macro SMCCC instr, maybe_quirk = 0
        .cfi_startproc
        \instr  #0
        ldr     x4, [sp]
        stp     x0, x1, [x4, #ARM_SMCCC_RES_X0_OFFS]
        stp     x2, x3, [x4, #ARM_SMCCC_RES_X2_OFFS]
+       .if \maybe_quirk != 0
        ldr     x4, [sp, #8]
        cbz     x4, 1f /* no quirk structure */
        ldr     x9, [x4, #ARM_SMCCC_QUIRK_ID_OFFS]
        cmp     x9, #ARM_SMCCC_QUIRK_QCOM_A6
        b.ne    1f
        str     x6, [x4, ARM_SMCCC_QUIRK_STATE_OFFS]
+       .endif
 1:     ret
        .cfi_endproc
        .endm
@@ -38,7 +40,7 @@
  *               struct arm_smccc_quirk *quirk)
  */
 ENTRY(__arm_smccc_smc)
-       SMCCC   smc
+       SMCCC   smc, 1
 ENDPROC(__arm_smccc_smc)
 
 /*
----------------------------%<----------------------------

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel