aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan Thibodeaux <ryan.thibodeaux@starlab.io>2019-03-22 14:29:57 -0400
committerBoris Ostrovsky <boris.ostrovsky@oracle.com>2019-04-23 11:06:26 -0400
commit2ec16bc0fc7ab544f2d405fd4fdd0d717c5ec0c5 (patch)
treefeb11296447e1e1c12a5cd1888d3a177d587c82c
parent085b7755808aa11f78ab9377257e1dad2e6fa4bb (diff)
x86/xen: Add "xen_timer_slop" command line option
Add a new command-line option "xen_timer_slop=<INT>" that sets the minimum delta of virtual Xen timers. This commit does not change the default timer slop value for virtual Xen timers. Lowering the timer slop value should improve the accuracy of virtual timers (e.g., better process dispatch latency), but it will likely increase the number of virtual timer interrupts (relative to the original slop setting). The original timer slop value has not changed since the introduction of the Xen-aware Linux kernel code. This commit provides users an opportunity to tune timer performance given the refinements to hardware and the Xen event channel processing. It also mirrors a feature in the Xen hypervisor - the "timer_slop" Xen command line option. [boris: updated comment describing TIMER_SLOP] Signed-off-by: Ryan Thibodeaux <ryan.thibodeaux@starlab.io> Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
-rw-r--r--Documentation/admin-guide/kernel-parameters.txt7
-rw-r--r--arch/x86/xen/time.c20
2 files changed, 24 insertions, 3 deletions
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 2b8ee90bb644..2623749ae7a3 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -5173,6 +5173,13 @@
5173 with /sys/devices/system/xen_memory/xen_memory0/scrub_pages. 5173 with /sys/devices/system/xen_memory/xen_memory0/scrub_pages.
5174 Default value controlled with CONFIG_XEN_SCRUB_PAGES_DEFAULT. 5174 Default value controlled with CONFIG_XEN_SCRUB_PAGES_DEFAULT.
5175 5175
5176 xen_timer_slop= [X86-64,XEN]
5177 Set the timer slop (in nanoseconds) for the virtual Xen
5178 timers (default is 100000). This adjusts the minimum
5179 delta of virtualized Xen timers, where lower values
5180 improve timer resolution at the expense of processing
5181 more timer interrupts.
5182
5176 xirc2ps_cs= [NET,PCMCIA] 5183 xirc2ps_cs= [NET,PCMCIA]
5177 Format: 5184 Format:
5178 <irq>,<irq_mask>,<io>,<full_duplex>,<do_sound>,<lockup_hack>[,<irq2>[,<irq3>[,<irq4>]]] 5185 <irq>,<irq_mask>,<io>,<full_duplex>,<do_sound>,<lockup_hack>[,<irq2>[,<irq3>[,<irq4>]]]
diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
index 6e29794573b7..befbdd8b17f0 100644
--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -28,7 +28,7 @@
28 28
29#include "xen-ops.h" 29#include "xen-ops.h"
30 30
31/* Xen may fire a timer up to this many ns early */ 31/* Minimum amount of time until next clock event fires */
32#define TIMER_SLOP 100000 32#define TIMER_SLOP 100000
33 33
34static u64 xen_sched_clock_offset __read_mostly; 34static u64 xen_sched_clock_offset __read_mostly;
@@ -212,7 +212,7 @@ static int xen_timerop_set_next_event(unsigned long delta,
212 return 0; 212 return 0;
213} 213}
214 214
215static const struct clock_event_device xen_timerop_clockevent = { 215static struct clock_event_device xen_timerop_clockevent __ro_after_init = {
216 .name = "xen", 216 .name = "xen",
217 .features = CLOCK_EVT_FEAT_ONESHOT, 217 .features = CLOCK_EVT_FEAT_ONESHOT,
218 218
@@ -273,7 +273,7 @@ static int xen_vcpuop_set_next_event(unsigned long delta,
273 return ret; 273 return ret;
274} 274}
275 275
276static const struct clock_event_device xen_vcpuop_clockevent = { 276static struct clock_event_device xen_vcpuop_clockevent __ro_after_init = {
277 .name = "xen", 277 .name = "xen",
278 .features = CLOCK_EVT_FEAT_ONESHOT, 278 .features = CLOCK_EVT_FEAT_ONESHOT,
279 279
@@ -570,3 +570,17 @@ void __init xen_hvm_init_time_ops(void)
570 x86_platform.set_wallclock = xen_set_wallclock; 570 x86_platform.set_wallclock = xen_set_wallclock;
571} 571}
572#endif 572#endif
573
574/* Kernel parameter to specify Xen timer slop */
575static int __init parse_xen_timer_slop(char *ptr)
576{
577 unsigned long slop = memparse(ptr, NULL);
578
579 xen_timerop_clockevent.min_delta_ns = slop;
580 xen_timerop_clockevent.min_delta_ticks = slop;
581 xen_vcpuop_clockevent.min_delta_ns = slop;
582 xen_vcpuop_clockevent.min_delta_ticks = slop;
583
584 return 0;
585}
586early_param("xen_timer_slop", parse_xen_timer_slop);