diff mbox series

powerpc/kernel/sysfs: Export ldbar spr to sysfs

Message ID 1509096890-22655-1-git-send-email-anju@linux.vnet.ibm.com (mailing list archive)
State Superseded
Headers show
Series powerpc/kernel/sysfs: Export ldbar spr to sysfs | expand

Commit Message

Anju T Sudhakar Oct. 27, 2017, 9:34 a.m. UTC
Add ldbar spr to sysfs. The spr will hold thread level In-Memory Collection (IMC)
counter configuration data.

Signed-off-by: Anju T Sudhakar <anju@linux.vnet.ibm.com>
Acked-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
---
 arch/powerpc/kernel/sysfs.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

kernel test robot Oct. 30, 2017, 10:26 a.m. UTC | #1
Hi Anju,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on powerpc/next]
[also build test ERROR on v4.14-rc7 next-20171018]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Anju-T-Sudhakar/powerpc-kernel-sysfs-Export-ldbar-spr-to-sysfs/20171030-155220
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-storcenter_defconfig (attached as .config)
compiler: powerpc-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
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
        make.cross ARCH=powerpc 

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

>> arch/powerpc/kernel/sysfs.c:419:16: error: 'show_ldbar' defined but not used [-Werror=unused-function]
    static ssize_t show_##NAME(struct device *dev, \
                   ^
>> arch/powerpc/kernel/sysfs.c:443:2: note: in expansion of macro '__SYSFS_SPRSETUP_SHOW_STORE'
     __SYSFS_SPRSETUP_SHOW_STORE(NAME)
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>> arch/powerpc/kernel/sysfs.c:469:1: note: in expansion of macro 'SYSFS_PMCSETUP'
    SYSFS_PMCSETUP(ldbar, SPRN_LDBAR);
    ^~~~~~~~~~~~~~
   cc1: all warnings being treated as errors

vim +/show_ldbar +419 arch/powerpc/kernel/sysfs.c

