From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Nicholas Piggin <npiggin@gmail.com>, Gerd Hoffmann <kraxel@redhat.com>
Cc: qemu-devel@nongnu.org, Kevin Wolf <kwolf@redhat.com>
Subject: Re: [PATCH v2 10/10] usb/msd: Add more tracing
Date: Fri, 11 Apr 2025 12:36:16 +0200 [thread overview]
Message-ID: <5aba881b-a1bb-40fc-b707-2fd0d4b1a1d2@linaro.org> (raw)
In-Reply-To: <20250411080431.207579-11-npiggin@gmail.com>
On 11/4/25 10:04, Nicholas Piggin wrote:
> Add tracing for more received packet types, cbw_state changes, and
> some more SCSI callbacks. These were useful in debugging relaxed
> packet ordering support.
>
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> ---
> hw/usb/dev-storage.c | 23 +++++++++++++++++++++--
> hw/usb/trace-events | 9 ++++++++-
> 2 files changed, 29 insertions(+), 3 deletions(-)
> static void usb_msd_copy_data(MSDState *s, USBPacket *p)
> {
> uint32_t len;
> +
> len = p->iov.size - p->actual_length;
> +
> + trace_usb_msd_copy_data(s->req->tag, len);
> +
> if (len > s->scsi_len)
> len = s->scsi_len;
> usb_packet_copy(p, scsi_req_get_buf(s->req) + s->scsi_off, len);
> @@ -264,6 +268,8 @@ void usb_msd_transfer_data(SCSIRequest *req, uint32_t len)
> MSDState *s = DO_UPCAST(MSDState, dev.qdev, req->bus->qbus.parent);
> USBPacket *p = s->data_packet;
>
> + trace_usb_msd_transfer_data(req->tag, len);
> +
> if (s->cbw_state == USB_MSD_CBW_DATAIN) {
> if (req->cmd.mode == SCSI_XFER_TO_DEV) {
> usb_msd_fatal_error(s);
> @@ -324,11 +330,13 @@ void usb_msd_command_complete(SCSIRequest *req, size_t resid)
> }
> if (s->data_len == 0) {
> s->cbw_state = USB_MSD_CBW_CSW;
> + trace_usb_msd_cbw_state(s->cbw_state);
> }
> /* USB_RET_SUCCESS status clears previous ASYNC status */
> usb_msd_data_packet_complete(s, USB_RET_SUCCESS);
> } else if (s->data_len == 0) {
> s->cbw_state = USB_MSD_CBW_CSW;
> + trace_usb_msd_cbw_state(s->cbw_state);
> }
Maybe helpful to log state transition?
void usb_msd_cbw_change_state(MSDState *s,
enum USBMSDCBWState cbw_state)
{
if (s->cbw_state != cbw_state) {
trace_usb_msd_cbw_state(s->cbw_state, cbw_state);
s->cbw_state = cbw_state;
}
}
Otherwise,
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
next prev parent reply other threads:[~2025-04-11 10:36 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-11 8:04 [PATCH v2 00/10] usb/msd: Permit relaxed ordering of IN packets Nicholas Piggin
2025-04-11 8:04 ` [PATCH v2 01/10] usb/msd: Split in and out packet handling Nicholas Piggin
2025-04-11 8:04 ` [PATCH v2 02/10] usb/msd: Ensure packet structure layout is correct Nicholas Piggin
2025-04-11 10:18 ` Philippe Mathieu-Daudé
2025-04-11 10:21 ` Philippe Mathieu-Daudé
2025-04-11 10:23 ` Philippe Mathieu-Daudé
2025-04-12 5:32 ` Nicholas Piggin
2025-04-11 8:04 ` [PATCH v2 03/10] usb/msd: Improved handling of mass storage reset Nicholas Piggin
2025-04-11 10:19 ` Philippe Mathieu-Daudé
2025-04-11 8:04 ` [PATCH v2 04/10] usb/msd: Improve packet validation error logging Nicholas Piggin
2025-04-11 8:04 ` [PATCH v2 05/10] usb/msd: Allow CBW packet size greater than 31 Nicholas Piggin
2025-04-11 8:04 ` [PATCH v2 06/10] usb/msd: Split async packet tracking into data and csw Nicholas Piggin
2025-04-11 8:04 ` [PATCH v2 07/10] usb/msd: Add some additional assertions Nicholas Piggin
2025-04-11 10:27 ` Philippe Mathieu-Daudé
2025-04-11 8:04 ` [PATCH v2 08/10] usb/msd: Rename mode to cbw_state, and tweak names Nicholas Piggin
2025-04-11 10:28 ` Philippe Mathieu-Daudé
2025-04-11 10:37 ` Philippe Mathieu-Daudé
2025-04-12 5:33 ` Nicholas Piggin
2025-04-11 8:04 ` [PATCH v2 09/10] usb/msd: Permit a DATA-IN or CSW packet before CBW packet Nicholas Piggin
2025-04-11 8:04 ` [PATCH v2 10/10] usb/msd: Add more tracing Nicholas Piggin
2025-04-11 10:36 ` Philippe Mathieu-Daudé [this message]
2025-04-12 5:33 ` Nicholas Piggin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5aba881b-a1bb-40fc-b707-2fd0d4b1a1d2@linaro.org \
--to=philmd@linaro.org \
--cc=kraxel@redhat.com \
--cc=kwolf@redhat.com \
--cc=npiggin@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).