Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1017313ybv; Thu, 13 Feb 2020 14:06:05 -0800 (PST) X-Google-Smtp-Source: APXvYqzfJ9yTdRQD8rbWq5IUlgyuSKX9IA8sGDbEOvUQ841eThl7iU4i1Og4AiE8/2hvh8/PWf/l X-Received: by 2002:a9d:68c8:: with SMTP id i8mr15507713oto.34.1581631565267; Thu, 13 Feb 2020 14:06:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581631565; cv=none; d=google.com; s=arc-20160816; b=lrizOZ90tvV9mzs14RMboGjqkFto3nQgM47KbKjG3HEHfOT8DzVGQeALJRPgUQxqgb dCjuNpB27iJPUOj9jx0I7+iooCfCII2E5Rj8WGL3DHQfSFMZfGI7Xql6rF/LpHrjB6gy XGdSoedXLpz8G9zvnOORk4PENekdDs0y+jG7z4LdWTi5lUvm2M+NFSlLQCMCVE/WIzzn 8oxrSRpLF+UC6eyqvx/gBXKgXfUczfF0BF6hGPxwSeBgy+97ileKJsOfycBRuBc5HEy7 Sovju56fqeZwATQk1Pkz4SO1xrBLihP+mRctYIrkhck1JEB5z2ppFs43HSDT6RMPGbmg TIqA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=WnkStU3WC/cleCtQ2YJl2Uo7UqHSZGvFXAOvsiOWVEA=; b=YE12+xri7PnuWbvczImRTYo7AyXdTZV3IEfnusv42eeBWGnkrtkU98Mod16eRO431d rfDYLqXVlGmDtH70gi/U1ZE7eIqM9R08Ra78oig9KbIr0dbgYzllwbH1ZPehibaVMugL ck9Gm3ozJ0igiuLAjmb9SgH+/BAzYZ1k5/dCQAjhVZTeEqg3FcvBAE4UPi73SuSfx1N8 mwhoWirtn6hUmdPSosm8vNx3He7IEz/P8omGe6AhOsAZPBjxvcO1lMoFEuej3OIptS6/ sAuW5KiNq5X2PsVg7u/7NmxYKqSSOzJU1r9p78o1i64/0A2p+30aU7oZtNzWbOPaS+77 h9vQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d19si1697479ote.3.2020.02.13.14.05.53; Thu, 13 Feb 2020 14:06:05 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728473AbgBMWFI (ORCPT + 99 others); Thu, 13 Feb 2020 17:05:08 -0500 Received: from cloudserver094114.home.pl ([79.96.170.134]:54186 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728294AbgBMWFG (ORCPT ); Thu, 13 Feb 2020 17:05:06 -0500 Received: from 79.184.254.199.ipv4.supernova.orange.pl (79.184.254.199) (HELO kreacher.localnet) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.341) id 74fd50b78f1f059c; Thu, 13 Feb 2020 23:05:04 +0100 From: "Rafael J. Wysocki" To: Linux PM Cc: Len Brown , LKML , Zhang Rui , "Rafael J. Wysocki" , Chen Yu Subject: [PATCH 4/9] intel_idle: Add __initdata annotations to init time variables Date: Thu, 13 Feb 2020 23:01:00 +0100 Message-ID: <14137087.YenDkMhGj7@kreacher> In-Reply-To: <2960689.qre192dJKD@kreacher> References: <2960689.qre192dJKD@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Rafael J. Wysocki" Annotate static variables cpuidle_state_table and mwait_substates with __initdata, because they are only used during the initialization of the driver. Also notice that static variable icpu could be annotated analogously and the structure pointed to by it could be __initconst, but two of its fields are accessed via icpu in intel_idle_cpu_init() and auto_demotion_disable(), so introduce two new static variables, auto_demotion_disable_flags and disable_promotion_to_c1e, to hold the values of these fields, set them during the initialization and use them in those functions instead of accessing the source data structure via icpu. That allows icpu to be annotated with __initdata, so do that, and it will also allow some __initconst annotations to be added subsequently. No intentional functional impact. Signed-off-by: Rafael J. Wysocki --- drivers/idle/intel_idle.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c index e0332d567735..b7341e0b910a 100644 --- a/drivers/idle/intel_idle.c +++ b/drivers/idle/intel_idle.c @@ -65,7 +65,11 @@ static struct cpuidle_driver intel_idle_driver = { static int max_cstate = CPUIDLE_STATE_MAX - 1; static unsigned int disabled_states_mask; -static unsigned int mwait_substates; +static unsigned int mwait_substates __initdata; + +static unsigned long auto_demotion_disable_flags; +static bool disable_promotion_to_c1e; + static bool lapic_timer_always_reliable; struct idle_cpu { @@ -81,9 +85,9 @@ struct idle_cpu { bool use_acpi; }; -static const struct idle_cpu *icpu; +static const struct idle_cpu *icpu __initdata; static struct cpuidle_device __percpu *intel_idle_cpuidle_devices; -static struct cpuidle_state *cpuidle_state_table; +static struct cpuidle_state *cpuidle_state_table __initdata; /* * Enable this state by default even if the ACPI _CST does not list it. @@ -1519,7 +1523,7 @@ static void auto_demotion_disable(void) unsigned long long msr_bits; rdmsrl(MSR_PKG_CST_CONFIG_CONTROL, msr_bits); - msr_bits &= ~(icpu->auto_demotion_disable_flags); + msr_bits &= ~auto_demotion_disable_flags; wrmsrl(MSR_PKG_CST_CONFIG_CONTROL, msr_bits); } @@ -1549,13 +1553,10 @@ static int intel_idle_cpu_init(unsigned int cpu) return -EIO; } - if (!icpu) - return 0; - - if (icpu->auto_demotion_disable_flags) + if (auto_demotion_disable_flags) auto_demotion_disable(); - if (icpu->disable_promotion_to_c1e) + if (disable_promotion_to_c1e) c1e_promotion_disable(); return 0; @@ -1633,6 +1634,8 @@ static int __init intel_idle_init(void) icpu = (const struct idle_cpu *)id->driver_data; if (icpu) { cpuidle_state_table = icpu->state_table; + auto_demotion_disable_flags = icpu->auto_demotion_disable_flags; + disable_promotion_to_c1e = icpu->disable_promotion_to_c1e; if (icpu->use_acpi || force_use_acpi) intel_idle_acpi_cst_extract(); } else if (!intel_idle_acpi_cst_extract()) { -- 2.16.4