mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Ankit Gupta" <ankgupta@codeaurora.org>
To: "Ankit Gupta" <ankgupta@codeaurora.org>
Cc: gavidov@codeaurora.org, sdharia@codeaurora.org,
	ivan.ivanov@linaro.org, svarbanov@mm-sol.com,
	rostedt@goodmis.org, linux-arm-msm@vger.kernel.org,
	gregkh@linuxfoundation.org, sboyd@codeaurora.org,
	collinsd@codeaurora.org, osvaldob@codeaurora.org,
	linux-kernel@vger.kernel.org, mlocke@codeaurora.org,
	galak@codeaurora.org, agross@codeaurora.org,
	"Ankit Gupta" <ankgupta@codeaurora.org>
Subject: Re: [PATCH v2] spmi-pmic-arb: add irq tracepoints to the pmic-arb driver
Date: Wed, 27 May 2015 10:21:10 -0600	[thread overview]
Message-ID: <1e85ad053b3b52c4d749580cce52b737.squirrel@www.codeaurora.org> (raw)
In-Reply-To: <1432743042-22817-1-git-send-email-ankgupta@codeaurora.org>

> The spmi-pmic-arb is also an interrupt controller. It gets a
> single aggregate irq and disseminates it to individual
> pmic-peripheral drivers. Each pmic-peripheral has a unique apid
> number, and can have multiple interrupt capable functions.
> The registered apid range shows the lowest and highest apid
> numbers of pmic-peripheral drivers which request irqs. Pid is
> the base address of that peripheral. For performance measurement,
> tracepoints are added at the beginning of the aggregate irq and
> at the end of the individual pmic-peripheral irqs.
>
> Following is a list showing the new tracepoint events:
>
> spmi_pmic_arb_aggregate_irq_start: aggregate irq number and registered
> 				   apid range.
>
> spmi_pmic_arb_apid_irq_end: apid, irq, func_num, sid and pid.
>
> SPMI Interrupts tracepoints can be enabled like:
>
> echo 1 >/sys/kernel/debug/tracing/events/spmi-pmic-arb/enable
>
> and will dump messages that can be viewed in
> /sys/kernel/debug/tracing/trace that look like:
> ... spmi_pmic_arb_aggregate_irq_start: irq=150 registered apid
> range=(3,189)
> ... spmi_pmic_arb_apid_irq_end: apid=3 irq=1 func_num=0 sid=0 pid=0x8
>
> Suggested-by: Sagar Dharia <sdharia@codeaurora.org>
> Signed-off-by: Gilad Avidov <gavidov@codeaurora.org>
> Signed-off-by: Ankit Gupta <ankgupta@codeaurora.org>
> ---

---
Changes since V1:
- pass ppid from driver to evaluate pid and sid in trace file itself.
- type of apid range change from int to u16 as max range can be 512.
- type of func_num change from int to u8, as max it can be 8.
---

