public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Ingo Molnar <mingo@elte.hu>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Paul Mackerras <paulus@samba.org>
Subject: [PATCH 1/4] irq: Support to compute context on top of a given preempt_count offset
Date: Fri, 21 May 2010 16:05:12 +0200	[thread overview]
Message-ID: <1274450715-23955-2-git-send-regression-fweisbec@gmail.com> (raw)
In-Reply-To: <1274450715-23955-1-git-send-regression-fweisbec@gmail.com>

This brings the support to compute irq/preempt contexts on top
of a a given preempt count offset instead of the current one.

This is going to be useful for perf that needs to know the
preempt_count() of the context that an event has interrupted.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
---
 include/linux/hardirq.h |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index d5b3876..0195547 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -58,6 +58,7 @@
 #define SOFTIRQ_MASK	(__IRQ_MASK(SOFTIRQ_BITS) << SOFTIRQ_SHIFT)
 #define HARDIRQ_MASK	(__IRQ_MASK(HARDIRQ_BITS) << HARDIRQ_SHIFT)
 #define NMI_MASK	(__IRQ_MASK(NMI_BITS)     << NMI_SHIFT)
+#define IRQ_MASK	(SOFTIRQ_MASK | HARDIRQ_MASK | NMI_MASK)
 
 #define PREEMPT_OFFSET	(1UL << PREEMPT_SHIFT)
 #define SOFTIRQ_OFFSET	(1UL << SOFTIRQ_SHIFT)
@@ -74,15 +75,23 @@
 #error PREEMPT_ACTIVE is too low!
 #endif
 
-#define hardirq_count()	(preempt_count() & HARDIRQ_MASK)
-#define softirq_count()	(preempt_count() & SOFTIRQ_MASK)
-#define irq_count()	(preempt_count() & (HARDIRQ_MASK | SOFTIRQ_MASK \
-				 | NMI_MASK))
+#define hardirq_count_offset(offset)	((offset) & HARDIRQ_MASK)
+#define softirq_count_offset(offset)	((offset) & SOFTIRQ_MASK)
+#define irq_count_offset(offset)	((offset) & IRQ_MASK)
+
+#define hardirq_count()			hardirq_count_offset(preempt_count())
+#define softirq_count()			softirq_count_offset(preempt_count())
+#define irq_count()			irq_count_offset(preempt_count())
 
 /*
  * Are we doing bottom half or hardware interrupt processing?
  * Are we in a softirq context? Interrupt context?
  */
+#define in_irq_offset(offset)		(hardirq_count_offset(offset))
+#define in_softirq_offset(offset)	(softirq_count_offset(offset))
+#define in_interrupt_offset(offset)	(irq_count_offset(offset))
+
+
 #define in_irq()		(hardirq_count())
 #define in_softirq()		(softirq_count())
 #define in_interrupt()		(irq_count())
-- 
1.6.2.3


  reply	other threads:[~2010-05-21 14:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-21 14:05 [PATCH 0/4] perf: Tasks and irq exclusion Frederic Weisbecker
2010-05-21 14:05 ` Frederic Weisbecker [this message]
2010-05-21 14:05 ` [PATCH 2/4] perf: Add exclude_task perf event attribute Frederic Weisbecker
2010-05-25  1:43   ` Paul Mackerras
2010-05-25  6:58     ` Peter Zijlstra
2010-05-25 10:06       ` Frederic Weisbecker
2010-06-07  1:38       ` Frederic Weisbecker
2010-06-08 18:59         ` Ingo Molnar
2010-06-08 19:02           ` Frederic Weisbecker
2010-05-21 14:05 ` [PATCH 3/4] perf: Support for irq exclusion Frederic Weisbecker
2010-05-21 14:06   ` Frederic Weisbecker
2010-05-21 14:05 ` [PATCH 4/4] perf: Support for task/softirq/hardirq exclusion on tools Frederic Weisbecker
2010-05-21 15:12 ` [PATCH 0/4] perf: Precise task / softirq / hardirq filtered stats/profiles Ingo Molnar
2010-05-21 16:15   ` Peter Zijlstra
2010-05-21 18:36     ` Ingo Molnar

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=1274450715-23955-2-git-send-regression-fweisbec@gmail.com \
    --to=fweisbec@gmail.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    /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