Re: [tip:x86/timers] sched/clock: Enable sched clock early

2018-07-30 Thread Pavel Tatashin
> > -   if (cd.actual_read_sched_clock == jiffy_sched_clock_read)
> > +   if (cd.actual_read_sched_clock == jiffy_sched_clock_read) {
> > +   local_irq_disable();
> > sched_clock_register(jiffy_sched_clock_read, BITS_PER_LONG, 
> > HZ);
> > +   local_irq_enable();
> > +   }
> >
> > update_sched_clock();
>
> I'm thinking maybe disable IRQs for that entire function, instead of
> just the register call.

Sure, I will send a patch.

Thank you,
Pavel


Re: [tip:x86/timers] sched/clock: Enable sched clock early

2018-07-30 Thread Pavel Tatashin
> > -   if (cd.actual_read_sched_clock == jiffy_sched_clock_read)
> > +   if (cd.actual_read_sched_clock == jiffy_sched_clock_read) {
> > +   local_irq_disable();
> > sched_clock_register(jiffy_sched_clock_read, BITS_PER_LONG, 
> > HZ);
> > +   local_irq_enable();
> > +   }
> >
> > update_sched_clock();
>
> I'm thinking maybe disable IRQs for that entire function, instead of
> just the register call.

Sure, I will send a patch.

Thank you,
Pavel


Re: [tip:x86/timers] sched/clock: Enable sched clock early

2018-07-30 Thread Peter Zijlstra
On Tue, Jul 24, 2018 at 10:41:19PM -0400, Pavel Tatashin wrote:

> If we need it, we can surround the sched_clock_register() with
> local_irq_disable/local_irq_enable:
> 
> diff --git a/kernel/time/sched_clock.c b/kernel/time/sched_clock.c
> index cbc72c2c1fca..5015b165b55b 100644
> --- a/kernel/time/sched_clock.c
> +++ b/kernel/time/sched_clock.c
> @@ -243,8 +243,11 @@ void __init generic_sched_clock_init(void)
>  * If no sched_clock() function has been provided at that point,
>  * make it the final one one.
>  */
> -   if (cd.actual_read_sched_clock == jiffy_sched_clock_read)
> +   if (cd.actual_read_sched_clock == jiffy_sched_clock_read) {
> +   local_irq_disable();
> sched_clock_register(jiffy_sched_clock_read, BITS_PER_LONG, 
> HZ);
> +   local_irq_enable();
> +   }
> 
> update_sched_clock();

I'm thinking maybe disable IRQs for that entire function, instead of
just the register call.


Re: [tip:x86/timers] sched/clock: Enable sched clock early

2018-07-30 Thread Peter Zijlstra
On Tue, Jul 24, 2018 at 10:41:19PM -0400, Pavel Tatashin wrote:

> If we need it, we can surround the sched_clock_register() with
> local_irq_disable/local_irq_enable:
> 
> diff --git a/kernel/time/sched_clock.c b/kernel/time/sched_clock.c
> index cbc72c2c1fca..5015b165b55b 100644
> --- a/kernel/time/sched_clock.c
> +++ b/kernel/time/sched_clock.c
> @@ -243,8 +243,11 @@ void __init generic_sched_clock_init(void)
>  * If no sched_clock() function has been provided at that point,
>  * make it the final one one.
>  */
> -   if (cd.actual_read_sched_clock == jiffy_sched_clock_read)
> +   if (cd.actual_read_sched_clock == jiffy_sched_clock_read) {
> +   local_irq_disable();
> sched_clock_register(jiffy_sched_clock_read, BITS_PER_LONG, 
> HZ);
> +   local_irq_enable();
> +   }
> 
> update_sched_clock();

I'm thinking maybe disable IRQs for that entire function, instead of
just the register call.


Re: [tip:x86/timers] sched/clock: Enable sched clock early

2018-07-24 Thread Pavel Tatashin
> integrator_defconfig+CONFIG_DEVTMPFS=y+CONFIG_DEVTMPFS_MOUNT=y
>
> Qemu command line is
> qemu-system-arm -M integratorcp  -m 128 \
> -kernel arch/arm/boot/zImage -no-reboot \
> -initrd busybox-armv4.cpio \
> --append "rdinit=/sbin/init console=ttyAMA0,115200" \
> -serial stdio -monitor null -nographic \
> -dtb arch/arm/boot/dts/integratorcp.dtb
>
> The scripts and files used are available from 
> g...@github.com:groeck/linux-build-test.git.
> qemu is version 2.12.

Reproduced. Thank you


Re: [tip:x86/timers] sched/clock: Enable sched clock early

2018-07-24 Thread Pavel Tatashin
> integrator_defconfig+CONFIG_DEVTMPFS=y+CONFIG_DEVTMPFS_MOUNT=y
>
> Qemu command line is
> qemu-system-arm -M integratorcp  -m 128 \
> -kernel arch/arm/boot/zImage -no-reboot \
> -initrd busybox-armv4.cpio \
> --append "rdinit=/sbin/init console=ttyAMA0,115200" \
> -serial stdio -monitor null -nographic \
> -dtb arch/arm/boot/dts/integratorcp.dtb
>
> The scripts and files used are available from 
> g...@github.com:groeck/linux-build-test.git.
> qemu is version 2.12.

Reproduced. Thank you


Re: [tip:x86/timers] sched/clock: Enable sched clock early

2018-07-24 Thread Pavel Tatashin
Peter,

The problem is in this stack

start_kernel
  local_irq_enable
  late_time_init
  sched_clock_init
generic_sched_clock_init
  sched_clock_register
WARN_ON(!irqs_disabled());

Before this work, sched_clock_init() was called prior to enabling
interrupts, but now after. So, we hit this WARN_ON() in
sched_clock_register().

The question is why do we need this warning in sched_clock_register? I
guess because we want to make this section of the code atomic:

195 new_epoch = read();  <- from here
196 cyc = cd.actual_read_sched_clock();
197 ns = rd.epoch_ns + cyc_to_ns((cyc - rd.epoch_cyc) &
rd.sched_clock_mask, rd.mult, rd.shift);
198 cd.actual_read_sched_clock = read;
199
200 rd.read_sched_clock = read;
201 rd.sched_clock_mask = new_mask;
202 rd.mult = new_mult;
203 rd.shift= new_shift;
204 rd.epoch_cyc= new_epoch;
205 rd.epoch_ns = ns;
206
207 update_clock_read_data(); <- to here

If we need it, we can surround the sched_clock_register() with
local_irq_disable/local_irq_enable:

diff --git a/kernel/time/sched_clock.c b/kernel/time/sched_clock.c
index cbc72c2c1fca..5015b165b55b 100644
--- a/kernel/time/sched_clock.c
+++ b/kernel/time/sched_clock.c
@@ -243,8 +243,11 @@ void __init generic_sched_clock_init(void)
 * If no sched_clock() function has been provided at that point,
 * make it the final one one.
 */
-   if (cd.actual_read_sched_clock == jiffy_sched_clock_read)
+   if (cd.actual_read_sched_clock == jiffy_sched_clock_read) {
+   local_irq_disable();
sched_clock_register(jiffy_sched_clock_read, BITS_PER_LONG, HZ);
+   local_irq_enable();
+   }

update_sched_clock();

Thank you,
Pavel


Re: [tip:x86/timers] sched/clock: Enable sched clock early

2018-07-24 Thread Pavel Tatashin
Peter,

The problem is in this stack

start_kernel
  local_irq_enable
  late_time_init
  sched_clock_init
generic_sched_clock_init
  sched_clock_register
WARN_ON(!irqs_disabled());

Before this work, sched_clock_init() was called prior to enabling
interrupts, but now after. So, we hit this WARN_ON() in
sched_clock_register().

The question is why do we need this warning in sched_clock_register? I
guess because we want to make this section of the code atomic:

195 new_epoch = read();  <- from here
196 cyc = cd.actual_read_sched_clock();
197 ns = rd.epoch_ns + cyc_to_ns((cyc - rd.epoch_cyc) &
rd.sched_clock_mask, rd.mult, rd.shift);
198 cd.actual_read_sched_clock = read;
199
200 rd.read_sched_clock = read;
201 rd.sched_clock_mask = new_mask;
202 rd.mult = new_mult;
203 rd.shift= new_shift;
204 rd.epoch_cyc= new_epoch;
205 rd.epoch_ns = ns;
206
207 update_clock_read_data(); <- to here

If we need it, we can surround the sched_clock_register() with
local_irq_disable/local_irq_enable:

diff --git a/kernel/time/sched_clock.c b/kernel/time/sched_clock.c
index cbc72c2c1fca..5015b165b55b 100644
--- a/kernel/time/sched_clock.c
+++ b/kernel/time/sched_clock.c
@@ -243,8 +243,11 @@ void __init generic_sched_clock_init(void)
 * If no sched_clock() function has been provided at that point,
 * make it the final one one.
 */
-   if (cd.actual_read_sched_clock == jiffy_sched_clock_read)
+   if (cd.actual_read_sched_clock == jiffy_sched_clock_read) {
+   local_irq_disable();
sched_clock_register(jiffy_sched_clock_read, BITS_PER_LONG, HZ);
+   local_irq_enable();
+   }

update_sched_clock();

Thank you,
Pavel


Re: [tip:x86/timers] sched/clock: Enable sched clock early

2018-07-24 Thread Guenter Roeck

On 07/24/2018 05:36 PM, Pavel Tatashin wrote:

On Tue, Jul 24, 2018 at 4:22 PM Pavel Tatashin
 wrote:


On Tue, Jul 24, 2018 at 3:54 PM Guenter Roeck  wrote:


Hi,

On Thu, Jul 19, 2018 at 03:33:21PM -0700, tip-bot for Pavel Tatashin wrote:

Commit-ID:  857baa87b6422bcfb84ed3631d6839920cb5b09d
Gitweb: https://git.kernel.org/tip/857baa87b6422bcfb84ed3631d6839920cb5b09d
Author: Pavel Tatashin 
AuthorDate: Thu, 19 Jul 2018 16:55:42 -0400
Committer:  Thomas Gleixner 
CommitDate: Fri, 20 Jul 2018 00:02:43 +0200

sched/clock: Enable sched clock early

Allow sched_clock() to be used before schec_clock_init() is called.  This
provides a way to get early boot timestamps on machines with unstable
clocks.



This patch causes a regression when running a qemu emulation with
arm:integratorcp.


Thank you for the report. I will study it.



...
Console: colour dummy device 80x30
[ cut here ]
WARNING: CPU: 0 PID: 0 at kernel/time/sched_clock.c:180
sched_clock_register+0x44/0x278
Modules linked in:
CPU: 0 PID: 0 Comm: swapper Not tainted 4.18.0-rc6-next-20180724 #1
Hardware name: ARM Integrator/CP (Device Tree)
[] (unwind_backtrace) from [] (show_stack+0x10/0x18)
[] (show_stack) from [] (dump_stack+0x18/0x24)
[] (dump_stack) from [] (__warn+0xc8/0xf0)
[] (__warn) from [] (warn_slowpath_null+0x3c/0x4c)
[] (warn_slowpath_null) from [] 
(sched_clock_register+0x44/0x278)
[] (sched_clock_register) from [] 
(generic_sched_clock_init+0x28/0x88)
[] (generic_sched_clock_init) from [] 
(sched_clock_init+0x54/0x74)
[] (sched_clock_init) from [] (start_kernel+0x310/0x3e4)
[] (start_kernel) from [<>] (  (null))
---[ end trace 08080eb81afa002c ]---
sched_clock: 32 bits at 100 Hz, resolution 1000ns, wraps every 
2147483647500ns
...

A complete boot log is available at
http://kerneltests.org/builders/qemu-arm-next/builds/979/steps/qemubuildcommand/logs/stdio

Unfortunately, reverting the patch results in conflicts, so I am unable
to confirm that it is the only culprit.

 From the context and from looking into the patch, it appears that this
can happen in any system if CONFIG_HAVE_UNSTABLE_SCHED_CLOCK is not
enabled.


Do you have a complete config, and also qemu args that were used? I
have tried defconfig arm, and run in qemu, could not reproduce the
problem.



integrator_defconfig+CONFIG_DEVTMPFS=y+CONFIG_DEVTMPFS_MOUNT=y

Qemu command line is
qemu-system-arm -M integratorcp  -m 128 \
-kernel arch/arm/boot/zImage -no-reboot \
-initrd busybox-armv4.cpio \
--append "rdinit=/sbin/init console=ttyAMA0,115200" \
-serial stdio -monitor null -nographic \
-dtb arch/arm/boot/dts/integratorcp.dtb

The scripts and files used are available from 
g...@github.com:groeck/linux-build-test.git.
qemu is version 2.12.

Guenter


Thank you,
Pavel



Bisect log is attached.

Guenter

---
# bad: [3946cd385042069ec57d3f04240def53b4eed7e5] Add linux-next specific files 
for 20180724
# good: [d72e90f33aa4709ebecc5005562f52335e106a60] Linux 4.18-rc6
git bisect start 'HEAD' 'v4.18-rc6'
# good: [f5fa891e325acf096c0f79e1d1b922002e251e5a] Merge remote-tracking branch 
'crypto/master'
git bisect good f5fa891e325acf096c0f79e1d1b922002e251e5a
# good: [cb6471f6bcfdacbeef9c23ba9dac00e67bd3c3a4] Merge remote-tracking branch 
'spi/for-next'
git bisect good cb6471f6bcfdacbeef9c23ba9dac00e67bd3c3a4
# bad: [6b5bfa57bf4553d051be65d85d021465041406d8] Merge remote-tracking branch 
'char-misc/char-misc-next'
git bisect bad 6b5bfa57bf4553d051be65d85d021465041406d8
# bad: [675a67e9ef3c041999f412cb75418d2b0def3854] Merge remote-tracking branch 
'rcu/rcu/next'
git bisect bad 675a67e9ef3c041999f412cb75418d2b0def3854
# good: [e78b01a51131f25fc2d881bc43001575c129069c] Merge branch 'perf/core'
git bisect good e78b01a51131f25fc2d881bc43001575c129069c
# good: [4e581bce514f4107ce84525f0f75f89c92b4140e] Merge branch 'x86/cpu'
git bisect good 4e581bce514f4107ce84525f0f75f89c92b4140e
# good: [20fa22e90e54e2d21cace7ba083598531670f7cf] Merge branch 'x86/pti'
git bisect good 20fa22e90e54e2d21cace7ba083598531670f7cf
# good: [4763f03d3d186ce8a1125844790152d76804ad60] x86/tsc: Use TSC as sched 
clock early
git bisect good 4763f03d3d186ce8a1125844790152d76804ad60
# good: [5f9ef44c7d1c59d0eda1d86e31d981bdffe2a725] tools/memory-model: Rename 
litmus tests to comply to norm7
git bisect good 5f9ef44c7d1c59d0eda1d86e31d981bdffe2a725
# bad: [fc3d25e1c8f6a9232530db02a1072033e22e0fe3] Merge branch 'x86/timers'
git bisect bad fc3d25e1c8f6a9232530db02a1072033e22e0fe3
# bad: [46457ea464f5341d1f9dad8dd213805d45f7f117] sched/clock: Use static key 
for sched_clock_running
git bisect bad 46457ea464f5341d1f9dad8dd213805d45f7f117
# bad: [857baa87b6422bcfb84ed3631d6839920cb5b09d] sched/clock: Enable sched 
clock early
git bisect bad 857baa87b6422bcfb84ed3631d6839920cb5b09d
# good: [5d2a4e91a541cb04d20d11602f0f9340291322ac] sched/clock: Move sched 
clock initialization and merge with generic clock
git bisect good 

Re: [tip:x86/timers] sched/clock: Enable sched clock early

2018-07-24 Thread Guenter Roeck

On 07/24/2018 05:36 PM, Pavel Tatashin wrote:

On Tue, Jul 24, 2018 at 4:22 PM Pavel Tatashin
 wrote:


On Tue, Jul 24, 2018 at 3:54 PM Guenter Roeck  wrote:


Hi,

On Thu, Jul 19, 2018 at 03:33:21PM -0700, tip-bot for Pavel Tatashin wrote:

Commit-ID:  857baa87b6422bcfb84ed3631d6839920cb5b09d
Gitweb: https://git.kernel.org/tip/857baa87b6422bcfb84ed3631d6839920cb5b09d
Author: Pavel Tatashin 
AuthorDate: Thu, 19 Jul 2018 16:55:42 -0400
Committer:  Thomas Gleixner 
CommitDate: Fri, 20 Jul 2018 00:02:43 +0200

