diff mbox

[v8,9/4] arm64: remove irq_count and do_softirq_own_stack()

Message ID 20151221113021.GH23092@arm.com
State New
Headers show

Commit Message

Will Deacon Dec. 21, 2015, 11:30 a.m. UTC
On Sun, Dec 20, 2015 at 08:07:46PM +0900, Jungseok Lee wrote:
> On Dec 19, 2015, at 1:01 AM, James Morse wrote:

> > diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S

> > index 0667fb7d8bb1..6745a9041f99 100644

> > --- a/arch/arm64/kernel/entry.S

> > +++ b/arch/arm64/kernel/entry.S

> > @@ -181,19 +181,20 @@ alternative_endif

> > 	.macro	irq_stack_entry

> > 	mov	x19, sp			// preserve the original sp

> > 

> > -	this_cpu_ptr irq_stack, x25, x26

> > -

> > 	/*

> > -	 * Check the lowest address on irq_stack for the irq_count value,

> > -	 * incremented by do_softirq_own_stack if we have re-enabled irqs

> > -	 * while on the irq_stack.

> > +	 * Compare sp and sp_el0, if the top ~(THREAD_SIZE - 1) bits match,

> > +	 * we are on a task stack, and should switch to the irq stack.

> > 	 */

> > -	ldr	x26, [x25]

> > -	cbnz	x26, 9998f		// recursive use?

> > +	mrs	x26, sp_el0		// already masked

> 

> Nit: How about using 'get_thread_info x26'?


Something like the following?

Will

--->8


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

Comments

Will Deacon Dec. 21, 2015, 12:21 p.m. UTC | #1
On Mon, Dec 21, 2015 at 12:19:32PM +0000, James Morse wrote:
> Will Deacon wrote:

> >> > +   mrs     x26, sp_el0             // already masked

> >>

> >> Nit: How about using 'get_thread_info x26'?

> > 

> > Something like the following?

> 

> Looks fine - I guess you're cleverly leaving the the el0_irq case to be

> covered by get_thread_info in kernel_entry?


Yup. tsk is always valid for exceptions taken from el0, afaict.

Will

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

Patch

diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S
index 6745a9041f99..c0db321db7e1 100644
--- a/arch/arm64/kernel/entry.S
+++ b/arch/arm64/kernel/entry.S
@@ -182,12 +182,12 @@  alternative_endif
 	mov	x19, sp			// preserve the original sp
 
 	/*
-	 * Compare sp and sp_el0, if the top ~(THREAD_SIZE - 1) bits match,
-	 * we are on a task stack, and should switch to the irq stack.
+	 * Compare sp with the current thread_info, if the top
+	 * ~(THREAD_SIZE - 1) bits match, we are on a task stack, and
+	 * should switch to the irq stack.
 	 */
-	mrs	x26, sp_el0		// already masked
 	and	x25, x19, #~(THREAD_SIZE - 1)
-	cmp	x25, x26
+	cmp	x25, tsk
 	b.ne	9998f
 
 	this_cpu_ptr irq_stack, x25, x26
@@ -406,10 +406,10 @@  el1_irq:
 	bl	trace_hardirqs_off
 #endif
 
+	get_thread_info tsk
 	irq_handler
 
 #ifdef CONFIG_PREEMPT
-	get_thread_info tsk
 	ldr	w24, [tsk, #TI_PREEMPT]		// get preempt count
 	cbnz	w24, 1f				// preempt count != 0
 	ldr	x0, [tsk, #TI_FLAGS]		// get flags