[3/3] xive: Log more information in opal_xive_dump() for emulation state

Submitted by Benjamin Herrenschmidt on April 21, 2017, 2:22 a.m.

Details

Message ID 20170421022259.13485-3-benh@kernel.crashing.org
State Accepted
Headers show

Commit Message

Benjamin Herrenschmidt April 21, 2017, 2:22 a.m.
Add a counter of total interrupts taken by a CPU, dump the
queue buffer both before and after the current pointer,
and also display the HW state of the queue descriptor and
the PQ state of the IPI.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 hw/xive.c | 31 +++++++++++++++++++++++++++----
 1 file changed, 27 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

diff --git a/hw/xive.c b/hw/xive.c
index c44f7d8..b40c5ca 100644
--- a/hw/xive.c
+++ b/hw/xive.c
@@ -300,6 +300,7 @@  struct xive_cpu_state {
 	uint32_t	eqmsk;
 	uint8_t		eqgen;
 	void		*eqmmio;
+	uint64_t	total_irqs;
 };
 
 #ifdef XIVE_PERCPU_LOG
@@ -3186,6 +3187,7 @@  static uint32_t xive_read_eq(struct xive_cpu_state *xs, bool just_peek)
 		xs->eqptr = (xs->eqptr + 1) & xs->eqmsk;
 		if (xs->eqptr == 0)
 			xs->eqgen ^= 1;
+		xs->total_irqs++;
 	}
 	return cur & 0x00ffffff;
 }
@@ -4439,6 +4441,9 @@  static int64_t opal_xive_dump_emu(uint32_t pir)
 {
 	struct cpu_thread *c = find_cpu_by_pir(pir);
 	struct xive_cpu_state *xs;
+	struct xive_eq *eq;
+	uint32_t ipi_target = -1u;
+	uint8_t *mm, pq;
 
 	if (!c)
 		return OPAL_PARAMETER;
@@ -4453,13 +4458,31 @@  static int64_t opal_xive_dump_emu(uint32_t pir)
 	lock(&xs->lock);
 
 	prlog(PR_INFO, "CPU[%04x]: cppr=%02x mfrr=%02x pend=%02x"
-	      " prev_cppr=%02x\n", pir,
-	      xs->cppr, xs->mfrr, xs->pending, xs->prev_cppr);
+	      " prev_cppr=%02x total_irqs=%llx\n", pir,
+	      xs->cppr, xs->mfrr, xs->pending, xs->prev_cppr, xs->total_irqs);
 
-	prlog(PR_INFO, "CPU[%04x]: EQ IDX=%x MSK=%x G=%d [%08x %08x ...]\n",
+	prlog(PR_INFO, "CPU[%04x]: EQ IDX=%x MSK=%x G=%d [%08x %08x %08x > %08x %08x %08x %08x ...]\n",
 	      pir,  xs->eqptr, xs->eqmsk, xs->eqgen,
+	      xs->eqbuf[(xs->eqptr - 3) & xs->eqmsk],
+	      xs->eqbuf[(xs->eqptr - 2) & xs->eqmsk],
+	      xs->eqbuf[(xs->eqptr - 1) & xs->eqmsk],
 	      xs->eqbuf[(xs->eqptr + 0) & xs->eqmsk],
-	      xs->eqbuf[(xs->eqptr + 1) & xs->eqmsk]);
+	      xs->eqbuf[(xs->eqptr + 1) & xs->eqmsk],
+	      xs->eqbuf[(xs->eqptr + 2) & xs->eqmsk],
+	      xs->eqbuf[(xs->eqptr + 3) & xs->eqmsk]);
+
+	mm = xs->xive->esb_mmio + GIRQ_TO_IDX(xs->ipi_irq) * 0x20000;
+	pq = in_8(mm + 0x10800);
+	xive_get_irq_targetting(xs->ipi_irq, &ipi_target, NULL, NULL);
+	prlog(PR_INFO, "CPU[%04x]: IPI #%08x PQ=%x target=%08x\n",
+	      pir, xs->ipi_irq, pq, ipi_target);
+
+	__xive_cache_scrub(xs->xive, xive_cache_eqc, xs->eq_blk,
+			   xs->eq_idx + XIVE_EMULATION_PRIO,
+			   false, false);
+	eq = xive_get_eq(xs->xive, xs->eq_idx + XIVE_EMULATION_PRIO);
+	prlog(PR_INFO, "CPU[%04x]: EQ @%p W0=%08x W1=%08x qbuf @%p\n",
+	      pir, eq, eq->w0, eq->w1, xs->eqbuf);
 
 	log_print(xs);