From: x0082077@ti.com (Maulik)
To: linux-arm-kernel@lists.infradead.org
Subject: Issue with file transfers to a mass storage device on SMP system
Date: Tue, 27 Jul 2010 12:04:39 +0530 [thread overview]
Message-ID: <00e601cb2d55$cb6253c0$808918ac@apr.dhcp.ti.com> (raw)
Hello,
I am working on OMAP4 which has two ARM Cortex A9 microprocessors (SMP
system) with 2.6.35-rc5 kernel.
I have an issue whereby transferring a large file (>20MB) over USB (OMAP
Mentor USB controller acts as USB host) to an attached USB thumb drive
fails.
The USB analyzer trace shows that the 31 bytes CBW packet is corrupted and
device responds with a STALL when this issue occurs.
Further it was found that the CBWCB field (the last 16 bytes which contains
the command to be executed by the device) of the CBW packet was Zero in the
failure case. Also the first 15 bytes of the CBW packet contained valid
data.
The code snippet below from usb_stor_Bulk_transport () in
drivers/usb/storage/transport.c looks to be a problem area.
/* copy the command payload */
memset(bcb->CDB, 0, sizeof(bcb->CDB));
memcpy(bcb->CDB, srb->cmnd, bcb->Length);
Looks like when the issue occurs the memory (bcb->CDB) is not yet updated
due to likely out of order execution due to SMP.
I have tried below workarounds that fixes the issue.
(1)Enabling debug prints / adding delays fixes the issue.
(2)Using nosmp in bootargs i.e. disabling SMP fixes the issue.
(3)Using wmb() (Write memory barrier) before starting DMA transfer in MUSB
driver fixes the issue.
(4)Using wmb() for only 31 bytes CBW packets after the memcpy(in storage
stack (transport.c)) fixes the issue.
(5)Checking if last 16 bytes (of the 31 bytes CBW packet) are Zero or not
after the memcpy() also fixes the issue. i.e if you read back the memory,
the memory seems to be updated.
Has anyone seen such issue on a SMP system?
Please comment on the need and the usage of a memory barrier in this case.
Thanks,
Maulik
next reply other threads:[~2010-07-27 6:34 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-27 6:34 Maulik [this message]
2010-07-27 7:05 ` Issue with file transfers to a mass storage device on SMP system Ming Lei
2010-07-27 9:38 ` Shilimkar, Santosh
2010-07-27 10:01 ` Russell King - ARM Linux
2010-07-27 10:19 ` Shilimkar, Santosh
2010-07-27 10:41 ` Russell King - ARM Linux
2010-07-27 12:00 ` Shilimkar, Santosh
2010-07-27 13:45 ` Shilimkar, Santosh
2010-07-27 13:59 ` Russell King - ARM Linux
2010-07-27 14:14 ` Shilimkar, Santosh
2010-07-27 14:21 ` Russell King - ARM Linux
2010-07-27 14:29 ` Shilimkar, Santosh
2010-07-27 16:07 ` Russell King - ARM Linux
2010-07-28 5:15 ` Shilimkar, Santosh
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='00e601cb2d55$cb6253c0$808918ac@apr.dhcp.ti.com' \
--to=x0082077@ti.com \
--cc=linux-arm-kernel@lists.infradead.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