All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64: Fix the kernel panic() on QDF2400 platform
@ 2017-02-23  3:10 ` Shanker Donthineni
  0 siblings, 0 replies; 8+ messages in thread
From: Shanker Donthineni @ 2017-02-23  3:10 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon
  Cc: linux-kernel, linux-arm-kernel, James Morse, Mark Rutland,
	Vikram Sethi, Shanker Donthineni

The commit 38fd94b0 'arm64: Work around Falkor erratum 1003' has
been added to fix the hardware bug but causing a system crash.
The value of the register x1 which contains 'struct mm_struct *'
should be preserved inside macro pre_ttbr0_update_workaround.

Macro pre_ttbr0_update_workaround expects 2nd and 3rd arguments
are temporary registers. Don't clobber register x1, Otherwise
the next load operation 'mmid x1 x1' access the invalid address.

[<ffff0000080989a0>] cpu_do_switch_mm+0x20/0x40
[<ffff000008b18614>] efi_virtmap_load+0x34/0x40
[<ffff000008b1812c>] virt_efi_get_next_variable+0x64/0xc8
[<ffff000008b16204>] efivar_init+0x8c/0x348
[<ffff0000092b777c>] efisubsys_init+0xd4/0x270
[<ffff000009270c74>] do_one_initcall+0x80/0x110
[<ffff000009270ea0>] kernel_init_freeable+0x19c/0x240
[<ffff000008d8cef0>] kernel_init+0x10/0x100
[<ffff000008082ec0>] ret_from_fork+0x10/0x50
 Code: d5033fdf b340bc01 d5182001 d5033fdf (f9416821)
 ---[ end trace 15247ca922eb6bb7 ]---
 note: swapper/0[1] exited with preempt_count 2
 Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b

 SMP: stopping secondary CPUs
 ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b

Signed-off-by: Shanker Donthineni <shankerd@codeaurora.org>
---
 arch/arm64/mm/proc.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S
index cd4d53d..877d42f 100644
--- a/arch/arm64/mm/proc.S
+++ b/arch/arm64/mm/proc.S
@@ -138,7 +138,7 @@ ENDPROC(cpu_do_resume)
  *	- pgd_phys - physical address of new TTB
  */
 ENTRY(cpu_do_switch_mm)
-	pre_ttbr0_update_workaround x0, x1, x2
+	pre_ttbr0_update_workaround x0, x2, x3
 	mmid	x1, x1				// get mm->context.id
 	bfi	x0, x1, #48, #16		// set the ASID
 	msr	ttbr0_el1, x0			// set TTBR0
-- 
Qualcomm Datacenter Technologies, Inc. on behalf of the Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH] arm64: Fix the kernel panic() on QDF2400 platform
@ 2017-02-23  3:10 ` Shanker Donthineni
  0 siblings, 0 replies; 8+ messages in thread
From: Shanker Donthineni @ 2017-02-23  3:10 UTC (permalink / raw)
  To: linux-arm-kernel

The commit 38fd94b0 'arm64: Work around Falkor erratum 1003' has
been added to fix the hardware bug but causing a system crash.
The value of the register x1 which contains 'struct mm_struct *'
should be preserved inside macro pre_ttbr0_update_workaround.

Macro pre_ttbr0_update_workaround expects 2nd and 3rd arguments
are temporary registers. Don't clobber register x1, Otherwise
the next load operation 'mmid x1 x1' access the invalid address.

[<ffff0000080989a0>] cpu_do_switch_mm+0x20/0x40
[<ffff000008b18614>] efi_virtmap_load+0x34/0x40
[<ffff000008b1812c>] virt_efi_get_next_variable+0x64/0xc8
[<ffff000008b16204>] efivar_init+0x8c/0x348
[<ffff0000092b777c>] efisubsys_init+0xd4/0x270
[<ffff000009270c74>] do_one_initcall+0x80/0x110
[<ffff000009270ea0>] kernel_init_freeable+0x19c/0x240
[<ffff000008d8cef0>] kernel_init+0x10/0x100
[<ffff000008082ec0>] ret_from_fork+0x10/0x50
 Code: d5033fdf b340bc01 d5182001 d5033fdf (f9416821)
 ---[ end trace 15247ca922eb6bb7 ]---
 note: swapper/0[1] exited with preempt_count 2
 Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b

 SMP: stopping secondary CPUs
 ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b