sched/clock: Enable sched clock early

Allow sched_clock() to be used before schec_clock_init() is called.  This
provides a way to get early boot timestamps on machines with unstable
clocks.



This patch causes a regression when running a qemu emulation with
arm:integratorcp.


Thank you for the report. I will study it.



...
Console: colour dummy device 80x30
[ cut here ]
WARNING: CPU: 0 PID: 0 at kernel/time/sched_clock.c:180
sched_clock_register+0x44/0x278
Modules linked in:
CPU: 0 PID: 0 Comm: swapper Not tainted 4.18.0-rc6-next-20180724 #1
Hardware name: ARM Integrator/CP (Device Tree)
[] (unwind_backtrace) from [] (show_stack+0x10/0x18)
[] (show_stack) from [] (dump_stack+0x18/0x24)
[] (dump_stack) from [] (__warn+0xc8/0xf0)
[] (__warn) from [] (warn_slowpath_null+0x3c/0x4c)
[] (warn_slowpath_null) from [] 
(sched_clock_register+0x44/0x278)
[] (sched_clock_register) from [] 
(generic_sched_clock_init+0x28/0x88)
[] (generic_sched_clock_init) from [] 
(sched_clock_init+0x54/0x74)
[] (sched_clock_init) from [] (start_kernel+0x310/0x3e4)
[] (start_kernel) from [<>] (  (null))
---[ end trace 08080eb81afa002c ]---
sched_clock: 32 bits at 100 Hz, resolution 1000ns, wraps every 
2147483647500ns
...

A complete boot log is available at
http://kerneltests.org/builders/qemu-arm-next/builds/979/steps/qemubuildcommand/logs/stdio

Unfortunately, reverting the patch results in conflicts, so I am unable
to confirm that it is the only culprit.

 From the context and from looking into the patch, it appears that this
can happen in any system if CONFIG_HAVE_UNSTABLE_SCHED_CLOCK is not
enabled.


Do you have a complete config, and also qemu args that were used? I
have tried defconfig arm, and run in qemu, could not reproduce the
problem.



integrator_defconfig+CONFIG_DEVTMPFS=y+CONFIG_DEVTMPFS_MOUNT=y

Qemu command line is
qemu-system-arm -M integratorcp  -m 128 \
-kernel arch/arm/boot/zImage -no-reboot \
-initrd busybox-armv4.cpio \
--append "rdinit=/sbin/init console=ttyAMA0,115200" \
-serial stdio -monitor null -nographic \
-dtb arch/arm/boot/dts/integratorcp.dtb

The scripts and files used are available from 
g...@github.com:groeck/linux-build-test.git.
qemu is version 2.12.

Guenter


Thank you,
Pavel



Bisect log is attached.

Guenter

---
# bad: [3946cd385042069ec57d3f04240def53b4eed7e5] Add linux-next specific files 
for 20180724
# good: [d72e90f33aa4709ebecc5005562f52335e106a60] Linux 4.18-rc6
git bisect start 'HEAD' 'v4.18-rc6'
# good: [f5fa891e325acf096c0f79e1d1b922002e251e5a] Merge remote-tracking branch 
'crypto/master'
git bisect good f5fa891e325acf096c0f79e1d1b922002e251e5a
# good: [cb6471f6bcfdacbeef9c23ba9dac00e67bd3c3a4] Merge remote-tracking branch 
'spi/for-next'
git bisect good cb6471f6bcfdacbeef9c23ba9dac00e67bd3c3a4
# bad: [6b5bfa57bf4553d051be65d85d021465041406d8] Merge remote-tracking branch 
'char-misc/char-misc-next'
git bisect bad 6b5bfa57bf4553d051be65d85d021465041406d8
# bad: [675a67e9ef3c041999f412cb75418d2b0def3854] Merge remote-tracking branch 
'rcu/rcu/next'
git bisect bad 675a67e9ef3c041999f412cb75418d2b0def3854
# good: [e78b01a51131f25fc2d881bc43001575c129069c] Merge branch 'perf/core'
git bisect good e78b01a51131f25fc2d881bc43001575c129069c
# good: [4e581bce514f4107ce84525f0f75f89c92b4140e] Merge branch 'x86/cpu'
git bisect good 4e581bce514f4107ce84525f0f75f89c92b4140e
# good: [20fa22e90e54e2d21cace7ba083598531670f7cf] Merge branch 'x86/pti'
git bisect good 20fa22e90e54e2d21cace7ba083598531670f7cf
# good: [4763f03d3d186ce8a1125844790152d76804ad60] x86/tsc: Use TSC as sched 
clock early
git bisect good 4763f03d3d186ce8a1125844790152d76804ad60
# good: [5f9ef44c7d1c59d0eda1d86e31d981bdffe2a725] tools/memory-model: Rename 
litmus tests to comply to norm7
git bisect good 5f9ef44c7d1c59d0eda1d86e31d981bdffe2a725
# bad: [fc3d25e1c8f6a9232530db02a1072033e22e0fe3] Merge branch 'x86/timers'
git bisect bad fc3d25e1c8f6a9232530db02a1072033e22e0fe3
# bad: [46457ea464f5341d1f9dad8dd213805d45f7f117] sched/clock: Use static key 
for sched_clock_running
git bisect bad 46457ea464f5341d1f9dad8dd213805d45f7f117
# bad: [857baa87b6422bcfb84ed3631d6839920cb5b09d] sched/clock: Enable sched 
clock early
git bisect bad 857baa87b6422bcfb84ed3631d6839920cb5b09d
# good: [5d2a4e91a541cb04d20d11602f0f9340291322ac] sched/clock: Move sched 
clock initialization and merge with generic clock
git bisect good 

Re: [tip:x86/timers] sched/clock: Enable sched clock early

2018-07-24 Thread Pavel Tatashin
On Tue, Jul 24, 2018 at 4:22 PM Pavel Tatashin
 wrote:
>
> On Tue, Jul 24, 2018 at 3:54 PM Guenter Roeck  wrote:
> >
> > Hi,
> >
> > On Thu, Jul 19, 2018 at 03:33:21PM -0700, tip-bot for Pavel Tatashin wrote:
> > > Commit-ID:  857baa87b6422bcfb84ed3631d6839920cb5b09d
> > > Gitweb: 
> > > https://git.kernel.org/tip/857baa87b6422bcfb84ed3631d6839920cb5b09d
> > > Author: Pavel Tatashin 
> > > AuthorDate: Thu, 19 Jul 2018 16:55:42 -0400
> > > Committer:  Thomas Gleixner 
> > > CommitDate: Fri, 20 Jul 2018 00:02:43 +0200
> > >
> > > sched/clock: Enable sched clock early
> > >
> > > Allow sched_clock() to be used before schec_clock_init() is called.  This
> > > provides a way to get early boot timestamps on machines with unstable
> > > clocks.
> > >
> >
> > This patch causes a regression when running a qemu emulation with
> > arm:integratorcp.
>
> Thank you for the report. I will study it.
>
> >
> > ...
> > Console: colour dummy device 80x30
> > [ cut here ]
> > WARNING: CPU: 0 PID: 0 at kernel/time/sched_clock.c:180
> > sched_clock_register+0x44/0x278
> > Modules linked in:
> > CPU: 0 PID: 0 Comm: swapper Not tainted 4.18.0-rc6-next-20180724 #1
> > Hardware name: ARM Integrator/CP (Device Tree)
> > [] (unwind_backtrace) from [] (show_stack+0x10/0x18)
> > [] (show_stack) from [] (dump_stack+0x18/0x24)
> > [] (dump_stack) from [] (__warn+0xc8/0xf0)
> > [] (__warn) from [] (warn_slowpath_null+0x3c/0x4c)
> > [] (warn_slowpath_null) from [] 
> > (sched_clock_register+0x44/0x278)
> > [] (sched_clock_register) from [] 
> > (generic_sched_clock_init+0x28/0x88)
> > [] (generic_sched_clock_init) from [] 
> > (sched_clock_init+0x54/0x74)
> > [] (sched_clock_init) from [] (start_kernel+0x310/0x3e4)
> > [] (start_kernel) from [<>] (  (null))
> > ---[ end trace 08080eb81afa002c ]---
> > sched_clock: 32 bits at 100 Hz, resolution 1000ns, wraps every 
> > 2147483647500ns
> > ...
> >
> > A complete boot log is available at
> > http://kerneltests.org/builders/qemu-arm-next/builds/979/steps/qemubuildcommand/logs/stdio
> >
> > Unfortunately, reverting the patch results in conflicts, so I am unable
> > to confirm that it is the only culprit.
> >
> > From the context and from looking into the patch, it appears that this
> > can happen in any system if CONFIG_HAVE_UNSTABLE_SCHED_CLOCK is not
> > enabled.