>  drivers/spmi/spmi-pmic-arb.c         | 13 +++++---
>  include/trace/events/spmi-pmic-arb.h | 62
> ++++++++++++++++++++++++++++++++++++
>  2 files changed, 70 insertions(+), 5 deletions(-)
>  create mode 100644 include/trace/events/spmi-pmic-arb.h
>
> diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c
> index 20559ab..56100e2 100644
> --- a/drivers/spmi/spmi-pmic-arb.c
> +++ b/drivers/spmi/spmi-pmic-arb.c
> @@ -23,6 +23,9 @@
>  #include <linux/slab.h>
>  #include <linux/spmi.h>
>
> +#define CREATE_TRACE_POINTS
> +#include <trace/events/spmi-pmic-arb.h>
> +
>  /* PMIC Arbiter configuration registers */
>  #define PMIC_ARB_VERSION		0x0000
>  #define PMIC_ARB_INT_EN			0x0004
> @@ -375,16 +378,15 @@ static void periph_interrupt(struct
> spmi_pmic_arb_dev *pa, u8 apid)
>  	unsigned int irq;
>  	u32 status;
>  	int id;
> +	u16 ppid = pa->apid_to_ppid[apid];
>
>  	status = readl_relaxed(pa->intr + SPMI_PIC_IRQ_STATUS(apid));
>  	while (status) {
>  		id = ffs(status) - 1;
>  		status &= ~(1 << id);
> -		irq = irq_find_mapping(pa->domain,
> -				       pa->apid_to_ppid[apid] << 16
> -				     | id << 8
> -				     | apid);
> +		irq = irq_find_mapping(pa->domain, ppid << 16 | id << 8 | apid);
>  		generic_handle_irq(irq);
> +		trace_spmi_pmic_arb_apid_irq_end(apid, irq, id, ppid);
>  	}
>  }
>
> @@ -399,7 +401,8 @@ static void pmic_arb_chained_irq(unsigned int irq,
> struct irq_desc *desc)
>  	int i, id;
>
>  	chained_irq_enter(chip, desc);
> -
> +	trace_spmi_pmic_arb_aggregate_irq_start(irq, pa->min_apid,
> +						pa->max_apid);
>  	for (i = first; i <= last; ++i) {
>  		status = readl_relaxed(intr +
>  				       SPMI_PIC_OWNER_ACC_STATUS(pa->ee, i));
> diff --git a/include/trace/events/spmi-pmic-arb.h
> b/include/trace/events/spmi-pmic-arb.h
> new file mode 100644
> index 0000000..c7fd402
> --- /dev/null
> +++ b/include/trace/events/spmi-pmic-arb.h
> @@ -0,0 +1,62 @@
> +#undef TRACE_SYSTEM
> +#define TRACE_SYSTEM spmi-pmic-arb
> +
> +#if !defined(_TRACE_SPMI_PMIC_ARB_H) || defined(TRACE_HEADER_MULTI_READ)
> +#define _TRACE_SPMI_PMIC_ARB_H
> +
> +#include <linux/spmi.h>
> +#include <linux/tracepoint.h>
> +
> +/*
> + * drivers/spmi/spmi-pmic-arb.c
> + */
> +
> +TRACE_EVENT(spmi_pmic_arb_aggregate_irq_start,
> +	TP_PROTO(unsigned int irq, u16 first, u16 last),
> +	TP_ARGS(irq, first, last),
> +
> +	TP_STRUCT__entry(
> +		__field		( unsigned int,   irq   )
> +		__field		( u16,            first )
> +		__field		( u16,            last  )
> +	),
> +
> +	TP_fast_assign(
> +		__entry->irq    = irq;
> +		__entry->first  = first;
> +		__entry->last   = last;
> +	),
> +
> +	TP_printk("irq=%d registered apid range=(%d,%d)",
> +		  (int)__entry->irq, (int)__entry->first, (int)__entry->last)
> +);
> +
> +TRACE_EVENT(spmi_pmic_arb_apid_irq_end,
> +	TP_PROTO(u8 apid, unsigned int irq, u8 func_num, u16 ppid),
> +	TP_ARGS(apid, irq, func_num, ppid),
> +
> +	TP_STRUCT__entry(
> +		__field		( u8,           apid     )
> +		__field		( unsigned int, irq      )
> +		__field		( u8,           func_num )
> +		__field		( u8,           sid      )
> +		__field		( u8,           pid      )
> +	),
> +
> +	TP_fast_assign(
> +		__entry->apid     = apid;
> +		__entry->irq      = irq;
> +		__entry->func_num = func_num;
> +		__entry->sid      = (ppid >> 8) & 0x0F;
> +		__entry->pid      = (ppid & 0xFF);
> +	),
> +
> +	TP_printk("apid=%d irq=%d func_num=%d sid=%d pid=0x%d",
> +		  (int)__entry->apid, (int)__entry->irq, (int)__entry->func_num,
> +		  (int)__entry->sid, (int)__entry->pid)
> +);
> +
> +#endif /* _TRACE_SPMI_PMIC_ARB_H */
> +
> +/* This part must be outside protection */
> +#include <trace/define_trace.h>
> --
> 1.8.5.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-arm-msm"
> in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>



  reply	other threads:[~2015-05-27 16:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-27 16:10 Ankit Gupta
2015-05-27 16:21 ` Ankit Gupta [this message]
2015-05-27 16:30   ` Steven Rostedt

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=1e85ad053b3b52c4d749580cce52b737.squirrel@www.codeaurora.org \
    --to=ankgupta@codeaurora.org \
    --cc=agross@codeaurora.org \
    --cc=collinsd@codeaurora.org \
    --cc=galak@codeaurora.org \
    --cc=gavidov@codeaurora.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=ivan.ivanov@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mlocke@codeaurora.org \
    --cc=osvaldob@codeaurora.org \
    --cc=rostedt@goodmis.org \
    --cc=sboyd@codeaurora.org \
    --cc=sdharia@codeaurora.org \
    --cc=svarbanov@mm-sol.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®