From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Cc: Felipe Balbi <balbi@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Dmitry Bogdanov <d.bogdanov@yadro.com>,
"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
"target-devel@vger.kernel.org" <target-devel@vger.kernel.org>
Subject: Re: [PATCH v2 11/25] usb: gadget: f_tcm: Execute command on write completion
Date: Mon, 29 Aug 2022 21:49:19 +0200 [thread overview]
Message-ID: <Yw0YP1qUYAw6inMJ@linutronix.de> (raw)
In-Reply-To: <20220826183732.vxogtdlwqiqbcg2t@synopsys.com>
On 2022-08-26 18:37:36 [+0000], Thinh Nguyen wrote:
> On Fri, Aug 26, 2022, Sebastian Andrzej Siewior wrote:
> > On 2022-07-18 18:27:12 [-0700], Thinh Nguyen wrote:
> > > index 6fea80afe2d7..ec83f2f9a858 100644
> > > --- a/drivers/usb/gadget/function/f_tcm.c
> > > +++ b/drivers/usb/gadget/function/f_tcm.c
> > > @@ -955,7 +949,7 @@ static void usbg_data_write_cmpl(struct usb_ep *ep, struct usb_request *req)
> > > se_cmd->data_length);
> > > }
> > >
> > > - complete(&cmd->write_complete);
> > > + target_execute_cmd(se_cmd);
> >
> > usbg_data_write_cmpl() is invoked from interrupt service routing which
> > may run with disabled interrupts. From looking at target_execute_cmd():
>
> It will always be called with interrupts disabled as documented in
> usb_request API.
>
> > | void target_execute_cmd(struct se_cmd *cmd)
> > | {
> > …
> > | spin_lock_irq(&cmd->t_state_lock);
> > …
> > | spin_unlock_irq(&cmd->t_state_lock);
> > …
> > | }
> >
> > which means interrupts will remain open after leaving
> > target_execute_cmd(). Now, why didn't the WARN_ONCE() in
> > __handle_irq_event_percpu() trigger? Am I missing something?
> >
> > > return;
> >
>
> Since target_execute_cmd() is called in usbg_data_write_cmpl(),
> interrupts are still disabled.
but you do realize that target_execute_cmd() will leave with enabled
interrupts and this is not desired? I _think_ this was the reason why I
ended up with the wait+complete construct instead of invoking this
function directly.
An _irqsave() in target_execute_cmd() would probably be all you need
here.
> Thanks,
> Thinh
Sebastian
next prev parent reply other threads:[~2022-08-29 19:49 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-19 1:26 [PATCH v2 00/25] usb: gadget: f_tcm: Enhance UASP driver Thinh Nguyen
2022-07-19 1:26 ` [PATCH v2 01/25] target: Add overlapped response to tmrsp_table Thinh Nguyen
2022-07-19 1:26 ` [PATCH v2 02/25] target: Add common TMR enum Thinh Nguyen
2022-07-19 1:26 ` [PATCH v2 03/25] usb: gadget: f_tcm: Increase stream count Thinh Nguyen
2022-07-19 9:02 ` Sergei Shtylyov
2022-07-19 1:26 ` [PATCH v2 04/25] usb: gadget: f_tcm: Increase bMaxBurst Thinh Nguyen
2022-07-19 1:26 ` [PATCH v2 05/25] usb: gadget: f_tcm: Don't set static stream_id Thinh Nguyen
2022-07-19 1:26 ` [PATCH v2 06/25] usb: gadget: f_tcm: Allocate matching number of commands to streams Thinh Nguyen
2022-07-19 1:26 ` [PATCH v2 07/25] usb: gadget: f_tcm: Limit number of sessions Thinh Nguyen
2022-07-19 1:26 ` [PATCH v2 08/25] usb: gadget: f_tcm: Handle multiple commands in parallel Thinh Nguyen
2022-07-19 1:27 ` [PATCH v2 09/25] usb: gadget: f_tcm: Use extra number of commands Thinh Nguyen
2022-07-19 1:27 ` [PATCH v2 10/25] usb: gadget: f_tcm: Return ATA cmd direction Thinh Nguyen
2022-07-19 1:27 ` [PATCH v2 11/25] usb: gadget: f_tcm: Execute command on write completion Thinh Nguyen
2022-08-26 7:00 ` Sebastian Andrzej Siewior
2022-08-26 18:37 ` Thinh Nguyen
2022-08-29 19:49 ` Sebastian Andrzej Siewior [this message]
2022-08-29 21:47 ` Thinh Nguyen
2022-08-30 10:03 ` Sebastian Andrzej Siewior
2022-07-19 1:27 ` [PATCH v2 12/25] usb: gadget: f_tcm: Minor cleanup redundant code Thinh Nguyen
2022-07-19 1:27 ` [PATCH v2 13/25] usb: gadget: f_tcm: Don't free command immediately Thinh Nguyen
2022-07-19 1:27 ` [PATCH v2 14/25] usb: gadget: f_tcm: Translate error to sense Thinh Nguyen
2022-07-19 1:27 ` [PATCH v2 15/25] usb: gadget: f_tcm: Cleanup unused variable Thinh Nguyen
2022-08-26 7:17 ` Sebastian Andrzej Siewior
2022-08-26 18:41 ` Thinh Nguyen
2022-07-19 1:27 ` [PATCH v2 16/25] usb: gadget: f_tcm: Update state on data write Thinh Nguyen
2022-08-26 7:22 ` Sebastian Andrzej Siewior
2022-08-26 19:01 ` Thinh Nguyen
2022-07-19 1:27 ` [PATCH v2 17/25] usb: gadget: f_tcm: Handle abort command Thinh Nguyen
2022-08-26 7:48 ` Sebastian Andrzej Siewior
2022-08-26 19:04 ` Thinh Nguyen
2022-07-19 1:27 ` [PATCH v2 18/25] usb: gadget: f_tcm: Cleanup requests on ep disable Thinh Nguyen
2022-07-19 1:28 ` [PATCH v2 19/25] usb: gadget: f_tcm: Decrement command ref count on cleanup Thinh Nguyen
2022-07-19 1:28 ` [PATCH v2 20/25] usb: gadget: f_tcm: Save CPU ID per command Thinh Nguyen
2022-07-19 1:28 ` [PATCH v2 21/25] usb: gadget: f_tcm: Get stream by tag Thinh Nguyen
2022-08-26 9:06 ` Sebastian Andrzej Siewior
2022-08-26 19:05 ` Thinh Nguyen
2022-07-19 1:28 ` [PATCH v2 22/25] usb: gadget: f_tcm: Send sense on cancelled transfer Thinh Nguyen
2022-07-19 1:28 ` [PATCH v2 23/25] usb: gadget: f_tcm: Handle TASK_MANAGEMENT commands Thinh Nguyen
2022-07-19 1:28 ` [PATCH v2 24/25] usb: gadget: f_tcm: Check overlapped command Thinh Nguyen
2022-08-26 10:46 ` Sebastian Andrzej Siewior
2022-08-26 19:27 ` Thinh Nguyen
2022-07-19 1:28 ` [PATCH v2 25/25] usb: gadget: f_tcm: Comply with UAS Task Management requirement Thinh Nguyen
2022-08-19 8:31 ` [PATCH v2 00/25] usb: gadget: f_tcm: Enhance UASP driver Greg Kroah-Hartman
2022-08-19 17:18 ` Thinh Nguyen
2022-08-26 2:34 ` Thinh Nguyen
2022-08-26 10:52 ` Sebastian Andrzej Siewior
2022-08-26 19:36 ` 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=Yw0YP1qUYAw6inMJ@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=Thinh.Nguyen@synopsys.com \
--cc=balbi@kernel.org \
--cc=d.bogdanov@yadro.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=target-devel@vger.kernel.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 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.