Re: [V5 7/7] selftests, powerpc: Add test case for TM related ptrace interface
On 11/25/2014 01:05 AM, Anshuman Khandual wrote: > This patch adds one more test case called 'tm-ptrace' targeting TM > related ptrace interface. This test creates one child process to > run some basic TM transactions and the parent process attaches the > child to do some ptrace probing using the recently added regset > interfaces. The parent process then compares the received values > against the expected values to verify whether it has passed the > given test or not. > > Signed-off-by: Anshuman Khandual > --- > tools/testing/selftests/powerpc/tm/Makefile| 2 +- > tools/testing/selftests/powerpc/tm/tm-ptrace.c | 542 > + > 2 files changed, 543 insertions(+), 1 deletion(-) > create mode 100644 tools/testing/selftests/powerpc/tm/tm-ptrace.c > > diff --git a/tools/testing/selftests/powerpc/tm/Makefile > b/tools/testing/selftests/powerpc/tm/Makefile > index 2cede23..71d400a 100644 > --- a/tools/testing/selftests/powerpc/tm/Makefile > +++ b/tools/testing/selftests/powerpc/tm/Makefile > @@ -1,4 +1,4 @@ > -PROGS := tm-resched-dscr > +PROGS := tm-resched-dscr tm-ptrace > Could you please add .gitignore for the binaries in this directory to avoid git status including the binaries it in its output. thanks, -- Shuah -- Shuah Khan Sr. Linux Kernel Developer Samsung Research America (Silicon Valley) shua...@osg.samsung.com | (970) 217-8978 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V6 9/9] selftests: Make GIT ignore all binaries in powerpc test suite
On 12/02/2014 12:56 AM, Anshuman Khandual wrote: > This patch includes all of the powerpc test binaries into the > .gitignore file listing in their respective directories. This > will make sure that GIT ignores all of these test binaries while > displaying status. > > Signed-off-by: Anshuman Khandual > --- > .../testing/selftests/powerpc/copyloops/.gitignore | 4 > tools/testing/selftests/powerpc/mm/.gitignore | 1 + > tools/testing/selftests/powerpc/pmu/.gitignore | 3 +++ > tools/testing/selftests/powerpc/pmu/ebb/.gitignore | 22 > ++ > .../selftests/powerpc/primitives/.gitignore| 1 + > 5 files changed, 31 insertions(+) > create mode 100644 tools/testing/selftests/powerpc/copyloops/.gitignore > create mode 100644 tools/testing/selftests/powerpc/mm/.gitignore > create mode 100644 tools/testing/selftests/powerpc/pmu/.gitignore > create mode 100644 tools/testing/selftests/powerpc/pmu/ebb/.gitignore > create mode 100644 tools/testing/selftests/powerpc/primitives/.gitignore > Creating a single .gitignore at tools/testing/selftests/powerpc will make this simpler without having to add one .gitignore for each directory underneath. Thanks for taking on the task to add .gitignore for all powerpc binaries. -- Shuah -- Shuah Khan Sr. Linux Kernel Developer Samsung Research America (Silicon Valley) shua...@osg.samsung.com | (970) 217-8978 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V2 06/12] selftests, powerpc: Add test for system wide DSCR default
+/* Default DSCR access */ > +unsigned long get_default_dscr(void) > +{ > + int fd = -1; > + char buf[16]; > + unsigned long val; > + > + if (fd == -1) { > + fd = open(DSCR_DEFAULT, O_RDONLY); > + if (fd == -1) { > + perror("open() failed\n"); > + exit(1); > + } > + } > + memset(buf, 0, sizeof(buf)); > + lseek(fd, 0, SEEK_SET); > + read(fd, buf, sizeof(buf)); > + sscanf(buf, "%lx", &val); > + close(fd); > + return val; > +} > + > +void set_default_dscr(unsigned long val) > +{ > + int fd = -1; > + char buf[16]; > + > + if (fd == -1) { > + fd = open(DSCR_DEFAULT, O_RDWR); > + if (fd == -1) { > + perror("open() failed\n"); > + exit(1); > + } > + } > + sprintf(buf, "%lx\n", val); > + write(fd, buf, strlen(buf)); > + close(fd); > +} > + > +double uniform_deviate(int seed) > +{ > + return seed * (1.0 / (RAND_MAX + 1.0)); > +} > +#endif /* _SELFTESTS_POWERPC_DSCR_DSCR_H */ > diff --git a/tools/testing/selftests/powerpc/dscr/dscr_default_test.c > b/tools/testing/selftests/powerpc/dscr/dscr_default_test.c > new file mode 100644 > index 000..fd8b7b9 > --- /dev/null > +++ b/tools/testing/selftests/powerpc/dscr/dscr_default_test.c > @@ -0,0 +1,121 @@ > +/* > + * POWER Data Stream Control Register (DSCR) default test > + * > + * This test modifies the system wide default DSCR through > + * it's sysfs interface and then verifies that all threads > + * see the correct changed DSCR value immediately. > + * > + * Copyright (C) 2012 Anton Blanchard , IBM > + * Copyright (C) 2015 Anshuman Khandual , IBM > + * > + * This program is free software; you can redistribute it and/or > + * modify it under the terms of the GNU General Public License > + * as published by the Free Software Foundation; either version > + * 2 of the License, or (at your option) any later version. > + */ > +#include "dscr.h" > + > +static unsigned long dscr; /* System DSCR default */ > +static unsigned long sequence; > +static unsigned long result[THREADS]; > + > +static void *do_test(void *in) > +{ > + unsigned long thread = (unsigned long)in; > + unsigned long i; > + > + for (i = 0; i < COUNT; i++) { > + unsigned long d, cur_dscr, cur_dscr_usr; > + unsigned long s1, s2; > + > + s1 = ACCESS_ONCE(sequence); > + if (s1 & 1) > + continue; > + rmb(); > + > + d = dscr; > + cur_dscr = get_dscr(); > + cur_dscr_usr = get_dscr_usr(); > + > + rmb(); > + s2 = sequence; > + > + if (s1 != s2) > + continue; > + > + if (cur_dscr != d) { > + fprintf(stderr, "thread %ld kernel DSCR should be %ld " > + "but is %ld\n", thread, d, cur_dscr); > + result[thread] = 1; > + pthread_exit(&result[thread]); > + } > + > + if (cur_dscr_usr != d) { > + fprintf(stderr, "thread %ld user DSCR should be %ld " > + "but is %ld\n", thread, d, cur_dscr_usr); > + result[thread] = 1; > + pthread_exit(&result[thread]); > + } > + } > + result[thread] = 0; > + pthread_exit(&result[thread]); > +} > + > +int test_body(void) > +{ > + pthread_t threads[THREADS]; > + unsigned long i, *status[THREADS]; > + > + /* Initial DSCR default */ > + dscr = 1; > + set_default_dscr(dscr); > + > + /* Spawn all testing threads */ > + for (i = 0; i < THREADS; i++) { > + if (pthread_create(&threads[i], NULL, do_test, (void *)i)) { > + perror("pthread_create() failed\n"); > + exit(1); > + } > + } > + > + srand(getpid()); > + > + /* Keep changing the DSCR default */ > + for (i = 0; i < COUNT; i++) { > + double ret = uniform_deviate(rand()); > + > + if (ret < 0.0001) { > + sequence++; > + wmb(); > + > + dscr++; > + if (dscr > DSCR_MAX) > + dscr = 0; > + > +
[PATCH] powerpc: fix wii_memory_fixups() compile error on 3.0.y tree
Fix wii_memory_fixups() the following compile error on 3.0.y tree with wii_defconfig on 3.0.y tree. CC arch/powerpc/platforms/embedded6xx/wii.o arch/powerpc/platforms/embedded6xx/wii.c: In function ‘wii_memory_fixups’: arch/powerpc/platforms/embedded6xx/wii.c:88:2: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 2 has type ‘phys_addr_t’ [-Werror=format] arch/powerpc/platforms/embedded6xx/wii.c:88:2: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘phys_addr_t’ [-Werror=format] arch/powerpc/platforms/embedded6xx/wii.c:90:2: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 2 has type ‘phys_addr_t’ [-Werror=format] arch/powerpc/platforms/embedded6xx/wii.c:90:2: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘phys_addr_t’ [-Werror=format] cc1: all warnings being treated as errors make[2]: *** [arch/powerpc/platforms/embedded6xx/wii.o] Error 1 make[1]: *** [arch/powerpc/platforms/embedded6xx] Error 2 make: *** [arch/powerpc/platforms] Error 2 Signed-off-by: Shuah Khan CC: sta...@vger.kernel.org 3.0.y --- arch/powerpc/platforms/embedded6xx/wii.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/platforms/embedded6xx/wii.c b/arch/powerpc/platforms/embedded6xx/wii.c index 1b5dc1a..13d58dd 100644 --- a/arch/powerpc/platforms/embedded6xx/wii.c +++ b/arch/powerpc/platforms/embedded6xx/wii.c @@ -85,9 +85,9 @@ void __init wii_memory_fixups(void) wii_hole_start = p[0].base + p[0].size; wii_hole_size = p[1].base - wii_hole_start; - pr_info("MEM1: <%08llx %08llx>\n", p[0].base, p[0].size); + pr_info("MEM1: <%08ulx %08ulx>\n", p[0].base, p[0].size); pr_info("HOLE: <%08lx %08lx>\n", wii_hole_start, wii_hole_size); - pr_info("MEM2: <%08llx %08llx>\n", p[1].base, p[1].size); + pr_info("MEM2: <%08ulx %08ulx>\n", p[1].base, p[1].size); p[0].size += wii_hole_size + p[1].size; -- 1.7.9.5 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] powerpc: fix wii_memory_fixups() compile error on 3.0.y tree
On Sat, Dec 8, 2012 at 10:22 AM, Ben Hutchings wrote: > On Fri, 2012-12-07 at 19:07 -0700, Shuah Khan wrote: >> Fix wii_memory_fixups() the following compile error on 3.0.y tree with >> wii_defconfig on 3.0.y tree. >> >> CC arch/powerpc/platforms/embedded6xx/wii.o >> arch/powerpc/platforms/embedded6xx/wii.c: In function ‘wii_memory_fixups’: >> arch/powerpc/platforms/embedded6xx/wii.c:88:2: error: format ‘%llx’ expects >> argument of type ‘long long unsigned int’, but argument 2 has type >> ‘phys_addr_t’ [-Werror=format] >> arch/powerpc/platforms/embedded6xx/wii.c:88:2: error: format ‘%llx’ expects >> argument of type ‘long long unsigned int’, but argument 3 has type >> ‘phys_addr_t’ [-Werror=format] >> arch/powerpc/platforms/embedded6xx/wii.c:90:2: error: format ‘%llx’ expects >> argument of type ‘long long unsigned int’, but argument 2 has type >> ‘phys_addr_t’ [-Werror=format] >> arch/powerpc/platforms/embedded6xx/wii.c:90:2: error: format ‘%llx’ expects >> argument of type ‘long long unsigned int’, but argument 3 has type >> ‘phys_addr_t’ [-Werror=format] >> cc1: all warnings being treated as errors >> make[2]: *** [arch/powerpc/platforms/embedded6xx/wii.o] Error 1 >> make[1]: *** [arch/powerpc/platforms/embedded6xx] Error 2 >> make: *** [arch/powerpc/platforms] Error 2 >> >> Signed-off-by: Shuah Khan >> CC: sta...@vger.kernel.org 3.0.y >> --- >> arch/powerpc/platforms/embedded6xx/wii.c |4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/arch/powerpc/platforms/embedded6xx/wii.c >> b/arch/powerpc/platforms/embedded6xx/wii.c >> index 1b5dc1a..13d58dd 100644 >> --- a/arch/powerpc/platforms/embedded6xx/wii.c >> +++ b/arch/powerpc/platforms/embedded6xx/wii.c >> @@ -85,9 +85,9 @@ void __init wii_memory_fixups(void) >> wii_hole_start = p[0].base + p[0].size; >> wii_hole_size = p[1].base - wii_hole_start; >> >> - pr_info("MEM1: <%08llx %08llx>\n", p[0].base, p[0].size); >> + pr_info("MEM1: <%08ulx %08ulx>\n", p[0].base, p[0].size); > > "%08ulx" is the conversion specification "%08u" followed by literal > "lx". If phys_addr_t is always defined as unsigned long or always > unsigned int for this platform then you could use "%08lx" or "%08x" > respectively. But usually the right thing to do is to cast the > arguments of type phys_addr_t to unsigned long long (or, equivalently, > u64). > > Ben. Thanks. I should have gone with my first instinct of typecasting :) Will resend the patch with typecast instead of the change I made in a couple of days. Thanks, -- Shuah ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v2] powerpc: fix wii_memory_fixups() compile error on 3.0.y tree
Fix wii_memory_fixups() the following compile error on 3.0.y tree with wii_defconfig on 3.0.y tree. CC arch/powerpc/platforms/embedded6xx/wii.o arch/powerpc/platforms/embedded6xx/wii.c: In function ‘wii_memory_fixups’: arch/powerpc/platforms/embedded6xx/wii.c:88:2: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 2 has type ‘phys_addr_t’ [-Werror=format] arch/powerpc/platforms/embedded6xx/wii.c:88:2: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘phys_addr_t’ [-Werror=format] arch/powerpc/platforms/embedded6xx/wii.c:90:2: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 2 has type ‘phys_addr_t’ [-Werror=format] arch/powerpc/platforms/embedded6xx/wii.c:90:2: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘phys_addr_t’ [-Werror=format] cc1: all warnings being treated as errors make[2]: *** [arch/powerpc/platforms/embedded6xx/wii.o] Error 1 make[1]: *** [arch/powerpc/platforms/embedded6xx] Error 2 make: *** [arch/powerpc/platforms] Error 2 Signed-off-by: Shuah Khan CC: sta...@vger.kernel.org 3.0.y --- arch/powerpc/platforms/embedded6xx/wii.c |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/platforms/embedded6xx/wii.c b/arch/powerpc/platforms/embedded6xx/wii.c index 1b5dc1a..d8ff38f 100644 --- a/arch/powerpc/platforms/embedded6xx/wii.c +++ b/arch/powerpc/platforms/embedded6xx/wii.c @@ -85,9 +85,11 @@ void __init wii_memory_fixups(void) wii_hole_start = p[0].base + p[0].size; wii_hole_size = p[1].base - wii_hole_start; - pr_info("MEM1: <%08llx %08llx>\n", p[0].base, p[0].size); + pr_info("MEM1: <%08ulx %08ulx>\n", + (phys_addr_t) p[0].base, (phys_addr_t) p[0].size); pr_info("HOLE: <%08lx %08lx>\n", wii_hole_start, wii_hole_size); - pr_info("MEM2: <%08llx %08llx>\n", p[1].base, p[1].size); + pr_info("MEM2: <%08ulx %08ulx>\n", + (phys_addr_t) p[1].base, (phys_addr_t) p[1].size); p[0].size += wii_hole_size + p[1].size; -- 1.7.9.5 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v2] powerpc: fix wii_memory_fixups() compile error on 3.0.y tree
On Mon, 2012-12-10 at 18:55 +, Ben Hutchings wrote: > On Mon, Dec 10, 2012 at 10:23:16AM -0700, Shuah Khan wrote: > > Fix wii_memory_fixups() the following compile error on 3.0.y tree with > > wii_defconfig on 3.0.y tree. > > > > CC arch/powerpc/platforms/embedded6xx/wii.o > > arch/powerpc/platforms/embedded6xx/wii.c: In function ‘wii_memory_fixups’: > > arch/powerpc/platforms/embedded6xx/wii.c:88:2: error: format ‘%llx’ expects > > argument of type ‘long long unsigned int’, but argument 2 has type > > ‘phys_addr_t’ [-Werror=format] > > arch/powerpc/platforms/embedded6xx/wii.c:88:2: error: format ‘%llx’ expects > > argument of type ‘long long unsigned int’, but argument 3 has type > > ‘phys_addr_t’ [-Werror=format] > > arch/powerpc/platforms/embedded6xx/wii.c:90:2: error: format ‘%llx’ expects > > argument of type ‘long long unsigned int’, but argument 2 has type > > ‘phys_addr_t’ [-Werror=format] > > arch/powerpc/platforms/embedded6xx/wii.c:90:2: error: format ‘%llx’ expects > > argument of type ‘long long unsigned int’, but argument 3 has type > > ‘phys_addr_t’ [-Werror=format] > > cc1: all warnings being treated as errors > > make[2]: *** [arch/powerpc/platforms/embedded6xx/wii.o] Error 1 > > make[1]: *** [arch/powerpc/platforms/embedded6xx] Error 2 > > make: *** [arch/powerpc/platforms] Error 2 > > > > Signed-off-by: Shuah Khan > > CC: sta...@vger.kernel.org 3.0.y > > --- > > arch/powerpc/platforms/embedded6xx/wii.c |6 -- > > 1 file changed, 4 insertions(+), 2 deletions(-) > > > > diff --git a/arch/powerpc/platforms/embedded6xx/wii.c > > b/arch/powerpc/platforms/embedded6xx/wii.c > > index 1b5dc1a..d8ff38f 100644 > > --- a/arch/powerpc/platforms/embedded6xx/wii.c > > +++ b/arch/powerpc/platforms/embedded6xx/wii.c > > @@ -85,9 +85,11 @@ void __init wii_memory_fixups(void) > > wii_hole_start = p[0].base + p[0].size; > > wii_hole_size = p[1].base - wii_hole_start; > > > > - pr_info("MEM1: <%08llx %08llx>\n", p[0].base, p[0].size); > > + pr_info("MEM1: <%08ulx %08ulx>\n", > > + (phys_addr_t) p[0].base, (phys_addr_t) p[0].size); > [...] > > This is incorrect in exactly the same way as the last version, > but with extra redundant casts. > Yes it is. :) That is embarrassing. The lesson is "don't try to work when not feeling well", at least that is my excuse. Thanks for catching it. I will really fix it this time and send a new patch. This bug is in there since Dec 2009, not sure if this is worth fixing, but might as well. de32400dd26e743c5d500aa42d8d6818b79edb73 wii: use both mem1 and mem2 as ram -- Shuah ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v3] powerpc: fix wii_memory_fixups() compile error on 3.0.y tree
Fix wii_memory_fixups() the following compile error on 3.0.y tree with wii_defconfig on 3.0.y tree. CC arch/powerpc/platforms/embedded6xx/wii.o arch/powerpc/platforms/embedded6xx/wii.c: In function ‘wii_memory_fixups’: arch/powerpc/platforms/embedded6xx/wii.c:88:2: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 2 has type ‘phys_addr_t’ [-Werror=format] arch/powerpc/platforms/embedded6xx/wii.c:88:2: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘phys_addr_t’ [-Werror=format] arch/powerpc/platforms/embedded6xx/wii.c:90:2: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 2 has type ‘phys_addr_t’ [-Werror=format] arch/powerpc/platforms/embedded6xx/wii.c:90:2: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘phys_addr_t’ [-Werror=format] cc1: all warnings being treated as errors make[2]: *** [arch/powerpc/platforms/embedded6xx/wii.o] Error 1 make[1]: *** [arch/powerpc/platforms/embedded6xx] Error 2 make: *** [arch/powerpc/platforms] Error 2 Signed-off-by: Shuah Khan CC: sta...@vger.kernel.org 3.0.y --- arch/powerpc/platforms/embedded6xx/wii.c |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/platforms/embedded6xx/wii.c b/arch/powerpc/platforms/embedded6xx/wii.c index 1b5dc1a..daf793b 100644 --- a/arch/powerpc/platforms/embedded6xx/wii.c +++ b/arch/powerpc/platforms/embedded6xx/wii.c @@ -85,9 +85,11 @@ void __init wii_memory_fixups(void) wii_hole_start = p[0].base + p[0].size; wii_hole_size = p[1].base - wii_hole_start; - pr_info("MEM1: <%08llx %08llx>\n", p[0].base, p[0].size); + pr_info("MEM1: <%08llx %08llx>\n", + (unsigned long long) p[0].base, (unsigned long long) p[0].size); pr_info("HOLE: <%08lx %08lx>\n", wii_hole_start, wii_hole_size); - pr_info("MEM2: <%08llx %08llx>\n", p[1].base, p[1].size); + pr_info("MEM2: <%08llx %08llx>\n", + (unsigned long long) p[1].base, (unsigned long long) p[1].size); p[0].size += wii_hole_size + p[1].size; -- 1.7.9.5 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFT][PATCH 04/12] drivers/macintosh/adb: change platform power management to use dev_pm_ops
Change adb platform driver to register pm ops using dev_pm_ops instead of legacy pm_ops. .pm hooks call existing legacy suspend and resume interfaces by passing in the right pm state. Signed-off-by: Shuah Khan --- drivers/macintosh/adb.c | 41 - 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c index 04a5049..df6b201 100644 --- a/drivers/macintosh/adb.c +++ b/drivers/macintosh/adb.c @@ -263,7 +263,7 @@ adb_reset_bus(void) /* * notify clients before sleep */ -static int adb_suspend(struct platform_device *dev, pm_message_t state) +static int __adb_suspend(struct platform_device *dev, pm_message_t state) { adb_got_sleep = 1; /* We need to get a lock on the probe thread */ @@ -276,10 +276,25 @@ static int adb_suspend(struct platform_device *dev, pm_message_t state) return 0; } +static int adb_suspend(struct device *dev) +{ + return __adb_suspend(to_platform_device(dev), PMSG_SUSPEND); +} + +static int adb_freeze(struct device *dev) +{ + return __adb_suspend(to_platform_device(dev), PMSG_FREEZE); +} + +static int adb_poweroff(struct device *dev) +{ + return __adb_suspend(to_platform_device(dev), PMSG_HIBERNATE); +} + /* * reset bus after sleep */ -static int adb_resume(struct platform_device *dev) +static int __adb_resume(struct platform_device *dev) { adb_got_sleep = 0; up(&adb_probe_mutex); @@ -287,6 +302,11 @@ static int adb_resume(struct platform_device *dev) return 0; } + +static int adb_resume(struct device *dev) +{ + return __adb_resume(to_platform_device(dev)); +} #endif /* CONFIG_PM */ static int __init adb_init(void) @@ -831,14 +851,25 @@ static const struct file_operations adb_fops = { .release= adb_release, }; +#ifdef CONFIG_PM +static const struct dev_pm_ops adb_dev_pm_ops = { + .suspend = adb_suspend, + .resume = adb_resume, + /* Hibernate hooks */ + .freeze = adb_freeze, + .thaw = adb_resume, + .poweroff = adb_poweroff, + .restore = adb_resume, +}; +#endif + static struct platform_driver adb_pfdrv = { .driver = { .name = "adb", - }, #ifdef CONFIG_PM - .suspend = adb_suspend, - .resume = adb_resume, + .pm = &adb_dev_pm_ops, #endif + }, }; static struct platform_device adb_pfdev = { -- 1.7.10.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFT][PATCH 00/12] change drivers power management to use dev_pm_ops
Change drivers to register pm ops using dev_pm_ops instead of legacy pm_ops. .pm hooks call existing legacy suspend and resume interfaces by passing in the right pm state. Bus drivers suspend and resume routines call .pm driver hooks if found. Shuah Khan (12): arm: change locomo platform and bus power management to use dev_pm_ops arm: change sa platform and bus power management to use dev_pm_ops arm: change scoop platform power management to use dev_pm_ops drivers/macintosh/adb: change platform power managemnet to use dev_pm_ops mmc: change au1xmmc platform power management to use dev_pm_ops mmc: change bfin_sdh platform power management to use dev_pm_ops isa: change isa bus power managemnet to use dev_pm_ops mmc: change cb710-mmc platform power management to use dev_pm_ops mmc: change msm_sdcc platform power management to use dev_pm_ops mmc: change tmio_mmc platform power management to use dev_pm_ops drivers/pcmcia: change ds driver power management to use dev_pm_ops drivers/s390/crypto: change ap_bus driver power management to use dev_pm_ops arch/arm/common/locomo.c | 93 +++--- arch/arm/common/sa.c | 88 +++ arch/arm/common/scoop.c | 44 drivers/base/isa.c | 30 -- drivers/macintosh/adb.c | 41 --- drivers/mmc/host/au1xmmc.c | 43 +++ drivers/mmc/host/bfin_sdh.c | 40 +++--- drivers/mmc/host/cb710-mmc.c | 37 +++-- drivers/mmc/host/msm_sdcc.c | 42 +++ drivers/mmc/host/tmio_mmc.c | 42 +++ drivers/pcmcia/ds.c | 36 +--- drivers/s390/crypto/ap_bus.c | 30 -- 12 files changed, 481 insertions(+), 85 deletions(-) -- 1.7.10.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V2 07/12] selftests, powerpc: Add test for explicitly changing DSCR value
On 01/13/2015 03:22 AM, Anshuman Khandual wrote: > This patch adds a test which modifies the DSCR using mtspr instruction > and verifies the change using mfspr instruction. It uses both the > privilege state SPR as well as the problem state SPR for the purpose. > > Signed-off-by: Anshuman Khandual > --- > tools/testing/selftests/powerpc/dscr/Makefile | 2 +- > .../selftests/powerpc/dscr/dscr_explicit_test.c| 72 > ++ > 2 files changed, 73 insertions(+), 1 deletion(-) > create mode 100644 tools/testing/selftests/powerpc/dscr/dscr_explicit_test.c > > diff --git a/tools/testing/selftests/powerpc/dscr/Makefile > b/tools/testing/selftests/powerpc/dscr/Makefile > index 0aa90ab..aede453 100644 > --- a/tools/testing/selftests/powerpc/dscr/Makefile > +++ b/tools/testing/selftests/powerpc/dscr/Makefile > @@ -1,4 +1,4 @@ > -PROGS := dscr_default_test > +PROGS := dscr_default_test dscr_explicit_test > > CFLAGS := $(CFLAGS) -lpthread > > diff --git a/tools/testing/selftests/powerpc/dscr/dscr_explicit_test.c > b/tools/testing/selftests/powerpc/dscr/dscr_explicit_test.c > new file mode 100644 > index 000..5c0b7c1 > --- /dev/null > +++ b/tools/testing/selftests/powerpc/dscr/dscr_explicit_test.c > @@ -0,0 +1,72 @@ > +/* > + * POWER Data Stream Control Register (DSCR) explicit test > + * > + * This test modifies the DSCR value using mtspr instruction and > + * verifies the change with mfspr instruction. It uses both the > + * privilege state SPR and the problem state SPR for this purpose. > + * > + * When using the privilege state SPR, the instructions such as > + * mfspr or mtspr are priviledged and the kernel emulates them > + * for us. Instructions using problem state SPR can be exuecuted > + * directly without any emulation if the HW supports them. Else > + * they also get emulated by the kernel. > + * > + * Copyright (C) 2012 Anton Blanchard , IBM > + * Copyright (C) 2015 Anshuman Khandual , IBM > + * > + * This program is free software; you can redistribute it and/or > + * modify it under the terms of the GNU General Public License > + * as published by the Free Software Foundation; either version > + * 2 of the License, or (at your option) any later version. > + */ > +#include "dscr.h" > + > +int test_body(void) > +{ > + unsigned long i, dscr = 0; > + > + srand(getpid()); > + set_dscr(dscr); > + > + for (i = 0; i < COUNT; i++) { > + unsigned long cur_dscr, cur_dscr_usr; > + double ret = uniform_deviate(rand()); > + > + if (ret < 0.001) { > + dscr++; > + if (dscr > DSCR_MAX) > + dscr = 0; > + > + set_dscr(dscr); > + } > + > + cur_dscr = get_dscr(); > + if (cur_dscr != dscr) { > + fprintf(stderr, "Kernel DSCR should be %ld but " > + "is %ld\n", dscr, cur_dscr); > + return 1; > + } > + > + ret = uniform_deviate(rand()); > + if (ret < 0.001) { > + dscr++; > + if (dscr > DSCR_MAX) > + dscr = 0; > + > + set_dscr_usr(dscr); > + } > + > + cur_dscr_usr = get_dscr_usr(); > + if (cur_dscr_usr != dscr) { > + fprintf(stderr, "User DSCR should be %ld but " > + "is %ld\n", dscr, cur_dscr_usr); > + return 1; > + } > + } > + return 0; > +} > + > +int main(int argc, char *argv[]) > +{ > + return test_harness(test_body, "dscr_explicit_test"); > +} > Could you please add a .gitignore for powerpc targets as we discussed earlier. It can be separate patch. Also, I would like to see the test results reports using kselftest.h - it can be separate patch in the interest of getting tests in. Acked-by: Shuah Khan Please take this through powerpc maintainer git. thanks, -- Shuah -- Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America (Silicon Valley) shua...@osg.samsung.com | (970) 217-8978 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V2 08/12] selftests, powerpc: Add test for DSCR SPR numbers
On 01/13/2015 03:22 AM, Anshuman Khandual wrote: > This patch adds a test which verifies that the DSCR privilege and > problem state SPR read & write accesses while making sure that the > results are always the same irrespective of which SPR number is > being used. > > Signed-off-by: Anshuman Khandual > --- > tools/testing/selftests/powerpc/dscr/Makefile | 2 +- > .../selftests/powerpc/dscr/dscr_user_test.c| 62 > ++ > 2 files changed, 63 insertions(+), 1 deletion(-) > create mode 100644 tools/testing/selftests/powerpc/dscr/dscr_user_test.c > > diff --git a/tools/testing/selftests/powerpc/dscr/Makefile > b/tools/testing/selftests/powerpc/dscr/Makefile > index aede453..ae865d8 100644 > --- a/tools/testing/selftests/powerpc/dscr/Makefile > +++ b/tools/testing/selftests/powerpc/dscr/Makefile > @@ -1,4 +1,4 @@ > -PROGS := dscr_default_test dscr_explicit_test > +PROGS := dscr_default_test dscr_explicit_test dscr_user_test > > CFLAGS := $(CFLAGS) -lpthread > > diff --git a/tools/testing/selftests/powerpc/dscr/dscr_user_test.c > b/tools/testing/selftests/powerpc/dscr/dscr_user_test.c > new file mode 100644 > index 000..f25d68e > --- /dev/null > +++ b/tools/testing/selftests/powerpc/dscr/dscr_user_test.c > @@ -0,0 +1,62 @@ > +/* > + * POWER Data Stream Control Register (DSCR) SPR test > + * > + * This test modifies the DSCR value through both the SPR number > + * based mtspr instruction and then makes sure that the same is > + * reflected through mfspr instruction using either of the SPR > + * numbers. > + * > + * When using the privilege state SPR, the instructions such as > + * mfspr or mtspr are priviledged and the kernel emulates them > + * for us. Instructions using problem state SPR can be exuecuted > + * directly without any emulation if the HW supports them. Else > + * they also get emulated by the kernel. > + * > + * Copyright (C) 2013 Anton Blanchard , IBM > + * Copyright (C) 2015 Anshuman Khandual , IBM > + * > + * This program is free software; you can redistribute it and/or > + * modify it under the terms of the GNU General Public License > + * as published by the Free Software Foundation; either version > + * 2 of the License, or (at your option) any later version. > + */ > +#include "dscr.h" > + > +static int check_dscr(char *str) > +{ > + unsigned long cur_dscr, cur_dscr_usr; > + > + cur_dscr = get_dscr(); > + cur_dscr_usr = get_dscr_usr(); > + if (cur_dscr != cur_dscr_usr) { > + printf("%s set, kernel get %lx != user get %lx\n", > + str, cur_dscr, cur_dscr_usr); > + return 1; > + } > + return 0; > +} > + > +int test_body(void) > +{ > + int i; > + > + check_dscr(""); > + > + for (i = 0; i < COUNT; i++) { > + set_dscr(i); > + if (check_dscr("kernel")) > + return 1; > + } > + > + for (i = 0; i < COUNT; i++) { > + set_dscr_usr(i); > + if (check_dscr("user")) > + return 1; > + } > + return 0; > +} > + > +int main(int argc, char *argv[]) > +{ > + return test_harness(test_body, "dscr_user_test"); > +} > Could you please add a .gitignore for powerpc targets as we discussed earlier. It can be separate patch. Also, I would like to see the test results reports using kselftest.h - it can be separate patch in the interest of getting tests in. Acked-by: Shuah Khan Please take this through powerpc maintainer git. thanks, -- Shuah -- Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America (Silicon Valley) shua...@osg.samsung.com | (970) 217-8978 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V2 09/12] selftests, powerpc: Add test for DSCR value inheritence across fork
On 01/13/2015 03:22 AM, Anshuman Khandual wrote: > This patch adds a test to verify that the changed DSCR value inside > any process would be inherited to it's child process across the fork > system call. > > Signed-off-by: Anshuman Khandual > --- > tools/testing/selftests/powerpc/dscr/Makefile | 3 +- > .../selftests/powerpc/dscr/dscr_inherit_test.c | 96 > ++ > 2 files changed, 98 insertions(+), 1 deletion(-) > create mode 100644 tools/testing/selftests/powerpc/dscr/dscr_inherit_test.c > > diff --git a/tools/testing/selftests/powerpc/dscr/Makefile > b/tools/testing/selftests/powerpc/dscr/Makefile > index ae865d8..81239e2 100644 > --- a/tools/testing/selftests/powerpc/dscr/Makefile > +++ b/tools/testing/selftests/powerpc/dscr/Makefile > @@ -1,4 +1,5 @@ > -PROGS := dscr_default_test dscr_explicit_test dscr_user_test > +PROGS := dscr_default_test dscr_explicit_test dscr_user_test \ > + dscr_inherit_test > > CFLAGS := $(CFLAGS) -lpthread > > diff --git a/tools/testing/selftests/powerpc/dscr/dscr_inherit_test.c > b/tools/testing/selftests/powerpc/dscr/dscr_inherit_test.c > new file mode 100644 > index 000..f1add77 > --- /dev/null > +++ b/tools/testing/selftests/powerpc/dscr/dscr_inherit_test.c > @@ -0,0 +1,96 @@ > +/* > + * POWER Data Stream Control Register (DSCR) fork test > + * > + * This testcase modifies the DSCR using mtspr, forks and then > + * verifies that the child process has the correct changed DSCR > + * value using mfspr. > + * > + * When using the privilege state SPR, the instructions such as > + * mfspr or mtspr are priviledged and the kernel emulates them > + * for us. Instructions using problem state SPR can be exuecuted > + * directly without any emulation if the HW supports them. Else > + * they also get emulated by the kernel. > + * > + * Copyright (C) 2012 Anton Blanchard , IBM > + * Copyright (C) 2015 Anshuman Khandual , IBM > + * > + * This program is free software; you can redistribute it and/or > + * modify it under the terms of the GNU General Public License > + * as published by the Free Software Foundation; either version > + * 2 of the License, or (at your option) any later version. > + */ > +#include "dscr.h" > + > +int test_body(void) > +{ > + unsigned long i, dscr = 0; > + pid_t pid; > + > + srand(getpid()); > + set_dscr(dscr); > + > + for (i = 0; i < COUNT; i++) { > + unsigned long cur_dscr, cur_dscr_usr; > + > + dscr++; > + if (dscr > DSCR_MAX) > + dscr = 0; > + > + if (i % 2 == 0) > + set_dscr_usr(dscr); > + else > + set_dscr(dscr); > + > + /* > + * XXX: Force a context switch out so that DSCR > + * current value is copied into the thread struct > + * which is required for the child to inherit the > + * changed value. > + */ > + sleep(1); > + > + pid = fork(); > + if (pid == -1) { > + perror("fork() failed\n"); > + exit(1); > + } else if (pid) { > + int status; > + > + if (waitpid(pid, &status, 0) == -1) { > + perror("waitpid() failed\n"); > + exit(1); > + } > + > + if (!WIFEXITED(status)) { > + fprintf(stderr, "Child didn't exit cleanly\n"); > + exit(1); > + } > + > + if (WEXITSTATUS(status) != 0) { > + fprintf(stderr, "Child didn't exit cleanly\n"); > + return 1; > + } > + } else { > + cur_dscr = get_dscr(); > + if (cur_dscr != dscr) { > + fprintf(stderr, "Kernel DSCR should be %ld " > + "but is %ld\n", dscr, cur_dscr); > + exit(1); > + } > + > + cur_dscr_usr = get_dscr_usr(); > + if (cur_dscr_usr != dscr) { > + fprintf(stderr, "User DSCR should be %ld " > + "but is %ld\n", dscr, cur_dscr_usr); > + exit(1); > + } > + exit(0); >
Re: [PATCH V2 10/12] selftests, powerpc: Add test for DSCR inheritence across fork & exec
} else { > + char dscr_str[16]; > + > + sprintf(dscr_str, "%ld", dscr); > + execlp(prog, prog, "exec", dscr_str, NULL); > + exit(1); > + } > + } > + return 0; > +} > + > +int main(int argc, char *argv[]) > +{ > + if (argc == 3 && !strcmp(argv[1], "exec")) { > + unsigned long parent_dscr; > + > + parent_dscr = atoi(argv[2]); > + do_exec(parent_dscr); > + } else if (argc != 1) { > + fprintf(stderr, "Usage: %s\n", argv[0]); > + exit(1); > + } > + > + strncpy(prog, argv[0], strlen(argv[0])); > + return test_harness(test_body, "dscr_inherit_exec_test"); > +} > Could you please add a .gitignore for powerpc targets as we discussed earlier. It can be separate patch. Also, I would like to see the test results reports using kselftest.h - it can be separate patch in the interest of getting tests in. Acked-by: Shuah Khan Please take this through powerpc maintainer git. thanks, -- Shuah -- Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America (Silicon Valley) shua...@osg.samsung.com | (970) 217-8978 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V2 11/12] selftests, powerpc: Add test for all DSCR sysfs interfaces
On 01/13/2015 03:22 AM, Anshuman Khandual wrote: > This test continuously updates the system wide DSCR default value > in the sysfs interface and makes sure that the same is reflected > across all the sysfs interfaces for each individual CPUs present > on the system. > > Signed-off-by: Anshuman Khandual > --- > tools/testing/selftests/powerpc/dscr/Makefile | 3 +- > .../selftests/powerpc/dscr/dscr_sysfs_test.c | 89 > ++ > 2 files changed, 91 insertions(+), 1 deletion(-) > create mode 100644 tools/testing/selftests/powerpc/dscr/dscr_sysfs_test.c > > diff --git a/tools/testing/selftests/powerpc/dscr/Makefile > b/tools/testing/selftests/powerpc/dscr/Makefile > index 4e84309..fada526 100644 > --- a/tools/testing/selftests/powerpc/dscr/Makefile > +++ b/tools/testing/selftests/powerpc/dscr/Makefile > @@ -1,5 +1,6 @@ > PROGS := dscr_default_test dscr_explicit_test dscr_user_test \ > - dscr_inherit_test dscr_inherit_exec_test > + dscr_inherit_test dscr_inherit_exec_test \ > + dscr_sysfs_test > > CFLAGS := $(CFLAGS) -lpthread > > diff --git a/tools/testing/selftests/powerpc/dscr/dscr_sysfs_test.c > b/tools/testing/selftests/powerpc/dscr/dscr_sysfs_test.c > new file mode 100644 > index 000..3d11439 > --- /dev/null > +++ b/tools/testing/selftests/powerpc/dscr/dscr_sysfs_test.c > @@ -0,0 +1,89 @@ > +/* > + * POWER Data Stream Control Register (DSCR) sysfs interface test > + * > + * This test updates to system wide DSCR default through the sysfs interface > + * and then verifies that all the CPU specific DSCR defaults are updated as > + * well verified from their sysfs interfaces. > + * > + * Copyright (C) 2015 Anshuman Khandual , IBM > + * > + * This program is free software; you can redistribute it and/or > + * modify it under the terms of the GNU General Public License > + * as published by the Free Software Foundation; either version > + * 2 of the License, or (at your option) any later version. > + */ > +#include "dscr.h" > + > +static int check_cpu_dscr_default(char *file, unsigned long val) > +{ > + char buf[10]; > + int fd, rc; > + > + fd = open(file, O_RDWR); > + if (fd == -1) { > + perror("open() failed\n"); > + return 1; > + } > + > + rc = read(fd, buf, sizeof(buf)); > + if (rc == -1) { > + perror("read() failed\n"); > + return 1; > + } > + close(fd); > + > + buf[rc] = '\0'; > + if (strtol(buf, NULL, 16) != val) { > + printf("DSCR match failed: %ld (system) %ld (cpu)\n", > + val, strtol(buf, NULL, 16)); > + return 1; > + } > + return 0; > +} > + > +static int check_all_cpu_dscr_defaults(unsigned long val) > +{ > + DIR *sysfs; > + struct dirent *dp; > + char file[LEN_MAX]; > + > + sysfs = opendir(CPU_PATH); > + if (!sysfs) { > + perror("opendir() failed\n"); > + return 1; > + } > + > + while ((dp = readdir(sysfs))) { > + if (!(dp->d_type & DT_DIR)) > + continue; > + if (!strcmp(dp->d_name, "cpuidle")) > + continue; > + if (!strstr(dp->d_name, "cpu")) > + continue; > + > + sprintf(file, "%s%s/dscr", CPU_PATH, dp->d_name); > + if (check_cpu_dscr_default(file, val)) > + return 1; > + } > + closedir(sysfs); > + return 0; > +} > + > +int test_body(void) > +{ > + int i, j; > + > + for (i = 0; i < COUNT; i++) { > + for (j = 0; j < DSCR_MAX; j++) { > + set_default_dscr(j); > + if (check_all_cpu_dscr_defaults(j)) > + return 1; > + } > + } > + return 0; > +} > + > +int main(int argc, char *argv[]) > +{ > + return test_harness(test_body, "dscr_sysfs_test"); > +} > Could you please add a .gitignore for powerpc targets as we discussed earlier. It can be separate patch. Also, I would like to see the test results reports using kselftest.h - it can be separate patch in the interest of getting tests in. Acked-by: Shuah Khan Please take this through powerpc maintainer git. thanks, -- Shuah -- Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America (Silicon Valley) shua...@osg.samsung.com | (970) 217-8978 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V2 12/12] selftests, powerpc: Add thread based stress test for DSCR sysfs interfaces
} > + > + if (*status[i]) { > + printf(" %ldth thread join failed with %ld\n", > + i, *status[i]); > + return 1; > + } > + } > + return 0; > +} > + > +int test_body(void) > +{ > + int i, j; > + > + result = malloc(sizeof(unsigned long) * sysconf(_SC_NPROCESSORS_ONLN)); > + pthread_mutex_init(&lock, NULL); > + target = 0; > + for (i = 0; i < COUNT; i++) { > + for (j = 0; j < DSCR_MAX; j++) { > + set_default_dscr(j); > + if (check_cpu_dscr_thread(j)) > + return 1; > + } > + } > + free(result); > + return 0; > +} > + > +int main(int argc, char *argv[]) > +{ > + return test_harness(test_body, "dscr_sysfs_thread_test"); > +} > Could you please add a .gitignore for powerpc targets as we discussed earlier. It can be separate patch. Also, I would like to see the test results reports using kselftest.h - it can be separate patch in the interest of getting tests in. Acked-by: Shuah Khan Please take this through powerpc maintainer git. thanks, -- Shuah -- Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America (Silicon Valley) shua...@osg.samsung.com | (970) 217-8978 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] selftests/powerpc: Add .gitignore for powerpc selftests
Please add a commit log. On 01/13/2015 04:49 PM, Michael Ellerman wrote: > Signed-off-by: Michael Ellerman > --- > .../testing/selftests/powerpc/copyloops/.gitignore | 4 > tools/testing/selftests/powerpc/mm/.gitignore | 1 + > tools/testing/selftests/powerpc/pmu/.gitignore | 3 +++ > tools/testing/selftests/powerpc/pmu/ebb/.gitignore | 22 > ++ > .../selftests/powerpc/primitives/.gitignore| 1 + > tools/testing/selftests/powerpc/tm/.gitignore | 1 + > 6 files changed, 32 insertions(+) > create mode 100644 tools/testing/selftests/powerpc/copyloops/.gitignore > create mode 100644 tools/testing/selftests/powerpc/mm/.gitignore > create mode 100644 tools/testing/selftests/powerpc/pmu/.gitignore > create mode 100644 tools/testing/selftests/powerpc/pmu/ebb/.gitignore > create mode 100644 tools/testing/selftests/powerpc/primitives/.gitignore > create mode 100644 tools/testing/selftests/powerpc/tm/.gitignore Please create a single .gitignore for all targets right under tools/testing/selftests/powerpc instead of multiple .gitignore files. thanks, -- Shuah -- Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America (Silicon Valley) shua...@osg.samsung.com | (970) 217-8978 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] selftests/powerpc: Add .gitignore for powerpc selftests
On 01/13/2015 07:15 PM, Michael Ellerman wrote: > On Tue, 2015-01-13 at 17:16 -0700, Shuah Khan wrote: >> Please add a commit log. > > What does it need to say? Explain the change the patch is making. Please see Documentation/SubmittingPatches for details. Looks like this patch is no longer needed as I see a new patch added to the series from Anshuman Khandual. > >> On 01/13/2015 04:49 PM, Michael Ellerman wrote: >>> Signed-off-by: Michael Ellerman >>> --- >>> .../testing/selftests/powerpc/copyloops/.gitignore | 4 >>> tools/testing/selftests/powerpc/mm/.gitignore | 1 + >>> tools/testing/selftests/powerpc/pmu/.gitignore | 3 +++ >>> tools/testing/selftests/powerpc/pmu/ebb/.gitignore | 22 >>> ++ >>> .../selftests/powerpc/primitives/.gitignore| 1 + >>> tools/testing/selftests/powerpc/tm/.gitignore | 1 + >>> 6 files changed, 32 insertions(+) >>> create mode 100644 tools/testing/selftests/powerpc/copyloops/.gitignore >>> create mode 100644 tools/testing/selftests/powerpc/mm/.gitignore >>> create mode 100644 tools/testing/selftests/powerpc/pmu/.gitignore >>> create mode 100644 tools/testing/selftests/powerpc/pmu/ebb/.gitignore >>> create mode 100644 tools/testing/selftests/powerpc/primitives/.gitignore >>> create mode 100644 tools/testing/selftests/powerpc/tm/.gitignore >> >> Please create a single .gitignore for all targets right under >> tools/testing/selftests/powerpc instead of multiple .gitignore >> files. > > Why? Having separate files makes it less likely we'll get merge conflicts > between different test subdirectores, it also makes it more likely someone > adding a test will notice they need to update the .gitignore in the same > directory. > It is a matter of reducing the number of files. I am fine with creating one per directory, if that fits in better with powerpc tests. -- Shuah -- Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America (Silicon Valley) shua...@osg.samsung.com | (970) 217-8978 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] selftest/lkdtm: Use local .gitignore
On 2/27/20 9:17 AM, Kees Cook wrote: On Thu, Feb 27, 2020 at 02:07:10PM +, Christophe Leroy wrote: Commit 68ca0fd272da ("selftest/lkdtm: Don't pollute 'git status'") introduced patterns for git to ignore files generated in tools/testing/selftests/lkdtm/ Use local .gitignore file instead of using the root one. Fixes: 68ca0fd272da ("selftest/lkdtm: Don't pollute 'git status'") Signed-off-by: Christophe Leroy Yeah, that's better. Thanks! Acked-by: Kees Cook I will apply it for next rc. Thanks. I should have noticed the problem in the previous version. It slipped by me. :( thanks, -- Shuah
Re: [PATCH 0/2] selftests: vm: Build fixes for powerpc64
On 1/30/20 12:01 AM, Sandipan Das wrote: The second patch was already posted independently but because of the changes in the first patch, the second one now depends on it. Hence posting it now as a part of this series. The last version (v2) of the second patch can be found at: https://patchwork.ozlabs.org/patch/1225969/ Sandipan Das (2): selftests: vm: Do not override definition of ARCH selftests: vm: Fix 64-bit test builds for powerpc64le tools/testing/selftests/vm/Makefile| 4 ++-- tools/testing/selftests/vm/run_vmtests | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) Michael, I see your tested-by on these two patches. I will take these through kselftest fixes. Sorry for the delay. I assumed these will go through ppc64 or vm. thanks, -- Shuah
Re: [PATCH 1/2] selftests: vm: Do not override definition of ARCH
On 2/10/20 7:49 PM, Michael Ellerman wrote: Sandipan Das writes: Independent builds of the vm selftests is currently broken because commit 7549b3364201 overrides the value of ARCH with the machine name from uname. This does not always match the architecture names used for tasks like header installation. In the interest not adding more delays to this patch, I fixed up the commit log for the following error and applied it. I hope to send this up for next rc. ERROR: Please use git commit description style 'commit <12+ chars of sha1> ("")' - ie: 'commit 7549b3364201 ("selftests: vm: Build/Run 64bit tests only on 64bit arch")' #93: because commit 7549b3364201 overrides the value of ARCH with The fixed up now looks as follows: Independent builds of the vm selftests is currently broken because commit 7549b3364201 ("selftests: vm: Build/Run 64bit tests only on 64bit arch") overrides the value of ARCH with the machine name from uname. This does not always match the architecture names used for tasks like header installation. Please make sure to run checkpatch with --strict to catch these kinds of errors in the future. thanks, -- Shuah
Re: [PATCH v6] selftests: add headers_install to lib.mk
On 09/27/2018 10:52 PM, Michael Ellerman wrote: > [ + linuxppc-dev ] > > Anders Roxell writes: >> If the kernel headers aren't installed we can't build all the tests. >> Add a new make target rule 'khdr' in the file lib.mk to generate the >> kernel headers and that gets include for every test-dir Makefile that >> includes lib.mk If the testdir in turn have its own sub-dirs the >> top_srcdir needs to be set to the linux-rootdir to be able to generate >> the kernel headers. >> >> Signed-off-by: Anders Roxell >> Reviewed-by: Fathi Boudra >> --- >> >> I sent this (v5) a month ago and wondered if it got lost. Resending >> unchanged. >> >> Cheers, >> Anders >> >> Makefile | 14 +- >> scripts/subarch.include| 13 + >> tools/testing/selftests/android/Makefile | 2 +- >> tools/testing/selftests/android/ion/Makefile | 2 ++ >> tools/testing/selftests/futex/functional/Makefile | 1 + >> tools/testing/selftests/gpio/Makefile | 7 ++- >> tools/testing/selftests/kvm/Makefile | 7 ++- >> tools/testing/selftests/lib.mk | 12 >> tools/testing/selftests/net/Makefile | 1 + >> .../selftests/networking/timestamping/Makefile | 1 + >> tools/testing/selftests/vm/Makefile| 4 >> 11 files changed, 36 insertions(+), 28 deletions(-) >> create mode 100644 scripts/subarch.include > > This broke all the powerpc selftests :( Sorry for thr breakage. > > Why did it go in at rc5? > This patch has been in linux-next for a sometime before I decided to send this. My original intent was to send this for rc2, and my schedule was messed up with traveling. Since I didn't hear any issues from linux-next soaking, I made a call on sending this in for rc5. On second thought I should have waited until 4.20. Sorry about that. thanks, -- Shuah
Re: [PATCH] selftest/lkdtm: Don't pollute 'git status'
On 2/20/20 7:58 AM, Christophe Leroy wrote: ping On 02/06/2020 08:11 AM, Christophe Leroy wrote: Commit 46d1a0f03d66 ("selftests/lkdtm: Add tests for LKDTM targets") added generation of lkdtm test scripts. Ignore those generated scripts when performing 'git status' Fixes: 46d1a0f03d66 ("selftests/lkdtm: Add tests for LKDTM targets") Signed-off-by: Christophe Leroy Without this, 'git status' now reports the following crap and real problems are drowned in the middle, that's annoying. I will pull this in. Please cc linux-kselftest mailing list in the future. thanks, -- Shuah
[PATCH RFT] powerpc: dma-mapping: support debug_dma_mapping_error
Add support for debug_dma_mapping_error() call to avoid warning from debug_dma_unmap() interface when it checks for mapping error checked status. Without this patch, device driver failed to check map error warning is generated. Signed-off-by: Shuah Khan --- arch/powerpc/include/asm/dma-mapping.h |1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h index 7816087..e27e9ad 100644 --- a/arch/powerpc/include/asm/dma-mapping.h +++ b/arch/powerpc/include/asm/dma-mapping.h @@ -172,6 +172,7 @@ static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) { struct dma_map_ops *dma_ops = get_dma_ops(dev); + debug_dma_mapping_error(dev, dma_addr); if (dma_ops->mapping_error) return dma_ops->mapping_error(dev, dma_addr); -- 1.7.9.5 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH RFT RESEND linux-next] powerpc: dma-mapping: support debug_dma_mapping_error
Add support for debug_dma_mapping_error() call to avoid warning from debug_dma_unmap() interface when it checks for mapping error checked status. Without this patch, device driver failed to check map error warning is generated. Signed-off-by: Shuah Khan --- arch/powerpc/include/asm/dma-mapping.h |1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h index 7816087..e27e9ad 100644 --- a/arch/powerpc/include/asm/dma-mapping.h +++ b/arch/powerpc/include/asm/dma-mapping.h @@ -172,6 +172,7 @@ static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) { struct dma_map_ops *dma_ops = get_dma_ops(dev); + debug_dma_mapping_error(dev, dma_addr); if (dma_ops->mapping_error) return dma_ops->mapping_error(dev, dma_addr); -- 1.7.9.5 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH RFT RESEND linux-next] powerpc: dma-mapping: support debug_dma_mapping_error
On Fri, 2012-10-26 at 10:08 -0600, Shuah Khan wrote: > Add support for debug_dma_mapping_error() call to avoid warning from > debug_dma_unmap() interface when it checks for mapping error checked > status. Without this patch, device driver failed to check map error > warning is generated. > > Signed-off-by: Shuah Khan > --- > arch/powerpc/include/asm/dma-mapping.h |1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/powerpc/include/asm/dma-mapping.h > b/arch/powerpc/include/asm/dma-mapping.h > index 7816087..e27e9ad 100644 > --- a/arch/powerpc/include/asm/dma-mapping.h > +++ b/arch/powerpc/include/asm/dma-mapping.h > @@ -172,6 +172,7 @@ static inline int dma_mapping_error(struct device *dev, > dma_addr_t dma_addr) > { > struct dma_map_ops *dma_ops = get_dma_ops(dev); > > + debug_dma_mapping_error(dev, dma_addr); > if (dma_ops->mapping_error) > return dma_ops->mapping_error(dev, dma_addr); > Marek, This one is for powerpc to go through your tree with the other arch debug_dma_mapping_error() patches. Thanks, -- Shuah ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 1/9] ARM64: dma_debug: add debug_dma_mapping_error support
Add dma-debug interface debug_dma_mapping_error() to debug drivers that fail to check dma mapping errors on addresses returned by dma_map_single() and dma_map_page() interfaces. Signed-off-by: Shuah Khan Acked-by: Catalin Marinas --- arch/arm64/include/asm/dma-mapping.h |1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/include/asm/dma-mapping.h b/arch/arm64/include/asm/dma-mapping.h index 538f4b4..9947768 100644 --- a/arch/arm64/include/asm/dma-mapping.h +++ b/arch/arm64/include/asm/dma-mapping.h @@ -50,6 +50,7 @@ static inline phys_addr_t dma_to_phys(struct device *dev, dma_addr_t dev_addr) static inline int dma_mapping_error(struct device *dev, dma_addr_t dev_addr) { struct dma_map_ops *ops = get_dma_ops(dev); + debug_dma_mapping_error(dev, dev_addr); return ops->mapping_error(dev, dev_addr); } -- 1.7.9.5 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 2/9] c6x: dma_debug: add debug_dma_mapping_error support
Add dma-debug interface debug_dma_mapping_error() to debug drivers that fail to check dma mapping errors on addresses returned by dma_map_single() and dma_map_page() interfaces. Signed-off-by: Shuah Khan Acked-by: Mark Salter --- arch/c6x/include/asm/dma-mapping.h |1 + 1 file changed, 1 insertion(+) diff --git a/arch/c6x/include/asm/dma-mapping.h b/arch/c6x/include/asm/dma-mapping.h index 03579fd..3c69406 100644 --- a/arch/c6x/include/asm/dma-mapping.h +++ b/arch/c6x/include/asm/dma-mapping.h @@ -32,6 +32,7 @@ static inline int dma_set_mask(struct device *dev, u64 dma_mask) */ static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) { + debug_dma_mapping_error(dev, dma_addr); return dma_addr == ~0; } -- 1.7.9.5 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 0/9] dma_debug: add debug_dma_mapping_error support to architectures that support DMA_DEBUG_API
An earlier patch added dma mapping error debug feature to dma_debug infrastructure. References: https://lkml.org/lkml/2012/10/8/296 https://lkml.org/lkml/2012/11/3/219 The following series of patches adds the call to debug_dma_mapping_error() to architecture specific dma_mapping_error() interfaces on the following architectures that support CONFIG_DMA_API_DEBUG. arm64 c6x ia64 microblaze mips powerpc sh sparc tile arm - Change is already in Marek's dma-mapping tree[1] https://patchwork.kernel.org/patch/1625601/ microblaze - Change is already in linux-next. Including it for completeness linux-next commit f229605441030bcd315c21d97b25889d63ed0130 x86 - done in the first patch that added the feature. ARM64: dma_debug: add debug_dma_mapping_error support c6x: dma_debug: add debug_dma_mapping_error support ia64: dma_debug: add debug_dma_mapping_error support microblaze: dma-mapping: support debug_dma_mapping_error mips: dma_debug: add debug_dma_mapping_error support powerpc: dma_debug: add debug_dma_mapping_error support sh: dma_debug: add debug_dma_mapping_error support sparc: dma_debug: add debug_dma_mapping_error support tile: dma_debug: add debug_dma_mapping_error support Thanks, -- Shuah ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 8/9] sparc: dma_debug: add debug_dma_mapping_error support
Add dma-debug interface debug_dma_mapping_error() to debug drivers that fail to check dma mapping errors on addresses returned by dma_map_single() and dma_map_page() interfaces. Signed-off-by: Shuah Khan Acked-by: David S. Miller --- arch/sparc/include/asm/dma-mapping.h |1 + 1 file changed, 1 insertion(+) diff --git a/arch/sparc/include/asm/dma-mapping.h b/arch/sparc/include/asm/dma-mapping.h index 8493fd3..05fe53f 100644 --- a/arch/sparc/include/asm/dma-mapping.h +++ b/arch/sparc/include/asm/dma-mapping.h @@ -59,6 +59,7 @@ static inline void dma_free_attrs(struct device *dev, size_t size, static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) { + debug_dma_mapping_error(dev, dma_addr); return (dma_addr == DMA_ERROR_CODE); } -- 1.7.9.5 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 9/9] tile: dma_debug: add debug_dma_mapping_error support
Add dma-debug interface debug_dma_mapping_error() to debug drivers that fail to check dma mapping errors on addresses returned by dma_map_single() and dma_map_page() interfaces. Signed-off-by: Shuah Khan --- arch/tile/include/asm/dma-mapping.h |1 + 1 file changed, 1 insertion(+) diff --git a/arch/tile/include/asm/dma-mapping.h b/arch/tile/include/asm/dma-mapping.h index 4b6247d..f2ff191 100644 --- a/arch/tile/include/asm/dma-mapping.h +++ b/arch/tile/include/asm/dma-mapping.h @@ -72,6 +72,7 @@ static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) { + debug_dma_mapping_error(dev, dma_addr); return get_dma_ops(dev)->mapping_error(dev, dma_addr); } -- 1.7.9.5 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 5/9] mips: dma_debug: add debug_dma_mapping_error support
Add dma-debug interface debug_dma_mapping_error() to debug drivers that fail to check dma mapping errors on addresses returned by dma_map_single() and dma_map_page() interfaces. Signed-off-by: Shuah Khan --- arch/mips/include/asm/dma-mapping.h |2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/mips/include/asm/dma-mapping.h b/arch/mips/include/asm/dma-mapping.h index be39a12..006b43e 100644 --- a/arch/mips/include/asm/dma-mapping.h +++ b/arch/mips/include/asm/dma-mapping.h @@ -40,6 +40,8 @@ static inline int dma_supported(struct device *dev, u64 mask) static inline int dma_mapping_error(struct device *dev, u64 mask) { struct dma_map_ops *ops = get_dma_ops(dev); + + debug_dma_mapping_error(dev, mask); return ops->mapping_error(dev, mask); } -- 1.7.9.5 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 6/9] powerpc: dma_debug: add debug_dma_mapping_error support
Add dma-debug interface debug_dma_mapping_error() to debug drivers that fail to check dma mapping errors on addresses returned by dma_map_single() and dma_map_page() interfaces. Signed-off-by: Shuah Khan --- arch/powerpc/include/asm/dma-mapping.h |1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h index 7816087..e27e9ad 100644 --- a/arch/powerpc/include/asm/dma-mapping.h +++ b/arch/powerpc/include/asm/dma-mapping.h @@ -172,6 +172,7 @@ static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) { struct dma_map_ops *dma_ops = get_dma_ops(dev); + debug_dma_mapping_error(dev, dma_addr); if (dma_ops->mapping_error) return dma_ops->mapping_error(dev, dma_addr); -- 1.7.9.5 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 4/9] microblaze: dma-mapping: support debug_dma_mapping_error
Add support for debug_dma_mapping_error() call to avoid warning from debug_dma_unmap() interface when it checks for mapping error checked status. Without this patch, device driver failed to check map error warning is generated. Signed-off-by: Shuah Khan Acked-by: Michal Simek --- This patch is already in linux-next. Including it in this series for completeness. linux-next commit f229605441030bcd315c21d97b25889d63ed0130 -- shuah --- arch/microblaze/include/asm/dma-mapping.h |2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/microblaze/include/asm/dma-mapping.h b/arch/microblaze/include/asm/dma-mapping.h index 01d2282..46460f1 100644 --- a/arch/microblaze/include/asm/dma-mapping.h +++ b/arch/microblaze/include/asm/dma-mapping.h @@ -114,6 +114,8 @@ static inline void __dma_sync(unsigned long paddr, static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) { struct dma_map_ops *ops = get_dma_ops(dev); + + debug_dma_mapping_error(dev, dma_addr); if (ops->mapping_error) return ops->mapping_error(dev, dma_addr); -- 1.7.9.5 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 3/9] ia64: dma_debug: add debug_dma_mapping_error support
Add dma-debug interface debug_dma_mapping_error() to debug drivers that fail to check dma mapping errors on addresses returned by dma_map_single() and dma_map_page() interfaces. Signed-off-by: Shuah Khan --- arch/ia64/include/asm/dma-mapping.h |1 + 1 file changed, 1 insertion(+) diff --git a/arch/ia64/include/asm/dma-mapping.h b/arch/ia64/include/asm/dma-mapping.h index 4f5e814..cf3ab7e 100644 --- a/arch/ia64/include/asm/dma-mapping.h +++ b/arch/ia64/include/asm/dma-mapping.h @@ -58,6 +58,7 @@ static inline void dma_free_attrs(struct device *dev, size_t size, static inline int dma_mapping_error(struct device *dev, dma_addr_t daddr) { struct dma_map_ops *ops = platform_dma_get_ops(dev); + debug_dma_mapping_error(dev, daddr); return ops->mapping_error(dev, daddr); } -- 1.7.9.5 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 7/9] sh: dma_debug: add debug_dma_mapping_error support
Add dma-debug interface debug_dma_mapping_error() to debug drivers that fail to check dma mapping errors on addresses returned by dma_map_single() and dma_map_page() interfaces. Signed-off-by: Shuah Khan --- arch/sh/include/asm/dma-mapping.h |1 + 1 file changed, 1 insertion(+) diff --git a/arch/sh/include/asm/dma-mapping.h b/arch/sh/include/asm/dma-mapping.h index 8bd965e..b437f2c 100644 --- a/arch/sh/include/asm/dma-mapping.h +++ b/arch/sh/include/asm/dma-mapping.h @@ -46,6 +46,7 @@ static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) { struct dma_map_ops *ops = get_dma_ops(dev); + debug_dma_mapping_error(dev, dma_addr); if (ops->mapping_error) return ops->mapping_error(dev, dma_addr); -- 1.7.9.5 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 0/9] dma_debug: add debug_dma_mapping_error support to architectures that support DMA_DEBUG_API
On Mon, 2012-11-26 at 12:22 +0100, Joerg Roedel wrote: > Hi Shuah, > > On Fri, Nov 23, 2012 at 02:29:02PM -0700, Shuah Khan wrote: > > x86 - done in the first patch that added the feature. > > > > ARM64: dma_debug: add debug_dma_mapping_error support > > c6x: dma_debug: add debug_dma_mapping_error support > > ia64: dma_debug: add debug_dma_mapping_error support > > microblaze: dma-mapping: support debug_dma_mapping_error > > mips: dma_debug: add debug_dma_mapping_error support > > powerpc: dma_debug: add debug_dma_mapping_error support > > sh: dma_debug: add debug_dma_mapping_error support > > sparc: dma_debug: add debug_dma_mapping_error support > > tile: dma_debug: add debug_dma_mapping_error support > > Have you compile-tested the invididual archs you are changing here? > Joerg, Yes I compile tested all of them (except microblaze) on Nov 20th linux_next git. The patch for microblaze is already in linux_next when I tried to apply the patch to Nov 20th linux-next and figured that is already covered and skipped that one. -- Shuah ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 21/34] selftests: powerpc: Fix incorrect kernel headers search path
On 1/27/23 06:57, Mathieu Desnoyers wrote: Use $(KHDR_INCLUDES) as lookup path for kernel headers. This prevents building against kernel headers from the build environment in scenarios where kernel headers are installed into a specific output directory (O=...). Signed-off-by: Mathieu Desnoyers Cc: Shuah Khan Cc: linux-kselft...@vger.kernel.org Cc: Ingo Molnar Cc: [5.18+] --- tools/testing/selftests/powerpc/ptrace/Makefile | 2 +- tools/testing/selftests/powerpc/security/Makefile | 2 +- tools/testing/selftests/powerpc/syscalls/Makefile | 2 +- tools/testing/selftests/powerpc/tm/Makefile | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/powerpc/ptrace/Makefile b/tools/testing/selftests/powerpc/ptrace/Makefile index 2f02cb54224d..cbeeaeae8837 100644 --- a/tools/testing/selftests/powerpc/ptrace/Makefile +++ b/tools/testing/selftests/powerpc/ptrace/Makefile @@ -33,7 +33,7 @@ TESTS_64 := $(patsubst %,$(OUTPUT)/%,$(TESTS_64)) $(TESTS_64): CFLAGS += -m64 $(TM_TESTS): CFLAGS += -I../tm -mhtm -CFLAGS += -I../../../../../usr/include -fno-pie +CFLAGS += $(KHDR_INCLUDES) -fno-pie $(OUTPUT)/ptrace-gpr: ptrace-gpr.S $(OUTPUT)/ptrace-pkey $(OUTPUT)/core-pkey: LDLIBS += -pthread diff --git a/tools/testing/selftests/powerpc/security/Makefile b/tools/testing/selftests/powerpc/security/Makefile index 7488315fd847..e0d979ab0204 100644 --- a/tools/testing/selftests/powerpc/security/Makefile +++ b/tools/testing/selftests/powerpc/security/Makefile @@ -5,7 +5,7 @@ TEST_PROGS := mitigation-patching.sh top_srcdir = ../../../../.. -CFLAGS += -I../../../../../usr/include +CFLAGS += $(KHDR_INCLUDES) include ../../lib.mk diff --git a/tools/testing/selftests/powerpc/syscalls/Makefile b/tools/testing/selftests/powerpc/syscalls/Makefile index b63f8459c704..d1f2648b112b 100644 --- a/tools/testing/selftests/powerpc/syscalls/Makefile +++ b/tools/testing/selftests/powerpc/syscalls/Makefile @@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only TEST_GEN_PROGS := ipc_unmuxed rtas_filter -CFLAGS += -I../../../../../usr/include +CFLAGS += $(KHDR_INCLUDES) top_srcdir = ../../../../.. include ../../lib.mk diff --git a/tools/testing/selftests/powerpc/tm/Makefile b/tools/testing/selftests/powerpc/tm/Makefile index 5881e97c73c1..3876805c2f31 100644 --- a/tools/testing/selftests/powerpc/tm/Makefile +++ b/tools/testing/selftests/powerpc/tm/Makefile @@ -17,7 +17,7 @@ $(TEST_GEN_PROGS): ../harness.c ../utils.c CFLAGS += -mhtm $(OUTPUT)/tm-syscall: tm-syscall-asm.S -$(OUTPUT)/tm-syscall: CFLAGS += -I../../../../../usr/include +$(OUTPUT)/tm-syscall: CFLAGS += $(KHDR_INCLUDES) $(OUTPUT)/tm-tmspr: CFLAGS += -pthread $(OUTPUT)/tm-vmx-unavail: CFLAGS += -pthread -m64 $(OUTPUT)/tm-resched-dscr: ../pmu/lib.c Adding powerpc maitainers. Would you me to take this patch through kselftest tree? If you decide to take this through yours: Acked-by: Shuah Khan thanks, -- Shuah
Re: [PATCH 00/34] selftests: Fix incorrect kernel headers search path
On 1/27/23 06:57, Mathieu Desnoyers wrote: Hi, This series fixes incorrect kernel header search path in kernel selftests. Near the end of the series, a few changes are not tagged as "Fixes" because the current behavior is to rely on the kernel sources uapi files rather than on the installed kernel header files. Nevertheless, those are updated for consistency. There are situations where "../../../../include/" was added to -I search path, which is bogus for userspace tests and caused issues with types.h. Those are removed. Thanks, Mathieu Mathieu Desnoyers (34): The below patches are now applied to linux-kselftest next for Linux 6.3-rc1 selftests: arm64: Fix incorrect kernel headers search path selftests: clone3: Fix incorrect kernel headers search path selftests: core: Fix incorrect kernel headers search path selftests: dma: Fix incorrect kernel headers search path selftests: dmabuf-heaps: Fix incorrect kernel headers search path selftests: drivers: Fix incorrect kernel headers search path selftests: filesystems: Fix incorrect kernel headers search path selftests: futex: Fix incorrect kernel headers search path selftests: gpio: Fix incorrect kernel headers search path selftests: ipc: Fix incorrect kernel headers search path selftests: kcmp: Fix incorrect kernel headers search path selftests: media_tests: Fix incorrect kernel headers search path selftests: membarrier: Fix incorrect kernel headers search path selftests: mount_setattr: Fix incorrect kernel headers search path selftests: move_mount_set_group: Fix incorrect kernel headers search path selftests: perf_events: Fix incorrect kernel headers search path selftests: pid_namespace: Fix incorrect kernel headers search path selftests: pidfd: Fix incorrect kernel headers search path selftests: ptp: Fix incorrect kernel headers search path selftests: rseq: Fix incorrect kernel headers search path selftests: sched: Fix incorrect kernel headers search path selftests: seccomp: Fix incorrect kernel headers search path selftests: sync: Fix incorrect kernel headers search path selftests: user_events: Fix incorrect kernel headers search path selftests: vm: Fix incorrect kernel headers search path selftests: x86: Fix incorrect kernel headers search path selftests: iommu: Use installed kernel headers search path selftests: memfd: Use installed kernel headers search path selftests: ptrace: Use installed kernel headers search path selftests: tdx: Use installed kernel headers search path These will be applied by maintainers to their trees. selftests: bpf: Fix incorrect kernel headers search path # 02/34 selftests: net: Fix incorrect kernel headers search path # 17/34 selftests: powerpc: Fix incorrect kernel headers search path # 21/34 selftests: bpf docs: Use installed kernel headers search path # 30/34 thanks, -- Shuah
Re: [PATCH 00/34] selftests: Fix incorrect kernel headers search path
On 1/30/23 16:45, Alexei Starovoitov wrote: On Mon, Jan 30, 2023 at 2:46 PM Shuah Khan wrote: On 1/27/23 06:57, Mathieu Desnoyers wrote: Hi, This series fixes incorrect kernel header search path in kernel selftests. Near the end of the series, a few changes are not tagged as "Fixes" because the current behavior is to rely on the kernel sources uapi files rather than on the installed kernel header files. Nevertheless, those are updated for consistency. There are situations where "../../../../include/" was added to -I search path, which is bogus for userspace tests and caused issues with types.h. Those are removed. Thanks, Mathieu Mathieu Desnoyers (34): The below patches are now applied to linux-kselftest next for Linux 6.3-rc1 selftests: arm64: Fix incorrect kernel headers search path selftests: clone3: Fix incorrect kernel headers search path selftests: core: Fix incorrect kernel headers search path selftests: dma: Fix incorrect kernel headers search path selftests: dmabuf-heaps: Fix incorrect kernel headers search path selftests: drivers: Fix incorrect kernel headers search path selftests: filesystems: Fix incorrect kernel headers search path selftests: futex: Fix incorrect kernel headers search path selftests: gpio: Fix incorrect kernel headers search path selftests: ipc: Fix incorrect kernel headers search path selftests: kcmp: Fix incorrect kernel headers search path selftests: media_tests: Fix incorrect kernel headers search path selftests: membarrier: Fix incorrect kernel headers search path selftests: mount_setattr: Fix incorrect kernel headers search path selftests: move_mount_set_group: Fix incorrect kernel headers search path selftests: perf_events: Fix incorrect kernel headers search path selftests: pid_namespace: Fix incorrect kernel headers search path selftests: pidfd: Fix incorrect kernel headers search path selftests: ptp: Fix incorrect kernel headers search path selftests: rseq: Fix incorrect kernel headers search path selftests: sched: Fix incorrect kernel headers search path selftests: seccomp: Fix incorrect kernel headers search path selftests: sync: Fix incorrect kernel headers search path selftests: user_events: Fix incorrect kernel headers search path selftests: vm: Fix incorrect kernel headers search path selftests: x86: Fix incorrect kernel headers search path selftests: iommu: Use installed kernel headers search path selftests: memfd: Use installed kernel headers search path selftests: ptrace: Use installed kernel headers search path selftests: tdx: Use installed kernel headers search path These will be applied by maintainers to their trees. Not in this form. They break the build. Mathieu is sending you the patches in the format you requested in the thread on this patch. thanks, -- Shuah
Re: [PATCH 00/34] selftests: Fix incorrect kernel headers search path
Hi Mathieu, On 1/30/23 15:29, Shuah Khan wrote: On 1/27/23 06:57, Mathieu Desnoyers wrote: Hi, This series fixes incorrect kernel header search path in kernel selftests. Near the end of the series, a few changes are not tagged as "Fixes" because the current behavior is to rely on the kernel sources uapi files rather than on the installed kernel header files. Nevertheless, those are updated for consistency. There are situations where "../../../../include/" was added to -I search path, which is bogus for userspace tests and caused issues with types.h. Those are removed. Thanks again for taking care of this. I did out of tree build testing on x86 on linux-kselftest next with these patches below. I haven't seen any problems introduced by the patch set. selftests: dma: Fix incorrect kernel headers search path This one needs a change and I will send a patch on top of yours. Even with that this test depends on unexported header from the repo and won't build out of tree. This is not related to your change. selftests: mount_setattr: Fix incorrect kernel headers search path This one fails to build with our without patch - an existing error. I have to do cross-build tests on arm64 and other arch patches still. This will happen later this week. selftests: arm64: Fix incorrect kernel headers search path drivers patch below had arch specific tests - testing todo The rest looks good. I will try to run bpf patches on my system. I do have clang, llvm installed on mine. TODO thanks, -- Shuah
Re: [PATCH 00/34] selftests: Fix incorrect kernel headers search path
On 2/1/23 19:07, Shuah Khan wrote: Hi Mathieu, On 1/30/23 15:29, Shuah Khan wrote: On 1/27/23 06:57, Mathieu Desnoyers wrote: Hi, This series fixes incorrect kernel header search path in kernel selftests. Near the end of the series, a few changes are not tagged as "Fixes" because the current behavior is to rely on the kernel sources uapi files rather than on the installed kernel header files. Nevertheless, those are updated for consistency. There are situations where "../../../../include/" was added to -I search path, which is bogus for userspace tests and caused issues with types.h. Those are removed. Thanks again for taking care of this. I did out of tree build testing on x86 on linux-kselftest next with these patches below. I haven't seen any problems introduced by the patch set. selftests: dma: Fix incorrect kernel headers search path This one needs a change and I will send a patch on top of yours. Even with that this test depends on unexported header from the repo and won't build out of tree. This is not related to your change. selftests: mount_setattr: Fix incorrect kernel headers search path This one fails to build with our without patch - an existing error. I have to do cross-build tests on arm64 and other arch patches still. This will happen later this week. arm64, s390 patches look good. thanks, -- Shuah
Re: [PATCH 00/34] selftests: Fix incorrect kernel headers search path
On 2/3/23 18:06, Shuah Khan wrote: On 2/1/23 19:07, Shuah Khan wrote: Hi Mathieu, On 1/30/23 15:29, Shuah Khan wrote: On 1/27/23 06:57, Mathieu Desnoyers wrote: Hi, This series fixes incorrect kernel header search path in kernel selftests. Near the end of the series, a few changes are not tagged as "Fixes" because the current behavior is to rely on the kernel sources uapi files rather than on the installed kernel header files. Nevertheless, those are updated for consistency. There are situations where "../../../../include/" was added to -I search path, which is bogus for userspace tests and caused issues with types.h. Those are removed. Thanks again for taking care of this. I did out of tree build testing on x86 on linux-kselftest next with these patches below. I haven't seen any problems introduced by the patch set. selftests: dma: Fix incorrect kernel headers search path This one needs a change and I will send a patch on top of yours. Even with that this test depends on unexported header from the repo and won't build out of tree. This is not related to your change. selftests: mount_setattr: Fix incorrect kernel headers search path This one fails to build with our without patch - an existing error. I have to do cross-build tests on arm64 and other arch patches still. This will happen later this week. arm64, s390 patches look good. I am seeing problem with selftests/dma and selfttests/user_events. 1. selftests: dma: Fix incorrect kernel headers search path dma test no longer builds. This test depends on linux/map_benchmark.h which is not included in uapi The order of include directorries -isystem followed by installed kernel headers, breaks the test build with the change to use KHDR_INCLUDES I am going to revert this patch for now and figure a longer term fix. The problem is the dependency on a non-uapi file: linux/map_benchmark.h Fixes: 8ddde07a3d28 ("dma-mapping: benchmark: extract a common header file for map_benchmark definition") change added this dependency on including linux/map_benchmark.h Christoph, Do you see this map_benchmark.h as part of uapi? 2. selftests: user_events: Fix incorrect kernel headers search path This one depends on linux/user_events.h which has bee removed from uapi in this commit: commit 5cfff569cab8bf544bab62c911c5d6efd5af5e05 Author: Steven Rostedt (Google) Date: Fri Apr 1 14:39:03 2022 -0400 tracing: Move user_events.h temporarily out of include/uapi This isn't a regression from 6.2 - this test stopped building once user_events.h has been removed from uapi. I will add a note that this test depends on a non-uapi header and can't be built at the moment. thanks, -- Shuah
Re: [PATCH v13 25/35] KVM: selftests: Convert lib's mem regions to KVM_SET_USER_MEMORY_REGION2
On 4/25/24 08:12, Dan Carpenter wrote: On Fri, Oct 27, 2023 at 11:22:07AM -0700, Sean Christopherson wrote: Use KVM_SET_USER_MEMORY_REGION2 throughout KVM's selftests library so that support for guest private memory can be added without needing an entirely separate set of helpers. Note, this obviously makes selftests backwards-incompatible with older KVM ^^ versions from this point forward. ^ Is there a way we could disable the tests on older kernels instead of making them fail? Check uname or something? There is probably a standard way to do this... It's these tests which fail. They shouldn't fail - the tests should be skipped on older kernels. If it is absolutely necessary to dd uname to check kernel version, refer to zram/zram_lib.sh for an example. thanks, -- Shuah
Re: [PATCH v13 25/35] KVM: selftests: Convert lib's mem regions to KVM_SET_USER_MEMORY_REGION2
On 4/25/24 09:09, Sean Christopherson wrote: On Thu, Apr 25, 2024, Shuah Khan wrote: On 4/25/24 08:12, Dan Carpenter wrote: On Fri, Oct 27, 2023 at 11:22:07AM -0700, Sean Christopherson wrote: Use KVM_SET_USER_MEMORY_REGION2 throughout KVM's selftests library so that support for guest private memory can be added without needing an entirely separate set of helpers. Note, this obviously makes selftests backwards-incompatible with older KVM ^^ versions from this point forward. ^ Is there a way we could disable the tests on older kernels instead of making them fail? Check uname or something? There is probably a standard way to do this... It's these tests which fail. They shouldn't fail - the tests should be skipped on older kernels. Ah, that makes sense. Except for a few outliers that aren't all that interesting, all KVM selftests create memslots, so I'm tempted to just make it a hard requirement to spare us headache, e.g. diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c index b2262b5fad9e..4b2038b1f11f 100644 --- a/tools/testing/selftests/kvm/lib/kvm_util.c +++ b/tools/testing/selftests/kvm/lib/kvm_util.c @@ -2306,6 +2306,9 @@ void __attribute((constructor)) kvm_selftest_init(void) /* Tell stdout not to buffer its content. */ setbuf(stdout, NULL); + __TEST_REQUIRE(kvm_has_cap(KVM_CAP_USER_MEMORY2), + "KVM selftests from v6.8+ require KVM_SET_USER_MEMORY_REGION2"); + kvm_selftest_arch_init(); } -- but it's also easy enough to be more precise and skip only those that actually create memslots. This is approach is what is recommended in kselfest document. Rubn as many tests as possible and skip the ones that can't be run due to unmet dependencies. diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c index b2262b5fad9e..b21152adf448 100644 --- a/tools/testing/selftests/kvm/lib/kvm_util.c +++ b/tools/testing/selftests/kvm/lib/kvm_util.c @@ -944,6 +944,9 @@ int __vm_set_user_memory_region2(struct kvm_vm *vm, uint32_t slot, uint32_t flag .guest_memfd_offset = guest_memfd_offset, }; + __TEST_REQUIRE(kvm_has_cap(KVM_CAP_USER_MEMORY2), + "KVM selftests from v6.8+ require KVM_SET_USER_MEMORY_REGION2"); + return ioctl(vm->fd, KVM_SET_USER_MEMORY_REGION2, ®ion); } @@ -970,6 +973,9 @@ void vm_mem_add(struct kvm_vm *vm, enum vm_mem_backing_src_type src_type, size_t mem_size = npages * vm->page_size; size_t alignment; + __TEST_REQUIRE(kvm_has_cap(KVM_CAP_USER_MEMORY2), + "KVM selftests from v6.8+ require KVM_SET_USER_MEMORY_REGION2"); + TEST_ASSERT(vm_adjust_num_guest_pages(vm->mode, npages) == npages, "Number of guest pages is not compatible with the host. " "Try npages=%d", vm_adjust_num_guest_pages(vm->mode, npages)); -- thanks, -- Shuah
Re: [PATCH v2] selftests/seccomp: fix ptrace tests on powerpc
variant->use_ptrace ? tracer_ptrace : tracer_seccomp, - NULL, variant->use_ptrace); + variant->use_ptrace ? (void *) variant + : NULL, + variant->use_ptrace); ret = prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0); ASSERT_EQ(0, ret); Hi Kees, If you want to take this through your tree: Acked-by: Shuah Khan thanks, -- Shuah
Re: [PATCH] testing/selftests/mqueue: Fix mq_perf_tests to free the allocated cpu set
On 4/6/22 11:57 AM, Athira Rajeev wrote: The selftest "mqueue/mq_perf_tests.c" use CPU_ALLOC to allocate CPU set. This cpu set is used further in pthread_attr_setaffinity_np and by pthread_create in the code. But in current code, allocated cpu set is not freed. Fix this by adding CPU_FREE after its usage is done. Good find. Signed-off-by: Athira Rajeev --- tools/testing/selftests/mqueue/mq_perf_tests.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/mqueue/mq_perf_tests.c b/tools/testing/selftests/mqueue/mq_perf_tests.c index b019e0b8221c..17c41f216bef 100644 --- a/tools/testing/selftests/mqueue/mq_perf_tests.c +++ b/tools/testing/selftests/mqueue/mq_perf_tests.c @@ -732,6 +732,7 @@ int main(int argc, char *argv[]) pthread_attr_destroy(&thread_attr); } + CPU_FREE(cpu_set); if (!continuous_mode) { pthread_join(cpu_threads[0], &retval); shutdown((long)retval, "perf_test_thread()", __LINE__); CPU_ALLOC() is called very early on in main() and there are a few error paths that exit without calling CPU_FREE. This change doesn't fully fix the problem. Review the other exit paths where CPU_FREE is needed. thanks, -- Shuah
Re: [PATCH V2] testing/selftests/mqueue: Fix mq_perf_tests to free the allocated cpu set
On 4/7/22 12:40 PM, Athira Rajeev wrote: The selftest "mqueue/mq_perf_tests.c" use CPU_ALLOC to allocate CPU set. This cpu set is used further in pthread_attr_setaffinity_np and by pthread_create in the code. But in current code, allocated cpu set is not freed. Fix this issue by adding CPU_FREE in the "shutdown" function which is called in most of the error/exit path for the cleanup. Also add CPU_FREE in some of the error paths where shutdown is not called. Fixes: 7820b0715b6f ("tools/selftests: add mq_perf_tests") Signed-off-by: Athira Rajeev --- Changelog: From v1 -> v2: Addressed review comment from Shuah Khan to add CPU_FREE in other exit paths where it is needed Thank you. I have a couple of comments on making the error paths simpler. Please see below. tools/testing/selftests/mqueue/mq_perf_tests.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/mqueue/mq_perf_tests.c b/tools/testing/selftests/mqueue/mq_perf_tests.c index b019e0b8221c..182434c7898d 100644 --- a/tools/testing/selftests/mqueue/mq_perf_tests.c +++ b/tools/testing/selftests/mqueue/mq_perf_tests.c @@ -180,6 +180,9 @@ void shutdown(int exit_val, char *err_cause, int line_no) if (in_shutdown++) return; + /* Free the cpu_set allocated using CPU_ALLOC in main function */ + CPU_FREE(cpu_set); + for (i = 0; i < num_cpus_to_pin; i++) if (cpu_threads[i]) { pthread_kill(cpu_threads[i], SIGUSR1); @@ -589,6 +592,7 @@ int main(int argc, char *argv[]) cpu_set)) { fprintf(stderr, "Any given CPU may " "only be given once.\n"); + CPU_FREE(cpu_set); This could be done in a common error path handling. exit(1); } else CPU_SET_S(cpus_to_pin[cpu], @@ -607,6 +611,7 @@ int main(int argc, char *argv[]) queue_path = malloc(strlen(option) + 2); if (!queue_path) { perror("malloc()"); + CPU_FREE(cpu_set); This could be done in a common error path handling. exit(1); } queue_path[0] = '/'; @@ -619,6 +624,7 @@ int main(int argc, char *argv[]) } if (continuous_mode && num_cpus_to_pin == 0) { + CPU_FREE(cpu_set); This could be done in a common error path handling. fprintf(stderr, "Must pass at least one CPU to continuous " "mode.\n"); poptPrintUsage(popt_context, stderr, 0); @@ -628,10 +634,12 @@ int main(int argc, char *argv[]) cpus_to_pin[0] = cpus_online - 1; } - if (getuid() != 0) + if (getuid() != 0) { + CPU_FREE(cpu_set); ksft_exit_skip("Not running as root, but almost all tests " "require root in order to modify\nsystem settings. " "Exiting.\n"); + } Why not move this check before CPU_ALLOC and make this the very first check in main()? With this change the other places where CPU_FREE is added right before exit(1). Something like this: err_code: CPU_FREE(cpu_set); exit(code) max_msgs = fopen(MAX_MSGS, "r+"); max_msgsize = fopen(MAX_MSGSIZE, "r+"); thanks, -- Shuah
Re: [PATCH V3] testing/selftests/mqueue: Fix mq_perf_tests to free the allocated cpu set
On 4/8/22 1:24 AM, Athira Rajeev wrote: The selftest "mqueue/mq_perf_tests.c" use CPU_ALLOC to allocate CPU set. This cpu set is used further in pthread_attr_setaffinity_np and by pthread_create in the code. But in current code, allocated cpu set is not freed. Fix this issue by adding CPU_FREE in the "shutdown" function which is called in most of the error/exit path for the cleanup. There are few error paths which exit without using shutdown. Add a common goto error path with CPU_FREE for these cases. Fixes: 7820b0715b6f ("tools/selftests: add mq_perf_tests") Signed-off-by: Athira Rajeev --- Changelog: From v2 -> v3: Addressed review comment from Shuah Khan to add common "goto" error path with CPU_FREE for few exit cases. From v1 -> v2: Addressed review comment from Shuah Khan to add CPU_FREE in other exit paths where it is needed Thank you. I will queue this up for Linux 5.18-rc3 thanks, -- Shuah
Re: [PATCH 2/2] selftest/cpuidle: Add support for cpuidle latency measurement
On 7/7/20 9:29 AM, Pratik Rajesh Sampat wrote: This patch adds support to trace IPI based and timer based wakeup latency from idle states Latches onto the test-cpuidle_latency kernel module using the debugfs interface to send IPIs or schedule a timer based event, which in-turn populates the debugfs with the latency measurements. Currently for the IPI and timer tests; first disable all idle states and then test for latency measurements incrementally enabling each state Signed-off-by: Pratik Rajesh Sampat --- tools/testing/selftests/Makefile | 1 + tools/testing/selftests/cpuidle/Makefile | 6 + tools/testing/selftests/cpuidle/cpuidle.sh | 240 + tools/testing/selftests/cpuidle/settings | 1 + 4 files changed, 248 insertions(+) create mode 100644 tools/testing/selftests/cpuidle/Makefile create mode 100755 tools/testing/selftests/cpuidle/cpuidle.sh create mode 100644 tools/testing/selftests/cpuidle/settings diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile index 1195bd85af38..ab6cf51f3518 100644 --- a/tools/testing/selftests/Makefile +++ b/tools/testing/selftests/Makefile @@ -7,6 +7,7 @@ TARGETS += capabilities TARGETS += cgroup TARGETS += clone3 TARGETS += cpufreq +TARGETS += cpuidle TARGETS += cpu-hotplug TARGETS += drivers/dma-buf TARGETS += efivarfs diff --git a/tools/testing/selftests/cpuidle/Makefile b/tools/testing/selftests/cpuidle/Makefile new file mode 100644 index ..72fd5d2e974d --- /dev/null +++ b/tools/testing/selftests/cpuidle/Makefile @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0 +all: + +TEST_PROGS := cpuidle.sh + +include ../lib.mk diff --git a/tools/testing/selftests/cpuidle/cpuidle.sh b/tools/testing/selftests/cpuidle/cpuidle.sh new file mode 100755 index ..11666fe47c34 --- /dev/null +++ b/tools/testing/selftests/cpuidle/cpuidle.sh @@ -0,0 +1,240 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 + +LOG=cpuidle.log +MODULE=/lib/modules/$(uname -r)/kernel/drivers/cpuidle/test-cpuidle_latency.ko + +helpme() +{ + printf "Usage: $0 [-h] [-todg args] + [-h ] + [-m ] + [-o ] + \n" + exit 2 +} + +parse_arguments() +{ + while getopts ht:m:o: arg + do + case $arg in + h) # --help + helpme + ;; + m) # --mod-file + MODULE=$OPTARG + ;; + o) # output log files + LOG=$OPTARG + ;; + \?) + helpme + ;; + esac + done +} + +ins_mod() +{ + if [ ! -f "$MODULE" ]; then + printf "$MODULE module does not exist. Exitting\n" + exit 2 Please use ksft_skip code to indicate the test is being skipped. + fi + printf "Inserting $MODULE module\n\n" + insmod $MODULE + if [ $? != 0 ]; then + printf "Insmod $MODULE failed\n" + exit 2 This is fine since you expect to be able to load the module. + fi +} + +compute_average() +{ + arr=("$@") + sum=0 + size=${#arr[@]} + for i in "${arr[@]}" + do + sum=$((sum + i)) + done + avg=$((sum/size)) +} + +# Disable all stop states +disable_idle() +{ + for ((cpu=0; cpu /sys/devices/system/cpu/cpu$cpu/cpuidle/state$state/disable + done + done +} + +# Enable the idle state supplied +# $1: State to enable +enable_state() +{ + for ((cpu=0; cpu /sys/devices/system/cpu/cpu$cpu/cpuidle/state$1/disable + done +} + +# Extract latency in microseconds and convert to nanoseconds +extract_latency() +{ + for ((state=0; state /dev/null & + yes_pid=$! +fi +taskset 0x1 echo $dest_cpu > /sys/kernel/debug/latency_test/ipi_cpu_dest +ipi_latency=$(cat /sys/kernel/debug/latency_test/ipi_latency_ns) +src_cpu=$(cat /sys/kernel/debug/latency_test/ipi_cpu_src) +if [ "$1" = "baseline" ]; then + kill $yes_pid + wait $yes_pid 2>/dev/null +fi +} + +# Incrementally Enable idle states one by one and compute the latency +run_ipi_tests() +{ +extract_latency +disable_idle +declare -a avg_arr +declare -a baseline_avg_array + +echo -e "--IPI Latency Test---" >> $LOG +for ((state=0; state> $LOG + enable_state $state + printf "%s %10s %12s %12s\n" "SRC_CPU" "DEST_CPU" "Base_IPI_Latency(ns)" "IPI_Latency(ns)" >> $LOG + unset avg_arr + unset baseline_avg_arr + for ((cpu=0; cpu> $LOG + avg_arr+=($ipi_l
Re: [PATCH linux-next] powerpc/tm: remove duplicate include in tm-poison.c
On 8/5/21 12:52 AM, cgel@gmail.com wrote: From: yong yiran 'inttypes.h' included in 'tm-poison.c' is duplicated. Remove all but the first include of inttypes.h from tm-poison.c. Reported-by: Zeal Robot Signed-off-by: yong yiran --- tools/testing/selftests/powerpc/tm/tm-poison.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/testing/selftests/powerpc/tm/tm-poison.c b/tools/testing/selftests/powerpc/tm/tm-poison.c index 29e5f26af7b9..27c083a03d1f 100644 --- a/tools/testing/selftests/powerpc/tm/tm-poison.c +++ b/tools/testing/selftests/powerpc/tm/tm-poison.c @@ -20,7 +20,6 @@ #include #include #include -#include #include "tm.h" We can't accept this patch. The from and Signed-off-by don't match. thanks, -- Shuah
Re: [PATCH linux-next] selftests/powerpc: remove duplicate include
On 8/23/21 9:05 PM, CGEL wrote: From: Changcheng Deng Clean up the following includecheck warning: ./tools/testing/selftests/powerpc/tm/tm-poison.c: inttypes.h is included more than once. No functional change. Reported-by: Zeal Robot Signed-off-by: Changcheng Deng --- tools/testing/selftests/powerpc/tm/tm-poison.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/testing/selftests/powerpc/tm/tm-poison.c b/tools/testing/selftests/powerpc/tm/tm-poison.c index 29e5f26..27c083a 100644 --- a/tools/testing/selftests/powerpc/tm/tm-poison.c +++ b/tools/testing/selftests/powerpc/tm/tm-poison.c @@ -20,7 +20,6 @@ #include #include #include -#include #include "tm.h" We can't accept this patch. The from and Signed-off-by don't match. thanks, -- Shuah
Re: [PATCH linux-next] selftests/powerpc: remove duplicate include
On 8/24/21 10:35 AM, Christophe Leroy wrote: Le 24/08/2021 à 16:41, Shuah Khan a écrit : On 8/23/21 9:05 PM, CGEL wrote: From: Changcheng Deng Clean up the following includecheck warning: ./tools/testing/selftests/powerpc/tm/tm-poison.c: inttypes.h is included more than once. No functional change. Reported-by: Zeal Robot Signed-off-by: Changcheng Deng --- tools/testing/selftests/powerpc/tm/tm-poison.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/testing/selftests/powerpc/tm/tm-poison.c b/tools/testing/selftests/powerpc/tm/tm-poison.c index 29e5f26..27c083a 100644 --- a/tools/testing/selftests/powerpc/tm/tm-poison.c +++ b/tools/testing/selftests/powerpc/tm/tm-poison.c @@ -20,7 +20,6 @@ #include #include #include -#include #include "tm.h" We can't accept this patch. The from and Signed-off-by don't match. As far as I can see they match: From: Changcheng Deng Signed-off-by: Changcheng Deng Yeah. My bad. thanks, -- Shuah
Re: [PATCH v3 1/8] PCI/AER: Remove ID from aer_agent_string[]
On 10/4/21 8:29 AM, Naveen Naidu wrote: Before 010caed4ccb6 ("PCI/AER: Decode Error Source RequesterID") the AER error logs looked like: pcieport :00:03.0: AER: Corrected error received: id=0018 pcieport :00:03.0: PCIe Bus Error: severity=Corrected, type=Data Link Layer, id=0018 (Receiver ID) pcieport :00:03.0: device [1b36:000c] error status/mask=0040/e000 pcieport :00:03.0:[ 6] BadTLP In 010caed4ccb6 ("PCI/AER: Decode Error Source Requester ID"), the "id" field was removed from the AER error logs, so currently AER logs look like: pcieport :00:03.0: AER: Corrected error received: :00:03:0 pcieport :00:03.0: PCIe Bus Error: severity=Corrected, type=Data Link Layer, (Receiver ID) pcieport :00:03.0: device [1b36:000c] error status/mask=0040/e000 pcieport :00:03.0:[ 6] BadTLP The second line in the above logs prints "(Receiver ID)", even when there is no "id" in the log line. This is confusing. Starting your commit log to say that message are confusing and then talk about why will make it easier to understand why the change is needed. Remove the "ID" from the aer_agent_string[]. The error logs will look as follows (Sample from dummy error injected by aer-inject): pcieport :00:03.0: AER: Corrected error received: :00:03.0 pcieport :00:03.0: PCIe Bus Error: severity=Corrected, type=Data Link Layer, (Receiver) pcieport :00:03.0: device [1b36:000c] error status/mask=0040/e000 pcieport :00:03.0:[ 6] BadTLP It is good to see before and after messages. However, it will be helpful to know why this change is necessary. It isn't very clear why in this commit log. Signed-off-by: Naveen Naidu Extra signed-off-by? --- drivers/pci/pcie/aer.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c index 9784fdcf3006..241ff361b43c 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -516,10 +516,10 @@ static const char *aer_uncorrectable_error_string[] = { }; static const char *aer_agent_string[] = { - "Receiver ID", - "Requester ID", - "Completer ID", - "Transmitter ID" + "Receiver", + "Requester", + "Completer", + "Transmitter" }; #define aer_stats_dev_attr(name, stats_array, strings_array, \ @@ -703,7 +703,7 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) const char *level; if (!info->status) { - pci_err(dev, "PCIe Bus Error: severity=%s, type=Inaccessible, (Unregistered Agent ID)\n", + pci_err(dev, "PCIe Bus Error: severity=%s, type=Inaccessible, (Unregistered Agent)\n", aer_error_severity_string[info->severity]); goto out; } thanks, -- Shuah
Re: [PATCH v1 2/6] mm/memory_hotplug: remove CONFIG_MEMORY_HOTPLUG_SPARSE
On 9/29/21 8:35 AM, David Hildenbrand wrote: CONFIG_MEMORY_HOTPLUG depends on CONFIG_SPARSEMEM, so there is no need for CONFIG_MEMORY_HOTPLUG_SPARSE anymore; adjust all instances to use CONFIG_MEMORY_HOTPLUG and remove CONFIG_MEMORY_HOTPLUG_SPARSE. Signed-off-by: David Hildenbrand --- arch/powerpc/include/asm/machdep.h| 2 +- arch/powerpc/kernel/setup_64.c| 2 +- arch/powerpc/platforms/powernv/setup.c| 4 ++-- arch/powerpc/platforms/pseries/setup.c| 2 +- drivers/base/Makefile | 2 +- drivers/base/node.c | 9 - drivers/virtio/Kconfig| 2 +- include/linux/memory.h| 18 +++--- include/linux/node.h | 4 ++-- lib/Kconfig.debug | 2 +- mm/Kconfig| 4 mm/memory_hotplug.c | 2 -- tools/testing/selftests/memory-hotplug/config | 1 - 13 files changed, 21 insertions(+), 33 deletions(-) { diff --git a/tools/testing/selftests/memory-hotplug/config b/tools/testing/selftests/memory-hotplug/config index a7e8cd5bb265..1eef042a31e1 100644 --- a/tools/testing/selftests/memory-hotplug/config +++ b/tools/testing/selftests/memory-hotplug/config @@ -1,5 +1,4 @@ CONFIG_MEMORY_HOTPLUG=y -CONFIG_MEMORY_HOTPLUG_SPARSE=y CONFIG_NOTIFIER_ERROR_INJECTION=y CONFIG_MEMORY_NOTIFIER_ERROR_INJECT=m CONFIG_MEMORY_HOTREMOVE=y For Kselftest change: Acked-by: Shuah Khan thanks, -- Shuah
Re: [PATCH 2/2] KVM: selftests: Add support for ppc64le
On 1/20/22 10:01 AM, Fabiano Rosas wrote: This adds the infrastructure for writing tests for the powerpc platform (Only Radix MMU for now). This patch also enables two tests: - a dummy sample test that creates a guest with one vcpu, issues hypercalls and reads/writes test values from memory. Since this test does something - rename it to something meaningful as opposed to sample. - the kvm_page_table test, although at this point I'm not using it to test KVM, but mostly as a way to stress test this code. $ make -C tools/testing/selftests TARGETS=kvm $ make -C tools/testing/selftests TARGETS=kvm run_tests Signed-off-by: Fabiano Rosas --- MAINTAINERS | 3 + tools/testing/selftests/kvm/.gitignore| 1 + tools/testing/selftests/kvm/Makefile | 14 +- .../selftests/kvm/include/kvm_util_base.h | 7 + .../selftests/kvm/include/ppc64le/processor.h | 43 +++ tools/testing/selftests/kvm/lib/kvm_util.c| 5 + .../testing/selftests/kvm/lib/powerpc/hcall.S | 6 + .../selftests/kvm/lib/powerpc/processor.c | 343 ++ .../testing/selftests/kvm/lib/powerpc/ucall.c | 67 .../selftests/kvm/powerpc/sample_test.c | 144 10 files changed, 630 insertions(+), 3 deletions(-) create mode 100644 tools/testing/selftests/kvm/include/ppc64le/processor.h create mode 100644 tools/testing/selftests/kvm/lib/powerpc/hcall.S create mode 100644 tools/testing/selftests/kvm/lib/powerpc/processor.c create mode 100644 tools/testing/selftests/kvm/lib/powerpc/ucall.c create mode 100644 tools/testing/selftests/kvm/powerpc/sample_test.c It will be easier to review this if split into a separate patch for each test. diff --git a/MAINTAINERS b/MAINTAINERS index a76e7558b151..15c89d33d584 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -10537,6 +10537,9 @@ F: arch/powerpc/include/asm/kvm* F:arch/powerpc/include/uapi/asm/kvm* F:arch/powerpc/kernel/kvm* F:arch/powerpc/kvm/ +F: tools/testing/selftests/kvm/include/ppc64le/ +F: tools/testing/selftests/kvm/lib/powerpc/ +F: tools/testing/selftests/kvm/powerpc/ KERNEL VIRTUAL MACHINE FOR RISC-V (KVM/riscv) M:Anup Patel diff --git a/tools/testing/selftests/kvm/.gitignore b/tools/testing/selftests/kvm/.gitignore index 8c129961accf..45ab993e2845 100644 --- a/tools/testing/selftests/kvm/.gitignore +++ b/tools/testing/selftests/kvm/.gitignore @@ -46,6 +46,7 @@ /x86_64/xen_vmcall_test /x86_64/xss_msr_test /x86_64/vmx_pmu_msrs_test +/powerpc/sample_test /access_tracking_perf_test /demand_paging_test /dirty_log_test diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile index 556da71c33b8..5ae27109e9b9 100644 --- a/tools/testing/selftests/kvm/Makefile +++ b/tools/testing/selftests/kvm/Makefile @@ -17,9 +17,9 @@ KSFT_KHDR_INSTALL := 1 # LINUX_TOOL_ARCH_INCLUDE is set using ARCH variable. # # x86_64 targets are named to include x86_64 as a suffix and directories -# for includes are in x86_64 sub-directory. s390x and aarch64 follow the -# same convention. "uname -m" doesn't result in the correct mapping for -# s390x and aarch64. +# for includes are in x86_64 sub-directory. s390x, aarch64 and ppc64le +# follow the same convention. "uname -m" doesn't result in the correct +# mapping for s390x, aarch64 and ppc64le. # # No change necessary for x86_64 UNAME_M := $(shell uname -m) @@ -36,12 +36,17 @@ endif ifeq ($(ARCH),riscv) UNAME_M := riscv endif +# Set UNAME_M for ppc64le compile/install to work +ifeq ($(ARCH),powerpc) + UNAME_M := ppc64le +endif LIBKVM = lib/assert.c lib/elf.c lib/io.c lib/kvm_util.c lib/rbtree.c lib/sparsebit.c lib/test_util.c lib/guest_modes.c lib/perf_test_util.c LIBKVM_x86_64 = lib/x86_64/apic.c lib/x86_64/processor.c lib/x86_64/vmx.c lib/x86_64/svm.c lib/x86_64/ucall.c lib/x86_64/handlers.S LIBKVM_aarch64 = lib/aarch64/processor.c lib/aarch64/ucall.c lib/aarch64/handlers.S lib/aarch64/spinlock.c lib/aarch64/gic.c lib/aarch64/gic_v3.c lib/aarch64/vgic.c LIBKVM_s390x = lib/s390x/processor.c lib/s390x/ucall.c lib/s390x/diag318_test_handler.c LIBKVM_riscv = lib/riscv/processor.c lib/riscv/ucall.c +LIBKVM_ppc64le = lib/powerpc/processor.c lib/powerpc/ucall.c lib/powerpc/hcall.S TEST_GEN_PROGS_x86_64 = x86_64/cr4_cpuid_sync_test TEST_GEN_PROGS_x86_64 += x86_64/get_msr_index_features @@ -133,6 +138,9 @@ TEST_GEN_PROGS_riscv += kvm_page_table_test TEST_GEN_PROGS_riscv += set_memory_region_test TEST_GEN_PROGS_riscv += kvm_binary_stats_test +TEST_GEN_PROGS_ppc64le += powerpc/sample_test Same comment as above. Find a name that desribes what this does? +TEST_GEN_PROGS_ppc64le += kvm_page_table_test + TEST_GEN_PROGS += $(TEST_GEN_PROGS_$(UNAME_M)) LIBKVM += $(LIBKVM_$(UNAME_M)) diff --git a/tools/testing/selftests/kvm/include/kvm_util_base.h b/tools/testing/selftests/kvm/include/kvm_util_base.h index
Re: [PATCH] selftest/vm: Use correct PAGE_SHIFT value for ppc64
On 2/9/22 8:43 AM, Aneesh Kumar K.V wrote: Keep it simple by using a #define and limiting hugepage size to 2M. This keeps the test simpler instead of dynamically finding the page size and huge page size. Without this tests are broken w.r.t reading /proc/self/pagemap if (pread(pagemap_fd, ent, sizeof(ent), (uintptr_t)ptr >> (PAGE_SHIFT - 3)) != sizeof(ent)) err(2, "read pagemap"); Cc: Shuah Khan Signed-off-by: Aneesh Kumar K.V --- tools/testing/selftests/vm/ksm_tests.c| 8 tools/testing/selftests/vm/transhuge-stress.c | 8 2 files changed, 16 insertions(+) diff --git a/tools/testing/selftests/vm/ksm_tests.c b/tools/testing/selftests/vm/ksm_tests.c index 1436e1a9a3d3..8200328ff018 100644 --- a/tools/testing/selftests/vm/ksm_tests.c +++ b/tools/testing/selftests/vm/ksm_tests.c @@ -22,8 +22,16 @@ #define KSM_MERGE_ACROSS_NODES_DEFAULT true #define MB (1ul << 20) +#ifdef __powerpc64__ +#define PAGE_SHIFT 16 +/* + * This will only work with radix 2M hugepage size + */ +#define HPAGE_SHIFT 21 +#else #define PAGE_SHIFT 12 #define HPAGE_SHIFT 21 +#endif #define PAGE_SIZE (1 << PAGE_SHIFT) #define HPAGE_SIZE (1 << HPAGE_SHIFT) diff --git a/tools/testing/selftests/vm/transhuge-stress.c b/tools/testing/selftests/vm/transhuge-stress.c index 5e4c036f6ad3..f04c8aa4bcf6 100644 --- a/tools/testing/selftests/vm/transhuge-stress.c +++ b/tools/testing/selftests/vm/transhuge-stress.c @@ -16,8 +16,16 @@ #include #include +#ifdef __powerpc64__ +#define PAGE_SHIFT 16 +/* + * This will only work with radix 2M hugepage size + */ +#define HPAGE_SHIFT 21 Why not have this is in common code? +#else #define PAGE_SHIFT 12 #define HPAGE_SHIFT 21 Same here. +#endif #define PAGE_SIZE (1 << PAGE_SHIFT) #define HPAGE_SIZE (1 << HPAGE_SHIFT) Please cc linux-kselftest mailing list in the future. With the above fixed. Reviewed-by: Shuah Khan thanks, -- Shuah
Re: [PATCH] selftest/vm: Use correct PAGE_SHIFT value for ppc64
On 2/9/22 9:12 PM, Aneesh Kumar K.V wrote: Shuah Khan writes: On 2/9/22 8:43 AM, Aneesh Kumar K.V wrote: Keep it simple by using a #define and limiting hugepage size to 2M. This keeps the test simpler instead of dynamically finding the page size and huge page size. Without this tests are broken w.r.t reading /proc/self/pagemap if (pread(pagemap_fd, ent, sizeof(ent), (uintptr_t)ptr >> (PAGE_SHIFT - 3)) != sizeof(ent)) err(2, "read pagemap"); Cc: Shuah Khan Signed-off-by: Aneesh Kumar K.V --- tools/testing/selftests/vm/ksm_tests.c| 8 tools/testing/selftests/vm/transhuge-stress.c | 8 2 files changed, 16 insertions(+) diff --git a/tools/testing/selftests/vm/ksm_tests.c b/tools/testing/selftests/vm/ksm_tests.c index 1436e1a9a3d3..8200328ff018 100644 --- a/tools/testing/selftests/vm/ksm_tests.c +++ b/tools/testing/selftests/vm/ksm_tests.c @@ -22,8 +22,16 @@ #define KSM_MERGE_ACROSS_NODES_DEFAULT true #define MB (1ul << 20) +#ifdef __powerpc64__ +#define PAGE_SHIFT 16 +/* + * This will only work with radix 2M hugepage size + */ +#define HPAGE_SHIFT 21 +#else #define PAGE_SHIFT 12 #define HPAGE_SHIFT 21 +#endif #define PAGE_SIZE (1 << PAGE_SHIFT) #define HPAGE_SIZE (1 << HPAGE_SHIFT) diff --git a/tools/testing/selftests/vm/transhuge-stress.c b/tools/testing/selftests/vm/transhuge-stress.c index 5e4c036f6ad3..f04c8aa4bcf6 100644 --- a/tools/testing/selftests/vm/transhuge-stress.c +++ b/tools/testing/selftests/vm/transhuge-stress.c @@ -16,8 +16,16 @@ #include #include +#ifdef __powerpc64__ +#define PAGE_SHIFT 16 +/* + * This will only work with radix 2M hugepage size + */ +#define HPAGE_SHIFT 21 Why not have this is in common code? Can you suggest where I can move that. We also have helper functions like allocate_transhuge() duplicated between tests. I didn't find libutil.a or anything similar supported by the selftets build. I noticed that HPAGE_SHIFT is defined in #ifdef __powerpc64__ block as well as #else. I am asking is it necessary to be part of both blocks. +#ifdef __powerpc64__ +#define PAGE_SHIFT 16 +/* + * This will only work with radix 2M hugepage size + */ +#define HPAGE_SHIFT 21 --- this one +#else #define PAGE_SHIFT 12 #define HPAGE_SHIFT 21 --- this one +#endif Hope this helps. thanks, -- Shuah
Re: [PATCH] selftest/vm: Use correct PAGE_SHIFT value for ppc64
On 2/10/22 8:03 AM, Aneesh Kumar K V wrote: On 2/10/22 20:09, Shuah Khan wrote: On 2/9/22 9:12 PM, Aneesh Kumar K.V wrote: Shuah Khan writes: On 2/9/22 8:43 AM, Aneesh Kumar K.V wrote: Keep it simple by using a #define and limiting hugepage size to 2M. This keeps the test simpler instead of dynamically finding the page size and huge page size. Without this tests are broken w.r.t reading /proc/self/pagemap if (pread(pagemap_fd, ent, sizeof(ent), (uintptr_t)ptr >> (PAGE_SHIFT - 3)) != sizeof(ent)) err(2, "read pagemap"); Cc: Shuah Khan Signed-off-by: Aneesh Kumar K.V --- tools/testing/selftests/vm/ksm_tests.c | 8 tools/testing/selftests/vm/transhuge-stress.c | 8 2 files changed, 16 insertions(+) diff --git a/tools/testing/selftests/vm/ksm_tests.c b/tools/testing/selftests/vm/ksm_tests.c index 1436e1a9a3d3..8200328ff018 100644 --- a/tools/testing/selftests/vm/ksm_tests.c +++ b/tools/testing/selftests/vm/ksm_tests.c @@ -22,8 +22,16 @@ #define KSM_MERGE_ACROSS_NODES_DEFAULT true #define MB (1ul << 20) +#ifdef __powerpc64__ +#define PAGE_SHIFT 16 +/* + * This will only work with radix 2M hugepage size + */ +#define HPAGE_SHIFT 21 +#else #define PAGE_SHIFT 12 #define HPAGE_SHIFT 21 +#endif #define PAGE_SIZE (1 << PAGE_SHIFT) #define HPAGE_SIZE (1 << HPAGE_SHIFT) diff --git a/tools/testing/selftests/vm/transhuge-stress.c b/tools/testing/selftests/vm/transhuge-stress.c index 5e4c036f6ad3..f04c8aa4bcf6 100644 --- a/tools/testing/selftests/vm/transhuge-stress.c +++ b/tools/testing/selftests/vm/transhuge-stress.c @@ -16,8 +16,16 @@ #include #include +#ifdef __powerpc64__ +#define PAGE_SHIFT 16 +/* + * This will only work with radix 2M hugepage size + */ +#define HPAGE_SHIFT 21 Why not have this is in common code? Can you suggest where I can move that. We also have helper functions like allocate_transhuge() duplicated between tests. I didn't find libutil.a or anything similar supported by the selftets build. I noticed that HPAGE_SHIFT is defined in #ifdef __powerpc64__ block as well as #else. I am asking is it necessary to be part of both blocks. +#ifdef __powerpc64__ +#define PAGE_SHIFT 16 +/* + * This will only work with radix 2M hugepage size + */ +#define HPAGE_SHIFT 21 --- this one +#else #define PAGE_SHIFT 12 #define HPAGE_SHIFT 21 --- this one +#endif The reason I did that was to add the comment which is relevant only for ppc64. ppc64 supports two hugepage sizes, 2M and 16M. The test won't work correctly with 16M hugepage size. We do have other tests in selftest/vm/ with similar restrictions. Right. You don't have to duplicate code for the comment. You can add the comment and then clarify in the comment that it is only relevant to ppc64. This way the comment is clear and we can avoid duplicate code that makes it hard to maintain in the future. thanks, -- Shuah
[PATCH 8/8] selftests: x86: override clean in lib.mk to fix warnings
Add override for lib.mk clean to fix the following warnings from clean target run. Makefile:44: warning: overriding recipe for target 'clean' ../lib.mk:55: warning: ignoring old recipe for target 'clean' Signed-off-by: Shuah Khan --- tools/testing/selftests/x86/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/x86/Makefile b/tools/testing/selftests/x86/Makefile index 38e0a9c..4d27550 100644 --- a/tools/testing/selftests/x86/Makefile +++ b/tools/testing/selftests/x86/Makefile @@ -40,8 +40,9 @@ all_32: $(BINARIES_32) all_64: $(BINARIES_64) -clean: +override define CLEAN $(RM) $(BINARIES_32) $(BINARIES_64) +endef $(BINARIES_32): $(OUTPUT)/%_32: %.c $(CC) -m32 -o $@ $(CFLAGS) $(EXTRA_CFLAGS) $^ -lrt -ldl -lm -- 2.9.3
[PATCH 2/8] selftests: lib.mk: define CLEAN macro to allow Makefiles to override clean
Define CLEAN macro to allow Makefiles to override common clean target in lib.mk. This will help fix the following failures: warning: overriding recipe for target 'clean' ../lib.mk:55: warning: ignoring old recipe for target 'clean' Signed-off-by: Shuah Khan --- tools/testing/selftests/lib.mk | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk index 775c589..959273c 100644 --- a/tools/testing/selftests/lib.mk +++ b/tools/testing/selftests/lib.mk @@ -51,8 +51,12 @@ endef emit_tests: $(EMIT_TESTS) -clean: +define CLEAN $(RM) -r $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) $(EXTRA_CLEAN) +endef + +clean: + $(CLEAN) $(OUTPUT)/%:%.c $(LINK.c) $^ $(LDLIBS) -o $@ -- 2.9.3
[PATCH 7/8] selftests: sync: override clean in lib.mk to fix warnings
Add override for lib.mk clean to fix the following warnings from clean target run. Makefile:24: warning: overriding recipe for target 'clean' ../lib.mk:55: warning: ignoring old recipe for target 'clean' Signed-off-by: Shuah Khan --- tools/testing/selftests/sync/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/sync/Makefile b/tools/testing/selftests/sync/Makefile index 87ac400..f7d250d 100644 --- a/tools/testing/selftests/sync/Makefile +++ b/tools/testing/selftests/sync/Makefile @@ -20,5 +20,6 @@ TESTS += sync_stress_merge.o sync_test: $(OBJS) $(TESTS) -clean: +override define CLEAN $(RM) sync_test $(OBJS) $(TESTS) +endef -- 2.9.3
[PATCH 0/8] Fix clean target warnings
This patch series consists of changes to lib.mk to allow overriding common clean target from Makefiles. This fixes warnings when clean overriding and ignoring warnings. Also fixes splice clean target removing a script that runs the test from its clean target. Shuah Khan (8): selftests: splice: fix clean target to not remove default_file_splice_read.sh selftests: lib.mk: define CLEAN macro to allow Makefiles to override clean selftests: futex: override clean in lib.mk to fix warnings selftests: gpio: override clean in lib.mk to fix warnings selftests: powerpc: override clean in lib.mk to fix warnings selftests: splice: override clean in lib.mk to fix warnings selftests: sync: override clean in lib.mk to fix warnings selftests: x86: override clean in lib.mk to fix warnings tools/testing/selftests/futex/Makefile | 3 ++- tools/testing/selftests/gpio/Makefile| 3 ++- tools/testing/selftests/lib.mk | 6 +- tools/testing/selftests/powerpc/Makefile | 3 ++- tools/testing/selftests/splice/Makefile | 5 +++-- tools/testing/selftests/sync/Makefile| 3 ++- tools/testing/selftests/x86/Makefile | 3 ++- 7 files changed, 18 insertions(+), 8 deletions(-) -- 2.9.3
[PATCH 3/8] selftests: futex: override clean in lib.mk to fix warnings
Add override for lib.mk clean to fix the following warnings from clean target run. Makefile:36: warning: overriding recipe for target 'clean' ../lib.mk:55: warning: ignoring old recipe for target 'clean' Signed-off-by: Shuah Khan --- tools/testing/selftests/futex/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/futex/Makefile b/tools/testing/selftests/futex/Makefile index c8095e6..e2fbb89 100644 --- a/tools/testing/selftests/futex/Makefile +++ b/tools/testing/selftests/futex/Makefile @@ -32,9 +32,10 @@ override define EMIT_TESTS echo "./run.sh" endef -clean: +override define CLEAN for DIR in $(SUBDIRS); do \ BUILD_TARGET=$(OUTPUT)/$$DIR; \ mkdir $$BUILD_TARGET -p; \ make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\ done +endef -- 2.9.3
[PATCH 4/8] selftests: gpio: override clean in lib.mk to fix warnings
Add override for lib.mk clean to fix the following warnings from clean target run. Makefile:11: warning: overriding recipe for target 'clean' ../lib.mk:55: warning: ignoring old recipe for target 'clean' Signed-off-by: Shuah Khan --- tools/testing/selftests/gpio/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/gpio/Makefile b/tools/testing/selftests/gpio/Makefile index 205e4d1..4f6d9e0 100644 --- a/tools/testing/selftests/gpio/Makefile +++ b/tools/testing/selftests/gpio/Makefile @@ -7,8 +7,9 @@ include ../lib.mk all: $(BINARIES) -clean: +override define CLEAN $(RM) $(BINARIES) +endef CFLAGS += -O2 -g -std=gnu99 -Wall -I../../../../usr/include/ LDLIBS += -lmount -I/usr/include/libmount -- 2.9.3
[PATCH 1/8] selftests: splice: fix clean target to not remove default_file_splice_read.sh
splice clean target removes the shell script default_file_splice_read.sh that runs the splice test. Fix it to not remove this file. Signed-off-by: Shuah Khan --- tools/testing/selftests/splice/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/splice/Makefile b/tools/testing/selftests/splice/Makefile index de51f43..559512c 100644 --- a/tools/testing/selftests/splice/Makefile +++ b/tools/testing/selftests/splice/Makefile @@ -5,4 +5,4 @@ all: $(TEST_PROGS) $(EXTRA) include ../lib.mk clean: - rm -fr $(TEST_PROGS) $(EXTRA) + rm -fr $(EXTRA) -- 2.9.3
[PATCH 6/8] selftests: splice: override clean in lib.mk to fix warnings
Add override for lib.mk clean to fix the following warnings from clean target run. Makefile:8: warning: overriding recipe for target 'clean' ../lib.mk:55: warning: ignoring old recipe for target 'clean' Signed-off-by: Shuah Khan --- tools/testing/selftests/splice/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/splice/Makefile b/tools/testing/selftests/splice/Makefile index 559512c..3f967ba 100644 --- a/tools/testing/selftests/splice/Makefile +++ b/tools/testing/selftests/splice/Makefile @@ -4,5 +4,6 @@ all: $(TEST_PROGS) $(EXTRA) include ../lib.mk -clean: +override define CLEAN rm -fr $(EXTRA) +endef -- 2.9.3
[PATCH 5/8] selftests: powerpc: override clean in lib.mk to fix warnings
Add override for lib.mk clean to fix the following warnings from clean target run. Makefile:63: warning: overriding recipe for target 'clean' ../lib.mk:55: warning: ignoring old recipe for target 'clean' Signed-off-by: Shuah Khan --- tools/testing/selftests/powerpc/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/powerpc/Makefile b/tools/testing/selftests/powerpc/Makefile index 1c5d057..8d9fc64 100644 --- a/tools/testing/selftests/powerpc/Makefile +++ b/tools/testing/selftests/powerpc/Makefile @@ -59,12 +59,13 @@ override define EMIT_TESTS done; endef -clean: +override define CLEAN @for TARGET in $(SUB_DIRS); do \ BUILD_TARGET=$$OUTPUT/$$TARGET; \ $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean; \ done; rm -f tags +endef tags: find . -name '*.c' -o -name '*.h' | xargs ctags -- 2.9.3
Re: [PATCH 2/8] selftests: lib.mk: define CLEAN macro to allow Makefiles to override clean
On 04/24/2017 09:45 AM, David Laight wrote: > From: Shuah Khan >> Sent: 22 April 2017 00:15 >> Define CLEAN macro to allow Makefiles to override common clean target >> in lib.mk. This will help fix the following failures: >> >> warning: overriding recipe for target 'clean' >> ../lib.mk:55: warning: ignoring old recipe for target 'clean' >> >> Signed-off-by: Shuah Khan >> --- >> tools/testing/selftests/lib.mk | 6 +- >> 1 file changed, 5 insertions(+), 1 deletion(-) >> >> diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk >> index 775c589..959273c 100644 >> --- a/tools/testing/selftests/lib.mk >> +++ b/tools/testing/selftests/lib.mk >> @@ -51,8 +51,12 @@ endef >> emit_tests: >> $(EMIT_TESTS) >> >> -clean: >> +define CLEAN >> $(RM) -r $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) >> $(EXTRA_CLEAN) >> +endef >> + >> +clean: >> +$(CLEAN) > > If might be easier to do something like: > > ifneq($(NO_CLEAN),y) > clean: > $(RM) -r $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) > $(EXTRA_CLEAN) > endif > > David > I am not sure that it is easier. Defining a macro would work well in this case to override and also works well with what we are doing for other overrides we already have such as EMIT_TESTS. thanks, -- Shuah
Re: [PATCH 8/8] selftests: x86: override clean in lib.mk to fix warnings
On 04/24/2017 09:57 AM, David Laight wrote: > From: Linuxppc-dev Michael Ellerman >> Shuah Khan writes: >> >>> Add override for lib.mk clean to fix the following warnings from clean >>> target run. >>> >>> Makefile:44: warning: overriding recipe for target 'clean' >>> ../lib.mk:55: warning: ignoring old recipe for target 'clean' >>> >>> Signed-off-by: Shuah Khan >>> --- >>> tools/testing/selftests/x86/Makefile | 3 ++- >>> 1 file changed, 2 insertions(+), 1 deletion(-) >>> >>> diff --git a/tools/testing/selftests/x86/Makefile >>> b/tools/testing/selftests/x86/Makefile >>> index 38e0a9c..4d27550 100644 >>> --- a/tools/testing/selftests/x86/Makefile >>> +++ b/tools/testing/selftests/x86/Makefile >>> @@ -40,8 +40,9 @@ all_32: $(BINARIES_32) >>> >>> all_64: $(BINARIES_64) >>> >>> -clean: >>> +override define CLEAN >>> $(RM) $(BINARIES_32) $(BINARIES_64) >>> +endef >> >> Simpler as: >> >> EXTRA_CLEAN := $(BINARIES_32) $(BINARIES_64) > > Actually for builds that insist on crapping all over the source tree I've > used: > > clean: > rm -rf `cat .cvsignore 2>/dev/null` > > David This will have to be done as a separate change. The warnings I am fixing are related to common clean target in lib.mk and the need to override. thanks, -- Shuah
Re: [PATCH 2/8] selftests: lib.mk: define CLEAN macro to allow Makefiles to override clean
On 04/21/2017 11:38 PM, Michael Ellerman wrote: > Shuah Khan writes: > >> Define CLEAN macro to allow Makefiles to override common clean target >> in lib.mk. This will help fix the following failures: >> >> warning: overriding recipe for target 'clean' >> ../lib.mk:55: warning: ignoring old recipe for target 'clean' >> >> Signed-off-by: Shuah Khan > > Should probably have: > > Fixes: 88baa78d1f31 ("selftests: remove duplicated all and clean target") Amended the change log to add the above. > > > In hindsight I'm not sure moving the clean target into lib.mk was > the best idea, but anyway it's a bit late to change our mind on that. Yeah. Moving clean target to lib.mk ended up to be problematic. However, there are some advantages as well. It will simplify some Makefiles. One thing that was missed was that not finding the Makefiles that require overrides. Anyway live and learn. > > This patch is a good solution to fix the warnings. > > Acked-by: Michael Ellerman > Thanks. I plan to apply the patch with the amended changelog and your Ack. Please let me know if you want to see v2 with the change sent out. thanks, -- Shuah
Re: [PATCH 4/8] selftests: gpio: override clean in lib.mk to fix warnings
On 04/21/2017 11:40 PM, Michael Ellerman wrote: > Shuah Khan writes: > >> Add override for lib.mk clean to fix the following warnings from clean >> target run. >> >> Makefile:11: warning: overriding recipe for target 'clean' >> ../lib.mk:55: warning: ignoring old recipe for target 'clean' >> >> Signed-off-by: Shuah Khan >> --- >> tools/testing/selftests/gpio/Makefile | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/tools/testing/selftests/gpio/Makefile >> b/tools/testing/selftests/gpio/Makefile >> index 205e4d1..4f6d9e0 100644 >> --- a/tools/testing/selftests/gpio/Makefile >> +++ b/tools/testing/selftests/gpio/Makefile >> @@ -7,8 +7,9 @@ include ../lib.mk >> >> all: $(BINARIES) >> >> -clean: >> +override define CLEAN >> $(RM) $(BINARIES) >> +endef > > This could be achieved more simply with: > > EXTRA_CLEAN := $(BINARIES) > gpio clean requires special handling. I have one more patch I sent out that handles that. So I am going to leave this patch the way with override. thanks, -- Shuah
Re: [PATCH 6/8] selftests: splice: override clean in lib.mk to fix warnings
On 04/21/2017 11:40 PM, Michael Ellerman wrote: > Shuah Khan writes: > >> Add override for lib.mk clean to fix the following warnings from clean >> target run. >> >> Makefile:8: warning: overriding recipe for target 'clean' >> ../lib.mk:55: warning: ignoring old recipe for target 'clean' >> >> Signed-off-by: Shuah Khan >> --- >> tools/testing/selftests/splice/Makefile | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/tools/testing/selftests/splice/Makefile >> b/tools/testing/selftests/splice/Makefile >> index 559512c..3f967ba 100644 >> --- a/tools/testing/selftests/splice/Makefile >> +++ b/tools/testing/selftests/splice/Makefile >> @@ -4,5 +4,6 @@ all: $(TEST_PROGS) $(EXTRA) >> >> include ../lib.mk >> >> -clean: >> +override define CLEAN >> rm -fr $(EXTRA) >> +endef > > Could just be: > > EXTRA_CLEAN := $(EXTRA) > Will send v2 with this change. -- Shuah
Re: [PATCH 7/8] selftests: sync: override clean in lib.mk to fix warnings
On 04/21/2017 11:41 PM, Michael Ellerman wrote: > Shuah Khan writes: > >> Add override for lib.mk clean to fix the following warnings from clean >> target run. >> >> Makefile:24: warning: overriding recipe for target 'clean' >> ../lib.mk:55: warning: ignoring old recipe for target 'clean' >> >> Signed-off-by: Shuah Khan >> --- >> tools/testing/selftests/sync/Makefile | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/tools/testing/selftests/sync/Makefile >> b/tools/testing/selftests/sync/Makefile >> index 87ac400..f7d250d 100644 >> --- a/tools/testing/selftests/sync/Makefile >> +++ b/tools/testing/selftests/sync/Makefile >> @@ -20,5 +20,6 @@ TESTS += sync_stress_merge.o >> >> sync_test: $(OBJS) $(TESTS) >> >> -clean: >> +override define CLEAN >> $(RM) sync_test $(OBJS) $(TESTS) >> +endef > > EXTRA_CLEAN := sync_test $(OBJS) $(TESTS) > Will send v2 with this change. -- Shuah
Re: [PATCH 8/8] selftests: x86: override clean in lib.mk to fix warnings
On 04/21/2017 11:41 PM, Michael Ellerman wrote: > Shuah Khan writes: > >> Add override for lib.mk clean to fix the following warnings from clean >> target run. >> >> Makefile:44: warning: overriding recipe for target 'clean' >> ../lib.mk:55: warning: ignoring old recipe for target 'clean' >> >> Signed-off-by: Shuah Khan >> --- >> tools/testing/selftests/x86/Makefile | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/tools/testing/selftests/x86/Makefile >> b/tools/testing/selftests/x86/Makefile >> index 38e0a9c..4d27550 100644 >> --- a/tools/testing/selftests/x86/Makefile >> +++ b/tools/testing/selftests/x86/Makefile >> @@ -40,8 +40,9 @@ all_32: $(BINARIES_32) >> >> all_64: $(BINARIES_64) >> >> -clean: >> +override define CLEAN >> $(RM) $(BINARIES_32) $(BINARIES_64) >> +endef > > Simpler as: > > EXTRA_CLEAN := $(BINARIES_32) $(BINARIES_64) > Will send v2 with this change. thanks, -- Shuah
[PATCH v2] selftests: x86: override clean in lib.mk to fix warnings
Add override with EXTRA_CLEAN for lib.mk clean to fix the following warnings from clean target run. Makefile:44: warning: overriding recipe for target 'clean' ../lib.mk:55: warning: ignoring old recipe for target 'clean' Signed-off-by: Shuah Khan --- Changes since v1: - simplified to use EXTRA_CLEAN based on Michael Ellerman's comments. tools/testing/selftests/x86/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/testing/selftests/x86/Makefile b/tools/testing/selftests/x86/Makefile index 38e0a9c..97f187e 100644 --- a/tools/testing/selftests/x86/Makefile +++ b/tools/testing/selftests/x86/Makefile @@ -40,8 +40,7 @@ all_32: $(BINARIES_32) all_64: $(BINARIES_64) -clean: - $(RM) $(BINARIES_32) $(BINARIES_64) +EXTRA_CLEAN := $(BINARIES_32) $(BINARIES_64) $(BINARIES_32): $(OUTPUT)/%_32: %.c $(CC) -m32 -o $@ $(CFLAGS) $(EXTRA_CFLAGS) $^ -lrt -ldl -lm -- 2.9.3
[PATCH v2] selftests: sync: override clean in lib.mk to fix warnings
Add override with EXTRA_CLEAN for lib.mk clean to fix the following warnings from clean target run. Makefile:24: warning: overriding recipe for target 'clean' ../lib.mk:55: warning: ignoring old recipe for target 'clean' Signed-off-by: Shuah Khan --- Changes since v1: - simplified to use EXTRA_CLEAN based on Michael Ellerman's comments. tools/testing/selftests/sync/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/testing/selftests/sync/Makefile b/tools/testing/selftests/sync/Makefile index 87ac400..4981c6b 100644 --- a/tools/testing/selftests/sync/Makefile +++ b/tools/testing/selftests/sync/Makefile @@ -20,5 +20,4 @@ TESTS += sync_stress_merge.o sync_test: $(OBJS) $(TESTS) -clean: - $(RM) sync_test $(OBJS) $(TESTS) +EXTRA_CLEAN := sync_test $(OBJS) $(TESTS) -- 2.9.3
[PATCH v2] selftests: splice: override clean in lib.mk to fix warnings
Add override with EXTRA_CLEAN for lib.mk clean to fix the following warnings from clean target run. Makefile:8: warning: overriding recipe for target 'clean' ../lib.mk:55: warning: ignoring old recipe for target 'clean' Signed-off-by: Shuah Khan --- Changes since v1: - simplified to use EXTRA_CLEAN based on Michael Ellerman's comments. tools/testing/selftests/splice/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/testing/selftests/splice/Makefile b/tools/testing/selftests/splice/Makefile index 559512c..9fc78e5 100644 --- a/tools/testing/selftests/splice/Makefile +++ b/tools/testing/selftests/splice/Makefile @@ -4,5 +4,4 @@ all: $(TEST_PROGS) $(EXTRA) include ../lib.mk -clean: - rm -fr $(EXTRA) +EXTRA_CLEAN := $(EXTRA) -- 2.9.3
Re: [PATCH 3/8] selftests: futex: override clean in lib.mk to fix warnings
On 04/27/2017 03:54 PM, Darren Hart wrote: > On Fri, Apr 21, 2017 at 05:14:45PM -0600, Shuah Khan wrote: >> Add override for lib.mk clean to fix the following warnings from clean >> target run. >> >> Makefile:36: warning: overriding recipe for target 'clean' >> ../lib.mk:55: warning: ignoring old recipe for target 'clean' >> >> Signed-off-by: Shuah Khan >> --- >> tools/testing/selftests/futex/Makefile | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/tools/testing/selftests/futex/Makefile >> b/tools/testing/selftests/futex/Makefile >> index c8095e6..e2fbb89 100644 >> --- a/tools/testing/selftests/futex/Makefile >> +++ b/tools/testing/selftests/futex/Makefile >> @@ -32,9 +32,10 @@ override define EMIT_TESTS >> echo "./run.sh" >> endef >> >> -clean: >> +override define CLEAN >> for DIR in $(SUBDIRS); do \ >> BUILD_TARGET=$(OUTPUT)/$$DIR; \ >> mkdir $$BUILD_TARGET -p; \ >> make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\ >> done >> +endef > > Taking the move of clean into lib.mk as a given, Yeah I considered undoing that, and chose to fix the missed issues instead. > > Acked-by: Darren Hart (VMware) > thanks, -- Shuah
Re: [PATCH 0/8] Fix clean target warnings
On 04/21/2017 05:14 PM, Shuah Khan wrote: > This patch series consists of changes to lib.mk to allow overriding > common clean target from Makefiles. This fixes warnings when clean > overriding and ignoring warnings. Also fixes splice clean target > removing a script that runs the test from its clean target. > > Shuah Khan (8): > selftests: splice: fix clean target to not remove > default_file_splice_read.sh > selftests: lib.mk: define CLEAN macro to allow Makefiles to override > clean Applied with amended change log and Michael's ack to linux-kselftest next > selftests: futex: override clean in lib.mk to fix warnings > selftests: gpio: override clean in lib.mk to fix warnings > selftests: powerpc: override clean in lib.mk to fix warnings Applied all of the above to linux-kseltftest next > selftests: splice: override clean in lib.mk to fix warnings > selftests: sync: override clean in lib.mk to fix warnings > selftests: x86: override clean in lib.mk to fix warnings Applied v2s addressing Michael's comments to linux-kselftest next x86 fix also addresses not being able to build ldt_gdt make -C tools/testing/selftests/x86 ldt_gdt thanks, -- Shuah
Re: [PATCH kernel] vfio/spapr: Add trace points for map/unmap
On 11/29/2017 09:32 AM, Alex Williamson wrote: > On Thu, 23 Nov 2017 15:13:37 +1100 > Alexey Kardashevskiy wrote: > >> On 17/11/17 17:58, Alexey Kardashevskiy wrote: >>> On 17/11/17 11:13, Alex Williamson wrote: On Tue, 14 Nov 2017 10:47:12 +1100 Alexey Kardashevskiy wrote: > On 27/10/17 14:00, Alexey Kardashevskiy wrote: >> This adds trace_map/trace_unmap tracepoints to spapr driver. Type1 >> already >> uses these via the IOMMU API (iommu_map/__iommu_unmap). >> >> Signed-off-by: Alexey Kardashevskiy Is this really legitimate to include tracepoints from a different subsystem?> The vfio type1 backend gets these trace points by virtue of it actually using the IOMMU API, it doesn't call them itself. I'm kind of surprised these are actually available to be called from a module. >>> >>> They are explicitly exported: >>> >>> EXPORT_TRACEPOINT_SYMBOL_GPL(map); >>> EXPORT_TRACEPOINT_SYMBOL_GPL(unmap); Tracepoints need to be exported as per the tracepoint sub-system requirements. >>> >>> I would think this is for things like drivers/vfio/vfio_iommu_spapr_tce.c , >>> why else?... >>> >>> I suspect the way to do this is probably to define our own tracepoints in the vfio/spapr backend or insert tracepoints into the IOMMU layers that that code calls into rather than masquerading as tracepoints from a different subsystem. Right? >>> >>> This makes sense too. But it is going to be just cut-n-paste and some >>> confusion - >>> /sys/kernel/debug/tracing/events/iommu/map will still be present but >>> won't work and >>> /sys/kernel/debug/tracing/events/vfio/vfio_iommu_spapr_tce/map will. > > But iommu/map does work, it's just not called by the vfio spapr tce > backend, which is absolutely correct. In fact, that's part of my > reservation about this approach is that it could be interpreted as > implying a call path that doesn't exist on this arch. These tracepoints are intended to be called after a iommo/map/unmap calls from IOMMU API. It doesn't make any sense to call them from random places. It is totally useless to do so and makes it difficult to debug problems. As an author of these tracepoints - that is my opinion. thanks, -- Shuah
Re: [PATCH 1/5] selftests: Fix selftests build to just build, not run tests
On 02/13/2017 07:09 PM, Michael Ellerman wrote: > Michael Ellerman writes: > >> In commit 88baa78d1f31 ("selftests: remove duplicated all and clean >> target"), the "all" target was removed from individual Makefiles and >> added to lib.mk. >> >> However the "all" target was added to lib.mk *after* the existing >> "runtests" target. This means "runtests" becomes the first (default) >> target for most of our Makefiles. > ... >> >> Fix it by moving the "all" target to the start of lib.mk, making it the >> default target. >> >> Fixes: 88baa78d1f31 ("selftests: remove duplicated all and clean target") >> Signed-off-by: Michael Ellerman > > Hi Shuah, > > Can you please merge this series into linux-next? > > The selftests are badly broken otherwise. > > cheers > Hi Michael, Thanks. All 5 patches are now in linux-kselftest next with Tested-by tag from Bamvor for 1,2,3. thank you both, -- Shuah
Re: [PATCH 1/5] selftests: Fix selftests build to just build, not run tests
On 02/13/2017 07:09 PM, Michael Ellerman wrote: > Michael Ellerman writes: > >> In commit 88baa78d1f31 ("selftests: remove duplicated all and clean >> target"), the "all" target was removed from individual Makefiles and >> added to lib.mk. >> >> However the "all" target was added to lib.mk *after* the existing >> "runtests" target. This means "runtests" becomes the first (default) >> target for most of our Makefiles. > ... >> >> Fix it by moving the "all" target to the start of lib.mk, making it the >> default target. >> >> Fixes: 88baa78d1f31 ("selftests: remove duplicated all and clean target") >> Signed-off-by: Michael Ellerman > > Hi Shuah, > > Can you please merge this series into linux-next? > > The selftests are badly broken otherwise. > > cheers > Hi Bamovar, Your original series badly broke the selftest build. I can no longer build individual tests. For example: cd breakpoints/ shuah@shuah-XPS-13-9350:/lkml/linux_4.11/tools/testing/selftests/breakpoints$ make gcc breakpoint_test.c -o /breakpoint_test /usr/bin/ld: cannot open output file /breakpoint_test: Permission denied collect2: error: ld returned 1 exit status ../lib.mk:54: recipe for target '/breakpoint_test' failed make: *** [/breakpoint_test] Error 1 commit a8ba798bc8ec663cf02e80b0dd770324de9bafd9 Author: bamvor.zhangj...@huawei.com Date: Tue Nov 29 19:55:52 2016 +0800 selftests: enable O and KBUILD_OUTPUT I believe the above patch is one of the suspects. Michael fixed some of the problems in this patch and others he sent. At the moment individual tests will not build. tools/testing/selftests/x86$ make Makefile:44: warning: overriding recipe for target 'clean' ../lib.mk:51: warning: ignoring old recipe for target 'clean' gcc -m64 -o /single_step_syscall_64 -O2 -g -std=gnu99 -pthread -Wall single_step_syscall.c -lrt -ldl /usr/bin/ld: cannot open output file /single_step_syscall_64: Permission denied collect2: error: ld returned 1 exit status Makefile:50: recipe for target '/single_step_syscall_64' failed make: *** [/single_step_syscall_64] Error 1 My guess is OUTPUT doesn't resolve in individual builds from the test directory. We have to get this fixed for 4.11-rc1 Simply Reverting a8ba798bc8ec663cf02e80b0dd770324de9bafd9 doesn't work. Michael's patches depend on this. So anyway, please let me know if you can fix this quickly. I am going to be trying a few things today as well. thanks, -- Shuah
Re: [PATCH 1/5] selftests: Fix selftests build to just build, not run tests
Hi Michael and Bamovar, On 03/01/2017 11:43 PM, Michael Ellerman wrote: > Shuah Khan writes: >> Hi Bamovar, >> >> Your original series badly broke the selftest build. I can no longer >> build individual tests. For example: >> >> cd breakpoints/ >> shuah@shuah-XPS-13-9350:/lkml/linux_4.11/tools/testing/selftests/breakpoints$ >> make >> gcc breakpoint_test.c -o /breakpoint_test >> /usr/bin/ld: cannot open output file /breakpoint_test: Permission denied >> collect2: error: ld returned 1 exit status >> ../lib.mk:54: recipe for target '/breakpoint_test' failed >> make: *** [/breakpoint_test] Error 1 > > I also got a report of that just yesterday. > > You can do: > > $ cd tools/testing/selftests ; make TARGETS=breakpoints > > But it's not ideal. > >> commit a8ba798bc8ec663cf02e80b0dd770324de9bafd9 >> Author: bamvor.zhangj...@huawei.com >> Date: Tue Nov 29 19:55:52 2016 +0800 >> >> selftests: enable O and KBUILD_OUTPUT >> >> I believe the above patch is one of the suspects. Michael fixed >> some of the problems in this patch and others he sent. > > It is that patch which caused it yes. > >> At the moment individual tests will not build. >> tools/testing/selftests/x86$ make >> Makefile:44: warning: overriding recipe for target 'clean' >> ../lib.mk:51: warning: ignoring old recipe for target 'clean' >> gcc -m64 -o /single_step_syscall_64 -O2 -g -std=gnu99 -pthread -Wall >> single_step_syscall.c -lrt -ldl >> /usr/bin/ld: cannot open output file /single_step_syscall_64: Permission >> denied >> collect2: error: ld returned 1 exit status >> Makefile:50: recipe for target '/single_step_syscall_64' failed >> make: *** [/single_step_syscall_64] Error 1 >> >> >> My guess is OUTPUT doesn't resolve in individual builds from the test >> directory. >> We have to get this fixed for 4.11-rc1 > > Yeah, OUTPUT is passed down from the top-level Makefile. > >> Simply Reverting a8ba798bc8ec663cf02e80b0dd770324de9bafd9 doesn't work. >> Michael's patches depend on this. So anyway, please let me know if you >> can fix this quickly. I am going to be trying a few things today as well. > > This seems to work, but needs some testing with and without OUTPUT set. > > Basically if OUTPUT is not set, assume the current directory. It should > only take effect when someone builds from an individual directory, > because if you build from the top level OUTPUT is already set. > > > diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk > index ce96d80ad64f..9087fa949e82 100644 > --- a/tools/testing/selftests/lib.mk > +++ b/tools/testing/selftests/lib.mk > @@ -2,6 +2,8 @@ > # Makefile can operate with or without the kbuild infrastructure. > CC := $(CROSS_COMPILE)gcc > > +OUTPUT ?= $(PWD) > + > TEST_GEN_PROGS := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS)) > TEST_GEN_FILES := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_FILES)) > > > > cheers > I sent a fix to lib.mk to set the OUTPUT. Please review. I can request Linus to merge it in before 4.11-rc1 comes out. thanks, -- Shuah
Re: [PATCH v2 1/1] rtc: rtctest: Improve support detection
On 08/15/2017 02:46 AM, Lukáš Doktor wrote: > The rtc-generic and opal-rtc are failing to run this test as they do not > support all the features. Let's treat the error returns and skip to the > following test. > > Theoretically the test_DATE should be also adjusted, but as it's enabled > on demand I think it makes sense to fail in such case. > > Signed-off-by: Lukáš Doktor > --- > tools/testing/selftests/timers/rtctest.c | 7 ++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/timers/rtctest.c > b/tools/testing/selftests/timers/rtctest.c > index f61170f..411eff6 100644 > --- a/tools/testing/selftests/timers/rtctest.c > +++ b/tools/testing/selftests/timers/rtctest.c > @@ -221,6 +221,11 @@ int main(int argc, char **argv) > /* Read the current alarm settings */ > retval = ioctl(fd, RTC_ALM_READ, &rtc_tm); > if (retval == -1) { > + if (errno == EINVAL) { > + fprintf(stderr, > + "\n...EINVAL reading current alarm > setting.\n"); > + goto test_PIE; > + } > perror("RTC_ALM_READ ioctl"); > exit(errno); > } > @@ -231,7 +236,7 @@ int main(int argc, char **argv) > /* Enable alarm interrupts */ > retval = ioctl(fd, RTC_AIE_ON, 0); > if (retval == -1) { > - if (errno == EINVAL) { > + if (errno == EINVAL || errno == EIO) { > fprintf(stderr, > "\n...Alarm IRQs not supported.\n"); > goto test_PIE; > Applied to linux-kselftest next for 4.14-rc1 thanks, -- Shuah
Re: [PATCH] selftests/overlayfs: Fix build error on ppc64
On 5/20/24 20:26, Michael Ellerman wrote: Fix build error on ppc64: dev_in_maps.c: In function ‘get_file_dev_and_inode’: dev_in_maps.c:60:59: error: format ‘%llu’ expects argument of type ‘long long unsigned int *’, but argument 7 has type ‘__u64 *’ {aka ‘long unsigned int *’} [-Werror=format=] By switching to unsigned long long for u64 for ppc64 builds. Signed-off-by: Michael Ellerman --- tools/testing/selftests/filesystems/overlayfs/dev_in_maps.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/filesystems/overlayfs/dev_in_maps.c b/tools/testing/selftests/filesystems/overlayfs/dev_in_maps.c index 759f86e7d263..2862aae58b79 100644 --- a/tools/testing/selftests/filesystems/overlayfs/dev_in_maps.c +++ b/tools/testing/selftests/filesystems/overlayfs/dev_in_maps.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 #define _GNU_SOURCE +#define __SANE_USERSPACE_TYPES__ // Use ll64 #include #include Applied to linux-kselftest fixes for the next rc. Michael, If you want to take this through, let me know, I can drop this. thanks, -- Shuah
Re: [PATCH] selftests: cachestat: Fix build warnings on ppc64
On 5/20/24 21:01, Michael Ellerman wrote: Fix warnings like: test_cachestat.c: In function ‘print_cachestat’: test_cachestat.c:30:38: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 2 has type ‘__u64’ {aka ‘long unsigned int’} [-Wformat=] By switching to unsigned long long for u64 for ppc64 builds. Signed-off-by: Michael Ellerman --- tools/testing/selftests/cachestat/test_cachestat.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/cachestat/test_cachestat.c b/tools/testing/selftests/cachestat/test_cachestat.c index b171fd53b004..632ab44737ec 100644 --- a/tools/testing/selftests/cachestat/test_cachestat.c +++ b/tools/testing/selftests/cachestat/test_cachestat.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 #define _GNU_SOURCE +#define __SANE_USERSPACE_TYPES__ // Use ll64 #include #include Applied to linux-kselftest fixes for the next rc. Michael, If you want to take this through, let me know, I can drop this. thanks, -- Shuah
Re: [PATCH] selftests/openat2: Fix build warnings on ppc64
On 5/20/24 21:03, Michael Ellerman wrote: Fix warnings like: openat2_test.c: In function ‘test_openat2_flags’: openat2_test.c:303:73: warning: format ‘%llX’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘__u64’ {aka ‘long unsigned int’} [-Wformat=] By switching to unsigned long long for u64 for ppc64 builds. Signed-off-by: Michael Ellerman --- tools/testing/selftests/openat2/openat2_test.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/openat2/openat2_test.c b/tools/testing/selftests/openat2/openat2_test.c index 9024754530b2..5790ab446527 100644 --- a/tools/testing/selftests/openat2/openat2_test.c +++ b/tools/testing/selftests/openat2/openat2_test.c @@ -5,6 +5,7 @@ */ #define _GNU_SOURCE +#define __SANE_USERSPACE_TYPES__ // Use ll64 #include #include #include Applied to linux-kselftest fixes for the next rc. Michael, If you want to take this through, let me know, I can drop this. thanks, -- Shuah
Re: [PATCH v4 28/29] kselftest/arm64: Add test case for POR_EL0 signal frame records
On 5/29/24 09:51, Mark Brown wrote: On Fri, May 03, 2024 at 02:01:46PM +0100, Joey Gouly wrote: Ensure that we get signal context for POR_EL0 if and only if POE is present on the system. Reviewed-by: Mark Brown For kselftest: Acked-by: Shuah Khan thanks, -- Shuah
Re: [PATCH 1/5] selftests: vdso: Fix vDSO name for powerpc
On 8/30/24 06:41, Jason A. Donenfeld wrote: Hi Shuah, No 0/5 patch, so replying to the first one. These are fixes to the vDSO selftests that Christophe is ostensibly providing as a preamble to his work porting vgetrandom to PPC. Do you mind if I take these via my random tree so his PPC vgetrandom code can go on top of it? Jason Yes - here is the Ack to apply to all patches in the series: Acked-by: Shuah Khan thanks, -- Shuah