ACPI / APEI: Add support to notify the vendor specific HW errors
Subsystems (6)
v6 cover ACPI / APEI: Add support to notify the vendor specific HW errors
Presently the vendor drivers are unable to do the recovery for the vendor specific recoverable HW errors, reported to the APEI driver in the vendor defined sections, because APEI driver does not support reporting the same to the vendor drivers.
This patch set
1. add an interface to the APEI driver to enable the vendor drivers to register the event handling functions for the corresponding vendor specific HW errors and report the error to the vendor driver.
2. add driver to handle HiSilicon hip08 PCIe controller's errors which is an example application of the above APEI interface.
Changes:
V6:
1. Fix few changes in the patch subject line suggested by Bjorn Helgaas.
V5:
1. Fix comments from James Morse.
1.1 Changed the notification method to use the atomic_notifier_chain. 1.2 Add the error handled status for the user space.
V4:
1. Fix for the smatch warning in the PCIe error driver:
warn: should '((((1))) << (9 + i))' be a 64 bit type? if (err->val_bits & BIT(HISI_PCIE_LOCAL_VALID_ERR_MISC + i))
^^^ This should be BIT_ULL() because it goes up to 9 + 32.
V3:
1. Fix the comments from Bjorn Helgaas.
V2:
1. Changes in the HiSilicon PCIe controller's error handling driver for the comments from Bjorn Helgaas.
2. Changes in the APEI interface to support reporting the vendor error for module with multiple devices, but use the same section type. In the error handler will use socket id/sub module id etc to distinguish the device.
V1:
1. Fix comments from James Morse.
2. add driver to handle HiSilicon hip08 PCIe controller's errors, which is an application of the above interface.
Shiju Jose (1):
ACPI / APEI: Add support to notify the vendor specific HW errors
Yicong Yang (1):
PCI: hip: Add handling of HiSilicon HIP PCIe controller errors
drivers/acpi/apei/ghes.c | 35 ++- drivers/pci/controller/Kconfig | 8 + drivers/pci/controller/Makefile | 1 + drivers/pci/controller/pcie-hisi-error.c | 357 +++++++++++++++++++++++ drivers/ras/ras.c | 5 +- include/acpi/ghes.h | 28 ++ include/linux/ras.h | 6 +- include/ras/ras_event.h | 7 +- 8 files changed, 440 insertions(+), 7 deletions(-) create mode 100644 drivers/pci/controller/pcie-hisi-error.c
Signature · 1 line
2.17.1
PATCH v6 1/2 ACPI / APEI: Add support to notify the vendor specific HW errors
Presently APEI does not support reporting the vendor specific HW errors, received in the vendor defined table entries, to the vendor drivers for any recovery.
This patch adds the support to register and unregister the error handling function for the vendor specific HW errors and notify the registered kernel driver.
--- drivers/acpi/apei/ghes.c | 35 ++++++++++++++++++++++++++++++++++- drivers/ras/ras.c | 5 +++-- include/acpi/ghes.h | 28 ++++++++++++++++++++++++++++ include/linux/ras.h | 6 ++++-- include/ras/ras_event.h | 7 +++++-- 5 files changed, 74 insertions(+), 7 deletions(-)
drivers/acpi/apei/ghes.c +34 -1
@@ -490,6 +490,32 @@ static void ghes_handle_aer(struct acpi_hest_generic_data *gdata)#endif } +static ATOMIC_NOTIFIER_HEAD (ghes_event_notify_list); + +/** +* ghes_register_event_notifier - register an event notifier +* for the non-fatal HW errors. +* @nb: pointer to the notifier_block structure of the event handler. +* +* return 0 : SUCCESS, non-zero : FAIL +*/ +int ghes_register_event_notifier (struct notifier_block *nb) +{ +return atomic_notifier_chain_register (&ghes_event_notify_list, nb); +} +EXPORT_SYMBOL_GPL (ghes_register_event_notifier); + +/** +* ghes_unregister_event_notifier - unregister the previously +* registered event notifier. +* @nb: pointer to the notifier_block structure of the event handler. +*/ +void ghes_unregister_event_notifier (struct notifier_block *nb) +{ +atomic_notifier_chain_unregister (&ghes_event_notify_list, nb); +} +EXPORT_SYMBOL_GPL (ghes_unregister_event_notifier); +static void ghes_do_proc (struct ghes *ghes,const struct acpi_hest_generic_status *estatus) {
@@ -526,10 +552,17 @@ static void ghes_do_proc(struct ghes *ghes,log_arm_hw_error (err); }else {void *err =acpi_hest_get_payload (gdata); +u8 error_handled = false; +int ret; + + ret =atomic_notifier_call_chain (&ghes_event_notify_list,0 , gdata); +if (ret &NOTIFY_OK ) + error_handled = true;log_non_standard_event (sec_type, fru_id, fru_text, sec_sev, err, - gdata->error_data_length); + gdata->error_data_length, + error_handled); } } }
drivers/ras/ras.c +3 -2
@@ -16,9 +16,10 @@void log_non_standard_event (const guid_t *sec_type,const guid_t *fru_id,const char *fru_text,const u8 sev,const u8 *err, -const u32 len) +const u32 len,const u8 error_handled) { -trace_non_standard_event (sec_type, fru_id, fru_text, sev, err, len); +trace_non_standard_event (sec_type, fru_id, fru_text, sev, + err, len, error_handled); }void log_arm_hw_error (struct cper_sec_proc_arm *err)
include/acpi/ghes.h +28 -0
@@ -50,6 +50,34 @@ enum { GHES_SEV_PANIC = 0x3, }; + +#ifdef CONFIG_ACPI_APEI_GHES +/** +* ghes_register_event_notifier - register an event notifier +* for the non-fatal HW errors. +* @nb: pointer to the notifier_block structure of the event notifier. +* +* Return : 0 - SUCCESS, non-zero - FAIL. +*/ +int ghes_register_event_notifier (struct notifier_block *nb); + +/** +* ghes_unregister_event_notifier - unregister the previously +* registered event notifier. +* @nb: pointer to the notifier_block structure of the event notifier. +*/ +void ghes_unregister_event_notifier (struct notifier_block *nb); +#else +static inline int ghes_register_event_notifier (struct notifier_block *nb) +{ +return -ENODEV ; +} + +static inline void ghes_unregister_event_notifier (struct notifier_block *nb) +{ +} +#endif +int ghes_estatus_pool_init (int num_ghes);/* From drivers/edac/ghes_edac.c */
include/linux/ras.h +4 -2
@@ -28,13 +28,15 @@ static inline int cec_add_elem(u64 pfn) { return -ENODEV; }#ifdef CONFIG_RAS void log_non_standard_event (const guid_t *sec_type,const guid_t *fru_id,const char *fru_text, -const u8 sev,const u8 *err,const u32 len); +const u8 sev,const u8 *err,const u32 len, +const u8 error_handled);void log_arm_hw_error (struct cper_sec_proc_arm *err);#else static inline void log_non_standard_event (const guid_t *sec_type,const guid_t *fru_id,const char *fru_text, -const u8 sev,const u8 *err,const u32 len) +const u8 sev,const u8 *err,const u32 len, +const u8 error_handled); {return ; }static inline void log_arm_hw_error (struct cper_sec_proc_arm *err) {return ; }
include/ras/ras_event.h +5 -2
@@ -223,9 +223,10 @@ TRACE_EVENT(non_standard_event,const char *fru_text, const u8 sev, const u8 *err, - const u32 len), + const u32 len, + const u8 error_handled), -TP_ARGS (sec_type ,fru_id ,fru_text ,sev ,err ,len ), +TP_ARGS (sec_type ,fru_id ,fru_text ,sev ,err ,len ,error_handled ),TP_STRUCT__entry ( __array(char, sec_type, UUID_SIZE)
@@ -234,6 +235,7 @@ TRACE_EVENT(non_standard_event, __field(u8, sev) __field(u32, len) __dynamic_array(u8, buf, len) +__field (u8, error_handled) ), TP_fast_assign(
@@ -243,6 +245,7 @@ TRACE_EVENT(non_standard_event, __entry->sev = sev; __entry->len = len;memcpy (__get_dynamic_array (buf), err, len); + __entry->error_handled = error_handled; ), TP_printk("severity: %d; sec type:%pU; FRU: %pU %s; data len:%d; raw data:%s",
Signature · 1 line
2.17.1
Borislav Petkov
maintainerQuoted 5 lines · Shiju Jose
Presently APEI does not support reporting the vendor specific HW errors, received in the vendor defined table entries, to the vendor drivers for any recovery.
This patch adds the support to register and unregister the
Avoid having "This patch" or "This commit" in the commit message. It is tautologically useless.
Also, do
$ git grep 'This patch' Documentation/process
for more details.
Quoted 50 lines
error handling function for the vendor specific HW errors and notify the registered kernel driver.
Signed-off-by Shiju Jose <[email protected]>--- drivers/acpi/apei/ghes.c | 35 ++++++++++++++++++++++++++++++++++- drivers/ras/ras.c | 5 +++-- include/acpi/ghes.h | 28 ++++++++++++++++++++++++++++ include/linux/ras.h | 6 ++++-- include/ras/ras_event.h | 7 +++++-- 5 files changed, 74 insertions(+), 7 deletions(-)drivers/acpi/apei/ghes.c +26
-0@@ -490,6 +490,32 @@ static void ghes_handle_aer(struct acpi_hest_generic_data *gdata)#endif } +static ATOMIC_NOTIFIER_HEAD (ghes_event_notify_list); + +/** +* ghes_register_event_notifier - register an event notifier +* for the non-fatal HW errors. +* @nb: pointer to the notifier_block structure of the event handler. +* +* return 0 : SUCCESS, non-zero : FAIL +*/ +int ghes_register_event_notifier (struct notifier_block *nb) +{ +return atomic_notifier_chain_register (&ghes_event_notify_list, nb); +} +EXPORT_SYMBOL_GPL (ghes_register_event_notifier); + +/** +* ghes_unregister_event_notifier - unregister the previously +* registered event notifier. +* @nb: pointer to the notifier_block structure of the event handler. +*/ +void ghes_unregister_event_notifier (struct notifier_block *nb) +{ +atomic_notifier_chain_unregister (&ghes_event_notify_list, nb); +} +EXPORT_SYMBOL_GPL (ghes_unregister_event_notifier); +static void ghes_do_proc (struct ghes *ghes,const struct acpi_hest_generic_status *estatus) {
drivers/acpi/apei/ghes.c static void ghes_do_proc(struct ghes *ghes, · line 558
Quoted 7 lines
drivers/acpi/apei/ghes.c +4
-0@@ -526,10 +552,17 @@ static void ghes_do_proc(struct ghes *ghes,log_arm_hw_error (err); }else {void *err =acpi_hest_get_payload (gdata); +u8 error_handled = false; +int ret; + + ret =atomic_notifier_call_chain (&ghes_event_notify_list,0 , gdata);
Well, this is a notifier with standard name for a non-standard event. Not optimal.
Why does only this event need a notifier? Because your driver is interested in only those events?
drivers/acpi/apei/ghes.c static void ghes_do_proc(struct ghes *ghes, · line 565
Quoted 8 lines
drivers/acpi/apei/ghes.c +4
-1+if (ret &NOTIFY_OK ) + error_handled = true;log_non_standard_event (sec_type, fru_id, fru_text, sec_sev, err, - gdata->error_data_length); + gdata->error_data_length, + error_handled);
What's that error_handled thing for? That's just silly.
Your notifier returns NOTIFY_STOP when it has queued the error. If you don't want to log it, just test == NOTIFY_STOP and do not log it then.
Then your notifier callback is queuing the error into a kfifo for whatever reason and then scheduling a workqueue to handle it in user context...
So I'm thinking that it would be better if you:
* make that kfifo generic and part of ghes.c and queue all types of error records into it in ghes_do_proc() - not just the non-standard ones.
* then, when you're done queuing, you kick a workqueue.
* that workqueue runs a normal, blocking notifier to which drivers register.
Your driver can register to that notifier too and do the normal handling then and not have this ad-hoc, semi-generic, semi-vendor-specific thing.
Thx.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteHi Borislav,
Thanks for reviewing the patches.
Quoted 16 lines
-----Original Message-----
From: [email protected] [mailto:linux-acpi- [email protected]] On Behalf Of Borislav Petkov
Sent: 27 March 2020 18:22
To: Shiju Jose <[email protected]>
Cc: [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Linuxarm <[email protected]>; Jonathan Cameron <[email protected]>; tanxiaofei <[email protected]>; yangyicong <[email protected]>
Subject: Re: [PATCH v6 1/2] ACPI / APEI: Add support to notify the vendor specific HW errorsOn Wed, Mar 25, 2020 at 04:42:22PM +0000, Shiju Jose wrote:
Quoted 9 lines
Quoted 5 lines
Presently APEI does not support reporting the vendor specific HW errors, received in the vendor defined table entries, to the vendor drivers for any recovery.
This patch adds the support to register and unregister the
Avoid having "This patch" or "This commit" in the commit message. It is tautologically useless.
Sure.
Quoted 5 lines
Also, do
$ git grep 'This patch' Documentation/processfor more details.
Sure.
Quoted 56 lines
Quoted 47 lines
error handling function for the vendor specific HW errors and notify the registered kernel driver.
Signed-off-by Shiju Jose <[email protected]>--- drivers/acpi/apei/ghes.c | 35 ++++++++++++++++++++++++++++++++++- drivers/ras/ras.c | 5 +++-- include/acpi/ghes.h | 28 ++++++++++++++++++++++++++++ include/linux/ras.h | 6 ++++-- include/ras/ras_event.h | 7 +++++-- 5 files changed, 74 insertions(+), 7 deletions(-)drivers/acpi/apei/ghes.c index renamed from drivers/acpi/apei/ghes.c +0
-0
24c9642e8fc7..d83f0b1aad0d100644drivers/acpi/apei/ghes.c +23
-0@@ -490,6 +490,32 @@ static void ghes_handle_aer(struct acpi_hest_generic_data *gdata) #endif } +static ATOMIC_NOTIFIER_HEAD (ghes_event_notify_list); + +/** +* ghes_register_event_notifier - register an event notifier +* for the non-fatal HW errors. +* @nb: pointer to the notifier_block structure of the event handler. +* +* return 0 : SUCCESS, non-zero : FAIL */ int +ghes_register_event_notifier (struct notifier_block *nb) { +return atomic_notifier_chain_register (&ghes_event_notify_list, nb); +}EXPORT_SYMBOL_GPL (ghes_register_event_notifier); + +/** +* ghes_unregister_event_notifier - unregister the previously +* registered event notifier. +* @nb: pointer to the notifier_block structure of the event handler. +*/ +void ghes_unregister_event_notifier (struct notifier_block *nb) +{ +atomic_notifier_chain_unregister (&ghes_event_notify_list, nb); +} +EXPORT_SYMBOL_GPL (ghes_unregister_event_notifier); +static void ghes_do_proc (struct ghes *ghes,const struct acpi_hest_generic_status *estatus) {drivers/acpi/apei/ghes.c static void ghes_do_proc(struct ghes *ghes, · line 558
Quoted 7 lines
drivers/acpi/apei/ghes.c +4
-0@@ -526,10 +552,17 @@ static void ghes_do_proc(struct ghes *ghes,log_arm_hw_error (err); }else {void *err =acpi_hest_get_payload (gdata); +u8 error_handled = false; +int ret; + + ret =
atomic_notifier_call_chain(&ghes_event_notify_list, 0, gdata);
Quoted 2 lines
Well, this is a notifier with standard name for a non-standard event. Not optimal.
Ok.
Quoted 3 lines
Why does only this event need a notifier? Because your driver is interested in only those events?
The error events for the PCIe controller can be reported to the kernel in the vendor defined format [as per the"N.2.3 Non-standard Section Body" of the UEFI spec].
Thus these events require a notifier from APEI to the corresponding kernel driver.
Quoted 11 lines
drivers/acpi/apei/ghes.c static void ghes_do_proc(struct ghes *ghes, · line 565
Quoted 9 lines
drivers/acpi/apei/ghes.c +4
-1+if (ret &NOTIFY_OK ) + error_handled = true;log_non_standard_event (sec_type, fru_id, fru_text, sec_sev, err, - gdata->error_data_length); + gdata->error_data_length, + error_handled);What's that
error_handledthing for? That's just silly.
This field added based on the input from James Morse on v4 patch to enable the user space application(rasdaemon) do the decoding and logging of the any extra error information shared by the corresponding kernel driver to the user space.
Quoted 3 lines
Your notifier returns
NOTIFY_STOPwhen it has queued the error. If you don't want to log it, just test ==NOTIFY_STOPand do not log it then.
sure.
Quoted 7 lines
Then your notifier callback is queuing the error into a kfifo for whatever reason and then scheduling a workqueue to handle it in user context...
So I'm thinking that it would be better if you:
Quoted 8 lines
* make that kfifo generic and part of
ghes.cand queue all types of error records into it inghes_do_proc()- not just the non-standard ones.* then, when you're done queuing, you kick a workqueue.
* that workqueue runs a normal, blocking notifier to which drivers register.
Sure. I will test this method and update.
Can you please confirm you want all the existing standard errors(memory, ARM, PCIE) in the ghes_do_proc () to be reported through the blocking notifier?
Quoted 11 lines
Your driver can register to that notifier too and do the normal handling then and not have this ad-hoc, semi-generic, semi-vendor-specific thing.
Thx.
--
Regards/Gruss,
Boris.
Thanks,
Shiju
Borislav Petkov
maintainerQuoted 4 lines · Shiju Jose
This field added based on the input from James Morse on v4 patch to enable the user space application(rasdaemon) do the decoding and logging of the any extra error information shared by the corresponding kernel driver to the user space.
How is your error reporting supposed to work?
Your driver is printing error information in dmesg and, at the same time, you want to report errors with the rasdaemon.
Currently, the kernel does not report any error info if there's a user agent like rasdaemon registered so you need to think about what exactly you're trying to achieve here wrt to error handling. Port resetting, printing error info, etc. Always ask yourself, what can the user do with the information you're printing. And so on...
Quoted 3 lines
Can you please confirm you want all the existing standard
errors(memory, ARM, PCIE)in theghes_do_proc() to be reported through the blocking notifier?
Yes, I would very much prefer to have a generic solution instead of vendor-specific stuff left and right.
Thx.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteHi Boris,
Quoted 22 lines
-----Original Message-----
From: Borislav Petkov [mailto:[email protected]]
Sent: 30 March 2020 11:34
To: Shiju Jose <[email protected]>
Cc: [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Linuxarm <[email protected]>; Jonathan Cameron <[email protected]>; tanxiaofei <[email protected]>; yangyicong <[email protected]>
Subject: Re: [PATCH v6 1/2] ACPI / APEI: Add support to notify the vendor specific HW errorsQuoted 4 lines · Shiju Jose
This field added based on the input from James Morse on v4 patch to enable the user space application(rasdaemon) do the decoding and logging of the any extra error information shared by the corresponding kernel driver to the user space.
How is your error reporting supposed to work?
Quoted 8 lines
Your driver is printing error information in dmesg and, at the same time, you want to report errors with the rasdaemon.
Currently, the kernel does not report any error info if there's a user agent like rasdaemon registered so you need to think about what exactly you're trying to achieve here wrt to error handling. Port resetting, printing error info, etc. Always ask yourself, what can the user do with the information you're printing. And so on...
The error_handled field added on the generic basis for the non-standard errors.
rasdaemon supports adding decoding of the vendor-specific error data, printing and
storing the decoded vendor error information to the sql database.
The idea was the error handled field will help the decoding part of the rasdaemon to do the appropriate steps for logging the vendor error information depending on whether a corresponding kernel driver has handled the error or not.
However I think the same can be achieved by adding an error handling status field to the vendor-specific data, which the kernel driver will set after handling the error and corresponding vendor-specific code in the rasdaemon will use it while logging the vendor error data.
Quoted 7 lines
Quoted 4 lines
Can you please confirm you want all the existing standard
errors(memory, ARM, PCIE)in theghes_do_proc() to be reported through the blocking notifier?Yes, I would very much prefer to have a generic solution instead of vendor- specific stuff left and right.
Sure.
Quoted 8 lines
Thx.
--
Regards/Gruss,
Boris.
Thanks,
Shiju
Borislav Petkov
maintainerQuoted 4 lines · Shiju Jose
The idea was the error handled field will help the decoding part of the rasdaemon to do the appropriate steps for logging the vendor error information depending on whether a corresponding kernel driver has handled the error or not.
What's the difference for rasdaemon whether the error has been handled or not?
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteHi Boris,
Quoted 14 lines
-----Original Message-----
From: Borislav Petkov [mailto:[email protected]]
Sent: 30 March 2020 14:43
To: Shiju Jose <[email protected]>
Cc: [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Linuxarm <[email protected]>; Jonathan Cameron <[email protected]>; tanxiaofei <[email protected]>; yangyicong <[email protected]>
Subject: Re: [PATCH v6 1/2] ACPI / APEI: Add support to notify the vendor specific HW errors
Quoted 8 lines
Quoted 4 lines · Shiju Jose
The idea was the error handled field will help the decoding part of the rasdaemon to do the appropriate steps for logging the vendor error information depending on whether a corresponding kernel driver has handled the error or not.
What's the difference for rasdaemon whether the error has been handled or not?
Following are some of the examples of the usage of error handled status
in the vendor specific code of the rasdaemon,
1. rasdaemon need not to print the vendor error data reported by the firmware if the
kernel driver already print those information. In this case rasdaemon will only need to store the decoded vendor error data to the SQL database.
2. If the vendor kernel driver want to report extra error information through
the vendor specific data (though presently we do not have any such use case) for the rasdamon to log. I think the error handled status useful to indicate that the kernel driver has filled the extra information and rasdaemon to decode and log them after extra data specific validity check.
Quoted 6 lines
--
Regards/Gruss,
Boris.
Thanks,
Shiju
Borislav Petkov
maintainerQuoted 3 lines · Shiju Jose
1. rasdaemon need not to print the vendor error data reported by the firmware if the kernel driver already print those information. In this case rasdaemon will only need to store the decoded vendor error data to the SQL database.
Well, there's a problem with this:
rasdaemon printing != kernel driver printing
Because printing in dmesg would need people to go grep dmesg.
Printing through rasdaemon or any userspace agent, OTOH, is a lot more flexible wrt analyzing and collecting those error records. Especially if you are a data center admin and you want to collect all your error
records: grepping dmesg simply doesn't scale versus all the rasdaemon agents reporting to a centrallized location.
Quoted 4 lines
2. If the vendor kernel driver want to report extra error information through
the vendor specific data (though presently we do not have any such use case) for the rasdamon to log. I think the error handled status useful to indicate that the kernel driver has filled the extra information and rasdaemon to decode and log them after extra data specific validity check.
The kernel driver can report that extra information without the kernel saying that the error was handled.
So I still see no sense for the kernel to tell userspace explicitly that it handled the error. There might be a valid reason, though, of which I cannot think of right now.
Thx.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteHi Boris,
Quoted 25 lines
-----Original Message-----
From: Borislav Petkov [mailto:[email protected]]
Sent: 31 March 2020 10:09
To: Shiju Jose <[email protected]>
Cc: [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Linuxarm <[email protected]>; Jonathan Cameron <[email protected]>; tanxiaofei <[email protected]>; yangyicong <[email protected]>
Subject: Re: [PATCH v6 1/2] ACPI / APEI: Add support to notify the vendor specific HW errorsQuoted 1 line · Shiju Jose
1. rasdaemon need not to print the vendor error data reported by the
firmware if the
Quoted 1 line
kernel driver already print those information. In this case rasdaemon will
only need to store
Quoted 1 line
the decoded vendor error data to the SQL database.
Well, there's a problem with this:
rasdaemon printing != kernel driver printing
Quoted 7 lines
Because printing in dmesg would need people to go grep dmesg.
Printing through rasdaemon or any userspace agent, OTOH, is a lot more flexible wrt analyzing and collecting those error records. Especially if you are a data center admin and you want to collect all your error
records: grepping dmesg simply doesn't scale versus all the rasdaemon agents reporting to a centrallized location.
Ok.
I posted V7 of this series.
"[v7 PATCH 0/6] ACPI / APEI: Add support to notify non-fatal HW errors"
Quoted 8 lines
Quoted 2 lines
2. If the vendor kernel driver want to report extra error information
through
Quoted 1 line
the vendor specific data (though presently we do not have any such use
case) for the rasdamon to log.
Quoted 1 line
I think the error handled status useful to indicate that the kernel driver
has filled the extra information and
Quoted 1 line
rasdaemon to decode and log them after extra data specific validity
Quoted 8 lines
check.
The kernel driver can report that extra information without the kernel saying that the error was handled.
So I still see no sense for the kernel to tell userspace explicitly that it handled the error. There might be a valid reason, though, of which I cannot think of right now.
Ok.
Quoted 8 lines
Thx.
--
Regards/Gruss,
Boris.
Thanks,
Shiju
Hi Boris, Shiju,
Sorry for not spotting this reply earlier: Its in-reply to v1, so gets buried.
Quoted 31 lines · Borislav Petkov
Quoted 5 lines · Shiju Jose
Presently APEI does not support reporting the vendor specific HW errors, received in the vendor defined table entries, to the vendor drivers for any recovery.
This patch adds the support to register and unregister the
Avoid having "This patch" or "This commit" in the commit message. It is tautologically useless.
Also, do
$ git grep 'This patch' Documentation/processfor more details.
drivers/acpi/apei/ghes.c static void ghes_do_proc(struct ghes *ghes, · line 558
Quoted 11 lines
error handling function for the vendor specific HW errors and notify the registered kernel driver.
drivers/acpi/apei/ghes.c +4
-0@@ -526,10 +552,17 @@ static void ghes_do_proc(struct ghes *ghes,log_arm_hw_error (err); }else {void *err =acpi_hest_get_payload (gdata); +u8 error_handled = false; +int ret; + + ret =atomic_notifier_call_chain (&ghes_event_notify_list,0 , gdata);Well, this is a notifier with standard name for a non-standard event. Not optimal.
Quoted 2 lines
Why does only this event need a notifier? Because your driver is interested in only those events?
Its the 'else' catch-all for stuff drivers/acpi/apei doesn't know to handle.
In this case its because its a vendor specific GUID that only the vendor driver knows how to parse.
Quoted 11 lines
drivers/acpi/apei/ghes.c static void ghes_do_proc(struct ghes *ghes, · line 565
Quoted 8 lines
drivers/acpi/apei/ghes.c +4
-1+if (ret &NOTIFY_OK ) + error_handled = true;log_non_standard_event (sec_type, fru_id, fru_text, sec_sev, err, - gdata->error_data_length); + gdata->error_data_length, + error_handled);What's that
error_handledthing for? That's just silly.
Quoted 2 lines
Your notifier returns
NOTIFY_STOPwhen it has queued the error. If you don't want to log it, just test ==NOTIFY_STOPand do not log it then.
My thinking for this being needed was so user-space consumers of those tracepoints keep working. Otherwise you upgrade, get this feature, and your user-space counters stop working.
You'd need to know this error source was now managed by an in-kernel driver, which may report the errors somewhere else...
Quoted 9 lines
Then your notifier callback is queuing the error into a kfifo for whatever reason and then scheduling a workqueue to handle it in user context...
So I'm thinking that it would be better if you:
* make that kfifo generic and part of
ghes.cand queue all types of error records into it inghes_do_proc()- not just the non-standard ones.
Move the drop to process context into ghes.c? This should result in less code.
I asked for this hooking to only be for the 'catch all' don't-know case so that we don't get drivers trying to hook and handle memory errors. (if we ever wanted that, it should be from part of memory_failure() so it catches all the ways of reporting memory-failure) 32bit arm has prior in this area.
Quoted 7 lines
* then, when you're done queuing, you kick a workqueue.
* that workqueue runs a normal, blocking notifier to which drivers register.
Your driver can register to that notifier too and do the normal handling then and not have this ad-hoc, semi-generic, semi-vendor-specific thing.
As long as we don't walk a list of things that might handle a memory-error, and have some random driver try and NOTIFY_STOP it....
aer_recover_queue() would be replaced by this. memory_failure_queue() has one additional caller in drivers/ras/cec.c.
Thanks,
James
Hi James,
Quoted 15 lines
-----Original Message-----
From: [email protected] [mailto:linux-pci- [email protected]] On Behalf Of James Morse
Sent: 08 April 2020 11:03
To: Borislav Petkov <[email protected]>; Shiju Jose <[email protected]>
Cc: [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Linuxarm <[email protected]>; Jonathan Cameron <[email protected]>; tanxiaofei <[email protected]>; yangyicong <[email protected]>
Subject: Re: [PATCH v6 1/2] ACPI / APEI: Add support to notify the vendor specific HW errors
Quoted 3 lines
Hi Boris, Shiju,
Sorry for not spotting this reply earlier: Its in-reply to v1, so gets buried.
I will resend the v7 patch solving this issue.
I guess the remaining questions here are for Boris. May be can we discuss your comments with V7 patch, which I will send?
Quoted 96 lines · Borislav Petkov
Quoted 19 lines · Shiju Jose
Quoted 5 lines
Presently APEI does not support reporting the vendor specific HW errors, received in the vendor defined table entries, to the vendor drivers for any recovery.
This patch adds the support to register and unregister the
Avoid having "This patch" or "This commit" in the commit message. It is tautologically useless.
Also, do
$ git grep 'This patch' Documentation/processfor more details.
Quoted 2 lines
error handling function for the vendor specific HW errors and notify the registered kernel driver.
Quoted 8 lines
drivers/acpi/apei/ghes.c static void ghes_do_proc(struct ghes *ghes, · line 558
Quoted 8 lines
drivers/acpi/apei/ghes.c +4
-0@@ -526,10 +552,17 @@ static void ghes_do_proc(struct ghes *ghes,log_arm_hw_error (err); }else {void *err =acpi_hest_get_payload (gdata); +u8 error_handled = false; +int ret; + + ret =atomic_notifier_call_chain(&ghes_event_notify_list, 0,
Quoted 7 lines
Review static void ghes_do_proc(struct ghes *ghes, · line 559
Quoted 1 line
(quoted diff) +1
-0+gdata);Well, this is a notifier with standard name for a non-standard event. Not optimal.
Why does only this event need a notifier? Because your driver is interested in only those events?
Its the 'else' catch-all for stuff
drivers/acpi/apeidoesn't know to handle.In this case its because its a vendor specific GUID that only the vendor driver knows how to parse.
Quoted 11 lines
drivers/acpi/apei/ghes.c static void ghes_do_proc(struct ghes *ghes, · line 565
Quoted 8 lines
drivers/acpi/apei/ghes.c +4
-1+if (ret &NOTIFY_OK ) + error_handled = true;log_non_standard_event (sec_type, fru_id, fru_text, sec_sev, err, - gdata->error_data_length); + gdata->error_data_length, + error_handled);What's that
error_handledthing for? That's just silly.Quoted 2 lines
Your notifier returns
NOTIFY_STOPwhen it has queued the error. If you don't want to log it, just test ==NOTIFY_STOPand do not log it then.My thinking for this being needed was so user-space consumers of those tracepoints keep working. Otherwise you upgrade, get this feature, and your user-space counters stop working.
You'd need to know this error source was now managed by an in-kernel driver, which may report the errors somewhere else...
Quoted 9 lines
Then your notifier callback is queuing the error into a kfifo for whatever reason and then scheduling a workqueue to handle it in user context...
So I'm thinking that it would be better if you:
* make that kfifo generic and part of
ghes.cand queue all types of error records into it inghes_do_proc()- not just the non-standard ones.Move the drop to process context into
ghes.c? This should result in less code.I asked for this hooking to only be for the 'catch all' don't-know case so that we don't get drivers trying to hook and handle memory errors. (if we ever wanted that, it should be from part of
memory_failure()so it catches all the ways of reporting memory-failure) 32bit arm has prior in this area.Quoted 7 lines
* then, when you're done queuing, you kick a workqueue.
* that workqueue runs a normal, blocking notifier to which drivers register.
Your driver can register to that notifier too and do the normal handling then and not have this ad-hoc, semi-generic, semi-vendor-specific
thing.
As long as we don't walk a list of things that might handle a memory-error, and have some random driver try and
NOTIFY_STOPit....
Quoted 7 lines
aer_recover_queue()would be replaced by this.memory_failure_queue()has one additional caller indrivers/ras/cec.c.Thanks,
James
Thanks,
Shiju
Hi Boris, Hi James,
Quoted 109 lines
-----Original Message-----
From: [email protected] [mailto:linux-pci- [email protected]] On Behalf Of James Morse
Sent: 08 April 2020 11:03
To: Borislav Petkov <[email protected]>; Shiju Jose <[email protected]>
Cc: [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Linuxarm <[email protected]>; Jonathan Cameron <[email protected]>; tanxiaofei <[email protected]>; yangyicong <[email protected]>
Subject: Re: [PATCH v6 1/2] ACPI / APEI: Add support to notify the vendor specific HW errorsHi Boris, Shiju,
Sorry for not spotting this reply earlier: Its in-reply to v1, so gets buried.
Quoted 19 lines · Borislav Petkov
Quoted 5 lines · Shiju Jose
Presently APEI does not support reporting the vendor specific HW errors, received in the vendor defined table entries, to the vendor drivers for any recovery.
This patch adds the support to register and unregister the
Avoid having "This patch" or "This commit" in the commit message. It is tautologically useless.
Also, do
$ git grep 'This patch' Documentation/processfor more details.
Quoted 2 lines
error handling function for the vendor specific HW errors and notify the registered kernel driver.
Quoted 8 lines
drivers/acpi/apei/ghes.c static void ghes_do_proc(struct ghes *ghes, · line 558
Quoted 8 lines
drivers/acpi/apei/ghes.c +4
-0@@ -526,10 +552,17 @@ static void ghes_do_proc(struct ghes *ghes,log_arm_hw_error (err); }else {void *err =acpi_hest_get_payload (gdata); +u8 error_handled = false; +int ret; + + ret =atomic_notifier_call_chain(&ghes_event_notify_list, 0,
Quoted 7 lines
Review static void ghes_do_proc(struct ghes *ghes, · line 559
Quoted 1 line
(quoted diff) +1
-0+gdata);Well, this is a notifier with standard name for a non-standard event. Not optimal.
Why does only this event need a notifier? Because your driver is interested in only those events?
Its the 'else' catch-all for stuff
drivers/acpi/apeidoesn't know to handle.In this case its because its a vendor specific GUID that only the vendor driver knows how to parse.
Quoted 11 lines
drivers/acpi/apei/ghes.c static void ghes_do_proc(struct ghes *ghes, · line 565
Quoted 8 lines
drivers/acpi/apei/ghes.c +4
-1+if (ret &NOTIFY_OK ) + error_handled = true;log_non_standard_event (sec_type, fru_id, fru_text, sec_sev, err, - gdata->error_data_length); + gdata->error_data_length, + error_handled);What's that
error_handledthing for? That's just silly.Quoted 2 lines
Your notifier returns
NOTIFY_STOPwhen it has queued the error. If you don't want to log it, just test ==NOTIFY_STOPand do not log it then.My thinking for this being needed was so user-space consumers of those tracepoints keep working. Otherwise you upgrade, get this feature, and your user-space counters stop working.
You'd need to know this error source was now managed by an in-kernel driver, which may report the errors somewhere else...
Quoted 9 lines
Then your notifier callback is queuing the error into a kfifo for whatever reason and then scheduling a workqueue to handle it in user context...
So I'm thinking that it would be better if you:
* make that kfifo generic and part of
ghes.cand queue all types of error records into it inghes_do_proc()- not just the non-standard ones.Move the drop to process context into
ghes.c? This should result in less code.I asked for this hooking to only be for the 'catch all' don't-know case so that we don't get drivers trying to hook and handle memory errors. (if we ever wanted that, it should be from part of
memory_failure()so it catches all the ways of reporting memory-failure) 32bit arm has prior in this area.Quoted 7 lines
* then, when you're done queuing, you kick a workqueue.
* that workqueue runs a normal, blocking notifier to which drivers register.
Your driver can register to that notifier too and do the normal handling then and not have this ad-hoc, semi-generic, semi-vendor-specific
Quoted 7 lines
thing.
As long as we don't walk a list of things that might handle a memory-error, and have some random driver try and
NOTIFY_STOPit....
aer_recover_queue()would be replaced by this.memory_failure_queue()has one additional caller indrivers/ras/cec.c.
Can you suggest whether the standard errors can report through the notifier (kfifo + blocking notifier), [which implemented in V7 patch], or not so that we can proceed with the changes to notify the vendor specific errors?
Quoted 5 lines
Thanks,
James
Thanks,
Shiju
PATCH v6 2/2 PCI: hip: Add handling of HiSilicon HIP PCIe controller errors
In reply to Shiju JoseFrom: Yicong Yang <[email protected]>
The HiSilicon HIP PCIe controller is capable of handling errors on root port and perform port reset separately at each root port.
This patch add error handling driver for HIP PCIe controller to log and report recoverable errors. Perform root port reset and restore link status after the recovery.
Following are some of the PCIe controller's recoverable errors
1. completion transmission timeout error.
2. CRS retry counter over the threshold error.
3. ECC 2 bit errors
4. AXI bresponse/rresponse errors etc.
Also fix the following Smatch warning:
warn: should '((((1))) << (9 + i))' be a 64 bit type? if (err->val_bits & BIT(HISI_PCIE_LOCAL_VALID_ERR_MISC + i))
^^^ This should be BIT_ULL() because it goes up to 9 + 32.
--
drivers/pci/controller/Kconfig | 8 + drivers/pci/controller/Makefile | 1 + drivers/pci/controller/pcie-hisi-error.c | 336 +++++++++++++++++++++++++++++++ 3 files changed, 345 insertions(+) create mode 100644 drivers/pci/controller/pcie-hisi-error.c --- drivers/pci/controller/Kconfig | 8 + drivers/pci/controller/Makefile | 1 + drivers/pci/controller/pcie-hisi-error.c | 357 +++++++++++++++++++++++ 3 files changed, 366 insertions(+) create mode 100644 drivers/pci/controller/pcie-hisi-error.c
drivers/pci/controller/Kconfig +8 -0
@@ -268,6 +268,14 @@ config PCI_HYPERV_INTERFACE The Hyper-V PCI Interface is a helper driver allows other drivers to have a common interface with the Hyper-V PCI frontend driver. +config PCIE_HISI_ERR + depends on ARM64 || COMPILE_TEST + depends on ACPI + bool "HiSilicon HIP PCIe controller error handling driver" + help + Say Y here if you want error handling support + for the PCIe controller's errors on HiSilicon HIP SoCs + source "drivers/pci/controller/dwc/Kconfig" source "drivers/pci/controller/cadence/Kconfig" endmenu
drivers/pci/controller/Makefile +1 -0
@@ -29,6 +29,7 @@ obj-$(CONFIG_PCIE_MOBIVEIL) += pcie-mobiveil.o obj-$(CONFIG_PCIE_TANGO_SMP8759) += pcie-tango.o obj-$(CONFIG_VMD) += vmd.o obj-$(CONFIG_PCIE_BRCMSTB) += pcie-brcmstb.o +obj-$(CONFIG_PCIE_HISI_ERR) += pcie-hisi-error.o # pcie-hisi.o quirks are needed even without CONFIG_PCIE_DW obj-y += dwc/
drivers/pci/controller/pcie-hisi-error.c new file +357 -0
357 lines not on this page · raw message
Signature · 1 line
2.17.1
Quoted 10 lines · Shiju Jose
Presently the vendor drivers are unable to do the recovery for the vendor specific recoverable HW errors, reported to the APEI driver in the vendor defined sections, because APEI driver does not support reporting the same to the vendor drivers.
This patch set
1. add an interface to the APEI driver to enable the vendor drivers to register the event handling functions for the corresponding vendor specific HW errors and report the error to the vendor driver.
Quoted 7 lines
2. add driver to handle HiSilicon hip08 PCIe controller's errors which is an example application of the above APEI interface.
Changes:
V6:
1. Fix few changes in the patch subject line suggested by Bjorn Helgaas.
I think it will save everybody a little work if you can wait a day or two so you can address more comments at once. You posted v6 only about three hours after v5, which isn't enough time for people to respond to v5.
I'm not going to even look at v6 because it doesn't address some of my v5 comments. Please wait a few days before v7 to see if Rafael has any thoughts on where the error driver should live.
Bjorn