From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: Felipe Balbi <balbi@kernel.org>,
Alan Stern <stern@rowland.harvard.edu>,
USB <linux-usb@vger.kernel.org>
Subject: dwc3 spin_lock_irq flags
Date: Tue, 10 Aug 2021 22:10:00 +0000 [thread overview]
Message-ID: <a034f2ef-c2a3-962e-d72b-0db6a34e67a2@synopsys.com> (raw)
Hi,
Typically when we use spin_lock_irqsave and spin_unlock_irqrestore,
we save the irq state in the "flags" variable and pass it down to any
function that may need to do spin_unlock_irqrestore and update the flags
again.
I don't see that we're doing it for dwc3 when we give back the requests:
void dwc3_gadget_giveback(struct dwc3_ep *dep, struct dwc3_request *req,
int status)
{
struct dwc3 *dwc = dep->dwc;
dwc3_gadget_del_and_unmap_request(dep, req, status);
req->status = DWC3_REQUEST_STATUS_COMPLETED;
spin_unlock(&dwc->lock);
usb_gadget_giveback_request(&dep->endpoint, &req->request);
spin_lock(&dwc->lock);
}
Then we would use the stale "flags" to do spin_unlock_irqrestore() at a later
time. Maybe someone can help shed some light on what issue this would cause
(if any). From our hardware testing, there's no obvious failure or performance
impact that we see.
Thanks,
Thinh
next reply other threads:[~2021-08-10 22:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-10 22:10 Thinh Nguyen [this message]
2021-08-11 1:51 ` dwc3 spin_lock_irq flags Alan Stern
2021-08-11 2:20 ` Thinh Nguyen
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=a034f2ef-c2a3-962e-d72b-0db6a34e67a2@synopsys.com \
--to=thinh.nguyen@synopsys.com \
--cc=balbi@kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
/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