linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 4.19 040/158] cpupower : frequency-set -r option misses the last cpu in related cpu list
       [not found] <20190715141809.8445-1-sashal@kernel.org>
@ 2019-07-15 14:16 ` Sasha Levin
  2019-07-15 14:16 ` [PATCH AUTOSEL 4.19 065/158] x86/cpu: Add Ice Lake NNPI to Intel family Sasha Levin
  2019-07-15 14:17 ` [PATCH AUTOSEL 4.19 123/158] cpufreq: Don't skip frequency validation for has_target() drivers Sasha Levin
  2 siblings, 0 replies; 5+ messages in thread
From: Sasha Levin @ 2019-07-15 14:16 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Abhishek Goel, Thomas Renninger, Shuah Khan, Sasha Levin, linux-pm

From: Abhishek Goel <huntbag@linux.vnet.ibm.com>

[ Upstream commit 04507c0a9385cc8280f794a36bfff567c8cc1042 ]

To set frequency on specific cpus using cpupower, following syntax can
be used :
cpupower -c #i frequency-set -f #f -r

While setting frequency using cpupower frequency-set command, if we use
'-r' option, it is expected to set frequency for all cpus related to
cpu #i. But it is observed to be missing the last cpu in related cpu
list. This patch fixes the problem.

Signed-off-by: Abhishek Goel <huntbag@linux.vnet.ibm.com>
Reviewed-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 tools/power/cpupower/utils/cpufreq-set.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/power/cpupower/utils/cpufreq-set.c b/tools/power/cpupower/utils/cpufreq-set.c
index 1eef0aed6423..08a405593a79 100644
--- a/tools/power/cpupower/utils/cpufreq-set.c
+++ b/tools/power/cpupower/utils/cpufreq-set.c
@@ -306,6 +306,8 @@ int cmd_freq_set(int argc, char **argv)
 				bitmask_setbit(cpus_chosen, cpus->cpu);
 				cpus = cpus->next;
 			}
+			/* Set the last cpu in related cpus list */
+			bitmask_setbit(cpus_chosen, cpus->cpu);
 			cpufreq_put_related_cpus(cpus);
 		}
 	}
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH AUTOSEL 4.19 065/158] x86/cpu: Add Ice Lake NNPI to Intel family
       [not found] <20190715141809.8445-1-sashal@kernel.org>
  2019-07-15 14:16 ` [PATCH AUTOSEL 4.19 040/158] cpupower : frequency-set -r option misses the last cpu in related cpu list Sasha Levin
@ 2019-07-15 14:16 ` Sasha Levin
  2019-07-15 14:17 ` [PATCH AUTOSEL 4.19 123/158] cpufreq: Don't skip frequency validation for has_target() drivers Sasha Levin
  2 siblings, 0 replies; 5+ messages in thread
From: Sasha Levin @ 2019-07-15 14:16 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Rajneesh Bhardwaj, Thomas Gleixner, bp, Borislav Petkov,
	Dave Hansen, Andy Shevchenko, H. Peter Anvin, Kan Liang,
	Peter Zijlstra, platform-driver-x86, Qiuxu Zhuo,
	Srinivas Pandruvada, Len Brown, Linux PM, Sasha Levin

From: Rajneesh Bhardwaj <rajneesh.bhardwaj@linux.intel.com>

[ Upstream commit e32d045cd4ba06b59878323e434bad010e78e658 ]

Add the CPUID model number of Ice Lake Neural Network Processor for Deep
Learning Inference (ICL-NNPI) to the Intel family list. Ice Lake NNPI uses
model number 0x9D and this will be documented in a future version of Intel
Software Development Manual.

Signed-off-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@linux.intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: bp@suse.de
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: platform-driver-x86@vger.kernel.org
Cc: Qiuxu Zhuo <qiuxu.zhuo@intel.com>
Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: Len Brown <lenb@kernel.org>
Cc: Linux PM <linux-pm@vger.kernel.org>
Link: https://lkml.kernel.org/r/20190606012419.13250-1-rajneesh.bhardwaj@linux.intel.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/x86/include/asm/intel-family.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/include/asm/intel-family.h b/arch/x86/include/asm/intel-family.h
index 2e38fb82b91d..aebedbaf5260 100644
--- a/arch/x86/include/asm/intel-family.h
+++ b/arch/x86/include/asm/intel-family.h
@@ -56,6 +56,7 @@
 #define INTEL_FAM6_ICELAKE_XEON_D	0x6C
 #define INTEL_FAM6_ICELAKE_DESKTOP	0x7D
 #define INTEL_FAM6_ICELAKE_MOBILE	0x7E
