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(-)
Created attachment 301548 [details] sleepgraph 5.19-rc8: 411ms suspend
Created attachment 301549 [details] sleepgraph 5.19.0: 686 ms suspend
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.
(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?
Created attachment 301553 [details] Bluetooth: hci_sync: Fix suspend performance regression
@Len Brown any chance to test with the above patch?