gregkh at linuxfoundation.org
2018-Nov-19 13:00 UTC
Patch "x86/hyper-v: Enable PIT shutdown quirk" has been added to the 4.19-stable tree
This is a note to let you know that I've just added the patch titled x86/hyper-v: Enable PIT shutdown quirk to the 4.19-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: x86-hyper-v-enable-pit-shutdown-quirk.patch and it can be found in the queue-4.19 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable at vger.kernel.org> know about it.>From 1de72c706488b7be664a601cf3843bd01e327e58 Mon Sep 17 00:00:00 2001From: Michael Kelley <mikelley at microsoft.com> Date: Sun, 4 Nov 2018 03:48:57 +0000 Subject: x86/hyper-v: Enable PIT shutdown quirk From: Michael Kelley <mikelley at microsoft.com> commit 1de72c706488b7be664a601cf3843bd01e327e58 upstream. Hyper-V emulation of the PIT has a quirk such that the normal PIT shutdown path doesn't work, because clearing the counter register restarts the timer. Disable the counter clearing on PIT shutdown. Signed-off-by: Michael Kelley <mikelley at microsoft.com> Signed-off-by: Thomas Gleixner <tglx at linutronix.de> Cc: "gregkh at linuxfoundation.org" <gregkh at linuxfoundation.org> Cc: "devel at linuxdriverproject.org" <devel at linuxdriverproject.org> Cc: "daniel.lezcano at linaro.org" <daniel.lezcano at linaro.org> Cc: "virtualization at lists.linux-foundation.org" <virtualization at lists.linux-foundation.org> Cc: "jgross at suse.com" <jgross at suse.com> Cc: "akataria at vmware.com" <akataria at vmware.com> Cc: "olaf at aepfle.de" <olaf at aepfle.de> Cc: "apw at canonical.com" <apw at canonical.com> Cc: vkuznets <vkuznets at redhat.com> Cc: "jasowang at redhat.com" <jasowang at redhat.com> Cc: "marcelo.cerri at canonical.com" <marcelo.cerri at canonical.com> Cc: KY Srinivasan <kys at microsoft.com> Cc: stable at vger.kernel.org Link: https://lkml.kernel.org/r/1541303219-11142-3-git-send-email-mikelley at microsoft.com Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org> --- arch/x86/kernel/cpu/mshyperv.c | 11 +++++++++++ 1 file changed, 11 insertions(+) --- a/arch/x86/kernel/cpu/mshyperv.c +++ b/arch/x86/kernel/cpu/mshyperv.c @@ -20,6 +20,7 @@ #include <linux/interrupt.h> #include <linux/irq.h> #include <linux/kexec.h> +#include <linux/i8253.h> #include <asm/processor.h> #include <asm/hypervisor.h> #include <asm/hyperv-tlfs.h> @@ -285,6 +286,16 @@ static void __init ms_hyperv_init_platfo if (efi_enabled(EFI_BOOT)) x86_platform.get_nmi_reason = hv_get_nmi_reason; + /* + * Hyper-V VMs have a PIT emulation quirk such that zeroing the + * counter register during PIT shutdown restarts the PIT. So it + * continues to interrupt @18.2 HZ. Setting i8253_clear_counter + * to false tells pit_shutdown() not to zero the counter so that + * the PIT really is shutdown. Generation 2 VMs don't have a PIT, + * and setting this value has no effect. + */ + i8253_clear_counter_on_shutdown = false; + #if IS_ENABLED(CONFIG_HYPERV) /* * Setup the hook to get control post apic initialization. Patches currently in stable-queue which might be from mikelley at microsoft.com are queue-4.19/x86-hyper-v-enable-pit-shutdown-quirk.patch queue-4.19/clockevents-drivers-i8253-add-support-for-pit-shutdown-quirk.patch
kbuild test robot
2018-Nov-19 20:44 UTC
Patch "x86/hyper-v: Enable PIT shutdown quirk" has been added to the 4.19-stable tree
Hi gregkh, I love your patch! Yet something to improve: [auto build test ERROR on tip/x86/core] [cannot apply to v4.20-rc3 next-20181119] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/gregkh-linuxfoundation-org/Patch-x86-hyper-v-Enable-PIT-shutdown-quirk-has-been-added-to-the-4-19-stable-tree/20181120-042611 config: i386-randconfig-x019-201846 (attached as .config) compiler: gcc-7 (Debian 7.3.0-1) 7.3.0 reproduce: # save the attached .config to linux build tree make ARCH=i386 All errors (new ones prefixed by >>): arch/x86/kernel/cpu/mshyperv.c: In function 'ms_hyperv_init_platform':>> arch/x86/kernel/cpu/mshyperv.c:297:2: error: 'i8253_clear_counter_on_shutdown' undeclared (first use in this function)i8253_clear_counter_on_shutdown = false; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ arch/x86/kernel/cpu/mshyperv.c:297:2: note: each undeclared identifier is reported only once for each function it appears in vim +/i8253_clear_counter_on_shutdown +297 arch/x86/kernel/cpu/mshyperv.c 275 276 #if IS_ENABLED(CONFIG_HYPERV) && defined(CONFIG_KEXEC_CORE) 277 machine_ops.shutdown = hv_machine_shutdown; 278 machine_ops.crash_shutdown = hv_machine_crash_shutdown; 279 #endif 280 mark_tsc_unstable("running on Hyper-V"); 281 282 /* 283 * Generation 2 instances don't support reading the NMI status from 284 * 0x61 port. 285 */ 286 if (efi_enabled(EFI_BOOT)) 287 x86_platform.get_nmi_reason = hv_get_nmi_reason; 288 289 /* 290 * Hyper-V VMs have a PIT emulation quirk such that zeroing the 291 * counter register during PIT shutdown restarts the PIT. So it 292 * continues to interrupt @18.2 HZ. Setting i8253_clear_counter 293 * to false tells pit_shutdown() not to zero the counter so that 294 * the PIT really is shutdown. Generation 2 VMs don't have a PIT, 295 * and setting this value has no effect. 296 */ > 297 i8253_clear_counter_on_shutdown = false; 298 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation -------------- next part -------------- A non-text attachment was scrubbed... Name: .config.gz Type: application/gzip Size: 30282 bytes Desc: not available URL: <http://lists.linuxfoundation.org/pipermail/virtualization/attachments/20181120/ef74e313/attachment-0001.bin>
kbuild test robot
2018-Nov-20 18:47 UTC
Patch "x86/hyper-v: Enable PIT shutdown quirk" has been added to the 4.19-stable tree
Hi gregkh, I love your patch! Yet something to improve: [auto build test ERROR on tip/x86/core] [cannot apply to v4.20-rc3 next-20181120] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/gregkh-linuxfoundation-org/Patch-x86-hyper-v-Enable-PIT-shutdown-quirk-has-been-added-to-the-4-19-stable-tree/20181120-042611 config: x86_64-allmodconfig (attached as .config) compiler: gcc-7 (Debian 7.3.0-1) 7.3.0 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All error/warnings (new ones prefixed by >>):>> arch/x86/kernel/cpu/mshyperv.c:297:9: error: undefined identifier 'i8253_clear_counter_on_shutdown'arch/x86/kernel/cpu/mshyperv.c:320:41: warning: symbol 'x86_hyper_ms_hyperv' was not declared. Should it be static?>> arch/x86/kernel/cpu/mshyperv.c:297:9: warning: generating address of non-lvalue (3)arch/x86/kernel/cpu/mshyperv.c: In function 'ms_hyperv_init_platform': arch/x86/kernel/cpu/mshyperv.c:297:2: error: 'i8253_clear_counter_on_shutdown' undeclared (first use in this function) i8253_clear_counter_on_shutdown = false; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ arch/x86/kernel/cpu/mshyperv.c:297:2: note: each undeclared identifier is reported only once for each function it appears in vim +/i8253_clear_counter_on_shutdown +297 arch/x86/kernel/cpu/mshyperv.c 275 276 #if IS_ENABLED(CONFIG_HYPERV) && defined(CONFIG_KEXEC_CORE) 277 machine_ops.shutdown = hv_machine_shutdown; 278 machine_ops.crash_shutdown = hv_machine_crash_shutdown; 279 #endif 280 mark_tsc_unstable("running on Hyper-V"); 281 282 /* 283 * Generation 2 instances don't support reading the NMI status from 284 * 0x61 port. 285 */ 286 if (efi_enabled(EFI_BOOT)) 287 x86_platform.get_nmi_reason = hv_get_nmi_reason; 288 289 /* 290 * Hyper-V VMs have a PIT emulation quirk such that zeroing the 291 * counter register during PIT shutdown restarts the PIT. So it 292 * continues to interrupt @18.2 HZ. Setting i8253_clear_counter 293 * to false tells pit_shutdown() not to zero the counter so that 294 * the PIT really is shutdown. Generation 2 VMs don't have a PIT, 295 * and setting this value has no effect. 296 */ > 297 i8253_clear_counter_on_shutdown = false; 298 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation -------------- next part -------------- A non-text attachment was scrubbed... Name: .config.gz Type: application/gzip Size: 65779 bytes Desc: not available URL: <http://lists.linuxfoundation.org/pipermail/virtualization/attachments/20181121/79ef8522/attachment-0001.bin>