From: Oliver O'Halloran <oohall@gmail.com> Date: 2019-02-15 00:59:11
There's no need to the custom getter/setter functions so we should remove
them in favour of using the generic one. While we're here, change the type
of eeh_max_freeze to u32 and print the value in decimal rather than
hex because printing it in hex makes no sense.
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
v2: Replaced uint32_t with u32.
---
arch/powerpc/include/asm/eeh.h | 2 +-
arch/powerpc/kernel/eeh.c | 21 +++------------------
2 files changed, 4 insertions(+), 19 deletions(-)
From: Oliver O'Halloran <oohall@gmail.com> Date: 2019-02-15 01:01:18
The EEH address cache is used to map a physical MMIO address back to a PCI
device. It's useful to know when it's being manipulated, but currently this
requires recompiling with #define DEBUG set. This is pointless since we
have dynamic_debug nowdays, so remove the #ifdef guard and add a pr_debug()
for the remove case too.
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
arch/powerpc/kernel/eeh_cache.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
From: Oliver O'Halloran <oohall@gmail.com> Date: 2019-02-15 01:03:02
Adds a debugfs file that can be read to view the contents of the EEH
address cache. This is pretty similar to the existing
eeh_addr_cache_print() function, but that function is intended to debug
issues inside of the kernel since it's #ifdef`ed out by default, and writes
into the kernel log.
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
v2: Added missing #endif
Replaced while loop with a for
---
arch/powerpc/include/asm/eeh.h | 3 +++
arch/powerpc/kernel/eeh.c | 1 +
arch/powerpc/kernel/eeh_cache.c | 30 ++++++++++++++++++++++++++----
3 files changed, 30 insertions(+), 4 deletions(-)
@@ -298,9 +299,30 @@ void eeh_addr_cache_build(void)eeh_addr_cache_insert_dev(dev);eeh_sysfs_add_device(dev);}+}-#ifdef DEBUG-/* Verify tree built up above, echo back the list of addrs. */-eeh_addr_cache_print(&pci_io_addr_cache_root);-#endif+staticinteeh_addr_cache_show(structseq_file*s,void*v)+{+structpci_io_addr_range*piar;+structrb_node*n;++spin_lock(&pci_io_addr_cache_root.piar_lock);+for(n=rb_first(&pci_io_addr_cache_root.rb_root);n;n=rb_next(n)){+piar=rb_entry(n,structpci_io_addr_range,rb_node);++seq_printf(s,"%s addr range [%pap-%pap]: %s\n",+(piar->flags&IORESOURCE_IO)?"i/o":"mem",+&piar->addr_lo,&piar->addr_hi,pci_name(piar->pcidev));+}+spin_unlock(&pci_io_addr_cache_root.piar_lock);++return0;+}+DEFINE_SHOW_ATTRIBUTE(eeh_addr_cache);++voideeh_cache_debugfs_init(void)+{+debugfs_create_file_unsafe("eeh_address_cache",0400,+powerpc_debugfs_root,NULL,+&eeh_addr_cache_fops);}
From: Oliver O'Halloran <oohall@gmail.com> Date: 2019-02-15 01:04:27
To use this function at all #define DEBUG needs to be set in eeh_cache.c.
Considering that printing at pr_debug is probably not all that useful since
it adds the additional hurdle of requiring you to enable the debug print if
dynamic_debug is in use so this patch bumps it to pr_info.
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
arch/powerpc/kernel/eeh_cache.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Oliver O'Halloran <oohall@gmail.com> Date: 2019-02-15 01:05:58
Add a helper to find the pci_controller structure based on the domain
number / phb id.
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
v2: Renamed pci_find_hose_for_domain() to
pci_find_controller_for_domain()
---
arch/powerpc/include/asm/pci-bridge.h | 2 ++
arch/powerpc/kernel/pci-common.c | 11 +++++++++++
2 files changed, 13 insertions(+)
@@ -274,6 +274,8 @@ extern int pcibios_map_io_space(struct pci_bus *bus);externstructpci_controller*pci_find_hose_for_OF_device(structdevice_node*node);+externstructpci_controller*pci_find_controller_for_domain(intdomain_nr);+/* Fill up host controller resources from the OF node */externvoidpci_process_bridge_OF_ranges(structpci_controller*hose,structdevice_node*dev,intprimary);
From: Oliver O'Halloran <oohall@gmail.com> Date: 2019-02-15 01:07:39
Currently when we detect an error we automatically invoke the EEH recovery
handler. This can be annoying when debugging EEH problems, or when working
on EEH itself so this patch adds a debugfs knob that will prevent a
recovery event from being queued up when an issue is detected.
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
arch/powerpc/include/asm/eeh.h | 1 +
arch/powerpc/kernel/eeh.c | 10 ++++++++++
arch/powerpc/kernel/eeh_event.c | 9 +++++++++
3 files changed, 20 insertions(+)
@@ -126,6 +126,15 @@ int eeh_send_failure_event(struct eeh_pe *pe)unsignedlongflags;structeeh_event*event;+/*+*Ifwe'vemanuallysupressedrecoveryeventsviadebugfs+*thenjustdropitonthefloor.+*/+if(eeh_debugfs_no_recover){+pr_err("EEH: Event dropped due to no_recover setting\n");+return0;+}+event=kzalloc(sizeof(*event),GFP_ATOMIC);if(!event){pr_err("EEH: out of memory, event not handled\n");
From: Oliver O'Halloran <oohall@gmail.com> Date: 2019-02-15 01:09:10
This patch adds a debugfs interface to force scheduling a recovery event.
This can be used to recover a specific PE or schedule a "special" recovery
even that checks for errors at the PHB level.
To force a recovery of a normal PE, use:
echo '<#pe>:<#phb>' > /sys/kernel/debug/powerpc/eeh_force_recover
To force a scan for broken PHBs:
echo 'hwcheck' > /sys/kernel/debug/powerpc/eeh_force_recover
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
v2: Rename from pci_find_hose_for_domain() to
pci_find_controller_for_domain()
Use the more descriptive "hwcheck" to send a special event
rather than "null"
---
arch/powerpc/include/asm/eeh_event.h | 1 +
arch/powerpc/kernel/eeh.c | 59 ++++++++++++++++++++++++++++
arch/powerpc/kernel/eeh_event.c | 25 +++++++-----
3 files changed, 75 insertions(+), 10 deletions(-)
@@ -121,20 +121,11 @@ int eeh_event_init(void)*theactualeventwillbedeliveredinanormalcontext*(fromaworkqueue).*/-inteeh_send_failure_event(structeeh_pe*pe)+int__eeh_send_failure_event(structeeh_pe*pe){unsignedlongflags;structeeh_event*event;-/*-*Ifwe'vemanuallysupressedrecoveryeventsviadebugfs-*thenjustdropitonthefloor.-*/-if(eeh_debugfs_no_recover){-pr_err("EEH: Event dropped due to no_recover setting\n");-return0;-}-event=kzalloc(sizeof(*event),GFP_ATOMIC);if(!event){pr_err("EEH: out of memory, event not handled\n");
@@ -153,6 +144,20 @@ int eeh_send_failure_event(struct eeh_pe *pe)return0;}+inteeh_send_failure_event(structeeh_pe*pe)+{+/*+*Ifwe'vemanuallysupressedrecoveryeventsviadebugfs+*thenjustdropitonthefloor.+*/+if(eeh_debugfs_no_recover){+pr_err("EEH: Event dropped due to no_recover setting\n");+return0;+}++return__eeh_send_failure_event(pe);+}+/***eeh_remove_event-RemoveEEHeventfromthequeue*@pe:EventbindingtothePE
From: Sam Bobroff <hidden> Date: 2019-02-15 05:12:20
On Fri, Feb 15, 2019 at 11:48:11AM +1100, Oliver O'Halloran wrote:
There's no need to the custom getter/setter functions so we should remove
them in favour of using the generic one. While we're here, change the type
of eeh_max_freeze to u32 and print the value in decimal rather than
hex because printing it in hex makes no sense.
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
From: Sam Bobroff <hidden> Date: 2019-02-15 05:14:01
On Fri, Feb 15, 2019 at 11:48:12AM +1100, Oliver O'Halloran wrote:
The EEH address cache is used to map a physical MMIO address back to a PCI
device. It's useful to know when it's being manipulated, but currently this
requires recompiling with #define DEBUG set. This is pointless since we
have dynamic_debug nowdays, so remove the #ifdef guard and add a pr_debug()
for the remove case too.
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
From: Sam Bobroff <hidden> Date: 2019-02-15 05:15:53
On Fri, Feb 15, 2019 at 11:48:13AM +1100, Oliver O'Halloran wrote:
Adds a debugfs file that can be read to view the contents of the EEH
address cache. This is pretty similar to the existing
eeh_addr_cache_print() function, but that function is intended to debug
issues inside of the kernel since it's #ifdef`ed out by default, and writes
into the kernel log.
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Reviewed-by: Sam Bobroff <redacted>
quoted hunk
---
v2: Added missing #endif
Replaced while loop with a for
---
arch/powerpc/include/asm/eeh.h | 3 +++
arch/powerpc/kernel/eeh.c | 1 +
arch/powerpc/kernel/eeh_cache.c | 30 ++++++++++++++++++++++++++----
3 files changed, 30 insertions(+), 4 deletions(-)
@@ -298,9 +299,30 @@ void eeh_addr_cache_build(void)eeh_addr_cache_insert_dev(dev);eeh_sysfs_add_device(dev);}+}-#ifdef DEBUG-/* Verify tree built up above, echo back the list of addrs. */-eeh_addr_cache_print(&pci_io_addr_cache_root);-#endif+staticinteeh_addr_cache_show(structseq_file*s,void*v)+{+structpci_io_addr_range*piar;+structrb_node*n;++spin_lock(&pci_io_addr_cache_root.piar_lock);+for(n=rb_first(&pci_io_addr_cache_root.rb_root);n;n=rb_next(n)){+piar=rb_entry(n,structpci_io_addr_range,rb_node);++seq_printf(s,"%s addr range [%pap-%pap]: %s\n",+(piar->flags&IORESOURCE_IO)?"i/o":"mem",+&piar->addr_lo,&piar->addr_hi,pci_name(piar->pcidev));+}+spin_unlock(&pci_io_addr_cache_root.piar_lock);++return0;+}+DEFINE_SHOW_ATTRIBUTE(eeh_addr_cache);++voideeh_cache_debugfs_init(void)+{+debugfs_create_file_unsafe("eeh_address_cache",0400,+powerpc_debugfs_root,NULL,+&eeh_addr_cache_fops);}
From: Sam Bobroff <hidden> Date: 2019-02-15 05:17:24
On Fri, Feb 15, 2019 at 11:48:14AM +1100, Oliver O'Halloran wrote:
To use this function at all #define DEBUG needs to be set in eeh_cache.c.
Considering that printing at pr_debug is probably not all that useful since
it adds the additional hurdle of requiring you to enable the debug print if
dynamic_debug is in use so this patch bumps it to pr_info.
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
@@ -274,6 +274,8 @@ extern int pcibios_map_io_space(struct pci_bus *bus);externstructpci_controller*pci_find_hose_for_OF_device(structdevice_node*node);+externstructpci_controller*pci_find_controller_for_domain(intdomain_nr);+/* Fill up host controller resources from the OF node */externvoidpci_process_bridge_OF_ranges(structpci_controller*hose,structdevice_node*dev,intprimary);
From: Sam Bobroff <hidden> Date: 2019-02-15 06:00:19
On Fri, Feb 15, 2019 at 11:48:16AM +1100, Oliver O'Halloran wrote:
quoted hunk
Currently when we detect an error we automatically invoke the EEH recovery
handler. This can be annoying when debugging EEH problems, or when working
on EEH itself so this patch adds a debugfs knob that will prevent a
recovery event from being queued up when an issue is detected.
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
arch/powerpc/include/asm/eeh.h | 1 +
arch/powerpc/kernel/eeh.c | 10 ++++++++++
arch/powerpc/kernel/eeh_event.c | 9 +++++++++
3 files changed, 20 insertions(+)
@@ -126,6 +126,15 @@ int eeh_send_failure_event(struct eeh_pe *pe)unsignedlongflags;structeeh_event*event;+/*+*Ifwe'vemanuallysupressedrecoveryeventsviadebugfs+*thenjustdropitonthefloor.+*/+if(eeh_debugfs_no_recover){+pr_err("EEH: Event dropped due to no_recover setting\n");+return0;+}+
I think it might be clearer if you did the 'no recovery' test at the
call sites (I think there are only a few), instead of inside the
function (and then the next patch wouldn't need to add a wrapper).
event = kzalloc(sizeof(*event), GFP_ATOMIC);
if (!event) {
pr_err("EEH: out of memory, event not handled\n");
--
2.20.1
From: Oliver <oohall@gmail.com> Date: 2019-02-17 23:21:31
On Fri, Feb 15, 2019 at 4:58 PM Sam Bobroff [off-list ref] wrote:
On Fri, Feb 15, 2019 at 11:48:16AM +1100, Oliver O'Halloran wrote:
quoted
Currently when we detect an error we automatically invoke the EEH recovery
handler. This can be annoying when debugging EEH problems, or when working
on EEH itself so this patch adds a debugfs knob that will prevent a
recovery event from being queued up when an issue is detected.
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
arch/powerpc/include/asm/eeh.h | 1 +
arch/powerpc/kernel/eeh.c | 10 ++++++++++
arch/powerpc/kernel/eeh_event.c | 9 +++++++++
3 files changed, 20 insertions(+)
@@ -126,6 +126,15 @@ int eeh_send_failure_event(struct eeh_pe *pe)unsignedlongflags;structeeh_event*event;+/*+*Ifwe'vemanuallysupressedrecoveryeventsviadebugfs+*thenjustdropitonthefloor.+*/+if(eeh_debugfs_no_recover){+pr_err("EEH: Event dropped due to no_recover setting\n");+return0;+}+
I think it might be clearer if you did the 'no recovery' test at the
call sites (I think there are only a few), instead of inside the
function (and then the next patch wouldn't need to add a wrapper).
I don't think adding boilerplate at all the call sites is an
improvement. It's just a recipe for adding bugs.
quoted
event = kzalloc(sizeof(*event), GFP_ATOMIC);
if (!event) {
pr_err("EEH: out of memory, event not handled\n");
--
2.20.1
From: Michael Ellerman <hidden> Date: 2019-02-22 10:29:07
On Fri, 2019-02-15 at 00:48:11 UTC, Oliver O'Halloran wrote:
There's no need to the custom getter/setter functions so we should remove
them in favour of using the generic one. While we're here, change the type
of eeh_max_freeze to u32 and print the value in decimal rather than
hex because printing it in hex makes no sense.
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Reviewed-by: Sam Bobroff <redacted>