All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] sched/clock: print a log when the sched clock is marked unstable
@ 2021-07-07 10:56 Ani Sinha
  2021-07-07 11:17 ` Peter Zijlstra
  0 siblings, 1 reply; 5+ messages in thread
From: Ani Sinha @ 2021-07-07 10:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: anirban.sinha, tglx, Ani Sinha, Ingo Molnar, Peter Zijlstra,
	Juri Lelli, Vincent Guittot, Dietmar Eggemann, Steven Rostedt,
	Ben Segall, Mel Gorman, Daniel Bristot de Oliveira

When the sched clock transitions from stable to unstable and
vice versa, a kernel log is printed. When the sched clock
is marked explicitly as unstable, make __clear_sched_clock_stable()
emit a warning log. It is useful for example in understanding
why a certain feature like NOHZ that depends on availability of a
stable sched clock, is not available.

Signed-off-by: Ani Sinha <ani@anisinha.ca>
---
 kernel/sched/clock.c | 1 +
 1 file changed, 1 insertion(+)

Changelog:
V1: original patch
v2: print pr_warn from __clear_sched_clock_stable instead. Commit log
    updated with proper prefix and wording.

diff --git a/kernel/sched/clock.c b/kernel/sched/clock.c
index c2b2859ddd82..99484fec0335 100644
--- a/kernel/sched/clock.c
+++ b/kernel/sched/clock.c
@@ -183,6 +183,7 @@ static void __clear_sched_clock_stable(void)
 		return;
 
 	tick_dep_set(TICK_DEP_BIT_CLOCK_UNSTABLE);
+	pr_warn("sched_clock: Marking unstable.\n");
 	schedule_work(&sched_clock_work);
 }
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] sched/clock: print a log when the sched clock is marked unstable
  2021-07-07 10:56 [PATCH v2] sched/clock: print a log when the sched clock is marked unstable Ani Sinha
@ 2021-07-07 11:17 ` Peter Zijlstra
  2021-07-07 11:45   ` Ani Sinha
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Zijlstra @ 2021-07-07 11:17 UTC (permalink / raw)
  To: Ani Sinha
  Cc: linux-kernel, anirban.sinha, tglx, Ingo Molnar, Juri Lelli,
	Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
	Mel Gorman, Daniel Bristot de Oliveira

On Wed, Jul 07, 2021 at 04:26:59PM +0530, Ani Sinha wrote:
> When the sched clock transitions from stable to unstable and
> vice versa, a kernel log is printed. When the sched clock
> is marked explicitly as unstable, make __clear_sched_clock_stable()
> emit a warning log. It is useful for example in understanding
> why a certain feature like NOHZ that depends on availability of a
> stable sched clock, is not available.
> 
> Signed-off-by: Ani Sinha <ani@anisinha.ca>
> ---
>  kernel/sched/clock.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> Changelog:
> V1: original patch
> v2: print pr_warn from __clear_sched_clock_stable instead. Commit log
>     updated with proper prefix and wording.
> 
> diff --git a/kernel/sched/clock.c b/kernel/sched/clock.c
> index c2b2859ddd82..99484fec0335 100644
> --- a/kernel/sched/clock.c
> +++ b/kernel/sched/clock.c
> @@ -183,6 +183,7 @@ static void __clear_sched_clock_stable(void)
>  		return;
>  
>  	tick_dep_set(TICK_DEP_BIT_CLOCK_UNSTABLE);
> +	pr_warn("sched_clock: Marking unstable.\n");
>  	schedule_work(&sched_clock_work);
>  }

I'm confused... that work has a ton of printk()s in, what is this
pr_warn() adding?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] sched/clock: print a log when the sched clock is marked unstable
  2021-07-07 11:17 ` Peter Zijlstra
@ 2021-07-07 11:45   ` Ani Sinha
  2021-07-07 12:18     ` Ani Sinha
  0 siblings, 1 reply; 5+ messages in thread
From: Ani Sinha @ 2021-07-07 11:45 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Ani Sinha, linux-kernel, anirban.sinha, tglx, Ingo Molnar,
	Juri Lelli, Vincent Guittot, Dietmar Eggemann, Steven Rostedt,
	Ben Segall, Mel Gorman, Daniel Bristot de Oliveira



On Wed, 7 Jul 2021, Peter Zijlstra wrote:

