From: Steven Rostedt <rostedt@goodmis.org>
To: Daniel Bristot de Oliveira <bristot@kernel.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
Jonathan Corbet <corbet@lwn.net>,
Juri Lelli <juri.lelli@redhat.com>,
Clark Williams <williams@redhat.com>,
Bagas Sanjaya <bagasdotme@gmail.com>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH V4 2/3] tracing/osnoise: Add preempt and/or irq disabled options
Date: Fri, 9 Dec 2022 15:35:52 -0500 [thread overview]
Message-ID: <20221209153552.4c7099cd@gandalf.local.home> (raw)
In-Reply-To: <ded51c4490cf0cdce4e73e448c77bef9c35d257b.1669832184.git.bristot@kernel.org>
On Wed, 30 Nov 2022 19:19:10 +0100
Daniel Bristot de Oliveira <bristot@kernel.org> wrote:
Hi Daniel,
As I was adding this series, I noticed an issue that needs to be fixed.
> static int run_osnoise(void)
> {
> + bool irq_disable = test_bit(OSN_IRQ_DISABLE, &osnoise_options);
> struct osnoise_variables *osn_var = this_cpu_osn_var();
> u64 start, sample, last_sample;
> u64 last_int_count, int_count;
> @@ -1315,11 +1323,18 @@ static int run_osnoise(void)
> s64 total, last_total = 0;
> struct osnoise_sample s;
> unsigned int threshold;
> + bool preempt_disable;
Let's use a different name for the above variable.
> u64 runtime, stop_in;
> u64 sum_noise = 0;
> int hw_count = 0;
> int ret = -1;
>
> + /*
> + * Disabling preemption is only required if IRQs are enabled,
> + * and the options is set on.
> + */
> + preempt_disable = !irq_disable && test_bit(OSN_PREEMPT_DISABLE, &osnoise_options);
> +
> /*
> * Considers the current thread as the workload.
> */
> @@ -1335,6 +1350,15 @@ static int run_osnoise(void)
> */
> threshold = tracing_thresh ? : 5000;
>
> + /*
> + * Apply PREEMPT and IRQ disabled options.
> + */
> + if (irq_disable)
> + local_irq_disable();
> +
> + if (preempt_disable)
> + preempt_disable();
> +
The only reason the above works is because preempt_disable() is a macro.
If it was a function, then it would likely fail to build (as you are
overriding the name with a bool variable).
-- Steve
next prev parent reply other threads:[~2022-12-09 20:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-30 18:19 [PATCH V4 0/3] Add osnoise/options options Daniel Bristot de Oliveira
2022-11-30 18:19 ` [PATCH V4 1/3] tracing/osnoise: Add PANIC_ON_STOP option Daniel Bristot de Oliveira
2022-11-30 18:19 ` [PATCH V4 2/3] tracing/osnoise: Add preempt and/or irq disabled options Daniel Bristot de Oliveira
2022-12-09 20:35 ` Steven Rostedt [this message]
2022-12-09 21:16 ` Daniel Bristot de Oliveira
2022-11-30 18:35 ` [PATCH V4 3/3] Documentation/osnoise: Add osnoise/options documentation Daniel Bristot de Oliveira
2022-12-01 3:59 ` Bagas Sanjaya
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=20221209153552.4c7099cd@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=bagasdotme@gmail.com \
--cc=bristot@kernel.org \
--cc=corbet@lwn.net \
--cc=juri.lelli@redhat.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=williams@redhat.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®