Do you have a complete config, and also qemu args that were used? I
have tried defconfig arm, and run in qemu, could not reproduce the
problem.

Thank you,
Pavel

> >
> > Bisect log is attached.
> >
> > Guenter
> >
> > ---
> > # bad: [3946cd385042069ec57d3f04240def53b4eed7e5] Add linux-next specific 
> > files for 20180724
> > # good: [d72e90f33aa4709ebecc5005562f52335e106a60] Linux 4.18-rc6
> > git bisect start 'HEAD' 'v4.18-rc6'
> > # good: [f5fa891e325acf096c0f79e1d1b922002e251e5a] Merge remote-tracking 
> > branch 'crypto/master'
> > git bisect good f5fa891e325acf096c0f79e1d1b922002e251e5a
> > # good: [cb6471f6bcfdacbeef9c23ba9dac00e67bd3c3a4] Merge remote-tracking 
> > branch 'spi/for-next'
> > git bisect good cb6471f6bcfdacbeef9c23ba9dac00e67bd3c3a4
> > # bad: [6b5bfa57bf4553d051be65d85d021465041406d8] Merge remote-tracking 
> > branch 'char-misc/char-misc-next'
> > git bisect bad 6b5bfa57bf4553d051be65d85d021465041406d8
> > # bad: [675a67e9ef3c041999f412cb75418d2b0def3854] Merge remote-tracking 
> > branch 'rcu/rcu/next'
> > git bisect bad 675a67e9ef3c041999f412cb75418d2b0def3854
> > # good: [e78b01a51131f25fc2d881bc43001575c129069c] Merge branch 'perf/core'
> > git bisect good e78b01a51131f25fc2d881bc43001575c129069c
> > # good: [4e581bce514f4107ce84525f0f75f89c92b4140e] Merge branch 'x86/cpu'
> > git bisect good 4e581bce514f4107ce84525f0f75f89c92b4140e
> > # good: [20fa22e90e54e2d21cace7ba083598531670f7cf] Merge branch 'x86/pti'
> > git bisect good 20fa22e90e54e2d21cace7ba083598531670f7cf
> > # good: [4763f03d3d186ce8a1125844790152d76804ad60] x86/tsc: Use TSC as 
> > sched clock early
> > git bisect good 4763f03d3d186ce8a1125844790152d76804ad60
> > # good: [5f9ef44c7d1c59d0eda1d86e31d981bdffe2a725] tools/memory-model: 
> > Rename litmus tests to comply to norm7
> > git bisect good 5f9ef44c7d1c59d0eda1d86e31d981bdffe2a725
> > # bad: [fc3d25e1c8f6a9232530db02a1072033e22e0fe3] Merge branch 'x86/timers'
> > git bisect bad fc3d25e1c8f6a9232530db02a1072033e22e0fe3
> > # bad: [46457ea464f5341d1f9dad8dd213805d45f7f117] sched/clock: Use static 
> > key for sched_clock_running
> > git bisect bad 46457ea464f5341d1f9dad8dd213805d45f7f117
> > # bad: [857baa87b6422bcfb84ed3631d6839920cb5b09d] sched/clock: Enable sched 
> > clock early
> > git bisect bad 857baa87b6422bcfb84ed3631d6839920cb5b09d
> > # good: [5d2a4e91a541cb04d20d11602f0f9340291322ac] sched/clock: Move sched 
> > clock initialization and merge with generic clock
> > git bisect good 5d2a4e91a541cb04d20d11602f0f9340291322ac
> > # first bad commit: [857baa87b6422bcfb84ed3631d6839920cb5b09d] sched/clock: 
> > Enable sched clock 

Re: [tip:x86/timers] sched/clock: Enable sched clock early

2018-07-24 Thread Pavel Tatashin
On Tue, Jul 24, 2018 at 4:22 PM Pavel Tatashin
 wrote:
>
> On Tue, Jul 24, 2018 at 3:54 PM Guenter Roeck  wrote:
> >
> > Hi,
> >
> > On Thu, Jul 19, 2018 at 03:33:21PM -0700, tip-bot for Pavel Tatashin wrote:
> > > Commit-ID:  857baa87b6422bcfb84ed3631d6839920cb5b09d
> > > Gitweb: 
> > > https://git.kernel.org/tip/857baa87b6422bcfb84ed3631d6839920cb5b09d
> > > Author: Pavel Tatashin 
> > > AuthorDate: Thu, 19 Jul 2018 16:55:42 -0400
> > > Committer:  Thomas Gleixner 
> > > CommitDate: Fri, 20 Jul 2018 00:02:43 +0200
> > >
> > > sched/clock: Enable sched clock early
> > >
> > > Allow sched_clock() to be used before schec_clock_init() is called.  This
> > > provides a way to get early boot timestamps on machines with unstable
> > > clocks.
> > >
> >
> > This patch causes a regression when running a qemu emulation with
> > arm:integratorcp.
>
> Thank you for the report. I will study it.
>
> >
> > ...
> > Console: colour dummy device 80x30
> > [ cut here ]
> > WARNING: CPU: 0 PID: 0 at kernel/time/sched_clock.c:180
> > sched_clock_register+0x44/0x278
> > Modules linked in:
> > CPU: 0 PID: 0 Comm: swapper Not tainted 4.18.0-rc6-next-20180724 #1
> > Hardware name: ARM Integrator/CP (Device Tree)
> > [] (unwind_backtrace) from [] (show_stack+0x10/0x18)
> > [] (show_stack) from [] (dump_stack+0x18/0x24)
> > [] (dump_stack) from [] (__warn+0xc8/0xf0)
> > [] (__warn) from [] (warn_slowpath_null+0x3c/0x4c)
> > [] (warn_slowpath_null) from [] 
> > (sched_clock_register+0x44/0x278)
> > [] (sched_clock_register) from [] 
> > (generic_sched_clock_init+0x28/0x88)
> > [] (generic_sched_clock_init) from [] 
> > (sched_clock_init+0x54/0x74)
> > [] (sched_clock_init) from [] (start_kernel+0x310/0x3e4)
> > [] (start_kernel) from [<>] (  (null))
> > ---[ end trace 08080eb81afa002c ]---
> > sched_clock: 32 bits at 100 Hz, resolution 1000ns, wraps every 
> > 2147483647500ns
> > ...
> >
> > A complete boot log is available at
> > http://kerneltests.org/builders/qemu-arm-next/builds/979/steps/qemubuildcommand/logs/stdio
> >
> > Unfortunately, reverting the patch results in conflicts, so I am unable
> > to confirm that it is the only culprit.
> >
> > From the context and from looking into the patch, it appears that this
> > can happen in any system if CONFIG_HAVE_UNSTABLE_SCHED_CLOCK is not
> > enabled.

Do you have a complete config, and also qemu args that were used? I
have tried defconfig arm, and run in qemu, could not reproduce the
problem.

Thank you,
Pavel