Signed-off-by: Shanker Donthineni <shankerd@codeaurora.org>
---
 arch/arm64/mm/proc.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S
index cd4d53d..877d42f 100644
--- a/arch/arm64/mm/proc.S
+++ b/arch/arm64/mm/proc.S
@@ -138,7 +138,7 @@ ENDPROC(cpu_do_resume)
  *	- pgd_phys - physical address of new TTB
  */
 ENTRY(cpu_do_switch_mm)
-	pre_ttbr0_update_workaround x0, x1, x2
+	pre_ttbr0_update_workaround x0, x2, x3
 	mmid	x1, x1				// get mm->context.id
 	bfi	x0, x1, #48, #16		// set the ASID
 	msr	ttbr0_el1, x0			// set TTBR0
-- 
Qualcomm Datacenter Technologies, Inc. on behalf of the Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] arm64: Fix the kernel panic() on QDF2400 platform
  2017-02-23  3:10 ` Shanker Donthineni
@ 2017-02-23 14:45   ` Will Deacon
  -1 siblings, 0 replies; 8+ messages in thread
From: Will Deacon @ 2017-02-23 14:45 UTC (permalink / raw)
  To: Shanker Donthineni
  Cc: Catalin Marinas, linux-kernel, linux-arm-kernel, James Morse,
	Mark Rutland, Vikram Sethi

On Wed, Feb 22, 2017 at 09:10:48PM -0600, Shanker Donthineni wrote:
> The commit 38fd94b0 'arm64: Work around Falkor erratum 1003' has
> been added to fix the hardware bug but causing a system crash.
> The value of the register x1 which contains 'struct mm_struct *'
> should be preserved inside macro pre_ttbr0_update_workaround.
> 
> Macro pre_ttbr0_update_workaround expects 2nd and 3rd arguments
> are temporary registers. Don't clobber register x1, Otherwise
> the next load operation 'mmid x1 x1' access the invalid address.

Whilst I'm pleased that you've sent a fix (and I'll pick it up), I have
to ask... did anybody actually test the original patch? If so, why wasn't
this found earlier?

Will

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] arm64: Fix the kernel panic() on QDF2400 platform
@ 2017-02-23 14:45   ` Will Deacon
  0 siblings, 0 replies; 8+ messages in thread
From: Will Deacon @ 2017-02-23 14:45 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Feb 22, 2017 at 09:10:48PM -0600, Shanker Donthineni wrote:
> The commit 38fd94b0 'arm64: Work around Falkor erratum 1003' has
> been added to fix the hardware bug but causing a system crash.
> The value of the register x1 which contains 'struct mm_struct *'
> should be preserved inside macro pre_ttbr0_update_workaround.
> 
> Macro pre_ttbr0_update_workaround expects 2nd and 3rd arguments
> are temporary registers. Don't clobber register x1, Otherwise
> the next load operation 'mmid x1 x1' access the invalid address.

Whilst I'm pleased that you've sent a fix (and I'll pick it up), I have
to ask... did anybody actually test the original patch? If so, why wasn't
this found earlier?

Will

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: arm64: Fix the kernel panic() on QDF2400 platform
  2017-02-23  3:10 ` Shanker Donthineni
