Bug 2643 - Add patch to fix URB giveback issue in tasklet function
Summary: Add patch to fix URB giveback issue in tasklet function
Status: RESOLVED FIXED
Alias: None
Product: ANCK 4.19 Dev
Classification: ANCK
Component: drivers (show other bugs) drivers
Version: unspecified
Hardware: All Linux
: P3-Medium S3-normal
Target Milestone: ---
Assignee: GuixinLiu
QA Contact: shuming
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-10-27 19:01 UTC by LeoLiu-oc
Modified: 2023-01-17 15:12 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description LeoLiu-oc zhaoxin_group 2022-10-27 19:01:27 UTC
Description of problem:
Usb core introduce the mechanism of giveback of URB in tasklet context to
reduce hardware interrupt handling time. On some test situation(such as
FIO with 4KB block size), when tasklet callback function called to
giveback URB, interrupt handler add URB node to the bh->head list also.
If check bh->head list again after finish all URB giveback of local_list,
then it may introduce a "dynamic balance" between giveback URB and add URB
to bh->head list. This tasklet callback function may not exit for a long
time, which will cause other tasklet function calls to be delayed. Some
real-time applications(such as KB and Mouse) will see noticeable lag.

In order to prevent the tasklet function from occupying the cpu for a long
time at a time, new URBS will not be added to the local_list even though
the bh->head list is not empty. But also need to ensure the left URB
giveback to be processed in time, so add a member high_prio for structure
giveback_urb_bh to prioritize tasklet and schelule this tasklet again if
bh->head list is not empty.

At the same time, we are able to prioritize tasklet through structure
member high_prio. So, replace the local high_prio_bh variable with this
structure member in usb_hcd_giveback_urb.


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
FIO/Iometer test:
Test with Block size=4K, random read with libaio, and device performance>400 MB/s(better performance is recommended) . for example: Plextor EX1 128G, Asmedia usb3.1 gen+Samsung 960 SSD


Actual results:
Without this patch, you can see the noticeable lag of usb mouse or keyboard.

Expected results:
With this patch, Mouse and keyboard will not has any lag.

Additional info:
Comment 1 maqiao alibaba_cloud_group 2023-01-17 15:12:08 UTC
merged: https://gitee.com/anolis/cloud-kernel/pulls/805