Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2072338ybk; Mon, 11 May 2020 11:14:32 -0700 (PDT) X-Google-Smtp-Source: APiQypIXZ/Mukht5NZkyta4UYb9T022DL6ZMDrOtxDE0TP+xR8KOLcyiXJGAWdpYXlWG39TIe1J5 X-Received: by 2002:a17:906:b217:: with SMTP id p23mr13963865ejz.136.1589220872511; Mon, 11 May 2020 11:14:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589220872; cv=none; d=google.com; s=arc-20160816; b=JBkeQqdXjaXLE/u0uKVbq9h30+k9OMcSwOWQwJZ89zavpMV2TosBAN5bP4mZkJByey MIS/ghF6bDsXNde3BxKOBFl9cvYDIEZktldyxbXX2HdpS3UpCKSVhZa2q9fCWdMCB/eg 3ERnFebl/6rQpmCPuymkUtt9HagR+imsA6cvviFW5cBI0RwjWE2uScI0/TupOSb57Z/G uR6TtX4RYYfb7mf+saB0iGTm9Q+utS86vp+dxqeIz/dReW5YZKPIUpYphO7qobgZHbuX 67/+umTw1f9fCgdcgKos0oF+2L24baPtPEtukYa7t1RA4KPC9M5BY8YzpEYzhEZirPgd XUnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=vNK/80MEvNYAfkCrjr0NJbUEUgSAqm+8IxpoHAyKOMU=; b=y8X/L2lfJjte6DJCEIU5lddA+iYt7oIUkeUhs7DqDKZH5UroqVtLCXb1Ql0sk3B3x2 yGIJEByfQhU4iboD7CnG8dNz0o1CnF+H+pDbNdrwbFr4aNfetwizqULcf/u7NAjA9qU3 QYozm0mWuj2VQSWeiAzML+jn7F3C6xgmNmEJx8rOMPyE7Z2litsWuKwV6zhfJqlf50lO zisluuXwUNxv6BUI1EkuhIU5kJ7btA3tPBE3jsUn3kcCkNupcrnM0gnvWAGQJQ4x3bUh 7ljyEE14LG+yhlRf7xPjg7iNXmYlJ1ZF8wtPuvBwswE9f300sP8veXRhZ5z1QFNh1jzY ByPg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u13si3376728ejg.291.2020.05.11.11.14.08; Mon, 11 May 2020 11:14:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729719AbgEKSKm (ORCPT + 99 others); Mon, 11 May 2020 14:10:42 -0400 Received: from mx3.molgen.mpg.de ([141.14.17.11]:38421 "EHLO mx1.molgen.mpg.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726891AbgEKSKm (ORCPT ); Mon, 11 May 2020 14:10:42 -0400 Received: from localhost.localdomain (ip5f5af07e.dynamic.kabel-deutschland.de [95.90.240.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: pmenzel) by mx.molgen.mpg.de (Postfix) with ESMTPSA id 3091F2002EE0A; Mon, 11 May 2020 20:10:39 +0200 (CEST) From: Paul Menzel To: linux-kernel@vger.kernel.org Cc: Paul Menzel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org Subject: [PATCH] clocksource: Add `nopmtmr` to disable ACPI PM Timer at run-time Date: Mon, 11 May 2020 20:07:02 +0200 Message-Id: <20200511180702.27893-1-pmenzel@molgen.mpg.de> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Initializing the ACPI Power Management Timer takes 33 ms on the ASUS F2A85-M PRO. [ 0.248373] calling init_acpi_pm_clocksource+0x0/0x197 @ 1 [ 0.282913] clocksource: acpi_pm: mask: 0xffffff max_cycles: 0xffffff, max_idle_ns: 2085701024 ns [ 0.282916] initcall init_acpi_pm_clocksource+0x0/0x197 returned 0 after 33731 usecs Currently, it’s only possible to disable that clocksource with the Kconfig option `X86_PM_TIMER`, so add the option `nopmtmr` to disable that clocksource at run-time. [ 0.248381] calling init_acpi_pm_clocksource+0x0/0x197 @ 1 [ 0.248383] initcall init_acpi_pm_clocksource+0x0/0x197 returned -19 after 0 usecs Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: x86@kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Paul Menzel --- Please consider this a request for comments. 1. What would be the correct return value? Can ENODEV be used? 2. Should the attribute `__read_mostly` be added? --- Documentation/admin-guide/kernel-parameters.txt | 2 ++ drivers/clocksource/acpi_pm.c | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 7bc83f3d9bdf..4ea7fa94b015 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -3246,6 +3246,8 @@ nopcid [X86-64] Disable the PCID cpu feature. + nopmtmr [X86] Disable the ACPI Power Management Timer. + norandmaps Don't use address space randomization. Equivalent to echo 0 > /proc/sys/kernel/randomize_va_space diff --git a/drivers/clocksource/acpi_pm.c b/drivers/clocksource/acpi_pm.c index eb596ff9e7bb..c1249f9c9acf 100644 --- a/drivers/clocksource/acpi_pm.c +++ b/drivers/clocksource/acpi_pm.c @@ -30,6 +30,7 @@ * in arch/i386/kernel/acpi/boot.c */ u32 pmtmr_ioport __read_mostly; +static bool nopmtmr; static inline u32 read_pmtmr(void) { @@ -177,6 +178,9 @@ static int __init init_acpi_pm_clocksource(void) u64 value1, value2; unsigned int i, j = 0; + if (nopmtmr) + return -ENODEV; + if (!pmtmr_ioport) return -ENODEV; @@ -239,3 +243,14 @@ static int __init parse_pmtmr(char *arg) return 1; } __setup("pmtmr=", parse_pmtmr); + +/* + * Allow to disable PMTimer at run-time. + */ +static int __init parse_nopmtmr(char *arg) +{ + nopmtmr = true; + + return 0; +} +__setup("nopmtmr", parse_nopmtmr); -- 2.26.2