+#define INTEL_FAM6_ICELAKE_NNPI		0x9D
 
 /* "Small Core" Processors (Atom) */
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH AUTOSEL 4.19 123/158] cpufreq: Don't skip frequency validation for has_target() drivers
       [not found] <20190715141809.8445-1-sashal@kernel.org>
  2019-07-15 14:16 ` [PATCH AUTOSEL 4.19 040/158] cpupower : frequency-set -r option misses the last cpu in related cpu list Sasha Levin
  2019-07-15 14:16 ` [PATCH AUTOSEL 4.19 065/158] x86/cpu: Add Ice Lake NNPI to Intel family Sasha Levin
@ 2019-07-15 14:17 ` Sasha Levin
  2019-07-16  9:21   ` Rafael J. Wysocki
  2 siblings, 1 reply; 5+ messages in thread
From: Sasha Levin @ 2019-07-15 14:17 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Viresh Kumar, Rafael J . Wysocki, Sasha Levin, linux-pm

From: Viresh Kumar <viresh.kumar@linaro.org>

[ Upstream commit 9801522840cc1073f8064b4c979b7b6995c74bca ]

CPUFREQ_CONST_LOOPS was introduced in a very old commit from pre-2.6
kernel release by commit 6a4a93f9c0d5 ("[CPUFREQ] Fix 'out of sync'
issue").

Basically, that commit does two things:

 - It adds the frequency verification code (which is quite similar to
   what we have today as well).

 - And it sets the CPUFREQ_CONST_LOOPS flag only for setpolicy drivers,
   rightly so based on the code we had then. The idea was to avoid
   frequency validation for setpolicy drivers as the cpufreq core doesn't
   know what frequency the hardware is running at and so no point in
   doing frequency verification.

The problem happened when we started to use the same CPUFREQ_CONST_LOOPS
flag for constant loops-per-jiffy thing as well and many has_target()
drivers started using the same flag and unknowingly skipped the
verification of frequency. There is no logical reason behind skipping
frequency validation because of the presence of CPUFREQ_CONST_LOOPS
flag otherwise.

Fix this issue by skipping frequency validation only for setpolicy
drivers and always doing it for has_target() drivers irrespective of
the presence or absence of CPUFREQ_CONST_LOOPS flag.

cpufreq_notify_transition() is only called for has_target() type driver
and not for set_policy type, and the check is simply redundant. Remove
it as well.

Also remove () around freq comparison statement as they aren't required
and checkpatch also warns for them.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/cpufreq/cpufreq.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index d3213594d1a7..80942ec34efd 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -321,12 +321,10 @@ static void cpufreq_notify_transition(struct cpufreq_policy *policy,
 		 * which is not equal to what the cpufreq core thinks is
 		 * "old frequency".
 		 */
-		if (!(cpufreq_driver->flags & CPUFREQ_CONST_LOOPS)) {
-			if (policy->cur && (policy->cur != freqs->old)) {
-				pr_debug("Warning: CPU frequency is %u, cpufreq assumed %u kHz\n",
-					 freqs->old, policy->cur);
-				freqs->old = policy->cur;
-			}
+		if (policy->cur && policy->cur != freqs->old) {
+			pr_debug("Warning: CPU frequency is %u, cpufreq assumed %u kHz\n",
+				 freqs->old, policy->cur);
+			freqs->old = policy->cur;
 		}
 
 		for_each_cpu(freqs->cpu, policy->cpus) {
@@ -1543,8 +1541,7 @@ static unsigned int __cpufreq_get(struct cpufreq_policy *policy)
 	if (policy->fast_switch_enabled)
 		return ret_freq;
 
-	if (ret_freq && policy->cur &&
-		!(cpufreq_driver->flags & CPUFREQ_CONST_LOOPS)) {
+	if (has_target() && ret_freq && policy->cur) {
 		/* verify no discrepancy between actual and
 					saved value exists */
 		if (unlikely(ret_freq != policy->cur)) {
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH AUTOSEL 4.19 123/158] cpufreq: Don't skip frequency validation for has_target() drivers
  2019-07-15 14:17 ` [PATCH AUTOSEL 4.19 123/158] cpufreq: Don't skip frequency validation for has_target() drivers Sasha Levin
@ 2019-07-16  9:21   ` Rafael J. Wysocki
  2019-07-22  0:40     ` Sasha Levin
  0 siblings, 1 reply; 5+ messages in thread
From: Rafael J. Wysocki @ 2019-07-16  9:21 UTC (permalink / raw)
  To: Sasha Levin, linux-kernel, stable; +Cc: Viresh Kumar, linux-pm

On 7/15/2019 4:17 PM, Sasha Levin wrote:
> From: Viresh Kumar <viresh.kumar@linaro.org>
>
> [ Upstream commit 9801522840cc1073f8064b4c979b7b6995c74bca ]
>
> CPUFREQ_CONST_LOOPS was introduced in a very old commit from pre-2.6
> kernel release by commit 6a4a93f9c0d5 ("[CPUFREQ] Fix 'out of sync'
> issue").
>
> Basically, that commit does two things:
>
>   - It adds the frequency verification code (which is quite similar to
>     what we have today as well).
>
>   - And it sets the CPUFREQ_CONST_LOOPS flag only for setpolicy drivers,
>     rightly so based on the code we had then. The idea was to avoid
>     frequency validation for setpolicy drivers as the cpufreq core doesn't
>     know what frequency the hardware is running at and so no point in
>     doing frequency verification.
>
> The problem happened when we started to use the same CPUFREQ_CONST_LOOPS
> flag for constant loops-per-jiffy thing as well and many has_target()
> drivers started using the same flag and unknowingly skipped the
> verification of frequency. There is no logical reason behind skipping
> frequency validation because of the presence of CPUFREQ_CONST_LOOPS
> flag otherwise.
>
> Fix this issue by skipping frequency validation only for setpolicy
> drivers and always doing it for has_target() drivers irrespective of
> the presence or absence of CPUFREQ_CONST_LOOPS flag.
>
> cpufreq_notify_transition() is only called for has_target() type driver
> and not for set_policy type, and the check is simply redundant. Remove
> it as well.
>
> Also remove () around freq comparison statement as they aren't required
> and checkpatch also warns for them.
>
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
>   drivers/cpufreq/cpufreq.c | 13 +++++--------
>   1 file changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index d3213594d1a7..80942ec34efd 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -321,12 +321,10 @@ static void cpufreq_notify_transition(struct cpufreq_policy *policy,
>   		 * which is not equal to what the cpufreq core thinks is
>   		 * "old frequency".
>   		 */
> -		if (!(cpufreq_driver->flags & CPUFREQ_CONST_LOOPS)) {
> -			if (policy->cur && (policy->cur != freqs->old)) {
> -				pr_debug("Warning: CPU frequency is %u, cpufreq assumed %u kHz\n",
> -					 freqs->old, policy->cur);
> -				freqs->old = policy->cur;
> -			}
> +		if (policy->cur && policy->cur != freqs->old) {
> +			pr_debug("Warning: CPU frequency is %u, cpufreq assumed %u kHz\n",
> +				 freqs->old, policy->cur);
> +			freqs->old = policy->cur;
>   		}
>   
>   		for_each_cpu(freqs->cpu, policy->cpus) {
> @@ -1543,8 +1541,7 @@ static unsigned int __cpufreq_get(struct cpufreq_policy *policy)
>   	if (policy->fast_switch_enabled)
>   		return ret_freq;
>   
> -	if (ret_freq && policy->cur &&
> -		!(cpufreq_driver->flags & CPUFREQ_CONST_LOOPS)) {
> +	if (has_target() && ret_freq && policy->cur) {
>   		/* verify no discrepancy between actual and
>   					saved value exists */
>   		if (unlikely(ret_freq != policy->cur)) {

This is not -stable material, please drop it.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH AUTOSEL 4.19 123/158] cpufreq: Don't skip frequency validation for has_target() drivers
  2019-07-16  9:21   ` Rafael J. Wysocki
@ 2019-07-22  0:40     ` Sasha Levin
  0 siblings, 0 replies; 5+ messages in thread
From: Sasha Levin @ 2019-07-22  0:40 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: linux-kernel, stable, Viresh Kumar, linux-pm

On Tue, Jul 16, 2019 at 11:21:34AM +0200, Rafael J. Wysocki wrote:
>On 7/15/2019 4:17 PM, Sasha Levin wrote:
>>From: Viresh Kumar <viresh.kumar@linaro.org>
>>
>>[ Upstream commit 9801522840cc1073f8064b4c979b7b6995c74bca ]
>>
>>CPUFREQ_CONST_LOOPS was introduced in a very old commit from pre-2.6
>>kernel release by commit 6a4a93f9c0d5 ("[CPUFREQ] Fix 'out of sync'
>>issue").
>>
>>Basically, that commit does two things:
>>
>>  - It adds the frequency verification code (which is quite similar to
>>    what we have today as well).
>>
>>  - And it sets the CPUFREQ_CONST_LOOPS flag only for setpolicy drivers,
>>    rightly so based on the code we had then. The idea was to avoid
>>    frequency validation for setpolicy drivers as the cpufreq core doesn't
>>    know what frequency the hardware is running at and so no point in
>>    doing frequency verification.
>>
>>The problem happened when we started to use the same CPUFREQ_CONST_LOOPS
>>flag for constant loops-per-jiffy thing as well and many has_target()
>>drivers started using the same flag and unknowingly skipped the
>>verification of frequency. There is no logical reason behind skipping
>>frequency validation because of the presence of CPUFREQ_CONST_LOOPS
>>flag otherwise.
>>
>>Fix this issue by skipping frequency validation only for setpolicy
>>drivers and always doing it for has_target() drivers irrespective of
>>the presence or absence of CPUFREQ_CONST_LOOPS flag.
>>
>>cpufreq_notify_transition() is only called for has_target() type driver
>>and not for set_policy type, and the check is simply redundant. Remove
>>it as well.
>>
>>Also remove () around freq comparison statement as they aren't required
>>and checkpatch also warns for them.
>>
>>Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
>>Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>>Signed-off-by: Sasha Levin <sashal@kernel.org>
>>---
>>  drivers/cpufreq/cpufreq.c | 13 +++++--------
>>  1 file changed, 5 insertions(+), 8 deletions(-)
>>
>>diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
>>index d3213594d1a7..80942ec34efd 100644
>>--- a/drivers/cpufreq/cpufreq.c
>>+++ b/drivers/cpufreq/cpufreq.c
>>@@ -321,12 +321,10 @@ static void cpufreq_notify_transition(struct cpufreq_policy *policy,
>>  		 * which is not equal to what the cpufreq core thinks is
>>  		 * "old frequency".
>>  		 */
>>-		if (!(cpufreq_driver->flags & CPUFREQ_CONST_LOOPS)) {
>>-			if (policy->cur && (policy->cur != freqs->old)) {
>>-				pr_debug("Warning: CPU frequency is %u, cpufreq assumed %u kHz\n",
>>-					 freqs->old, policy->cur);
>>-				freqs->old = policy->cur;
>>-			}
>>+		if (policy->cur && policy->cur != freqs->old) {
>>+			pr_debug("Warning: CPU frequency is %u, cpufreq assumed %u kHz\n",
>>+				 freqs->old, policy->cur);
>>+			freqs->old = policy->cur;
>>  		}
>>  		for_each_cpu(freqs->cpu, policy->cpus) {
>>@@ -1543,8 +1541,7 @@ static unsigned int __cpufreq_get(struct cpufreq_policy *policy)
>>  	if (policy->fast_switch_enabled)
>>  		return ret_freq;
>>-	if (ret_freq && policy->cur &&
>>-		!(cpufreq_driver->flags & CPUFREQ_CONST_LOOPS)) {
>>+	if (has_target() && ret_freq && policy->cur) {
>>  		/* verify no discrepancy between actual and
>>  					saved value exists */
>>  		if (unlikely(ret_freq != policy->cur)) {
>
>This is not -stable material, please drop it.

I've dropped it, thanks!

--
Thanks,
Sasha

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-07-22  0:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20190715141809.8445-1-sashal@kernel.org>
2019-07-15 14:16 ` [PATCH AUTOSEL 4.19 040/158] cpupower : frequency-set -r option misses the last cpu in related cpu list Sasha Levin
2019-07-15 14:16 ` [PATCH AUTOSEL 4.19 065/158] x86/cpu: Add Ice Lake NNPI to Intel family Sasha Levin
2019-07-15 14:17 ` [PATCH AUTOSEL 4.19 123/158] cpufreq: Don't skip frequency validation for has_target() drivers Sasha Levin
2019-07-16  9:21   ` Rafael J. Wysocki
2019-07-22  0:40     ` Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).