39a360ef arch/powerpc/kernel/sysfs.c Sam bobroff            2014-05-21  417  
39a360ef arch/powerpc/kernel/sysfs.c Sam bobroff            2014-05-21  418  #define __SYSFS_SPRSETUP_SHOW_STORE(NAME) \
8a25a2fd arch/powerpc/kernel/sysfs.c Kay Sievers            2011-12-21 @419  static ssize_t show_##NAME(struct device *dev, \
8a25a2fd arch/powerpc/kernel/sysfs.c Kay Sievers            2011-12-21  420  			struct device_attribute *attr, \
4a0b2b4d arch/powerpc/kernel/sysfs.c Andi Kleen             2008-07-01  421  			char *buf) \
^1da177e arch/ppc64/kernel/sysfs.c   Linus Torvalds         2005-04-16  422  { \
8a25a2fd arch/powerpc/kernel/sysfs.c Kay Sievers            2011-12-21  423  	struct cpu *cpu = container_of(dev, struct cpu, dev); \
9a371934 arch/powerpc/kernel/sysfs.c Rusty Russell          2009-03-11  424  	unsigned long val; \
8a25a2fd arch/powerpc/kernel/sysfs.c Kay Sievers            2011-12-21  425  	smp_call_function_single(cpu->dev.id, read_##NAME, &val, 1);	\
^1da177e arch/ppc64/kernel/sysfs.c   Linus Torvalds         2005-04-16  426  	return sprintf(buf, "%lx\n", val); \
^1da177e arch/ppc64/kernel/sysfs.c   Linus Torvalds         2005-04-16  427  } \
3ff6eecc arch/powerpc/kernel/sysfs.c Adrian Bunk            2008-01-24  428  static ssize_t __used \
8a25a2fd arch/powerpc/kernel/sysfs.c Kay Sievers            2011-12-21  429  	store_##NAME(struct device *dev, struct device_attribute *attr, \
4a0b2b4d arch/powerpc/kernel/sysfs.c Andi Kleen             2008-07-01  430  			const char *buf, size_t count) \
^1da177e arch/ppc64/kernel/sysfs.c   Linus Torvalds         2005-04-16  431  { \
8a25a2fd arch/powerpc/kernel/sysfs.c Kay Sievers            2011-12-21  432  	struct cpu *cpu = container_of(dev, struct cpu, dev); \
^1da177e arch/ppc64/kernel/sysfs.c   Linus Torvalds         2005-04-16  433  	unsigned long val; \
^1da177e arch/ppc64/kernel/sysfs.c   Linus Torvalds         2005-04-16  434  	int ret = sscanf(buf, "%lx", &val); \
^1da177e arch/ppc64/kernel/sysfs.c   Linus Torvalds         2005-04-16  435  	if (ret != 1) \
^1da177e arch/ppc64/kernel/sysfs.c   Linus Torvalds         2005-04-16  436  		return -EINVAL; \
8a25a2fd arch/powerpc/kernel/sysfs.c Kay Sievers            2011-12-21  437  	smp_call_function_single(cpu->dev.id, write_##NAME, &val, 1); \
^1da177e arch/ppc64/kernel/sysfs.c   Linus Torvalds         2005-04-16  438  	return count; \
^1da177e arch/ppc64/kernel/sysfs.c   Linus Torvalds         2005-04-16  439  }
^1da177e arch/ppc64/kernel/sysfs.c   Linus Torvalds         2005-04-16  440  
fd7e4296 arch/powerpc/kernel/sysfs.c Madhavan Srinivasan    2013-10-03  441  #define SYSFS_PMCSETUP(NAME, ADDRESS) \
39a360ef arch/powerpc/kernel/sysfs.c Sam bobroff            2014-05-21  442  	__SYSFS_SPRSETUP_READ_WRITE(NAME, ADDRESS, ppc_enable_pmcs()) \
39a360ef arch/powerpc/kernel/sysfs.c Sam bobroff            2014-05-21 @443  	__SYSFS_SPRSETUP_SHOW_STORE(NAME)
fd7e4296 arch/powerpc/kernel/sysfs.c Madhavan Srinivasan    2013-10-03  444  #define SYSFS_SPRSETUP(NAME, ADDRESS) \
39a360ef arch/powerpc/kernel/sysfs.c Sam bobroff            2014-05-21  445  	__SYSFS_SPRSETUP_READ_WRITE(NAME, ADDRESS, ) \
39a360ef arch/powerpc/kernel/sysfs.c Sam bobroff            2014-05-21  446  	__SYSFS_SPRSETUP_SHOW_STORE(NAME)
39a360ef arch/powerpc/kernel/sysfs.c Sam bobroff            2014-05-21  447  
39a360ef arch/powerpc/kernel/sysfs.c Sam bobroff            2014-05-21  448  #define SYSFS_SPRSETUP_SHOW_STORE(NAME) \
39a360ef arch/powerpc/kernel/sysfs.c Sam bobroff            2014-05-21  449  	__SYSFS_SPRSETUP_SHOW_STORE(NAME)
6529c13d arch/powerpc/kernel/sysfs.c Olof Johansson         2007-01-28  450  
6529c13d arch/powerpc/kernel/sysfs.c Olof Johansson         2007-01-28  451  /* Let's define all possible registers, we'll only hook up the ones
6529c13d arch/powerpc/kernel/sysfs.c Olof Johansson         2007-01-28  452   * that are implemented on the current processor
6529c13d arch/powerpc/kernel/sysfs.c Olof Johansson         2007-01-28  453   */
6529c13d arch/powerpc/kernel/sysfs.c Olof Johansson         2007-01-28  454  
33a7f122 arch/powerpc/kernel/sysfs.c Kumar Gala             2008-09-18  455  #if defined(CONFIG_PPC64)
b950bdd0 arch/powerpc/kernel/sysfs.c Benjamin Herrenschmidt 2008-08-18  456  #define HAS_PPC_PMC_CLASSIC	1
b950bdd0 arch/powerpc/kernel/sysfs.c Benjamin Herrenschmidt 2008-08-18  457  #define HAS_PPC_PMC_IBM		1
b950bdd0 arch/powerpc/kernel/sysfs.c Benjamin Herrenschmidt 2008-08-18  458  #define HAS_PPC_PMC_PA6T	1
33a7f122 arch/powerpc/kernel/sysfs.c Kumar Gala             2008-09-18  459  #elif defined(CONFIG_6xx)
b950bdd0 arch/powerpc/kernel/sysfs.c Benjamin Herrenschmidt 2008-08-18  460  #define HAS_PPC_PMC_CLASSIC	1
b950bdd0 arch/powerpc/kernel/sysfs.c Benjamin Herrenschmidt 2008-08-18  461  #define HAS_PPC_PMC_IBM		1
b950bdd0 arch/powerpc/kernel/sysfs.c Benjamin Herrenschmidt 2008-08-18  462  #define HAS_PPC_PMC_G4		1
b950bdd0 arch/powerpc/kernel/sysfs.c Benjamin Herrenschmidt 2008-08-18  463  #endif
b950bdd0 arch/powerpc/kernel/sysfs.c Benjamin Herrenschmidt 2008-08-18  464  
b950bdd0 arch/powerpc/kernel/sysfs.c Benjamin Herrenschmidt 2008-08-18  465  
b950bdd0 arch/powerpc/kernel/sysfs.c Benjamin Herrenschmidt 2008-08-18  466  #ifdef HAS_PPC_PMC_CLASSIC
^1da177e arch/ppc64/kernel/sysfs.c   Linus Torvalds         2005-04-16  467  SYSFS_PMCSETUP(mmcr0, SPRN_MMCR0);
^1da177e arch/ppc64/kernel/sysfs.c   Linus Torvalds         2005-04-16  468  SYSFS_PMCSETUP(mmcr1, SPRN_MMCR1);
080163db arch/powerpc/kernel/sysfs.c Anju T Sudhakar        2017-10-27 @469  SYSFS_PMCSETUP(ldbar, SPRN_LDBAR);
^1da177e arch/ppc64/kernel/sysfs.c   Linus Torvalds         2005-04-16  470  SYSFS_PMCSETUP(pmc1, SPRN_PMC1);
^1da177e arch/ppc64/kernel/sysfs.c   Linus Torvalds         2005-04-16  471  SYSFS_PMCSETUP(pmc2, SPRN_PMC2);
^1da177e arch/ppc64/kernel/sysfs.c   Linus Torvalds         2005-04-16  472  SYSFS_PMCSETUP(pmc3, SPRN_PMC3);
^1da177e arch/ppc64/kernel/sysfs.c   Linus Torvalds         2005-04-16  473  SYSFS_PMCSETUP(pmc4, SPRN_PMC4);
^1da177e arch/ppc64/kernel/sysfs.c   Linus Torvalds         2005-04-16  474  SYSFS_PMCSETUP(pmc5, SPRN_PMC5);
^1da177e arch/ppc64/kernel/sysfs.c   Linus Torvalds         2005-04-16  475  SYSFS_PMCSETUP(pmc6, SPRN_PMC6);
b950bdd0 arch/powerpc/kernel/sysfs.c Benjamin Herrenschmidt 2008-08-18  476  

:::::: The code at line 419 was first introduced by commit
:::::: 8a25a2fd126c621f44f3aeaef80d51f00fc11639 cpu: convert 'cpu' and 'machinecheck' sysdev_class to a regular subsystem

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

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
maddy Oct. 30, 2017, 11:56 a.m. UTC | #2
On Friday 27 October 2017 03:04 PM, Anju T Sudhakar wrote:
> Add ldbar spr to sysfs. The spr will hold thread level In-Memory Collection (IMC)
> counter configuration data.
>
> Signed-off-by: Anju T Sudhakar <anju@linux.vnet.ibm.com>
> Acked-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
> ---
>   arch/powerpc/kernel/sysfs.c | 8 ++++++++
>   1 file changed, 8 insertions(+)
>
> diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
> index 4437c70c7c2b..8efcaece4796 100644
> --- a/arch/powerpc/kernel/sysfs.c
> +++ b/arch/powerpc/kernel/sysfs.c
> @@ -466,6 +466,7 @@ static ssize_t __used \
>   #ifdef HAS_PPC_PMC_CLASSIC
>   SYSFS_PMCSETUP(mmcr0, SPRN_MMCR0);
>   SYSFS_PMCSETUP(mmcr1, SPRN_MMCR1);
> +SYSFS_PMCSETUP(ldbar, SPRN_LDBAR);

My bad. Missed to mention this. For ldbar spr,
use SYSFS_SPRSETUP macro instead.

Maddy

>   SYSFS_PMCSETUP(pmc1, SPRN_PMC1);
>   SYSFS_PMCSETUP(pmc2, SPRN_PMC2);
>   SYSFS_PMCSETUP(pmc3, SPRN_PMC3);
> @@ -492,6 +493,7 @@ SYSFS_SPRSETUP(pir, SPRN_PIR);
>     Lets be conservative and default to pseries.
>   */
>   static DEVICE_ATTR(mmcra, 0600, show_mmcra, store_mmcra);
> +static DEVICE_ATTR(ldbar, 0600, show_ldbar, store_ldbar);
>   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);
> @@ -757,6 +759,9 @@ static int register_cpu_online(unsigned int cpu)
>   			device_create_file(s, &pmc_attrs[i]);
>
>   #ifdef CONFIG_PPC64
> +	if (cpu_has_feature(CPU_FTR_ARCH_300))
> +		device_create_file(s, &dev_attr_ldbar);
> +
>   	if (cpu_has_feature(CPU_FTR_MMCRA))
>   		device_create_file(s, &dev_attr_mmcra);
>
> @@ -842,6 +847,9 @@ static int unregister_cpu_online(unsigned int cpu)
>   			device_remove_file(s, &pmc_attrs[i]);
>
>   #ifdef CONFIG_PPC64
> +	if (cpu_has_feature(CPU_FTR_ARCH_300))
> +		device_remove_file(s, &dev_attr_ldbar);
> +
>   	if (cpu_has_feature(CPU_FTR_MMCRA))
>   		device_remove_file(s, &dev_attr_mmcra);
>
diff mbox series

