All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/6] Track and expose idle PURR and SPURR ticks
@ 2020-03-11  9:37 ` Gautham R. Shenoy
  0 siblings, 0 replies; 19+ messages in thread
From: Gautham R. Shenoy @ 2020-03-11  9:37 UTC (permalink / raw)
  To: Nathan Lynch, Michael Ellerman, Vaidyanathan Srinivasan,
	Kamalesh Babulal, Naveen N. Rao, Tyrel Datwyler
  Cc: linuxppc-dev, linux-kernel, Gautham R. Shenoy

From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>

Hi,

This is the third version of the patches to track and expose idle PURR
and SPURR ticks. These patches are required by tools such as lparstat
to compute system utilization for capacity planning purposes.

The previous versions can be found here:
v2: https://lkml.org/lkml/2020/2/21/21
v1: https://lore.kernel.org/patchwork/cover/1159341/

They key changes from v2 are:

    - The prolog and epilog functions have been named
      pseries_idle_prolog() and pseries_idle_epilog() respectively to
      indicate their pseries specific nature.

    - Fixed the Documentation for
      /sys/devices/system/cpu/cpuX/idle_spurr as pointed out by
      Nathan Lynch.

    - Introduces a patch (Patch 6/6) to send an IPI in order to read
      and cache the values of purr, spurr, idle_purr and idle_spurr of
      the target CPU when any one of them is read via sysfs. These
      cached values will be presented if any of these sysfs are read
      within the next 10ms. If these sysfs files are read after 10ms
      from the earlier IPI, a fresh IPI is issued to read and cache
      the values again. This minimizes the number of IPIs required to
      be sent when these values are read back-to-back via the sysfs
      interface.

Test-results: While reading the four sysfs files back-to-back for a
given CPU every second for 100 seconds.
    
    Without patch 6/6 (Without caching): 
                 16 [XICS 2 Edge IPI] = 422 times
                 DBL [Doorbell interrupts] = 13 times
                 Total : 435 IPIs.
    
    With patch 6/6 (With caching):
                  16 [XICS 2 Edge IPI] = 111 times
                  DBL [Doorbell interrupts] = 17 times
                  Total : 128 IPIs.
Motivation:
===========
On PSeries LPARs, the data centers planners desire a more accurate
view of system utilization per resource such as CPU to plan the system
capacity requirements better. Such accuracy can be obtained by reading
PURR/SPURR registers for CPU resource utilization.

Tools such as lparstat which are used to compute the utilization need
to know [S]PURR ticks when the cpu was busy or idle. The [S]PURR
counters are already exposed through sysfs.  We already account for
PURR ticks when we go to idle so that we can update the VPA area. This
patchset extends support to account for SPURR ticks when idle, and
expose both via per-cpu sysfs files.

These patches are required for enhancement to the lparstat utility
that compute the CPU utilization based on PURR and SPURR which can be
found here :
https://groups.google.com/forum/#!topic/powerpc-utils-devel/fYRo69xO9r4


With the patches, when lparstat is run on a LPAR running CPU-Hogs,
=========================================================================
sudo ./src/lparstat -E 1 3
System Configuration
type=Dedicated mode=Capped smt=8 lcpu=2 mem=4834176 kB cpus=0 ent=2.00 
---Actual---                 -Normalized-
%busy  %idle   Frequency     %busy  %idle
------ ------  ------------- ------ ------
1  99.99   0.00  3.35GHz[111%] 110.99   0.00
2 100.00   0.00  3.35GHz[111%] 111.00   0.00
3 100.00   0.00  3.35GHz[111%] 111.00   0.00
=========================================================================

When lparstat is run on an LPAR that is idle,
=========================================================================
$ sudo ./src/lparstat -E 1 3
System Configuration
type=Dedicated mode=Capped smt=8 lcpu=2 mem=4834176 kB cpus=0 ent=2.00 
---Actual---                 -Normalized-
%busy  %idle   Frequency     %busy  %idle
------ ------  ------------- ------ ------
1   0.71  99.30  2.18GHz[ 72%]   0.53  71.48
2   0.56  99.44  2.11GHz[ 70%]   0.43  69.57
3   0.54  99.46  2.11GHz[ 70%]   0.43  69.57
=========================================================================
     

Gautham R. Shenoy (6):
  powerpc: Move idle_loop_prolog()/epilog() functions to header file
  powerpc/idle: Add accessor function to always read latest idle PURR
  powerpc/pseries: Account for SPURR ticks on idle CPUs
  powerpc/sysfs: Show idle_purr and idle_spurr for every CPU
  Documentation: Document sysfs interfaces purr, spurr, idle_purr, idle_spurr
  pseries/sysfs: Minimise IPI noise while reading [idle_][s]purr

 Documentation/ABI/testing/sysfs-devices-system-cpu |  39 ++++++
 arch/powerpc/include/asm/idle.h                    |  89 ++++++++++++++
 arch/powerpc/kernel/sysfs.c                        | 133 +++++++++++++++++++--
 arch/powerpc/platforms/pseries/setup.c             |   8 +-
 drivers/cpuidle/cpuidle-pseries.c                  |  39 ++----
 5 files changed, 267 insertions(+), 41 deletions(-)
 create mode 100644 arch/powerpc/include/asm/idle.h

-- 
1.9.4


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

* [PATCH v3 0/6] Track and expose idle PURR and SPURR ticks
@ 2020-03-11  9:37 ` Gautham R. Shenoy
  0 siblings, 0 replies; 19+ messages in thread
From: Gautham R. Shenoy @ 2020-03-11  9:37 UTC (permalink / raw)
  To: Nathan Lynch, Michael Ellerman, Vaidyanathan Srinivasan,
	Kamalesh Babulal, Naveen N. Rao, Tyrel Datwyler
  Cc: Gautham R. Shenoy, linuxppc-dev, linux-kernel

From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>

Hi,

This is the third version of the patches to track and expose idle PURR
and SPURR ticks. These patches are required by tools such as lparstat
to compute system utilization for capacity planning purposes.

The previous versions can be found here:
v2: https://lkml.org/lkml/2020/2/21/21
v1: https://lore.kernel.org/patchwork/cover/1159341/

They key changes from v2 are:

    - The prolog and epilog functions have been named
      pseries_idle_prolog() and pseries_idle_epilog() respectively to
      indicate their pseries specific nature.

    - Fixed the Documentation for
      /sys/devices/system/cpu/cpuX/idle_spurr as pointed out by
      Nathan Lynch.

    - Introduces a patch (Patch 6/6) to send an IPI in order to read
      and cache the values of purr, spurr, idle_purr and idle_spurr of
      the target CPU when any one of them is read via sysfs. These
      cached values will be presented if any of these sysfs are read
      within the next 10ms. If these sysfs files are read after 10ms
      from the earlier IPI, a fresh IPI is issued to read and cache
      the values again. This minimizes the number of IPIs required to
      be sent when these values are read back-to-back via the sysfs
      interface.

Test-results: While reading the four sysfs files back-to-back for a
given CPU every second for 100 seconds.
    
    Without patch 6/6 (Without caching): 
                 16 [XICS 2 Edge IPI] = 422 times
                 DBL [Doorbell interrupts] = 13 times
                 Total : 435 IPIs.
    
    With patch 6/6 (With caching):
                  16 [XICS 2 Edge IPI] = 111 times
                  DBL [Doorbell interrupts] = 17 times
                  Total : 128 IPIs.
Motivation:
===========
On PSeries LPARs, the data centers planners desire a more accurate
view of system utilization per resource such as CPU to plan the system
capacity requirements better. Such accuracy can be obtained by reading
PURR/SPURR registers for CPU resource utilization.

Tools such as lparstat which are used to compute the utilization need
to know [S]PURR ticks when the cpu was busy or idle. The [S]PURR
counters are already exposed through sysfs.  We already account for
PURR ticks when we go to idle so that we can update the VPA area. This
patchset extends support to account for SPURR ticks when idle, and
expose both via per-cpu sysfs files.

These patches are required for enhancement to the lparstat utility
that compute the CPU utilization based on PURR and SPURR which can be
found here :
https://groups.google.com/forum/#!topic/powerpc-utils-devel/fYRo69xO9r4


With the patches, when lparstat is run on a LPAR running CPU-Hogs,
=========================================================================
sudo ./src/lparstat -E 1 3
System Configuration
type=Dedicated mode=Capped smt=8 lcpu=2 mem=4834176 kB cpus=0 ent=2.00 
---Actual---                 -Normalized-
%busy  %idle   Frequency     %busy  %idle
------ ------  ------------- ------ ------
1  99.99   0.00  3.35GHz[111%] 110.99   0.00
2 100.00   0.00  3.35GHz[111%] 111.00   0.00
3 100.00   0.00  3.35GHz[111%] 111.00   0.00
=========================================================================

When lparstat is run on an LPAR that is idle,
=========================================================================
$ sudo ./src/lparstat -E 1 3
System Configuration
type=Dedicated mode=Capped smt=8 lcpu=2 mem=4834176 kB cpus=0 ent=2.00 
---Actual---                 -Normalized-
%busy  %idle   Frequency     %busy  %idle
------ ------  ------------- ------ ------
1   0.71  99.30  2.18GHz[ 72%]   0.53  71.48
2   0.56  99.44  2.11GHz[ 70%]   0.43  69.57
3   0.54  99.46  2.11GHz[ 70%]   0.43  69.57
=========================================================================
     

Gautham R. Shenoy (6):
  powerpc: Move idle_loop_prolog()/epilog() functions to header file
  powerpc/idle: Add accessor function to always read latest idle PURR
  powerpc/pseries: Account for SPURR ticks on idle CPUs
  powerpc/sysfs: Show idle_purr and idle_spurr for every CPU
  Documentation: Document sysfs interfaces purr, spurr, idle_purr, idle_spurr
  pseries/sysfs: Minimise IPI noise while reading [idle_][s]purr

 Documentation/ABI/testing/sysfs-devices-system-cpu |  39 ++++++
 arch/powerpc/include/asm/idle.h                    |  89 ++++++++++++++
 arch/powerpc/kernel/sysfs.c                        | 133 +++++++++++++++++++--
 arch/powerpc/platforms/pseries/setup.c             |   8 +-
 drivers/cpuidle/cpuidle-pseries.c                  |  39 ++----
 5 files changed, 267 insertions(+), 41 deletions(-)
 create mode 100644 arch/powerpc/include/asm/idle.h

-- 
1.9.4


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

* [PATCH v3 1/6] powerpc: Move idle_loop_prolog()/epilog() functions to header file
  2020-03-11  9:37 ` Gautham R. Shenoy
@ 2020-03-11  9:37   ` Gautham R. Shenoy
  -1 siblings, 0 replies; 19+ messages in thread
From: Gautham R. Shenoy @ 2020-03-11  9:37 UTC (permalink / raw)
  To: Nathan Lynch, Michael Ellerman, Vaidyanathan Srinivasan,
	Kamalesh Babulal, Naveen N. Rao, Tyrel Datwyler
  Cc: linuxppc-dev, linux-kernel, Gautham R. Shenoy

From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>

Currently prior to entering an idle state on a Linux Guest, the
pseries cpuidle driver implement an idle_loop_prolog() and
idle_loop_epilog() functions which ensure that idle_purr is correctly
computed, and the hypervisor is informed that the CPU cycles have been
donated.

These prolog and epilog functions are also required in the default
idle call, i.e pseries_lpar_idle(). Hence move these accessor
functions to a common header file and call them from
pseries_lpar_idle(). Since the existing header files such as
asm/processor.h have enough clutter, create a new header file
asm/idle.h. Finally rename idle_loop_prolog() and idle_loop_epilog()
to pseries_idle_prolog() and pseries_idle_epilog() as they are only
relavent for on pseries guests.

Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
---
 arch/powerpc/include/asm/idle.h        | 28 ++++++++++++++++++++++++++
 arch/powerpc/platforms/pseries/setup.c |  7 +++++--
 drivers/cpuidle/cpuidle-pseries.c      | 36 +++++++---------------------------
 3 files changed, 40 insertions(+), 31 deletions(-)
 create mode 100644 arch/powerpc/include/asm/idle.h

diff --git a/arch/powerpc/include/asm/idle.h b/arch/powerpc/include/asm/idle.h
new file mode 100644
index 0000000..e838ea5
--- /dev/null
+++ b/arch/powerpc/include/asm/idle.h
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+#ifndef _ASM_POWERPC_IDLE_H
+#define _ASM_POWERPC_IDLE_H
+#include <asm/runlatch.h>
+
+static inline void pseries_idle_prolog(unsigned long *in_purr)
+{
+	ppc64_runlatch_off();
+	*in_purr = mfspr(SPRN_PURR);
+	/*
+	 * Indicate to the HV that we are idle. Now would be
+	 * a good time to find other work to dispatch.
+	 */
+	get_lppaca()->idle = 1;
+}
+
+static inline void pseries_idle_epilog(unsigned long in_purr)
+{
+	u64 wait_cycles;
+
+	wait_cycles = be64_to_cpu(get_lppaca()->wait_state_cycles);
+	wait_cycles += mfspr(SPRN_PURR) - in_purr;
+	get_lppaca()->wait_state_cycles = cpu_to_be64(wait_cycles);
+	get_lppaca()->idle = 0;
+
+	ppc64_runlatch_on();
+}
+#endif
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 0c8421d..2f53e6b 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -68,6 +68,7 @@
 #include <asm/isa-bridge.h>
 #include <asm/security_features.h>
 #include <asm/asm-const.h>
+#include <asm/idle.h>
 #include <asm/swiotlb.h>
 #include <asm/svm.h>
 
@@ -319,6 +320,8 @@ static int alloc_dispatch_log_kmem_cache(void)
 
 static void pseries_lpar_idle(void)
 {
+	unsigned long in_purr;
+
 	/*
 	 * Default handler to go into low thread priority and possibly
 	 * low power mode by ceding processor to hypervisor
@@ -328,7 +331,7 @@ static void pseries_lpar_idle(void)
 		return;
 
 	/* Indicate to hypervisor that we are idle. */
-	get_lppaca()->idle = 1;
+	pseries_idle_prolog(&in_purr);
 
 	/*
 	 * Yield the processor to the hypervisor.  We return if
@@ -339,7 +342,7 @@ static void pseries_lpar_idle(void)
 	 */
 	cede_processor();
 
-	get_lppaca()->idle = 0;
+	pseries_idle_epilog(in_purr);
 }
 
 /*
diff --git a/drivers/cpuidle/cpuidle-pseries.c b/drivers/cpuidle/cpuidle-pseries.c
index 74c2479..46d5e05 100644
--- a/drivers/cpuidle/cpuidle-pseries.c
+++ b/drivers/cpuidle/cpuidle-pseries.c
@@ -19,6 +19,7 @@
 #include <asm/machdep.h>
 #include <asm/firmware.h>
 #include <asm/runlatch.h>
+#include <asm/idle.h>
 #include <asm/plpar_wrappers.h>
 
 struct cpuidle_driver pseries_idle_driver = {
@@ -31,29 +32,6 @@ struct cpuidle_driver pseries_idle_driver = {
 static u64 snooze_timeout __read_mostly;
 static bool snooze_timeout_en __read_mostly;
 
-static inline void idle_loop_prolog(unsigned long *in_purr)
-{
-	ppc64_runlatch_off();
-	*in_purr = mfspr(SPRN_PURR);
-	/*
-	 * Indicate to the HV that we are idle. Now would be
-	 * a good time to find other work to dispatch.
-	 */
-	get_lppaca()->idle = 1;
-}
-
-static inline void idle_loop_epilog(unsigned long in_purr)
-{
-	u64 wait_cycles;
-
-	wait_cycles = be64_to_cpu(get_lppaca()->wait_state_cycles);
-	wait_cycles += mfspr(SPRN_PURR) - in_purr;
-	get_lppaca()->wait_state_cycles = cpu_to_be64(wait_cycles);
-	get_lppaca()->idle = 0;
-
-	ppc64_runlatch_on();
-}
-
 static int snooze_loop(struct cpuidle_device *dev,
 			struct cpuidle_driver *drv,
 			int index)
