From: Peter Zijlstra <peterz@infradead.org>
To: Zqiang <qiang1.zhang@intel.com>
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] irq_work: Add event-tracing points for irq_work
Date: Thu, 14 Apr 2022 11:32:04 +0200 [thread overview]
Message-ID: <YlfqFJLau+7PlPJ3@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20220414063829.2472251-1-qiang1.zhang@intel.com>
On Thu, Apr 14, 2022 at 02:38:29PM +0800, Zqiang wrote:
> Add irq_work_queue_on tracepoints allow tracing when and how
> a irq-work is queued, irq_work_execute_start/end tracepoints
> allow know when a irq-work is executed and the executed time.
Yeah, but why?
> diff --git a/kernel/irq_work.c b/kernel/irq_work.c
> index 7afa40fe5cc4..edad992556d0 100644
> --- a/kernel/irq_work.c
> +++ b/kernel/irq_work.c
> @@ -22,6 +22,9 @@
> #include <asm/processor.h>
> #include <linux/kasan.h>
>
> +#define CREATE_TRACE_POINTS
> +#include <trace/events/irq_work.h>
> +
> static DEFINE_PER_CPU(struct llist_head, raised_list);
> static DEFINE_PER_CPU(struct llist_head, lazy_list);
> static DEFINE_PER_CPU(struct task_struct *, irq_workd);
> @@ -81,7 +84,9 @@ static void __irq_work_queue_local(struct irq_work *work)
> bool rt_lazy_work = false;
> bool lazy_work = false;
> int work_flags;
> + int cpu = smp_processor_id();
>
> + trace_irq_work_queue_on(cpu, work);
That's not very nice, you made this function more expensive for no
reason. And you violated coding style while doing it :/
> work_flags = atomic_read(&work->node.a_flags);
> if (work_flags & IRQ_WORK_LAZY)
> lazy_work = true;
> @@ -143,7 +148,7 @@ bool irq_work_queue_on(struct irq_work *work, int cpu)
> if (cpu != smp_processor_id()) {
> /* Arch remote IPI send/receive backend aren't NMI safe */
> WARN_ON_ONCE(in_nmi());
> -
> + trace_irq_work_queue_on(cpu, work);
> /*
> * On PREEMPT_RT the items which are not marked as
> * IRQ_WORK_HARD_IRQ are added to the lazy list and a HARD work
> @@ -208,7 +213,9 @@ void irq_work_single(void *arg)
> smp_mb();
>
> lockdep_irq_work_enter(flags);
> + trace_irq_work_execute_start(work);
> work->func(work);
> + trace_irq_work_execute_end(work);
> lockdep_irq_work_exit(flags);
>
> /*
next prev parent reply other threads:[~2022-04-14 9:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-14 6:38 Zqiang
2022-04-14 9:32 ` Peter Zijlstra [this message]
2022-04-15 2:56 ` Zhang, Qiang1
2022-04-14 13:47 ` Thomas Gleixner
2022-04-15 3:02 ` Zhang, Qiang1
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=YlfqFJLau+7PlPJ3@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=qiang1.zhang@intel.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®