linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] edac,ghes,cper: Add device to Memory Error Record
@ 2021-11-30 13:16 Shuai Xue
  2021-11-30 19:13 ` Luck, Tony
  0 siblings, 1 reply; 3+ messages in thread
From: Shuai Xue @ 2021-11-30 13:16 UTC (permalink / raw)
  To: mchehab, bp, tony.luck, james.morse, rric, linux-edac, linux-kernel
  Cc: xueshuai, zhangliguang, zhuo.song

If Bit 7 of Validation Bits is valid, the device number of the memory
associated with errors should be reported to Memory Error Record.

Signed-off-by: Shuai Xue <xueshuai@linux.alibaba.com>
---
 drivers/edac/ghes_edac.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c
index a918ca93e4f7..cf98b270d6f7 100644
--- a/drivers/edac/ghes_edac.c
+++ b/drivers/edac/ghes_edac.c
@@ -378,6 +378,8 @@ void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err)
 	if (mem_err->validation_bits & CPER_MEM_VALID_BANK_ADDRESS)
 		p += sprintf(p, "bank_address:%d ",
 			     mem_err->bank & CPER_MEM_BANK_ADDRESS_MASK);
+	if (mem_err->validation_bits & CPER_MEM_VALID_DEVICE)
+		p += sprintf(p, "device:%d ", mem_err->device);
 	if (mem_err->validation_bits & (CPER_MEM_VALID_ROW | CPER_MEM_VALID_ROW_EXT)) {
 		u32 row = mem_err->row;
 
-- 
2.20.1.12.g72788fdb


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] edac,ghes,cper: Add device to Memory Error Record
  2021-11-30 13:16 [PATCH] edac,ghes,cper: Add device to Memory Error Record Shuai Xue
@ 2021-11-30 19:13 ` Luck, Tony
  2021-12-02 13:32   ` Shuai Xue
  0 siblings, 1 reply; 3+ messages in thread
From: Luck, Tony @ 2021-11-30 19:13 UTC (permalink / raw)
  To: Shuai Xue
  Cc: mchehab, bp, james.morse, rric, linux-edac, linux-kernel,
	zhangliguang, zhuo.song

On Tue, Nov 30, 2021 at 09:16:48PM +0800, Shuai Xue wrote:
> If Bit 7 of Validation Bits is valid, the device number of the memory
> associated with errors should be reported to Memory Error Record.
> 
> Signed-off-by: Shuai Xue <xueshuai@linux.alibaba.com>
> ---
>  drivers/edac/ghes_edac.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c
> index a918ca93e4f7..cf98b270d6f7 100644
> --- a/drivers/edac/ghes_edac.c
> +++ b/drivers/edac/ghes_edac.c
> @@ -378,6 +378,8 @@ void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err)
>  	if (mem_err->validation_bits & CPER_MEM_VALID_BANK_ADDRESS)
>  		p += sprintf(p, "bank_address:%d ",
>  			     mem_err->bank & CPER_MEM_BANK_ADDRESS_MASK);
> +	if (mem_err->validation_bits & CPER_MEM_VALID_DEVICE)
> +		p += sprintf(p, "device:%d ", mem_err->device);
>  	if (mem_err->validation_bits & (CPER_MEM_VALID_ROW | CPER_MEM_VALID_ROW_EXT)) {
>  		u32 row = mem_err->row;
>  

This looks OK (same as code in drivers/firmware/efi/cper.c in the
cper_mem_err_location() function. But that makes me wonder why there
is near duplication of code in ghes_edac.c?

The cper.c code seems to be written defensively using scnprintf()
instead of sprintf().  Could ghes_edac share the same code?

-Tony

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] edac,ghes,cper: Add device to Memory Error Record
  2021-11-30 19:13 ` Luck, Tony
@ 2021-12-02 13:32   ` Shuai Xue
  0 siblings, 0 replies; 3+ messages in thread
From: Shuai Xue @ 2021-12-02 13:32 UTC (permalink / raw)
  To: Luck, Tony
  Cc: mchehab, bp, james.morse, rric, linux-edac, linux-kernel,
	zhangliguang, zhuo.song

Hi, Tony,

> This looks OK (same as code in drivers/firmware/efi/cper.c in the
> cper_mem_err_location() function. But that makes me wonder why there
> is near duplication of code in ghes_edac.c?
May it is a legacy issue.


> The cper.c code seems to be written defensively using scnprintf()
> instead of sprintf().  Could ghes_edac share the same code?
I think so, ghes_edac_report_mem_error in ghes_edac.c is Long Method
and have Duplicated Code with cper_mem_err_location,
cper_dimm_err_location, and cper_mem_err_type_str in
drivers/firmware/efi/cper.c.

I will send a new patch to rework ghes_edac_report_mem_error.

Cheers
Shuai

On 2021/12/1 AM3:13, Luck, Tony wrote:
> On Tue, Nov 30, 2021 at 09:16:48PM +0800, Shuai Xue wrote:
>> If Bit 7 of Validation Bits is valid, the device number of the memory
>> associated with errors should be reported to Memory Error Record.
>>
>> Signed-off-by: Shuai Xue <xueshuai@linux.alibaba.com>
>> ---
>>  drivers/edac/ghes_edac.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c
>> index a918ca93e4f7..cf98b270d6f7 100644
>> --- a/drivers/edac/ghes_edac.c
>> +++ b/drivers/edac/ghes_edac.c
>> @@ -378,6 +378,8 @@ void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err)
>>  	if (mem_err->validation_bits & CPER_MEM_VALID_BANK_ADDRESS)
>>  		p += sprintf(p, "bank_address:%d ",
>>  			     mem_err->bank & CPER_MEM_BANK_ADDRESS_MASK);
>> +	if (mem_err->validation_bits & CPER_MEM_VALID_DEVICE)
>> +		p += sprintf(p, "device:%d ", mem_err->device);
>>  	if (mem_err->validation_bits & (CPER_MEM_VALID_ROW | CPER_MEM_VALID_ROW_EXT)) {
>>  		u32 row = mem_err->row;
>>  
> 
> This looks OK (same as code in drivers/firmware/efi/cper.c in the
> cper_mem_err_location() function. But that makes me wonder why there
> is near duplication of code in ghes_edac.c?
> 
> The cper.c code seems to be written defensively using scnprintf()
> instead of sprintf().  Could ghes_edac share the same code?
> 
> -Tony
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-12-02 13:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-30 13:16 [PATCH] edac,ghes,cper: Add device to Memory Error Record Shuai Xue
2021-11-30 19:13 ` Luck, Tony
2021-12-02 13:32   ` Shuai Xue

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).