> >
> > Bisect log is attached.
> >
> > Guenter
> >
> > ---
> > # bad: [3946cd385042069ec57d3f04240def53b4eed7e5] Add linux-next specific 
> > files for 20180724
> > # good: [d72e90f33aa4709ebecc5005562f52335e106a60] Linux 4.18-rc6
> > git bisect start 'HEAD' 'v4.18-rc6'
> > # good: [f5fa891e325acf096c0f79e1d1b922002e251e5a] Merge remote-tracking 
> > branch 'crypto/master'
> > git bisect good f5fa891e325acf096c0f79e1d1b922002e251e5a
> > # good: [cb6471f6bcfdacbeef9c23ba9dac00e67bd3c3a4] Merge remote-tracking 
> > branch 'spi/for-next'
> > git bisect good cb6471f6bcfdacbeef9c23ba9dac00e67bd3c3a4
> > # bad: [6b5bfa57bf4553d051be65d85d021465041406d8] Merge remote-tracking 
> > branch 'char-misc/char-misc-next'
> > git bisect bad 6b5bfa57bf4553d051be65d85d021465041406d8
> > # bad: [675a67e9ef3c041999f412cb75418d2b0def3854] Merge remote-tracking 
> > branch 'rcu/rcu/next'
> > git bisect bad 675a67e9ef3c041999f412cb75418d2b0def3854
> > # good: [e78b01a51131f25fc2d881bc43001575c129069c] Merge branch 'perf/core'
> > git bisect good e78b01a51131f25fc2d881bc43001575c129069c
> > # good: [4e581bce514f4107ce84525f0f75f89c92b4140e] Merge branch 'x86/cpu'
> > git bisect good 4e581bce514f4107ce84525f0f75f89c92b4140e
> > # good: [20fa22e90e54e2d21cace7ba083598531670f7cf] Merge branch 'x86/pti'
> > git bisect good 20fa22e90e54e2d21cace7ba083598531670f7cf
> > # good: [4763f03d3d186ce8a1125844790152d76804ad60] x86/tsc: Use TSC as 
> > sched clock early
> > git bisect good 4763f03d3d186ce8a1125844790152d76804ad60
> > # good: [5f9ef44c7d1c59d0eda1d86e31d981bdffe2a725] tools/memory-model: 
> > Rename litmus tests to comply to norm7
> > git bisect good 5f9ef44c7d1c59d0eda1d86e31d981bdffe2a725
> > # bad: [fc3d25e1c8f6a9232530db02a1072033e22e0fe3] Merge branch 'x86/timers'
> > git bisect bad fc3d25e1c8f6a9232530db02a1072033e22e0fe3
> > # bad: [46457ea464f5341d1f9dad8dd213805d45f7f117] sched/clock: Use static 
> > key for sched_clock_running
> > git bisect bad 46457ea464f5341d1f9dad8dd213805d45f7f117
> > # bad: [857baa87b6422bcfb84ed3631d6839920cb5b09d] sched/clock: Enable sched 
> > clock early
> > git bisect bad 857baa87b6422bcfb84ed3631d6839920cb5b09d
> > # good: [5d2a4e91a541cb04d20d11602f0f9340291322ac] sched/clock: Move sched 
> > clock initialization and merge with generic clock
> > git bisect good 5d2a4e91a541cb04d20d11602f0f9340291322ac
> > # first bad commit: [857baa87b6422bcfb84ed3631d6839920cb5b09d] sched/clock: 
> > Enable sched clock 

Re: [tip:x86/timers] sched/clock: Enable sched clock early

2018-07-24 Thread Pavel Tatashin
On Tue, Jul 24, 2018 at 3:54 PM Guenter Roeck  wrote:
>
> Hi,
>
> On Thu, Jul 19, 2018 at 03:33:21PM -0700, tip-bot for Pavel Tatashin wrote:
> > Commit-ID:  857baa87b6422bcfb84ed3631d6839920cb5b09d
> > Gitweb: 
> > https://git.kernel.org/tip/857baa87b6422bcfb84ed3631d6839920cb5b09d
> > Author: Pavel Tatashin 
> > AuthorDate: Thu, 19 Jul 2018 16:55:42 -0400
> > Committer:  Thomas Gleixner 
> > CommitDate: Fri, 20 Jul 2018 00:02:43 +0200
> >
> > sched/clock: Enable sched clock early
> >
> > Allow sched_clock() to be used before schec_clock_init() is called.  This
> > provides a way to get early boot timestamps on machines with unstable
> > clocks.
> >
>
> This patch causes a regression when running a qemu emulation with
> arm:integratorcp.

Thank you for the report. I will study it.

>
> ...
> Console: colour dummy device 80x30
> [ cut here ]
> WARNING: CPU: 0 PID: 0 at kernel/time/sched_clock.c:180
> sched_clock_register+0x44/0x278
> Modules linked in:
> CPU: 0 PID: 0 Comm: swapper Not tainted 4.18.0-rc6-next-20180724 #1
> Hardware name: ARM Integrator/CP (Device Tree)
> [] (unwind_backtrace) from [] (show_stack+0x10/0x18)
> [] (show_stack) from [] (dump_stack+0x18/0x24)
> [] (dump_stack) from [] (__warn+0xc8/0xf0)
> [] (__warn) from [] (warn_slowpath_null+0x3c/0x4c)
> [] (warn_slowpath_null) from [] 
> (sched_clock_register+0x44/0x278)
> [] (sched_clock_register) from [] 
> (generic_sched_clock_init+0x28/0x88)
> [] (generic_sched_clock_init) from [] 
> (sched_clock_init+0x54/0x74)
> [] (sched_clock_init) from [] (start_kernel+0x310/0x3e4)
> [] (start_kernel) from [<>] (  (null))
> ---[ end trace 08080eb81afa002c ]---
> sched_clock: 32 bits at 100 Hz, resolution 1000ns, wraps every 
> 2147483647500ns
> ...
>
> A complete boot log is available at
> http://kerneltests.org/builders/qemu-arm-next/builds/979/steps/qemubuildcommand/logs/stdio
>
> Unfortunately, reverting the patch results in conflicts, so I am unable
> to confirm that it is the only culprit.
>
> From the context and from looking into the patch, it appears that this
> can happen in any system if CONFIG_HAVE_UNSTABLE_SCHED_CLOCK is not
> enabled.
>
> Bisect log is attached.
>
> Guenter
>
> ---
> # bad: [3946cd385042069ec57d3f04240def53b4eed7e5] Add linux-next specific 
> files for 20180724
> # good: [d72e90f33aa4709ebecc5005562f52335e106a60] Linux 4.18-rc6
> git bisect start 'HEAD' 'v4.18-rc6'
> # good: [f5fa891e325acf096c0f79e1d1b922002e251e5a] Merge remote-tracking 
> branch 'crypto/master'
> git bisect good f5fa891e325acf096c0f79e1d1b922002e251e5a
> # good: [cb6471f6bcfdacbeef9c23ba9dac00e67bd3c3a4] Merge remote-tracking 
> branch 'spi/for-next'
> git bisect good cb6471f6bcfdacbeef9c23ba9dac00e67bd3c3a4
> # bad: [6b5bfa57bf4553d051be65d85d021465041406d8] Merge remote-tracking 
> branch 'char-misc/char-misc-next'
> git bisect bad 6b5bfa57bf4553d051be65d85d021465041406d8
> # bad: [675a67e9ef3c041999f412cb75418d2b0def3854] Merge remote-tracking 
> branch 'rcu/rcu/next'
> git bisect bad 675a67e9ef3c041999f412cb75418d2b0def3854
> # good: [e78b01a51131f25fc2d881bc43001575c129069c] Merge branch 'perf/core'
> git bisect good e78b01a51131f25fc2d881bc43001575c129069c
> # good: [4e581bce514f4107ce84525f0f75f89c92b4140e] Merge branch 'x86/cpu'
> git bisect good 4e581bce514f4107ce84525f0f75f89c92b4140e
> # good: [20fa22e90e54e2d21cace7ba083598531670f7cf] Merge branch 'x86/pti'
> git bisect good 20fa22e90e54e2d21cace7ba083598531670f7cf
> # good: [4763f03d3d186ce8a1125844790152d76804ad60] x86/tsc: Use TSC as sched 
> clock early
> git bisect good 4763f03d3d186ce8a1125844790152d76804ad60
> # good: [5f9ef44c7d1c59d0eda1d86e31d981bdffe2a725] tools/memory-model: Rename 
> litmus tests to comply to norm7
> git bisect good 5f9ef44c7d1c59d0eda1d86e31d981bdffe2a725
> # bad: [fc3d25e1c8f6a9232530db02a1072033e22e0fe3] Merge branch 'x86/timers'
> git bisect bad fc3d25e1c8f6a9232530db02a1072033e22e0fe3
> # bad: [46457ea464f5341d1f9dad8dd213805d45f7f117] sched/clock: Use static key 
> for sched_clock_running
> git bisect bad 46457ea464f5341d1f9dad8dd213805d45f7f117
> # bad: [857baa87b6422bcfb84ed3631d6839920cb5b09d] sched/clock: Enable sched 
> clock early
> git bisect bad 857baa87b6422bcfb84ed3631d6839920cb5b09d
> # good: [5d2a4e91a541cb04d20d11602f0f9340291322ac] sched/clock: Move sched 
> clock initialization and merge with generic clock
> git bisect good 5d2a4e91a541cb04d20d11602f0f9340291322ac
> # first bad commit: [857baa87b6422bcfb84ed3631d6839920cb5b09d] sched/clock: 
> Enable sched clock early


