Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2361732imj; Mon, 11 Feb 2019 01:16:54 -0800 (PST) X-Google-Smtp-Source: AHgI3IbPJpSPBvKIdsKlcG1qtCcOFQoK5jpIAemStcdYCzh9LA7XHAl1rPEcbiadBc5UmTdQrZv9 X-Received: by 2002:a17:902:aa8c:: with SMTP id d12mr36985771plr.25.1549876613969; Mon, 11 Feb 2019 01:16:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549876613; cv=none; d=google.com; s=arc-20160816; b=guiWVy+l1OBbyJagKFfh9g9SzPpUAiZHvEz5yIIfXPStO7fsg4J3yVJWTguL4pQAcv 1c2BNGEokqquKiIPLJhHaHci6hqJcgzlVhZHQkekDfa9hKt4UpQfdRi9SDcIx613CY6e Y2kBPgZ5pq2GfrW0Qa7VB4m3k76jQFjlJ26+Z5cL2VjiRD39SIyv6aH/wxL+tIJ/PymX jVy0bPtymC7/QmU7/JRw3pao2+dhvwqpfS+hI/JxOZAYngcTaSK/4qsnIssUfEFCDWFO AkfDHmIaMhCT0dZ8lZ/d0ZS5g2CHkpk5op5EGXfICc97chZ4PXHln9t3q1RKopVFjnTp WSvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Nll5qJc4+5cFu37dVw7E6pyiUvfGyANWpL1pMp5somY=; b=yp00w30HNVkr/7fcZikEeYBRS6kKjoCOkzT7X9Yf5oUG5OyxNlyet7tQSdQ7vE7ZnS VcLcmXi4bAFNDCNZRx97QoAIdQ3+FlwvJYCuWbqE97EbaRkmNT9nsq1BINv7aUlRgCLd BzGOEYeP/jjd4RPe83h8ilW2coDMDcsRRTizMMf8KWLInqtAQGC80hpuGNYOs6mJ5+vJ JbWb6ylkhMYLZajxO5YtPjxyr0Ywc2nNfzRUWJ8ZrcLOmVZa4WMxvt6Ikoz6Dacc/8oL U86c3gEGN7RlWgYWkov9ZlCC+2bAL3HdUGp/O6/fVUqAH1lhOZqX9HcyuiP6oDZ/67sf f0ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lAPbgyNI; 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 sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 18si9046435pgb.412.2019.02.11.01.16.37; Mon, 11 Feb 2019 01:16:53 -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; dkim=pass header.i=@linaro.org header.s=google header.b=lAPbgyNI; 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 sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726699AbfBKJQc (ORCPT + 99 others); Mon, 11 Feb 2019 04:16:32 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:37005 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726015AbfBKJQc (ORCPT ); Mon, 11 Feb 2019 04:16:32 -0500 Received: by mail-pg1-f195.google.com with SMTP id q206so1016561pgq.4 for ; Mon, 11 Feb 2019 01:16:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Nll5qJc4+5cFu37dVw7E6pyiUvfGyANWpL1pMp5somY=; b=lAPbgyNI+TK5+TDQP1ePckMohKqA9ceDELHyRvoD2PJsHHLhptFqM+z/04LYw653pJ y1ZviMp3nkALyRZBNDHnlbt3d6mLlhQlD4ZhCUhijCD0eJRtgR+DSAq9+XSpcmhnc+kb yjZVtcRgc7n9bj7vBdMA+JjCLZJaQ34VTTXnMZo+gvY7Plj2ALU++SxGAstPiHDIP2eS ZE5OwGasVFEryrBfgJbDIeVIvPnUPR0gE79LuD90vsZt+Njz4yCxtMSnfHffMotY8LfO svVaib+F6RCxun4cxl8jvdNmcREl4TEzkFwF7zFmMJMfmt68tXdeJ8NI+DFQ5I1C5x8I gMaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Nll5qJc4+5cFu37dVw7E6pyiUvfGyANWpL1pMp5somY=; b=OAS/LWO2cZgQ9gOGgDLAwbdRFSa5Vu5PYRPIM+APWQWZWuudl3wctwOXBsby9kxBDv y7mFeH0Y76nep5OgPxehb+oKISD+hHz+H5x/E9bX0plzH6eYQyVCVqIVIpfim4Qvkcgo hGp3WE6/fZ/jw83/zRTXYDYPh7sFDgOdMl1WjYntwfZBgRFr9RZoD709Y7CCfOfVhGYl r5J3xNG0sPgzzgi8qioQTYWHNQudEuXqpZnuqkudETKjoE+ZMM0boMhbgZpqZRrXciMY Iy2pI2p6QrfEjF/AlcDNYiwIiKHJU9ui2YprvUsDFci7fQMG/Vg3lMdt7sMZHs98q+zl dm3w== X-Gm-Message-State: AHQUAubtwIwF8uYeVAGHxE3a3HL/5EmNX93e8JPT7Ac36+M2sBBTUwT9 INk1keAn2W6u0cHJ/ymIlEAdHQ== X-Received: by 2002:a63:4e05:: with SMTP id c5mr1155281pgb.393.1549876590763; Mon, 11 Feb 2019 01:16:30 -0800 (PST) Received: from localhost ([122.172.102.63]) by smtp.gmail.com with ESMTPSA id y72sm15198061pfa.98.2019.02.11.01.16.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Feb 2019 01:16:29 -0800 (PST) Date: Mon, 11 Feb 2019 14:46:27 +0530 From: Viresh Kumar To: Chen Yu Cc: "Rafael J. Wysocki" , Len Brown , Srinivas Pandruvada , linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH][RFC] ACPI: add "processor.broadcast_ppc" hook to broadcast _PPC to all online CPUs Message-ID: <20190211091627.homaij2rtqzrytbu@vireshk-i7> References: <20190209120232.21582-1-yu.c.chen@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190209120232.21582-1-yu.c.chen@intel.com> User-Agent: NeoMutt/20180323-120-3dd1ac Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09-02-19, 20:02, Chen Yu wrote: > 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 > and broadcast the _PPC notifier to all online CPUs. > > 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/acpi/processor_perflib.c | 16 ++++++++++++++-- > drivers/cpufreq/cpufreq.c | 2 ++ > drivers/cpufreq/intel_pstate.c | 15 ++++++++++++++- > 3 files changed, 30 insertions(+), 3 deletions(-) > > diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c > index a303fd0e108c..737dbf5aa7f7 100644 > --- a/drivers/acpi/processor_perflib.c > +++ b/drivers/acpi/processor_perflib.c > @@ -63,6 +63,10 @@ module_param(ignore_ppc, int, 0644); > MODULE_PARM_DESC(ignore_ppc, "If the frequency of your machine gets wrongly" \ > "limited by BIOS, this should help"); > > +static int broadcast_ppc; > +module_param(broadcast_ppc, int, 0644); > +MODULE_PARM_DESC(broadcast_ppc, "Broadcast the ppc to all online CPUs"); > + > #define PPC_REGISTERED 1 > #define PPC_IN_USE 2 > > @@ -180,8 +184,16 @@ void acpi_processor_ppc_has_changed(struct acpi_processor *pr, int event_flag) > else > acpi_processor_ppc_ost(pr->handle, 0); > } > - if (ret >= 0) > - cpufreq_update_policy(pr->id); > + if (ret >= 0) { > + if (broadcast_ppc) { > + int cpu; > + > + for_each_possible_cpu(cpu) > + cpufreq_update_policy(cpu); > + } else { > + cpufreq_update_policy(pr->id); > + } > + } > } > > int acpi_processor_get_bios_limit(int cpu, unsigned int *limit) > 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..e1881313c396 100644 > --- a/drivers/cpufreq/intel_pstate.c > +++ b/drivers/cpufreq/intel_pstate.c > @@ -2081,11 +2081,24 @@ 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 && policy->max == policy->cpuinfo.max_freq && > + max_freq != policy->cpuinfo.max_freq) { > + /* > + * System was not running under any constraints, but the > + * current max possible frequency is changed. So reset > + * policy limits. > + */ > + 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) By TURBO I believe this is about boost-frequencies and you should use that infrastructure to make it work, isn't it ? -- viresh