linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	Andy Lutomirski <luto@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Borislav Petkov <bp@alien8.de>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Waiman Long <Waiman.Long@hpe.com>,
	Waiman Long <waiman.long@hpe.com>, Ingo Molnar <mingo@kernel.org>
Subject: [PATCH 4.4 71/78] x86/vdso: Remove direct HPET access through the vDSO
Date: Thu, 22 Aug 2019 10:19:15 -0700	[thread overview]
Message-ID: <20190822171834.084939719@linuxfoundation.org> (raw)
In-Reply-To: <20190822171832.012773482@linuxfoundation.org>

From: Andy Lutomirski <luto@kernel.org>

commit 1ed95e52d902035e39a715ff3a314a893a96e5b7 upstream.

Allowing user code to map the HPET is problematic.  HPET
implementations are notoriously buggy, and there are probably many
machines on which even MMIO reads from bogus HPET addresses are
problematic.

We have a report that the Dell Precision M2800 with:

  ACPI: HPET 0x00000000C8FE6238 000038 (v01 DELL   CBX3  01072009 AMI. 00000005)

is either so slow when accessing the HPET or actually hangs in some
regard, causing soft lockups to be reported if users do unexpected
things to the HPET.

The vclock HPET code has also always been a questionable speedup.
Accessing an HPET is exceedingly slow (on the order of several
microseconds), so the added overhead in requiring a syscall to read
the HPET is a small fraction of the total code of accessing it.

To avoid future problems, let's just delete the code entirely.

In the long run, this could actually be a speedup.  Waiman Long as a
patch to optimize the case where multiple CPUs contend for the HPET,
but that won't help unless all the accesses are mediated by the
kernel.

Reported-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Borislav Petkov <bp@alien8.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Waiman Long <Waiman.Long@hpe.com>
Cc: Waiman Long <waiman.long@hpe.com>
Link: http://lkml.kernel.org/r/d2f90bba98db9905041cff294646d290d378f67a.1460074438.git.luto@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/x86/entry/vdso/vclock_gettime.c  |   15 ---------------
 arch/x86/entry/vdso/vdso-layout.lds.S |    5 ++---
 arch/x86/include/asm/clocksource.h    |    3 +--
 arch/x86/kernel/hpet.c                |    1 -
 arch/x86/kvm/trace.h                  |    3 +--
 5 files changed, 4 insertions(+), 23 deletions(-)

--- a/arch/x86/entry/vdso/vclock_gettime.c
+++ b/arch/x86/entry/vdso/vclock_gettime.c
@@ -13,7 +13,6 @@
 
 #include <uapi/linux/time.h>
 #include <asm/vgtod.h>
-#include <asm/hpet.h>
 #include <asm/vvar.h>
 #include <asm/unistd.h>
 #include <asm/msr.h>