> On Wed, Jul 07, 2021 at 04:26:59PM +0530, Ani Sinha wrote:
> > When the sched clock transitions from stable to unstable and
> > vice versa, a kernel log is printed. When the sched clock
> > is marked explicitly as unstable, make __clear_sched_clock_stable()
> > emit a warning log. It is useful for example in understanding
> > why a certain feature like NOHZ that depends on availability of a
> > stable sched clock, is not available.
> >
> > Signed-off-by: Ani Sinha <ani@anisinha.ca>
> > ---
> >  kernel/sched/clock.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > Changelog:
> > V1: original patch
> > v2: print pr_warn from __clear_sched_clock_stable instead. Commit log
> >     updated with proper prefix and wording.
> >
> > diff --git a/kernel/sched/clock.c b/kernel/sched/clock.c
> > index c2b2859ddd82..99484fec0335 100644
> > --- a/kernel/sched/clock.c
> > +++ b/kernel/sched/clock.c
> > @@ -183,6 +183,7 @@ static void __clear_sched_clock_stable(void)
> >  		return;
> >
> >  	tick_dep_set(TICK_DEP_BIT_CLOCK_UNSTABLE);
> > +	pr_warn("sched_clock: Marking unstable.\n");
> >  	schedule_work(&sched_clock_work);
> >  }
>
> I'm confused... that work has a ton of printk()s in, what is this
> pr_warn() adding?
>

Right, but for whatever reason, on latest version of Ubuntu (21.04)
running on hyperV, I do not see those logs:

azureuser@CentOS:~$ uname -a
Linux CentOS 5.11.0-1009-azure #9-Ubuntu SMP Thu Jun 17 02:20:07 UTC 2021
x86_64 x86_64 x86_64 GNU/Linux
azureuser@CentOS:~$ dmesg | grep unstable
dmesg: read kernel buffer failed: Operation not permitted
azureuser@CentOS:~$ sudo su
root@CentOS:/home/azureuser# dmesg | grep unstable
[    0.000000] tsc: Marking TSC unstable due to running on Hyper-V
root@CentOS:/home/azureuser# dmesg | grep sched
[    0.384656] rcu: RCU calculated value of scheduler-enlistment delay is
25 jiffies.
[    1.122977] io scheduler mq-deadline registered
root@CentOS:/home/azureuser# exit

Hence, I was trying the patch.

A

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] sched/clock: print a log when the sched clock is marked unstable
  2021-07-07 11:45   ` Ani Sinha
@ 2021-07-07 12:18     ` Ani Sinha
  2021-07-10  3:49       ` Ani Sinha
  0 siblings, 1 reply; 5+ messages in thread
From: Ani Sinha @ 2021-07-07 12:18 UTC (permalink / raw)
  To: Ani Sinha
  Cc: Peter Zijlstra, linux-kernel, anirban.sinha, tglx, Ingo Molnar,
	Juri Lelli, Vincent Guittot, Dietmar Eggemann, Steven Rostedt,
	Ben Segall, Mel Gorman, Daniel Bristot de Oliveira



On Wed, 7 Jul 2021, Ani Sinha wrote:

>
>
> On Wed, 7 Jul 2021, Peter Zijlstra wrote:
>
> > On Wed, Jul 07, 2021 at 04:26:59PM +0530, Ani Sinha wrote:
> > > When the sched clock transitions from stable to unstable and
> > > vice versa, a kernel log is printed. When the sched clock
> > > is marked explicitly as unstable, make __clear_sched_clock_stable()
> > > emit a warning log. It is useful for example in understanding
> > > why a certain feature like NOHZ that depends on availability of a
> > > stable sched clock, is not available.
> > >
> > > Signed-off-by: Ani Sinha <ani@anisinha.ca>
> > > ---
> > >  kernel/sched/clock.c | 1 +
> > >  1 file changed, 1 insertion(+)
> > >
> > > Changelog:
> > > V1: original patch
> > > v2: print pr_warn from __clear_sched_clock_stable instead. Commit log
> > >     updated with proper prefix and wording.
> > >
> > > diff --git a/kernel/sched/clock.c b/kernel/sched/clock.c
> > > index c2b2859ddd82..99484fec0335 100644
> > > --- a/kernel/sched/clock.c
> > > +++ b/kernel/sched/clock.c
> > > @@ -183,6 +183,7 @@ static void __clear_sched_clock_stable(void)
> > >  		return;
> > >
> > >  	tick_dep_set(TICK_DEP_BIT_CLOCK_UNSTABLE);
> > > +	pr_warn("sched_clock: Marking unstable.\n");
> > >  	schedule_work(&sched_clock_work);
> > >  }
> >
> > I'm confused... that work has a ton of printk()s in, what is this
> > pr_warn() adding?
> >
>
> Right, but for whatever reason, on latest version of Ubuntu (21.04)
> running on hyperV, I do not see those logs:
>
> azureuser@CentOS:~$ uname -a
> Linux CentOS 5.11.0-1009-azure #9-Ubuntu SMP Thu Jun 17 02:20:07 UTC 2021
> x86_64 x86_64 x86_64 GNU/Linux
> azureuser@CentOS:~$ dmesg | grep unstable
> dmesg: read kernel buffer failed: Operation not permitted
> azureuser@CentOS:~$ sudo su
> root@CentOS:/home/azureuser# dmesg | grep unstable
> [    0.000000] tsc: Marking TSC unstable due to running on Hyper-V
> root@CentOS:/home/azureuser# dmesg | grep sched
> [    0.384656] rcu: RCU calculated value of scheduler-enlistment delay is
> 25 jiffies.
> [    1.122977] io scheduler mq-deadline registered
> root@CentOS:/home/azureuser# exit
>
> Hence, I was trying the patch.

OK never mimd. Seems on hyperV, they use read_hv_sched_clock_tsc() for
pv_sched_clock and therefore using_native_sched_clock() returns false.
Thus, clear_sched_clock_stable() is not called.

I will need to do some instrumentation to confirm this. Maybe we do not
need any patching after all.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] sched/clock: print a log when the sched clock is marked unstable
  2021-07-07 12:18     ` Ani Sinha
