mbox series

[v2,0/3] Release allocated periodic bandwidth data from reset_bandwidth()

Message ID 20201210104747.3416781-1-ikjn@chromium.org
Headers show
Series Release allocated periodic bandwidth data from reset_bandwidth() | expand

Message

Ikjoon Jang Dec. 10, 2020, 10:47 a.m. UTC
xhci-mtk releases allocated TT bandwidth data only when whole
endpoints of a device are dropped as there're only {add|drop}_endpoint()
hooks are defined. This patchset adds more hooks and releases all
bandwidth data from reset_bandwidth() path, not drop_endpoint().


Changes in v2:
- fix a 0-day warning from unused variable
- split one big patch into three patches
- bugfix in hw flags

Ikjoon Jang (3):
  usb: xhci-mtk: code cleanups in getting bandwidth table
  usb: xhci-mtk: delay association of tt and ep
  usb: xhci-mtk: fix unreleased bandwidth data

 drivers/usb/host/xhci-mtk-sch.c | 180 ++++++++++++++++++++------------
 drivers/usb/host/xhci-mtk.h     |  13 +++
 drivers/usb/host/xhci.c         |   9 ++
 3 files changed, 133 insertions(+), 69 deletions(-)

Comments

Greg KH Dec. 10, 2020, 10:58 a.m. UTC | #1
On Thu, Dec 10, 2020 at 06:47:47PM +0800, Ikjoon Jang wrote:
> xhci-mtk has hooks on add_endpoint() and drop_endpoint() from xhci
> to handle its own sw bandwidth managements and stores bandwidth data
> into internal table every time add_endpoint() is called,
> so when bandwidth allocation fails at one endpoint, all earlier
> allocation from the same interface could still remain at the table.
> 
> This patch adds two more hooks from check_bandwidth() and
> reset_bandwidth(), and make mtk-xhci to releases all failed endpoints
> from reset_bandwidth().
> 
> Fixes: 0cbd4b34cda9 ("xhci: mediatek: support MTK xHCI host controller")
> Signed-off-by: Ikjoon Jang <ikjn@chromium.org>

Shouldn't this be the first patch in the series?  You don't want a fix
to be dependent on code style changes, otherwise it is really really
hard to backport it to older kernels that might need this fix, right?

Can you re-order these patches please?

thanks,

greg k-h
Chunfeng Yun (云春峰) Dec. 11, 2020, 1:53 a.m. UTC | #2
On Thu, 2020-12-10 at 18:47 +0800, Ikjoon Jang wrote:
> xhci-mtk releases allocated TT bandwidth data only when whole

> endpoints of a device are dropped as there're only {add|drop}_endpoint()

> hooks are defined. This patchset adds more hooks and releases all

> bandwidth data from reset_bandwidth() path, not drop_endpoint().

> 

> 

> Changes in v2:

> - fix a 0-day warning from unused variable

> - split one big patch into three patches

> - bugfix in hw flags

> 

> Ikjoon Jang (3):

>   usb: xhci-mtk: code cleanups in getting bandwidth table

>   usb: xhci-mtk: delay association of tt and ep

>   usb: xhci-mtk: fix unreleased bandwidth data

> 

>  drivers/usb/host/xhci-mtk-sch.c | 180 ++++++++++++++++++++------------

>  drivers/usb/host/xhci-mtk.h     |  13 +++

>  drivers/usb/host/xhci.c         |   9 ++

>  3 files changed, 133 insertions(+), 69 deletions(-)

Thanks for your patch, I'll test it and check it with our DE

>
Ikjoon Jang Dec. 11, 2020, 6:27 a.m. UTC | #3
On Thu, Dec 10, 2020 at 6:57 PM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>

> On Thu, Dec 10, 2020 at 06:47:47PM +0800, Ikjoon Jang wrote:

> > xhci-mtk has hooks on add_endpoint() and drop_endpoint() from xhci

> > to handle its own sw bandwidth managements and stores bandwidth data

> > into internal table every time add_endpoint() is called,

> > so when bandwidth allocation fails at one endpoint, all earlier

> > allocation from the same interface could still remain at the table.

> >

> > This patch adds two more hooks from check_bandwidth() and

> > reset_bandwidth(), and make mtk-xhci to releases all failed endpoints

> > from reset_bandwidth().

> >

> > Fixes: 0cbd4b34cda9 ("xhci: mediatek: support MTK xHCI host controller")

> > Signed-off-by: Ikjoon Jang <ikjn@chromium.org>

>

> Shouldn't this be the first patch in the series?  You don't want a fix

> to be dependent on code style changes, otherwise it is really really

> hard to backport it to older kernels that might need this fix, right?


yes, you're right.

This patchset also requires
"4b0f7a77fb3c usb: xhci-mtk: supports bandwidth scheduling with multi-TT",
which doesn't have a Fixes tag.

I think I can change Fixes to point to that commit (4b0f7a77fb3c),
as this unreleased bandwidth data is much more impactful to
TT bandwidth.

Thanks!

>

> Can you re-order these patches please?

>

> thanks,

>

> greg k-h
Ikjoon Jang Dec. 11, 2020, 6:36 a.m. UTC | #4
On Fri, Dec 11, 2020 at 9:53 AM Chunfeng Yun <chunfeng.yun@mediatek.com> wrote:
>

> On Thu, 2020-12-10 at 18:47 +0800, Ikjoon Jang wrote:

> > xhci-mtk releases allocated TT bandwidth data only when whole

> > endpoints of a device are dropped as there're only {add|drop}_endpoint()

> > hooks are defined. This patchset adds more hooks and releases all

> > bandwidth data from reset_bandwidth() path, not drop_endpoint().

> >

> >

> > Changes in v2:

> > - fix a 0-day warning from unused variable

> > - split one big patch into three patches

> > - bugfix in hw flags

> >

> > Ikjoon Jang (3):

> >   usb: xhci-mtk: code cleanups in getting bandwidth table

> >   usb: xhci-mtk: delay association of tt and ep

> >   usb: xhci-mtk: fix unreleased bandwidth data

> >

> >  drivers/usb/host/xhci-mtk-sch.c | 180 ++++++++++++++++++++------------

> >  drivers/usb/host/xhci-mtk.h     |  13 +++

> >  drivers/usb/host/xhci.c         |   9 ++

> >  3 files changed, 133 insertions(+), 69 deletions(-)

> Thanks for your patch, I'll test it and check it with our DE


Thanks, I will upload v3.
But I don't expect any logic changes from v2.
Can you please give me feedback on v2 if you find anything?

>

> >

>
Chunfeng Yun (云春峰) Dec. 14, 2020, 3:24 a.m. UTC | #5
On Fri, 2020-12-11 at 14:36 +0800, Ikjoon Jang wrote:
> On Fri, Dec 11, 2020 at 9:53 AM Chunfeng Yun <chunfeng.yun@mediatek.com> wrote:

> >

> > On Thu, 2020-12-10 at 18:47 +0800, Ikjoon Jang wrote:

> > > xhci-mtk releases allocated TT bandwidth data only when whole

> > > endpoints of a device are dropped as there're only {add|drop}_endpoint()

> > > hooks are defined. This patchset adds more hooks and releases all

> > > bandwidth data from reset_bandwidth() path, not drop_endpoint().

> > >

> > >

> > > Changes in v2:

> > > - fix a 0-day warning from unused variable

> > > - split one big patch into three patches

> > > - bugfix in hw flags

> > >

> > > Ikjoon Jang (3):

> > >   usb: xhci-mtk: code cleanups in getting bandwidth table

> > >   usb: xhci-mtk: delay association of tt and ep

> > >   usb: xhci-mtk: fix unreleased bandwidth data

> > >

> > >  drivers/usb/host/xhci-mtk-sch.c | 180 ++++++++++++++++++++------------

> > >  drivers/usb/host/xhci-mtk.h     |  13 +++

> > >  drivers/usb/host/xhci.c         |   9 ++

> > >  3 files changed, 133 insertions(+), 69 deletions(-)

> > Thanks for your patch, I'll test it and check it with our DE

> 

> Thanks, I will upload v3.

> But I don't expect any logic changes from v2.

> Can you please give me feedback on v2 if you find anything?

Ok

> 

> >

> > >

> >