All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ganesh <ganeshgr@linux.ibm.com>
To: Nicholas Piggin <npiggin@gmail.com>,
	linuxppc-dev@lists.ozlabs.org, mpe@ellerman.id.au
Cc: mahesh@linux.ibm.com, dja@axtens.net
Subject: Re: [PATCH v3 2/2] pseries/mce: Refactor the pseries mce handling code
Date: Mon, 17 Jan 2022 13:41:03 +0530	[thread overview]
Message-ID: <78771d76-9ae2-9ab1-6b0e-7a93093056db@linux.ibm.com> (raw)
In-Reply-To: <1637759013.aa9l8cb1io.astroid@bobo.none>

[-- Attachment #1: Type: text/plain, Size: 5937 bytes --]

On 11/24/21 18:40, Nicholas Piggin wrote:

> Excerpts from Ganesh Goudar's message of November 24, 2021 7:55 pm:
>> Now that we are no longer switching on the mmu in realmode
>> mce handler, Revert the commit 4ff753feab02("powerpc/pseries:
>> Avoid using addr_to_pfn in real mode") partially, which
>> introduced functions mce_handle_err_virtmode/realmode() to
>> separate mce handler code which needed translation to enabled.
>>
>> Signed-off-by: Ganesh Goudar<ganeshgr@linux.ibm.com>
>> ---
>>   arch/powerpc/platforms/pseries/ras.c | 122 +++++++++++----------------
>>   1 file changed, 49 insertions(+), 73 deletions(-)
>>
>> diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c
>> index 8613f9cc5798..62e1519b8355 100644
>> --- a/arch/powerpc/platforms/pseries/ras.c
>> +++ b/arch/powerpc/platforms/pseries/ras.c
>> @@ -511,58 +511,17 @@ int pSeries_system_reset_exception(struct pt_regs *regs)
>>   	return 0; /* need to perform reset */
>>   }
>>   
>> -static int mce_handle_err_realmode(int disposition, u8 error_type)
>> -{
>> -#ifdef CONFIG_PPC_BOOK3S_64
>> -	if (disposition == RTAS_DISP_NOT_RECOVERED) {
>> -		switch (error_type) {
>> -		case	MC_ERROR_TYPE_ERAT:
>> -			flush_erat();
>> -			disposition = RTAS_DISP_FULLY_RECOVERED;
>> -			break;
>> -		case	MC_ERROR_TYPE_SLB:
>> -			/*
>> -			 * Store the old slb content in paca before flushing.
>> -			 * Print this when we go to virtual mode.
>> -			 * There are chances that we may hit MCE again if there
>> -			 * is a parity error on the SLB entry we trying to read
>> -			 * for saving. Hence limit the slb saving to single
>> -			 * level of recursion.
>> -			 */
>> -			if (local_paca->in_mce == 1)
>> -				slb_save_contents(local_paca->mce_faulty_slbs);
>> -			flush_and_reload_slb();
>> -			disposition = RTAS_DISP_FULLY_RECOVERED;
>> -			break;
>> -		default:
>> -			break;
>> -		}
>> -	} else if (disposition == RTAS_DISP_LIMITED_RECOVERY) {
>> -		/* Platform corrected itself but could be degraded */
>> -		pr_err("MCE: limited recovery, system may be degraded\n");
>> -		disposition = RTAS_DISP_FULLY_RECOVERED;
>> -	}
>> -#endif
>> -	return disposition;
>> -}
>> -
>> -static int mce_handle_err_virtmode(struct pt_regs *regs,
>> -				   struct rtas_error_log *errp,
>> -				   struct pseries_mc_errorlog *mce_log,
>> -				   int disposition)
>> +static int mce_handle_error(struct pt_regs *regs, struct rtas_error_log *errp)
>>   {
>>   	struct mce_error_info mce_err = { 0 };
>> +	unsigned long eaddr = 0, paddr = 0;
>> +	struct pseries_errorlog *pseries_log;
>> +	struct pseries_mc_errorlog *mce_log;
>> +	int disposition = rtas_error_disposition(errp);
>>   	int initiator = rtas_error_initiator(errp);
>>   	int severity = rtas_error_severity(errp);
>> -	unsigned long eaddr = 0, paddr = 0;
>>   	u8 error_type, err_sub_type;
>>   
>> -	if (!mce_log)
>> -		goto out;
>> -
>> -	error_type = mce_log->error_type;
>> -	err_sub_type = rtas_mc_error_sub_type(mce_log);
>> -
>>   	if (initiator == RTAS_INITIATOR_UNKNOWN)
>>   		mce_err.initiator = MCE_INITIATOR_UNKNOWN;
>>   	else if (initiator == RTAS_INITIATOR_CPU)
>> @@ -588,6 +547,8 @@ static int mce_handle_err_virtmode(struct pt_regs *regs,
>>   		mce_err.severity = MCE_SEV_SEVERE;
>>   	else if (severity == RTAS_SEVERITY_ERROR)
>>   		mce_err.severity = MCE_SEV_SEVERE;
>> +	else if (severity == RTAS_SEVERITY_FATAL)
>> +		mce_err.severity = MCE_SEV_FATAL;
>>   	else
>>   		mce_err.severity = MCE_SEV_FATAL;
>>   
> What's this hunk for?
>
>> @@ -599,7 +560,18 @@ static int mce_handle_err_virtmode(struct pt_regs *regs,
>>   	mce_err.error_type = MCE_ERROR_TYPE_UNKNOWN;
>>   	mce_err.error_class = MCE_ECLASS_UNKNOWN;
>>   
>> -	switch (error_type) {
>> +	if (!rtas_error_extended(errp))
>> +		goto out;
>> +
>> +	pseries_log = get_pseries_errorlog(errp, PSERIES_ELOG_SECT_ID_MCE);
>> +	if (!pseries_log)
>> +		goto out;
>> +
>> +	mce_log = (struct pseries_mc_errorlog *)pseries_log->data;
>> +	error_type = mce_log->error_type;
>> +	err_sub_type = rtas_mc_error_sub_type(mce_log);
>> +
>> +	switch (mce_log->error_type) {
>>   	case MC_ERROR_TYPE_UE:
>>   		mce_err.error_type = MCE_ERROR_TYPE_UE;
>>   		mce_common_process_ue(regs, &mce_err);
>> @@ -692,41 +664,45 @@ static int mce_handle_err_virtmode(struct pt_regs *regs,
>>   		mce_err.error_type = MCE_ERROR_TYPE_DCACHE;
>>   		break;
>>   	case MC_ERROR_TYPE_I_CACHE:
>> -		mce_err.error_type = MCE_ERROR_TYPE_ICACHE;
>> +		mce_err.error_type = MCE_ERROR_TYPE_DCACHE;
>>   		break;
> And this one. Doesn't look right.
>
>>   	case MC_ERROR_TYPE_UNKNOWN:
>>   	default:
>>   		mce_err.error_type = MCE_ERROR_TYPE_UNKNOWN;
>>   		break;
>>   	}
>> +
>> +#ifdef CONFIG_PPC_BOOK3S_64
>> +	if (disposition == RTAS_DISP_NOT_RECOVERED) {
>> +		switch (error_type) {
>> +		case	MC_ERROR_TYPE_SLB:
>> +		case	MC_ERROR_TYPE_ERAT:
>> +			/*
>> +			 * Store the old slb content in paca before flushing.
>> +			 * Print this when we go to virtual mode.
>> +			 * There are chances that we may hit MCE again if there
>> +			 * is a parity error on the SLB entry we trying to read
>> +			 * for saving. Hence limit the slb saving to single
>> +			 * level of recursion.
>> +			 */
>> +			if (local_paca->in_mce == 1)
>> +				slb_save_contents(local_paca->mce_faulty_slbs);
>> +			flush_and_reload_slb();
>> +			disposition = RTAS_DISP_FULLY_RECOVERED;
>> +			break;
>> +		default:
>> +			break;
>> +		}
>> +	} else if (disposition == RTAS_DISP_LIMITED_RECOVERY) {
>> +		/* Platform corrected itself but could be degraded */
>> +		pr_err("MCE: limited recovery, system may be degraded\n");
>> +		disposition = RTAS_DISP_FULLY_RECOVERED;
>> +	}
> I would prefer if you just keep the mce_handle_err_realmode function
> (can rename it if you want). It's actually changed a bit since the
> patch being reverted so we don't want to undo that.

Ok, I will leave it as is for now, we can change it later.

>
> Thanks,
> Nick

[-- Attachment #2: Type: text/html, Size: 6507 bytes --]

  reply	other threads:[~2022-01-17 10:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-24  9:54 [PATCH v3 1/2] powerpc/mce: Avoid using irq_work_queue() in realmode Ganesh Goudar
2021-11-24  9:55 ` [PATCH v3 2/2] pseries/mce: Refactor the pseries mce handling code Ganesh Goudar
2021-11-24 13:10   ` Nicholas Piggin
2022-01-17  8:11     ` Ganesh [this message]
2021-11-24 13:03 ` [PATCH v3 1/2] powerpc/mce: Avoid using irq_work_queue() in realmode Nicholas Piggin
2022-01-17  8:09   ` Ganesh
  -- strict thread matches above, loose matches on Subject: below --
2021-11-25 22:03 [PATCH v3 2/2] pseries/mce: Refactor the pseries mce handling code kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=78771d76-9ae2-9ab1-6b0e-7a93093056db@linux.ibm.com \
    --to=ganeshgr@linux.ibm.com \
    --cc=dja@axtens.net \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mahesh@linux.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.