From patchwork Tue Jun 28 10:51:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 71066 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp1517402qgy; Tue, 28 Jun 2016 03:56:15 -0700 (PDT) X-Received: by 10.98.74.92 with SMTP id x89mr619519pfa.79.1467111375408; Tue, 28 Jun 2016 03:56:15 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r13si2468340pag.64.2016.06.28.03.56.15; Tue, 28 Jun 2016 03:56:15 -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=@linaro.org; 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 dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752817AbcF1KyT (ORCPT + 30 others); Tue, 28 Jun 2016 06:54:19 -0400 Received: from mail-wm0-f41.google.com ([74.125.82.41]:35671 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752952AbcF1KxO (ORCPT ); Tue, 28 Jun 2016 06:53:14 -0400 Received: by mail-wm0-f41.google.com with SMTP id v199so134266056wmv.0 for ; Tue, 28 Jun 2016 03:53:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=4rgu4Ut+x/FGddJlzJGUaYWxpMIx5POdnuz42uLOzp0=; b=khYQkRsYH2OjNJEuYMz+yq8bUCpz088YxTpTXbmbj0Rhld3z1NI+KO0TExyCurfEcW eNKe/RWDM5nAkRCN7joapCs26mvBcjImnCii7px12Xy6Kwn2Xhl2VCkiy6cSJmvpRJ1E zVBLQ/4M35psH6FpBgfY8Cel8RtTZdEIuVjis= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=4rgu4Ut+x/FGddJlzJGUaYWxpMIx5POdnuz42uLOzp0=; b=IdxaAyeY3wv4nh85zg0Fs72LPi0X8Ymahw7hJj+d7HNb+MaUXaeFGlafeXkiANvnVO rQhLG6e6XzyEVDo01/7d619NGRYjD26mSGogUE+HzPeVtMnX+bdsFDURakZXphu1PJkN Ks3LT8XnBLWHOFUUHX5w0Eg/NulD2zSEMae2hWZg+P9+Z0gsmoL0sMQ0MlJmLrN9yZwy h4WDlUOMvgOybUBM64y5/NFLB7Z/bDVctgXt77krnj5UeIejIY9lm5xg/ap8152YVbEA C/z/1RsXd3RLlmoxHWeIPR/aJsrp81148MHpMckVEQd/xURDyL5tp4kSZQnAvZCqVS2+ RB8Q== X-Gm-Message-State: ALyK8tLpPi9qALb3Xe1aoKXMk1Ml9JJ8dqpbK+XaBQ/n320gRDW7HtCfGFP5er+WV6Rk6J5L X-Received: by 10.28.92.66 with SMTP id q63mr16042448wmb.73.1467111179195; Tue, 28 Jun 2016 03:52:59 -0700 (PDT) Received: from localhost.localdomain (sju31-1-78-210-255-2.fbx.proxad.net. [78.210.255.2]) by smtp.gmail.com with ESMTPSA id x194sm1577615wmf.13.2016.06.28.03.52.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 28 Jun 2016 03:52:58 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, tglx@linutronix.de Cc: linux-kernel@vger.kernel.org, Will Deacon , Marc Zyngier , Mark Rutland , linux-doc@vger.kernel.org Subject: [PATCH 92/92] clocksource/drivers/arm_arch_timer: Control the evtstrm via the cmdline Date: Tue, 28 Jun 2016 12:51:50 +0200 Message-Id: <1467111111-12587-17-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1467111111-12587-1-git-send-email-daniel.lezcano@linaro.org> References: <577251A4.7030508@linaro.org> <1467111111-12587-1-git-send-email-daniel.lezcano@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Will Deacon Disabling the eventstream can be useful for both remotely debugging a deployed production system and development of code using WFE-based polling loops. Whilst this can currently be controlled via a Kconfig option (CONFIG_ARM_ARCH_TIMER_EVTSTREAM), it's often desirable to toggle the feature on the command line, so this patch adds a new command-line option ("clocksource.arm_arch_timer.evtstrm") to do just that. The default behaviour is determined based on CONFIG_ARM_ARCH_TIMER_EVTSTREAM. Cc: Marc Zyngier Cc: Mark Rutland Signed-off-by: Will Deacon Signed-off-by: Daniel Lezcano --- Documentation/kernel-parameters.txt | 8 ++++++++ drivers/clocksource/Kconfig | 12 +++++++----- drivers/clocksource/arm_arch_timer.c | 10 +++++++++- 3 files changed, 24 insertions(+), 6 deletions(-) -- 1.9.1 diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 82b42c9..2c92f1d 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt @@ -687,6 +687,14 @@ bytes respectively. Such letter suffixes can also be entirely omitted. [SPARC64] tick [X86-64] hpet,tsc + clocksource.arm_arch_timer.evtstrm= + [ARM,ARM64] + Format: + Enable/disable the eventstream feature of the ARM + architected timer so that code using WFE-based polling + loops can be debugged more effectively on production + systems. + clearcpuid=BITNUM [X86] Disable CPUID feature X for the kernel. See arch/x86/include/asm/cpufeatures.h for the valid bit diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig index 7acdf3d..5677886 100644 --- a/drivers/clocksource/Kconfig +++ b/drivers/clocksource/Kconfig @@ -288,14 +288,16 @@ config ARM_ARCH_TIMER select CLKSRC_ACPI if ACPI config ARM_ARCH_TIMER_EVTSTREAM - bool "Support for ARM architected timer event stream generation" + bool "Enable ARM architected timer event stream generation by default" default y if ARM_ARCH_TIMER depends on ARM_ARCH_TIMER help - This option enables support for event stream generation based on - the ARM architected timer. It is used for waking up CPUs executing - the wfe instruction at a frequency represented as a power-of-2 - divisor of the clock rate. + This option enables support by default for event stream generation + based on the ARM architected timer. It is used for waking up CPUs + executing the wfe instruction at a frequency represented as a + power-of-2 divisor of the clock rate. The behaviour can also be + overridden on the command line using the + clocksource.arm_arch_timer.evtstream parameter. The main use of the event stream is wfe-based timeouts of userspace locking implementations. It might also be useful for imposing timeout on wfe to safeguard against any programming errors in case an expected diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index 9e33309..5effd30 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c @@ -79,6 +79,14 @@ static enum ppi_nr arch_timer_uses_ppi = VIRT_PPI; static bool arch_timer_c3stop; static bool arch_timer_mem_use_virtual; +static bool evtstrm_enable = IS_ENABLED(CONFIG_ARM_ARCH_TIMER_EVTSTREAM); + +static int __init early_evtstrm_cfg(char *buf) +{ + return strtobool(buf, &evtstrm_enable); +} +early_param("clocksource.arm_arch_timer.evtstrm", early_evtstrm_cfg); + /* * Architected system timer support. */ @@ -372,7 +380,7 @@ static int arch_timer_setup(struct clock_event_device *clk) enable_percpu_irq(arch_timer_ppi[PHYS_NONSECURE_PPI], 0); arch_counter_set_user_access(); - if (IS_ENABLED(CONFIG_ARM_ARCH_TIMER_EVTSTREAM)) + if (evtstrm_enable) arch_timer_configure_evtstream(); return 0;