@@ -26,16 +25,6 @@ extern int __vdso_clock_gettime(clockid_
 extern int __vdso_gettimeofday(struct timeval *tv, struct timezone *tz);
 extern time_t __vdso_time(time_t *t);
 
-#ifdef CONFIG_HPET_TIMER
-extern u8 hpet_page
-	__attribute__((visibility("hidden")));
-
-static notrace cycle_t vread_hpet(void)
-{
-	return *(const volatile u32 *)(&hpet_page + HPET_COUNTER);
-}
-#endif
-
 #ifdef CONFIG_PARAVIRT_CLOCK
 extern u8 pvclock_page
 	__attribute__((visibility("hidden")));
@@ -209,10 +198,6 @@ notrace static inline u64 vgetsns(int *m
 
 	if (gtod->vclock_mode == VCLOCK_TSC)
 		cycles = vread_tsc();
-#ifdef CONFIG_HPET_TIMER
-	else if (gtod->vclock_mode == VCLOCK_HPET)
-		cycles = vread_hpet();
-#endif
 #ifdef CONFIG_PARAVIRT_CLOCK
 	else if (gtod->vclock_mode == VCLOCK_PVCLOCK)
 		cycles = vread_pvclock(mode);
--- a/arch/x86/entry/vdso/vdso-layout.lds.S
+++ b/arch/x86/entry/vdso/vdso-layout.lds.S
@@ -25,7 +25,7 @@ SECTIONS
 	 * segment.
 	 */
 
-	vvar_start = . - 3 * PAGE_SIZE;
+	vvar_start = . - 2 * PAGE_SIZE;
 	vvar_page = vvar_start;
 
 	/* Place all vvars at the offsets in asm/vvar.h. */
@@ -35,8 +35,7 @@ SECTIONS
 #undef __VVAR_KERNEL_LDS
 #undef EMIT_VVAR
 
-	hpet_page = vvar_start + PAGE_SIZE;
-	pvclock_page = vvar_start + 2 * PAGE_SIZE;
+	pvclock_page = vvar_start + PAGE_SIZE;
 
 	. = SIZEOF_HEADERS;
 
--- a/arch/x86/include/asm/clocksource.h
+++ b/arch/x86/include/asm/clocksource.h
@@ -5,8 +5,7 @@
 
 #define VCLOCK_NONE 0  /* No vDSO clock available.	*/
 #define VCLOCK_TSC  1  /* vDSO should use vread_tsc.	*/
-#define VCLOCK_HPET 2  /* vDSO should use vread_hpet.	*/
-#define VCLOCK_PVCLOCK 3 /* vDSO should use vread_pvclock. */
+#define VCLOCK_PVCLOCK 2 /* vDSO should use vread_pvclock. */
 
 struct arch_clocksource_data {
 	int vclock_mode;
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -774,7 +774,6 @@ static struct clocksource clocksource_hp
 	.mask		= HPET_MASK,
 	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
 	.resume		= hpet_resume_counter,
-	.archdata	= { .vclock_mode = VCLOCK_HPET },
 };
 
 static int hpet_clocksource_register(void)
--- a/arch/x86/kvm/trace.h
+++ b/arch/x86/kvm/trace.h
@@ -809,8 +809,7 @@ TRACE_EVENT(kvm_write_tsc_offset,
 
 #define host_clocks					\
 	{VCLOCK_NONE, "none"},				\
-	{VCLOCK_TSC,  "tsc"},				\
-	{VCLOCK_HPET, "hpet"}				\
+	{VCLOCK_TSC,  "tsc"}				\
 
 TRACE_EVENT(kvm_update_master_clock,
 	TP_PROTO(bool use_master_clock, unsigned int host_clock, bool offset_matched),



  parent reply	other threads:[~2019-08-22 17:23 UTC|newest]

Thread overview: 91+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-22 17:18 [PATCH 4.4 00/78] 4.4.190-stable review Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 01/78] usb: iowarrior: fix deadlock on disconnect Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 02/78] sound: fix a memory leak bug Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 03/78] x86/mm: Check for pfn instead of page in vmalloc_sync_one() Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 04/78] x86/mm: Sync also unmappings in vmalloc_sync_all() Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 05/78] mm/vmalloc: Sync unmappings in __purge_vmap_area_lazy() Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 06/78] perf db-export: Fix thread__exec_comm() Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 07/78] usb: yurex: Fix use-after-free in yurex_delete Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 08/78] can: peak_usb: fix potential double kfree_skb() Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 09/78] netfilter: nfnetlink: avoid deadlock due to synchronous request_module Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 10/78] iscsi_ibft: make ISCSI_IBFT dependson ACPI instead of ISCSI_IBFT_FIND Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 11/78] mac80211: dont warn about CW params when not using them Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 12/78] hwmon: (nct6775) Fix register address and added missed tolerance for nct6106 Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 13/78] cpufreq/pasemi: fix use-after-free in pas_cpufreq_cpu_init() Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 14/78] s390/qdio: add sanity checks to the fast-requeue path Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 15/78] ALSA: compress: Fix regression on compressed capture streams Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 16/78] ALSA: compress: Prevent bypasses of set_params Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 17/78] ALSA: compress: Be more restrictive about when a drain is allowed Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 18/78] perf probe: Avoid calling freeing routine multiple times for same pointer Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 19/78] ARM: davinci: fix sleep.S build error on ARMv4 Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 20/78] scsi: megaraid_sas: fix panic on loading firmware crashdump Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 21/78] scsi: ibmvfc: fix WARN_ON during event pool release Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 22/78] tty/ldsem, locking/rwsem: Add missing ACQUIRE to read_failed sleep loop Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 23/78] perf/core: Fix creating kernel counters for PMUs that override event->cpu Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 24/78] can: peak_usb: pcan_usb_pro: Fix info-leaks to USB devices Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 25/78] can: peak_usb: pcan_usb_fd: " Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 26/78] hwmon: (nct7802) Fix wrong detection of in4 presence Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 27/78] ALSA: firewire: fix a memory leak bug Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 28/78] mac80211: dont WARN on short WMM parameters from AP Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 29/78] SMB3: Fix deadlock in validate negotiate hits reconnect Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 30/78] smb3: send CAP_DFS capability during session setup Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 31/78] mwifiex: fix 802.11n/WPA detection Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 32/78] scsi: mpt3sas: Use 63-bit DMA addressing on SAS35 HBA Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 33/78] sh: kernel: hw_breakpoint: Fix missing break in switch statement Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 34/78] usb: gadget: f_midi: fail if set_alt fails to allocate requests Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 35/78] USB: gadget: f_midi: fixing a possible double-free in f_midi Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 36/78] mm/memcontrol.c: fix use after free in mem_cgroup_iter() Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 37/78] ALSA: hda - Fix a memory leak bug Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 38/78] HID: holtek: test for sanity of intfdata Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 39/78] HID: hiddev: avoid opening a disconnected device Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 40/78] HID: hiddev: do cleanup in failure of opening a device Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 41/78] Input: kbtab - sanity check for endpoint type Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 42/78] Input: iforce - add sanity checks Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 43/78] net: usb: pegasus: fix improper read if get_registers() fail Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 44/78] xen/pciback: remove set but not used variable old_state Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 45/78] irqchip/irq-imx-gpcv2: Forward irq type to parent Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 46/78] perf header: Fix divide by zero error if f_header.attr_size==0 Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 47/78] perf header: Fix use of unitialized value warning Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 48/78] libata: zpodd: Fix small read overflow in zpodd_get_mech_type() Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 49/78] scsi: hpsa: correct scsi command status issue after reset Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 50/78] ata: libahci: do not complain in case of deferred probe Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 51/78] kbuild: modpost: handle KBUILD_EXTRA_SYMBOLS only for external modules Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 52/78] IB/core: Add mitigation for Spectre V1 Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 53/78] ocfs2: remove set but not used variable last_hash Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 54/78] asm-generic: fix -Wtype-limits compiler warnings Greg Kroah-Hartman
2019-08-22 17:18 ` [PATCH 4.4 55/78] staging: comedi: dt3000: Fix signed integer overflow divider * base Greg Kroah-Hartman
2019-08-22 17:19 ` [PATCH 4.4 56/78] staging: comedi: dt3000: Fix rounding up of timer divisor Greg Kroah-Hartman
2019-08-22 17:19 ` [PATCH 4.4 57/78] USB: core: Fix races in character device registration and deregistraion Greg Kroah-Hartman
2019-08-22 17:19 ` [PATCH 4.4 58/78] usb: cdc-acm: make sure a refcount is taken early enough Greg Kroah-Hartman
2019-08-22 17:19 ` [PATCH 4.4 59/78] USB: serial: option: add D-Link DWM-222 device ID Greg Kroah-Hartman
2019-08-22 17:19 ` [PATCH 4.4 60/78] USB: serial: option: Add support for ZTE MF871A Greg Kroah-Hartman
2019-08-22 17:19 ` [PATCH 4.4 61/78] USB: serial: option: add the BroadMobi BM818 card Greg Kroah-Hartman
2019-08-22 17:19 ` [PATCH 4.4 62/78] USB: serial: option: Add Motorola modem UARTs Greg Kroah-Hartman
2019-08-22 17:19 ` [PATCH 4.4 63/78] Backport minimal compiler_attributes.h to support GCC 9 Greg Kroah-Hartman
2019-08-22 17:19 ` [PATCH 4.4 64/78] include/linux/module.h: copy __init/__exit attrs to init/cleanup_module Greg Kroah-Hartman
2019-08-22 17:19 ` [PATCH 4.4 65/78] arm64: compat: Allow single-byte watchpoints on all addresses Greg Kroah-Hartman
2019-08-22 17:19 ` [PATCH 4.4 66/78] Input: psmouse - fix build error of multiple definition Greg Kroah-Hartman
2019-08-22 17:19 ` [PATCH 4.4 67/78] asm-generic: default BUG_ON(x) to if(x)BUG() Greg Kroah-Hartman
2019-08-22 17:19 ` [PATCH 4.4 68/78] scsi: fcoe: Embed fc_rport_priv in fcoe_rport structure Greg Kroah-Hartman
2019-08-22 17:19 ` [PATCH 4.4 69/78] RDMA: Directly cast the sockaddr union to sockaddr Greg Kroah-Hartman
2019-08-22 17:19 ` [PATCH 4.4 70/78] IB/mlx5: Make coding style more consistent Greg Kroah-Hartman
2019-08-22 17:19 ` Greg Kroah-Hartman [this message]
2019-08-22 17:19 ` [PATCH 4.4 72/78] iommu/amd: Move iommu_init_pci() to .init section Greg Kroah-Hartman
2019-08-22 17:19 ` [PATCH 4.4 73/78] x86/boot: Disable the address-of-packed-member compiler warning Greg Kroah-Hartman
2019-08-22 17:19 ` [PATCH 4.4 74/78] net/packet: fix race in tpacket_snd() Greg Kroah-Hartman
2019-08-22 17:19 ` [PATCH 4.4 75/78] xen/netback: Reset nr_frags before freeing skb Greg Kroah-Hartman
2019-08-22 17:19 ` [PATCH 4.4 76/78] net/mlx5e: Only support tx/rx pause setting for port owner Greg Kroah-Hartman
2019-08-22 17:19 ` [PATCH 4.4 77/78] sctp: fix the transport error_count check Greg Kroah-Hartman
2019-08-22 17:19 ` [PATCH 4.4 78/78] bonding: Add vlan tx offload to hw_enc_features Greg Kroah-Hartman
2019-08-22 21:17 ` [PATCH 4.4 00/78] 4.4.190-stable review kernelci.org bot
2019-08-22 22:40   ` Kevin Hilman
2019-08-23  8:31     ` Naresh Kamboju
2019-08-23 16:05       ` Kevin Hilman
2019-08-23  2:05 ` Jon Hunter
2019-08-23 17:38   ` Greg Kroah-Hartman
2019-08-23  8:26 ` Naresh Kamboju
2019-08-23 17:38   ` Greg Kroah-Hartman
2019-08-23 14:27 ` Guenter Roeck
2019-08-23 17:39   ` Greg Kroah-Hartman
2019-08-24 18:03 ` shuah
2019-08-24 18:14   ` Greg Kroah-Hartman

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=20190822171834.084939719@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=Waiman.Long@hpe.com \
    --cc=bp@alien8.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=luto@kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.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;
as well as URLs for NNTP newsgroup(s).