All of lore.kernel.org
 help / color / mirror / Atom feed
From: Prasanna Kumar T S M <ptsm@linux.microsoft.com>
To: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>,
	linux-edac@vger.kernel.org
Cc: git@amd.com, shubhrajyoti.datta@gmail.com,
	Michal Simek <michal.simek@amd.com>,
	Borislav Petkov <bp@alien8.de>, Tony Luck <tony.luck@intel.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] EDAC/versalnet: Report PFN and page offset for DDR errors
Date: Wed, 1 Apr 2026 11:28:10 +0530	[thread overview]
Message-ID: <c4a7a3ec-cb87-4edc-ad6a-32dbed15197a@linux.microsoft.com> (raw)
In-Reply-To: <20260329124400.4064739-1-shubhrajyoti.datta@amd.com>



On 29-03-2026 18:14, Shubhrajyoti Datta wrote:
> Currently, DDRMC correctable and uncorrectable error events are reported
> to EDAC with page frame number (pfn) and offset set to zero.
> This information is not useful to locate the address for memory errors.
> 
> Compute the physical address from the error information and extract
> the page frame number and offset before calling edac_mc_handle_error().
> This provides the actual memory location information to the userspace.
> 
> Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>
> ---
> 
>   drivers/edac/versalnet_edac.c | 18 +++++++++---------
>   1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/edac/versalnet_edac.c b/drivers/edac/versalnet_edac.c
> index 915bcd6166f7..66df090245be 100644
> --- a/drivers/edac/versalnet_edac.c
> +++ b/drivers/edac/versalnet_edac.c
> @@ -431,8 +431,7 @@ static void handle_error(struct mc_priv  *priv, struct ecc_status *stat,
>   {
>   	union ecc_error_info pinf;
>   	struct mem_ctl_info *mci;
> -	unsigned long pa;
> -	phys_addr_t pfn;
> +	unsigned long pa, pfn;
>   	int err;
>   
>   	if (WARN_ON_ONCE(ctl_num >= NUM_CONTROLLERS))
> @@ -442,27 +441,28 @@ static void handle_error(struct mc_priv  *priv, struct ecc_status *stat,
>   
>   	if (stat->error_type == MC5_ERR_TYPE_CE) {
>   		pinf = stat->ceinfo[stat->channel];
> +		pa = convert_to_physical(priv, pinf, ctl_num, error_data);
> +		pfn = PHYS_PFN(pa);
>   		snprintf(priv->message, sizeof(priv->message),
>   			 "Error type:%s Controller %d Addr at %lx\n",
> -			 "CE", ctl_num, convert_to_physical(priv, pinf, ctl_num, error_data));
> +			 "CE", ctl_num, pa);
>   
>   		edac_mc_handle_error(HW_EVENT_ERR_CORRECTED, mci,
> -				     1, 0, 0, 0, 0, 0, -1,
> +				     1, pfn, offset_in_page(pa), 0, 0, 0, -1,
>   				     priv->message, "");
>   	}
>   
>   	if (stat->error_type == MC5_ERR_TYPE_UE) {
>   		pinf = stat->ueinfo[stat->channel];
> +		pa = convert_to_physical(priv, pinf, ctl_num, error_data);
> +		pfn = PHYS_PFN(pa);
>   		snprintf(priv->message, sizeof(priv->message),
>   			 "Error type:%s controller %d Addr at %lx\n",
> -			 "UE", ctl_num, convert_to_physical(priv, pinf, ctl_num, error_data));
> +			 "UE", ctl_num, pa);
>   
>   		edac_mc_handle_error(HW_EVENT_ERR_UNCORRECTED, mci,
> -				     1, 0, 0, 0, 0, 0, -1,
> +				     1, pfn, offset_in_page(pa), 0, 0, 0, -1,
>   				     priv->message, "");
> -		pa = convert_to_physical(priv, pinf, ctl_num, error_data);
> -		pfn = PHYS_PFN(pa);
> -
>   		if (IS_ENABLED(CONFIG_MEMORY_FAILURE)) {
>   			err = memory_failure(pfn, MF_ACTION_REQUIRED);
>   			if (err)

Nit: pa and pfn calculation can be moved out of the if() condition.

Irrespective of the nit, the patch looks good.

Reviewed-by: Prasanna Kumar T S M <ptsm@linux.microsoft.com>

  reply	other threads:[~2026-04-01  5:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-29 12:44 [PATCH] EDAC/versalnet: Report PFN and page offset for DDR errors Shubhrajyoti Datta
2026-04-01  5:58 ` Prasanna Kumar T S M [this message]
2026-04-22  3:59   ` Srivatsa S. Bhat
2026-04-27 10:47     ` Shubhrajyoti Datta

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=c4a7a3ec-cb87-4edc-ad6a-32dbed15197a@linux.microsoft.com \
    --to=ptsm@linux.microsoft.com \
    --cc=bp@alien8.de \
    --cc=git@amd.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.simek@amd.com \
    --cc=shubhrajyoti.datta@amd.com \
    --cc=shubhrajyoti.datta@gmail.com \
    --cc=tony.luck@intel.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.