@@ -63,7 +41,7 @@ static int snooze_loop(struct cpuidle_device *dev,
 
 	set_thread_flag(TIF_POLLING_NRFLAG);
 
-	idle_loop_prolog(&in_purr);
+	pseries_idle_prolog(&in_purr);
 	local_irq_enable();
 	snooze_exit_time = get_tb() + snooze_timeout;
 
@@ -87,7 +65,7 @@ static int snooze_loop(struct cpuidle_device *dev,
 
 	local_irq_disable();
 
-	idle_loop_epilog(in_purr);
+	pseries_idle_epilog(in_purr);
 
 	return index;
 }
@@ -115,7 +93,7 @@ static int dedicated_cede_loop(struct cpuidle_device *dev,
 {
 	unsigned long in_purr;
 
-	idle_loop_prolog(&in_purr);
+	pseries_idle_prolog(&in_purr);
 	get_lppaca()->donate_dedicated_cpu = 1;
 
 	HMT_medium();
@@ -124,7 +102,7 @@ static int dedicated_cede_loop(struct cpuidle_device *dev,
 	local_irq_disable();
 	get_lppaca()->donate_dedicated_cpu = 0;
 
-	idle_loop_epilog(in_purr);
+	pseries_idle_epilog(in_purr);
 
 	return index;
 }
@@ -135,7 +113,7 @@ static int shared_cede_loop(struct cpuidle_device *dev,
 {
 	unsigned long in_purr;
 
-	idle_loop_prolog(&in_purr);
+	pseries_idle_prolog(&in_purr);
 
 	/*
 	 * Yield the processor to the hypervisor.  We return if
@@ -147,7 +125,7 @@ static int shared_cede_loop(struct cpuidle_device *dev,
 	check_and_cede_processor();
 
 	local_irq_disable();
-	idle_loop_epilog(in_purr);
+	pseries_idle_epilog(in_purr);
 
 	return index;
 }
-- 
1.9.4


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

* [PATCH v3 1/6] powerpc: Move idle_loop_prolog()/epilog() functions to header file
@ 2020-03-11  9:37   ` Gautham R. Shenoy
  0 siblings, 0 replies; 19+ messages in thread
From: Gautham R. Shenoy @ 2020-03-11  9:37 UTC (permalink / raw)
  To: Nathan Lynch, Michael Ellerman, Vaidyanathan Srinivasan,
	Kamalesh Babulal, Naveen N. Rao, Tyrel Datwyler
  Cc: Gautham R. Shenoy, linuxppc-dev, linux-kernel

From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>

Currently prior to entering an idle state on a Linux Guest, the
pseries cpuidle driver implement an idle_loop_prolog() and
idle_loop_epilog() functions which ensure that idle_purr is correctly
computed, and the hypervisor is informed that the CPU cycles have been
donated.

These prolog and epilog functions are also required in the default
idle call, i.e pseries_lpar_idle(). Hence move these accessor
functions to a common header file and call them from
pseries_lpar_idle(). Since the existing header files such as
asm/processor.h have enough clutter, create a new header file
asm/idle.h. Finally rename idle_loop_prolog() and idle_loop_epilog()
to pseries_idle_prolog() and pseries_idle_epilog() as they are only
relavent for on pseries guests.

Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
---
 arch/powerpc/include/asm/idle.h        | 28 ++++++++++++++++++++++++++
 arch/powerpc/platforms/pseries/setup.c |  7 +++++--
 drivers/cpuidle/cpuidle-pseries.c      | 36 +++++++---------------------------
 3 files changed, 40 insertions(+), 31 deletions(-)
 create mode 100644 arch/powerpc/include/asm/idle.h

diff --git a/arch/powerpc/include/asm/idle.h b/arch/powerpc/include/asm/idle.h
new file mode 100644
index 0000000..e838ea5
--- /dev/null
+++ b/arch/powerpc/include/asm/idle.h
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+#ifndef _ASM_POWERPC_IDLE_H
+#define _ASM_POWERPC_IDLE_H
+#include <asm/runlatch.h>
+
+static inline void pseries_idle_prolog(unsigned long *in_purr)
+{
+	ppc64_runlatch_off();
+	*in_purr = mfspr(SPRN_PURR);
+	/*
+	 * Indicate to the HV that we are idle. Now would be
+	 * a good time to find other work to dispatch.
+	 */
+	get_lppaca()->idle = 1;
+}
+
+static inline void pseries_idle_epilog(unsigned long in_purr)
+{
+	u64 wait_cycles;
+
+	wait_cycles = be64_to_cpu(get_lppaca()->wait_state_cycles);
+	wait_cycles += mfspr(SPRN_PURR) - in_purr;
+	get_lppaca()->wait_state_cycles = cpu_to_be64(wait_cycles);
+	get_lppaca()->idle = 0;
+
+	ppc64_runlatch_on();
+}
+#endif
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 0c8421d..2f53e6b 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -68,6 +68,7 @@
 #include <asm/isa-bridge.h>
 #include <asm/security_features.h>
 #include <asm/asm-const.h>
+#include <asm/idle.h>
 #include <asm/swiotlb.h>
 #include <asm/svm.h>
 
@@ -319,6 +320,8 @@ static int alloc_dispatch_log_kmem_cache(void)
 
 static void pseries_lpar_idle(void)
 {
+	unsigned long in_purr;
+
 	/*
 	 * Default handler to go into low thread priority and possibly
 	 * low power mode by ceding processor to hypervisor
@@ -328,7 +331,7 @@ static void pseries_lpar_idle(void)
 		return;
 
 	/* Indicate to hypervisor that we are idle. */
-	get_lppaca()->idle = 1;
+	pseries_idle_prolog(&in_purr);
 
 	/*
 	 * Yield the processor to the hypervisor.  We return if
@@ -339,7 +342,7 @@ static void pseries_lpar_idle(void)
 	 */
 	cede_processor();
 
-	get_lppaca()->idle = 0;
+	pseries_idle_epilog(in_purr);
 }
 
 /*
diff --git a/drivers/cpuidle/cpuidle-pseries.c b/drivers/cpuidle/cpuidle-pseries.c
index 74c2479..46d5e05 100644
--- a/drivers/cpuidle/cpuidle-pseries.c
+++ b/drivers/cpuidle/cpuidle-pseries.c
@@ -19,6 +19,7 @@
 #include <asm/machdep.h>
 #include <asm/firmware.h>
 #include <asm/runlatch.h>
+#include <asm/idle.h>
 #include <asm/plpar_wrappers.h>
 
 struct cpuidle_driver pseries_idle_driver = {
@@ -31,29 +32,6 @@ struct cpuidle_driver pseries_idle_driver = {
 static u64 snooze_timeout __read_mostly;
 static bool snooze_timeout_en __read_mostly;
 
-static inline void idle_loop_prolog(unsigned long *in_purr)
-{
-	ppc64_runlatch_off();
-	*in_purr = mfspr(SPRN_PURR);
-	/*
-	 * Indicate to the HV that we are idle. Now would be
-	 * a good time to find other work to dispatch.
-	 */
-	get_lppaca()->idle = 1;
-}
-
-static inline void idle_loop_epilog(unsigned long in_purr)
-{
-	u64 wait_cycles;
-
-	wait_cycles = be64_to_cpu(get_lppaca()->wait_state_cycles);
-	wait_cycles += mfspr(SPRN_PURR) - in_purr;
-	get_lppaca()->wait_state_cycles = cpu_to_be64(wait_cycles);
-	get_lppaca()->idle = 0;
-
-	ppc64_runlatch_on();
-}
-
 static int snooze_loop(struct cpuidle_device *dev,
 			struct cpuidle_driver *drv,
 			int index)
@@ -63,7 +41,7 @@ static int snooze_loop(struct cpuidle_device *dev,
 
 	set_thread_flag(TIF_POLLING_NRFLAG);
 
-	idle_loop_prolog(&in_purr);
+	pseries_idle_prolog(&in_purr);
 	local_irq_enable();
 	snooze_exit_time = get_tb() + snooze_timeout;
 
@@ -87,7 +65,7 @@ static int snooze_loop(struct cpuidle_device *dev,
 
 	local_irq_disable();
 
-	idle_loop_epilog(in_purr);
+	pseries_idle_epilog(in_purr);
 
 	return index;
 }
@@ -115,7 +93,7 @@ static int dedicated_cede_loop(struct cpuidle_device *dev,
 {
 	unsigned long in_purr;
 
-	idle_loop_prolog(&in_purr);
+	pseries_idle_prolog(&in_purr);
 	get_lppaca()->donate_dedicated_cpu = 1;
 
 	HMT_medium();
@@ -124,7 +102,7 @@ static int dedicated_cede_loop(struct cpuidle_device *dev,
 	local_irq_disable();
 	get_lppaca()->donate_dedicated_cpu = 0;
 
-	idle_loop_epilog(in_purr);
+	pseries_idle_epilog(in_purr);
 
 	return index;
 }
@@ -135,7 +113,7 @@ static int shared_cede_loop(struct cpuidle_device *dev,
 {
 	unsigned long in_purr;
 
-	idle_loop_prolog(&in_purr);
+	pseries_idle_prolog(&in_purr);
 
 	/*
 	 * Yield the processor to the hypervisor.  We return if
@@ -147,7 +125,7 @@ static int shared_cede_loop(struct cpuidle_device *dev,
 	check_and_cede_processor();
 
 	local_irq_disable();
-	idle_loop_epilog(in_purr);
+	pseries_idle_epilog(in_purr);
 
 	return index;
 }
-- 
1.9.4


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

* [PATCH v3 2/6] powerpc/idle: Add accessor function to always read latest idle PURR
  2020-03-11  9:37 ` Gautham R. Shenoy
@ 2020-03-11  9:37   ` Gautham R. Shenoy
  -1 siblings, 0 replies; 19+ messages in thread
From: Gautham R. Shenoy @ 2020-03-11  9:37 UTC (permalink / raw)
  To: Nathan Lynch, Michael Ellerman, Vaidyanathan Srinivasan,
	Kamalesh Babulal, Naveen N. Rao, Tyrel Datwyler
  Cc: linuxppc-dev, linux-kernel, Gautham R. Shenoy

From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>

Currently when CPU goes idle, we take a snapshot of PURR via
pseries_idle_prolog() which is used at the CPU idle exit to compute
the idle PURR cycles via the function pseries_idle_epilog().  Thus,
the value of idle PURR cycle thus read before pseries_idle_prolog() and
after pseries_idle_epilog() is always correct.

However, if we were to read the idle PURR cycles from an interrupt
context between pseries_idle_prolog() and pseries_idle_epilog() (this will
be done in a future patch), then, the value of the idle PURR thus read
will not include the cycles spent in the most recent idle period.

This patch addresses the issue by providing accessor function to read
the idle PURR such such that it includes the cycles spent in the most
recent idle period, if we read it between pseries_idle_prolog() and
pseries_idle_epilog(). In order to achieve it, the patch saves the
snapshot of PURR in pseries_idle_prolog() in a per-cpu variable,
instead of on the stack, so that it can be accessed from an interrupt
context.

Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
---
 arch/powerpc/include/asm/idle.h        | 46 +++++++++++++++++++++++++++-------
 arch/powerpc/platforms/pseries/setup.c |  7 +++---
 drivers/cpuidle/cpuidle-pseries.c      | 15 +++++------
 3 files changed, 46 insertions(+), 22 deletions(-)

diff --git a/arch/powerpc/include/asm/idle.h b/arch/powerpc/include/asm/idle.h
index e838ea5..7552823 100644
--- a/arch/powerpc/include/asm/idle.h
+++ b/arch/powerpc/include/asm/idle.h
@@ -3,10 +3,27 @@
 #define _ASM_POWERPC_IDLE_H
 #include <asm/runlatch.h>
 
-static inline void pseries_idle_prolog(unsigned long *in_purr)
+DECLARE_PER_CPU(u64, idle_entry_purr_snap);
+
+static inline void snapshot_purr_idle_entry(void)
+{
+	*this_cpu_ptr(&idle_entry_purr_snap) = mfspr(SPRN_PURR);
+}
+
+static inline void update_idle_purr_accounting(void)
+{
+	u64 wait_cycles;
+	u64 in_purr = *this_cpu_ptr(&idle_entry_purr_snap);
+
+	wait_cycles = be64_to_cpu(get_lppaca()->wait_state_cycles);
+	wait_cycles += mfspr(SPRN_PURR) - in_purr;
+	get_lppaca()->wait_state_cycles = cpu_to_be64(wait_cycles);
+}
+
+static inline void pseries_idle_prolog(void)
 {
 	ppc64_runlatch_off();
-	*in_purr = mfspr(SPRN_PURR);
+	snapshot_purr_idle_entry();
 	/*
 	 * Indicate to the HV that we are idle. Now would be
 	 * a good time to find other work to dispatch.
@@ -14,15 +31,26 @@ static inline void pseries_idle_prolog(unsigned long *in_purr)
 	get_lppaca()->idle = 1;
 }
 
-static inline void pseries_idle_epilog(unsigned long in_purr)
+static inline void pseries_idle_epilog(void)
 {
-	u64 wait_cycles;
-
-	wait_cycles = be64_to_cpu(get_lppaca()->wait_state_cycles);
-	wait_cycles += mfspr(SPRN_PURR) - in_purr;
-	get_lppaca()->wait_state_cycles = cpu_to_be64(wait_cycles);
+	update_idle_purr_accounting();
 	get_lppaca()->idle = 0;
-
 	ppc64_runlatch_on();
 }
+
+static inline u64 read_this_idle_purr(void)
+{
+	/*
+	 * If we are reading from an idle context, update the
+	 * idle-purr cycles corresponding to the last idle period.
+	 * Since the idle context is not yet over, take a fresh
+	 * snapshot of the idle-purr.
+	 */
+	if (unlikely(get_lppaca()->idle == 1)) {
+		update_idle_purr_accounting();
+		snapshot_purr_idle_entry();
+	}
+
+	return be64_to_cpu(get_lppaca()->wait_state_cycles);
+}
 #endif
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 2f53e6b..4905c96 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -318,10 +318,9 @@ static int alloc_dispatch_log_kmem_cache(void)
 }
 machine_early_initcall(pseries, alloc_dispatch_log_kmem_cache);
 
+DEFINE_PER_CPU(u64, idle_entry_purr_snap);
 static void pseries_lpar_idle(void)
 {
-	unsigned long in_purr;
-
 	/*
 	 * Default handler to go into low thread priority and possibly
 	 * low power mode by ceding processor to hypervisor
@@ -331,7 +330,7 @@ static void pseries_lpar_idle(void)
 		return;
 
 	/* Indicate to hypervisor that we are idle. */
-	pseries_idle_prolog(&in_purr);
+	pseries_idle_prolog();
 
 	/*
 	 * Yield the processor to the hypervisor.  We return if
@@ -342,7 +341,7 @@ static void pseries_lpar_idle(void)
 	 */
 	cede_processor();
 
-	pseries_idle_epilog(in_purr);
+	pseries_idle_epilog();
 }
 
 /*
diff --git a/drivers/cpuidle/cpuidle-pseries.c b/drivers/cpuidle/cpuidle-pseries.c
index 46d5e05..6513ef2 100644
--- a/drivers/cpuidle/cpuidle-pseries.c
+++ b/drivers/cpuidle/cpuidle-pseries.c
@@ -36,12 +36,11 @@ static int snooze_loop(struct cpuidle_device *dev,
 			struct cpuidle_driver *drv,
 			int index)
 {
-	unsigned long in_purr;
 	u64 snooze_exit_time;
 
 	set_thread_flag(TIF_POLLING_NRFLAG);
 
-	pseries_idle_prolog(&in_purr);
+	pseries_idle_prolog();
 	local_irq_enable();
 	snooze_exit_time = get_tb() + snooze_timeout;
 
@@ -65,7 +64,7 @@ static int snooze_loop(struct cpuidle_device *dev,
 
 	local_irq_disable();
 
-	pseries_idle_epilog(in_purr);
+	pseries_idle_epilog();
 
 	return index;
 }
@@ -91,9 +90,8 @@ static int dedicated_cede_loop(struct cpuidle_device *dev,
 				struct cpuidle_driver *drv,
 				int index)
 {
-	unsigned long in_purr;
 
-	pseries_idle_prolog(&in_purr);
+	pseries_idle_prolog();
 	get_lppaca()->donate_dedicated_cpu = 1;
 
 	HMT_medium();
@@ -102,7 +100,7 @@ static int dedicated_cede_loop(struct cpuidle_device *dev,
 	local_irq_disable();
 	get_lppaca()->donate_dedicated_cpu = 0;
 
-	pseries_idle_epilog(in_purr);
+	pseries_idle_epilog();
 
 	return index;
 }
@@ -111,9 +109,8 @@ static int shared_cede_loop(struct cpuidle_device *dev,
 			struct cpuidle_driver *drv,
 			int index)
 {
-	unsigned long in_purr;
 
-	pseries_idle_prolog(&in_purr);
+	pseries_idle_prolog();
 
 	/*
 	 * Yield the processor to the hypervisor.  We return if
@@ -125,7 +122,7 @@ static int shared_cede_loop(struct cpuidle_device *dev,
 	check_and_cede_processor();
 
 	local_irq_disable();
-	pseries_idle_epilog(in_purr);
+	pseries_idle_epilog();
 
 	return index;
 }
-- 
1.9.4


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

* [PATCH v3 2/6] powerpc/idle: Add accessor function to always read latest idle PURR
@ 2020-03-11  9:37   ` Gautham R. Shenoy
  0 siblings, 0 replies; 19+ messages in thread
From: Gautham R. Shenoy @ 2020-03-11  9:37 UTC (permalink / raw)
  To: Nathan Lynch, Michael Ellerman, Vaidyanathan Srinivasan,
	Kamalesh Babulal, Naveen N. Rao, Tyrel Datwyler
  Cc: Gautham R. Shenoy, linuxppc-dev, linux-kernel

From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>

Currently when CPU goes idle, we take a snapshot of PURR via
pseries_idle_prolog() which is used at the CPU idle exit to compute
the idle PURR cycles via the function pseries_idle_epilog().  Thus,
the value of idle PURR cycle thus read before pseries_idle_prolog() and
after pseries_idle_epilog() is always correct.

However, if we were to read the idle PURR cycles from an interrupt
context between pseries_idle_prolog() and pseries_idle_epilog() (this will
be done in a future patch), then, the value of the idle PURR thus read
will not include the cycles spent in the most recent idle period.

This patch addresses the issue by providing accessor function to read
the idle PURR such such that it includes the cycles spent in the most
recent idle period, if we read it between pseries_idle_prolog() and
pseries_idle_epilog(). In order to achieve it, the patch saves the
snapshot of PURR in pseries_idle_prolog() in a per-cpu variable,
instead of on the stack, so that it can be accessed from an interrupt
context.

Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
---
 arch/powerpc/include/asm/idle.h        | 46 +++++++++++++++++++++++++++-------
 arch/powerpc/platforms/pseries/setup.c |  7 +++---
 drivers/cpuidle/cpuidle-pseries.c      | 15 +++++------
 3 files changed, 46 insertions(+), 22 deletions(-)

diff --git a/arch/powerpc/include/asm/idle.h b/arch/powerpc/include/asm/idle.h
index e838ea5..7552823 100644
--- a/arch/powerpc/include/asm/idle.h
+++ b/arch/powerpc/include/asm/idle.h
@@ -3,10 +3,27 @@
 #define _ASM_POWERPC_IDLE_H
 #include <asm/runlatch.h>
 
-static inline void pseries_idle_prolog(unsigned long *in_purr)
+DECLARE_PER_CPU(u64, idle_entry_purr_snap);
+
+static inline void snapshot_purr_idle_entry(void)
+{
+	*this_cpu_ptr(&idle_entry_purr_snap) = mfspr(SPRN_PURR);
+}
+
+static inline void update_idle_purr_accounting(void)
+{
+	u64 wait_cycles;
+	u64 in_purr = *this_cpu_ptr(&idle_entry_purr_snap);
+
+	wait_cycles = be64_to_cpu(get_lppaca()->wait_state_cycles);
+	wait_cycles += mfspr(SPRN_PURR) - in_purr;
+	get_lppaca()->wait_state_cycles = cpu_to_be64(wait_cycles);
+}
+
+static inline void pseries_idle_prolog(void)
 {
 	ppc64_runlatch_off();
-	*in_purr = mfspr(SPRN_PURR);
+	snapshot_purr_idle_entry();
 	/*
 	 * Indicate to the HV that we are idle. Now would be
 	 * a good time to find other work to dispatch.
@@ -14,15 +31,26 @@ static inline void pseries_idle_prolog(unsigned long *in_purr)
 	get_lppaca()->idle = 1;
 }
 
-static inline void pseries_idle_epilog(unsigned long in_purr)
+static inline void pseries_idle_epilog(void)
 {
-	u64 wait_cycles;
-
-	wait_cycles = be64_to_cpu(get_lppaca()->wait_state_cycles);
-	wait_cycles += mfspr(SPRN_PURR) - in_purr;
-	get_lppaca()->wait_state_cycles = cpu_to_be64(wait_cycles);
+	update_idle_purr_accounting();
 	get_lppaca()->idle = 0;
-
 	ppc64_runlatch_on();
 }
+
+static inline u64 read_this_idle_purr(void)
+{
+	/*
+	 * If we are reading from an idle context, update the
+	 * idle-purr cycles corresponding to the last idle period.
+	 * Since the idle context is not yet over, take a fresh
+	 * snapshot of the idle-purr.
+	 */
+	if (unlikely(get_lppaca()->idle == 1)) {
+		update_idle_purr_accounting();
+		snapshot_purr_idle_entry();
+	}
+
+	return be64_to_cpu(get_lppaca()->wait_state_cycles);
+}
 #endif
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 2f53e6b..4905c96 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -318,10 +318,9 @@ static int alloc_dispatch_log_kmem_cache(void)
 }
 machine_early_initcall(pseries, alloc_dispatch_log_kmem_cache);
 
+DEFINE_PER_CPU(u64, idle_entry_purr_snap);
 static void pseries_lpar_idle(void)
 {
-	unsigned long in_purr;
-
 	/*
 	 * Default handler to go into low thread priority and possibly
 	 * low power mode by ceding processor to hypervisor
@@ -331,7 +330,7 @@ static void pseries_lpar_idle(void)
 		return;
 
 	/* Indicate to hypervisor that we are idle. */
-	pseries_idle_prolog(&in_purr);
+	pseries_idle_prolog();
 
 	/*
 	 * Yield the processor to the hypervisor.  We return if
@@ -342,7 +341,7 @@ static void pseries_lpar_idle(void)
 	 */
 	cede_processor();
 
-	pseries_idle_epilog(in_purr);
+	pseries_idle_epilog();
 }
 
 /*
diff --git a/drivers/cpuidle/cpuidle-pseries.c b/drivers/cpuidle/cpuidle-pseries.c
index 46d5e05..6513ef2 100644
--- a/drivers/cpuidle/cpuidle-pseries.c
+++ b/drivers/cpuidle/cpuidle-pseries.c
@@ -36,12 +36,11 @@ static int snooze_loop(struct cpuidle_device *dev,
 			struct cpuidle_driver *drv,
 			int index)
 {
-	unsigned long in_purr;
 	u64 snooze_exit_time;
 
 	set_thread_flag(TIF_POLLING_NRFLAG);
 
-	pseries_idle_prolog(&in_purr);
+	pseries_idle_prolog();
 	local_irq_enable();
 	snooze_exit_time = get_tb() + snooze_timeout;
 
@@ -65,7 +64,7 @@ static int snooze_loop(struct cpuidle_device *dev,
 
 	local_irq_disable();
 
-	pseries_idle_epilog(in_purr);
+	pseries_idle_epilog();
 
 	return index;
 }
@@ -91,9 +90,8 @@ static int dedicated_cede_loop(struct cpuidle_device *dev,
 				struct cpuidle_driver *drv,
 				int index)
 {
-	unsigned long in_purr;
 
-	pseries_idle_prolog(&in_purr);
+	pseries_idle_prolog();
 	get_lppaca()->donate_dedicated_cpu = 1;
 
 	HMT_medium();
@@ -102,7 +100,7 @@ static int dedicated_cede_loop(struct cpuidle_device *dev,
 	local_irq_disable();
 	get_lppaca()->donate_dedicated_cpu = 0;
 
-	pseries_idle_epilog(in_purr);
+	pseries_idle_epilog();
 
 	return index;
 }
@@ -111,9 +109,8 @@ static int shared_cede_loop(struct cpuidle_device *dev,
 			struct cpuidle_driver *drv,
 			int index)
 {
-	unsigned long in_purr;
 
-	pseries_idle_prolog(&in_purr);
+	pseries_idle_prolog();
 
 	/*
 	 * Yield the processor to the hypervisor.  We return if
@@ -125,7 +122,7 @@ static int shared_cede_loop(struct cpuidle_device *dev,
 	check_and_cede_processor();
 
 	local_irq_disable();
-	pseries_idle_epilog(in_purr);
+	pseries_idle_epilog();
 
 	return index;
 }
-- 
1.9.4


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

* [PATCH v3 3/6] powerpc/pseries: Account for SPURR ticks on idle CPUs
  2020-03-11  9:37 ` Gautham R. Shenoy
@ 2020-03-11  9:37   ` Gautham R. Shenoy
  -1 siblings, 0 replies; 19+ messages in thread
From: Gautham R. Shenoy @ 2020-03-11  9:37 UTC (permalink / raw)
  To: Nathan Lynch, Michael Ellerman, Vaidyanathan Srinivasan,
	Kamalesh Babulal, Naveen N. Rao, Tyrel Datwyler
  Cc: linuxppc-dev, linux-kernel, Gautham R. Shenoy

From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>

On Pseries LPARs, to calculate utilization, we need to know the
[S]PURR ticks when the CPUs were busy or idle.

Via pseries_idle_prolog(), pseries_idle_epilog(), we track the idle
PURR ticks in the VPA variable "wait_state_cycles". This patch extends
the support to account for the idle SPURR ticks. It also provides an
accessor function to accurately reads idle SPURR ticks.

Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
---
 arch/powerpc/include/asm/idle.h        | 33 +++++++++++++++++++++++++++++++++
 arch/powerpc/platforms/pseries/setup.c |  2 ++
 2 files changed, 35 insertions(+)

diff --git a/arch/powerpc/include/asm/idle.h b/arch/powerpc/include/asm/idle.h
index 7552823..a375589 100644
--- a/arch/powerpc/include/asm/idle.h
+++ b/arch/powerpc/include/asm/idle.h
@@ -3,13 +3,20 @@
 #define _ASM_POWERPC_IDLE_H
 #include <asm/runlatch.h>
 
+DECLARE_PER_CPU(u64, idle_spurr_cycles);
 DECLARE_PER_CPU(u64, idle_entry_purr_snap);
+DECLARE_PER_CPU(u64, idle_entry_spurr_snap);
 
 static inline void snapshot_purr_idle_entry(void)
 {
 	*this_cpu_ptr(&idle_entry_purr_snap) = mfspr(SPRN_PURR);
 }
 
+static inline void snapshot_spurr_idle_entry(void)
+{
+	*this_cpu_ptr(&idle_entry_spurr_snap) = mfspr(SPRN_SPURR);
+}
+
 static inline void update_idle_purr_accounting(void)
 {
 	u64 wait_cycles;
@@ -20,10 +27,19 @@ static inline void update_idle_purr_accounting(void)
 	get_lppaca()->wait_state_cycles = cpu_to_be64(wait_cycles);
 }
 
+static inline void update_idle_spurr_accounting(void)
+{
+	u64 *idle_spurr_cycles_ptr = this_cpu_ptr(&idle_spurr_cycles);
+	u64 in_spurr = *this_cpu_ptr(&idle_entry_spurr_snap);
+
+	*idle_spurr_cycles_ptr += mfspr(SPRN_SPURR) - in_spurr;
+}
+
 static inline void pseries_idle_prolog(void)
 {
 	ppc64_runlatch_off();
 	snapshot_purr_idle_entry();
+	snapshot_spurr_idle_entry();
 	/*
 	 * Indicate to the HV that we are idle. Now would be
 	 * a good time to find other work to dispatch.
@@ -34,6 +50,7 @@ static inline void pseries_idle_prolog(void)
 static inline void pseries_idle_epilog(void)
 {
 	update_idle_purr_accounting();
+	update_idle_spurr_accounting();
 	get_lppaca()->idle = 0;
 	ppc64_runlatch_on();
 }
@@ -53,4 +70,20 @@ static inline u64 read_this_idle_purr(void)
 
 	return be64_to_cpu(get_lppaca()->wait_state_cycles);
 }
+
+static inline u64 read_this_idle_spurr(void)
+{
+	/*
+	 * If we are reading from an idle context, update the
+	 * idle-spurr cycles corresponding to the last idle period.
+	 * Since the idle context is not yet over, take a fresh
+	 * snapshot of the idle-spurr.
+	 */
+	if (get_lppaca()->idle == 1) {
+		update_idle_spurr_accounting();
+		snapshot_spurr_idle_entry();
+	}
+
+	return *this_cpu_ptr(&idle_spurr_cycles);
+}
 #endif
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 4905c96..1b55e80 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -318,7 +318,9 @@ static int alloc_dispatch_log_kmem_cache(void)
 }
 machine_early_initcall(pseries, alloc_dispatch_log_kmem_cache);
 
+DEFINE_PER_CPU(u64, idle_spurr_cycles);
 DEFINE_PER_CPU(u64, idle_entry_purr_snap);
+DEFINE_PER_CPU(u64, idle_entry_spurr_snap);
 static void pseries_lpar_idle(void)
 {
 	/*
-- 
1.9.4


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

* [PATCH v3 3/6] powerpc/pseries: Account for SPURR ticks on idle CPUs
@ 2020-03-11  9:37   ` Gautham R. Shenoy
  0 siblings, 0 replies; 19+ messages in thread
From: Gautham R. Shenoy @ 2020-03-11  9:37 UTC (permalink / raw)
  To: Nathan Lynch, Michael Ellerman, Vaidyanathan Srinivasan,
	Kamalesh Babulal, Naveen N. Rao, Tyrel Datwyler
  Cc: Gautham R. Shenoy, linuxppc-dev, linux-kernel

From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>

On Pseries LPARs, to calculate utilization, we need to know the
[S]PURR ticks when the CPUs were busy or idle.

Via pseries_idle_prolog(), pseries_idle_epilog(), we track the idle
PURR ticks in the VPA variable "wait_state_cycles". This patch extends
the support to account for the idle SPURR ticks. It also provides an
accessor function to accurately reads idle SPURR ticks.

Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
---
 arch/powerpc/include/asm/idle.h        | 33 +++++++++++++++++++++++++++++++++
 arch/powerpc/platforms/pseries/setup.c |  2 ++
 2 files changed, 35 insertions(+)

diff --git a/arch/powerpc/include/asm/idle.h b/arch/powerpc/include/asm/idle.h
index 7552823..a375589 100644
--- a/arch/powerpc/include/asm/idle.h
+++ b/arch/powerpc/include/asm/idle.h
@@ -3,13 +3,20 @@
 #define _ASM_POWERPC_IDLE_H
 #include <asm/runlatch.h>
 
+DECLARE_PER_CPU(u64, idle_spurr_cycles);
 DECLARE_PER_CPU(u64, idle_entry_purr_snap);
+DECLARE_PER_CPU(u64, idle_entry_spurr_snap);
 
 static inline void snapshot_purr_idle_entry(void)
 {
 	*this_cpu_ptr(&idle_entry_purr_snap) = mfspr(SPRN_PURR);
 }
 
+static inline void snapshot_spurr_idle_entry(void)
+{
+	*this_cpu_ptr(&idle_entry_spurr_snap) = mfspr(SPRN_SPURR);
+}
+
 static inline void update_idle_purr_accounting(void)
 {
 	u64 wait_cycles;
@@ -20,10 +27,19 @@ static inline void update_idle_purr_accounting(void)
 	get_lppaca()->wait_state_cycles = cpu_to_be64(wait_cycles);
 }
 
+static inline void update_idle_spurr_accounting(void)
+{
+	u64 *idle_spurr_cycles_ptr = this_cpu_ptr(&idle_spurr_cycles);
+	u64 in_spurr = *this_cpu_ptr(&idle_entry_spurr_snap);
+
+	*idle_spurr_cycles_ptr += mfspr(SPRN_SPURR) - in_spurr;
+}
+
 static inline void pseries_idle_prolog(void)
 {
 	ppc64_runlatch_off();
 	snapshot_purr_idle_entry();
+	snapshot_spurr_idle_entry();
 	/*
 	 * Indicate to the HV that we are idle. Now would be
 	 * a good time to find other work to dispatch.
@@ -34,6 +50,7 @@ static inline void pseries_idle_prolog(void)
 static inline void pseries_idle_epilog(void)
 {
 	update_idle_purr_accounting();
+	update_idle_spurr_accounting();
 	get_lppaca()->idle = 0;
 	ppc64_runlatch_on();
 }
@@ -53,4 +70,20 @@ static inline u64 read_this_idle_purr(void)
 
 	return be64_to_cpu(get_lppaca()->wait_state_cycles);
 }
+
+static inline u64 read_this_idle_spurr(void)
+{
+	/*
+	 * If we are reading from an idle context, update the
+	 * idle-spurr cycles corresponding to the last idle period.
+	 * Since the idle context is not yet over, take a fresh
+	 * snapshot of the idle-spurr.
+	 */
+	if (get_lppaca()->idle == 1) {
+		update_idle_spurr_accounting();
+		snapshot_spurr_idle_entry();
+	}
+
+	return *this_cpu_ptr(&idle_spurr_cycles);
+}
 #endif
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 4905c96..1b55e80 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -318,7 +318,9 @@ static int alloc_dispatch_log_kmem_cache(void)
 }
 machine_early_initcall(pseries, alloc_dispatch_log_kmem_cache);
 
+DEFINE_PER_CPU(u64, idle_spurr_cycles);
 DEFINE_PER_CPU(u64, idle_entry_purr_snap);
+DEFINE_PER_CPU(u64, idle_entry_spurr_snap);
 static void pseries_lpar_idle(void)
 {
 	/*
-- 
1.9.4


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

* [PATCH v3 4/6] powerpc/sysfs: Show idle_purr and idle_spurr for every CPU
  2020-03-11  9:37 ` Gautham R. Shenoy
@ 2020-03-11  9:37   ` Gautham R. Shenoy
  -1 siblings, 0 replies; 19+ messages in thread
From: Gautham R. Shenoy @ 2020-03-11  9:37 UTC (permalink / raw)
  To: Nathan Lynch, Michael Ellerman, Vaidyanathan Srinivasan,
	Kamalesh Babulal, Naveen N. Rao, Tyrel Datwyler
  Cc: linuxppc-dev, linux-kernel, Gautham R. Shenoy

From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>

On Pseries LPARs, to calculate utilization, we need to know the
[S]PURR ticks when the CPUs were busy or idle.

The total PURR and SPURR ticks are already exposed via the per-cpu
sysfs files "purr" and "spurr". This patch adds support for exposing
the idle PURR and SPURR ticks via new per-cpu sysfs files named
"idle_purr" and "idle_spurr".

Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
---
 arch/powerpc/kernel/sysfs.c | 54 ++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 51 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index 479c706..c9ddb83 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -19,6 +19,7 @@
 #include <asm/smp.h>
 #include <asm/pmc.h>
 #include <asm/firmware.h>
+#include <asm/idle.h>
 #include <asm/svm.h>
 
 #include "cacheinfo.h"
@@ -760,6 +761,42 @@ static void create_svm_file(void)
 }
 #endif /* CONFIG_PPC_SVM */
 
+static void read_idle_purr(void *val)
+{
+	u64 *ret = val;
+
+	*ret = read_this_idle_purr();
+}
+
+static ssize_t idle_purr_show(struct device *dev,
+			      struct device_attribute *attr, char *buf)
+{
+	struct cpu *cpu = container_of(dev, struct cpu, dev);
+	u64 val;
+
+	smp_call_function_single(cpu->dev.id, read_idle_purr, &val, 1);
+	return sprintf(buf, "%llx\n", val);
+}
+static DEVICE_ATTR(idle_purr, 0400, idle_purr_show, NULL);
+
+static void read_idle_spurr(void *val)
+{
+	u64 *ret = val;
+
+	*ret = read_this_idle_spurr();
+}
+
+static ssize_t idle_spurr_show(struct device *dev,
+			       struct device_attribute *attr, char *buf)
+{
+	struct cpu *cpu = container_of(dev, struct cpu, dev);
+	u64 val;
+
+	smp_call_function_single(cpu->dev.id, read_idle_spurr, &val, 1);
+	return sprintf(buf, "%llx\n", val);
+}
+static DEVICE_ATTR(idle_spurr, 0400, idle_spurr_show, NULL);
+
 static int register_cpu_online(unsigned int cpu)
 {
 	struct cpu *c = &per_cpu(cpu_devices, cpu);
@@ -823,10 +860,15 @@ static int register_cpu_online(unsigned int cpu)
 		if (!firmware_has_feature(FW_FEATURE_LPAR))
 			add_write_permission_dev_attr(&dev_attr_purr);
 		device_create_file(s, &dev_attr_purr);
+		if (firmware_has_feature(FW_FEATURE_LPAR))
+			device_create_file(s, &dev_attr_idle_purr);
 	}
 
-	if (cpu_has_feature(CPU_FTR_SPURR))
+	if (cpu_has_feature(CPU_FTR_SPURR)) {
 		device_create_file(s, &dev_attr_spurr);
+		if (firmware_has_feature(FW_FEATURE_LPAR))
+			device_create_file(s, &dev_attr_idle_spurr);
+	}
 
 	if (cpu_has_feature(CPU_FTR_DSCR))
 		device_create_file(s, &dev_attr_dscr);
@@ -910,11 +952,17 @@ static int unregister_cpu_online(unsigned int cpu)
 		device_remove_file(s, &dev_attr_mmcra);
 #endif /* CONFIG_PMU_SYSFS */
 
-	if (cpu_has_feature(CPU_FTR_PURR))
+	if (cpu_has_feature(CPU_FTR_PURR)) {
 		device_remove_file(s, &dev_attr_purr);
+		if (firmware_has_feature(FW_FEATURE_LPAR))
+			device_remove_file(s, &dev_attr_idle_purr);
+	}
 
-	if (cpu_has_feature(CPU_FTR_SPURR))
+	if (cpu_has_feature(CPU_FTR_SPURR)) {
 		device_remove_file(s, &dev_attr_spurr);
+		if (firmware_has_feature(FW_FEATURE_LPAR))
+			device_remove_file(s, &dev_attr_idle_spurr);
+	}
 
 	if (cpu_has_feature(CPU_FTR_DSCR))
 		device_remove_file(s, &dev_attr_dscr);
-- 
1.9.4


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

* [PATCH v3 4/6] powerpc/sysfs: Show idle_purr and idle_spurr for every CPU
@ 2020-03-11  9:37   ` Gautham R. Shenoy
  0 siblings, 0 replies; 19+ messages in thread
From: Gautham R. Shenoy @ 2020-03-11  9:37 UTC (permalink / raw)
  To: Nathan Lynch, Michael Ellerman, Vaidyanathan Srinivasan,
	Kamalesh Babulal, Naveen N. Rao, Tyrel Datwyler
  Cc: Gautham R. Shenoy, linuxppc-dev, linux-kernel

From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>

On Pseries LPARs, to calculate utilization, we need to know the
[S]PURR ticks when the CPUs were busy or idle.

The total PURR and SPURR ticks are already exposed via the per-cpu
sysfs files "purr" and "spurr". This patch adds support for exposing
the idle PURR and SPURR ticks via new per-cpu sysfs files named
"idle_purr" and "idle_spurr".

Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
---
 arch/powerpc/kernel/sysfs.c | 54 ++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 51 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index 479c706..c9ddb83 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -19,6 +19,7 @@
 #include <asm/smp.h>
 #include <asm/pmc.h>
 #include <asm/firmware.h>
+#include <asm/idle.h>
 #include <asm/svm.h>
 
 #include "cacheinfo.h"
@@ -760,6 +761,42 @@ static void create_svm_file(void)
 }
 #endif /* CONFIG_PPC_SVM */
 
+static void read_idle_purr(void *val)
+{
+	u64 *ret = val;
+
+	*ret = read_this_idle_purr();
+}
+
+static ssize_t idle_purr_show(struct device *dev,
+			      struct device_attribute *attr, char *buf)
+{
+	struct cpu *cpu = container_of(dev, struct cpu, dev);
+	u64 val;
+
+	smp_call_function_single(cpu->dev.id, read_idle_purr, &val, 1);
+	return sprintf(buf, "%llx\n", val);
+}
+static DEVICE_ATTR(idle_purr, 0400, idle_purr_show, NULL);
+
+static void read_idle_spurr(void *val)
+{
+	u64 *ret = val;
+
+	*ret = read_this_idle_spurr();
+}
+
+static ssize_t idle_spurr_show(struct device *dev,
+			       struct device_attribute *attr, char *buf)
+{
+	struct cpu *cpu = container_of(dev, struct cpu, dev);
+	u64 val;
+
+	smp_call_function_single(cpu->dev.id, read_idle_spurr, &val, 1);
+	return sprintf(buf, "%llx\n", val);
+}
+static DEVICE_ATTR(idle_spurr, 0400, idle_spurr_show, NULL);
+
 static int register_cpu_online(unsigned int cpu)
 {
 	struct cpu *c = &per_cpu(cpu_devices, cpu);
@@ -823,10 +860,15 @@ static int register_cpu_online(unsigned int cpu)
 		if (!firmware_has_feature(FW_FEATURE_LPAR))
 			add_write_permission_dev_attr(&dev_attr_purr);
 		device_create_file(s, &dev_attr_purr);
+		if (firmware_has_feature(FW_FEATURE_LPAR))
+			device_create_file(s, &dev_attr_idle_purr);
 	}
 
-	if (cpu_has_feature(CPU_FTR_SPURR))
+	if (cpu_has_feature(CPU_FTR_SPURR)) {
 		device_create_file(s, &dev_attr_spurr);
+		if (firmware_has_feature(FW_FEATURE_LPAR))
+			device_create_file(s, &dev_attr_idle_spurr);
+	}
 
 	if (cpu_has_feature(CPU_FTR_DSCR))
 		device_create_file(s, &dev_attr_dscr);
@@ -910,11 +952,17 @@ static int unregister_cpu_online(unsigned int cpu)
 		device_remove_file(s, &dev_attr_mmcra);
 #endif /* CONFIG_PMU_SYSFS */
 
-	if (cpu_has_feature(CPU_FTR_PURR))
+	if (cpu_has_feature(CPU_FTR_PURR)) {
 		device_remove_file(s, &dev_attr_purr);
+		if (firmware_has_feature(FW_FEATURE_LPAR))
+			device_remove_file(s, &dev_attr_idle_purr);
+	}
 
-	if (cpu_has_feature(CPU_FTR_SPURR))
+	if (cpu_has_feature(CPU_FTR_SPURR)) {
 		device_remove_file(s, &dev_attr_spurr);
+		if (firmware_has_feature(FW_FEATURE_LPAR))
+			device_remove_file(s, &dev_attr_idle_spurr);
+	}
 
 	if (cpu_has_feature(CPU_FTR_DSCR))
 		device_remove_file(s, &dev_attr_dscr);
-- 
1.9.4


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

* [PATCH v3 5/6] Documentation: Document sysfs interfaces purr, spurr, idle_purr, idle_spurr
  2020-03-11  9:37 ` Gautham R. Shenoy
@ 2020-03-11  9:37   ` Gautham R. Shenoy
  -1 siblings, 0 replies; 19+ messages in thread
From: Gautham R. Shenoy @ 2020-03-11  9:37 UTC (permalink / raw)
  To: Nathan Lynch, Michael Ellerman, Vaidyanathan Srinivasan,
	Kamalesh Babulal, Naveen N. Rao, Tyrel Datwyler
  Cc: linuxppc-dev, linux-kernel, Gautham R. Shenoy

From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>

Add documentation for the following sysfs interfaces:
/sys/devices/system/cpu/cpuX/purr
/sys/devices/system/cpu/cpuX/spurr
/sys/devices/system/cpu/cpuX/idle_purr
/sys/devices/system/cpu/cpuX/idle_spurr

Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
---
 Documentation/ABI/testing/sysfs-devices-system-cpu | 39 ++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-devices-system-cpu b/Documentation/ABI/testing/sysfs-devices-system-cpu
index 2e0e3b4..bc07677 100644
--- a/Documentation/ABI/testing/sysfs-devices-system-cpu
+++ b/Documentation/ABI/testing/sysfs-devices-system-cpu
@@ -580,3 +580,42 @@ Description:	Secure Virtual Machine
 		If 1, it means the system is using the Protected Execution
 		Facility in POWER9 and newer processors. i.e., it is a Secure
 		Virtual Machine.
+
+What: 		/sys/devices/system/cpu/cpuX/purr
+Date:		Apr 2005
+Contact:	Linux for PowerPC mailing list <linuxppc-dev@ozlabs.org>
+Description:	PURR ticks for this CPU since the system boot.
+
+		The Processor Utilization Resources Register (PURR) is
+		a 64-bit counter which provides an estimate of the
+		resources used by the CPU thread. The contents of this
+		register increases monotonically. This sysfs interface
+		exposes the number of PURR ticks for cpuX.
+
+What: 		/sys/devices/system/cpu/cpuX/spurr
+Date:		Dec 2006
+Contact:	Linux for PowerPC mailing list <linuxppc-dev@ozlabs.org>
+Description:	SPURR ticks for this CPU since the system boot.
+
+		The Scaled Processor Utilization Resources Register
+		(SPURR) is a 64-bit counter that provides a frequency
+		invariant estimate of the resources used by the CPU
+		thread. The contents of this register increases
+		monotonically. This sysfs interface exposes the number
+		of SPURR ticks for cpuX.
+
+What: 		/sys/devices/system/cpu/cpuX/idle_purr
+Date:		Mar 2020
+Contact:	Linux for PowerPC mailing list <linuxppc-dev@ozlabs.org>
+Description:	PURR ticks for cpuX when it was idle.
+
+		This sysfs interface exposes the number of PURR ticks
+		for cpuX when it was idle.
+
+What: 		/sys/devices/system/cpu/cpuX/idle_spurr
+Date:		Mar 2020
+Contact:	Linux for PowerPC mailing list <linuxppc-dev@ozlabs.org>
+Description:	SPURR ticks for cpuX when it was idle.
+
+		This sysfs interface exposes the number of SPURR ticks
+		for cpuX when it was idle.
-- 
1.9.4


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

* [PATCH v3 5/6] Documentation: Document sysfs interfaces purr, spurr, idle_purr, idle_spurr
@ 2020-03-11  9:37   ` Gautham R. Shenoy
  0 siblings, 0 replies; 19+ messages in thread
From: Gautham R. Shenoy @ 2020-03-11  9:37 UTC (permalink / raw)
  To: Nathan Lynch, Michael Ellerman, Vaidyanathan Srinivasan,
	Kamalesh Babulal, Naveen N. Rao, Tyrel Datwyler
  Cc: Gautham R. Shenoy, linuxppc-dev, linux-kernel

From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>

Add documentation for the following sysfs interfaces:
/sys/devices/system/cpu/cpuX/purr
/sys/devices/system/cpu/cpuX/spurr
/sys/devices/system/cpu/cpuX/idle_purr
/sys/devices/system/cpu/cpuX/idle_spurr

Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
---
 Documentation/ABI/testing/sysfs-devices-system-cpu | 39 ++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-devices-system-cpu b/Documentation/ABI/testing/sysfs-devices-system-cpu
index 2e0e3b4..bc07677 100644
--- a/Documentation/ABI/testing/sysfs-devices-system-cpu
+++ b/Documentation/ABI/testing/sysfs-devices-system-cpu
@@ -580,3 +580,42 @@ Description:	Secure Virtual Machine
 		If 1, it means the system is using the Protected Execution
 		Facility in POWER9 and newer processors. i.e., it is a Secure
 		Virtual Machine.
+
+What: 		/sys/devices/system/cpu/cpuX/purr
+Date:		Apr 2005
+Contact:	Linux for PowerPC mailing list <linuxppc-dev@ozlabs.org>
+Description:	PURR ticks for this CPU since the system boot.
+
+		The Processor Utilization Resources Register (PURR) is
+		a 64-bit counter which provides an estimate of the
+		resources used by the CPU thread. The contents of this
+		register increases monotonically. This sysfs interface
+		exposes the number of PURR ticks for cpuX.
+
+What: 		/sys/devices/system/cpu/cpuX/spurr
+Date:		Dec 2006
+Contact:	Linux for PowerPC mailing list <linuxppc-dev@ozlabs.org>
+Description:	SPURR ticks for this CPU since the system boot.
+
+		The Scaled Processor Utilization Resources Register
+		(SPURR) is a 64-bit counter that provides a frequency
+		invariant estimate of the resources used by the CPU
+		thread. The contents of this register increases
+		monotonically. This sysfs interface exposes the number
+		of SPURR ticks for cpuX.
+
+What: 		/sys/devices/system/cpu/cpuX/idle_purr
+Date:		Mar 2020
+Contact:	Linux for PowerPC mailing list <linuxppc-dev@ozlabs.org>
+Description:	PURR ticks for cpuX when it was idle.
+
+		This sysfs interface exposes the number of PURR ticks
+		for cpuX when it was idle.
+
+What: 		/sys/devices/system/cpu/cpuX/idle_spurr
+Date:		Mar 2020
+Contact:	Linux for PowerPC mailing list <linuxppc-dev@ozlabs.org>
+Description:	SPURR ticks for cpuX when it was idle.
+
+		This sysfs interface exposes the number of SPURR ticks
+		for cpuX when it was idle.
-- 
1.9.4


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

* [PATCH v3 6/6] pseries/sysfs: Minimise IPI noise while reading [idle_][s]purr
  2020-03-11  9:37 ` Gautham R. Shenoy
@ 2020-03-11  9:37   ` Gautham R. Shenoy
  -1 siblings, 0 replies; 19+ messages in thread
From: Gautham R. Shenoy @ 2020-03-11  9:37 UTC (permalink / raw)
  To: Nathan Lynch, Michael Ellerman, Vaidyanathan Srinivasan,
	Kamalesh Babulal, Naveen N. Rao, Tyrel Datwyler
  Cc: linuxppc-dev, linux-kernel, Gautham R. Shenoy

From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>

Currently purr, spurr, idle_purr, idle_spurr are exposed for every CPU
via the sysfs interface
/sys/devices/system/cpu/cpuX/[idle_][s]purr. Each sysfs read currently
generates an IPI to obtain the desired value from the target CPU X.
Since these aforementioned sysfs files are typically read one after
another, we end up generating 4 IPIs per CPU in a short duration.

In order to minimize the IPI noise, this patch caches the values of
all the four entities whenever one of them is read. If subsequently
any of these are read within the next 10ms, the cached value is
returned. With this, we will generate at most one IPI every 10ms for
every CPU.

Test-results: While reading the four sysfs files back-to-back for a
given CPU every second for 100 seconds.

Without the patch:
		 16 [XICS 2 Edge IPI] = 422 times
		 DBL [Doorbell interrupts] = 13 times
		 Total : 435 IPIs.

With the patch:
		  16 [XICS 2 Edge IPI] = 111 times
		  DBL [Doorbell interrupts] = 17 times
		  Total : 128 IPIs.

Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
---
 arch/powerpc/kernel/sysfs.c | 109 ++++++++++++++++++++++++++++++++++++--------
 1 file changed, 90 insertions(+), 19 deletions(-)

diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index c9ddb83..db8fc90 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -586,8 +586,6 @@ void ppc_enable_pmcs(void)
  * SPRs which are not related to PMU.
  */
 #ifdef CONFIG_PPC64
-SYSFS_SPRSETUP(purr, SPRN_PURR);
-SYSFS_SPRSETUP(spurr, SPRN_SPURR);
 SYSFS_SPRSETUP(pir, SPRN_PIR);
 SYSFS_SPRSETUP(tscr, SPRN_TSCR);
 
@@ -596,8 +594,6 @@ void ppc_enable_pmcs(void)
   enable write when needed with a separate function.
   Lets be conservative and default to pseries.
 */
-static DEVICE_ATTR(spurr, 0400, show_spurr, NULL);
-static DEVICE_ATTR(purr, 0400, show_purr, store_purr);
 static DEVICE_ATTR(pir, 0400, show_pir, NULL);
 static DEVICE_ATTR(tscr, 0600, show_tscr, store_tscr);
 #endif /* CONFIG_PPC64 */
@@ -761,39 +757,114 @@ static void create_svm_file(void)
 }
 #endif /* CONFIG_PPC_SVM */
 
-static void read_idle_purr(void *val)
+/*
+ * The duration (in ms) from the last IPI to the target CPU until
+ * which a cached value of purr, spurr, idle_purr, idle_spurr can be
+ * reported to the user on a corresponding sysfs file read. Beyond
+ * this duration, fresh values need to be obtained by sending IPIs to
+ * the target CPU when the sysfs files are read.
+ */
+static unsigned long util_stats_staleness_tolerance_ms = 10;
+struct util_acct_stats {
+	u64 latest_purr;
+	u64 latest_spurr;
+	u64 latest_idle_purr;
+	u64 latest_idle_spurr;
+	unsigned long last_update_jiffies;
+};
+
+DEFINE_PER_CPU(struct util_acct_stats, util_acct_stats);
+
+static void update_util_acct_stats(void *ptr)
 {
-	u64 *ret = val;
+	struct util_acct_stats *stats = ptr;
 
-	*ret = read_this_idle_purr();
+	stats->latest_purr = mfspr(SPRN_PURR);
+	stats->latest_spurr = mfspr(SPRN_SPURR);
+	stats->latest_idle_purr = read_this_idle_purr();
+	stats->latest_idle_spurr = read_this_idle_spurr();
+	stats->last_update_jiffies = jiffies;
 }
 
-static ssize_t idle_purr_show(struct device *dev,
-			      struct device_attribute *attr, char *buf)
+struct util_acct_stats *get_util_stats_ptr(int cpu)
+{
+	struct util_acct_stats *stats = per_cpu_ptr(&util_acct_stats, cpu);
+	unsigned long delta_jiffies;
+
+	delta_jiffies = jiffies - stats->last_update_jiffies;
+
+	/*
+	 * If we have a recent enough data, reuse that instead of
+	 * sending an IPI.
+	 */
+	if (jiffies_to_msecs(delta_jiffies) < util_stats_staleness_tolerance_ms)
+		return stats;
+
+	smp_call_function_single(cpu, update_util_acct_stats, stats, 1);
+	return stats;
+}
+
+static ssize_t show_purr(struct device *dev,
+			 struct device_attribute *attr, char *buf)
 {
 	struct cpu *cpu = container_of(dev, struct cpu, dev);
-	u64 val;
+	struct util_acct_stats *stats;
 
-	smp_call_function_single(cpu->dev.id, read_idle_purr, &val, 1);
-	return sprintf(buf, "%llx\n", val);
+	stats = get_util_stats_ptr(cpu->dev.id);
+	return sprintf(buf, "%llx\n", stats->latest_purr);
 }
-static DEVICE_ATTR(idle_purr, 0400, idle_purr_show, NULL);
 
-static void read_idle_spurr(void *val)
+static void write_purr(void *val)
 {
-	u64 *ret = val;
+	mtspr(SPRN_PURR, *(unsigned long *)val);
+}
 
-	*ret = read_this_idle_spurr();
+static ssize_t __used store_purr(struct device *dev,
+				 struct device_attribute *attr,
+				 const char *buf, size_t count)
+{
+	struct cpu *cpu = container_of(dev, struct cpu, dev);
+	unsigned long val;
+	int ret = kstrtoul(buf, 16, &val);
+
+	if (ret != 0)
+		return -EINVAL;
+
+	smp_call_function_single(cpu->dev.id, write_purr, &val, 1);
+	return count;
+}
+static DEVICE_ATTR(purr, 0400, show_purr, store_purr);
+
+static ssize_t show_spurr(struct device *dev,
+			  struct device_attribute *attr, char *buf)
+{
+	struct cpu *cpu = container_of(dev, struct cpu, dev);
+	struct util_acct_stats *stats;
+
+	stats = get_util_stats_ptr(cpu->dev.id);
+	return sprintf(buf, "%llx\n", stats->latest_spurr);
 }
+static DEVICE_ATTR(spurr, 0400, show_spurr, NULL);
+
+static ssize_t idle_purr_show(struct device *dev,
+			      struct device_attribute *attr, char *buf)
+{
+	struct cpu *cpu = container_of(dev, struct cpu, dev);
+	struct util_acct_stats *stats;
+
+	stats = get_util_stats_ptr(cpu->dev.id);
+	return sprintf(buf, "%llx\n", stats->latest_idle_purr);
+}
+static DEVICE_ATTR(idle_purr, 0400, idle_purr_show, NULL);
 
 static ssize_t idle_spurr_show(struct device *dev,
 			       struct device_attribute *attr, char *buf)
 {
 	struct cpu *cpu = container_of(dev, struct cpu, dev);
-	u64 val;
+	struct util_acct_stats *stats;
 
-	smp_call_function_single(cpu->dev.id, read_idle_spurr, &val, 1);
-	return sprintf(buf, "%llx\n", val);
+	stats =  get_util_stats_ptr(cpu->dev.id);
+	return sprintf(buf, "%llx\n", stats->latest_idle_spurr);
 }
 static DEVICE_ATTR(idle_spurr, 0400, idle_spurr_show, NULL);
 
-- 
1.9.4


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

* [PATCH v3 6/6] pseries/sysfs: Minimise IPI noise while reading [idle_][s]purr
@ 2020-03-11  9:37   ` Gautham R. Shenoy
  0 siblings, 0 replies; 19+ messages in thread
From: Gautham R. Shenoy @ 2020-03-11  9:37 UTC (permalink / raw)
  To: Nathan Lynch, Michael Ellerman, Vaidyanathan Srinivasan,
	Kamalesh Babulal, Naveen N. Rao, Tyrel Datwyler
  Cc: Gautham R. Shenoy, linuxppc-dev, linux-kernel

From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>

Currently purr, spurr, idle_purr, idle_spurr are exposed for every CPU
via the sysfs interface
/sys/devices/system/cpu/cpuX/[idle_][s]purr. Each sysfs read currently
generates an IPI to obtain the desired value from the target CPU X.
Since these aforementioned sysfs files are typically read one after
another, we end up generating 4 IPIs per CPU in a short duration.

In order to minimize the IPI noise, this patch caches the values of
all the four entities whenever one of them is read. If subsequently
any of these are read within the next 10ms, the cached value is
returned. With this, we will generate at most one IPI every 10ms for
every CPU.

Test-results: While reading the four sysfs files back-to-back for a
given CPU every second for 100 seconds.

Without the patch:
		 16 [XICS 2 Edge IPI] = 422 times
		 DBL [Doorbell interrupts] = 13 times
		 Total : 435 IPIs.

With the patch:
		  16 [XICS 2 Edge IPI] = 111 times
		  DBL [Doorbell interrupts] = 17 times
		  Total : 128 IPIs.

Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
---
 arch/powerpc/kernel/sysfs.c | 109 ++++++++++++++++++++++++++++++++++++--------
 1 file changed, 90 insertions(+), 19 deletions(-)

diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index c9ddb83..db8fc90 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -586,8 +586,6 @@ void ppc_enable_pmcs(void)
  * SPRs which are not related to PMU.
  */
 #ifdef CONFIG_PPC64
-SYSFS_SPRSETUP(purr, SPRN_PURR);
-SYSFS_SPRSETUP(spurr, SPRN_SPURR);
 SYSFS_SPRSETUP(pir, SPRN_PIR);
 SYSFS_SPRSETUP(tscr, SPRN_TSCR);
 
@@ -596,8 +594,6 @@ void ppc_enable_pmcs(void)
   enable write when needed with a separate function.
   Lets be conservative and default to pseries.
 */
-static DEVICE_ATTR(spurr, 0400, show_spurr, NULL);
-static DEVICE_ATTR(purr, 0400, show_purr, store_purr);
 static DEVICE_ATTR(pir, 0400, show_pir, NULL);
 static DEVICE_ATTR(tscr, 0600, show_tscr, store_tscr);
 #endif /* CONFIG_PPC64 */
@@ -761,39 +757,114 @@ static void create_svm_file(void)
 }
 #endif /* CONFIG_PPC_SVM */
 
-static void read_idle_purr(void *val)
+/*
+ * The duration (in ms) from the last IPI to the target CPU until
+ * which a cached value of purr, spurr, idle_purr, idle_spurr can be
+ * reported to the user on a corresponding sysfs file read. Beyond
+ * this duration, fresh values need to be obtained by sending IPIs to
+ * the target CPU when the sysfs files are read.
+ */
+static unsigned long util_stats_staleness_tolerance_ms = 10;
+struct util_acct_stats {
+	u64 latest_purr;
+	u64 latest_spurr;
+	u64 latest_idle_purr;
+	u64 latest_idle_spurr;
+	unsigned long last_update_jiffies;
+};
+
+DEFINE_PER_CPU(struct util_acct_stats, util_acct_stats);
+
+static void update_util_acct_stats(void *ptr)
 {
-	u64 *ret = val;
+	struct util_acct_stats *stats = ptr;
 
-	*ret = read_this_idle_purr();
+	stats->latest_purr = mfspr(SPRN_PURR);
+	stats->latest_spurr = mfspr(SPRN_SPURR);
+	stats->latest_idle_purr = read_this_idle_purr();
+	stats->latest_idle_spurr = read_this_idle_spurr();
+	stats->last_update_jiffies = jiffies;
 }
 
-static ssize_t idle_purr_show(struct device *dev,
-			      struct device_attribute *attr, char *buf)
+struct util_acct_stats *get_util_stats_ptr(int cpu)
+{
+	struct util_acct_stats *stats = per_cpu_ptr(&util_acct_stats, cpu);
+	unsigned long delta_jiffies;
+
+	delta_jiffies = jiffies - stats->last_update_jiffies;
+
+	/*
+	 * If we have a recent enough data, reuse that instead of
+	 * sending an IPI.
+	 */
+	if (jiffies_to_msecs(delta_jiffies) < util_stats_staleness_tolerance_ms)
+		return stats;
+
+	smp_call_function_single(cpu, update_util_acct_stats, stats, 1);
+	return stats;
+}
+
+static ssize_t show_purr(struct device *dev,
+			 struct device_attribute *attr, char *buf)
 {
 	struct cpu *cpu = container_of(dev, struct cpu, dev);
-	u64 val;
+	struct util_acct_stats *stats;
 
-	smp_call_function_single(cpu->dev.id, read_idle_purr, &val, 1);
-	return sprintf(buf, "%llx\n", val);
+	stats = get_util_stats_ptr(cpu->dev.id);
+	return sprintf(buf, "%llx\n", stats->latest_purr);
 }
-static DEVICE_ATTR(idle_purr, 0400, idle_purr_show, NULL);
 
-static void read_idle_spurr(void *val)
+static void write_purr(void *val)
 {
-	u64 *ret = val;
+	mtspr(SPRN_PURR, *(unsigned long *)val);
+}
 
-	*ret = read_this_idle_spurr();
+static ssize_t __used store_purr(struct device *dev,
+				 struct device_attribute *attr,
+				 const char *buf, size_t count)
+{
+	struct cpu *cpu = container_of(dev, struct cpu, dev);
+	unsigned long val;
+	int ret = kstrtoul(buf, 16, &val);
+
+	if (ret != 0)
+		return -EINVAL;
+
+	smp_call_function_single(cpu->dev.id, write_purr, &val, 1);
+	return count;
+}
+static DEVICE_ATTR(purr, 0400, show_purr, store_purr);
+
+static ssize_t show_spurr(struct device *dev,
+			  struct device_attribute *attr, char *buf)
+{
+	struct cpu *cpu = container_of(dev, struct cpu, dev);
+	struct util_acct_stats *stats;
+
+	stats = get_util_stats_ptr(cpu->dev.id);
+	return sprintf(buf, "%llx\n", stats->latest_spurr);
 }
+static DEVICE_ATTR(spurr, 0400, show_spurr, NULL);
+
+static ssize_t idle_purr_show(struct device *dev,
+			      struct device_attribute *attr, char *buf)
+{
+	struct cpu *cpu = container_of(dev, struct cpu, dev);
+	struct util_acct_stats *stats;
+
+	stats = get_util_stats_ptr(cpu->dev.id);
+	return sprintf(buf, "%llx\n", stats->latest_idle_purr);
+}
+static DEVICE_ATTR(idle_purr, 0400, idle_purr_show, NULL);
 
 static ssize_t idle_spurr_show(struct device *dev,
 			       struct device_attribute *attr, char *buf)
 {
 	struct cpu *cpu = container_of(dev, struct cpu, dev);
-	u64 val;
+	struct util_acct_stats *stats;
 
-	smp_call_function_single(cpu->dev.id, read_idle_spurr, &val, 1);
-	return sprintf(buf, "%llx\n", val);
+	stats =  get_util_stats_ptr(cpu->dev.id);
+	return sprintf(buf, "%llx\n", stats->latest_idle_spurr);
 }
 static DEVICE_ATTR(idle_spurr, 0400, idle_spurr_show, NULL);
 
-- 
1.9.4


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

* Re: [PATCH v3 4/6] powerpc/sysfs: Show idle_purr and idle_spurr for every CPU
  2020-03-11  9:37   ` Gautham R. Shenoy
  (?)
@ 2020-03-11 22:30   ` kbuild test robot
  -1 siblings, 0 replies; 19+ messages in thread
From: kbuild test robot @ 2020-03-11 22:30 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 14955 bytes --]

Hi "Gautham,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on powerpc/next]
[also build test ERROR on linus/master v5.6-rc5 next-20200311]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Gautham-R-Shenoy/Track-and-expose-idle-PURR-and-SPURR-ticks/20200312-041724
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-fsp2_defconfig (attached as .config)
compiler: powerpc-linux-gcc (GCC) 9.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=9.2.0 make.cross ARCH=powerpc 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All error/warnings (new ones prefixed by >>):

   In file included from include/linux/byteorder/big_endian.h:5,
                    from arch/powerpc/include/uapi/asm/byteorder.h:14,
                    from include/asm-generic/bitops/le.h:6,
                    from arch/powerpc/include/asm/bitops.h:250,
                    from include/linux/bitops.h:29,
                    from include/linux/kernel.h:12,
                    from include/linux/list.h:9,
                    from include/linux/rculist.h:10,
                    from include/linux/pid.h:5,
                    from include/linux/sched.h:14,
                    from include/linux/ratelimit.h:6,
                    from include/linux/dev_printk.h:16,
                    from include/linux/device.h:15,
                    from arch/powerpc/kernel/sysfs.c:2:
   arch/powerpc/include/asm/idle.h: In function 'update_idle_purr_accounting':
>> arch/powerpc/include/asm/idle.h:25:28: error: implicit declaration of function 'get_lppaca'; did you mean 'get_page'? [-Werror=implicit-function-declaration]
      25 |  wait_cycles = be64_to_cpu(get_lppaca()->wait_state_cycles);
         |                            ^~~~~~~~~~
   include/uapi/linux/byteorder/big_endian.h:38:51: note: in definition of macro '__be64_to_cpu'
      38 | #define __be64_to_cpu(x) ((__force __u64)(__be64)(x))
         |                                                   ^
   arch/powerpc/include/asm/idle.h:25:16: note: in expansion of macro 'be64_to_cpu'
      25 |  wait_cycles = be64_to_cpu(get_lppaca()->wait_state_cycles);
         |                ^~~~~~~~~~~
   arch/powerpc/include/asm/idle.h:25:40: error: invalid type argument of '->' (have 'int')
      25 |  wait_cycles = be64_to_cpu(get_lppaca()->wait_state_cycles);
         |                                        ^~
   include/uapi/linux/byteorder/big_endian.h:38:51: note: in definition of macro '__be64_to_cpu'
      38 | #define __be64_to_cpu(x) ((__force __u64)(__be64)(x))
         |                                                   ^
   arch/powerpc/include/asm/idle.h:25:16: note: in expansion of macro 'be64_to_cpu'
      25 |  wait_cycles = be64_to_cpu(get_lppaca()->wait_state_cycles);
         |                ^~~~~~~~~~~
   In file included from arch/powerpc/kernel/sysfs.c:22:
   arch/powerpc/include/asm/idle.h:27:14: error: invalid type argument of '->' (have 'int')
      27 |  get_lppaca()->wait_state_cycles = cpu_to_be64(wait_cycles);
         |              ^~
   arch/powerpc/include/asm/idle.h: In function 'pseries_idle_prolog':
   arch/powerpc/include/asm/idle.h:47:14: error: invalid type argument of '->' (have 'int')
      47 |  get_lppaca()->idle = 1;
         |              ^~
   arch/powerpc/include/asm/idle.h: In function 'pseries_idle_epilog':
   arch/powerpc/include/asm/idle.h:54:14: error: invalid type argument of '->' (have 'int')
      54 |  get_lppaca()->idle = 0;
         |              ^~
   In file included from include/linux/dev_printk.h:14,
                    from include/linux/device.h:15,
                    from arch/powerpc/kernel/sysfs.c:2:
   arch/powerpc/include/asm/idle.h: In function 'read_this_idle_purr':
   arch/powerpc/include/asm/idle.h:66:27: error: invalid type argument of '->' (have 'int')
      66 |  if (unlikely(get_lppaca()->idle == 1)) {
         |                           ^~
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   In file included from include/linux/byteorder/big_endian.h:5,
                    from arch/powerpc/include/uapi/asm/byteorder.h:14,
                    from include/asm-generic/bitops/le.h:6,
                    from arch/powerpc/include/asm/bitops.h:250,
                    from include/linux/bitops.h:29,
                    from include/linux/kernel.h:12,
                    from include/linux/list.h:9,
                    from include/linux/rculist.h:10,
                    from include/linux/pid.h:5,
                    from include/linux/sched.h:14,
                    from include/linux/ratelimit.h:6,
                    from include/linux/dev_printk.h:16,
                    from include/linux/device.h:15,
                    from arch/powerpc/kernel/sysfs.c:2:
   arch/powerpc/include/asm/idle.h:71:33: error: invalid type argument of '->' (have 'int')
      71 |  return be64_to_cpu(get_lppaca()->wait_state_cycles);
         |                                 ^~
   include/uapi/linux/byteorder/big_endian.h:38:51: note: in definition of macro '__be64_to_cpu'
      38 | #define __be64_to_cpu(x) ((__force __u64)(__be64)(x))
         |                                                   ^
   arch/powerpc/include/asm/idle.h:71:9: note: in expansion of macro 'be64_to_cpu'
      71 |  return be64_to_cpu(get_lppaca()->wait_state_cycles);
         |         ^~~~~~~~~~~
   In file included from arch/powerpc/kernel/sysfs.c:22:
   arch/powerpc/include/asm/idle.h: In function 'read_this_idle_spurr':
   arch/powerpc/include/asm/idle.h:82:18: error: invalid type argument of '->' (have 'int')
      82 |  if (get_lppaca()->idle == 1) {
         |                  ^~
   In file included from arch/powerpc/kernel/sysfs.c:2:
   At top level:
>> include/linux/device.h:126:26: error: 'dev_attr_idle_spurr' defined but not used [-Werror=unused-variable]
     126 |  struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
         |                          ^~~~~~~~~
>> arch/powerpc/kernel/sysfs.c:798:8: note: in expansion of macro 'DEVICE_ATTR'
     798 | static DEVICE_ATTR(idle_spurr, 0400, idle_spurr_show, NULL);
         |        ^~~~~~~~~~~
>> include/linux/device.h:126:26: error: 'dev_attr_idle_purr' defined but not used [-Werror=unused-variable]
     126 |  struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
         |                          ^~~~~~~~~
   arch/powerpc/kernel/sysfs.c:780:8: note: in expansion of macro 'DEVICE_ATTR'
     780 | static DEVICE_ATTR(idle_purr, 0400, idle_purr_show, NULL);
         |        ^~~~~~~~~~~
   cc1: all warnings being treated as errors
--
   In file included from include/linux/byteorder/big_endian.h:5,
                    from arch/powerpc/include/uapi/asm/byteorder.h:14,
                    from include/asm-generic/bitops/le.h:6,
                    from arch/powerpc/include/asm/bitops.h:250,
                    from include/linux/bitops.h:29,
                    from include/linux/kernel.h:12,
                    from include/linux/list.h:9,
                    from include/linux/rculist.h:10,
                    from include/linux/pid.h:5,
                    from include/linux/sched.h:14,
                    from include/linux/ratelimit.h:6,
                    from include/linux/dev_printk.h:16,
                    from include/linux/device.h:15,
                    from arch/powerpc//kernel/sysfs.c:2:
   arch/powerpc/include/asm/idle.h: In function 'update_idle_purr_accounting':
>> arch/powerpc/include/asm/idle.h:25:28: error: implicit declaration of function 'get_lppaca'; did you mean 'get_page'? [-Werror=implicit-function-declaration]
      25 |  wait_cycles = be64_to_cpu(get_lppaca()->wait_state_cycles);
         |                            ^~~~~~~~~~
   include/uapi/linux/byteorder/big_endian.h:38:51: note: in definition of macro '__be64_to_cpu'
      38 | #define __be64_to_cpu(x) ((__force __u64)(__be64)(x))
         |                                                   ^
   arch/powerpc/include/asm/idle.h:25:16: note: in expansion of macro 'be64_to_cpu'
      25 |  wait_cycles = be64_to_cpu(get_lppaca()->wait_state_cycles);
         |                ^~~~~~~~~~~
   arch/powerpc/include/asm/idle.h:25:40: error: invalid type argument of '->' (have 'int')
      25 |  wait_cycles = be64_to_cpu(get_lppaca()->wait_state_cycles);
         |                                        ^~
   include/uapi/linux/byteorder/big_endian.h:38:51: note: in definition of macro '__be64_to_cpu'
      38 | #define __be64_to_cpu(x) ((__force __u64)(__be64)(x))
         |                                                   ^
   arch/powerpc/include/asm/idle.h:25:16: note: in expansion of macro 'be64_to_cpu'
      25 |  wait_cycles = be64_to_cpu(get_lppaca()->wait_state_cycles);
         |                ^~~~~~~~~~~
   In file included from arch/powerpc//kernel/sysfs.c:22:
   arch/powerpc/include/asm/idle.h:27:14: error: invalid type argument of '->' (have 'int')
      27 |  get_lppaca()->wait_state_cycles = cpu_to_be64(wait_cycles);
         |              ^~
   arch/powerpc/include/asm/idle.h: In function 'pseries_idle_prolog':
   arch/powerpc/include/asm/idle.h:47:14: error: invalid type argument of '->' (have 'int')
      47 |  get_lppaca()->idle = 1;
         |              ^~
   arch/powerpc/include/asm/idle.h: In function 'pseries_idle_epilog':
   arch/powerpc/include/asm/idle.h:54:14: error: invalid type argument of '->' (have 'int')
      54 |  get_lppaca()->idle = 0;
         |              ^~
   In file included from include/linux/dev_printk.h:14,
                    from include/linux/device.h:15,
                    from arch/powerpc//kernel/sysfs.c:2:
   arch/powerpc/include/asm/idle.h: In function 'read_this_idle_purr':
   arch/powerpc/include/asm/idle.h:66:27: error: invalid type argument of '->' (have 'int')
      66 |  if (unlikely(get_lppaca()->idle == 1)) {
         |                           ^~
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   In file included from include/linux/byteorder/big_endian.h:5,
                    from arch/powerpc/include/uapi/asm/byteorder.h:14,
                    from include/asm-generic/bitops/le.h:6,
                    from arch/powerpc/include/asm/bitops.h:250,
                    from include/linux/bitops.h:29,
                    from include/linux/kernel.h:12,
                    from include/linux/list.h:9,
                    from include/linux/rculist.h:10,
                    from include/linux/pid.h:5,
                    from include/linux/sched.h:14,
                    from include/linux/ratelimit.h:6,
                    from include/linux/dev_printk.h:16,
                    from include/linux/device.h:15,
                    from arch/powerpc//kernel/sysfs.c:2:
   arch/powerpc/include/asm/idle.h:71:33: error: invalid type argument of '->' (have 'int')
      71 |  return be64_to_cpu(get_lppaca()->wait_state_cycles);
         |                                 ^~
   include/uapi/linux/byteorder/big_endian.h:38:51: note: in definition of macro '__be64_to_cpu'
      38 | #define __be64_to_cpu(x) ((__force __u64)(__be64)(x))
         |                                                   ^
   arch/powerpc/include/asm/idle.h:71:9: note: in expansion of macro 'be64_to_cpu'
      71 |  return be64_to_cpu(get_lppaca()->wait_state_cycles);
         |         ^~~~~~~~~~~
   In file included from arch/powerpc//kernel/sysfs.c:22:
   arch/powerpc/include/asm/idle.h: In function 'read_this_idle_spurr':
   arch/powerpc/include/asm/idle.h:82:18: error: invalid type argument of '->' (have 'int')
      82 |  if (get_lppaca()->idle == 1) {
         |                  ^~
   In file included from arch/powerpc//kernel/sysfs.c:2:
   At top level:
>> include/linux/device.h:126:26: error: 'dev_attr_idle_spurr' defined but not used [-Werror=unused-variable]
     126 |  struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
         |                          ^~~~~~~~~
   arch/powerpc//kernel/sysfs.c:798:8: note: in expansion of macro 'DEVICE_ATTR'
     798 | static DEVICE_ATTR(idle_spurr, 0400, idle_spurr_show, NULL);
         |        ^~~~~~~~~~~
>> include/linux/device.h:126:26: error: 'dev_attr_idle_purr' defined but not used [-Werror=unused-variable]
     126 |  struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
         |                          ^~~~~~~~~
   arch/powerpc//kernel/sysfs.c:780:8: note: in expansion of macro 'DEVICE_ATTR'
     780 | static DEVICE_ATTR(idle_purr, 0400, idle_purr_show, NULL);
         |        ^~~~~~~~~~~
   cc1: all warnings being treated as errors

vim +25 arch/powerpc/include/asm/idle.h

03d989e21479c7 Gautham R. Shenoy 2020-03-11  19  
2452f5988544ea Gautham R. Shenoy 2020-03-11  20  static inline void update_idle_purr_accounting(void)
2452f5988544ea Gautham R. Shenoy 2020-03-11  21  {
2452f5988544ea Gautham R. Shenoy 2020-03-11  22  	u64 wait_cycles;
2452f5988544ea Gautham R. Shenoy 2020-03-11  23  	u64 in_purr = *this_cpu_ptr(&idle_entry_purr_snap);
2452f5988544ea Gautham R. Shenoy 2020-03-11  24  
2452f5988544ea Gautham R. Shenoy 2020-03-11 @25  	wait_cycles = be64_to_cpu(get_lppaca()->wait_state_cycles);
2452f5988544ea Gautham R. Shenoy 2020-03-11  26  	wait_cycles += mfspr(SPRN_PURR) - in_purr;
2452f5988544ea Gautham R. Shenoy 2020-03-11  27  	get_lppaca()->wait_state_cycles = cpu_to_be64(wait_cycles);
2452f5988544ea Gautham R. Shenoy 2020-03-11  28  }
2452f5988544ea Gautham R. Shenoy 2020-03-11  29  

:::::: The code at line 25 was first introduced by commit
:::::: 2452f5988544eaae0c9f73103c2f7083ef4e2fa7 powerpc/idle: Add accessor function to always read latest idle PURR

:::::: TO: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
:::::: CC: 0day robot <lkp@intel.com>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 15487 bytes --]

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

* Re: [PATCH v3 6/6] pseries/sysfs: Minimise IPI noise while reading [idle_][s]purr
  2020-03-11  9:37   ` Gautham R. Shenoy
  (?)
@ 2020-03-11 23:12   ` kbuild test robot
  -1 siblings, 0 replies; 19+ messages in thread
From: kbuild test robot @ 2020-03-11 23:12 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 19921 bytes --]

Hi "Gautham,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on powerpc/next]
[also build test ERROR on next-20200311]
[cannot apply to linus/master v5.6-rc5]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Gautham-R-Shenoy/Track-and-expose-idle-PURR-and-SPURR-ticks/20200312-041724
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-fsp2_defconfig (attached as .config)
compiler: powerpc-linux-gcc (GCC) 9.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=9.2.0 make.cross ARCH=powerpc 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

                    from arch/powerpc/include/uapi/asm/byteorder.h:14,
                    from include/asm-generic/bitops/le.h:6,
                    from arch/powerpc/include/asm/bitops.h:250,
                    from include/linux/bitops.h:29,
                    from include/linux/kernel.h:12,
                    from include/linux/list.h:9,
                    from include/linux/rculist.h:10,
                    from include/linux/pid.h:5,
                    from include/linux/sched.h:14,
                    from include/linux/ratelimit.h:6,
                    from include/linux/dev_printk.h:16,
                    from include/linux/device.h:15,
                    from arch/powerpc/kernel/sysfs.c:2:
   arch/powerpc/include/asm/idle.h: In function 'update_idle_purr_accounting':
   arch/powerpc/include/asm/idle.h:25:28: error: implicit declaration of function 'get_lppaca'; did you mean 'get_page'? [-Werror=implicit-function-declaration]
      25 |  wait_cycles = be64_to_cpu(get_lppaca()->wait_state_cycles);
         |                            ^~~~~~~~~~
   include/uapi/linux/byteorder/big_endian.h:38:51: note: in definition of macro '__be64_to_cpu'
      38 | #define __be64_to_cpu(x) ((__force __u64)(__be64)(x))
         |                                                   ^
   arch/powerpc/include/asm/idle.h:25:16: note: in expansion of macro 'be64_to_cpu'
      25 |  wait_cycles = be64_to_cpu(get_lppaca()->wait_state_cycles);
         |                ^~~~~~~~~~~
   arch/powerpc/include/asm/idle.h:25:40: error: invalid type argument of '->' (have 'int')
      25 |  wait_cycles = be64_to_cpu(get_lppaca()->wait_state_cycles);
         |                                        ^~
   include/uapi/linux/byteorder/big_endian.h:38:51: note: in definition of macro '__be64_to_cpu'
      38 | #define __be64_to_cpu(x) ((__force __u64)(__be64)(x))
         |                                                   ^
   arch/powerpc/include/asm/idle.h:25:16: note: in expansion of macro 'be64_to_cpu'
      25 |  wait_cycles = be64_to_cpu(get_lppaca()->wait_state_cycles);
         |                ^~~~~~~~~~~
   In file included from arch/powerpc/kernel/sysfs.c:22:
   arch/powerpc/include/asm/idle.h:27:14: error: invalid type argument of '->' (have 'int')
      27 |  get_lppaca()->wait_state_cycles = cpu_to_be64(wait_cycles);
         |              ^~
   arch/powerpc/include/asm/idle.h: In function 'pseries_idle_prolog':
   arch/powerpc/include/asm/idle.h:47:14: error: invalid type argument of '->' (have 'int')
      47 |  get_lppaca()->idle = 1;
         |              ^~
   arch/powerpc/include/asm/idle.h: In function 'pseries_idle_epilog':
   arch/powerpc/include/asm/idle.h:54:14: error: invalid type argument of '->' (have 'int')
      54 |  get_lppaca()->idle = 0;
         |              ^~
   In file included from include/linux/dev_printk.h:14,
                    from include/linux/device.h:15,
                    from arch/powerpc/kernel/sysfs.c:2:
   arch/powerpc/include/asm/idle.h: In function 'read_this_idle_purr':
   arch/powerpc/include/asm/idle.h:66:27: error: invalid type argument of '->' (have 'int')
      66 |  if (unlikely(get_lppaca()->idle == 1)) {
         |                           ^~
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   In file included from include/linux/byteorder/big_endian.h:5,
                    from arch/powerpc/include/uapi/asm/byteorder.h:14,
                    from include/asm-generic/bitops/le.h:6,
                    from arch/powerpc/include/asm/bitops.h:250,
                    from include/linux/bitops.h:29,
                    from include/linux/kernel.h:12,
                    from include/linux/list.h:9,
                    from include/linux/rculist.h:10,
                    from include/linux/pid.h:5,
                    from include/linux/sched.h:14,
                    from include/linux/ratelimit.h:6,
                    from include/linux/dev_printk.h:16,
                    from include/linux/device.h:15,
                    from arch/powerpc/kernel/sysfs.c:2:
   arch/powerpc/include/asm/idle.h:71:33: error: invalid type argument of '->' (have 'int')
      71 |  return be64_to_cpu(get_lppaca()->wait_state_cycles);
         |                                 ^~
   include/uapi/linux/byteorder/big_endian.h:38:51: note: in definition of macro '__be64_to_cpu'
      38 | #define __be64_to_cpu(x) ((__force __u64)(__be64)(x))
         |                                                   ^
   arch/powerpc/include/asm/idle.h:71:9: note: in expansion of macro 'be64_to_cpu'
      71 |  return be64_to_cpu(get_lppaca()->wait_state_cycles);
         |         ^~~~~~~~~~~
   In file included from arch/powerpc/kernel/sysfs.c:22:
   arch/powerpc/include/asm/idle.h: In function 'read_this_idle_spurr':
   arch/powerpc/include/asm/idle.h:82:18: error: invalid type argument of '->' (have 'int')
      82 |  if (get_lppaca()->idle == 1) {
         |                  ^~
   arch/powerpc/include/asm/idle.h: In function 'read_this_idle_purr':
   arch/powerpc/include/asm/idle.h:72:1: error: control reaches end of non-void function [-Werror=return-type]
      72 | }
         | ^
   In file included from arch/powerpc/kernel/sysfs.c:2:
   At top level:
   include/linux/device.h:126:26: error: 'dev_attr_idle_spurr' defined but not used [-Werror=unused-variable]
     126 |  struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
         |                          ^~~~~~~~~
   arch/powerpc/kernel/sysfs.c:869:8: note: in expansion of macro 'DEVICE_ATTR'
     869 | static DEVICE_ATTR(idle_spurr, 0400, idle_spurr_show, NULL);
         |        ^~~~~~~~~~~
   include/linux/device.h:126:26: error: 'dev_attr_idle_purr' defined but not used [-Werror=unused-variable]
     126 |  struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
         |                          ^~~~~~~~~
   arch/powerpc/kernel/sysfs.c:858:8: note: in expansion of macro 'DEVICE_ATTR'
     858 | static DEVICE_ATTR(idle_purr, 0400, idle_purr_show, NULL);
         |        ^~~~~~~~~~~
>> include/linux/device.h:126:26: error: 'dev_attr_spurr' defined but not used [-Werror=unused-variable]
     126 |  struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
         |                          ^~~~~~~~~
   arch/powerpc/kernel/sysfs.c:847:8: note: in expansion of macro 'DEVICE_ATTR'
     847 | static DEVICE_ATTR(spurr, 0400, show_spurr, NULL);
         |        ^~~~~~~~~~~
>> include/linux/device.h:126:26: error: 'dev_attr_purr' defined but not used [-Werror=unused-variable]
     126 |  struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
         |                          ^~~~~~~~~
   arch/powerpc/kernel/sysfs.c:836:8: note: in expansion of macro 'DEVICE_ATTR'
     836 | static DEVICE_ATTR(purr, 0400, show_purr, store_purr);
         |        ^~~~~~~~~~~
   cc1: all warnings being treated as errors
--
                    from arch/powerpc/include/uapi/asm/byteorder.h:14,
                    from include/asm-generic/bitops/le.h:6,
                    from arch/powerpc/include/asm/bitops.h:250,
                    from include/linux/bitops.h:29,
                    from include/linux/kernel.h:12,
                    from include/linux/list.h:9,
                    from include/linux/rculist.h:10,
                    from include/linux/pid.h:5,
                    from include/linux/sched.h:14,
                    from include/linux/ratelimit.h:6,
                    from include/linux/dev_printk.h:16,
                    from include/linux/device.h:15,
                    from arch/powerpc//kernel/sysfs.c:2:
   arch/powerpc/include/asm/idle.h: In function 'update_idle_purr_accounting':
   arch/powerpc/include/asm/idle.h:25:28: error: implicit declaration of function 'get_lppaca'; did you mean 'get_page'? [-Werror=implicit-function-declaration]
      25 |  wait_cycles = be64_to_cpu(get_lppaca()->wait_state_cycles);
         |                            ^~~~~~~~~~
   include/uapi/linux/byteorder/big_endian.h:38:51: note: in definition of macro '__be64_to_cpu'
      38 | #define __be64_to_cpu(x) ((__force __u64)(__be64)(x))
         |                                                   ^
   arch/powerpc/include/asm/idle.h:25:16: note: in expansion of macro 'be64_to_cpu'
      25 |  wait_cycles = be64_to_cpu(get_lppaca()->wait_state_cycles);
         |                ^~~~~~~~~~~
   arch/powerpc/include/asm/idle.h:25:40: error: invalid type argument of '->' (have 'int')
      25 |  wait_cycles = be64_to_cpu(get_lppaca()->wait_state_cycles);
         |                                        ^~
   include/uapi/linux/byteorder/big_endian.h:38:51: note: in definition of macro '__be64_to_cpu'
      38 | #define __be64_to_cpu(x) ((__force __u64)(__be64)(x))
         |                                                   ^
   arch/powerpc/include/asm/idle.h:25:16: note: in expansion of macro 'be64_to_cpu'
      25 |  wait_cycles = be64_to_cpu(get_lppaca()->wait_state_cycles);
         |                ^~~~~~~~~~~
   In file included from arch/powerpc//kernel/sysfs.c:22:
   arch/powerpc/include/asm/idle.h:27:14: error: invalid type argument of '->' (have 'int')
      27 |  get_lppaca()->wait_state_cycles = cpu_to_be64(wait_cycles);
         |              ^~
   arch/powerpc/include/asm/idle.h: In function 'pseries_idle_prolog':
   arch/powerpc/include/asm/idle.h:47:14: error: invalid type argument of '->' (have 'int')
      47 |  get_lppaca()->idle = 1;
         |              ^~
   arch/powerpc/include/asm/idle.h: In function 'pseries_idle_epilog':
   arch/powerpc/include/asm/idle.h:54:14: error: invalid type argument of '->' (have 'int')
      54 |  get_lppaca()->idle = 0;
         |              ^~
   In file included from include/linux/dev_printk.h:14,
                    from include/linux/device.h:15,
                    from arch/powerpc//kernel/sysfs.c:2:
   arch/powerpc/include/asm/idle.h: In function 'read_this_idle_purr':
   arch/powerpc/include/asm/idle.h:66:27: error: invalid type argument of '->' (have 'int')
      66 |  if (unlikely(get_lppaca()->idle == 1)) {
         |                           ^~
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   In file included from include/linux/byteorder/big_endian.h:5,
                    from arch/powerpc/include/uapi/asm/byteorder.h:14,
                    from include/asm-generic/bitops/le.h:6,
                    from arch/powerpc/include/asm/bitops.h:250,
                    from include/linux/bitops.h:29,
                    from include/linux/kernel.h:12,
                    from include/linux/list.h:9,
                    from include/linux/rculist.h:10,
                    from include/linux/pid.h:5,
                    from include/linux/sched.h:14,
                    from include/linux/ratelimit.h:6,
                    from include/linux/dev_printk.h:16,
                    from include/linux/device.h:15,
                    from arch/powerpc//kernel/sysfs.c:2:
   arch/powerpc/include/asm/idle.h:71:33: error: invalid type argument of '->' (have 'int')
      71 |  return be64_to_cpu(get_lppaca()->wait_state_cycles);
         |                                 ^~
   include/uapi/linux/byteorder/big_endian.h:38:51: note: in definition of macro '__be64_to_cpu'
      38 | #define __be64_to_cpu(x) ((__force __u64)(__be64)(x))
         |                                                   ^
   arch/powerpc/include/asm/idle.h:71:9: note: in expansion of macro 'be64_to_cpu'
      71 |  return be64_to_cpu(get_lppaca()->wait_state_cycles);
         |         ^~~~~~~~~~~
   In file included from arch/powerpc//kernel/sysfs.c:22:
   arch/powerpc/include/asm/idle.h: In function 'read_this_idle_spurr':
   arch/powerpc/include/asm/idle.h:82:18: error: invalid type argument of '->' (have 'int')
      82 |  if (get_lppaca()->idle == 1) {
         |                  ^~
   arch/powerpc/include/asm/idle.h: In function 'read_this_idle_purr':
   arch/powerpc/include/asm/idle.h:72:1: error: control reaches end of non-void function [-Werror=return-type]
      72 | }
         | ^
   In file included from arch/powerpc//kernel/sysfs.c:2:
   At top level:
   include/linux/device.h:126:26: error: 'dev_attr_idle_spurr' defined but not used [-Werror=unused-variable]
     126 |  struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
         |                          ^~~~~~~~~
   arch/powerpc//kernel/sysfs.c:869:8: note: in expansion of macro 'DEVICE_ATTR'
     869 | static DEVICE_ATTR(idle_spurr, 0400, idle_spurr_show, NULL);
         |        ^~~~~~~~~~~
   include/linux/device.h:126:26: error: 'dev_attr_idle_purr' defined but not used [-Werror=unused-variable]
     126 |  struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
         |                          ^~~~~~~~~
   arch/powerpc//kernel/sysfs.c:858:8: note: in expansion of macro 'DEVICE_ATTR'
     858 | static DEVICE_ATTR(idle_purr, 0400, idle_purr_show, NULL);
         |        ^~~~~~~~~~~
>> include/linux/device.h:126:26: error: 'dev_attr_spurr' defined but not used [-Werror=unused-variable]
     126 |  struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
         |                          ^~~~~~~~~
   arch/powerpc//kernel/sysfs.c:847:8: note: in expansion of macro 'DEVICE_ATTR'
     847 | static DEVICE_ATTR(spurr, 0400, show_spurr, NULL);
         |        ^~~~~~~~~~~
>> include/linux/device.h:126:26: error: 'dev_attr_purr' defined but not used [-Werror=unused-variable]
     126 |  struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
         |                          ^~~~~~~~~
   arch/powerpc//kernel/sysfs.c:836:8: note: in expansion of macro 'DEVICE_ATTR'
     836 | static DEVICE_ATTR(purr, 0400, show_purr, store_purr);
         |        ^~~~~~~~~~~
   cc1: all warnings being treated as errors

vim +/dev_attr_spurr +126 include/linux/device.h

ca22e56debc57b Kay Sievers        2011-12-14  111  
ca22e56debc57b Kay Sievers        2011-12-14  112  ssize_t device_show_ulong(struct device *dev, struct device_attribute *attr,
ca22e56debc57b Kay Sievers        2011-12-14  113  			  char *buf);
ca22e56debc57b Kay Sievers        2011-12-14  114  ssize_t device_store_ulong(struct device *dev, struct device_attribute *attr,
ca22e56debc57b Kay Sievers        2011-12-14  115  			   const char *buf, size_t count);
ca22e56debc57b Kay Sievers        2011-12-14  116  ssize_t device_show_int(struct device *dev, struct device_attribute *attr,
ca22e56debc57b Kay Sievers        2011-12-14  117  			char *buf);
ca22e56debc57b Kay Sievers        2011-12-14  118  ssize_t device_store_int(struct device *dev, struct device_attribute *attr,
ca22e56debc57b Kay Sievers        2011-12-14  119  			 const char *buf, size_t count);
91872392f08486 Borislav Petkov    2012-10-09  120  ssize_t device_show_bool(struct device *dev, struct device_attribute *attr,
91872392f08486 Borislav Petkov    2012-10-09  121  			char *buf);
91872392f08486 Borislav Petkov    2012-10-09  122  ssize_t device_store_bool(struct device *dev, struct device_attribute *attr,
91872392f08486 Borislav Petkov    2012-10-09  123  			 const char *buf, size_t count);
ca22e56debc57b Kay Sievers        2011-12-14  124  
a7fd67062efc5b Kay Sievers        2005-10-01  125  #define DEVICE_ATTR(_name, _mode, _show, _store) \
a7fd67062efc5b Kay Sievers        2005-10-01 @126  	struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
7fda9100bb8258 Christophe Leroy   2017-12-18  127  #define DEVICE_ATTR_PREALLOC(_name, _mode, _show, _store) \
7fda9100bb8258 Christophe Leroy   2017-12-18  128  	struct device_attribute dev_attr_##_name = \
7fda9100bb8258 Christophe Leroy   2017-12-18  129  		__ATTR_PREALLOC(_name, _mode, _show, _store)
ced321bf915153 Greg Kroah-Hartman 2013-07-14  130  #define DEVICE_ATTR_RW(_name) \
ced321bf915153 Greg Kroah-Hartman 2013-07-14  131  	struct device_attribute dev_attr_##_name = __ATTR_RW(_name)
ced321bf915153 Greg Kroah-Hartman 2013-07-14  132  #define DEVICE_ATTR_RO(_name) \
ced321bf915153 Greg Kroah-Hartman 2013-07-14  133  	struct device_attribute dev_attr_##_name = __ATTR_RO(_name)
1130c55c757660 Greg Kroah-Hartman 2013-08-23  134  #define DEVICE_ATTR_WO(_name) \
1130c55c757660 Greg Kroah-Hartman 2013-08-23  135  	struct device_attribute dev_attr_##_name = __ATTR_WO(_name)
ca22e56debc57b Kay Sievers        2011-12-14  136  #define DEVICE_ULONG_ATTR(_name, _mode, _var) \
ca22e56debc57b Kay Sievers        2011-12-14  137  	struct dev_ext_attribute dev_attr_##_name = \
ca22e56debc57b Kay Sievers        2011-12-14  138  		{ __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) }
ca22e56debc57b Kay Sievers        2011-12-14  139  #define DEVICE_INT_ATTR(_name, _mode, _var) \
ca22e56debc57b Kay Sievers        2011-12-14  140  	struct dev_ext_attribute dev_attr_##_name = \
94758185689ee9 Michael Davidson   2012-05-03  141  		{ __ATTR(_name, _mode, device_show_int, device_store_int), &(_var) }
91872392f08486 Borislav Petkov    2012-10-09  142  #define DEVICE_BOOL_ATTR(_name, _mode, _var) \
91872392f08486 Borislav Petkov    2012-10-09  143  	struct dev_ext_attribute dev_attr_##_name = \
91872392f08486 Borislav Petkov    2012-10-09  144  		{ __ATTR(_name, _mode, device_show_bool, device_store_bool), &(_var) }
356c05d58af05d Alan Stern         2012-05-14  145  #define DEVICE_ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) \
356c05d58af05d Alan Stern         2012-05-14  146  	struct device_attribute dev_attr_##_name =		\
356c05d58af05d Alan Stern         2012-05-14  147  		__ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store)
a7fd67062efc5b Kay Sievers        2005-10-01  148  

:::::: The code at line 126 was first introduced by commit
:::::: a7fd67062efc5b0fc9a61368c607fa92d1d57f9e [PATCH] add sysfs attr to re-emit device hotplug event

:::::: TO: Kay Sievers <kay.sievers@suse.de>
:::::: CC: Greg Kroah-Hartman <gregkh@suse.de>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 15487 bytes --]

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

* Re: [PATCH v3 4/6] powerpc/sysfs: Show idle_purr and idle_spurr for every CPU
  2020-03-11  9:37   ` Gautham R. Shenoy
  (?)
  (?)
@ 2020-03-11 23:13   ` kbuild test robot
  -1 siblings, 0 replies; 19+ messages in thread
From: kbuild test robot @ 2020-03-11 23:13 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 18143 bytes --]

Hi "Gautham,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on powerpc/next]
[also build test WARNING on linus/master v5.6-rc5 next-20200311]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Gautham-R-Shenoy/Track-and-expose-idle-PURR-and-SPURR-ticks/20200312-041724
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-rhel-kconfig (attached as .config)
compiler: powerpc64le-linux-gcc (GCC) 9.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=9.2.0 make.cross ARCH=powerpc 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   In file included from include/linux/swab.h:5,
                    from include/uapi/linux/byteorder/little_endian.h:13,
                    from include/linux/byteorder/little_endian.h:5,
                    from arch/powerpc/include/uapi/asm/byteorder.h:12,
                    from include/asm-generic/bitops/le.h:6,
                    from arch/powerpc/include/asm/bitops.h:250,
                    from include/linux/bitops.h:29,
                    from include/linux/kernel.h:12,
                    from include/linux/list.h:9,
                    from include/linux/lockdep.h:27,
                    from include/linux/spinlock_types.h:18,
                    from arch/powerpc/include/asm/lppaca.h:45,
                    from arch/powerpc/include/asm/paca.h:17,
                    from arch/powerpc/include/asm/current.h:13,
                    from include/linux/sched.h:12,
                    from include/linux/ratelimit.h:6,
                    from include/linux/dev_printk.h:16,
                    from include/linux/device.h:15,
                    from arch/powerpc/kernel/sysfs.c:2:
   arch/powerpc/include/asm/idle.h: In function 'update_idle_purr_accounting':
   arch/powerpc/include/asm/idle.h:25:28: error: implicit declaration of function 'get_lppaca'; did you mean 'get_paca'? [-Werror=implicit-function-declaration]
      25 |  wait_cycles = be64_to_cpu(get_lppaca()->wait_state_cycles);
         |                            ^~~~~~~~~~
   include/uapi/linux/swab.h:128:54: note: in definition of macro '__swab64'
     128 | #define __swab64(x) (__u64)__builtin_bswap64((__u64)(x))
         |                                                      ^
>> include/linux/byteorder/generic.h:93:21: note: in expansion of macro '__be64_to_cpu'
      93 | #define be64_to_cpu __be64_to_cpu
         |                     ^~~~~~~~~~~~~
   arch/powerpc/include/asm/idle.h:25:16: note: in expansion of macro 'be64_to_cpu'
      25 |  wait_cycles = be64_to_cpu(get_lppaca()->wait_state_cycles);
         |                ^~~~~~~~~~~
   arch/powerpc/include/asm/idle.h:25:40: error: invalid type argument of '->' (have 'int')
      25 |  wait_cycles = be64_to_cpu(get_lppaca()->wait_state_cycles);
         |                                        ^~
   include/uapi/linux/swab.h:128:54: note: in definition of macro '__swab64'
     128 | #define __swab64(x) (__u64)__builtin_bswap64((__u64)(x))
         |                                                      ^
>> include/linux/byteorder/generic.h:93:21: note: in expansion of macro '__be64_to_cpu'
      93 | #define be64_to_cpu __be64_to_cpu
         |                     ^~~~~~~~~~~~~
   arch/powerpc/include/asm/idle.h:25:16: note: in expansion of macro 'be64_to_cpu'
      25 |  wait_cycles = be64_to_cpu(get_lppaca()->wait_state_cycles);
         |                ^~~~~~~~~~~
   In file included from arch/powerpc/kernel/sysfs.c:22:
   arch/powerpc/include/asm/idle.h:27:14: error: invalid type argument of '->' (have 'int')
      27 |  get_lppaca()->wait_state_cycles = cpu_to_be64(wait_cycles);
         |              ^~
   arch/powerpc/include/asm/idle.h: In function 'pseries_idle_prolog':
   arch/powerpc/include/asm/idle.h:47:14: error: invalid type argument of '->' (have 'int')
      47 |  get_lppaca()->idle = 1;
         |              ^~
   arch/powerpc/include/asm/idle.h: In function 'pseries_idle_epilog':
   arch/powerpc/include/asm/idle.h:54:14: error: invalid type argument of '->' (have 'int')
      54 |  get_lppaca()->idle = 0;
         |              ^~
   In file included from include/linux/dev_printk.h:14,
                    from include/linux/device.h:15,
                    from arch/powerpc/kernel/sysfs.c:2:
   arch/powerpc/include/asm/idle.h: In function 'read_this_idle_purr':
   arch/powerpc/include/asm/idle.h:66:27: error: invalid type argument of '->' (have 'int')
      66 |  if (unlikely(get_lppaca()->idle == 1)) {
         |                           ^~
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   In file included from include/linux/swab.h:5,
                    from include/uapi/linux/byteorder/little_endian.h:13,
                    from include/linux/byteorder/little_endian.h:5,
                    from arch/powerpc/include/uapi/asm/byteorder.h:12,
                    from include/asm-generic/bitops/le.h:6,
                    from arch/powerpc/include/asm/bitops.h:250,
                    from include/linux/bitops.h:29,
                    from include/linux/kernel.h:12,
                    from include/linux/list.h:9,
                    from include/linux/lockdep.h:27,
                    from include/linux/spinlock_types.h:18,
                    from arch/powerpc/include/asm/lppaca.h:45,
                    from arch/powerpc/include/asm/paca.h:17,
                    from arch/powerpc/include/asm/current.h:13,
                    from include/linux/sched.h:12,
                    from include/linux/ratelimit.h:6,
                    from include/linux/dev_printk.h:16,
                    from include/linux/device.h:15,
                    from arch/powerpc/kernel/sysfs.c:2:
   arch/powerpc/include/asm/idle.h:71:33: error: invalid type argument of '->' (have 'int')
      71 |  return be64_to_cpu(get_lppaca()->wait_state_cycles);
         |                                 ^~
   include/uapi/linux/swab.h:128:54: note: in definition of macro '__swab64'
     128 | #define __swab64(x) (__u64)__builtin_bswap64((__u64)(x))
         |                                                      ^
>> include/linux/byteorder/generic.h:93:21: note: in expansion of macro '__be64_to_cpu'
      93 | #define be64_to_cpu __be64_to_cpu
         |                     ^~~~~~~~~~~~~
   arch/powerpc/include/asm/idle.h:71:9: note: in expansion of macro 'be64_to_cpu'
      71 |  return be64_to_cpu(get_lppaca()->wait_state_cycles);
         |         ^~~~~~~~~~~
   In file included from arch/powerpc/kernel/sysfs.c:22:
   arch/powerpc/include/asm/idle.h: In function 'read_this_idle_spurr':
   arch/powerpc/include/asm/idle.h:82:18: error: invalid type argument of '->' (have 'int')
      82 |  if (get_lppaca()->idle == 1) {
         |                  ^~
   cc1: some warnings being treated as errors

vim +/__be64_to_cpu +93 include/linux/byteorder/generic.h

^1da177e4c3f41 Linus Torvalds 2005-04-16    4  
^1da177e4c3f41 Linus Torvalds 2005-04-16    5  /*
90a856436ddafb Geoff Levand   2014-08-06    6   * linux/byteorder/generic.h
^1da177e4c3f41 Linus Torvalds 2005-04-16    7   * Generic Byte-reordering support
^1da177e4c3f41 Linus Torvalds 2005-04-16    8   *
e0487992ce1dd7 Ed L. Cashin   2005-09-19    9   * The "... p" macros, like le64_to_cpup, can be used with pointers
e0487992ce1dd7 Ed L. Cashin   2005-09-19   10   * to unaligned data, but there will be a performance penalty on 
e0487992ce1dd7 Ed L. Cashin   2005-09-19   11   * some architectures.  Use get_unaligned for unaligned data.
e0487992ce1dd7 Ed L. Cashin   2005-09-19   12   *
^1da177e4c3f41 Linus Torvalds 2005-04-16   13   * Francois-Rene Rideau <fare@tunes.org> 19970707
^1da177e4c3f41 Linus Torvalds 2005-04-16   14   *    gathered all the good ideas from all asm-foo/byteorder.h into one file,
^1da177e4c3f41 Linus Torvalds 2005-04-16   15   *    cleaned them up.
^1da177e4c3f41 Linus Torvalds 2005-04-16   16   *    I hope it is compliant with non-GCC compilers.
^1da177e4c3f41 Linus Torvalds 2005-04-16   17   *    I decided to put __BYTEORDER_HAS_U64__ in byteorder.h,
^1da177e4c3f41 Linus Torvalds 2005-04-16   18   *    because I wasn't sure it would be ok to put it in types.h
^1da177e4c3f41 Linus Torvalds 2005-04-16   19   *    Upgraded it to 2.1.43
^1da177e4c3f41 Linus Torvalds 2005-04-16   20   * Francois-Rene Rideau <fare@tunes.org> 19971012
^1da177e4c3f41 Linus Torvalds 2005-04-16   21   *    Upgraded it to 2.1.57
^1da177e4c3f41 Linus Torvalds 2005-04-16   22   *    to please Linus T., replaced huge #ifdef's between little/big endian
^1da177e4c3f41 Linus Torvalds 2005-04-16   23   *    by nestedly #include'd files.
^1da177e4c3f41 Linus Torvalds 2005-04-16   24   * Francois-Rene Rideau <fare@tunes.org> 19971205
^1da177e4c3f41 Linus Torvalds 2005-04-16   25   *    Made it to 2.1.71; now a facelift:
^1da177e4c3f41 Linus Torvalds 2005-04-16   26   *    Put files under include/linux/byteorder/
^1da177e4c3f41 Linus Torvalds 2005-04-16   27   *    Split swab from generic support.
^1da177e4c3f41 Linus Torvalds 2005-04-16   28   *
^1da177e4c3f41 Linus Torvalds 2005-04-16   29   * TODO:
^1da177e4c3f41 Linus Torvalds 2005-04-16   30   *   = Regular kernel maintainers could also replace all these manual
^1da177e4c3f41 Linus Torvalds 2005-04-16   31   *    byteswap macros that remain, disseminated among drivers,
^1da177e4c3f41 Linus Torvalds 2005-04-16   32   *    after some grep or the sources...
^1da177e4c3f41 Linus Torvalds 2005-04-16   33   *   = Linus might want to rename all these macros and files to fit his taste,
^1da177e4c3f41 Linus Torvalds 2005-04-16   34   *    to fit his personal naming scheme.
^1da177e4c3f41 Linus Torvalds 2005-04-16   35   *   = it seems that a few drivers would also appreciate
^1da177e4c3f41 Linus Torvalds 2005-04-16   36   *    nybble swapping support...
^1da177e4c3f41 Linus Torvalds 2005-04-16   37   *   = every architecture could add their byteswap macro in asm/byteorder.h
^1da177e4c3f41 Linus Torvalds 2005-04-16   38   *    see how some architectures already do (i386, alpha, ppc, etc)
^1da177e4c3f41 Linus Torvalds 2005-04-16   39   *   = cpu_to_beXX and beXX_to_cpu might some day need to be well
^1da177e4c3f41 Linus Torvalds 2005-04-16   40   *    distinguished throughout the kernel. This is not the case currently,
^1da177e4c3f41 Linus Torvalds 2005-04-16   41   *    since little endian, big endian, and pdp endian machines needn't it.
^1da177e4c3f41 Linus Torvalds 2005-04-16   42   *    But this might be the case for, say, a port of Linux to 20/21 bit
^1da177e4c3f41 Linus Torvalds 2005-04-16   43   *    architectures (and F21 Linux addict around?).
^1da177e4c3f41 Linus Torvalds 2005-04-16   44   */
^1da177e4c3f41 Linus Torvalds 2005-04-16   45  
^1da177e4c3f41 Linus Torvalds 2005-04-16   46  /*
^1da177e4c3f41 Linus Torvalds 2005-04-16   47   * The following macros are to be defined by <asm/byteorder.h>:
^1da177e4c3f41 Linus Torvalds 2005-04-16   48   *
^1da177e4c3f41 Linus Torvalds 2005-04-16   49   * Conversion of long and short int between network and host format
^1da177e4c3f41 Linus Torvalds 2005-04-16   50   *	ntohl(__u32 x)
^1da177e4c3f41 Linus Torvalds 2005-04-16   51   *	ntohs(__u16 x)
^1da177e4c3f41 Linus Torvalds 2005-04-16   52   *	htonl(__u32 x)
^1da177e4c3f41 Linus Torvalds 2005-04-16   53   *	htons(__u16 x)
^1da177e4c3f41 Linus Torvalds 2005-04-16   54   * It seems that some programs (which? where? or perhaps a standard? POSIX?)
^1da177e4c3f41 Linus Torvalds 2005-04-16   55   * might like the above to be functions, not macros (why?).
^1da177e4c3f41 Linus Torvalds 2005-04-16   56   * if that's true, then detect them, and take measures.
^1da177e4c3f41 Linus Torvalds 2005-04-16   57   * Anyway, the measure is: define only ___ntohl as a macro instead,
^1da177e4c3f41 Linus Torvalds 2005-04-16   58   * and in a separate file, have
^1da177e4c3f41 Linus Torvalds 2005-04-16   59   * unsigned long inline ntohl(x){return ___ntohl(x);}
^1da177e4c3f41 Linus Torvalds 2005-04-16   60   *
^1da177e4c3f41 Linus Torvalds 2005-04-16   61   * The same for constant arguments
^1da177e4c3f41 Linus Torvalds 2005-04-16   62   *	__constant_ntohl(__u32 x)
^1da177e4c3f41 Linus Torvalds 2005-04-16   63   *	__constant_ntohs(__u16 x)
^1da177e4c3f41 Linus Torvalds 2005-04-16   64   *	__constant_htonl(__u32 x)
^1da177e4c3f41 Linus Torvalds 2005-04-16   65   *	__constant_htons(__u16 x)
^1da177e4c3f41 Linus Torvalds 2005-04-16   66   *
^1da177e4c3f41 Linus Torvalds 2005-04-16   67   * Conversion of XX-bit integers (16- 32- or 64-)
^1da177e4c3f41 Linus Torvalds 2005-04-16   68   * between native CPU format and little/big endian format
^1da177e4c3f41 Linus Torvalds 2005-04-16   69   * 64-bit stuff only defined for proper architectures
^1da177e4c3f41 Linus Torvalds 2005-04-16   70   *	cpu_to_[bl]eXX(__uXX x)
^1da177e4c3f41 Linus Torvalds 2005-04-16   71   *	[bl]eXX_to_cpu(__uXX x)
^1da177e4c3f41 Linus Torvalds 2005-04-16   72   *
^1da177e4c3f41 Linus Torvalds 2005-04-16   73   * The same, but takes a pointer to the value to convert
^1da177e4c3f41 Linus Torvalds 2005-04-16   74   *	cpu_to_[bl]eXXp(__uXX x)
^1da177e4c3f41 Linus Torvalds 2005-04-16   75   *	[bl]eXX_to_cpup(__uXX x)
^1da177e4c3f41 Linus Torvalds 2005-04-16   76   *
^1da177e4c3f41 Linus Torvalds 2005-04-16   77   * The same, but change in situ
^1da177e4c3f41 Linus Torvalds 2005-04-16   78   *	cpu_to_[bl]eXXs(__uXX x)
^1da177e4c3f41 Linus Torvalds 2005-04-16   79   *	[bl]eXX_to_cpus(__uXX x)
^1da177e4c3f41 Linus Torvalds 2005-04-16   80   *
^1da177e4c3f41 Linus Torvalds 2005-04-16   81   * See asm-foo/byteorder.h for examples of how to provide
^1da177e4c3f41 Linus Torvalds 2005-04-16   82   * architecture-optimized versions
^1da177e4c3f41 Linus Torvalds 2005-04-16   83   *
^1da177e4c3f41 Linus Torvalds 2005-04-16   84   */
^1da177e4c3f41 Linus Torvalds 2005-04-16   85  
^1da177e4c3f41 Linus Torvalds 2005-04-16   86  #define cpu_to_le64 __cpu_to_le64
^1da177e4c3f41 Linus Torvalds 2005-04-16   87  #define le64_to_cpu __le64_to_cpu
^1da177e4c3f41 Linus Torvalds 2005-04-16   88  #define cpu_to_le32 __cpu_to_le32
^1da177e4c3f41 Linus Torvalds 2005-04-16   89  #define le32_to_cpu __le32_to_cpu
^1da177e4c3f41 Linus Torvalds 2005-04-16   90  #define cpu_to_le16 __cpu_to_le16
^1da177e4c3f41 Linus Torvalds 2005-04-16   91  #define le16_to_cpu __le16_to_cpu
^1da177e4c3f41 Linus Torvalds 2005-04-16   92  #define cpu_to_be64 __cpu_to_be64
^1da177e4c3f41 Linus Torvalds 2005-04-16  @93  #define be64_to_cpu __be64_to_cpu
^1da177e4c3f41 Linus Torvalds 2005-04-16   94  #define cpu_to_be32 __cpu_to_be32
^1da177e4c3f41 Linus Torvalds 2005-04-16   95  #define be32_to_cpu __be32_to_cpu
^1da177e4c3f41 Linus Torvalds 2005-04-16   96  #define cpu_to_be16 __cpu_to_be16
^1da177e4c3f41 Linus Torvalds 2005-04-16   97  #define be16_to_cpu __be16_to_cpu
^1da177e4c3f41 Linus Torvalds 2005-04-16   98  #define cpu_to_le64p __cpu_to_le64p
^1da177e4c3f41 Linus Torvalds 2005-04-16   99  #define le64_to_cpup __le64_to_cpup
^1da177e4c3f41 Linus Torvalds 2005-04-16  100  #define cpu_to_le32p __cpu_to_le32p
^1da177e4c3f41 Linus Torvalds 2005-04-16  101  #define le32_to_cpup __le32_to_cpup
^1da177e4c3f41 Linus Torvalds 2005-04-16  102  #define cpu_to_le16p __cpu_to_le16p
^1da177e4c3f41 Linus Torvalds 2005-04-16  103  #define le16_to_cpup __le16_to_cpup
^1da177e4c3f41 Linus Torvalds 2005-04-16  104  #define cpu_to_be64p __cpu_to_be64p
^1da177e4c3f41 Linus Torvalds 2005-04-16  105  #define be64_to_cpup __be64_to_cpup
^1da177e4c3f41 Linus Torvalds 2005-04-16  106  #define cpu_to_be32p __cpu_to_be32p
^1da177e4c3f41 Linus Torvalds 2005-04-16  107  #define be32_to_cpup __be32_to_cpup
^1da177e4c3f41 Linus Torvalds 2005-04-16  108  #define cpu_to_be16p __cpu_to_be16p
^1da177e4c3f41 Linus Torvalds 2005-04-16  109  #define be16_to_cpup __be16_to_cpup
^1da177e4c3f41 Linus Torvalds 2005-04-16  110  #define cpu_to_le64s __cpu_to_le64s
^1da177e4c3f41 Linus Torvalds 2005-04-16  111  #define le64_to_cpus __le64_to_cpus
^1da177e4c3f41 Linus Torvalds 2005-04-16  112  #define cpu_to_le32s __cpu_to_le32s
^1da177e4c3f41 Linus Torvalds 2005-04-16  113  #define le32_to_cpus __le32_to_cpus
^1da177e4c3f41 Linus Torvalds 2005-04-16  114  #define cpu_to_le16s __cpu_to_le16s
^1da177e4c3f41 Linus Torvalds 2005-04-16  115  #define le16_to_cpus __le16_to_cpus
^1da177e4c3f41 Linus Torvalds 2005-04-16  116  #define cpu_to_be64s __cpu_to_be64s
^1da177e4c3f41 Linus Torvalds 2005-04-16  117  #define be64_to_cpus __be64_to_cpus
^1da177e4c3f41 Linus Torvalds 2005-04-16  118  #define cpu_to_be32s __cpu_to_be32s
^1da177e4c3f41 Linus Torvalds 2005-04-16  119  #define be32_to_cpus __be32_to_cpus
^1da177e4c3f41 Linus Torvalds 2005-04-16  120  #define cpu_to_be16s __cpu_to_be16s
^1da177e4c3f41 Linus Torvalds 2005-04-16  121  #define be16_to_cpus __be16_to_cpus
^1da177e4c3f41 Linus Torvalds 2005-04-16  122  

:::::: The code at line 93 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:::::: TO: Linus Torvalds <torvalds@ppc970.osdl.org>
:::::: CC: Linus Torvalds <torvalds@ppc970.osdl.org>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 15333 bytes --]

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

* Re: [PATCH v3 4/6] powerpc/sysfs: Show idle_purr and idle_spurr for every CPU
  2020-03-11  9:37   ` Gautham R. Shenoy
                     ` (2 preceding siblings ...)
  (?)
@ 2020-03-11 23:48   ` kbuild test robot
  -1 siblings, 0 replies; 19+ messages in thread
From: kbuild test robot @ 2020-03-11 23:48 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 15987 bytes --]

