** Description changed:

  BugLink: https://bugs.launchpad.net/bugs/1894591
  
  [Impact]
  
  The default clocksource for a KVM VM is kvm-clock, and I happen to need
  tsc.
  
  $ cat /sys/devices/system/clocksource/clocksource0/current_clocksource
  kvm-clock
  
  If I edit /etc/default/grub and append "clocksource=tsc" to
  GRUB_CMDLINE_LINUX_DEFAULT and reboot, I find the clocksource is still
  kvm-clock.
  
  $ cat /sys/devices/system/clocksource/clocksource0/current_clocksource
  kvm-clock
  
  I can work around this by telling the kernel that the tsc clocksource is
  reliable, before the watchdog has a chance to see for itself that it is
  reliable:
  
  GRUB_CMDLINE_LINUX_DEFAULT="clocksource=tsc tsc=reliable"
  
  $ cat /sys/devices/system/clocksource/clocksource0/current_clocksource
  tsc
  
  If I override the clocksource, the kernel should respect my wishes and I
  should receive the requested clocksource.
  
  [Fix]
  
  The fix landed in Linux 4.9 in the below commit:
  
  commit 36374583f9084cdab4b5dcf5521a3ce55bebb9fa
  Author: Kyle Walker <kwal...@redhat.com>
  Date:   Sat Aug 6 12:07:30 2016 -0400
  Subject: clocksource: Defer override invalidation unless clock is unstable
  Link: 
https://github.com/torvalds/linux/commit/36374583f9084cdab4b5dcf5521a3ce55bebb9fa
  
  The commit ensures the override doesn't get cleared before the watchdog
  has had an opportunity to check if the clocksource is stable or not.
  However, if the clocksource is known to be unstable at this point in
  time, it will clear the override and return to the default.
  
  This is a clean cherry-pick to the Xenial 4.4 kernel.
  
  [Testcase]
  
  Start up a KVM VM, possibly enable invtsc on the QEMU command line.
  
  The default clocksource will be kvm-clock:
  
  $ cat /sys/devices/system/clocksource/clocksource0/current_clocksource
  kvm-clock
  
  If you set the kernel command line to:
  
  GRUB_CMDLINE_LINUX_DEFAULT="clocksource=tsc"
  
  If you reboot, you will see the incorrect option of kvm-clock:
  
  $ cat /sys/devices/system/clocksource/clocksource0/current_clocksource
  kvm-clock
  
  There is a test kernel available in the below ppa, with the commit
  applied:
  
  https://launchpad.net/~mruffell/+archive/ubuntu/sf291501-test
  
  If you install the test kernel, and leave the kernel command line as:
  
  GRUB_CMDLINE_LINUX_DEFAULT="clocksource=tsc"
  
  You will get the requested clocksource:
  
  $ cat /sys/devices/system/clocksource/clocksource0/current_clocksource
  tsc
  
+ You will also get the following in dmesg:
+ 
+ $ dmesg | grep defer
+ [    1.002599] clocksource: Override clocksource tsc is not currently HRT 
compatible - deferring
+ 
  [Regression Potential]
  
  This commit changes how the kernel treats clocksource overrides. If any
  users have an override set, but the kernel is clearing the override and
  returning to the default, when they install a patched kernel, they will
  change over to their requested override, which may come as a surprise.
  
  If there is a regression, it will only affect systems who have
  clocksource overrides in place, and in the worst case, will revert the
  system to its default clocksource if the selected clocksource override
  is found to be unstable.
  
  The commit is well tested, and should not cause any regressions.

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux in Ubuntu.
https://bugs.launchpad.net/bugs/1894591

Title:
  clock: overriding the clocksource should select the requested
  clocksource

Status in linux package in Ubuntu:
  Fix Released
Status in linux source package in Xenial:
  In Progress

Bug description:
  BugLink: https://bugs.launchpad.net/bugs/1894591

  [Impact]

  The default clocksource for a KVM VM is kvm-clock, and I happen to
  need tsc.

  $ cat /sys/devices/system/clocksource/clocksource0/current_clocksource
  kvm-clock

  If I edit /etc/default/grub and append "clocksource=tsc" to
  GRUB_CMDLINE_LINUX_DEFAULT and reboot, I find the clocksource is still
  kvm-clock.

  $ cat /sys/devices/system/clocksource/clocksource0/current_clocksource
  kvm-clock

  I can work around this by telling the kernel that the tsc clocksource
  is reliable, before the watchdog has a chance to see for itself that
  it is reliable:

  GRUB_CMDLINE_LINUX_DEFAULT="clocksource=tsc tsc=reliable"

  $ cat /sys/devices/system/clocksource/clocksource0/current_clocksource
  tsc

  If I override the clocksource, the kernel should respect my wishes and
  I should receive the requested clocksource.

  [Fix]

  The fix landed in Linux 4.9 in the below commit:

  commit 36374583f9084cdab4b5dcf5521a3ce55bebb9fa
  Author: Kyle Walker <kwal...@redhat.com>
  Date:   Sat Aug 6 12:07:30 2016 -0400
  Subject: clocksource: Defer override invalidation unless clock is unstable
  Link: 
https://github.com/torvalds/linux/commit/36374583f9084cdab4b5dcf5521a3ce55bebb9fa

  The commit ensures the override doesn't get cleared before the
  watchdog has had an opportunity to check if the clocksource is stable
  or not. However, if the clocksource is known to be unstable at this
  point in time, it will clear the override and return to the default.

  This is a clean cherry-pick to the Xenial 4.4 kernel.

  [Testcase]

  Start up a KVM VM, possibly enable invtsc on the QEMU command line.

  The default clocksource will be kvm-clock:

  $ cat /sys/devices/system/clocksource/clocksource0/current_clocksource
  kvm-clock

  If you set the kernel command line to:

  GRUB_CMDLINE_LINUX_DEFAULT="clocksource=tsc"

  If you reboot, you will see the incorrect option of kvm-clock:

  $ cat /sys/devices/system/clocksource/clocksource0/current_clocksource
  kvm-clock

  There is a test kernel available in the below ppa, with the commit
  applied:

  https://launchpad.net/~mruffell/+archive/ubuntu/sf291501-test

  If you install the test kernel, and leave the kernel command line as:

  GRUB_CMDLINE_LINUX_DEFAULT="clocksource=tsc"

  You will get the requested clocksource:

  $ cat /sys/devices/system/clocksource/clocksource0/current_clocksource
  tsc

  You will also get the following in dmesg:

  $ dmesg | grep defer
  [    1.002599] clocksource: Override clocksource tsc is not currently HRT 
compatible - deferring

  [Regression Potential]

  This commit changes how the kernel treats clocksource overrides. If
  any users have an override set, but the kernel is clearing the
  override and returning to the default, when they install a patched
  kernel, they will change over to their requested override, which may
  come as a surprise.

  If there is a regression, it will only affect systems who have
  clocksource overrides in place, and in the worst case, will revert the
  system to its default clocksource if the selected clocksource override
  is found to be unstable.

  The commit is well tested, and should not cause any regressions.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1894591/+subscriptions

-- 
Mailing list: https://launchpad.net/~kernel-packages
Post to     : kernel-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kernel-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to