Add an API for edac device, for mulriple errors
v4 cover Add an API for edac device, for mulriple errors
Add an API for EDAC device to report for multiple errors, and move the old report function to use the new API.
Changes from v3:
----------------
- Move count check to inline function
- Fix count variable describtion (Reported-by: kbuild test robot <[email protected]>)
Changes from v2:
----------------
- Remove copy of edac_device_handle_*() functions, modify the existing functions.
Changes from v1:
----------------
- use 'unsigned int' instead of u16
- update variable name to be count
- remove WARN_ON and simply exit if count is zero
- add inline functions in header file
Hanna Hawa (2):
edac: Add an API for edac device to report for multiple errors
edac: move edac_device_handle_*() API functions to header
drivers/edac/edac_device.c | 44 +++++++++++++++++---------------- drivers/edac/edac_device.h | 50 +++++++++++++++++++++++++++++++++----- 2 files changed, 67 insertions(+), 27 deletions(-)
Signature · 1 line
2.17.1
PATCH v4 1/2 edac: Add an API for edac device to report for multiple errors
Add an API for EDAC device to report multiple errors with same type.
--- drivers/edac/edac_device.c | 56 ++++++++++++++++++++++++-------------- drivers/edac/edac_device.h | 47 ++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+), 20 deletions(-)
drivers/edac/edac_device.c +36 -20
@@ -555,8 +555,9 @@ static inline int edac_device_get_panic_on_ue(struct edac_device_ctl_inforeturn edac_dev->panic_on_ue; } -void edac_device_handle_ce (struct edac_device_ctl_info *edac_dev, -int inst_nr,int block_nr,const char *msg) +void __edac_device_handle_ce (struct edac_device_ctl_info *edac_dev, +unsigned int count,int inst_nr,int block_nr, +const char *msg) {struct edac_device_instance *instance;struct edac_device_block *block =NULL ;
@@ -582,23 +583,24 @@ void edac_device_handle_ce(struct edac_device_ctl_info *edac_dev,if (instance->nr_blocks >0 ) { block = instance->blocks + block_nr; - block->counters.ce_count++; + block->counters.ce_count += count; }/* Propagate the count up the 'totals' tree */ - instance->counters.ce_count++; - edac_dev->counters.ce_count++; + instance->counters.ce_count += count; + edac_dev->counters.ce_count += count;if (edac_device_get_log_ce (edac_dev))edac_device_printk (edac_dev,KERN_WARNING , -"CE: %s instance: %s block: %s '%s'\n" , - edac_dev->ctl_name, instance->name, - block ? block->name :"N/A" , msg); +"CE: %s instance: %s block: %s count: %d '%s'\n" , + edac_dev->ctl_name, instance->name, + block ? block->name :"N/A" , count, msg); } -EXPORT_SYMBOL_GPL (edac_device_handle_ce); +EXPORT_SYMBOL_GPL (__edac_device_handle_ce); -void edac_device_handle_ue (struct edac_device_ctl_info *edac_dev, -int inst_nr,int block_nr,const char *msg) +void __edac_device_handle_ue (struct edac_device_ctl_info *edac_dev, +unsigned int count,int inst_nr,int block_nr, +const char *msg) {struct edac_device_instance *instance;struct edac_device_block *block =NULL ;
@@ -624,22 +626,36 @@ void edac_device_handle_ue(struct edac_device_ctl_info *edac_dev,if (instance->nr_blocks >0 ) { block = instance->blocks + block_nr; - block->counters.ue_count++; + block->counters.ue_count += count; }/* Propagate the count up the 'totals' tree */ - instance->counters.ue_count++; - edac_dev->counters.ue_count++; + instance->counters.ue_count += count; + edac_dev->counters.ue_count += count;if (edac_device_get_log_ue (edac_dev))edac_device_printk (edac_dev,KERN_EMERG , -"UE: %s instance: %s block: %s '%s'\n" , - edac_dev->ctl_name, instance->name, - block ? block->name :"N/A" , msg); +"UE: %s instance: %s block: %s count: %d '%s'\n" , + edac_dev->ctl_name, instance->name, + block ? block->name :"N/A" , count, msg);if (edac_device_get_panic_on_ue (edac_dev)) -panic ("EDAC %s: UE instance: %s block %s '%s'\n" , - edac_dev->ctl_name, instance->name, - block ? block->name :"N/A" , msg); +panic ("EDAC %s: UE instance: %s block %s count: %d '%s'\n" , + edac_dev->ctl_name, instance->name, + block ? block->name :"N/A" , count, msg); +} +EXPORT_SYMBOL_GPL (__edac_device_handle_ue); + +void edac_device_handle_ce (struct edac_device_ctl_info *edac_dev, +int inst_nr,int block_nr,const char *msg) +{ +__edac_device_handle_ce (edac_dev,1 , inst_nr, block_nr, msg); +} +EXPORT_SYMBOL_GPL (edac_device_handle_ce); + +void edac_device_handle_ue (struct edac_device_ctl_info *edac_dev, +int inst_nr,int block_nr,const char *msg) +{ +__edac_device_handle_ue (edac_dev,1 , inst_nr, block_nr, msg); }EXPORT_SYMBOL_GPL (edac_device_handle_ue);
drivers/edac/edac_device.h +47 -0
59 lines not on this page · raw message
Signature · 1 line
2.17.1
Borislav Petkov
maintainerRe: [PATCH v4 1/2] edac: Add an API for edac device to report for multiple errors
Review
Quoted 6 lines · Hanna Hawa
(quoted diff) +6
-0+void edac_device_handle_ce(struct edac_device_ctl_info *edac_dev, + int inst_nr, int block_nr, const char *msg) +{ + __edac_device_handle_ce(edac_dev, 1, inst_nr, block_nr, msg); +} +EXPORT_SYMBOL_GPL(edac_device_handle_ce);
Eww, I don't like that: exporting the function *and* the __ counterpart. The user will get confused and that is unnecessary.
See below for a better version. This way you solve the whole deal with a single patch.
---
From: Hanna Hawa <[email protected]>
Date: Mon, 23 Sep 2019 20:17:40 +0100
Subject: [PATCH] EDAC/device: Rework error logging API
Make the main workhorse the "count" functions which can log a @count of errors. Have the current APIs edac_device_handle_{ce,ue}() call the _count() variants and this way keep the exported symbols number unchanged.
[ bp: Rewrite. ]
--- drivers/edac/edac_device.c | 44 ++++++++++++++++--------------- drivers/edac/edac_device.h | 54 ++++++++++++++++++++++++++++++-------- 2 files changed, 66 insertions(+), 32 deletions(-)
drivers/edac/edac_device.c +23 -21
@@ -555,8 +555,9 @@ static inline int edac_device_get_panic_on_ue(struct edac_device_ctl_inforeturn edac_dev->panic_on_ue; } -void edac_device_handle_ce (struct edac_device_ctl_info *edac_dev, -int inst_nr,int block_nr,const char *msg) +void edac_device_handle_ce_count (struct edac_device_ctl_info *edac_dev, +unsigned int count,int inst_nr,int block_nr, +const char *msg) {struct edac_device_instance *instance;struct edac_device_block *block =NULL ;
@@ -582,23 +583,24 @@ void edac_device_handle_ce(struct edac_device_ctl_info *edac_dev,if (instance->nr_blocks >0 ) { block = instance->blocks + block_nr; - block->counters.ce_count++; + block->counters.ce_count += count; }/* Propagate the count up the 'totals' tree */ - instance->counters.ce_count++; - edac_dev->counters.ce_count++; + instance->counters.ce_count += count; + edac_dev->counters.ce_count += count;if (edac_device_get_log_ce (edac_dev))edac_device_printk (edac_dev,KERN_WARNING , -"CE: %s instance: %s block: %s '%s'\n" , - edac_dev->ctl_name, instance->name, - block ? block->name :"N/A" , msg); +"CE: %s instance: %s block: %s count: %d '%s'\n" , + edac_dev->ctl_name, instance->name, + block ? block->name :"N/A" , count, msg); } -EXPORT_SYMBOL_GPL (edac_device_handle_ce); +EXPORT_SYMBOL_GPL (edac_device_handle_ce_count); -void edac_device_handle_ue (struct edac_device_ctl_info *edac_dev, -int inst_nr,int block_nr,const char *msg) +void edac_device_handle_ue_count (struct edac_device_ctl_info *edac_dev, +unsigned int count,int inst_nr,int block_nr, +const char *msg) {struct edac_device_instance *instance;struct edac_device_block *block =NULL ;
@@ -624,22 +626,22 @@ void edac_device_handle_ue(struct edac_device_ctl_info *edac_dev,if (instance->nr_blocks >0 ) { block = instance->blocks + block_nr; - block->counters.ue_count++; + block->counters.ue_count += count; }/* Propagate the count up the 'totals' tree */ - instance->counters.ue_count++; - edac_dev->counters.ue_count++; + instance->counters.ue_count += count; + edac_dev->counters.ue_count += count;if (edac_device_get_log_ue (edac_dev))edac_device_printk (edac_dev,KERN_EMERG , -"UE: %s instance: %s block: %s '%s'\n" , - edac_dev->ctl_name, instance->name, - block ? block->name :"N/A" , msg); +"UE: %s instance: %s block: %s count: %d '%s'\n" , + edac_dev->ctl_name, instance->name, + block ? block->name :"N/A" , count, msg);if (edac_device_get_panic_on_ue (edac_dev)) -panic ("EDAC %s: UE instance: %s block %s '%s'\n" , - edac_dev->ctl_name, instance->name, - block ? block->name :"N/A" , msg); +panic ("EDAC %s: UE instance: %s block %s count: %d '%s'\n" , + edac_dev->ctl_name, instance->name, + block ? block->name :"N/A" , count, msg); } -EXPORT_SYMBOL_GPL (edac_device_handle_ue); +EXPORT_SYMBOL_GPL (edac_device_handle_ue_count);
drivers/edac/edac_device.h +43 -11
75 lines not on this page · raw message
Signature · 7 lines
2.21.0
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteRe: [PATCH v4 1/2] edac: Add an API for edac device to report for multiple errors
Quoted 11 lines · Borislav Petkov
----------------------------------------------------------------------
Review
Quoted 6 lines · Hanna Hawa
(quoted diff) +6
-0+void edac_device_handle_ce(struct edac_device_ctl_info *edac_dev, + int inst_nr, int block_nr, const char *msg) +{ + __edac_device_handle_ce(edac_dev, 1, inst_nr, block_nr, msg); +} +EXPORT_SYMBOL_GPL(edac_device_handle_ce);Eww, I don't like that: exporting the function *and* the __ counterpart. The user will get confused and that is unnecessary.
It is *not* the counterpart. The __* version already has the additional count argument in. There are 2 patches:
1) introduce new function __edac_device_handle_ce/ue() including the *_count() inline functions, but keep the old symbols (note the count=1 parameter).
2) remove old symbol edac_device_handle_ce/ue() and replace it with an inline function to use the counterpart symbol too.
The first patch only adds functionality but keeps the abi. Thus it makes a backport easier. The 2nd switches completely to the new function.
-Robert
Borislav Petkov
maintainerRe: [PATCH v4 1/2] edac: Add an API for edac device to report for multiple errors
Quoted 1 line · Robert Richter
It is *not* the counterpart. The __* version already has the...
Lemme cut to the chase:
"Make the main workhorse the "count" functions which can log a @count of errors. Have the current APIs edac_device_handle_{ce,ue}() call the _count() variants and this way keep the exported symbols number unchanged."
I want to see exactly *two* pairs of functions:
edac_device_handle_{ce,ue}_count - logs a @count of errors
edac_device_handle_{ce,ue} - logs a single error
Not three pairs. I.e., the "__" versions are not needed.
Quoted 2 lines
The first patch only adds functionality but keeps the abi. Thus it makes a backport easier.
Works just the same with my version - single backport.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteRe: [PATCH v4 1/2] edac: Add an API for edac device to report for multiple errors
Quoted 16 lines · Borislav Petkov
----------------------------------------------------------------------
Quoted 1 line · Robert Richter
It is *not* the counterpart. The __* version already has the...
Lemme cut to the chase:
"Make the main workhorse the "count" functions which can log a @count of errors. Have the current APIs edac_device_handle_{ce,ue}() call the
_count()variants and this way keep the exported symbols number unchanged."I want to see exactly *two* pairs of functions:
edac_device_handle_{ce,ue}_count - logs a @count of errors
edac_device_handle_{ce,ue} - logs a single error
Quoted 6 lines
Not three pairs. I.e., the "__" versions are not needed.
Quoted 2 lines
The first patch only adds functionality but keeps the abi. Thus it makes a backport easier.
Works just the same with my version - single backport.
If you move to static inline for edac_device_handle_{ce,ue} the symbols vanish and this breaks the abi. That's why the split in two patches.
Your comment to not have a __ version as a third variant of the interface makes sense to me. But to keep ABI your patch still needs to be split. The first patch still must contain symbols for edac_device_handle_{ce,ue}. I am not sure if ABI compatability is something we want to make easier here. I personally like the approach.
-Robert
Borislav Petkov
maintainerRe: [PATCH v4 1/2] edac: Add an API for edac device to report for multiple errors
Quoted 3 lines · Robert Richter
If you move to static inline for edac_device_handle_{ce,ue} the symbols vanish and this breaks the abi. That's why the split in two patches.
ABI issues do not concern upstream. And that coming from me working at a company who dance a lot to make ABI happy.
Also, I'm missing the reasoning why you use the ABI as an argument at
all: do you know of a particular case where people are thinking of backporting this or this is all hypothetical.
Quoted 3 lines
Your comment to not have a __ version as a third variant of the interface makes sense to me. But to keep ABI your patch still needs to be split.
Not really - normally, when you fix ABI issues with symbols disappearing, all of a sudden, you add dummy ones so that the ABI checker is happy.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteRe: [PATCH v4 1/2] edac: Add an API for edac device to report for multiple errors
Quoted 12 lines · Borislav Petkov
Quoted 3 lines · Robert Richter
If you move to static inline for edac_device_handle_{ce,ue} the symbols vanish and this breaks the abi. That's why the split in two patches.
ABI issues do not concern upstream. And that coming from me working at a company who dance a lot to make ABI happy.
Also, I'm missing the reasoning why you use the ABI as an argument at
all: do you know of a particular case where people are thinking of backporting this or this is all hypothetical.
Quoted 7 lines
Quoted 3 lines
Your comment to not have a __ version as a third variant of the interface makes sense to me. But to keep ABI your patch still needs to be split.
Not really - normally, when you fix ABI issues with symbols disappearing, all of a sudden, you add dummy ones so that the ABI checker is happy.
Let's go with a single patch then and the function naming you suggested before.
Thanks,
-Robert
Re: [PATCH v4 1/2] edac: Add an API for edac device to report for multiple errors
In reply to Borislav PetkovQuoted 11 lines · Borislav Petkov
Review
Quoted 6 lines · Hanna Hawa
(quoted diff) +6
-0+void edac_device_handle_ce(struct edac_device_ctl_info *edac_dev, + int inst_nr, int block_nr, const char *msg) +{ + __edac_device_handle_ce(edac_dev, 1, inst_nr, block_nr, msg); +} +EXPORT_SYMBOL_GPL(edac_device_handle_ce);Eww, I don't like that: exporting the function *and* the __ counterpart. The user will get confused and that is unnecessary.
Quoted 2 lines
See below for a better version. This way you solve the whole deal with a single patch.
I'm okay with this version, minor comment below.
Quoted 37 lines
---
From: Hanna Hawa <[email protected]>
Date: Mon, 23 Sep 2019 20:17:40 +0100
Subject: [PATCH] EDAC/device: Rework error logging APIMake the main workhorse the "count" functions which can log a @count of errors. Have the current APIs edac_device_handle_{ce,ue}() call the
_count()variants and this way keep the exported symbols number unchanged.[ bp: Rewrite. ]
Signed-off-by Hanna Hawa <[email protected]>Signed-off-by Borislav Petkov <[email protected]>Cc James Morse <[email protected]>Cc linux-edac <[email protected]>Cc Mauro Carvalho Chehab <[email protected]>Cc Tony Luck <[email protected]>--- drivers/edac/edac_device.c | 44 ++++++++++++++++--------------- drivers/edac/edac_device.h | 54 ++++++++++++++++++++++++++++++-------- 2 files changed, 66 insertions(+), 32 deletions(-)drivers/edac/edac_device.c +0
-0@@ -555,8 +555,9 @@ static inline int edac_device_get_panic_on_ue(struct edac_device_ctl_inforeturn edac_dev->panic_on_ue;
drivers/edac/edac_device.c static inline int edac_device_get_panic_on_ue(struct edac_device_ctl_info · line 563
Quoted 10 lines
drivers/edac/edac_device.c +3
-2} -void edac_device_handle_ce (struct edac_device_ctl_info *edac_dev, -int inst_nr,int block_nr,const char *msg) +void edac_device_handle_ce_count (struct edac_device_ctl_info *edac_dev, +unsigned int count,int inst_nr,int block_nr, +const char *msg) {struct edac_device_instance *instance;struct edac_device_block *block =NULL ;
Missing count check, same in *_ue_count():
if (count)
return;
Quoted 149 lines
drivers/edac/edac_device.c +20
-19@@ -582,23 +583,24 @@ void edac_device_handle_ce(struct edac_device_ctl_info *edac_dev,if (instance->nr_blocks >0 ) { block = instance->blocks + block_nr; - block->counters.ce_count++; + block->counters.ce_count += count; }/* Propagate the count up the 'totals' tree */ - instance->counters.ce_count++; - edac_dev->counters.ce_count++; + instance->counters.ce_count += count; + edac_dev->counters.ce_count += count;if (edac_device_get_log_ce (edac_dev))edac_device_printk (edac_dev,KERN_WARNING , -"CE: %s instance: %s block: %s '%s'\n" , - edac_dev->ctl_name, instance->name, - block ? block->name :"N/A" , msg); +"CE: %s instance: %s block: %s count: %d '%s'\n" , + edac_dev->ctl_name, instance->name, + block ? block->name :"N/A" , count, msg); } -EXPORT_SYMBOL_GPL (edac_device_handle_ce); +EXPORT_SYMBOL_GPL (edac_device_handle_ce_count); -void edac_device_handle_ue (struct edac_device_ctl_info *edac_dev, -int inst_nr,int block_nr,const char *msg) +void edac_device_handle_ue_count (struct edac_device_ctl_info *edac_dev, +unsigned int count,int inst_nr,int block_nr, +const char *msg) {struct edac_device_instance *instance;struct edac_device_block *block =NULL ;@@ -624,22 +626,22 @@ void edac_device_handle_ue(struct edac_device_ctl_info *edac_dev,if (instance->nr_blocks >0 ) { block = instance->blocks + block_nr; - block->counters.ue_count++; + block->counters.ue_count += count; }/* Propagate the count up the 'totals' tree */ - instance->counters.ue_count++; - edac_dev->counters.ue_count++; + instance->counters.ue_count += count; + edac_dev->counters.ue_count += count;if (edac_device_get_log_ue (edac_dev))edac_device_printk (edac_dev,KERN_EMERG , -"UE: %s instance: %s block: %s '%s'\n" , - edac_dev->ctl_name, instance->name, - block ? block->name :"N/A" , msg); +"UE: %s instance: %s block: %s count: %d '%s'\n" , + edac_dev->ctl_name, instance->name, + block ? block->name :"N/A" , count, msg);if (edac_device_get_panic_on_ue (edac_dev)) -panic ("EDAC %s: UE instance: %s block %s '%s'\n" , - edac_dev->ctl_name, instance->name, - block ? block->name :"N/A" , msg); +panic ("EDAC %s: UE instance: %s block %s count: %d '%s'\n" , + edac_dev->ctl_name, instance->name, + block ? block->name :"N/A" , count, msg); } -EXPORT_SYMBOL_GPL (edac_device_handle_ue); +EXPORT_SYMBOL_GPL (edac_device_handle_ue_count);drivers/edac/edac_device.h +43
-11@@ -286,27 +286,60 @@ extern int edac_device_add_device(struct edac_device_ctl_info *edac_dev);extern struct edac_device_ctl_info *edac_device_del_device (struct device *dev);/** -* edac_device_handle_ue(): -* perform a common output and handling of an 'edac_dev' UE event +* Log correctable errors. * * @edac_dev: pointer to struct &edac_device_ctl_info -* @inst_nr: number of the instance where the UE error happened -* @block_nr: number of the block where the UE error happened +* @inst_nr: number of the instance where the CE error happened +* @count: Number of errors to log. +* @block_nr: number of the block where the CE error happened +* @msg: message to be printed +*/ +void edac_device_handle_ce_count (struct edac_device_ctl_info *edac_dev, +unsigned int count,int inst_nr,int block_nr, +const char *msg); + +/** +* Log uncorrectable errors. +* +* @edac_dev: pointer to struct &edac_device_ctl_info +* @inst_nr: number of the instance where the CE error happened +* @count: Number of errors to log. +* @block_nr: number of the block where the CE error happened * @msg: message to be printed */ -extern void edac_device_handle_ue (struct edac_device_ctl_info *edac_dev, -int inst_nr,int block_nr,const char *msg); +void edac_device_handle_ue_count (struct edac_device_ctl_info *edac_dev, +unsigned int count,int inst_nr,int block_nr, +const char *msg); +/** -* edac_device_handle_ce(): -* perform a common output and handling of an 'edac_dev' CE event +* edac_device_handle_ce(): Log a single correctable error * * @edac_dev: pointer to struct &edac_device_ctl_info * @inst_nr: number of the instance where the CE error happened * @block_nr: number of the block where the CE error happened * @msg: message to be printed */ -extern void edac_device_handle_ce (struct edac_device_ctl_info *edac_dev, -int inst_nr,int block_nr,const char *msg); +static inline void +edac_device_handle_ce (struct edac_device_ctl_info *edac_dev,int inst_nr, +int block_nr,const char *msg) +{ +edac_device_handle_ce_count (edac_dev,1 , inst_nr, block_nr, msg); +} + +/** +* edac_device_handle_ue(): Log a single uncorrectable error +* +* @edac_dev: pointer to struct &edac_device_ctl_info +* @inst_nr: number of the instance where the UE error happened +* @block_nr: number of the block where the UE error happened +* @msg: message to be printed +*/ +static inline void +edac_device_handle_ue (struct edac_device_ctl_info *edac_dev,int inst_nr, +int block_nr,const char *msg) +{ +edac_device_handle_ue_count (edac_dev,1 , inst_nr, block_nr, msg); +}/** * edac_device_alloc_index: Allocate a unique device index number @@ -316,5 +349,4 @@ extern void edac_device_handle_ce(struct edac_device_ctl_info *edac_dev,*/ extern int edac_device_alloc_index (void );extern const char *edac_layer_name[]; -#endif
Borislav Petkov
maintainerPATCH 1/1 EDAC/device: Rework error logging API
Quoted 2 lines · Hanna
Missing count check, same in
*_ue_count():
if (count)
I think you meant:
if (!count)
Anyway, fixed:
---
From 0e49a27859b947d2abded91ee3558639bf8ec0bd Mon Sep 17 00:00:00 2001
From: Hanna Hawa <[email protected]>
Date: Mon, 23 Sep 2019 20:17:40 +0100
Subject: [PATCH] EDAC/device: Rework error logging API
Make the main workhorse the "count" functions which can log a @count of errors. Have the current APIs edac_device_handle_{ce,ue}() call the _count() variants and this way keep the exported symbols number unchanged.
[ bp: Rewrite. ]
--- drivers/edac/edac_device.c | 50 ++++++++++++++++++++--------------- drivers/edac/edac_device.h | 54 ++++++++++++++++++++++++++++++-------- 2 files changed, 72 insertions(+), 32 deletions(-)
drivers/edac/edac_device.c +29 -21
@@ -555,12 +555,16 @@ static inline int edac_device_get_panic_on_ue(struct edac_device_ctl_inforeturn edac_dev->panic_on_ue; } -void edac_device_handle_ce (struct edac_device_ctl_info *edac_dev, -int inst_nr,int block_nr,const char *msg) +void edac_device_handle_ce_count (struct edac_device_ctl_info *edac_dev, +unsigned int count,int inst_nr,int block_nr, +const char *msg) {struct edac_device_instance *instance;struct edac_device_block *block =NULL ; +if (!count) +return ; +if ((inst_nr >= edac_dev->nr_instances) || (inst_nr <0 )) {edac_device_printk (edac_dev,KERN_ERR , "INTERNAL ERROR: 'instance' out of range "
@@ -582,27 +586,31 @@ void edac_device_handle_ce(struct edac_device_ctl_info *edac_dev,if (instance->nr_blocks >0 ) { block = instance->blocks + block_nr; - block->counters.ce_count++; + block->counters.ce_count += count; }/* Propagate the count up the 'totals' tree */ - instance->counters.ce_count++; - edac_dev->counters.ce_count++; + instance->counters.ce_count += count; + edac_dev->counters.ce_count += count;if (edac_device_get_log_ce (edac_dev))edac_device_printk (edac_dev,KERN_WARNING , -"CE: %s instance: %s block: %s '%s'\n" , - edac_dev->ctl_name, instance->name, - block ? block->name :"N/A" , msg); +"CE: %s instance: %s block: %s count: %d '%s'\n" , + edac_dev->ctl_name, instance->name, + block ? block->name :"N/A" , count, msg); } -EXPORT_SYMBOL_GPL (edac_device_handle_ce); +EXPORT_SYMBOL_GPL (edac_device_handle_ce_count); -void edac_device_handle_ue (struct edac_device_ctl_info *edac_dev, -int inst_nr,int block_nr,const char *msg) +void edac_device_handle_ue_count (struct edac_device_ctl_info *edac_dev, +unsigned int count,int inst_nr,int block_nr, +const char *msg) {struct edac_device_instance *instance;struct edac_device_block *block =NULL ; +if (!count) +return ; +if ((inst_nr >= edac_dev->nr_instances) || (inst_nr <0 )) {edac_device_printk (edac_dev,KERN_ERR , "INTERNAL ERROR: 'instance' out of range "
@@ -624,22 +632,22 @@ void edac_device_handle_ue(struct edac_device_ctl_info *edac_dev,if (instance->nr_blocks >0 ) { block = instance->blocks + block_nr; - block->counters.ue_count++; + block->counters.ue_count += count; }/* Propagate the count up the 'totals' tree */ - instance->counters.ue_count++; - edac_dev->counters.ue_count++; + instance->counters.ue_count += count; + edac_dev->counters.ue_count += count;if (edac_device_get_log_ue (edac_dev))edac_device_printk (edac_dev,KERN_EMERG , -"UE: %s instance: %s block: %s '%s'\n" , - edac_dev->ctl_name, instance->name, - block ? block->name :"N/A" , msg); +"UE: %s instance: %s block: %s count: %d '%s'\n" , + edac_dev->ctl_name, instance->name, + block ? block->name :"N/A" , count, msg);if (edac_device_get_panic_on_ue (edac_dev)) -panic ("EDAC %s: UE instance: %s block %s '%s'\n" , - edac_dev->ctl_name, instance->name, - block ? block->name :"N/A" , msg); +panic ("EDAC %s: UE instance: %s block %s count: %d '%s'\n" , + edac_dev->ctl_name, instance->name, + block ? block->name :"N/A" , count, msg); } -EXPORT_SYMBOL_GPL (edac_device_handle_ue); +EXPORT_SYMBOL_GPL (edac_device_handle_ue_count);
drivers/edac/edac_device.h +43 -11
75 lines not on this page · raw message
Signature · 8 lines
2.21.0
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquettePATCH v4 2/2 edac: move edac_device_handle_*() API functions to header
In reply to Hanna HawaMove edac_device_handle_*() functions from source file to header file as inline funtcion that use the new API with single error.
--- drivers/edac/edac_device.c | 14 -------------- drivers/edac/edac_device.h | 35 +++++++++++++---------------------- 2 files changed, 13 insertions(+), 36 deletions(-)
drivers/edac/edac_device.c +0 -14
@@ -645,17 +645,3 @@ void __edac_device_handle_ue(struct edac_device_ctl_info *edac_dev, block ? block->name : "N/A", count, msg); }EXPORT_SYMBOL_GPL (__edac_device_handle_ue); - -void edac_device_handle_ce (struct edac_device_ctl_info *edac_dev, -int inst_nr,int block_nr,const char *msg) -{ -__edac_device_handle_ce (edac_dev,1 , inst_nr, block_nr, msg); -} -EXPORT_SYMBOL_GPL (edac_device_handle_ce); - -void edac_device_handle_ue (struct edac_device_ctl_info *edac_dev, -int inst_nr,int block_nr,const char *msg) -{ -__edac_device_handle_ue (edac_dev,1 , inst_nr, block_nr, msg); -} -EXPORT_SYMBOL_GPL (edac_device_handle_ue);
drivers/edac/edac_device.h +13 -22
@@ -312,28 +312,19 @@ void __edac_device_handle_ce(struct edac_device_ctl_info *edac_dev, unsigned int count, int inst_nr, int block_nr, const char *msg); -/** -* edac_device_handle_ue(): -* perform a common output and handling of an 'edac_dev' UE event -* -* @edac_dev: pointer to struct &edac_device_ctl_info -* @inst_nr: number of the instance where the UE error happened -* @block_nr: number of the block where the UE error happened -* @msg: message to be printed -*/ -extern void edac_device_handle_ue (struct edac_device_ctl_info *edac_dev, -int inst_nr,int block_nr,const char *msg); -/** -* edac_device_handle_ce(): -* perform a common output and handling of an 'edac_dev' CE event -* -* @edac_dev: pointer to struct &edac_device_ctl_info -* @inst_nr: number of the instance where the CE error happened -* @block_nr: number of the block where the CE error happened -* @msg: message to be printed -*/ -extern void edac_device_handle_ce (struct edac_device_ctl_info *edac_dev, -int inst_nr,int block_nr,const char *msg); +static inline void edac_device_handle_ce (struct edac_device_ctl_info *edac_dev, +int inst_nr,int block_nr, +const char *msg) +{ +__edac_device_handle_ce (edac_dev,1 , inst_nr, block_nr, msg); +} + +static inline void edac_device_handle_ue (struct edac_device_ctl_info *edac_dev, +int inst_nr,int block_nr, +const char *msg) +{ +__edac_device_handle_ue (edac_dev,1 , inst_nr, block_nr, msg); +} static inline void edac_device_handle_ce_count(struct edac_device_ctl_info *edac_dev, unsigned int count, int inst_nr,
Signature · 1 line
2.17.1
Quoted 8 lines · Hanna Hawa
Add an API for EDAC device to report for multiple errors, and move the old report function to use the new API.
Changes from v3:
----------------
- Move count check to inline function
- Fix count variable describtion (Reported-by: kbuild test robot <[email protected]>)
Looks good to me. If another respin happens, please fix the 80 char limitation for the static inline functions, you could line break after the type definition.
Thanks,
-Robert