Hi "Gautham,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on powerpc/next]
[also build test WARNING on linus/master scottwood/next v5.6-rc5 next-20200311]
[cannot apply to mpe/next]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Gautham-R-Shenoy/Track-and-expose-idle-PURR-and-SPURR-ticks/20200312-041724
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-randconfig-a001-20200311 (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 9.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=9.2.0 make.cross ARCH=powerpc 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   In file included from include/linux/byteorder/big_endian.h:5,
                    from arch/powerpc/include/uapi/asm/byteorder.h:14,
                    from include/asm-generic/bitops/le.h:6,
                    from arch/powerpc/include/asm/bitops.h:250,
                    from include/linux/bitops.h:29,
                    from include/linux/kernel.h:12,
                    from include/asm-generic/bug.h:19,
                    from arch/powerpc/include/asm/bug.h:109,
                    from include/linux/bug.h:5,
                    from arch/powerpc/include/asm/mmu.h:130,
                    from arch/powerpc/include/asm/paca.h:18,
                    from arch/powerpc/include/asm/current.h:13,
                    from include/linux/sched.h:12,
                    from include/linux/ratelimit.h:6,
                    from include/linux/dev_printk.h:16,
                    from include/linux/device.h:15,
                    from arch/powerpc/kernel/sysfs.c:2:
   arch/powerpc/include/asm/idle.h: In function 'update_idle_purr_accounting':
   arch/powerpc/include/asm/idle.h:25:28: error: implicit declaration of function 'get_lppaca'; did you mean 'get_paca'? [-Werror=implicit-function-declaration]
      25 |  wait_cycles = be64_to_cpu(get_lppaca()->wait_state_cycles);
         |                            ^~~~~~~~~~
   include/uapi/linux/byteorder/big_endian.h:38:51: note: in definition of macro '__be64_to_cpu'
      38 | #define __be64_to_cpu(x) ((__force __u64)(__be64)(x))
         |                                                   ^
   arch/powerpc/include/asm/idle.h:25:16: note: in expansion of macro 'be64_to_cpu'
      25 |  wait_cycles = be64_to_cpu(get_lppaca()->wait_state_cycles);
         |                ^~~~~~~~~~~
   arch/powerpc/include/asm/idle.h:25:40: error: invalid type argument of '->' (have 'int')
      25 |  wait_cycles = be64_to_cpu(get_lppaca()->wait_state_cycles);
         |                                        ^~
   include/uapi/linux/byteorder/big_endian.h:38:51: note: in definition of macro '__be64_to_cpu'
      38 | #define __be64_to_cpu(x) ((__force __u64)(__be64)(x))
         |                                                   ^
   arch/powerpc/include/asm/idle.h:25:16: note: in expansion of macro 'be64_to_cpu'
      25 |  wait_cycles = be64_to_cpu(get_lppaca()->wait_state_cycles);
         |                ^~~~~~~~~~~
   In file included from arch/powerpc/kernel/sysfs.c:22:
   arch/powerpc/include/asm/idle.h:27:14: error: invalid type argument of '->' (have 'int')
      27 |  get_lppaca()->wait_state_cycles = cpu_to_be64(wait_cycles);
         |              ^~
   arch/powerpc/include/asm/idle.h: In function 'pseries_idle_prolog':
   arch/powerpc/include/asm/idle.h:47:14: error: invalid type argument of '->' (have 'int')
      47 |  get_lppaca()->idle = 1;
         |              ^~
   arch/powerpc/include/asm/idle.h: In function 'pseries_idle_epilog':
   arch/powerpc/include/asm/idle.h:54:14: error: invalid type argument of '->' (have 'int')
      54 |  get_lppaca()->idle = 0;
         |              ^~
   In file included from include/linux/dev_printk.h:14,
                    from include/linux/device.h:15,
                    from arch/powerpc/kernel/sysfs.c:2:
   arch/powerpc/include/asm/idle.h: In function 'read_this_idle_purr':
   arch/powerpc/include/asm/idle.h:66:27: error: invalid type argument of '->' (have 'int')
      66 |  if (unlikely(get_lppaca()->idle == 1)) {
         |                           ^~
   include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
      58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
         |                                                    ^~~~
>> arch/powerpc/include/asm/idle.h:66:2: note: in expansion of macro 'if'
      66 |  if (unlikely(get_lppaca()->idle == 1)) {
         |  ^~
   include/linux/compiler.h:48:24: note: in expansion of macro '__branch_check__'
      48 | #  define unlikely(x) (__branch_check__(x, 0, __builtin_constant_p(x)))
         |                        ^~~~~~~~~~~~~~~~
>> arch/powerpc/include/asm/idle.h:66:6: note: in expansion of macro 'unlikely'
      66 |  if (unlikely(get_lppaca()->idle == 1)) {
         |      ^~~~~~~~
   arch/powerpc/include/asm/idle.h:66:27: error: invalid type argument of '->' (have 'int')
      66 |  if (unlikely(get_lppaca()->idle == 1)) {
         |                           ^~
   include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
      58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
         |                                                    ^~~~
>> arch/powerpc/include/asm/idle.h:66:2: note: in expansion of macro 'if'
      66 |  if (unlikely(get_lppaca()->idle == 1)) {
         |  ^~
   include/linux/compiler.h:48:24: note: in expansion of macro '__branch_check__'
      48 | #  define unlikely(x) (__branch_check__(x, 0, __builtin_constant_p(x)))
         |                        ^~~~~~~~~~~~~~~~
>> arch/powerpc/include/asm/idle.h:66:6: note: in expansion of macro 'unlikely'
      66 |  if (unlikely(get_lppaca()->idle == 1)) {
         |      ^~~~~~~~
   arch/powerpc/include/asm/idle.h:66:27: error: invalid type argument of '->' (have 'int')
      66 |  if (unlikely(get_lppaca()->idle == 1)) {
         |                           ^~
   include/linux/compiler.h:58:61: note: in definition of macro '__trace_if_var'
      58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
         |                                                             ^~~~
>> arch/powerpc/include/asm/idle.h:66:2: note: in expansion of macro 'if'
      66 |  if (unlikely(get_lppaca()->idle == 1)) {
         |  ^~
   include/linux/compiler.h:48:24: note: in expansion of macro '__branch_check__'
      48 | #  define unlikely(x) (__branch_check__(x, 0, __builtin_constant_p(x)))
         |                        ^~~~~~~~~~~~~~~~
>> arch/powerpc/include/asm/idle.h:66:6: note: in expansion of macro 'unlikely'
      66 |  if (unlikely(get_lppaca()->idle == 1)) {
         |      ^~~~~~~~
   arch/powerpc/include/asm/idle.h:66:27: error: invalid type argument of '->' (have 'int')
      66 |  if (unlikely(get_lppaca()->idle == 1)) {
         |                           ^~
   include/linux/compiler.h:58:61: note: in definition of macro '__trace_if_var'
      58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
         |                                                             ^~~~
>> arch/powerpc/include/asm/idle.h:66:2: note: in expansion of macro 'if'
      66 |  if (unlikely(get_lppaca()->idle == 1)) {
         |  ^~
   include/linux/compiler.h:48:24: note: in expansion of macro '__branch_check__'
      48 | #  define unlikely(x) (__branch_check__(x, 0, __builtin_constant_p(x)))
         |                        ^~~~~~~~~~~~~~~~
>> arch/powerpc/include/asm/idle.h:66:6: note: in expansion of macro 'unlikely'
      66 |  if (unlikely(get_lppaca()->idle == 1)) {
         |      ^~~~~~~~
   arch/powerpc/include/asm/idle.h:66:27: error: invalid type argument of '->' (have 'int')
      66 |  if (unlikely(get_lppaca()->idle == 1)) {
         |                           ^~
   include/linux/compiler.h:69:3: note: in definition of macro '__trace_if_value'
      69 |  (cond) ?     \
         |   ^~~~
   include/linux/compiler.h:56:28: note: in expansion of macro '__trace_if_var'
      56 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
         |                            ^~~~~~~~~~~~~~
>> arch/powerpc/include/asm/idle.h:66:2: note: in expansion of macro 'if'
      66 |  if (unlikely(get_lppaca()->idle == 1)) {
         |  ^~
   include/linux/compiler.h:48:24: note: in expansion of macro '__branch_check__'
      48 | #  define unlikely(x) (__branch_check__(x, 0, __builtin_constant_p(x)))
         |                        ^~~~~~~~~~~~~~~~
>> arch/powerpc/include/asm/idle.h:66:6: note: in expansion of macro 'unlikely'
      66 |  if (unlikely(get_lppaca()->idle == 1)) {
         |      ^~~~~~~~
   arch/powerpc/include/asm/idle.h:66:27: error: invalid type argument of '->' (have 'int')
      66 |  if (unlikely(get_lppaca()->idle == 1)) {
         |                           ^~
   include/linux/compiler.h:69:3: note: in definition of macro '__trace_if_value'
      69 |  (cond) ?     \
         |   ^~~~
   include/linux/compiler.h:56:28: note: in expansion of macro '__trace_if_var'
      56 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
         |                            ^~~~~~~~~~~~~~
>> arch/powerpc/include/asm/idle.h:66:2: note: in expansion of macro 'if'
      66 |  if (unlikely(get_lppaca()->idle == 1)) {
         |  ^~
   include/linux/compiler.h:48:24: note: in expansion of macro '__branch_check__'
      48 | #  define unlikely(x) (__branch_check__(x, 0, __builtin_constant_p(x)))
         |                        ^~~~~~~~~~~~~~~~
>> arch/powerpc/include/asm/idle.h:66:6: note: in expansion of macro 'unlikely'
      66 |  if (unlikely(get_lppaca()->idle == 1)) {
         |      ^~~~~~~~
   In file included from include/linux/byteorder/big_endian.h:5,
                    from arch/powerpc/include/uapi/asm/byteorder.h:14,
                    from include/asm-generic/bitops/le.h:6,
                    from arch/powerpc/include/asm/bitops.h:250,
                    from include/linux/bitops.h:29,
                    from include/linux/kernel.h:12,
                    from include/asm-generic/bug.h:19,
                    from arch/powerpc/include/asm/bug.h:109,
                    from include/linux/bug.h:5,
                    from arch/powerpc/include/asm/mmu.h:130,
                    from arch/powerpc/include/asm/paca.h:18,
                    from arch/powerpc/include/asm/current.h:13,
                    from include/linux/sched.h:12,
                    from include/linux/ratelimit.h:6,
                    from include/linux/dev_printk.h:16,
                    from include/linux/device.h:15,
                    from arch/powerpc/kernel/sysfs.c:2:
   arch/powerpc/include/asm/idle.h:71:33: error: invalid type argument of '->' (have 'int')
      71 |  return be64_to_cpu(get_lppaca()->wait_state_cycles);
         |                                 ^~
   include/uapi/linux/byteorder/big_endian.h:38:51: note: in definition of macro '__be64_to_cpu'
      38 | #define __be64_to_cpu(x) ((__force __u64)(__be64)(x))
         |                                                   ^
   arch/powerpc/include/asm/idle.h:71:9: note: in expansion of macro 'be64_to_cpu'
      71 |  return be64_to_cpu(get_lppaca()->wait_state_cycles);
         |         ^~~~~~~~~~~
   In file included from include/linux/dev_printk.h:14,
                    from include/linux/device.h:15,
                    from arch/powerpc/kernel/sysfs.c:2:
   arch/powerpc/include/asm/idle.h: In function 'read_this_idle_spurr':
   arch/powerpc/include/asm/idle.h:82:18: error: invalid type argument of '->' (have 'int')
      82 |  if (get_lppaca()->idle == 1) {
         |                  ^~
   include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
      58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
         |                                                    ^~~~
   arch/powerpc/include/asm/idle.h:82:2: note: in expansion of macro 'if'
      82 |  if (get_lppaca()->idle == 1) {
         |  ^~
   arch/powerpc/include/asm/idle.h:82:18: error: invalid type argument of '->' (have 'int')
      82 |  if (get_lppaca()->idle == 1) {
         |                  ^~
   include/linux/compiler.h:58:61: note: in definition of macro '__trace_if_var'
      58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
         |                                                             ^~~~
   arch/powerpc/include/asm/idle.h:82:2: note: in expansion of macro 'if'
      82 |  if (get_lppaca()->idle == 1) {
         |  ^~
   arch/powerpc/include/asm/idle.h:82:18: error: invalid type argument of '->' (have 'int')
      82 |  if (get_lppaca()->idle == 1) {
         |                  ^~
   include/linux/compiler.h:69:3: note: in definition of macro '__trace_if_value'
      69 |  (cond) ?     \
         |   ^~~~
   include/linux/compiler.h:56:28: note: in expansion of macro '__trace_if_var'
      56 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
         |                            ^~~~~~~~~~~~~~
   arch/powerpc/include/asm/idle.h:82:2: note: in expansion of macro 'if'
      82 |  if (get_lppaca()->idle == 1) {
         |  ^~
   cc1: some warnings being treated as errors

vim +/if +66 arch/powerpc/include/asm/idle.h

2452f5988544ea Gautham R. Shenoy 2020-03-11  57  
2452f5988544ea Gautham R. Shenoy 2020-03-11  58  static inline u64 read_this_idle_purr(void)
2452f5988544ea Gautham R. Shenoy 2020-03-11  59  {
2452f5988544ea Gautham R. Shenoy 2020-03-11  60  	/*
2452f5988544ea Gautham R. Shenoy 2020-03-11  61  	 * If we are reading from an idle context, update the
2452f5988544ea Gautham R. Shenoy 2020-03-11  62  	 * idle-purr cycles corresponding to the last idle period.
2452f5988544ea Gautham R. Shenoy 2020-03-11  63  	 * Since the idle context is not yet over, take a fresh
2452f5988544ea Gautham R. Shenoy 2020-03-11  64  	 * snapshot of the idle-purr.
2452f5988544ea Gautham R. Shenoy 2020-03-11  65  	 */
2452f5988544ea Gautham R. Shenoy 2020-03-11 @66  	if (unlikely(get_lppaca()->idle == 1)) {
2452f5988544ea Gautham R. Shenoy 2020-03-11  67  		update_idle_purr_accounting();
2452f5988544ea Gautham R. Shenoy 2020-03-11  68  		snapshot_purr_idle_entry();
2452f5988544ea Gautham R. Shenoy 2020-03-11  69  	}
2452f5988544ea Gautham R. Shenoy 2020-03-11  70  
2452f5988544ea Gautham R. Shenoy 2020-03-11  71  	return be64_to_cpu(get_lppaca()->wait_state_cycles);
2452f5988544ea Gautham R. Shenoy 2020-03-11  72  }
03d989e21479c7 Gautham R. Shenoy 2020-03-11  73  

:::::: The code at line 66 was first introduced by commit
:::::: 2452f5988544eaae0c9f73103c2f7083ef4e2fa7 powerpc/idle: Add accessor function to always read latest idle PURR

:::::: TO: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
:::::: CC: 0day robot <lkp@intel.com>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 29200 bytes --]

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

* Re: [PATCH v3 6/6] pseries/sysfs: Minimise IPI noise while reading [idle_][s]purr
  2020-03-11  9:37   ` Gautham R. Shenoy
  (?)
  (?)
@ 2020-03-12  0:09   ` kbuild test robot
  -1 siblings, 0 replies; 19+ messages in thread
From: kbuild test robot @ 2020-03-12  0:09 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 9367 bytes --]

Hi "Gautham,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on powerpc/next]
[also build test WARNING on next-20200311]
[cannot apply to linus/master v5.6-rc5]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Gautham-R-Shenoy/Track-and-expose-idle-PURR-and-SPURR-ticks/20200312-041724
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-rhel-kconfig (attached as .config)
compiler: powerpc64le-linux-gcc (GCC) 9.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=9.2.0 make.cross ARCH=powerpc 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

                    from arch/powerpc/include/uapi/asm/byteorder.h:12,
                    from include/asm-generic/bitops/le.h:6,
                    from arch/powerpc/include/asm/bitops.h:250,
                    from include/linux/bitops.h:29,
                    from include/linux/kernel.h:12,
                    from include/linux/list.h:9,
                    from include/linux/lockdep.h:27,
                    from include/linux/spinlock_types.h:18,
                    from arch/powerpc/include/asm/lppaca.h:45,
                    from arch/powerpc/include/asm/paca.h:17,
                    from arch/powerpc/include/asm/current.h:13,
                    from include/linux/sched.h:12,
                    from include/linux/ratelimit.h:6,
                    from include/linux/dev_printk.h:16,
                    from include/linux/device.h:15,
                    from arch/powerpc/kernel/sysfs.c:2:
   arch/powerpc/include/asm/idle.h: In function 'update_idle_purr_accounting':
   arch/powerpc/include/asm/idle.h:25:28: error: implicit declaration of function 'get_lppaca'; did you mean 'get_paca'? [-Werror=implicit-function-declaration]
      25 |  wait_cycles = be64_to_cpu(get_lppaca()->wait_state_cycles);
         |                            ^~~~~~~~~~
   include/uapi/linux/swab.h:128:54: note: in definition of macro '__swab64'
     128 | #define __swab64(x) (__u64)__builtin_bswap64((__u64)(x))
         |                                                      ^
   include/linux/byteorder/generic.h:93:21: note: in expansion of macro '__be64_to_cpu'
      93 | #define be64_to_cpu __be64_to_cpu
         |                     ^~~~~~~~~~~~~
   arch/powerpc/include/asm/idle.h:25:16: note: in expansion of macro 'be64_to_cpu'
      25 |  wait_cycles = be64_to_cpu(get_lppaca()->wait_state_cycles);
         |                ^~~~~~~~~~~
   arch/powerpc/include/asm/idle.h:25:40: error: invalid type argument of '->' (have 'int')
      25 |  wait_cycles = be64_to_cpu(get_lppaca()->wait_state_cycles);
         |                                        ^~
   include/uapi/linux/swab.h:128:54: note: in definition of macro '__swab64'
     128 | #define __swab64(x) (__u64)__builtin_bswap64((__u64)(x))
         |                                                      ^
   include/linux/byteorder/generic.h:93:21: note: in expansion of macro '__be64_to_cpu'
      93 | #define be64_to_cpu __be64_to_cpu
         |                     ^~~~~~~~~~~~~
   arch/powerpc/include/asm/idle.h:25:16: note: in expansion of macro 'be64_to_cpu'
      25 |  wait_cycles = be64_to_cpu(get_lppaca()->wait_state_cycles);
         |                ^~~~~~~~~~~
   In file included from arch/powerpc/kernel/sysfs.c:22:
   arch/powerpc/include/asm/idle.h:27:14: error: invalid type argument of '->' (have 'int')
      27 |  get_lppaca()->wait_state_cycles = cpu_to_be64(wait_cycles);
         |              ^~
   arch/powerpc/include/asm/idle.h: In function 'pseries_idle_prolog':
   arch/powerpc/include/asm/idle.h:47:14: error: invalid type argument of '->' (have 'int')
      47 |  get_lppaca()->idle = 1;
         |              ^~
   arch/powerpc/include/asm/idle.h: In function 'pseries_idle_epilog':
   arch/powerpc/include/asm/idle.h:54:14: error: invalid type argument of '->' (have 'int')
      54 |  get_lppaca()->idle = 0;
         |              ^~
   In file included from include/linux/dev_printk.h:14,
                    from include/linux/device.h:15,
                    from arch/powerpc/kernel/sysfs.c:2:
   arch/powerpc/include/asm/idle.h: In function 'read_this_idle_purr':
   arch/powerpc/include/asm/idle.h:66:27: error: invalid type argument of '->' (have 'int')
      66 |  if (unlikely(get_lppaca()->idle == 1)) {
         |                           ^~
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   In file included from include/linux/swab.h:5,
                    from include/uapi/linux/byteorder/little_endian.h:13,
                    from include/linux/byteorder/little_endian.h:5,
                    from arch/powerpc/include/uapi/asm/byteorder.h:12,
                    from include/asm-generic/bitops/le.h:6,
                    from arch/powerpc/include/asm/bitops.h:250,
                    from include/linux/bitops.h:29,
                    from include/linux/kernel.h:12,
                    from include/linux/list.h:9,
                    from include/linux/lockdep.h:27,
                    from include/linux/spinlock_types.h:18,
                    from arch/powerpc/include/asm/lppaca.h:45,
                    from arch/powerpc/include/asm/paca.h:17,
                    from arch/powerpc/include/asm/current.h:13,
                    from include/linux/sched.h:12,
                    from include/linux/ratelimit.h:6,
                    from include/linux/dev_printk.h:16,
                    from include/linux/device.h:15,
                    from arch/powerpc/kernel/sysfs.c:2:
   arch/powerpc/include/asm/idle.h:71:33: error: invalid type argument of '->' (have 'int')
      71 |  return be64_to_cpu(get_lppaca()->wait_state_cycles);
         |                                 ^~
   include/uapi/linux/swab.h:128:54: note: in definition of macro '__swab64'
     128 | #define __swab64(x) (__u64)__builtin_bswap64((__u64)(x))
         |                                                      ^
   include/linux/byteorder/generic.h:93:21: note: in expansion of macro '__be64_to_cpu'
      93 | #define be64_to_cpu __be64_to_cpu
         |                     ^~~~~~~~~~~~~
   arch/powerpc/include/asm/idle.h:71:9: note: in expansion of macro 'be64_to_cpu'
      71 |  return be64_to_cpu(get_lppaca()->wait_state_cycles);
         |         ^~~~~~~~~~~
   In file included from arch/powerpc/kernel/sysfs.c:22:
   arch/powerpc/include/asm/idle.h: In function 'read_this_idle_spurr':
   arch/powerpc/include/asm/idle.h:82:18: error: invalid type argument of '->' (have 'int')
      82 |  if (get_lppaca()->idle == 1) {
         |                  ^~
   arch/powerpc/include/asm/idle.h: In function 'read_this_idle_purr':
>> arch/powerpc/include/asm/idle.h:72:1: warning: control reaches end of non-void function [-Wreturn-type]
      72 | }
         | ^
   cc1: some warnings being treated as errors

vim +72 arch/powerpc/include/asm/idle.h

2452f5988544ea Gautham R. Shenoy 2020-03-11  57  
2452f5988544ea Gautham R. Shenoy 2020-03-11  58  static inline u64 read_this_idle_purr(void)
2452f5988544ea Gautham R. Shenoy 2020-03-11  59  {
2452f5988544ea Gautham R. Shenoy 2020-03-11  60  	/*
2452f5988544ea Gautham R. Shenoy 2020-03-11  61  	 * If we are reading from an idle context, update the
2452f5988544ea Gautham R. Shenoy 2020-03-11  62  	 * idle-purr cycles corresponding to the last idle period.
2452f5988544ea Gautham R. Shenoy 2020-03-11  63  	 * Since the idle context is not yet over, take a fresh
2452f5988544ea Gautham R. Shenoy 2020-03-11  64  	 * snapshot of the idle-purr.
2452f5988544ea Gautham R. Shenoy 2020-03-11  65  	 */
2452f5988544ea Gautham R. Shenoy 2020-03-11  66  	if (unlikely(get_lppaca()->idle == 1)) {
2452f5988544ea Gautham R. Shenoy 2020-03-11  67  		update_idle_purr_accounting();
2452f5988544ea Gautham R. Shenoy 2020-03-11  68  		snapshot_purr_idle_entry();
2452f5988544ea Gautham R. Shenoy 2020-03-11  69  	}
2452f5988544ea Gautham R. Shenoy 2020-03-11  70  
2452f5988544ea Gautham R. Shenoy 2020-03-11  71  	return be64_to_cpu(get_lppaca()->wait_state_cycles);
2452f5988544ea Gautham R. Shenoy 2020-03-11 @72  }
03d989e21479c7 Gautham R. Shenoy 2020-03-11  73  

:::::: The code at line 72 was first introduced by commit
:::::: 2452f5988544eaae0c9f73103c2f7083ef4e2fa7 powerpc/idle: Add accessor function to always read latest idle PURR

:::::: TO: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
:::::: CC: 0day robot <lkp@intel.com>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 15333 bytes --]

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

end of thread, other threads:[~2020-03-12  0:09 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-11  9:37 [PATCH v3 0/6] Track and expose idle PURR and SPURR ticks Gautham R. Shenoy
2020-03-11  9:37 ` Gautham R. Shenoy
2020-03-11  9:37 ` [PATCH v3 1/6] powerpc: Move idle_loop_prolog()/epilog() functions to header file Gautham R. Shenoy
2020-03-11  9:37   ` Gautham R. Shenoy
2020-03-11  9:37 ` [PATCH v3 2/6] powerpc/idle: Add accessor function to always read latest idle PURR Gautham R. Shenoy
2020-03-11  9:37   ` Gautham R. Shenoy
2020-03-11  9:37 ` [PATCH v3 3/6] powerpc/pseries: Account for SPURR ticks on idle CPUs Gautham R. Shenoy
2020-03-11  9:37   ` Gautham R. Shenoy
2020-03-11  9:37 ` [PATCH v3 4/6] powerpc/sysfs: Show idle_purr and idle_spurr for every CPU Gautham R. Shenoy
2020-03-11  9:37   ` Gautham R. Shenoy
2020-03-11 22:30   ` kbuild test robot
2020-03-11 23:13   ` kbuild test robot
2020-03-11 23:48   ` kbuild test robot
2020-03-11  9:37 ` [PATCH v3 5/6] Documentation: Document sysfs interfaces purr, spurr, idle_purr, idle_spurr Gautham R. Shenoy
2020-03-11  9:37   ` Gautham R. Shenoy
2020-03-11  9:37 ` [PATCH v3 6/6] pseries/sysfs: Minimise IPI noise while reading [idle_][s]purr Gautham R. Shenoy
2020-03-11  9:37   ` Gautham R. Shenoy
2020-03-11 23:12   ` kbuild test robot
2020-03-12  0:09   ` kbuild test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.