acpi: More trace points
cover acpi: More trace points
I wrote these patches to help me debug an unplug failure. I expect them to be helpful for others, too.
Markus Armbruster (3):
acpi/piix4: Convert debug printf()s to trace events acpi/pcihp: Convert debug printf()s to trace events acpi/pcihp: Add a few more trace points related to unplug
hw/acpi/pcihp.c | 32 +++++++++++++++----------------- hw/acpi/piix4.c | 14 +++----------- hw/acpi/trace-events | 16 ++++++++++++++++ 3 files changed, 34 insertions(+), 28 deletions(-)
Signature · 1 line
2.17.2
PATCH 1/3 acpi/piix4: Convert debug printf()s to trace events
--- hw/acpi/piix4.c | 14 +++----------- hw/acpi/trace-events | 4 ++++ 2 files changed, 7 insertions(+), 11 deletions(-)
hw/acpi/piix4.c +3 -11
@@ -39,14 +39,7 @@#include "hw/acpi/acpi_dev_interface.h" #include "hw/xen/xen.h" #include "qom/cpu.h" - -//#define DEBUG - -#ifdef DEBUG -# define PIIX4_DPRINTF (format, ...) printf(format, ## __VA_ARGS__) -#else -# define PIIX4_DPRINTF (format, ...) do { } while (0) -#endif +#include "trace.h" #define GPE_BASE 0xafe0#define GPE_LEN 4
@@ -596,7 +589,7 @@ static uint64_t gpe_readb(void *opaque, hwaddr addr, unsigned width)PIIX4PMState *s = opaque;uint32_t val =acpi_gpe_ioport_readb (&s->ar, addr); -PIIX4_DPRINTF ("gpe read %" HWADDR_PRIx" == %" PRIu32"\n" , addr, val); +trace_piix4_gpe_readb (addr, width, val);return val; }
@@ -605,10 +598,9 @@ static void gpe_writeb(void *opaque, hwaddr addr, uint64_t val, {PIIX4PMState *s = opaque; +trace_piix4_gpe_writeb (addr, width, val);acpi_gpe_ioport_writeb (&s->ar, addr, val);acpi_update_sci (&s->ar, s->irq); - -PIIX4_DPRINTF ("gpe write %" HWADDR_PRIx" <== %" PRIu64"\n" , addr, val); }static const MemoryRegionOps piix4_gpe_ops = {
hw/acpi/trace-events +4 -0
@@ -31,6 +31,10 @@ cpuhp_acpi_ejecting_cpu(uint32_t idx) "0x%"PRIx32 cpuhp_acpi_write_ost_ev(uint32_t slot, uint32_t ev) "idx[0x%"PRIx32"] OST EVENT: 0x%"PRIx32 cpuhp_acpi_write_ost_status(uint32_t slot, uint32_t st) "idx[0x%"PRIx32"] OST STATUS: 0x%"PRIx32 +# piix4.c +piix4_gpe_readb(uint64_t addr, unsigned width, uint64_t val) "addr: 0x%" PRIx64 " width: %d ==> 0x%" PRIx64 +piix4_gpe_writeb(uint64_t addr, unsigned width, uint64_t val) "addr: 0x%" PRIx64 " width: %d <== 0x%" PRIx64 + # tco.c tco_timer_reload(int ticks, int msec) "ticks=%d (%d ms)" tco_timer_expired(int timeouts_no, bool strap, bool no_reboot) "timeouts_no=%d no_reboot=%d/%d"
Signature · 1 line
2.17.2
Re: [Qemu-devel] [PATCH 1/3] acpi/piix4: Convert debug printf()s to trace events
Quoted 1 line · On Tue, 2 Apr 2019 18:18:58 +0200 Markus Armbruster <[email protected]> wrote:
Signed-off-by Markus Armbruster <[email protected]>
Quoted 61 lines
--- hw/acpi/piix4.c | 14 +++----------- hw/acpi/trace-events | 4 ++++ 2 files changed, 7 insertions(+), 11 deletions(-)hw/acpi/piix4.c +3
-11@@ -39,14 +39,7 @@#include "hw/acpi/acpi_dev_interface.h" #include "hw/xen/xen.h" #include "qom/cpu.h" - -//#define DEBUG - -#ifdef DEBUG -# define PIIX4_DPRINTF (format, ...) printf(format, ## __VA_ARGS__) -#else -# define PIIX4_DPRINTF (format, ...) do { } while (0) -#endif +#include "trace.h" #define GPE_BASE 0xafe0#define GPE_LEN 4@@ -596,7 +589,7 @@ static uint64_t gpe_readb(void *opaque, hwaddr addr, unsigned width)PIIX4PMState *s = opaque;uint32_t val =acpi_gpe_ioport_readb (&s->ar, addr); -PIIX4_DPRINTF ("gpe read %" HWADDR_PRIx" == %" PRIu32"\n" , addr, val); +trace_piix4_gpe_readb (addr, width, val);return val; }@@ -605,10 +598,9 @@ static void gpe_writeb(void *opaque, hwaddr addr, uint64_t val, {PIIX4PMState *s = opaque; +trace_piix4_gpe_writeb (addr, width, val);acpi_gpe_ioport_writeb (&s->ar, addr, val);acpi_update_sci (&s->ar, s->irq); - -PIIX4_DPRINTF ("gpe write %" HWADDR_PRIx" <== %" PRIu64"\n" , addr, val); }static const MemoryRegionOps piix4_gpe_ops = {hw/acpi/trace-events +4
-0@@ -31,6 +31,10 @@ cpuhp_acpi_ejecting_cpu(uint32_t idx) "0x%"PRIx32 cpuhp_acpi_write_ost_ev(uint32_t slot, uint32_t ev) "idx[0x%"PRIx32"] OST EVENT: 0x%"PRIx32 cpuhp_acpi_write_ost_status(uint32_t slot, uint32_t st) "idx[0x%"PRIx32"] OST STATUS: 0x%"PRIx32 +# piix4.c +piix4_gpe_readb(uint64_t addr, unsigned width, uint64_t val) "addr: 0x%" PRIx64 " width: %d ==> 0x%" PRIx64 +piix4_gpe_writeb(uint64_t addr, unsigned width, uint64_t val) "addr: 0x%" PRIx64 " width: %d <== 0x%" PRIx64 + # tco.c tco_timer_reload(int ticks, int msec) "ticks=%d (%d ms)" tco_timer_expired(int timeouts_no, bool strap, bool no_reboot) "timeouts_no=%d no_reboot=%d/%d"
PATCH 2/3 acpi/pcihp: Convert debug printf()s to trace events
In reply to Markus Armbruster--- hw/acpi/pcihp.c | 25 ++++++++----------------- hw/acpi/trace-events | 9 +++++++++ 2 files changed, 17 insertions(+), 17 deletions(-)
hw/acpi/pcihp.c +8 -17
@@ -37,14 +37,7 @@#include "hw/pci/pci_bus.h" #include "qapi/error.h" #include "qom/qom-qobject.h" - -//#define DEBUG - -#ifdef DEBUG -# define ACPI_PCIHP_DPRINTF (format, ...) printf(format, ## __VA_ARGS__) -#else -# define ACPI_PCIHP_DPRINTF (format, ...) do { } while (0) -#endif +#include "trace.h" #define ACPI_PCIHP_ADDR 0xae00#define ACPI_PCIHP_SIZE 0x0014
@@ -306,23 +299,23 @@ static uint64_t pci_read(void *opaque, hwaddr addr, unsigned int size)if (!s->legacy_piix) { s->acpi_pcihp_pci_status[bsel].up =0 ; } -ACPI_PCIHP_DPRINTF ("pci_up_read %" PRIu32"\n" , val); +trace_acpi_pci_up_read (val);break ;case PCI_DOWN_BASE : val = s->acpi_pcihp_pci_status[bsel].down; -ACPI_PCIHP_DPRINTF ("pci_down_read %" PRIu32"\n" , val); +trace_acpi_pci_down_read (val);break ;case PCI_EJ_BASE :/* No feature defined yet */ -ACPI_PCIHP_DPRINTF ("pci_features_read %" PRIu32"\n" , val); +trace_acpi_pci_features_read (val);break ;case PCI_RMV_BASE : val = s->acpi_pcihp_pci_status[bsel].hotplug_enable; -ACPI_PCIHP_DPRINTF ("pci_rmv_read %" PRIu32"\n" , val); +trace_acpi_pci_rmv_read (val);break ;case PCI_SEL_BASE : val = s->hotplug_select; -ACPI_PCIHP_DPRINTF ("pci_sel_read %" PRIu32"\n" , val); +trace_acpi_pci_sel_read (val);default :break ; }
@@ -340,13 +333,11 @@ static void pci_write(void *opaque, hwaddr addr, uint64_t data,break ; }acpi_pcihp_eject_slot (s, s->hotplug_select, data); -ACPI_PCIHP_DPRINTF ("pciej write %" HWADDR_PRIx" <== %" PRIu64"\n" , - addr, data); +trace_acpi_pci_ej_write (addr, data);break ;case PCI_SEL_BASE : s->hotplug_select = s->legacy_piix ?ACPI_PCIHP_BSEL_DEFAULT : data; -ACPI_PCIHP_DPRINTF ("pcisel write %" HWADDR_PRIx" <== %" PRIu64"\n" , - addr, data); +trace_acpi_pci_sel_write (addr, data);default :break ; }
hw/acpi/trace-events +9 -0
@@ -31,6 +31,15 @@ cpuhp_acpi_ejecting_cpu(uint32_t idx) "0x%"PRIx32 cpuhp_acpi_write_ost_ev(uint32_t slot, uint32_t ev) "idx[0x%"PRIx32"] OST EVENT: 0x%"PRIx32 cpuhp_acpi_write_ost_status(uint32_t slot, uint32_t st) "idx[0x%"PRIx32"] OST STATUS: 0x%"PRIx32 +# pcihp.c +acpi_pci_up_read(uint32_t val) "%" PRIu32 +acpi_pci_down_read(uint32_t val) "%" PRIu32 +acpi_pci_features_read(uint32_t val) "%" PRIu32 +acpi_pci_rmv_read(uint32_t val) "%" PRIu32 +acpi_pci_sel_read(uint32_t val) "%" PRIu32 +acpi_pci_ej_write(uint64_t addr, uint64_t data) "0x%" PRIx64 " <== %" PRIu64 +acpi_pci_sel_write(uint64_t addr, uint64_t data) "0x%" PRIx64 " <== %" PRIu64 + # piix4.c piix4_gpe_readb(uint64_t addr, unsigned width, uint64_t val) "addr: 0x%" PRIx64 " width: %d ==> 0x%" PRIx64 piix4_gpe_writeb(uint64_t addr, unsigned width, uint64_t val) "addr: 0x%" PRIx64 " width: %d <== 0x%" PRIx64
Signature · 1 line
2.17.2
Re: [Qemu-devel] [PATCH 2/3] acpi/pcihp: Convert debug printf()s to trace events
Quoted 1 line · On Tue, 2 Apr 2019 18:18:59 +0200 Markus Armbruster <[email protected]> wrote:
Signed-off-by Markus Armbruster <[email protected]>
Quoted 90 lines
--- hw/acpi/pcihp.c | 25 ++++++++----------------- hw/acpi/trace-events | 9 +++++++++ 2 files changed, 17 insertions(+), 17 deletions(-)hw/acpi/pcihp.c +8
-17@@ -37,14 +37,7 @@#include "hw/pci/pci_bus.h" #include "qapi/error.h" #include "qom/qom-qobject.h" - -//#define DEBUG - -#ifdef DEBUG -# define ACPI_PCIHP_DPRINTF (format, ...) printf(format, ## __VA_ARGS__) -#else -# define ACPI_PCIHP_DPRINTF (format, ...) do { } while (0) -#endif +#include "trace.h" #define ACPI_PCIHP_ADDR 0xae00#define ACPI_PCIHP_SIZE 0x0014@@ -306,23 +299,23 @@ static uint64_t pci_read(void *opaque, hwaddr addr, unsigned int size)if (!s->legacy_piix) { s->acpi_pcihp_pci_status[bsel].up =0 ; } -ACPI_PCIHP_DPRINTF ("pci_up_read %" PRIu32"\n" , val); +trace_acpi_pci_up_read (val);break ;case PCI_DOWN_BASE : val = s->acpi_pcihp_pci_status[bsel].down; -ACPI_PCIHP_DPRINTF ("pci_down_read %" PRIu32"\n" , val); +trace_acpi_pci_down_read (val);break ;case PCI_EJ_BASE :/* No feature defined yet */ -ACPI_PCIHP_DPRINTF ("pci_features_read %" PRIu32"\n" , val); +trace_acpi_pci_features_read (val);break ;case PCI_RMV_BASE : val = s->acpi_pcihp_pci_status[bsel].hotplug_enable; -ACPI_PCIHP_DPRINTF ("pci_rmv_read %" PRIu32"\n" , val); +trace_acpi_pci_rmv_read (val);break ;case PCI_SEL_BASE : val = s->hotplug_select; -ACPI_PCIHP_DPRINTF ("pci_sel_read %" PRIu32"\n" , val); +trace_acpi_pci_sel_read (val);default :break ; }@@ -340,13 +333,11 @@ static void pci_write(void *opaque, hwaddr addr, uint64_t data,break ; }acpi_pcihp_eject_slot (s, s->hotplug_select, data); -ACPI_PCIHP_DPRINTF ("pciej write %" HWADDR_PRIx" <== %" PRIu64"\n" , - addr, data); +trace_acpi_pci_ej_write (addr, data);break ;case PCI_SEL_BASE : s->hotplug_select = s->legacy_piix ?ACPI_PCIHP_BSEL_DEFAULT : data; -ACPI_PCIHP_DPRINTF ("pcisel write %" HWADDR_PRIx" <== %" PRIu64"\n" , - addr, data); +trace_acpi_pci_sel_write (addr, data);default :break ; }hw/acpi/trace-events +9
-0@@ -31,6 +31,15 @@ cpuhp_acpi_ejecting_cpu(uint32_t idx) "0x%"PRIx32 cpuhp_acpi_write_ost_ev(uint32_t slot, uint32_t ev) "idx[0x%"PRIx32"] OST EVENT: 0x%"PRIx32 cpuhp_acpi_write_ost_status(uint32_t slot, uint32_t st) "idx[0x%"PRIx32"] OST STATUS: 0x%"PRIx32 +# pcihp.c +acpi_pci_up_read(uint32_t val) "%" PRIu32 +acpi_pci_down_read(uint32_t val) "%" PRIu32 +acpi_pci_features_read(uint32_t val) "%" PRIu32 +acpi_pci_rmv_read(uint32_t val) "%" PRIu32 +acpi_pci_sel_read(uint32_t val) "%" PRIu32 +acpi_pci_ej_write(uint64_t addr, uint64_t data) "0x%" PRIx64 " <== %" PRIu64 +acpi_pci_sel_write(uint64_t addr, uint64_t data) "0x%" PRIx64 " <== %" PRIu64 + # piix4.c piix4_gpe_readb(uint64_t addr, unsigned width, uint64_t val) "addr: 0x%" PRIx64 " width: %d ==> 0x%" PRIx64 piix4_gpe_writeb(uint64_t addr, unsigned width, uint64_t val) "addr: 0x%" PRIx64 " width: %d <== 0x%" PRIx64
PATCH 3/3 acpi/pcihp: Add a few more trace points related to unplug
In reply to Markus Armbruster--- hw/acpi/pcihp.c | 7 +++++++ hw/acpi/trace-events | 3 +++ 2 files changed, 10 insertions(+)
hw/acpi/pcihp.c +7 -0
@@ -152,6 +152,8 @@ static void acpi_pcihp_eject_slot(AcpiPciHpState *s, unsigned bsel, unsigned sloint slot =ctz32 (slots);PCIBus *bus =acpi_pcihp_find_hotplug_bus (s, bsel); +trace_acpi_pci_eject_slot (bsel, slot); +if (!bus) {return ; }
@@ -263,6 +265,8 @@ void acpi_pcihp_device_plug_cb(HotplugHandler *hotplug_dev, AcpiPciHpState *s,void acpi_pcihp_device_unplug_cb (HotplugHandler *hotplug_dev,AcpiPciHpState *s,DeviceState *dev,Error **errp) { +trace_acpi_pci_unplug (PCI_SLOT (PCI_DEVICE (dev)->devfn), +acpi_pcihp_get_bsel (pci_get_bus (PCI_DEVICE (dev))));object_property_set_bool (OBJECT (dev), false,"realized" ,NULL ); }
@@ -273,6 +277,9 @@ void acpi_pcihp_device_unplug_request_cb(HotplugHandler *hotplug_dev,PCIDevice *pdev =PCI_DEVICE (dev);int slot =PCI_SLOT (pdev->devfn);int bsel =acpi_pcihp_get_bsel (pci_get_bus (pdev)); + +trace_acpi_pci_unplug_request (bsel, slot); +if (bsel <0 ) {error_setg (errp,"Unsupported bus. Bus doesn't have property '" ACPI_PCIHP_PROP_BSEL "' set" );
hw/acpi/trace-events +3 -0
@@ -32,6 +32,9 @@ cpuhp_acpi_write_ost_ev(uint32_t slot, uint32_t ev) "idx[0x%"PRIx32"] OST EVENT: cpuhp_acpi_write_ost_status(uint32_t slot, uint32_t st) "idx[0x%"PRIx32"] OST STATUS: 0x%"PRIx32 # pcihp.c +acpi_pci_eject_slot(unsigned bsel, unsigned slot) "bsel: %u slot: %u" +acpi_pci_unplug(int bsel, int slot) "bsel: %d slot: %d" +acpi_pci_unplug_request(int bsel, int slot) "bsel: %d slot: %d" acpi_pci_up_read(uint32_t val) "%" PRIu32 acpi_pci_down_read(uint32_t val) "%" PRIu32 acpi_pci_features_read(uint32_t val) "%" PRIu32
Signature · 1 line
2.17.2
Re: [Qemu-devel] [PATCH 3/3] acpi/pcihp: Add a few more trace points related to unplug
Quoted 1 line · On Tue, 2 Apr 2019 18:19:00 +0200 Markus Armbruster <[email protected]> wrote:
Signed-off-by Markus Armbruster <[email protected]>
Quoted 51 lines
--- hw/acpi/pcihp.c | 7 +++++++ hw/acpi/trace-events | 3 +++ 2 files changed, 10 insertions(+)hw/acpi/pcihp.c +7
-0@@ -152,6 +152,8 @@ static void acpi_pcihp_eject_slot(AcpiPciHpState *s, unsigned bsel, unsigned sloint slot =ctz32 (slots);PCIBus *bus =acpi_pcihp_find_hotplug_bus (s, bsel); +trace_acpi_pci_eject_slot (bsel, slot); +if (!bus) {return ; }@@ -263,6 +265,8 @@ void acpi_pcihp_device_plug_cb(HotplugHandler *hotplug_dev, AcpiPciHpState *s,void acpi_pcihp_device_unplug_cb (HotplugHandler *hotplug_dev,AcpiPciHpState *s,DeviceState *dev,Error **errp) { +trace_acpi_pci_unplug (PCI_SLOT (PCI_DEVICE (dev)->devfn), +acpi_pcihp_get_bsel (pci_get_bus (PCI_DEVICE (dev))));object_property_set_bool (OBJECT (dev), false,"realized" ,NULL ); }@@ -273,6 +277,9 @@ void acpi_pcihp_device_unplug_request_cb(HotplugHandler *hotplug_dev,PCIDevice *pdev =PCI_DEVICE (dev);int slot =PCI_SLOT (pdev->devfn);int bsel =acpi_pcihp_get_bsel (pci_get_bus (pdev)); + +trace_acpi_pci_unplug_request (bsel, slot); +if (bsel <0 ) {error_setg (errp,"Unsupported bus. Bus doesn't have property '" ACPI_PCIHP_PROP_BSEL "' set" );hw/acpi/trace-events +3
-0@@ -32,6 +32,9 @@ cpuhp_acpi_write_ost_ev(uint32_t slot, uint32_t ev) "idx[0x%"PRIx32"] OST EVENT: cpuhp_acpi_write_ost_status(uint32_t slot, uint32_t st) "idx[0x%"PRIx32"] OST STATUS: 0x%"PRIx32 # pcihp.c +acpi_pci_eject_slot(unsigned bsel, unsigned slot) "bsel: %u slot: %u" +acpi_pci_unplug(int bsel, int slot) "bsel: %d slot: %d" +acpi_pci_unplug_request(int bsel, int slot) "bsel: %d slot: %d" acpi_pci_up_read(uint32_t val) "%" PRIu32 acpi_pci_down_read(uint32_t val) "%" PRIu32 acpi_pci_features_read(uint32_t val) "%" PRIu32
Re: [Qemu-devel] [PATCH 3/3] acpi/pcihp: Add a few more trace points related to unplug
Hi Igor,
Quoted 6 lines · Igor Mammedov
Quoted 1 line · On Tue, 2 Apr 2019 18:19:00 +0200 Markus Armbruster <[email protected]> wrote:
Signed-off-by Markus Armbruster <[email protected]>Reviewed-by Markus Armbruster <[email protected]>
did you mean: "R-b: Igor" instead?
Laszlo
Igor Mammedov
Reviewed-byRe: [Qemu-devel] [PATCH 3/3] acpi/pcihp: Add a few more trace points related to unplug
Quoted 11 lines · On Thu, 4 Apr 2019 14:54:51 +0200 Laszlo Ersek <[email protected]> wrote:
Hi Igor,
Quoted 6 lines · Igor Mammedov
Quoted 1 line · On Tue, 2 Apr 2019 18:19:00 +0200 Markus Armbruster <[email protected]> wrote:
Signed-off-by Markus Armbruster <[email protected]>Reviewed-by Markus Armbruster <[email protected]>did you mean: "R-b: Igor" instead?
:) yep, copied name from wrong field which is easy feat in claws-mail
Quoted 2 lines
Laszlo
Quoted 2 lines · Markus Armbruster
I wrote these patches to help me debug an unplug failure. I expect them to be helpful for others, too.
Appreciated.
FYI I have a WiP branch where I use existing tracepoints to check events order and timing (using Avocado).
Series:
Quoted 11 lines
Markus Armbruster (3):
acpi/piix4: Convert debug printf()s to trace events acpi/pcihp: Convert debug printf()s to trace events acpi/pcihp: Add a few more trace points related to unplughw/acpi/pcihp.c | 32 +++++++++++++++----------------- hw/acpi/piix4.c | 14 +++----------- hw/acpi/trace-events | 16 ++++++++++++++++ 3 files changed, 34 insertions(+), 28 deletions(-)
Ping?
Quoted 12 lines · Markus Armbruster
I wrote these patches to help me debug an unplug failure. I expect them to be helpful for others, too.
Markus Armbruster (3):
acpi/piix4: Convert debug printf()s to trace events acpi/pcihp: Convert debug printf()s to trace events acpi/pcihp: Add a few more trace points related to unplughw/acpi/pcihp.c | 32 +++++++++++++++----------------- hw/acpi/piix4.c | 14 +++----------- hw/acpi/trace-events | 16 ++++++++++++++++ 3 files changed, 34 insertions(+), 28 deletions(-)
tagged, thanks!
Quoted 16 lines · Markus Armbruster
Ping?
Quoted 12 lines · Markus Armbruster
I wrote these patches to help me debug an unplug failure. I expect them to be helpful for others, too.
Markus Armbruster (3):
acpi/piix4: Convert debug printf()s to trace events acpi/pcihp: Convert debug printf()s to trace events acpi/pcihp: Add a few more trace points related to unplughw/acpi/pcihp.c | 32 +++++++++++++++----------------- hw/acpi/piix4.c | 14 +++----------- hw/acpi/trace-events | 16 ++++++++++++++++ 3 files changed, 34 insertions(+), 28 deletions(-)