Message ID | 1617954422-36617-1-git-send-email-liulongfang@huawei.com |
---|---|
State | New |
Headers | show |
Series | [v2] USB:ohci:fix ohci interruption problem | expand |
Hi Longfang, Thank you for the patch! Yet something to improve: [auto build test ERROR on usb/usb-testing] [also build test ERROR on v5.12-rc6 next-20210409] [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/Longfang-Liu/USB-ohci-fix-ohci-interruption-problem/20210409-155150 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing config: i386-randconfig-a012-20210411 (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 reproduce (this is a W=1 build): # https://github.com/0day-ci/linux/commit/fa57a31f84453b32378ba3d1410e7a549b5d397d git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Longfang-Liu/USB-ohci-fix-ohci-interruption-problem/20210409-155150 git checkout fa57a31f84453b32378ba3d1410e7a549b5d397d # save the attached .config to linux build tree make W=1 ARCH=i386 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): >> drivers/usb/core/hcd-pci.c:624:13: error: 'hcd_pci_freeze' undeclared here (not in a function); did you mean 'hcd_pci_resume'? 624 | .freeze = hcd_pci_freeze, | ^~~~~~~~~~~~~~ | hcd_pci_resume vim +624 drivers/usb/core/hcd-pci.c 618 619 const struct dev_pm_ops usb_hcd_pci_pm_ops = { 620 .suspend = hcd_pci_suspend, 621 .suspend_noirq = hcd_pci_suspend_noirq, 622 .resume_noirq = hcd_pci_resume_noirq, 623 .resume = hcd_pci_resume, > 624 .freeze = hcd_pci_freeze, 625 .freeze_noirq = check_root_hub_suspended, 626 .thaw_noirq = NULL, 627 .thaw = NULL, 628 .poweroff = hcd_pci_suspend, 629 .poweroff_noirq = hcd_pci_suspend_noirq, 630 .restore_noirq = hcd_pci_resume_noirq, 631 .restore = hcd_pci_restore, 632 .runtime_suspend = hcd_pci_runtime_suspend, 633 .runtime_resume = hcd_pci_runtime_resume, 634 }; 635 EXPORT_SYMBOL_GPL(usb_hcd_pci_pm_ops); 636 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
On 2021/4/9 23:07, Alan Stern wrote: > On Fri, Apr 09, 2021 at 03:47:02PM +0800, Longfang Liu wrote: >> The operating method of the system entering S4 sleep mode: >> echo reboot > /sys/power/disk >> echo disk > /sys/power/state >> >> When OHCI enters the S4 sleep state, check the log and find that >> the USB sleep process will call check_root_hub_suspend() and >> ohci_bus_suspend() instead ohci_suspend() and ohci_bus_suspend(), >> which will cause the OHCI interrupt to not be closed. >> >> At this time, if just one device interrupt is reported. the >> driver will not process and close this device interrupt. It will cause >> the entire system to be stuck during sleep, causing the device to >> fail to respond. >> >> When the abnormal interruption reaches 100,000 times, the system will >> forcibly close the interruption and make the device unusable. >> >> Because the root cause of the problem is that ohci_suspend is not >> called to perform normal interrupt shutdown operations when the system >> enters S4 sleep mode. >> >> Therefore, our solution is to specify freeze interface in this mode to >> perform normal suspend_common() operations, and call ohci_suspend() >> after check_root_hub_suspend() is executed through the suspend_common() >> operation. >> >> Signed-off-by: Longfang Liu <liulongfang@huawei.com> >> --- >> >> Changes in V2: >> - Modify comment and patch version information. > > Please, instead of sending the same incorrect patch over and over again, > spend some time figuring out what is really going wrong. I have already > explained why this patch is not the right thing to do. > > You have to determine why the poweroff callback in hcd-pci.c (which > points to hcd_pci_suspend) isn't getting called. That's the real > explanation for your problem. > > Alan Stern > Ok! I need to analyze the PCI device sleep and wake process to see why it will not be called. Thanks, Longfang. >> Changes in V1: >> - Call suspend_common by adding the hcd_pci_freeze function turn off >> the interrupt instead of adding a shutdown operation in ohci_bus_suspend >> to turn off the interrupt. >> >> drivers/usb/core/hcd-pci.c | 7 ++++++- >> 1 file changed, 6 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c >> index 1547aa6..c5844a3 100644 >> --- a/drivers/usb/core/hcd-pci.c >> +++ b/drivers/usb/core/hcd-pci.c >> @@ -509,6 +509,11 @@ static int resume_common(struct device *dev, int event) >> >> #ifdef CONFIG_PM_SLEEP >> >> +static int hcd_pci_freeze(struct device *dev) >> +{ >> + return suspend_common(dev, device_may_wakeup(dev)); >> +} >> + >> static int hcd_pci_suspend(struct device *dev) >> { >> return suspend_common(dev, device_may_wakeup(dev)); >> @@ -605,7 +610,7 @@ const struct dev_pm_ops usb_hcd_pci_pm_ops = { >> .suspend_noirq = hcd_pci_suspend_noirq, >> .resume_noirq = hcd_pci_resume_noirq, >> .resume = hcd_pci_resume, >> - .freeze = check_root_hub_suspended, >> + .freeze = hcd_pci_freeze, >> .freeze_noirq = check_root_hub_suspended, >> .thaw_noirq = NULL, >> .thaw = NULL, >> -- >> 2.8.1 >> > . >
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index 1547aa6..c5844a3 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c @@ -509,6 +509,11 @@ static int resume_common(struct device *dev, int event) #ifdef CONFIG_PM_SLEEP +static int hcd_pci_freeze(struct device *dev) +{ + return suspend_common(dev, device_may_wakeup(dev)); +} + static int hcd_pci_suspend(struct device *dev) { return suspend_common(dev, device_may_wakeup(dev)); @@ -605,7 +610,7 @@ const struct dev_pm_ops usb_hcd_pci_pm_ops = { .suspend_noirq = hcd_pci_suspend_noirq, .resume_noirq = hcd_pci_resume_noirq, .resume = hcd_pci_resume, - .freeze = check_root_hub_suspended, + .freeze = hcd_pci_freeze, .freeze_noirq = check_root_hub_suspended, .thaw_noirq = NULL, .thaw = NULL,
The operating method of the system entering S4 sleep mode: echo reboot > /sys/power/disk echo disk > /sys/power/state When OHCI enters the S4 sleep state, check the log and find that the USB sleep process will call check_root_hub_suspend() and ohci_bus_suspend() instead ohci_suspend() and ohci_bus_suspend(), which will cause the OHCI interrupt to not be closed. At this time, if just one device interrupt is reported. the driver will not process and close this device interrupt. It will cause the entire system to be stuck during sleep, causing the device to fail to respond. When the abnormal interruption reaches 100,000 times, the system will forcibly close the interruption and make the device unusable. Because the root cause of the problem is that ohci_suspend is not called to perform normal interrupt shutdown operations when the system enters S4 sleep mode. Therefore, our solution is to specify freeze interface in this mode to perform normal suspend_common() operations, and call ohci_suspend() after check_root_hub_suspend() is executed through the suspend_common() operation. Signed-off-by: Longfang Liu <liulongfang@huawei.com> --- Changes in V2: - Modify comment and patch version information. Changes in V1: - Call suspend_common by adding the hcd_pci_freeze function turn off the interrupt instead of adding a shutdown operation in ohci_bus_suspend to turn off the interrupt. drivers/usb/core/hcd-pci.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)