All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hw/usb/hcd-ehci.c: print diagnostics when cpage out of range
@ 2022-04-30  8:25 Arnout Engelen
  2022-06-09 10:09 ` Gerd Hoffmann
  0 siblings, 1 reply; 3+ messages in thread
From: Arnout Engelen @ 2022-04-30  8:25 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial, kraxel; +Cc: Arnout Engelen

Making it easier to diagnose what is going on when it happens

Signed-off-by: Arnout Engelen <arnout@bzzt.net>
---
 hw/usb/hcd-ehci.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index 33a8a377bd..8e2f6578c2 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -1195,6 +1195,11 @@ static int ehci_init_transfer(EHCIPacket *p)
     while (bytes > 0) {
         if (cpage > 4) {
             fprintf(stderr, "cpage out of range (%u)\n", cpage);
+            bytes  = get_field(p->qtd.token, QTD_TOKEN_TBYTES);
+            offset = p->qtd.bufptr[0] & ~QTD_BUFPTR_MASK;
+            cpage  = get_field(p->qtd.token, QTD_TOKEN_CPAGE);
+            fprintf(stderr, "reading %u bytes from offset %u at page %u\n",
+                    bytes, offset, cpage);
             qemu_sglist_destroy(&p->sgl);
             return -1;
         }
-- 
2.35.3



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] hw/usb/hcd-ehci.c: print diagnostics when cpage out of range
  2022-04-30  8:25 [PATCH] hw/usb/hcd-ehci.c: print diagnostics when cpage out of range Arnout Engelen
@ 2022-06-09 10:09 ` Gerd Hoffmann
  2022-06-09 10:13   ` Arnout Engelen
  0 siblings, 1 reply; 3+ messages in thread
From: Gerd Hoffmann @ 2022-06-09 10:09 UTC (permalink / raw)
  To: Arnout Engelen; +Cc: qemu-devel, qemu-trivial

  Hi,

>          if (cpage > 4) {
>              fprintf(stderr, "cpage out of range (%u)\n", cpage);
> +            bytes  = get_field(p->qtd.token, QTD_TOKEN_TBYTES);
> +            offset = p->qtd.bufptr[0] & ~QTD_BUFPTR_MASK;
> +            cpage  = get_field(p->qtd.token, QTD_TOKEN_CPAGE);
> +            fprintf(stderr, "reading %u bytes from offset %u at page %u\n",
> +                    bytes, offset, cpage);

I think we should either drop it (you've successfully debugged the
problem meanwhile, thanks for that), or turn it into a tracepoint.
Simply printing to stderr is deprecated.

take care,
  Gerd



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] hw/usb/hcd-ehci.c: print diagnostics when cpage out of range
  2022-06-09 10:09 ` Gerd Hoffmann
@ 2022-06-09 10:13   ` Arnout Engelen
  0 siblings, 0 replies; 3+ messages in thread
From: Arnout Engelen @ 2022-06-09 10:13 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: qemu-devel, qemu-trivial

[-- Attachment #1: Type: text/plain, Size: 778 bytes --]

On Thu, Jun 9, 2022, at 12:09, Gerd Hoffmann wrote:
>   Hi,
> 
> >          if (cpage > 4) {
> >              fprintf(stderr, "cpage out of range (%u)\n", cpage);
> > +            bytes  = get_field(p->qtd.token, QTD_TOKEN_TBYTES);
> > +            offset = p->qtd.bufptr[0] & ~QTD_BUFPTR_MASK;
> > +            cpage  = get_field(p->qtd.token, QTD_TOKEN_CPAGE);
> > +            fprintf(stderr, "reading %u bytes from offset %u at page %u\n",
> > +                    bytes, offset, cpage);
> 
> I think we should either drop it (you've successfully debugged the
> problem meanwhile, thanks for that), or turn it into a tracepoint.
> Simply printing to stderr is deprecated.

Gotcha, I'm OK with dropping it. Thanks for the feedback & queue-ing the fix!


Kind regards,

Arnout

[-- Attachment #2: Type: text/html, Size: 1718 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-06-09 12:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-30  8:25 [PATCH] hw/usb/hcd-ehci.c: print diagnostics when cpage out of range Arnout Engelen
2022-06-09 10:09 ` Gerd Hoffmann
2022-06-09 10:13   ` Arnout Engelen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.