Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp924720img; Fri, 22 Mar 2019 11:31:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqx0oYEi1NEtNLCrkTU05zoFJobAU81AR9fayYEz5ISDMIYUh5o/OMXanvPIxK6qoZNvDt7e X-Received: by 2002:aa7:8251:: with SMTP id e17mr10650282pfn.96.1553279492791; Fri, 22 Mar 2019 11:31:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553279492; cv=none; d=google.com; s=arc-20160816; b=fxcoku15oZPLii8I6FEX8QtukzVII4P4K4Wdljk5HhYZBJcb2C+qTPlWs2IlhIa9X+ 8gdayxSSP+mHvB/v9xzzqZo1VX3s4qB4iszPZm4nkJ6SVbppWSk7HHcghh6ohLIgXqUX QmTpVdT40t6b8hhuJ7q1K11iHNkahCmzhL9eG04fDQ4VmT1xCZd3co0ER2sUrBCZzJ6m pI7QNngO2C9d99WnMHixX2xIc7fAE8uGUm3N2CZg0DNIBH6cfNjIdKnzNG1lvK0Vfi2C /9SBqpJzaFmbY79VhHYU0nwTHJi2wKEBWNTc9OY7BUSvK6uOjPnz+ZkiegnEgMAte8oB XEEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=QHKLfg/vBhdXYRO4deWi+CYS6pkbDYiyKauNVBCvb4U=; b=QLsRhQ/7rNkjtlsnaAey0+atS3Wh064nnh5yawyqlFBsyrEQyedWZsDuT/s9KrT9tu Z4y+y5uR+IBjOuaz2WZgUGWhfDiAd4KO5SvrYnT12tQWpcQZHM8cmf5XixTH3wuDJEZA jgZiqJn/GBjnU3nmke2nKY6/Z97JGN4ws4GwDbTJgee8G7oppPKDPvi5ocxjKlOqMALa +/z6I/TvqROmCCKp1L/Cqkpiq5t/c6zOOblOb2zbOowTFvTOhqeASx5GWUz4udHCoYy0 jf5LiWcUZECnLh6koWeJDOuAzZu+CiyuFqStYaV8uwJhS114tl6/WMd4k94W+FW332nA 3BsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=h6yky17a; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j9si7033719pgk.323.2019.03.22.11.31.17; Fri, 22 Mar 2019 11:31:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=h6yky17a; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729029AbfCVSah (ORCPT + 99 others); Fri, 22 Mar 2019 14:30:37 -0400 Received: from mail-vk1-f194.google.com ([209.85.221.194]:38060 "EHLO mail-vk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727050AbfCVSah (ORCPT ); Fri, 22 Mar 2019 14:30:37 -0400 Received: by mail-vk1-f194.google.com with SMTP id h71so684097vkf.5 for ; Fri, 22 Mar 2019 11:30:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=QHKLfg/vBhdXYRO4deWi+CYS6pkbDYiyKauNVBCvb4U=; b=h6yky17abN6hu/Ml+pfHNv0cEniO7kK55g7UrvUiKMfqE4AyQJOyWuGG9NUozW/bu9 W4pOhJXuKOrzQM3VKZK50p1WMl8XOr5lOSHykUMXkvOGsmXUpTm77dP8/Cv4pfVHSzIz E/iO947QDWzRG1rt6zXzCR9J6YuAfYFhSiyxRq13+om+VkRy8ItdTxgzV/r+cQPD167f aSVw28zEdoVmsQM8Eo8LyDAWZ7pzOwqEQGbwuvK+dFjBsobjwpi0bu7KWOleLtQqR85K S4LL8cIEdmmRrqza5E+DNSDhmGxtN0EdtACjs6Mzc9FDYgYsM0UYAjDdyDVMSf5CGNSo SloQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=QHKLfg/vBhdXYRO4deWi+CYS6pkbDYiyKauNVBCvb4U=; b=Ka7Yr+48WBGiieV8/F+owQmrePibLHEFGX63zKNp9KunBGmPS1PGj/0O2q7xkR1hZx fT8LoFv1Km1NzZNzMJLSm/Cr/P0HWMt+5xsmrLGot7j3qdz3Cp0jRM8gEN7qQY+9q35T mCFjcXySDk2l+IY2lZOnQTYFcXy8GQ4nRrP/0/oUtq9xxJqGXc6StnSqm+jCtQWMP885 2vm4OwTXCiIrqc+ObKIZCS9haAFWPV3FaBDRytJHEtq0aPhzzsDHZuCXup2eX3mpzgrw QOl3I32llGNh98NTOw/jkyDo1F1bzlIuPsr3tGzguDyJXrHQW2VbuiPfQ5JhFFkN1Qe+ k2kQ== X-Gm-Message-State: APjAAAWqy1UcGOxsjCTuJ+RFuaGD1VavxwZl8nTvmnQI4lQLJWM08S3v R2aF39+0XAbhzpuvxELe5Hs= X-Received: by 2002:a1f:2acb:: with SMTP id q194mr6691777vkq.92.1553279436098; Fri, 22 Mar 2019 11:30:36 -0700 (PDT) Received: from centos-dev.localdomain (pool-173-66-89-81.washdc.fios.verizon.net. [173.66.89.81]) by smtp.gmail.com with ESMTPSA id r185sm2768649vsr.29.2019.03.22.11.30.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Mar 2019 11:30:35 -0700 (PDT) From: thibodux@gmail.com X-Google-Original-From: ryan.thibodeaux@starlab.io To: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org Cc: boris.ostrovsky@oracle.com, oleksandr_andrushchenko@epam.com, tglx@linutronix.de, jgross@suse.com, thibodux@gmail.com, ryan.thibodeaux@starlab.io Subject: [PATCH] x86/xen: Add "xen_timer_slop" command line option Date: Fri, 22 Mar 2019 14:29:57 -0400 Message-Id: <1553279397-130201-1-git-send-email-ryan.thibodeaux@starlab.io> X-Mailer: git-send-email 1.8.3.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ryan Thibodeaux Add a new command-line option "xen_timer_slop=" 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. Signed-off-by: Ryan Thibodeaux --- Documentation/admin-guide/kernel-parameters.txt | 7 +++++++ arch/x86/xen/time.c | 18 ++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 858b6c0..fb58c84 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -5129,6 +5129,13 @@ with /sys/devices/system/xen_memory/xen_memory0/scrub_pages. Default value controlled with CONFIG_XEN_SCRUB_PAGES_DEFAULT. + xen_timer_slop= [X86-64,XEN] + Set the timer slop (in nanoseconds) for the virtual Xen + timers (default is 100000). This adjusts the minimum + delta of virtualized Xen timers, where lower values + improve timer resolution at the expense of processing + more timer interrupts. + xirc2ps_cs= [NET,PCMCIA] Format: ,,,,,[,[,[,]]] diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c index 6e29794..0393968 100644 --- a/arch/x86/xen/time.c +++ b/arch/x86/xen/time.c @@ -212,7 +212,7 @@ static int xen_timerop_set_next_event(unsigned long delta, return 0; } -static const struct clock_event_device xen_timerop_clockevent = { +static struct clock_event_device xen_timerop_clockevent __ro_after_init = { .name = "xen", .features = CLOCK_EVT_FEAT_ONESHOT, @@ -273,7 +273,7 @@ static int xen_vcpuop_set_next_event(unsigned long delta, return ret; } -static const struct clock_event_device xen_vcpuop_clockevent = { +static struct clock_event_device xen_vcpuop_clockevent __ro_after_init = { .name = "xen", .features = CLOCK_EVT_FEAT_ONESHOT, @@ -570,3 +570,17 @@ void __init xen_hvm_init_time_ops(void) x86_platform.set_wallclock = xen_set_wallclock; } #endif + +/* Kernel parameter to specify Xen timer slop */ +static int __init parse_xen_timer_slop(char *ptr) +{ + unsigned long slop = memparse(ptr, NULL); + + xen_timerop_clockevent.min_delta_ns = slop; + xen_timerop_clockevent.min_delta_ticks = slop; + xen_vcpuop_clockevent.min_delta_ns = slop; + xen_vcpuop_clockevent.min_delta_ticks = slop; + + return 0; +} +early_param("xen_timer_slop", parse_xen_timer_slop); -- 1.8.3.1