mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nicolas Saenz Julienne <nsaenzju@redhat.com>
To: paulmck@kernel.org
Cc: rostedt@goodmis.org, bristot@kernel.org, mingo@redhat.com,
	linux-kernel@vger.kernel.org, mtosatti@redhat.com
Subject: Re: [PATCH] tracing/osnoise: Force quiescent states while tracing
Date: Wed, 02 Mar 2022 11:46:11 +0100	[thread overview]
Message-ID: <14775dadbf47ce3bcc8c375be82028ef4dcdba87.camel@redhat.com> (raw)
In-Reply-To: <20220301175621.GP4285@paulmck-ThinkPad-P17-Gen-1>

On Tue, 2022-03-01 at 09:56 -0800, Paul E. McKenney wrote:
> On Tue, Mar 01, 2022 at 11:00:08AM +0100, Nicolas Saenz Julienne wrote:
> > On Mon, 2022-02-28 at 14:11 -0800, Paul E. McKenney wrote:
> > > On Mon, Feb 28, 2022 at 03:14:23PM +0100, Nicolas Saenz Julienne wrote:
> > > > At the moment running osnoise on an isolated CPU and a PREEMPT_RCU
> > > > kernel might have the side effect of extending grace periods too much.
> > > > This will eventually entice RCU to schedule a task on the isolated CPU
> > > > to end the overly extended grace period, adding unwarranted noise to the
> > > > CPU being traced in the process.
> 
> Ah, I misread the above paragraph.  Apologies!
> 
> Nevertheless, could you please add something explicit to the effect that
> RCU is completing grace periods as required?

Yes, of course.

[...]
> > > o	At about 30 milliseconds into the grace period, RCU forces an
> > > 	explicit context switch on the wayward CPU.  This should get
> > > 	the CPU's attention even in CONFIG_PREEMPT=y kernels.
> > > 
> > > So what is happening for you instead?
> > 
> > Well, that's exactly what I'm seeing, but it doesn't play well with osnoise.
> 
> Whew!!!  ;-)
> 
> > Here's a simplified view of what the tracer does:
> > 
> > 	time1 = get_time();
> > 	while(1) {
> > 		time2 = get_time();
> > 		if (time2 - time1 > threshold)
> > 			trace_noise();
> > 		cond_resched();
> > 		time1 = time2;
> > 	}
> > 
> > This is pinned to a specific CPU, and in the most extreme cases is expected to
> > take 100% of CPU time. Eventually, some SMI, NMI/interrupt, or process
> > execution will trigger the threshold, and osnoise will provide some nice traces
> > explaining what happened.
> > 
> > RCU forcing a context switch on the wayward CPU is introducing unwarranted
> > noise as it's triggered by the fact we're measuring and wouldn't happen
> > otherwise.
> > 
> > If this were user-space, we'd be in an EQS, which would make this problem go
> > away. An option would be mimicking this behaviour (assuming irq entry/exit code
> > did the right thing):
> > 
> > 	rcu_eqs_enter(); <--
> > 	time1 = get_time();
> > 	while(1) {
> > 		time2 = get_time();
> > 		if (time2 - time1 > threshold)
> > 			trace_noise();
> > 		rcu_eqs_exit(); <--
> > 		cond_resched();
> > 		rcu_eqs_enter(); <--
> > 		time1 = time2;
> > 	}
> > 
> > But given the tight loop this isn't much different than what I'm proposing at
> > the moment, isn't it? rcu_momentary_dyntick_idle() just emulates a really fast
> > EQS entry/exit.
> 
> And that is in fact exactly what rcu_momentary_dyntick_idle() was
> intended for:
> 
> Acked-by: Paul E. McKenney <paulmck@kernel.org>

Thanks!

-- 
Nicolás Sáenz


  reply	other threads:[~2022-03-02 10:46 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-28 14:14 Nicolas Saenz Julienne
2022-02-28 15:45 ` Steven Rostedt
2022-03-01 10:59   ` Nicolas Saenz Julienne
2022-03-01 17:30     ` Daniel Bristot de Oliveira
2022-02-28 20:00 ` Daniel Bristot de Oliveira
2022-03-01 10:52   ` Nicolas Saenz Julienne
2022-03-01 17:55     ` Daniel Bristot de Oliveira
2022-03-01 18:05       ` Paul E. McKenney
2022-03-01 18:44         ` Daniel Bristot de Oliveira
2022-03-01 18:58           ` Paul E. McKenney
2022-03-01 19:29             ` Daniel Bristot de Oliveira
2022-03-01 19:46               ` Paul E. McKenney
2022-03-01 19:53                 ` Daniel Bristot de Oliveira
2022-02-28 22:11 ` Paul E. McKenney
2022-03-01 10:00   ` Nicolas Saenz Julienne
2022-03-01 17:44     ` Daniel Bristot de Oliveira
2022-03-01 17:56     ` Paul E. McKenney
2022-03-02 10:46       ` Nicolas Saenz Julienne [this message]
2022-03-04 14:28 ` Daniel Bristot de Oliveira
2022-03-04 14:36   ` Nicolas Saenz Julienne
2022-03-04 14:39     ` Daniel Bristot de Oliveira
2022-03-04 14:51     ` Daniel Bristot de Oliveira
2022-03-04 15:28       ` Nicolas Saenz Julienne
2022-03-04 15:37         ` Daniel Bristot de Oliveira
2022-03-04 15:55           ` Nicolas Saenz Julienne
2022-03-04 16:26             ` Paul E. McKenney

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=14775dadbf47ce3bcc8c375be82028ef4dcdba87.camel@redhat.com \
    --to=nsaenzju@redhat.com \
    --cc=bristot@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=paulmck@kernel.org \
    --cc=rostedt@goodmis.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

Powered by JetHome