linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc: Fix lazy preemption for powerpc 32bit
@ 2020-03-18 20:26 Thomas Graziadei
  2020-03-19 14:24 ` Sebastian Andrzej Siewior
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Graziadei @ 2020-03-18 20:26 UTC (permalink / raw)
  To: linux-kernel; +Cc: bigeasy, rostedt, tglx, linux-rt-users, Thomas Graziadei

From: Thomas Graziadei <thomas.graziadei@omicronenergy.com>

The 32bit powerpc assembler implementation of the lazy preemption
set the _TIF_PERSYSCALL_MASK on the low word. This could lead to
modprobe segfaults and a kernel panic - not syncing: Attempt to
kill init! issue.

Fixed by shifting the mask by 16 bit using andis and lis.

Signed-off-by: Thomas Graziadei <thomas.graziadei@omicronenergy.com>
---
 arch/powerpc/kernel/entry_32.S | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index 172dfb567c25..ab609d63d644 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -533,12 +533,12 @@ syscall_exit_work:
 
 1:	stw	r6,RESULT(r1)	/* Save result */
 	stw	r3,GPR3(r1)	/* Update return value */
-2:	andi.	r0,r9,(_TIF_PERSYSCALL_MASK)@h
+2:	andis.	r0,r9,(_TIF_PERSYSCALL_MASK)@h
 	beq	4f
 
 	/* Clear per-syscall TIF flags if any are set.  */
 
-	li	r11,_TIF_PERSYSCALL_MASK@h
+	lis	r11,(_TIF_PERSYSCALL_MASK)@h
 	addi	r12,r2,TI_FLAGS
 3:	lwarx	r8,0,r12
 	andc	r8,r8,r11
-- 
2.17.1


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

* Re: [PATCH] powerpc: Fix lazy preemption for powerpc 32bit
  2020-03-18 20:26 [PATCH] powerpc: Fix lazy preemption for powerpc 32bit Thomas Graziadei
@ 2020-03-19 14:24 ` Sebastian Andrzej Siewior
  2020-03-19 14:45   ` Thomas Graziadei
  0 siblings, 1 reply; 3+ messages in thread
From: Sebastian Andrzej Siewior @ 2020-03-19 14:24 UTC (permalink / raw)
  To: Thomas Graziadei; +Cc: linux-kernel, rostedt, tglx, linux-rt-users

On 2020-03-18 21:26:40 [+0100], Thomas Graziadei wrote:
> From: Thomas Graziadei <thomas.graziadei@omicronenergy.com>
> 
> The 32bit powerpc assembler implementation of the lazy preemption
> set the _TIF_PERSYSCALL_MASK on the low word. This could lead to
> modprobe segfaults and a kernel panic - not syncing: Attempt to
> kill init! issue.
> 
> Fixed by shifting the mask by 16 bit using andis and lis.

bah. Thank you for catching this.
Still e500 based powerpc I assume?

> Signed-off-by: Thomas Graziadei <thomas.graziadei@omicronenergy.com>

Sebastian

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

* RE: [PATCH] powerpc: Fix lazy preemption for powerpc 32bit
  2020-03-19 14:24 ` Sebastian Andrzej Siewior
@ 2020-03-19 14:45   ` Thomas Graziadei
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Graziadei @ 2020-03-19 14:45 UTC (permalink / raw)
  To: 'Sebastian Andrzej Siewior'
  Cc: linux-kernel, rostedt, tglx, linux-rt-users

> From: Sebastian Andrzej Siewior [mailto:bigeasy@linutronix.de] 
> On 2020-03-18 21:26:40 [+0100], Thomas Graziadei wrote:
>> From: Thomas Graziadei <thomas.graziadei@omicronenergy.com>
>> 
>> The 32bit powerpc assembler implementation of the lazy preemption set 
>> the _TIF_PERSYSCALL_MASK on the low word. This could lead to modprobe 
>> segfaults and a kernel panic - not syncing: Attempt to kill init! 
>> issue.
>> 
>> Fixed by shifting the mask by 16 bit using andis and lis.
>
> bah. Thank you for catching this.
> Still e500 based powerpc I assume?

Well thanks for the great work and yes still e500 powerpc based.

>
>> Signed-off-by: Thomas Graziadei <thomas.graziadei@omicronenergy.com>
>
> Sebastian

Thomas

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

end of thread, other threads:[~2020-03-19 14:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-18 20:26 [PATCH] powerpc: Fix lazy preemption for powerpc 32bit Thomas Graziadei
2020-03-19 14:24 ` Sebastian Andrzej Siewior
2020-03-19 14:45   ` Thomas Graziadei

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).