Re: [tip:x86/timers] sched/clock: Enable sched clock early

2018-07-24 Thread Pavel Tatashin
On Tue, Jul 24, 2018 at 3:54 PM Guenter Roeck  wrote:
>
> Hi,
>
> On Thu, Jul 19, 2018 at 03:33:21PM -0700, tip-bot for Pavel Tatashin wrote:
> > Commit-ID:  857baa87b6422bcfb84ed3631d6839920cb5b09d
> > Gitweb: 
> > https://git.kernel.org/tip/857baa87b6422bcfb84ed3631d6839920cb5b09d
> > Author: Pavel Tatashin 
> > AuthorDate: Thu, 19 Jul 2018 16:55:42 -0400
> > Committer:  Thomas Gleixner 
> > CommitDate: Fri, 20 Jul 2018 00:02:43 +0200
> >
> > sched/clock: Enable sched clock early
> >
> > Allow sched_clock() to be used before schec_clock_init() is called.  This
> > provides a way to get early boot timestamps on machines with unstable
> > clocks.
> >
>
> This patch causes a regression when running a qemu emulation with
> arm:integratorcp.

Thank you for the report. I will study it.

>
> ...
> Console: colour dummy device 80x30
> [ cut here ]
> WARNING: CPU: 0 PID: 0 at kernel/time/sched_clock.c:180
> sched_clock_register+0x44/0x278
> Modules linked in:
> CPU: 0 PID: 0 Comm: swapper Not tainted 4.18.0-rc6-next-20180724 #1
> Hardware name: ARM Integrator/CP (Device Tree)
> [] (unwind_backtrace) from [] (show_stack+0x10/0x18)
> [] (show_stack) from [] (dump_stack+0x18/0x24)
> [] (dump_stack) from [] (__warn+0xc8/0xf0)
> [] (__warn) from [] (warn_slowpath_null+0x3c/0x4c)
> [] (warn_slowpath_null) from [] 
> (sched_clock_register+0x44/0x278)
> [] (sched_clock_register) from [] 
> (generic_sched_clock_init+0x28/0x88)
> [] (generic_sched_clock_init) from [] 
> (sched_clock_init+0x54/0x74)
> [] (sched_clock_init) from [] (start_kernel+0x310/0x3e4)
> [] (start_kernel) from [<>] (  (null))
> ---[ end trace 08080eb81afa002c ]---
> sched_clock: 32 bits at 100 Hz, resolution 1000ns, wraps every 
> 2147483647500ns
> ...
>
> A complete boot log is available at
> http://kerneltests.org/builders/qemu-arm-next/builds/979/steps/qemubuildcommand/logs/stdio
>
> Unfortunately, reverting the patch results in conflicts, so I am unable
> to confirm that it is the only culprit.
>
> From the context and from looking into the patch, it appears that this
> can happen in any system if CONFIG_HAVE_UNSTABLE_SCHED_CLOCK is not
> enabled.
>
> Bisect log is attached.
>
> Guenter
>
> ---
> # bad: [3946cd385042069ec57d3f04240def53b4eed7e5] Add linux-next specific 
> files for 20180724
> # good: [d72e90f33aa4709ebecc5005562f52335e106a60] Linux 4.18-rc6
> git bisect start 'HEAD' 'v4.18-rc6'
> # good: [f5fa891e325acf096c0f79e1d1b922002e251e5a] Merge remote-tracking 
> branch 'crypto/master'
> git bisect good f5fa891e325acf096c0f79e1d1b922002e251e5a
> # good: [cb6471f6bcfdacbeef9c23ba9dac00e67bd3c3a4] Merge remote-tracking 
> branch 'spi/for-next'
> git bisect good cb6471f6bcfdacbeef9c23ba9dac00e67bd3c3a4
> # bad: [6b5bfa57bf4553d051be65d85d021465041406d8] Merge remote-tracking 
> branch 'char-misc/char-misc-next'
> git bisect bad 6b5bfa57bf4553d051be65d85d021465041406d8
> # bad: [675a67e9ef3c041999f412cb75418d2b0def3854] Merge remote-tracking 
> branch 'rcu/rcu/next'
> git bisect bad 675a67e9ef3c041999f412cb75418d2b0def3854
> # good: [e78b01a51131f25fc2d881bc43001575c129069c] Merge branch 'perf/core'
> git bisect good e78b01a51131f25fc2d881bc43001575c129069c
> # good: [4e581bce514f4107ce84525f0f75f89c92b4140e] Merge branch 'x86/cpu'
> git bisect good 4e581bce514f4107ce84525f0f75f89c92b4140e
> # good: [20fa22e90e54e2d21cace7ba083598531670f7cf] Merge branch 'x86/pti'
> git bisect good 20fa22e90e54e2d21cace7ba083598531670f7cf
> # good: [4763f03d3d186ce8a1125844790152d76804ad60] x86/tsc: Use TSC as sched 
> clock early
> git bisect good 4763f03d3d186ce8a1125844790152d76804ad60
> # good: [5f9ef44c7d1c59d0eda1d86e31d981bdffe2a725] tools/memory-model: Rename 
> litmus tests to comply to norm7
> git bisect good 5f9ef44c7d1c59d0eda1d86e31d981bdffe2a725
> # bad: [fc3d25e1c8f6a9232530db02a1072033e22e0fe3] Merge branch 'x86/timers'
> git bisect bad fc3d25e1c8f6a9232530db02a1072033e22e0fe3
> # bad: [46457ea464f5341d1f9dad8dd213805d45f7f117] sched/clock: Use static key 
> for sched_clock_running
> git bisect bad 46457ea464f5341d1f9dad8dd213805d45f7f117
> # bad: [857baa87b6422bcfb84ed3631d6839920cb5b09d] sched/clock: Enable sched 
> clock early
> git bisect bad 857baa87b6422bcfb84ed3631d6839920cb5b09d
> # good: [5d2a4e91a541cb04d20d11602f0f9340291322ac] sched/clock: Move sched 
> clock initialization and merge with generic clock
> git bisect good 5d2a4e91a541cb04d20d11602f0f9340291322ac
> # first bad commit: [857baa87b6422bcfb84ed3631d6839920cb5b09d] sched/clock: 
> Enable sched clock early


Re: [tip:x86/timers] sched/clock: Enable sched clock early

2018-07-24 Thread Guenter Roeck
Hi,

On Thu, Jul 19, 2018 at 03:33:21PM -0700, tip-bot for Pavel Tatashin wrote:
> Commit-ID:  857baa87b6422bcfb84ed3631d6839920cb5b09d
> Gitweb: 
> https://git.kernel.org/tip/857baa87b6422bcfb84ed3631d6839920cb5b09d
> Author: Pavel Tatashin 
> AuthorDate: Thu, 19 Jul 2018 16:55:42 -0400
> Committer:  Thomas Gleixner 
> CommitDate: Fri, 20 Jul 2018 00:02:43 +0200
> 
> sched/clock: Enable sched clock early
> 
> Allow sched_clock() to be used before schec_clock_init() is called.  This
> provides a way to get early boot timestamps on machines with unstable
> clocks.
> 

This patch causes a regression when running a qemu emulation with
arm:integratorcp.

...
Console: colour dummy device 80x30
[ cut here ]
WARNING: CPU: 0 PID: 0 at kernel/time/sched_clock.c:180
sched_clock_register+0x44/0x278
Modules linked in:
CPU: 0 PID: 0 Comm: swapper Not tainted 4.18.0-rc6-next-20180724 #1
Hardware name: ARM Integrator/CP (Device Tree)
[] (unwind_backtrace) from [] (show_stack+0x10/0x18)
[] (show_stack) from [] (dump_stack+0x18/0x24)
[] (dump_stack) from [] (__warn+0xc8/0xf0)
[] (__warn) from [] (warn_slowpath_null+0x3c/0x4c)
[] (warn_slowpath_null) from [] 
(sched_clock_register+0x44/0x278)
[] (sched_clock_register) from [] 
(generic_sched_clock_init+0x28/0x88)
[] (generic_sched_clock_init) from [] 
(sched_clock_init+0x54/0x74)
[] (sched_clock_init) from [] (start_kernel+0x310/0x3e4)
[] (start_kernel) from [<>] (  (null))
---[ end trace 08080eb81afa002c ]---
sched_clock: 32 bits at 100 Hz, resolution 1000ns, wraps every 
2147483647500ns
...