Patch

diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index 4437c70c7c2b..8efcaece4796 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -466,6 +466,7 @@  static ssize_t __used \
 #ifdef HAS_PPC_PMC_CLASSIC
 SYSFS_PMCSETUP(mmcr0, SPRN_MMCR0);
 SYSFS_PMCSETUP(mmcr1, SPRN_MMCR1);
+SYSFS_PMCSETUP(ldbar, SPRN_LDBAR);
 SYSFS_PMCSETUP(pmc1, SPRN_PMC1);
 SYSFS_PMCSETUP(pmc2, SPRN_PMC2);
 SYSFS_PMCSETUP(pmc3, SPRN_PMC3);
@@ -492,6 +493,7 @@  SYSFS_SPRSETUP(pir, SPRN_PIR);
   Lets be conservative and default to pseries.
 */
 static DEVICE_ATTR(mmcra, 0600, show_mmcra, store_mmcra);
+static DEVICE_ATTR(ldbar, 0600, show_ldbar, store_ldbar);
 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);
@@ -757,6 +759,9 @@  static int register_cpu_online(unsigned int cpu)
 			device_create_file(s, &pmc_attrs[i]);
 
 #ifdef CONFIG_PPC64
+	if (cpu_has_feature(CPU_FTR_ARCH_300))
+		device_create_file(s, &dev_attr_ldbar);
+
 	if (cpu_has_feature(CPU_FTR_MMCRA))
 		device_create_file(s, &dev_attr_mmcra);
 
@@ -842,6 +847,9 @@  static int unregister_cpu_online(unsigned int cpu)
 			device_remove_file(s, &pmc_attrs[i]);
 
 #ifdef CONFIG_PPC64
+	if (cpu_has_feature(CPU_FTR_ARCH_300))
+		device_remove_file(s, &dev_attr_ldbar);
+
 	if (cpu_has_feature(CPU_FTR_MMCRA))
 		device_remove_file(s, &dev_attr_mmcra);