mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: mingo@elte.hu, rostedt@goodmis.org, yhlu.kernel@gmail.com
Cc: linux-kernel@vger.kernel.org, Jiri Olsa <jolsa@redhat.com>
Subject: [PATCH 2/2] apic,trace: IPI sent trace event.
Date: Thu,  5 Aug 2010 13:09:38 +0200	[thread overview]
Message-ID: <1281006578-5073-3-git-send-email-jolsa@redhat.com> (raw)
In-Reply-To: <1281006578-5073-1-git-send-email-jolsa@redhat.com>

Adding apic IPI trace event.

wbr,
jirka


Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
 arch/x86/include/asm/apic_trace.h |   53 +++++++++++++++++++++++++++++++++++++
 arch/x86/kernel/apic/apic.c       |   21 ++++++++++++++
 2 files changed, 74 insertions(+), 0 deletions(-)
 create mode 100644 arch/x86/include/asm/apic_trace.h

diff --git a/arch/x86/include/asm/apic_trace.h b/arch/x86/include/asm/apic_trace.h
new file mode 100644
index 0000000..03eea8e
--- /dev/null
+++ b/arch/x86/include/asm/apic_trace.h
@@ -0,0 +1,53 @@
+
+#if !defined(_TRACE_APIC_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_APIC_H
+
+#include <linux/tracepoint.h>
+#include <linux/cpumask.h>
+
+#define BUFSIZE (50)
+#define CPU_MASK_PRINTK() ({						\
+	const char *ret = p->buffer + p->len;				\
+	char buf[BUFSIZE];						\
+	bitmap_scnlistprintf(buf, BUFSIZE,				\
+			     __entry->mask, nr_cpumask_bits);		\
+	trace_seq_printf(p, "to cpu(s) %s\n", buf);			\
+	ret;								\
+})
+
+/**
+ * apic_send_IPI_mask - called before the IPI is send
+ * @mask: cpu mask the IPI is directed to
+ * @vector: interrupt number
+ */
+TRACE_EVENT(apic_send_IPI,
+
+	TP_PROTO(const struct cpumask *mask, int vector),
+
+	TP_ARGS(mask, vector),
+
+	TP_STRUCT__entry(
+		__array(unsigned long, mask, nr_cpumask_bits)
+		__field(int, vector)
+	),
+
+	TP_fast_assign(
+		bitmap_copy(__entry->mask, cpumask_bits(mask), nr_cpumask_bits);
+		__entry->vector = vector;
+	),
+
+	TP_printk("irq %d, %s", __entry->vector, CPU_MASK_PRINTK())
+);
+
+#endif /* _TRACE_APIC_H */
+
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM irq
+
+#undef TRACE_INCLUDE_FILE
+#define TRACE_INCLUDE_FILE apic_trace
+
+#undef TRACE_INCLUDE_PATH
+#define TRACE_INCLUDE_PATH asm
+
+#include <trace/define_trace.h>
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 2ab2f26..d8cddf0 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -53,6 +53,9 @@
 #include <asm/kvm_para.h>
 #include <asm/tsc.h>
 
+#define CREATE_TRACE_POINTS
+#include <asm/apic_trace.h>
+
 unsigned int num_processors;
 
 unsigned disabled_cpus __cpuinitdata;
@@ -2335,25 +2338,43 @@ late_initcall(lapic_insert_resource);
 
 void apic_send_IPI_mask(const struct cpumask *mask, int vector)
 {
+	trace_apic_send_IPI(mask, vector);
+
 	apic->send_IPI_mask(mask, vector);
 }
 
 void apic_send_IPI_mask_allbutself(const struct cpumask *mask, int vector)
 {
+	trace_apic_send_IPI(mask, vector);
+
 	apic->send_IPI_mask_allbutself(mask, vector);
 }
 
 void apic_send_IPI_allbutself(int vector)
 {
+	struct cpumask mask;
+
+	cpumask_copy(&mask, cpu_possible_mask);
+	cpumask_clear_cpu(smp_processor_id(), &mask);
+	trace_apic_send_IPI(&mask, vector);
+
 	apic->send_IPI_allbutself(vector);
 }
 
 void apic_send_IPI_all(int vector)
 {
+	trace_apic_send_IPI(cpu_online_mask, vector);
+
 	apic->send_IPI_all(vector);
 }
 
 void apic_send_IPI_self(int vector)
 {
+	struct cpumask mask;
+
+	cpumask_clear(&mask);
+	cpumask_set_cpu(smp_processor_id(), &mask);
+	trace_apic_send_IPI(&mask, vector);
+
 	apic->send_IPI_self(vector);
 }
-- 
1.7.2


  parent reply	other threads:[~2010-08-05 11:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-05 11:09 [RFC 0/2] apic: tracing IPI events Jiri Olsa
2010-08-05 11:09 ` [PATCH 1/2] apic: adding apic_send_IPI_* methods for apic's IPI callbacks Jiri Olsa
2010-08-05 11:09 ` Jiri Olsa [this message]
2010-08-06 11:26 ` [RFC 0/2] apic: tracing IPI events Andi Kleen
2010-08-06 11:46   ` Jiri Olsa

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=1281006578-5073-3-git-send-email-jolsa@redhat.com \
    --to=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rostedt@goodmis.org \
    --cc=yhlu.kernel@gmail.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

all inboxes | Powered by JetHome®