A complete boot log is available at
http://kerneltests.org/builders/qemu-arm-next/builds/979/steps/qemubuildcommand/logs/stdio

Unfortunately, reverting the patch results in conflicts, so I am unable
to confirm that it is the only culprit.

>From the context and from looking into the patch, it appears that this
can happen in any system if CONFIG_HAVE_UNSTABLE_SCHED_CLOCK is not
enabled.

Bisect log is attached.

Guenter

---
# bad: [3946cd385042069ec57d3f04240def53b4eed7e5] Add linux-next specific files 
for 20180724
# good: [d72e90f33aa4709ebecc5005562f52335e106a60] Linux 4.18-rc6
git bisect start 'HEAD' 'v4.18-rc6'
# good: [f5fa891e325acf096c0f79e1d1b922002e251e5a] Merge remote-tracking branch 
'crypto/master'
git bisect good f5fa891e325acf096c0f79e1d1b922002e251e5a
# good: [cb6471f6bcfdacbeef9c23ba9dac00e67bd3c3a4] Merge remote-tracking branch 
'spi/for-next'
git bisect good cb6471f6bcfdacbeef9c23ba9dac00e67bd3c3a4
# bad: [6b5bfa57bf4553d051be65d85d021465041406d8] Merge remote-tracking branch 
'char-misc/char-misc-next'
git bisect bad 6b5bfa57bf4553d051be65d85d021465041406d8
# bad: [675a67e9ef3c041999f412cb75418d2b0def3854] Merge remote-tracking branch 
'rcu/rcu/next'
git bisect bad 675a67e9ef3c041999f412cb75418d2b0def3854
# good: [e78b01a51131f25fc2d881bc43001575c129069c] Merge branch 'perf/core'
git bisect good e78b01a51131f25fc2d881bc43001575c129069c
# good: [4e581bce514f4107ce84525f0f75f89c92b4140e] Merge branch 'x86/cpu'
git bisect good 4e581bce514f4107ce84525f0f75f89c92b4140e
# good: [20fa22e90e54e2d21cace7ba083598531670f7cf] Merge branch 'x86/pti'
git bisect good 20fa22e90e54e2d21cace7ba083598531670f7cf
# good: [4763f03d3d186ce8a1125844790152d76804ad60] x86/tsc: Use TSC as sched 
clock early
git bisect good 4763f03d3d186ce8a1125844790152d76804ad60
# good: [5f9ef44c7d1c59d0eda1d86e31d981bdffe2a725] tools/memory-model: Rename 
litmus tests to comply to norm7
git bisect good 5f9ef44c7d1c59d0eda1d86e31d981bdffe2a725
# bad: [fc3d25e1c8f6a9232530db02a1072033e22e0fe3] Merge branch 'x86/timers'
git bisect bad fc3d25e1c8f6a9232530db02a1072033e22e0fe3
# bad: [46457ea464f5341d1f9dad8dd213805d45f7f117] sched/clock: Use static key 
for sched_clock_running
git bisect bad 46457ea464f5341d1f9dad8dd213805d45f7f117
# bad: [857baa87b6422bcfb84ed3631d6839920cb5b09d] sched/clock: Enable sched 
clock early
git bisect bad 857baa87b6422bcfb84ed3631d6839920cb5b09d
# good: [5d2a4e91a541cb04d20d11602f0f9340291322ac] sched/clock: Move sched 
clock initialization and merge with generic clock
git bisect good 5d2a4e91a541cb04d20d11602f0f9340291322ac
# first bad commit: [857baa87b6422bcfb84ed3631d6839920cb5b09d] sched/clock: 
Enable sched clock early


Re: [tip:x86/timers] sched/clock: Enable sched clock early

2018-07-24 Thread Guenter Roeck
Hi,

On Thu, Jul 19, 2018 at 03:33:21PM -0700, tip-bot for Pavel Tatashin wrote:
> Commit-ID:  857baa87b6422bcfb84ed3631d6839920cb5b09d
> Gitweb: 
> https://git.kernel.org/tip/857baa87b6422bcfb84ed3631d6839920cb5b09d
> Author: Pavel Tatashin 
> AuthorDate: Thu, 19 Jul 2018 16:55:42 -0400
> Committer:  Thomas Gleixner 
> CommitDate: Fri, 20 Jul 2018 00:02:43 +0200
> 
> sched/clock: Enable sched clock early
> 
> Allow sched_clock() to be used before schec_clock_init() is called.  This
> provides a way to get early boot timestamps on machines with unstable
> clocks.
> 

This patch causes a regression when running a qemu emulation with
arm:integratorcp.

...
Console: colour dummy device 80x30
[ cut here ]
WARNING: CPU: 0 PID: 0 at kernel/time/sched_clock.c:180
sched_clock_register+0x44/0x278
Modules linked in:
CPU: 0 PID: 0 Comm: swapper Not tainted 4.18.0-rc6-next-20180724 #1
Hardware name: ARM Integrator/CP (Device Tree)
[] (unwind_backtrace) from [] (show_stack+0x10/0x18)
[] (show_stack) from [] (dump_stack+0x18/0x24)
[] (dump_stack) from [] (__warn+0xc8/0xf0)
[] (__warn) from [] (warn_slowpath_null+0x3c/0x4c)
[] (warn_slowpath_null) from [] 
(sched_clock_register+0x44/0x278)
[] (sched_clock_register) from [] 
(generic_sched_clock_init+0x28/0x88)
[] (generic_sched_clock_init) from [] 
(sched_clock_init+0x54/0x74)
[] (sched_clock_init) from [] (start_kernel+0x310/0x3e4)
[] (start_kernel) from [<>] (  (null))
---[ end trace 08080eb81afa002c ]---
sched_clock: 32 bits at 100 Hz, resolution 1000ns, wraps every 
2147483647500ns
...

A complete boot log is available at
http://kerneltests.org/builders/qemu-arm-next/builds/979/steps/qemubuildcommand/logs/stdio

Unfortunately, reverting the patch results in conflicts, so I am unable
to confirm that it is the only culprit.

>From the context and from looking into the patch, it appears that this
can happen in any system if CONFIG_HAVE_UNSTABLE_SCHED_CLOCK is not
enabled.

Bisect log is attached.

Guenter

---
# bad: [3946cd385042069ec57d3f04240def53b4eed7e5] Add linux-next specific files 
for 20180724
# good: [d72e90f33aa4709ebecc5005562f52335e106a60] Linux 4.18-rc6
git bisect start 'HEAD' 'v4.18-rc6'
# good: [f5fa891e325acf096c0f79e1d1b922002e251e5a] Merge remote-tracking branch 
'crypto/master'
git bisect good f5fa891e325acf096c0f79e1d1b922002e251e5a
# good: [cb6471f6bcfdacbeef9c23ba9dac00e67bd3c3a4] Merge remote-tracking branch 
'spi/for-next'
git bisect good cb6471f6bcfdacbeef9c23ba9dac00e67bd3c3a4
# bad: [6b5bfa57bf4553d051be65d85d021465041406d8] Merge remote-tracking branch 
'char-misc/char-misc-next'
git bisect bad 6b5bfa57bf4553d051be65d85d021465041406d8
# bad: [675a67e9ef3c041999f412cb75418d2b0def3854] Merge remote-tracking branch 
'rcu/rcu/next'
git bisect bad 675a67e9ef3c041999f412cb75418d2b0def3854
# good: [e78b01a51131f25fc2d881bc43001575c129069c] Merge branch 'perf/core'
git bisect good e78b01a51131f25fc2d881bc43001575c129069c
# good: [4e581bce514f4107ce84525f0f75f89c92b4140e] Merge branch 'x86/cpu'
git bisect good 4e581bce514f4107ce84525f0f75f89c92b4140e
# good: [20fa22e90e54e2d21cace7ba083598531670f7cf] Merge branch 'x86/pti'
git bisect good 20fa22e90e54e2d21cace7ba083598531670f7cf
# good: [4763f03d3d186ce8a1125844790152d76804ad60] x86/tsc: Use TSC as sched 
clock early
git bisect good 4763f03d3d186ce8a1125844790152d76804ad60
# good: [5f9ef44c7d1c59d0eda1d86e31d981bdffe2a725] tools/memory-model: Rename 
litmus tests to comply to norm7
git bisect good 5f9ef44c7d1c59d0eda1d86e31d981bdffe2a725
# bad: [fc3d25e1c8f6a9232530db02a1072033e22e0fe3] Merge branch 'x86/timers'
git bisect bad fc3d25e1c8f6a9232530db02a1072033e22e0fe3
# bad: [46457ea464f5341d1f9dad8dd213805d45f7f117] sched/clock: Use static key 
for sched_clock_running
git bisect bad 46457ea464f5341d1f9dad8dd213805d45f7f117
# bad: [857baa87b6422bcfb84ed3631d6839920cb5b09d] sched/clock: Enable sched 
clock early
git bisect bad 857baa87b6422bcfb84ed3631d6839920cb5b09d
# good: [5d2a4e91a541cb04d20d11602f0f9340291322ac] sched/clock: Move sched 
clock initialization and merge with generic clock
git bisect good 5d2a4e91a541cb04d20d11602f0f9340291322ac
# first bad commit: [857baa87b6422bcfb84ed3631d6839920cb5b09d] sched/clock: 
Enable sched clock early


