linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: richard clark <richard.xnu.clark@gmail.com>
Cc: Mark Rutland <mark.rutland@arm.com>,
	will@kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	"Russell King (Oracle)" <linux@armlinux.org.uk>,
	Steven Rostedt <rostedt@goodmis.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: Will smp_call_function_single(cpu, ...) broadcast IPI to all other cpus?
Date: Thu, 27 Jun 2024 11:38:58 +0100	[thread overview]
Message-ID: <86pls2isal.wl-maz@kernel.org> (raw)
In-Reply-To: <CAJNi4rMfRmWoYdsyH6ibNKN8DSCL_DO8Wa08mWbe8t7vH21Dpw@mail.gmail.com>

On Thu, 27 Jun 2024 10:26:05 +0100,
richard clark <richard.xnu.clark@gmail.com> wrote:
> 
> Hi,
> There's a smp_call_function_single(10, ipi_cb_func, &data_info, 1)
> called by the init function of my kmod, then I ipi traces this
> smp_call_function_single(...) with below cmdline:
> 
> # echo 0 > /sys/kernel/debug/tracing/tracing_on; echo >
> /sys/kernel/debug/tracing/trace; echo 'reason=="Function call
> interrupts"' > /sys/kernel/debug/tracing/events/ipi/filter; echo 1 >
> /sys/kernel/debug/tracing/events/ipi/ipi_raise/enable; echo 1 >
> /sys/kernel/debug/tracing/events/ipi/ipi_entry/enable; echo 1 >
> /sys/kernel/debug/tracing/tracing_on; taskset -c 0 insmod
> /kmods/ipi_test.ko; echo 0 > /sys/kernel/debug/tracing/tracing_on;
> echo 0 > /sys/kernel/debug/tracing/events/ipi/ipi_raise/enable; echo 0
> > /sys/kernel/debug/tracing/events/ipi/ipi_entry/enable; echo >
> /sys/kernel/debug/tracing/events/ipi/filter; cat
> /sys/kernel/debug/tracing/trace
> 
> The trace output as below:
> 
> # tracer: nop
> #
> # entries-in-buffer/entries-written: 28/28   #P:12
> #
> #                                _-------=> irqs-off/BH-disabled
> #                               / _------=> need-resched
> #                              | / _-----=> need-resched-lazy
> #                              || / _----=> hardirq/softirq
> #                              ||| / _---=> preempt-depth
> #                              |||| / _--=> preempt-lazy-depth
> #                              ||||| / _-=> migrate-disable
> #                              |||||| /     delay
> #           TASK-PID     CPU#  |||||||  TIMESTAMP  FUNCTION
> #              | |         |   |||||||      |         |
> 
>           <idle>-0       [009] dn.h2..   555.400822: ipi_raise:
> target_mask=00000000,00000002 (Function call interrupts)
>           <idle>-0       [001] d..h1..   555.400832: ipi_entry:
> (Function call interrupts)
>           insmod-1644    [000] ....1..   555.401628: ipi_raise:
> target_mask=00000000,00000ffe (Function call interrupts)
>           <idle>-0       [001] d..h1..   555.401630: ipi_entry:
> (Function call interrupts)
>           <idle>-0       [009] d..h1..   555.401631: ipi_entry:
> (Function call interrupts)
>           <idle>-0       [011] d..h1..   555.401633: ipi_entry:
> (Function call interrupts)
>           <idle>-0       [003] d..h1..   555.401633: ipi_entry:
> (Function call interrupts)
>           <idle>-0       [008] d..h1..   555.401633: ipi_entry:
> (Function call interrupts)
>           <idle>-0       [002] d..h1..   555.401634: ipi_entry:
> (Function call interrupts)
>           <idle>-0       [010] d..h1..   555.401634: ipi_entry:
> (Function call interrupts)
>           <idle>-0       [004] d..h1..   555.401635: ipi_entry:
> (Function call interrupts)
>           <idle>-0       [005] d..h1..   555.401635: ipi_entry:
> (Function call interrupts)
>           <idle>-0       [006] d..h1..   555.401635: ipi_entry:
> (Function call interrupts)
>           <idle>-0       [007] d..h1..   555.401635: ipi_entry:
> (Function call interrupts)
>           insmod-1644    [000] ....1..   555.401643: ipi_raise:
> target_mask=00000000,00000ffe (Function call interrupts)
>           <idle>-0       [001] d..h1..   555.401644: ipi_entry:
> (Function call interrupts)
>           <idle>-0       [002] d..h1..   555.401645: ipi_entry:
> (Function call interrupts)
>           <idle>-0       [003] d..h1..   555.401645: ipi_entry:
> (Function call interrupts)
>           <idle>-0       [004] d..h1..   555.401645: ipi_entry:
> (Function call interrupts)
>           <idle>-0       [006] d..h1..   555.401645: ipi_entry:
> (Function call interrupts)
>           <idle>-0       [005] d..h1..   555.401645: ipi_entry:
> (Function call interrupts)
>           <idle>-0       [007] d..h1..   555.401645: ipi_entry:
> (Function call interrupts)
>           <idle>-0       [008] d..h1..   555.401645: ipi_entry:
> (Function call interrupts)
>           <idle>-0       [009] d..h1..   555.401645: ipi_entry:
> (Function call interrupts)
>           <idle>-0       [010] d..h1..   555.401645: ipi_entry:
> (Function call interrupts)
>           <idle>-0       [011] d..h1..   555.401646: ipi_entry:
> (Function call interrupts)
>           insmod-1644    [000] ....1..   555.401908: ipi_raise:
> target_mask=00000000,00000400 (Function call interrupts)
>           <idle>-0       [010] d..h1..   555.401911: ipi_entry:
> (Function call interrupts)
> 
> I am curious why there're two IPI broadcasts to all the other
> cpus(1-11) before the real smp_call_function_single(10) trace
> event(the last two lines of the above trace output), any comments
> about that?

You may want to enable stack trace recording and find out for yourself
where these ipi_raise() calls are coming from.

	M.

-- 
Without deviation from the norm, progress is not possible.


  reply	other threads:[~2024-06-27 11:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-27  9:26 Will smp_call_function_single(cpu, ...) broadcast IPI to all other cpus? richard clark
2024-06-27 10:38 ` Marc Zyngier [this message]
2024-06-27 14:12   ` Steven Rostedt
2024-06-28  1:57     ` richard clark
2024-06-28 10:21     ` richard clark
2024-06-28 12:41       ` Steven Rostedt
2024-06-29  5:41         ` richard clark
2024-06-28 13:13       ` Russell King (Oracle)
2024-06-29  5:38         ` richard clark

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=86pls2isal.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mark.rutland@arm.com \
    --cc=richard.xnu.clark@gmail.com \
    --cc=rostedt@goodmis.org \
    --cc=torvalds@linux-foundation.org \
    --cc=will@kernel.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;
as well as URLs for NNTP newsgroup(s).