@ 2017-02-23 17:57   ` Manoj Iyer
  -1 siblings, 0 replies; 8+ messages in thread
From: Manoj Iyer @ 2017-02-23 17:57 UTC (permalink / raw)
  To: Shanker Donthineni
  Cc: Catalin Marinas, Will Deacon, linux-kernel, linux-arm-kernel,
	James Morse, Mark Rutland, Vikram Sethi


Tested on Ubuntu 17.04 (Linux 4.10). I am able to boot the kernel on 
QDF2400 platform without any panics.

Tested-by: Manoj Iyer <manoj.iyer@canonical.com>

--
============================
Manoj Iyer
Ubuntu/Canonical
ARM Servers - Cloud
============================

On Wed, 22 Feb 2017, Shanker Donthineni wrote:

> The commit 38fd94b0 'arm64: Work around Falkor erratum 1003' has
> been added to fix the hardware bug but causing a system crash.
> The value of the register x1 which contains 'struct mm_struct *'
> should be preserved inside macro pre_ttbr0_update_workaround.
>
> Macro pre_ttbr0_update_workaround expects 2nd and 3rd arguments
> are temporary registers. Don't clobber register x1, Otherwise
> the next load operation 'mmid x1 x1' access the invalid address.
>
> [<ffff0000080989a0>] cpu_do_switch_mm+0x20/0x40
> [<ffff000008b18614>] efi_virtmap_load+0x34/0x40
> [<ffff000008b1812c>] virt_efi_get_next_variable+0x64/0xc8
> [<ffff000008b16204>] efivar_init+0x8c/0x348
> [<ffff0000092b777c>] efisubsys_init+0xd4/0x270
> [<ffff000009270c74>] do_one_initcall+0x80/0x110
> [<ffff000009270ea0>] kernel_init_freeable+0x19c/0x240
> [<ffff000008d8cef0>] kernel_init+0x10/0x100
> [<ffff000008082ec0>] ret_from_fork+0x10/0x50
> Code: d5033fdf b340bc01 d5182001 d5033fdf (f9416821)
> ---[ end trace 15247ca922eb6bb7 ]---
> note: swapper/0[1] exited with preempt_count 2
> Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
>
> SMP: stopping secondary CPUs
> ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
>
> Signed-off-by: Shanker Donthineni <shankerd@codeaurora.org>
> ---
> arch/arm64/mm/proc.S | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S
> index cd4d53d..877d42f 100644
> --- a/arch/arm64/mm/proc.S
> +++ b/arch/arm64/mm/proc.S
> @@ -138,7 +138,7 @@ ENDPROC(cpu_do_resume)
>  *	- pgd_phys - physical address of new TTB
>  */
> ENTRY(cpu_do_switch_mm)
> -	pre_ttbr0_update_workaround x0, x1, x2
> +	pre_ttbr0_update_workaround x0, x2, x3
> 	mmid	x1, x1				// get mm->context.id
> 	bfi	x0, x1, #48, #16		// set the ASID
> 	msr	ttbr0_el1, x0			// set TTBR0
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* arm64: Fix the kernel panic() on QDF2400 platform
@ 2017-02-23 17:57   ` Manoj Iyer
  0 siblings, 0 replies; 8+ messages in thread
From: Manoj Iyer @ 2017-02-23 17:57 UTC (permalink / raw)
  To: linux-arm-kernel


Tested on Ubuntu 17.04 (Linux 4.10). I am able to boot the kernel on 
QDF2400 platform without any panics.

Tested-by: Manoj Iyer <manoj.iyer@canonical.com>

--
============================
Manoj Iyer
Ubuntu/Canonical
ARM Servers - Cloud
============================

On Wed, 22 Feb 2017, Shanker Donthineni wrote:

> The commit 38fd94b0 'arm64: Work around Falkor erratum 1003' has
> been added to fix the hardware bug but causing a system crash.
> The value of the register x1 which contains 'struct mm_struct *'
> should be preserved inside macro pre_ttbr0_update_workaround.
>
> Macro pre_ttbr0_update_workaround expects 2nd and 3rd arguments
> are temporary registers. Don't clobber register x1, Otherwise
> the next load operation 'mmid x1 x1' access the invalid address.
>
> [<ffff0000080989a0>] cpu_do_switch_mm+0x20/0x40
> [<ffff000008b18614>] efi_virtmap_load+0x34/0x40
> [<ffff000008b1812c>] virt_efi_get_next_variable+0x64/0xc8
> [<ffff000008b16204>] efivar_init+0x8c/0x348
> [<ffff0000092b777c>] efisubsys_init+0xd4/0x270
> [<ffff000009270c74>] do_one_initcall+0x80/0x110
> [<ffff000009270ea0>] kernel_init_freeable+0x19c/0x240
> [<ffff000008d8cef0>] kernel_init+0x10/0x100
> [<ffff000008082ec0>] ret_from_fork+0x10/0x50
> Code: d5033fdf b340bc01 d5182001 d5033fdf (f9416821)
> ---[ end trace 15247ca922eb6bb7 ]---
> note: swapper/0[1] exited with preempt_count 2
> Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
>
> SMP: stopping secondary CPUs
> ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
>
> Signed-off-by: Shanker Donthineni <shankerd@codeaurora.org>
> ---
> arch/arm64/mm/proc.S | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S
> index cd4d53d..877d42f 100644
> --- a/arch/arm64/mm/proc.S
> +++ b/arch/arm64/mm/proc.S
> @@ -138,7 +138,7 @@ ENDPROC(cpu_do_resume)
>  *	- pgd_phys - physical address of new TTB
>  */
> ENTRY(cpu_do_switch_mm)
> -	pre_ttbr0_update_workaround x0, x1, x2
> +	pre_ttbr0_update_workaround x0, x2, x3
> 	mmid	x1, x1				// get mm->context.id
> 	bfi	x0, x1, #48, #16		// set the ASID
> 	msr	ttbr0_el1, x0			// set TTBR0
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] arm64: Fix the kernel panic() on QDF2400 platform
  2017-02-23 14:45   ` Will Deacon
@ 2017-02-23 19:29     ` Timur Tabi
  -1 siblings, 0 replies; 8+ messages in thread
From: Timur Tabi @ 2017-02-23 19:29 UTC (permalink / raw)
  To: Will Deacon
  Cc: Shanker Donthineni, Mark Rutland, Vikram Sethi, Catalin Marinas,
	linux-kernel, James Morse, linux-arm-kernel, cov

On Thu, Feb 23, 2017 at 8:45 AM, Will Deacon <will.deacon@arm.com> wrote:
>
> Whilst I'm pleased that you've sent a fix (and I'll pick it up), I have
> to ask... did anybody actually test the original patch? If so, why wasn't
> this found earlier?

First, Shanker's going to post a V2 with an improved patch description.

As for testing it, well, I can't explain how that bug was missed.
Looking at it, it's obvious now.  Unfortunately, the developer who
wrote the code no longer works for Qualcomm.

-- 
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] arm64: Fix the kernel panic() on QDF2400 platform
@ 2017-02-23 19:29     ` Timur Tabi
  0 siblings, 0 replies; 8+ messages in thread
From: Timur Tabi @ 2017-02-23 19:29 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Feb 23, 2017 at 8:45 AM, Will Deacon <will.deacon@arm.com> wrote:
>
> Whilst I'm pleased that you've sent a fix (and I'll pick it up), I have
> to ask... did anybody actually test the original patch? If so, why wasn't
> this found earlier?

First, Shanker's going to post a V2 with an improved patch description.

As for testing it, well, I can't explain how that bug was missed.
Looking at it, it's obvious now.  Unfortunately, the developer who
wrote the code no longer works for Qualcomm.

-- 
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-02-23 19:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-23  3:10 [PATCH] arm64: Fix the kernel panic() on QDF2400 platform Shanker Donthineni
2017-02-23  3:10 ` Shanker Donthineni
2017-02-23 14:45 ` Will Deacon
2017-02-23 14:45   ` Will Deacon
2017-02-23 19:29   ` Timur Tabi
2017-02-23 19:29     ` Timur Tabi
2017-02-23 17:57 ` Manoj Iyer
2017-02-23 17:57   ` Manoj Iyer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.