[tip:x86/timers] sched/clock: Enable sched clock early

2018-07-19 Thread tip-bot for Pavel Tatashin
Commit-ID:  857baa87b6422bcfb84ed3631d6839920cb5b09d
Gitweb: https://git.kernel.org/tip/857baa87b6422bcfb84ed3631d6839920cb5b09d
Author: Pavel Tatashin 
AuthorDate: Thu, 19 Jul 2018 16:55:42 -0400
Committer:  Thomas Gleixner 
CommitDate: Fri, 20 Jul 2018 00:02:43 +0200

sched/clock: Enable sched clock early

Allow sched_clock() to be used before schec_clock_init() is called.  This
provides a way to get early boot timestamps on machines with unstable
clocks.

Signed-off-by: Pavel Tatashin 
Signed-off-by: Thomas Gleixner 
Cc: steven.sist...@oracle.com
Cc: daniel.m.jor...@oracle.com
Cc: li...@armlinux.org.uk
Cc: schwidef...@de.ibm.com
Cc: heiko.carst...@de.ibm.com
Cc: john.stu...@linaro.org
Cc: sb...@codeaurora.org
Cc: h...@zytor.com
Cc: douly.f...@cn.fujitsu.com
Cc: pet...@infradead.org
Cc: pra...@redhat.com
Cc: feng.t...@intel.com
Cc: pmla...@suse.com
Cc: gno...@lxorguk.ukuu.org.uk
Cc: linux-s...@vger.kernel.org
Cc: boris.ostrov...@oracle.com
Cc: jgr...@suse.com
Cc: pbonz...@redhat.com
Link: 
https://lkml.kernel.org/r/20180719205545.16512-24-pasha.tatas...@oracle.com

---
 init/main.c  |  2 +-
 kernel/sched/clock.c | 20 +++-
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/init/main.c b/init/main.c
index 162d931c9511..ff0a24170b95 100644
--- a/init/main.c
+++ b/init/main.c
@@ -642,7 +642,6 @@ asmlinkage __visible void __init start_kernel(void)
softirq_init();
timekeeping_init();
time_init();
-   sched_clock_init();
printk_safe_init();
perf_event_init();
profile_init();
@@ -697,6 +696,7 @@ asmlinkage __visible void __init start_kernel(void)
acpi_early_init();
if (late_time_init)
late_time_init();
+   sched_clock_init();
calibrate_delay();
pid_idr_init();
anon_vma_init();
diff --git a/kernel/sched/clock.c b/kernel/sched/clock.c
index 0e9dbb2d9aea..422cd63f8f17 100644
--- a/kernel/sched/clock.c
+++ b/kernel/sched/clock.c
@@ -202,7 +202,25 @@ static void __sched_clock_gtod_offset(void)
 
 void __init sched_clock_init(void)
 {
+   unsigned long flags;
+
+   /*
+* Set __gtod_offset such that once we mark sched_clock_running,
+* sched_clock_tick() continues where sched_clock() left off.
+*
+* Even if TSC is buggered, we're still UP at this point so it
+* can't really be out of sync.
+*/
+   local_irq_save(flags);
+   __sched_clock_gtod_offset();
+   local_irq_restore(flags);
+
sched_clock_running = 1;
+
+   /* Now that sched_clock_running is set adjust scd */
+   local_irq_save(flags);
+   sched_clock_tick();
+   local_irq_restore(flags);
 }
 /*
  * We run this as late_initcall() such that it runs after all built-in drivers,
@@ -356,7 +374,7 @@ u64 sched_clock_cpu(int cpu)
return sched_clock() + __sched_clock_offset;
 
if (unlikely(!sched_clock_running))
-   return 0ull;
+   return sched_clock();
 
preempt_disable_notrace();
scd = cpu_sdc(cpu);


[tip:x86/timers] sched/clock: Enable sched clock early

2018-07-19 Thread tip-bot for Pavel Tatashin
Commit-ID:  857baa87b6422bcfb84ed3631d6839920cb5b09d
Gitweb: https://git.kernel.org/tip/857baa87b6422bcfb84ed3631d6839920cb5b09d
Author: Pavel Tatashin 
AuthorDate: Thu, 19 Jul 2018 16:55:42 -0400
Committer:  Thomas Gleixner 
CommitDate: Fri, 20 Jul 2018 00:02:43 +0200

sched/clock: Enable sched clock early

Allow sched_clock() to be used before schec_clock_init() is called.  This
provides a way to get early boot timestamps on machines with unstable
clocks.

Signed-off-by: Pavel Tatashin 
Signed-off-by: Thomas Gleixner 
Cc: steven.sist...@oracle.com
Cc: daniel.m.jor...@oracle.com
Cc: li...@armlinux.org.uk
Cc: schwidef...@de.ibm.com
Cc: heiko.carst...@de.ibm.com
Cc: john.stu...@linaro.org
Cc: sb...@codeaurora.org
Cc: h...@zytor.com
Cc: douly.f...@cn.fujitsu.com
Cc: pet...@infradead.org
Cc: pra...@redhat.com
Cc: feng.t...@intel.com
Cc: pmla...@suse.com
Cc: gno...@lxorguk.ukuu.org.uk
Cc: linux-s...@vger.kernel.org
Cc: boris.ostrov...@oracle.com
Cc: jgr...@suse.com
Cc: pbonz...@redhat.com
Link: 
https://lkml.kernel.org/r/20180719205545.16512-24-pasha.tatas...@oracle.com

---
 init/main.c  |  2 +-
 kernel/sched/clock.c | 20 +++-
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/init/main.c b/init/main.c
index 162d931c9511..ff0a24170b95 100644
--- a/init/main.c
+++ b/init/main.c
@@ -642,7 +642,6 @@ asmlinkage __visible void __init start_kernel(void)
softirq_init();
timekeeping_init();
time_init();
-   sched_clock_init();
printk_safe_init();
perf_event_init();
profile_init();
@@ -697,6 +696,7 @@ asmlinkage __visible void __init start_kernel(void)
acpi_early_init();
if (late_time_init)
late_time_init();
+   sched_clock_init();
calibrate_delay();
pid_idr_init();
anon_vma_init();
diff --git a/kernel/sched/clock.c b/kernel/sched/clock.c
index 0e9dbb2d9aea..422cd63f8f17 100644
--- a/kernel/sched/clock.c
+++ b/kernel/sched/clock.c
@@ -202,7 +202,25 @@ static void __sched_clock_gtod_offset(void)
 
 void __init sched_clock_init(void)
 {
+   unsigned long flags;
+
+   /*
+* Set __gtod_offset such that once we mark sched_clock_running,
+* sched_clock_tick() continues where sched_clock() left off.
+*
+* Even if TSC is buggered, we're still UP at this point so it
+* can't really be out of sync.
+*/
+   local_irq_save(flags);
+   __sched_clock_gtod_offset();
+   local_irq_restore(flags);
+
sched_clock_running = 1;
+
+   /* Now that sched_clock_running is set adjust scd */
+   local_irq_save(flags);
+   sched_clock_tick();
+   local_irq_restore(flags);
 }
 /*
  * We run this as late_initcall() such that it runs after all built-in drivers,
@@ -356,7 +374,7 @@ u64 sched_clock_cpu(int cpu)
return sched_clock() + __sched_clock_offset;
 
if (unlikely(!sched_clock_running))
-   return 0ull;
+   return sched_clock();
 
preempt_disable_notrace();
scd = cpu_sdc(cpu);