Message ID | 20200407051636.648369-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 (2c0ce4ff35994a7b12cc9879ced52c9e7c2e6667) |
snowpatch_ozlabs/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 33 lines checked |
snowpatch_ozlabs/needsstable | success | Patch has no Fixes tags |
Le 07/04/2020 à 07:16, 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> Reviewed-by: Christophe Leroy <christophe.leroy@c-s.fr> > --- > arch/powerpc/kernel/setup_64.c | 15 ++++++++++++--- > 1 file changed, 12 insertions(+), 3 deletions(-) > > diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c > index 438a9befce41..defe05b6b7a9 100644 > --- a/arch/powerpc/kernel/setup_64.c > +++ b/arch/powerpc/kernel/setup_64.c > @@ -709,7 +709,7 @@ void __init exc_lvl_early_init(void) > */ > void __init emergency_stack_init(void) > { > - u64 limit; > + u64 limit, mce_limit; > unsigned int i; > > /* > @@ -726,7 +726,16 @@ void __init emergency_stack_init(void) > * initialized in kernel/irq.c. These are initialized here in order > * to have emergency stacks available as early as possible. > */ > - limit = min(ppc64_bolted_size(), ppc64_rma_size); > + limit = mce_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. > + */ > + if (firmware_has_feature(FW_FEATURE_LPAR) && mce_limit > SZ_4G) > + mce_limit = SZ_4G; > > for_each_possible_cpu(i) { > paca_ptrs[i]->emergency_sp = alloc_stack(limit, i) + THREAD_SIZE; > @@ -736,7 +745,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 > } > } >
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c index 438a9befce41..defe05b6b7a9 100644 --- a/arch/powerpc/kernel/setup_64.c +++ b/arch/powerpc/kernel/setup_64.c @@ -709,7 +709,7 @@ void __init exc_lvl_early_init(void) */ void __init emergency_stack_init(void) { - u64 limit; + u64 limit, mce_limit; unsigned int i; /* @@ -726,7 +726,16 @@ void __init emergency_stack_init(void) * initialized in kernel/irq.c. These are initialized here in order * to have emergency stacks available as early as possible. */ - limit = min(ppc64_bolted_size(), ppc64_rma_size); + limit = mce_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. + */ + if (firmware_has_feature(FW_FEATURE_LPAR) && mce_limit > SZ_4G) + mce_limit = SZ_4G; for_each_possible_cpu(i) { paca_ptrs[i]->emergency_sp = alloc_stack(limit, i) + THREAD_SIZE; @@ -736,7 +745,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 } }