Bug 216352 - [BISECTED] 250 ms system suspend performance regression
Summary: [BISECTED] 250 ms system suspend performance regression
Status: NEW
Alias: None
Product: Drivers
Classification: Unclassified
Component: Bluetooth (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: linux-bluetooth@vger.kernel.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-08-11 00:47 UTC by Len Brown
Modified: 2022-08-12 18:10 UTC (History)
5 users (show)

See Also:
Kernel Version: 5.19
Subsystem:
Regression: Yes
Bisected commit-id:


Attachments
sleepgraph 5.19-rc8: 411ms suspend (391.73 KB, text/html)
2022-08-11 03:59 UTC, Len Brown
Details
sleepgraph 5.19.0: 686 ms suspend (466.24 KB, text/html)
2022-08-11 04:01 UTC, Len Brown
Details
Bluetooth: hci_sync: Fix suspend performance regression (1.72 KB, patch)
2022-08-11 21:23 UTC, Luiz Von Dentz
Details | Diff

Description Len Brown 2022-08-11 00:47:45 UTC
My skylake laptop suspends with median performance of 427 ms
up through 5.19-rc8.

After this commit, median performance slows to 684 ms in 5.19.0.

ef61b6ea154464fefd8a6712d7a3b43b445c3d4a is the first bad commit
commit ef61b6ea154464fefd8a6712d7a3b43b445c3d4a
Author: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
Date:   Mon Jul 25 15:34:21 2022 -0700

    Bluetooth: Always set event mask on suspend
    
    When suspending, always set the event mask once disconnects are
    successful. Otherwise, if wakeup is disallowed, the event mask is not
    set before suspend continues and can result in an early wakeup.
    
    Fixes: 182ee45da083 ("Bluetooth: hci_sync: Rework hci_suspend_notifier")
    Cc: stable@vger.kernel.org
    Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

 net/bluetooth/hci_sync.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Comment 1 Len Brown 2022-08-11 03:59:32 UTC
Created attachment 301548 [details]
sleepgraph 5.19-rc8: 411ms suspend
Comment 2 Len Brown 2022-08-11 04:01:44 UTC
Created attachment 301549 [details]
sleepgraph 5.19.0: 686 ms suspend
Comment 3 Len Brown 2022-08-11 04:10:46 UTC
Comparing the attached sleepgraph output of 5.19 to 5.19-rc8...

acpi_ps_execute_method(PCI.XHC._PS0) plus
msleep 120
msleep 40
msleep 40
msleep 10

have, as a group, shifted left from the suspend phase,
where they used to overlap with other tasks,
into the suspend_prepare phase, where they are the
slowest operation.
Comment 4 Luiz Von Dentz 2022-08-11 21:03:22 UTC
(In reply to Len Brown from comment #3)
> Comparing the attached sleepgraph output of 5.19 to 5.19-rc8...
> 
> acpi_ps_execute_method(PCI.XHC._PS0) plus
> msleep 120
> msleep 40
> msleep 40
> msleep 10
> 
> have, as a group, shifted left from the suspend phase,
> where they used to overlap with other tasks,
> into the suspend_prepare phase, where they are the
> slowest operation.

We can probably return to the way it was if we detect the event mask needs updating or not by checking if there is any connections, anyway if you attempt to suspend while there is a bluetooth connection this extra latency would probably reappear since in that case we need to update the event mask in order to not wakeup the system by events such Disconnect Complete, not sure if this is acceptable or perhaps the root cause is that notifiers are serialized so while these commands are pending it prevents other notifiers to be run?
Comment 5 Luiz Von Dentz 2022-08-11 21:23:24 UTC
Created attachment 301553 [details]
Bluetooth: hci_sync: Fix suspend performance regression
Comment 6 Luiz Von Dentz 2022-08-12 18:10:57 UTC
@Len Brown any chance to test with the above patch?

Note You need to log in before you can comment on or make changes to this bug.