Message ID | 20200403132622.130394-10-npiggin@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | powerpc/64: machine check and system reset fixes | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/apply_patch | success | Successfully applied on branch powerpc/merge (d0c12846a3a24cd6d68b608c866712bc7e471634) |
snowpatch_ozlabs/checkpatch | warning | total: 0 errors, 0 warnings, 6 checks, 35 lines checked |
snowpatch_ozlabs/needsstable | success | Patch has no Fixes tags |
Le 03/04/2020 à 15:26, Nicholas Piggin a écrit : > This allows rtas_args to be put on the machine check stack, which > avoids a lot of complications with re-entrancy deadlocks. > > Reviewed-by: Mahesh Salgaonkar <mahesh@linux.ibm.com> > Signed-off-by: Nicholas Piggin <npiggin@gmail.com> > --- > arch/powerpc/kernel/setup_64.c | 17 ++++++++++++++++- > 1 file changed, 16 insertions(+), 1 deletion(-) > > diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c > index e05e6dd67ae6..3a2428aa3d9a 100644 > --- a/arch/powerpc/kernel/setup_64.c > +++ b/arch/powerpc/kernel/setup_64.c > @@ -692,6 +692,9 @@ void __init exc_lvl_early_init(void) > void __init emergency_stack_init(void) > { > u64 limit; > +#ifdef CONFIG_PPC_BOOK3S_64 #ifdef not needed, see below > + u64 mce_limit; > +#endif > unsigned int i; > > /* > @@ -710,6 +713,18 @@ void __init emergency_stack_init(void) > */ > limit = min(ppc64_bolted_size(), ppc64_rma_size); > > + /* > + * Machine check on pseries calls rtas, but can't use the static > + * rtas_args due to a machine check hitting while the lock is held. > + * rtas args have to be under 4GB, so the machine check stack is > + * limited to 4GB so args can be put on stack. > + */ > +#ifdef CONFIG_PPC_BOOK3S_64 This ifdef is not needed. FW_FEATURE_LPAR is only possible on CONFIG_PPC_BOOK3S_64 (indeed only on PSERIES or PS3). On others firmware_has_feature(FW_FEATURE_LPAR) should return 0 at compile time. > + mce_limit = limit; > + if (firmware_has_feature(FW_FEATURE_LPAR) && mce_limit > 4UL*1024*1024*1024) > + mce_limit = 4UL*1024*1024*1024; You should use SZ_4G instead of hardcoding. > +#endif > + > for_each_possible_cpu(i) { > paca_ptrs[i]->emergency_sp = alloc_stack(limit, i) + THREAD_SIZE; > > @@ -718,7 +733,7 @@ void __init emergency_stack_init(void) > paca_ptrs[i]->nmi_emergency_sp = alloc_stack(limit, i) + THREAD_SIZE; > > /* emergency stack for machine check exception handling. */ > - paca_ptrs[i]->mc_emergency_sp = alloc_stack(limit, i) + THREAD_SIZE; > + paca_ptrs[i]->mc_emergency_sp = alloc_stack(mce_limit, i) + THREAD_SIZE; > #endif > } > } > Christophe
Christophe Leroy's on April 4, 2020 12:19 am: > > > Le 03/04/2020 à 15:26, Nicholas Piggin a écrit : >> This allows rtas_args to be put on the machine check stack, which >> avoids a lot of complications with re-entrancy deadlocks. >> >> Reviewed-by: Mahesh Salgaonkar <mahesh@linux.ibm.com> >> Signed-off-by: Nicholas Piggin <npiggin@gmail.com> >> --- >> arch/powerpc/kernel/setup_64.c | 17 ++++++++++++++++- >> 1 file changed, 16 insertions(+), 1 deletion(-) >> >> diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c >> index e05e6dd67ae6..3a2428aa3d9a 100644 >> --- a/arch/powerpc/kernel/setup_64.c >> +++ b/arch/powerpc/kernel/setup_64.c >> @@ -692,6 +692,9 @@ void __init exc_lvl_early_init(void) >> void __init emergency_stack_init(void) >> { >> u64 limit; >> +#ifdef CONFIG_PPC_BOOK3S_64 > > #ifdef not needed, see below > >> + u64 mce_limit; >> +#endif >> unsigned int i; >> >> /* >> @@ -710,6 +713,18 @@ void __init emergency_stack_init(void) >> */ >> limit = min(ppc64_bolted_size(), ppc64_rma_size); >> >> + /* >> + * Machine check on pseries calls rtas, but can't use the static >> + * rtas_args due to a machine check hitting while the lock is held. >> + * rtas args have to be under 4GB, so the machine check stack is >> + * limited to 4GB so args can be put on stack. >> + */ >> +#ifdef CONFIG_PPC_BOOK3S_64 > > This ifdef is not needed. FW_FEATURE_LPAR is only possible on > CONFIG_PPC_BOOK3S_64 (indeed only on PSERIES or PS3). On others > firmware_has_feature(FW_FEATURE_LPAR) should return 0 at compile time. Sure I'll remove it. >> + mce_limit = limit; >> + if (firmware_has_feature(FW_FEATURE_LPAR) && mce_limit > 4UL*1024*1024*1024) >> + mce_limit = 4UL*1024*1024*1024; > > You should use SZ_4G instead of hardcoding. Will do. Thanks, Nick
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c index e05e6dd67ae6..3a2428aa3d9a 100644 --- a/arch/powerpc/kernel/setup_64.c +++ b/arch/powerpc/kernel/setup_64.c @@ -692,6 +692,9 @@ void __init exc_lvl_early_init(void) void __init emergency_stack_init(void) { u64 limit; +#ifdef CONFIG_PPC_BOOK3S_64 + u64 mce_limit; +#endif unsigned int i; /* @@ -710,6 +713,18 @@ void __init emergency_stack_init(void) */ limit = min(ppc64_bolted_size(), ppc64_rma_size); + /* + * Machine check on pseries calls rtas, but can't use the static + * rtas_args due to a machine check hitting while the lock is held. + * rtas args have to be under 4GB, so the machine check stack is + * limited to 4GB so args can be put on stack. + */ +#ifdef CONFIG_PPC_BOOK3S_64 + mce_limit = limit; + if (firmware_has_feature(FW_FEATURE_LPAR) && mce_limit > 4UL*1024*1024*1024) + mce_limit = 4UL*1024*1024*1024; +#endif + for_each_possible_cpu(i) { paca_ptrs[i]->emergency_sp = alloc_stack(limit, i) + THREAD_SIZE; @@ -718,7 +733,7 @@ void __init emergency_stack_init(void) paca_ptrs[i]->nmi_emergency_sp = alloc_stack(limit, i) + THREAD_SIZE; /* emergency stack for machine check exception handling. */ - paca_ptrs[i]->mc_emergency_sp = alloc_stack(limit, i) + THREAD_SIZE; + paca_ptrs[i]->mc_emergency_sp = alloc_stack(mce_limit, i) + THREAD_SIZE; #endif } }