Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp1059776img; Thu, 28 Feb 2019 12:19:05 -0800 (PST) X-Google-Smtp-Source: APXvYqzBx8uo2b9e224NiCMf8KVTD8cpxDLkAPo9fIQlsvJ1NDMlonbDoH5bYk292jze8KDWSHIX X-Received: by 2002:a63:31c8:: with SMTP id x191mr875145pgx.99.1551385144981; Thu, 28 Feb 2019 12:19:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551385144; cv=none; d=google.com; s=arc-20160816; b=Ryh/OqdHmbE1RIiXxXkPccpNFAaxh4FogRpsAk4wgG80HZ+xHzOqlqxVswH+6Uzs0Z ib8YUAmUjm8ksEymJqKqsfpRBu0/sk/K47HdHomkSQylJsxmawktDGJadg4iIMFCv3Wv WpVEk7vy3rc6zluuxR0z4JFteiCkPDA3QL8hnU7wGzOLOvCTUT2CnYTZn8qeAIxcBVJR IO/kZgRIROQB3VlR+RzbN5lG5FfeD+arq2ImgM/VXbJVZhPk3I8+q28kfwLf8rMdC1MW Z7oBSNwbgCEu0px8GEOudGEaJo3uBRlILdsi8kEZeKGguBBbg9LfwnNOS7/t/v2LWUBx MRXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=XZ+wiKXiC810nm0ONy41Zg8oJPdFK3P34/JpzGm3b2w=; b=jqiguSTqkvIU3Oz1p/ROKhm1JSIeYCOMYV0l8TlWuOdNsuLyM3V7z6qHDi6K8mnOc7 OK0sBVZJpKUXWZP6Kiv6MdwMglEwEtPgTbPmaNVDA3jetbrDgW76Y+5hm1wizuJBNnH2 WBiVz8EQexQUmUjY+lodO5z/Q9krMxj8aviQWBN6bIX5T2r/LYCZ5+qtNvB7crEkwWuo IpopxZOZwShKLwM5hMBd0eESJ1aoCGGHtnbblEqIxTHdgHxF197rGLBKkE2K80AhWXzl 7ciOO/XG27rMnc3f8oIOn/ZC4uDhth70VwWj9eHh4jo7dVivGu0LkX70JAGv3RP1W+bs Cy9A== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e67si19827445pfh.212.2019.02.28.12.18.50; Thu, 28 Feb 2019 12:19:04 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388381AbfB1R7N (ORCPT + 99 others); Thu, 28 Feb 2019 12:59:13 -0500 Received: from mga14.intel.com ([192.55.52.115]:9164 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726214AbfB1R7M (ORCPT ); Thu, 28 Feb 2019 12:59:12 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Feb 2019 09:59:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,423,1544515200"; d="scan'208";a="147405226" Received: from chenyu-office.sh.intel.com ([10.239.158.163]) by fmsmga002.fm.intel.com with ESMTP; 28 Feb 2019 09:59:10 -0800 From: Chen Yu To: "Rafael J. Wysocki" , Viresh Kumar , Srinivas Pandruvada , Len Brown Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, yu.chen.surf@gmail.com, Chen Yu Subject: [PATCH 2/2][RFC v2] ACPI: Update cpuinfo.max after bootup if necessary Date: Fri, 1 Mar 2019 02:08:02 +0800 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Dell Inc. XPS13 9333, the BIOS changes the value of MSR_IA32_MISC_ENABLE_TURBO_DISABLE at runtime (e.g., when the power source changes), the maximum frequency of the CPU is not updated accordingly. This is due to the policy's cpuinfo.max is not updated when _PPC notifier fires. Fix this problem by updating the policy's cpuinfo.max when necessary. Link: https://bugzilla.kernel.org/show_bug.cgi?id=200759 Reported-and-tested-by: Gabriele Mazzotta Originally-by: Srinivas Pandruvada Signed-off-by: Chen Yu --- drivers/cpufreq/cpufreq.c | 2 ++ drivers/cpufreq/intel_pstate.c | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index e35a886e00bc..95e08816b512 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -2237,6 +2237,8 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy, policy->min = new_policy->min; policy->max = new_policy->max; + policy->cpuinfo.max_freq = new_policy->cpuinfo.max_freq; + policy->cpuinfo.min_freq = new_policy->cpuinfo.min_freq; trace_cpu_frequency_limits(policy); policy->cached_target_freq = UINT_MAX; diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index dd66decf2087..841c74f69f66 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -2081,11 +2081,17 @@ static void intel_pstate_adjust_policy_max(struct cpufreq_policy *policy, static int intel_pstate_verify_policy(struct cpufreq_policy *policy) { + int max_freq; struct cpudata *cpu = all_cpu_data[policy->cpu]; update_turbo_state(); + max_freq = intel_pstate_get_max_freq(cpu); + + if (acpi_ppc && max_freq != policy->cpuinfo.max_freq) + policy->cpuinfo.max_freq = policy->max = max_freq; + cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq, - intel_pstate_get_max_freq(cpu)); + max_freq); if (policy->policy != CPUFREQ_POLICY_POWERSAVE && policy->policy != CPUFREQ_POLICY_PERFORMANCE) @@ -2192,11 +2198,16 @@ static struct cpufreq_driver intel_pstate = { static int intel_cpufreq_verify_policy(struct cpufreq_policy *policy) { + int max_freq; struct cpudata *cpu = all_cpu_data[policy->cpu]; update_turbo_state(); + max_freq = intel_pstate_get_max_freq(cpu); + + if (acpi_ppc && max_freq != policy->cpuinfo.max_freq) + policy->cpuinfo.max_freq = policy->max = max_freq; cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq, - intel_pstate_get_max_freq(cpu)); + max_freq); intel_pstate_adjust_policy_max(policy, cpu); -- 2.17.1