From: Felipe Balbi <balbi@kernel.org>
To: Anurag Kumar Vulisha <anuragku@xilinx.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Alan Stern <stern@rowland.harvard.edu>,
Johan Hovold <johan@kernel.org>,
Jaejoong Kim <climbbb.kim@gmail.com>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Roger Quadros <rogerq@ti.com>
Cc: "linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"v.anuragkumar@gmail.com" <v.anuragkumar@gmail.com>,
Thinh Nguyen <thinhn@synopsys.com>,
Tejas Joglekar <tejas.joglekar@synopsys.com>,
Ajay Yugalkishore Pandey <APANDEY@xilinx.com>
Subject: [V6,01/10] usb: gadget: udc: Add timer for stream capable endpoints
Date: Thu, 29 Nov 2018 14:51:32 +0200 [thread overview]
Message-ID: <87h8g0yrl7.fsf@linux.intel.com> (raw)
Hi,
Anurag Kumar Vulisha <anuragku@xilinx.com> writes:
>>> diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c
>>> index af88b48..41cc23b 100644
>>> --- a/drivers/usb/gadget/udc/core.c
>>> +++ b/drivers/usb/gadget/udc/core.c
>>> @@ -52,6 +52,24 @@ static int udc_bind_to_driver(struct usb_udc *udc,
>>> /* ------------------------------------------------------------------------- */
>>>
>>> /**
>>> + * usb_ep_stream_timeout - callback function for endpoint stream timeout timer
>>> + * @arg: pointer to struct timer_list
>>> + *
>>> + * This function gets called only when bulk streams are enabled in the endpoint
>>> + * and only after ep->stream_timeout_timer has expired. The timer gets expired
>>> + * only when the gadget controller failed to find a valid stream event for this
>>> + * endpoint. On timer expiry, this function calls the endpoint-specific timeout
>>> + * handler registered to endpoint ops->stream_timeout API.
>>> + */
>>> +static void usb_ep_stream_timeout(struct timer_list *arg)
>>> +{
>>> + struct usb_ep *ep = from_timer(ep, arg, stream_timeout_timer);
>>> +
>>> + if (ep->stream_capable && ep->ops->stream_timeout)
>>
>>why is the timer only for stream endpoints? What if we want to run this
>>on non-stream capable eps?
>>
>
> I have seen this issue only with stream capable eps between PRIME &
> EPRDY. But this issue can potentially occur with non-stream endpoints
> also. Will remove this stream capable checks in next series of patch.
you're adding support for transfer timeouts, which some gadgets may want
regardless of endpoint type. One use is to correct cases of streams
going out of sync.
>>> + ep->ops->stream_timeout(ep);
>>
>>you don't ned an extra operation here, ep_dequeue should be enough.
>>
>
> I think issuing ep_dequeue() would be more trickier than calling ep->ops->stream_timeout().
> This is because, every gadget driver has their own way of handling ep_dequeue. Some
> drivers (like dwc3) may sleep for an event (wait_event_lock_irq) in the ep_dequeue routine.
not anymore. There's, now, a requirement that ->dequeue can be called
from any context.
> Since we are calling ep_dequeue from timer timeout callback which is in softirq context,
> sleeping or waiting for an event would hang the system. Also adding ep->ops->stream_timeout()
> would make the gadget drivers handle the issue in better way based on their implementation.
no problems
> Another advantage is the drivers which doesn't have this timeout issue doesn't have to register the
> timeout handler and can avoid the logic of deleting the timer for every request. So, I think
> ep->ops->stream_timeout() would be better than having a generic handler which does
> ep_dequeue() & ep_queue(). Please provide your suggestion on this implementation.
call ep_dequeue()
WARNING: multiple messages have this Message-ID (diff)
From: Felipe Balbi <balbi@kernel.org>
To: Anurag Kumar Vulisha <anuragku@xilinx.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Alan Stern <stern@rowland.harvard.edu>,
Johan Hovold <johan@kernel.org>,
Jaejoong Kim <climbbb.kim@gmail.com>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Roger Quadros <rogerq@ti.com>
Cc: "linux-usb\@vger.kernel.org" <linux-usb@vger.kernel.org>,
"linux-kernel\@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"v.anuragkumar\@gmail.com" <v.anuragkumar@gmail.com>,
Thinh Nguyen <thinhn@synopsys.com>,
Tejas Joglekar <tejas.joglekar@synopsys.com>,
Ajay Yugalkishore Pandey <APANDEY@xilinx.com>
Subject: RE: [PATCH V6 01/10] usb: gadget: udc: Add timer for stream capable endpoints
Date: Thu, 29 Nov 2018 14:51:32 +0200 [thread overview]
Message-ID: <87h8g0yrl7.fsf@linux.intel.com> (raw)
In-Reply-To: <BL0PR02MB563317DEAFAD7C06B52FC23DA7D10@BL0PR02MB5633.namprd02.prod.outlook.com>
[-- Attachment #1: Type: text/plain, Size: 2893 bytes --]
Hi,
Anurag Kumar Vulisha <anuragku@xilinx.com> writes:
>>> diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c
>>> index af88b48..41cc23b 100644
>>> --- a/drivers/usb/gadget/udc/core.c
>>> +++ b/drivers/usb/gadget/udc/core.c
>>> @@ -52,6 +52,24 @@ static int udc_bind_to_driver(struct usb_udc *udc,
>>> /* ------------------------------------------------------------------------- */
>>>
>>> /**
>>> + * usb_ep_stream_timeout - callback function for endpoint stream timeout timer
>>> + * @arg: pointer to struct timer_list
>>> + *
>>> + * This function gets called only when bulk streams are enabled in the endpoint
>>> + * and only after ep->stream_timeout_timer has expired. The timer gets expired
>>> + * only when the gadget controller failed to find a valid stream event for this
>>> + * endpoint. On timer expiry, this function calls the endpoint-specific timeout
>>> + * handler registered to endpoint ops->stream_timeout API.
>>> + */
>>> +static void usb_ep_stream_timeout(struct timer_list *arg)
>>> +{
>>> + struct usb_ep *ep = from_timer(ep, arg, stream_timeout_timer);
>>> +
>>> + if (ep->stream_capable && ep->ops->stream_timeout)
>>
>>why is the timer only for stream endpoints? What if we want to run this
>>on non-stream capable eps?
>>
>
> I have seen this issue only with stream capable eps between PRIME &
> EPRDY. But this issue can potentially occur with non-stream endpoints
> also. Will remove this stream capable checks in next series of patch.
you're adding support for transfer timeouts, which some gadgets may want
regardless of endpoint type. One use is to correct cases of streams
going out of sync.
>>> + ep->ops->stream_timeout(ep);
>>
>>you don't ned an extra operation here, ep_dequeue should be enough.
>>
>
> I think issuing ep_dequeue() would be more trickier than calling ep->ops->stream_timeout().
> This is because, every gadget driver has their own way of handling ep_dequeue. Some
> drivers (like dwc3) may sleep for an event (wait_event_lock_irq) in the ep_dequeue routine.
not anymore. There's, now, a requirement that ->dequeue can be called
from any context.
> Since we are calling ep_dequeue from timer timeout callback which is in softirq context,
> sleeping or waiting for an event would hang the system. Also adding ep->ops->stream_timeout()
> would make the gadget drivers handle the issue in better way based on their implementation.
no problems
> Another advantage is the drivers which doesn't have this timeout issue doesn't have to register the
> timeout handler and can avoid the logic of deleting the timer for every request. So, I think
> ep->ops->stream_timeout() would be better than having a generic handler which does
> ep_dequeue() & ep_queue(). Please provide your suggestion on this implementation.
call ep_dequeue()
--
balbi
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
next reply other threads:[~2018-11-29 12:51 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-29 12:51 Felipe Balbi [this message]
2018-11-29 12:51 ` [PATCH V6 01/10] usb: gadget: udc: Add timer for stream capable endpoints Felipe Balbi
-- strict thread matches above, loose matches on Subject: below --
2018-11-29 15:51 [V6,01/10] " Anurag Kumar Vulisha
2018-11-29 15:51 ` [PATCH V6 01/10] " Anurag Kumar Vulisha
2018-11-28 16:15 [V6,01/10] " Anurag Kumar Vulisha
2018-11-28 16:15 ` [PATCH V6 01/10] " Anurag Kumar Vulisha
2018-11-14 13:57 [V6,01/10] " Felipe Balbi
2018-11-14 13:57 ` [PATCH V6 01/10] " Felipe Balbi
2018-10-13 13:14 [V6,10/10] usb: dwc3: Check MISSED ISOC bit only for ISOC endpoints Anurag Kumar Vulisha
2018-10-13 13:14 ` [PATCH V6 10/10] " Anurag Kumar Vulisha
2018-10-13 13:14 [V6,09/10] usb: dwc3: Check for IOC/LST bit in both event->status and TRB->ctrl fields Anurag Kumar Vulisha
2018-10-13 13:14 ` [PATCH V6 09/10] " Anurag Kumar Vulisha
2018-10-13 13:14 [V6,08/10] usb: dwc3: Correct the logic for checking TRB full in __dwc3_prepare_one_trb() Anurag Kumar Vulisha
2018-10-13 13:14 ` [PATCH V6 08/10] " Anurag Kumar Vulisha
2018-10-13 13:14 [V6,08/10] " Anurag Kumar Vulisha
2018-10-13 13:14 ` [PATCH V6 08/10] " Anurag Kumar Vulisha
2018-10-13 13:14 [V6,07/10] usb: dwc3: check for requests in started list for stream capable endpoints Anurag Kumar Vulisha
2018-10-13 13:14 ` [PATCH V6 07/10] " Anurag Kumar Vulisha
2018-10-13 13:14 [V6,06/10] usb: dwc3: don't issue no-op trb " Anurag Kumar Vulisha
2018-10-13 13:14 ` [PATCH V6 06/10] " Anurag Kumar Vulisha
2018-10-13 13:14 [V6,05/10] usb: dwc3: make controller clear transfer resources after complete Anurag Kumar Vulisha
2018-10-13 13:14 ` [PATCH V6 05/10] " Anurag Kumar Vulisha
2018-10-13 13:14 [V6,04/10] usb: dwc3: update stream id in depcmd Anurag Kumar Vulisha
2018-10-13 13:14 ` [PATCH V6 04/10] " Anurag Kumar Vulisha
2018-10-13 13:14 [V6,03/10] usb: dwc3: gadget: Remove references to dep->stream_capable Anurag Kumar Vulisha
2018-10-13 13:14 ` [PATCH V6 03/10] " Anurag Kumar Vulisha
2018-10-13 13:14 [V6,02/10] usb: dwc3: gadget: Add stream timeout handler for avoiding deadlock Anurag Kumar Vulisha
2018-10-13 13:14 ` [PATCH V6 02/10] " Anurag Kumar Vulisha
2018-10-13 13:14 [V6,01/10] usb: gadget: udc: Add timer for stream capable endpoints Anurag Kumar Vulisha
2018-10-13 13:14 ` [PATCH V6 01/10] " Anurag Kumar Vulisha
2018-10-13 13:14 [PATCH V6 00/10] usb: dwc3: Fix broken BULK stream support to dwc3 gadget driver Anurag Kumar Vulisha
2018-11-11 8:48 ` Anurag Kumar Vulisha
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=87h8g0yrl7.fsf@linux.intel.com \
--to=balbi@kernel.org \
--cc=APANDEY@xilinx.com \
--cc=anuragku@xilinx.com \
--cc=benh@kernel.crashing.org \
--cc=climbbb.kim@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=rogerq@ti.com \
--cc=stern@rowland.harvard.edu \
--cc=tejas.joglekar@synopsys.com \
--cc=thinhn@synopsys.com \
--cc=v.anuragkumar@gmail.com \
/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.