@ 2021-07-10  3:49       ` Ani Sinha
  0 siblings, 0 replies; 5+ messages in thread
From: Ani Sinha @ 2021-07-10  3:49 UTC (permalink / raw)
  To: Ani Sinha
  Cc: Peter Zijlstra, linux-kernel, anirban.sinha, Thomas Gleixner,
	Ingo Molnar, Juri Lelli, Vincent Guittot, Dietmar Eggemann,
	Steven Rostedt, Ben Segall, Mel Gorman,
	Daniel Bristot de Oliveira

On Wed, Jul 7, 2021 at 5:48 PM Ani Sinha <ani@anisinha.ca> wrote:
>
>
>
> On Wed, 7 Jul 2021, Ani Sinha wrote:
>
> >
> >
> > On Wed, 7 Jul 2021, Peter Zijlstra wrote:
> >
> > > On Wed, Jul 07, 2021 at 04:26:59PM +0530, Ani Sinha wrote:
> > > > When the sched clock transitions from stable to unstable and
> > > > vice versa, a kernel log is printed. When the sched clock
> > > > is marked explicitly as unstable, make __clear_sched_clock_stable()
> > > > emit a warning log. It is useful for example in understanding
> > > > why a certain feature like NOHZ that depends on availability of a
> > > > stable sched clock, is not available.
> > > >
> > > > Signed-off-by: Ani Sinha <ani@anisinha.ca>
> > > > ---
> > > >  kernel/sched/clock.c | 1 +
> > > >  1 file changed, 1 insertion(+)
> > > >
> > > > Changelog:
> > > > V1: original patch
> > > > v2: print pr_warn from __clear_sched_clock_stable instead. Commit log
> > > >     updated with proper prefix and wording.
> > > >
> > > > diff --git a/kernel/sched/clock.c b/kernel/sched/clock.c
> > > > index c2b2859ddd82..99484fec0335 100644
> > > > --- a/kernel/sched/clock.c
> > > > +++ b/kernel/sched/clock.c
> > > > @@ -183,6 +183,7 @@ static void __clear_sched_clock_stable(void)
> > > >           return;
> > > >
> > > >   tick_dep_set(TICK_DEP_BIT_CLOCK_UNSTABLE);
> > > > + pr_warn("sched_clock: Marking unstable.\n");
> > > >   schedule_work(&sched_clock_work);
> > > >  }
> > >
> > > I'm confused... that work has a ton of printk()s in, what is this
> > > pr_warn() adding?
> > >
> >
> > Right, but for whatever reason, on latest version of Ubuntu (21.04)
> > running on hyperV, I do not see those logs:
> >
> > azureuser@CentOS:~$ uname -a
> > Linux CentOS 5.11.0-1009-azure #9-Ubuntu SMP Thu Jun 17 02:20:07 UTC 2021
> > x86_64 x86_64 x86_64 GNU/Linux
> > azureuser@CentOS:~$ dmesg | grep unstable
> > dmesg: read kernel buffer failed: Operation not permitted
> > azureuser@CentOS:~$ sudo su
> > root@CentOS:/home/azureuser# dmesg | grep unstable
> > [    0.000000] tsc: Marking TSC unstable due to running on Hyper-V
> > root@CentOS:/home/azureuser# dmesg | grep sched
> > [    0.384656] rcu: RCU calculated value of scheduler-enlistment delay is
> > 25 jiffies.
> > [    1.122977] io scheduler mq-deadline registered
> > root@CentOS:/home/azureuser# exit
> >
> > Hence, I was trying the patch.
>
> OK never mimd. Seems on hyperV, they use read_hv_sched_clock_tsc() for
> pv_sched_clock and therefore using_native_sched_clock() returns false.
> Thus, clear_sched_clock_stable() is not called.
>
> I will need to do some instrumentation to confirm this. Maybe we do not
> need any patching after all.

Yes, no additional logging is needed here. This patch can be
discarded. There is a potential issue on the platform side code for
hyperV for which we might send a separate patch.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-07-10  3:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-07 10:56 [PATCH v2] sched/clock: print a log when the sched clock is marked unstable Ani Sinha
2021-07-07 11:17 ` Peter Zijlstra
2021-07-07 11:45   ` Ani Sinha
2021-07-07 12:18     ` Ani Sinha
2021-07-10  3:49       ` Ani Sinha

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.