From patchwork Wed Aug 24 21:29:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Gardner X-Patchwork-Id: 662575 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 3sKL7w3Q36z9s65; Thu, 25 Aug 2016 07:30:36 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical-com.20150623.gappssmtp.com header.i=@canonical-com.20150623.gappssmtp.com header.b=zhGxZUq+; dkim-atps=neutral Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1bcfkm-0007tV-Rb; Wed, 24 Aug 2016 21:30:32 +0000 Received: from mail-it0-f43.google.com ([209.85.214.43]) by huckleberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1bcfkK-0007dj-1e for kernel-team@lists.ubuntu.com; Wed, 24 Aug 2016 21:30:04 +0000 Received: by mail-it0-f43.google.com with SMTP id n128so58325115ith.1 for ; Wed, 24 Aug 2016 14:30:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=hLs/ErtCOG57+zFfP+J1TsX0lv3JT0pVx/t+5oxlqdo=; b=zhGxZUq+5+w20qjvpBgF+MgRBTkb9+udgaZZKDR8UfW+r5jue2FST4k/MCDHzu3g+p OKTrk98nGWgl+RllA4SHsODakJWM/EK/aY45YZlp4H2EcPQnHGb85EEh50bmVAyuRN1E 5lkr0p3cLEU2+Q6J+PeuqHfMvT6xlAcR3kpnydXxuArmCb+cMBOe2AqS+9BhPKHv2yIk jmm+2aYJxH/vj/7enmDCnRLnjoOhonuZp38MKfPB9aq5O8z64uumS/Xev8jJl/Ppi8qE eurD1CKk/uRHUpZsb79GPfbosEJS4uM1M3EamCu1kqMv+tNmUUfAiSwn/aOlcfx7xt0+ VkjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=hLs/ErtCOG57+zFfP+J1TsX0lv3JT0pVx/t+5oxlqdo=; b=mzK6lZbrjsadQqTfKhIQFiJQ1DfWJIzJjwxNe295dwi9ed8F3wew/mcuC1aAzoqVf+ niXxHZacPBi8Y5vn06NY3KH0lejnS7oQvNSQ7+QjcCLkUw7kao8CGv2c7hmozCcmn1gk Neyds0PdMAjf8rG7oUAJrVlu+3L7gXH8VhPhcrzXGatU3jU2y0tDT6704YE7rQUe6oBN dB11EfRL5oW3ZyfVsklopbLFyuE9wDNxVBjxBl/IA/VcsNAhS1VezMkqm/KFlhIBmG3e c9nA8qF5uv8p5xAhPRUBTeVUMW4h1iNFZE7Gg4xKvO/b84Ms81ZozqJApUd41TWeEvpu hbRA== X-Gm-Message-State: AEkoouuVd2FH6RTTwUHmYJ005jIcrYCCpBab5ANLlt8CAtEqWB2I9ls+b8s1kfhU0RuoOKfX X-Received: by 10.107.131.170 with SMTP id n42mr6329961ioi.126.1472074202550; Wed, 24 Aug 2016 14:30:02 -0700 (PDT) Received: from gbyte.rtg.local (host-174-45-44-32.hln-mt.client.bresnan.net. [174.45.44.32]) by smtp.gmail.com with ESMTPSA id o5sm12370305ith.20.2016.08.24.14.30.01 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 24 Aug 2016 14:30:02 -0700 (PDT) From: Tim Gardner To: kernel-team@lists.ubuntu.com Subject: [PATCH 15/16] drivers/idle: make intel_idle.c driver more explicitly non-modular Date: Wed, 24 Aug 2016 15:29:45 -0600 Message-Id: <1472074186-21406-16-git-send-email-tim.gardner@canonical.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1472074186-21406-1-git-send-email-tim.gardner@canonical.com> References: <1472074186-21406-1-git-send-email-tim.gardner@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: kernel-team-bounces@lists.ubuntu.com From: Paul Gortmaker BugLink: http://bugs.launchpad.net/bugs/1591821 The Kconfig for this driver is currently declared with: config INTEL_IDLE bool "Cpuidle Driver for Intel Processors" ...meaning that it currently is not being built as a module by anyone. This was done in commit 6ce9cd8669fa1195fdc21643370e34523c7ac988 ("intel_idle: disable module support") since "...the module capability is cauing more trouble than it is worth." This was done over 5y ago, and Daniel adds that: ...the modular support has been removed from almost all the cpuidle drivers and the cpuidle framework is no longer assuming driver could be unloaded. Removing the modular dead code in the driver makes sense as this what have been done in the others drivers. So lets remove the modular code that is essentially orphaned, so that when reading the driver there is no doubt it is builtin-only. Since module_init translates to device_initcall in the non-modular case, the init ordering remains unchanged with this commit. At a later date we might want to consider whether subsys_init or another init category seems more appropriate than device_init. We replace module.h with moduleparam.h since the file does declare some module parameters, and leaving them as such is currently the easiest way to remain compatible with existing boot arg use cases. Note that MODULE_DEVICE_TABLE is a no-op for non-modular code. Also note that we can't remove intel_idle_cpuidle_devices_uninit() as that is still used for unwind purposes if the init fails. We also delete the MODULE_LICENSE tag etc. since all that information is already contained at the top of the file in the comments. Signed-off-by: Paul Gortmaker Signed-off-by: Len Brown Signed-off-by: Rafael J. Wysocki (cherry picked from commit 02c4fae9ea68fc41ebe871c635408daa2ba37d2e) Signed-off-by: Tim Gardner --- drivers/idle/intel_idle.c | 41 ++++++++--------------------------------- 1 file changed, 8 insertions(+), 33 deletions(-) diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c index b5dd41d..4c8b23d 100644 --- a/drivers/idle/intel_idle.c +++ b/drivers/idle/intel_idle.c @@ -46,8 +46,6 @@ * to avoid complications with the lapic timer workaround. * Have not seen issues with suspend, but may need same workaround here. * - * There is currently no kernel-based automatic probing/loading mechanism - * if the driver is built as a module. */ /* un-comment DEBUG to enable pr_debug() statements */ @@ -60,7 +58,7 @@ #include #include #include -#include +#include #include #include #include @@ -1055,7 +1053,6 @@ static const struct x86_cpu_id intel_idle_ids[] __initconst = { ICPU(INTEL_FAM6_ATOM_GOLDMONT, idle_cpu_bxt), {} }; -MODULE_DEVICE_TABLE(x86cpu, intel_idle_ids); /* * intel_idle_probe() @@ -1416,34 +1413,12 @@ static int __init intel_idle_init(void) return 0; } +device_initcall(intel_idle_init); -static void __exit intel_idle_exit(void) -{ - struct cpuidle_device *dev; - int i; - - cpu_notifier_register_begin(); - - if (lapic_timer_reliable_states != LAPIC_TIMER_ALWAYS_RELIABLE) - on_each_cpu(__setup_broadcast_timer, (void *)false, 1); - __unregister_cpu_notifier(&cpu_hotplug_notifier); - - for_each_possible_cpu(i) { - dev = per_cpu_ptr(intel_idle_cpuidle_devices, i); - cpuidle_unregister_device(dev); - } - - cpu_notifier_register_done(); - - cpuidle_unregister_driver(&intel_idle_driver); - free_percpu(intel_idle_cpuidle_devices); -} - -module_init(intel_idle_init); -module_exit(intel_idle_exit); - +/* + * We are not really modular, but we used to support that. Meaning we also + * support "intel_idle.max_cstate=..." at boot and also a read-only export of + * it at /sys/module/intel_idle/parameters/max_cstate -- so using module_param + * is the easiest way (currently) to continue doing that. + */ module_param(max_cstate, int, 0444); - -MODULE_AUTHOR("Len Brown "); -MODULE_DESCRIPTION("Cpuidle driver for Intel Hardware v" INTEL_IDLE_VERSION); -MODULE_LICENSE("GPL");