public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Max Filippov <jcmvbkbc@gmail.com>
To: linux-xtensa@linux-xtensa.org, linux-kernel@vger.kernel.org
Cc: Chris Zankel <chris@zankel.net>, Marc Gauthier <marc@cadence.com>,
	Max Filippov <jcmvbkbc@gmail.com>
Subject: [PATCH v2 09/13] xtensa: reorganize irq flags tracing
Date: Sat, 18 Jul 2015 11:30:12 +0300	[thread overview]
Message-ID: <1437208216-15729-10-git-send-email-jcmvbkbc@gmail.com> (raw)
In-Reply-To: <1437208216-15729-1-git-send-email-jcmvbkbc@gmail.com>

entry.s only disables IRQs on hardware IRQ, move trace_hardirqs_off call
into do_interrupt. Check actual intlevel that will be restored on return
from exception handler to decide if trace_hardirqs_on should be called.
Annotate IRQ on/off points in the TIF_* handling loop on return from
exception handler.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
 arch/xtensa/kernel/entry.S | 39 ++++++++++++++-------------------------
 arch/xtensa/kernel/traps.c |  5 ++++-
 2 files changed, 18 insertions(+), 26 deletions(-)

diff --git a/arch/xtensa/kernel/entry.S b/arch/xtensa/kernel/entry.S
index b64075f..d060fc2 100644
--- a/arch/xtensa/kernel/entry.S
+++ b/arch/xtensa/kernel/entry.S
@@ -415,21 +415,6 @@ common_exception:
 
 	save_xtregs_opt a1 a3 a4 a5 a6 a7 PT_XTREGS_OPT
 	
-#ifdef CONFIG_TRACE_IRQFLAGS
-	l32i	a4, a1, PT_DEPC
-	/* Double exception means we came here with an exception
-	 * while PS.EXCM was set, i.e. interrupts disabled.
-	 */
-	bgeui	a4, VALID_DOUBLE_EXCEPTION_ADDRESS, 1f
-	bnei	a2, EXCCAUSE_LEVEL1_INTERRUPT, 1f
-	/* We came here with an interrupt means interrupts were enabled
-	 * and we've just disabled them.
-	 */
-	movi	a4, trace_hardirqs_off
-	callx4	a4
-1:
-#endif
-
 	/* Go to second-level dispatcher. Set up parameters to pass to the
 	 * exception handler and call the exception handler.
 	 */
@@ -450,6 +435,10 @@ common_exception_return:
 
 1:
 	rsil	a2, LOCKLEVEL
+#ifdef CONFIG_TRACE_IRQFLAGS
+	movi	a4, trace_hardirqs_off
+	callx4	a4
+#endif
 
 	/* Jump if we are returning from kernel exceptions. */
 
@@ -474,6 +463,10 @@ common_exception_return:
 
 	/* Call do_signal() */
 
+#ifdef CONFIG_TRACE_IRQFLAGS
+	movi	a4, trace_hardirqs_on
+	callx4	a4
+#endif
 	rsil	a2, 0
 	movi	a4, do_notify_resume	# int do_notify_resume(struct pt_regs*)
 	mov	a6, a1
@@ -482,6 +475,10 @@ common_exception_return:
 
 3:	/* Reschedule */
 
+#ifdef CONFIG_TRACE_IRQFLAGS
+	movi	a4, trace_hardirqs_on
+	callx4	a4
+#endif
 	rsil	a2, 0
 	movi	a4, schedule	# void schedule (void)
 	callx4	a4
@@ -510,16 +507,8 @@ common_exception_return:
 6:
 4:
 #ifdef CONFIG_TRACE_IRQFLAGS
-	l32i	a4, a1, PT_DEPC
-	/* Double exception means we came here with an exception
-	 * while PS.EXCM was set, i.e. interrupts disabled.
-	 */
-	bgeui	a4, VALID_DOUBLE_EXCEPTION_ADDRESS, 1f
-	l32i	a4, a1, PT_EXCCAUSE
-	bnei	a4, EXCCAUSE_LEVEL1_INTERRUPT, 1f
-	/* We came here with an interrupt means interrupts were enabled
-	 * and we'll reenable them on return.
-	 */
+	extui	a4, a3, PS_INTLEVEL_SHIFT, PS_INTLEVEL_WIDTH
+	bgei	a4, LOCKLEVEL, 1f
 	movi	a4, trace_hardirqs_on
 	callx4	a4
 1:
diff --git a/arch/xtensa/kernel/traps.c b/arch/xtensa/kernel/traps.c
index 9d2f45f..a1b5bd2 100644
--- a/arch/xtensa/kernel/traps.c
+++ b/arch/xtensa/kernel/traps.c
@@ -211,8 +211,11 @@ void do_interrupt(struct pt_regs *regs)
 		XCHAL_INTLEVEL6_MASK,
 		XCHAL_INTLEVEL7_MASK,
 	};
-	struct pt_regs *old_regs = set_irq_regs(regs);
+	struct pt_regs *old_regs;
 
+	trace_hardirqs_off();
+
+	old_regs = set_irq_regs(regs);
 	irq_enter();
 
 	for (;;) {
-- 
1.8.1.4


  parent reply	other threads:[~2015-07-18  8:33 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-18  8:30 [PATCH v2 00/13] Support hardware perf counters on xtensa Max Filippov
2015-07-18  8:30 ` [PATCH v2 01/13] xtensa: clean up Kconfig dependencies for custom cores Max Filippov
2015-07-18  8:30 ` [PATCH v2 02/13] xtensa: keep exception/interrupt stack continuous Max Filippov
2015-07-18  8:30 ` [PATCH v2 03/13] xtensa: move oprofile stack tracing to stacktrace.c Max Filippov
2015-07-18  8:30 ` [PATCH v2 04/13] xtensa: select PERF_USE_VMALLOC for cache-aliasing configurations Max Filippov
2015-07-18  8:30 ` [PATCH v2 05/13] xtensa: add profiling IRQ type to xtensa_irq_map Max Filippov
2015-07-18  8:30 ` [PATCH v2 06/13] xtensa: count software page fault perf events Max Filippov
2015-07-18  8:30 ` [PATCH v2 07/13] xtensa: implement counting and sampling " Max Filippov
2015-08-06 19:46   ` Arnaldo Carvalho de Melo
2015-08-07  9:13     ` Peter Zijlstra
2015-08-07 12:03       ` Max Filippov
2015-08-07 13:12         ` Arnaldo Carvalho de Melo
2015-07-18  8:30 ` [PATCH v2 08/13] perf tools: xtensa: add DWARF register names Max Filippov
2015-08-07  7:22   ` [tip:perf/core] perf tools xtensa: Add " tip-bot for Max Filippov
2015-07-18  8:30 ` Max Filippov [this message]
2015-07-18  8:30 ` [PATCH v2 10/13] xtensa: fix kernel register spilling Max Filippov
2015-07-18  8:30 ` [PATCH v2 11/13] xtensa: don't touch EXC_TABLE_FIXUP in _switch_to Max Filippov
2015-07-18  8:30 ` [PATCH v2 12/13] xtensa: implement fake NMI Max Filippov
2015-07-27 14:36   ` Max Filippov
2015-07-27 15:14   ` Peter Zijlstra
2015-07-18  8:30 ` [PATCH v2 13/13] xtensa: drop unused irq_err_count Max Filippov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1437208216-15729-10-git-send-email-jcmvbkbc@gmail.com \
    --to=jcmvbkbc@gmail.com \
    --cc=chris@zankel.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xtensa@linux-xtensa.org \
    --cc=marc@cadence.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox