diff mbox series

usb: xhci-mtk: allow multiple Start-Split in a microframe

Message ID 1623895911-29259-1-git-send-email-chunfeng.yun@mediatek.com (mailing list archive)
State New, archived
Headers show
Series usb: xhci-mtk: allow multiple Start-Split in a microframe | expand

Commit Message

Chunfeng Yun (云春峰) June 17, 2021, 2:11 a.m. UTC
This patch is used to relax bandwidth schedule by allowing multiple
Start-Split in the same microframe.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/usb/host/xhci-mtk-sch.c | 16 ----------------
 drivers/usb/host/xhci-mtk.h     |  2 --
 2 files changed, 18 deletions(-)

Comments

kernel test robot June 17, 2021, 7:09 a.m. UTC | #1
Hi Chunfeng,

I love your patch! Perhaps something to improve:

[auto build test WARNING on usb/usb-testing]
[also build test WARNING on v5.13-rc6 next-20210616]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Chunfeng-Yun/usb-xhci-mtk-allow-multiple-Start-Split-in-a-microframe/20210617-101730
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: arc-allyesconfig (attached as .config)
compiler: arceb-elf-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/1417adf315cfee06ef79bd1e34266e9098863b5c
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Chunfeng-Yun/usb-xhci-mtk-allow-multiple-Start-Split-in-a-microframe/20210617-101730
        git checkout 1417adf315cfee06ef79bd1e34266e9098863b5c
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   drivers/usb/host/xhci-mtk-sch.c: In function 'update_sch_tt':
>> drivers/usb/host/xhci-mtk-sch.c:538:6: warning: variable 'bits' set but not used [-Wunused-but-set-variable]
     538 |  int bits;
         |      ^~~~


vim +/bits +538 drivers/usb/host/xhci-mtk-sch.c

08e469de87a253 Chunfeng Yun 2018-09-20  532  
6009bea08ad79c Chunfeng Yun 2021-03-08  533  static void update_sch_tt(struct mu3h_sch_ep_info *sch_ep, bool used)
08e469de87a253 Chunfeng Yun 2018-09-20  534  {
08e469de87a253 Chunfeng Yun 2018-09-20  535  	struct mu3h_sch_tt *tt = sch_ep->sch_tt;
08e469de87a253 Chunfeng Yun 2018-09-20  536  	u32 base, num_esit;
e19ee44a3d07c2 Chunfeng Yun 2021-03-08  537  	int bw_updated;
e19ee44a3d07c2 Chunfeng Yun 2021-03-08 @538  	int bits;
08e469de87a253 Chunfeng Yun 2018-09-20  539  	int i, j;
08e469de87a253 Chunfeng Yun 2018-09-20  540  
08e469de87a253 Chunfeng Yun 2018-09-20  541  	num_esit = XHCI_MTK_MAX_ESIT / sch_ep->esit;
e19ee44a3d07c2 Chunfeng Yun 2021-03-08  542  	bits = (sch_ep->ep_type == ISOC_OUT_EP) ? sch_ep->cs_count : 1;
e19ee44a3d07c2 Chunfeng Yun 2021-03-08  543  
e19ee44a3d07c2 Chunfeng Yun 2021-03-08  544  	if (used)
e19ee44a3d07c2 Chunfeng Yun 2021-03-08  545  		bw_updated = sch_ep->bw_cost_per_microframe;
e19ee44a3d07c2 Chunfeng Yun 2021-03-08  546  	else
e19ee44a3d07c2 Chunfeng Yun 2021-03-08  547  		bw_updated = -sch_ep->bw_cost_per_microframe;
e19ee44a3d07c2 Chunfeng Yun 2021-03-08  548  
08e469de87a253 Chunfeng Yun 2018-09-20  549  	for (i = 0; i < num_esit; i++) {
08e469de87a253 Chunfeng Yun 2018-09-20  550  		base = sch_ep->offset + i * sch_ep->esit;
e19ee44a3d07c2 Chunfeng Yun 2021-03-08  551  
e19ee44a3d07c2 Chunfeng Yun 2021-03-08  552  		for (j = 0; j < sch_ep->cs_count; j++)
e19ee44a3d07c2 Chunfeng Yun 2021-03-08  553  			tt->fs_bus_bw[base + j] += bw_updated;
08e469de87a253 Chunfeng Yun 2018-09-20  554  	}
08e469de87a253 Chunfeng Yun 2018-09-20  555  
e19ee44a3d07c2 Chunfeng Yun 2021-03-08  556  	if (used)
08e469de87a253 Chunfeng Yun 2018-09-20  557  		list_add_tail(&sch_ep->tt_endpoint, &tt->ep_list);
e19ee44a3d07c2 Chunfeng Yun 2021-03-08  558  	else
e19ee44a3d07c2 Chunfeng Yun 2021-03-08  559  		list_del(&sch_ep->tt_endpoint);
08e469de87a253 Chunfeng Yun 2018-09-20  560  }
08e469de87a253 Chunfeng Yun 2018-09-20  561  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Greg KH June 17, 2021, 1:31 p.m. UTC | #2
On Thu, Jun 17, 2021 at 10:11:51AM +0800, Chunfeng Yun wrote:
> This patch is used to relax bandwidth schedule by allowing multiple
> Start-Split in the same microframe.
> 
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> ---
>  drivers/usb/host/xhci-mtk-sch.c | 16 ----------------
>  drivers/usb/host/xhci-mtk.h     |  2 --
>  2 files changed, 18 deletions(-)
> 
> diff --git a/drivers/usb/host/xhci-mtk-sch.c b/drivers/usb/host/xhci-mtk-sch.c
> index c07411d9b16f..149a0f4a6ec4 100644
> --- a/drivers/usb/host/xhci-mtk-sch.c
> +++ b/drivers/usb/host/xhci-mtk-sch.c
> @@ -470,11 +470,9 @@ static int check_fs_bus_bw(struct mu3h_sch_ep_info *sch_ep, int offset)
>  
>  static int check_sch_tt(struct mu3h_sch_ep_info *sch_ep, u32 offset)
>  {
> -	struct mu3h_sch_tt *tt = sch_ep->sch_tt;
>  	u32 extra_cs_count;
>  	u32 start_ss, last_ss;
>  	u32 start_cs, last_cs;
> -	int i;
>  
>  	if (!sch_ep->sch_tt)
>  		return 0;
> @@ -491,10 +489,6 @@ static int check_sch_tt(struct mu3h_sch_ep_info *sch_ep, u32 offset)
>  		if (!(start_ss == 7 || last_ss < 6))
>  			return -ESCH_SS_Y6;
>  
> -		for (i = 0; i < sch_ep->cs_count; i++)
> -			if (test_bit(offset + i, tt->ss_bit_map))
> -				return -ESCH_SS_OVERLAP;
> -
>  	} else {
>  		u32 cs_count = DIV_ROUND_UP(sch_ep->maxpkt, FS_PAYLOAD_MAX);
>  
> @@ -521,9 +515,6 @@ static int check_sch_tt(struct mu3h_sch_ep_info *sch_ep, u32 offset)
>  		if (cs_count > 7)
>  			cs_count = 7; /* HW limit */
>  
> -		if (test_bit(offset, tt->ss_bit_map))
> -			return -ESCH_SS_OVERLAP;
> -
>  		sch_ep->cs_count = cs_count;
>  		/* one for ss, the other for idle */
>  		sch_ep->num_budget_microframes = cs_count + 2;
> @@ -558,13 +549,6 @@ static void update_sch_tt(struct mu3h_sch_ep_info *sch_ep, bool used)
>  	for (i = 0; i < num_esit; i++) {
>  		base = sch_ep->offset + i * sch_ep->esit;
>  
> -		for (j = 0; j < bits; j++) {

Now that bits is no longer used, we get a build warning.

Can you fix this patch and resend it?

thanks,

greg k-h
Chunfeng Yun (云春峰) June 18, 2021, 5:15 a.m. UTC | #3
On Thu, 2021-06-17 at 15:31 +0200, Greg Kroah-Hartman wrote:
> On Thu, Jun 17, 2021 at 10:11:51AM +0800, Chunfeng Yun wrote:
> > This patch is used to relax bandwidth schedule by allowing multiple
> > Start-Split in the same microframe.
> > 
> > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> > ---
> >  drivers/usb/host/xhci-mtk-sch.c | 16 ----------------
> >  drivers/usb/host/xhci-mtk.h     |  2 --
> >  2 files changed, 18 deletions(-)
> > 
> > diff --git a/drivers/usb/host/xhci-mtk-sch.c b/drivers/usb/host/xhci-mtk-sch.c
> > index c07411d9b16f..149a0f4a6ec4 100644
> > --- a/drivers/usb/host/xhci-mtk-sch.c
> > +++ b/drivers/usb/host/xhci-mtk-sch.c
> > @@ -470,11 +470,9 @@ static int check_fs_bus_bw(struct mu3h_sch_ep_info *sch_ep, int offset)
> >  
> >  static int check_sch_tt(struct mu3h_sch_ep_info *sch_ep, u32 offset)
> >  {
> > -	struct mu3h_sch_tt *tt = sch_ep->sch_tt;
> >  	u32 extra_cs_count;
> >  	u32 start_ss, last_ss;
> >  	u32 start_cs, last_cs;
> > -	int i;
> >  
> >  	if (!sch_ep->sch_tt)
> >  		return 0;
> > @@ -491,10 +489,6 @@ static int check_sch_tt(struct mu3h_sch_ep_info *sch_ep, u32 offset)
> >  		if (!(start_ss == 7 || last_ss < 6))
> >  			return -ESCH_SS_Y6;
> >  
> > -		for (i = 0; i < sch_ep->cs_count; i++)
> > -			if (test_bit(offset + i, tt->ss_bit_map))
> > -				return -ESCH_SS_OVERLAP;
> > -
> >  	} else {
> >  		u32 cs_count = DIV_ROUND_UP(sch_ep->maxpkt, FS_PAYLOAD_MAX);
> >  
> > @@ -521,9 +515,6 @@ static int check_sch_tt(struct mu3h_sch_ep_info *sch_ep, u32 offset)
> >  		if (cs_count > 7)
> >  			cs_count = 7; /* HW limit */
> >  
> > -		if (test_bit(offset, tt->ss_bit_map))
> > -			return -ESCH_SS_OVERLAP;
> > -
> >  		sch_ep->cs_count = cs_count;
> >  		/* one for ss, the other for idle */
> >  		sch_ep->num_budget_microframes = cs_count + 2;
> > @@ -558,13 +549,6 @@ static void update_sch_tt(struct mu3h_sch_ep_info *sch_ep, bool used)
> >  	for (i = 0; i < num_esit; i++) {
> >  		base = sch_ep->offset + i * sch_ep->esit;
> >  
> > -		for (j = 0; j < bits; j++) {
> 
> Now that bits is no longer used, we get a build warning.
> 
> Can you fix this patch and resend it?
Ok, thanks

> 
> thanks,
> 
> greg k-h
diff mbox series

Patch

diff --git a/drivers/usb/host/xhci-mtk-sch.c b/drivers/usb/host/xhci-mtk-sch.c
index c07411d9b16f..149a0f4a6ec4 100644
--- a/drivers/usb/host/xhci-mtk-sch.c
+++ b/drivers/usb/host/xhci-mtk-sch.c
@@ -470,11 +470,9 @@  static int check_fs_bus_bw(struct mu3h_sch_ep_info *sch_ep, int offset)
 
 static int check_sch_tt(struct mu3h_sch_ep_info *sch_ep, u32 offset)
 {
-	struct mu3h_sch_tt *tt = sch_ep->sch_tt;
 	u32 extra_cs_count;
 	u32 start_ss, last_ss;
 	u32 start_cs, last_cs;
-	int i;
 
 	if (!sch_ep->sch_tt)
 		return 0;
@@ -491,10 +489,6 @@  static int check_sch_tt(struct mu3h_sch_ep_info *sch_ep, u32 offset)
 		if (!(start_ss == 7 || last_ss < 6))
 			return -ESCH_SS_Y6;
 
-		for (i = 0; i < sch_ep->cs_count; i++)
-			if (test_bit(offset + i, tt->ss_bit_map))
-				return -ESCH_SS_OVERLAP;
-
 	} else {
 		u32 cs_count = DIV_ROUND_UP(sch_ep->maxpkt, FS_PAYLOAD_MAX);
 
@@ -521,9 +515,6 @@  static int check_sch_tt(struct mu3h_sch_ep_info *sch_ep, u32 offset)
 		if (cs_count > 7)
 			cs_count = 7; /* HW limit */
 
-		if (test_bit(offset, tt->ss_bit_map))
-			return -ESCH_SS_OVERLAP;
-
 		sch_ep->cs_count = cs_count;
 		/* one for ss, the other for idle */
 		sch_ep->num_budget_microframes = cs_count + 2;
@@ -558,13 +549,6 @@  static void update_sch_tt(struct mu3h_sch_ep_info *sch_ep, bool used)
 	for (i = 0; i < num_esit; i++) {
 		base = sch_ep->offset + i * sch_ep->esit;
 
-		for (j = 0; j < bits; j++) {
-			if (used)
-				set_bit(base + j, tt->ss_bit_map);
-			else
-				clear_bit(base + j, tt->ss_bit_map);
-		}
-
 		for (j = 0; j < sch_ep->cs_count; j++)
 			tt->fs_bus_bw[base + j] += bw_updated;
 	}
diff --git a/drivers/usb/host/xhci-mtk.h b/drivers/usb/host/xhci-mtk.h
index cd3a37bb73e6..390cb5a86082 100644
--- a/drivers/usb/host/xhci-mtk.h
+++ b/drivers/usb/host/xhci-mtk.h
@@ -24,12 +24,10 @@ 
 #define XHCI_MTK_MAX_ESIT	64
 
 /**
- * @ss_bit_map: used to avoid start split microframes overlay
  * @fs_bus_bw: array to keep track of bandwidth already used for FS
  * @ep_list: Endpoints using this TT
  */
 struct mu3h_sch_tt {
-	DECLARE_BITMAP(ss_bit_map, XHCI_MTK_MAX_ESIT);
 	u32 fs_bus_bw[XHCI_MTK_MAX_ESIT];
 	struct list_head ep_list;
 };