From: Christopher M. Riedl <hidden> Date: 2019-08-06 03:05:26
Fixes an oops when calling the shared-processor spinlock implementation
from a non-SP LPAR. Also take this opportunity to refactor
SHARED_PROCESSOR a bit.
Reference: https://github.com/linuxppc/issues/issues/229
Changes since v2:
- Directly call splpar_*_yield() to avoid duplicate call to
is_shared_processor() in some cases
Changes since v1:
- Improve comment wording to make it clear why the BOOK3S #ifdef is
required in is_shared_processor() in spinlock.h
- Replace empty #define of splpar_*_yield() with actual functions with
empty bodies
Christopher M. Riedl (3):
powerpc/spinlocks: Refactor SHARED_PROCESSOR
powerpc/spinlocks: Rename SPLPAR-only spinlocks
powerpc/spinlocks: Fix oops in shared-processor spinlocks
arch/powerpc/include/asm/spinlock.h | 62 +++++++++++++++++++++--------
arch/powerpc/lib/locks.c | 6 +--
2 files changed, 48 insertions(+), 20 deletions(-)
--
2.22.0
From: Christopher M. Riedl <hidden> Date: 2019-08-06 02:59:52
Determining if a processor is in shared processor mode is not a constant
so don't hide it behind a #define.
Signed-off-by: Christopher M. Riedl <redacted>
Reviewed-by: Andrew Donnellan <redacted>
---
arch/powerpc/include/asm/spinlock.h | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
@@ -101,15 +101,27 @@ static inline int arch_spin_trylock(arch_spinlock_t *lock)#if defined(CONFIG_PPC_SPLPAR)/* We only yield to the hypervisor if we are in shared processor mode */-#define SHARED_PROCESSOR (lppaca_shared_proc(local_paca->lppaca_ptr))externvoid__spin_yield(arch_spinlock_t*lock);externvoid__rw_yield(arch_rwlock_t*lock);#else /* SPLPAR */#define __spin_yield(x) barrier()#define __rw_yield(x) barrier()-#define SHARED_PROCESSOR 0#endif+staticinlineboolis_shared_processor(void)+{+/*+*LPPACAisonlyavailableonBOOK3SsoguardanythingLPPACArelatedto+*allowotherplatforms(whichincludethiscommonheader)tocompile.+*/+#ifdef CONFIG_PPC_BOOK3S+return(IS_ENABLED(CONFIG_PPC_SPLPAR)&&+lppaca_shared_proc(local_paca->lppaca_ptr));+#else+returnfalse;+#endif+}+staticinlinevoidarch_spin_lock(arch_spinlock_t*lock){while(1){
@@ -103,11 +103,9 @@ static inline int arch_spin_trylock(arch_spinlock_t *lock)/* We only yield to the hypervisor if we are in shared processor mode */voidsplpar_spin_yield(arch_spinlock_t*lock);voidsplpar_rw_yield(arch_rwlock_t*lock);-#define __spin_yield(x) splpar_spin_yield(x)-#define __rw_yield(x) splpar_rw_yield(x)#else /* SPLPAR */-#define __spin_yield(x) barrier()-#define __rw_yield(x) barrier()+staticinlinevoidsplpar_spin_yield(arch_spinlock_t*lock){};+staticinlinevoidsplpar_rw_yield(arch_rwlock_t*lock){};#endifstaticinlineboolis_shared_processor(void)
From: Christopher M. Riedl <hidden> Date: 2019-08-06 03:03:34
The __rw_yield and __spin_yield locks only pertain to SPLPAR mode.
Rename them to make this relationship obvious.
Signed-off-by: Christopher M. Riedl <redacted>
Reviewed-by: Andrew Donnellan <redacted>
---
arch/powerpc/include/asm/spinlock.h | 6 ++++--
arch/powerpc/lib/locks.c | 6 +++---
2 files changed, 7 insertions(+), 5 deletions(-)
@@ -101,8 +101,10 @@ static inline int arch_spin_trylock(arch_spinlock_t *lock)#if defined(CONFIG_PPC_SPLPAR)/* We only yield to the hypervisor if we are in shared processor mode */-externvoid__spin_yield(arch_spinlock_t*lock);-externvoid__rw_yield(arch_rwlock_t*lock);+voidsplpar_spin_yield(arch_spinlock_t*lock);+voidsplpar_rw_yield(arch_rwlock_t*lock);+#define __spin_yield(x) splpar_spin_yield(x)+#define __rw_yield(x) splpar_rw_yield(x)#else /* SPLPAR */#define __spin_yield(x) barrier()#define __rw_yield(x) barrier()
From: kbuild test robot <hidden> Date: 2019-08-12 01:55:34
Hi "Christopher,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linus/master]
[cannot apply to v5.3-rc4 next-20190809]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Christopher-M-Riedl/Fix-oops-in-shared-processor-spinlocks/20190806-204502
config: powerpc-powernv_defconfig (attached as .config)
compiler: powerpc64le-linux-gcc (GCC) 7.4.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.4.0 make.cross ARCH=powerpc
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <redacted>
All errors (new ones prefixed by >>):
In file included from include/linux/spinlock.h:89:0,
from include/linux/seqlock.h:36,
from include/linux/time.h:6,
from include/linux/compat.h:10,
from arch/powerpc/kernel/asm-offsets.c:14:
arch/powerpc/include/asm/spinlock.h: In function 'is_shared_processor':
quoted
arch/powerpc/include/asm/spinlock.h:119:34: error: 'struct paca_struct' has no member named 'lppaca_ptr'; did you mean 'slb_cache_ptr'?
lppaca_shared_proc(local_paca->lppaca_ptr));
^~~~~~~~~~
slb_cache_ptr
make[2]: *** [arch/powerpc/kernel/asm-offsets.s] Error 1
make[2]: Target '__build' not remade because of errors.
make[1]: *** [prepare0] Error 2
make[1]: Target 'prepare' not remade because of errors.
make: *** [sub-make] Error 2
7 real 4 user 3 sys 110.24% cpu make prepare
vim +119 arch/powerpc/include/asm/spinlock.h
110
111 static inline bool is_shared_processor(void)
112 {
113 /*
114 * LPPACA is only available on BOOK3S so guard anything LPPACA related to
115 * allow other platforms (which include this common header) to compile.
116 */
117 #ifdef CONFIG_PPC_BOOK3S
118 return (IS_ENABLED(CONFIG_PPC_SPLPAR) &&
> 119 lppaca_shared_proc(local_paca->lppaca_ptr));
120 #else
121 return false;
122 #endif
123 }
124
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
From: Michael Ellerman <mpe@ellerman.id.au> Date: 2019-08-12 12:10:41
kbuild test robot [off-list ref] writes:
Hi "Christopher,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linus/master]
[cannot apply to v5.3-rc4 next-20190809]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Christopher-M-Riedl/Fix-oops-in-shared-processor-spinlocks/20190806-204502
config: powerpc-powernv_defconfig (attached as .config)
compiler: powerpc64le-linux-gcc (GCC) 7.4.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.4.0 make.cross ARCH=powerpc
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <redacted>
All errors (new ones prefixed by >>):
In file included from include/linux/spinlock.h:89:0,
from include/linux/seqlock.h:36,
from include/linux/time.h:6,
from include/linux/compat.h:10,
from arch/powerpc/kernel/asm-offsets.c:14:
arch/powerpc/include/asm/spinlock.h: In function 'is_shared_processor':
quoted
quoted
arch/powerpc/include/asm/spinlock.h:119:34: error: 'struct paca_struct' has no member named 'lppaca_ptr'; did you mean 'slb_cache_ptr'?
lppaca_shared_proc(local_paca->lppaca_ptr));
^~~~~~~~~~
slb_cache_ptr
make[2]: *** [arch/powerpc/kernel/asm-offsets.s] Error 1
make[2]: Target '__build' not remade because of errors.
make[1]: *** [prepare0] Error 2
make[1]: Target 'prepare' not remade because of errors.
make: *** [sub-make] Error 2
7 real 4 user 3 sys 110.24% cpu make prepare
vim +119 arch/powerpc/include/asm/spinlock.h
110
111 static inline bool is_shared_processor(void)
112 {
113 /*
114 * LPPACA is only available on BOOK3S so guard anything LPPACA related to
115 * allow other platforms (which include this common header) to compile.
116 */
117 #ifdef CONFIG_PPC_BOOK3S
I think you should use PPC_PSERIES here and that will fix it.
cheers
118 return (IS_ENABLED(CONFIG_PPC_SPLPAR) &&
> 119 lppaca_shared_proc(local_paca->lppaca_ptr));
120 #else
121 return false;
122 #endif
123 }
124
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation