Bug 199941

Summary: system freeze the third time suspending (with custom udev rules)
Product: Power Management Reporter: n0000b.n000b
Component: Hibernation/SuspendAssignee: Rafael J. Wysocki (rjw)
Status: RESOLVED PATCH_ALREADY_AVAILABLE    
Severity: normal CC: mika.westerberg
Priority: P1    
Hardware: x86-64   
OS: Linux   
Kernel Version: 4.16.13 Subsystem:
Regression: Yes Bisected commit-id:
Attachments: lspci
lspci
lspci -vvv
sudo lspci -vvv
PCI / PM: Resume parallel bridges on system suspend
PCI / ACPI / PM: Resume bridges on system suspend
PCI / ACPI / PM: Resume bridges w/o drivers on suspend-to-RAM

Description n0000b.n000b 2018-06-06 07:47:01 UTC
Created attachment 276337 [details]
lspci

Since upgrading to the kernel version 4.16.13 in fedora 28 the laptop (samsung 305V4A) hangs on the third time when I try suspend (the system doesn't enter suspend and some leds are on), previous kernel 4.16.12 works ok

the custom udev rule is this

ACTION=="add", SUBSYSTEM=="pci", ATTR{power/control}="auto"


As a work around i can enter this command to make the laptop capable of suspend multiple times in 4.16.13

echo on > sys/bus/pci/devices/0000\:00\:14.4/power/control


I haven't had the time to bisect the commits, but in a hunch i reverted this commit and the system can suspend multiple times:

commit 9fa10e44b722f6773841e18912edefda735e71d8
PM / core: Fix direct_complete handling for devices with no callbacks
commit c62ec4610c40bcc44f2d3d5ed1c312737279e2f3 upstream.

attached is the output of lspci

Some previous similar bug I had with the same laptop: https://bugzilla.kernel.org/show_bug.cgi?id=156441

Thanks!
Comment 1 Rafael J. Wysocki 2018-06-06 09:55:14 UTC
Please attach the output of lspci from this machine.
Comment 2 n0000b.n000b 2018-06-06 20:20:35 UTC
Created attachment 276351 [details]
lspci

here is lspci again
Comment 3 Rafael J. Wysocki 2018-06-06 23:36:48 UTC
0000:00:14.4 is a bridge, so the commit you have reverted effectively enables the direct_complete optimization for it and that leads to problems.

It looks like disabling direct_complete for it explicitly should help, but please attach the output of "lspci -vvv" so we can see more details.
Comment 4 n0000b.n000b 2018-06-07 02:37:54 UTC
Created attachment 276361 [details]
lspci -vvv

here it is
Comment 5 Rafael J. Wysocki 2018-06-07 08:43:56 UTC
But can you call it as root, please?
Comment 6 n0000b.n000b 2018-06-07 09:31:09 UTC
Created attachment 276367 [details]
sudo lspci -vvv

ok
Comment 7 n0000b.n000b 2018-06-20 07:00:21 UTC
do you need any other info?
Comment 8 Rafael J. Wysocki 2018-06-20 08:25:11 UTC
Created attachment 276701 [details]
PCI / PM: Resume parallel bridges on system suspend

Does this patch help?
Comment 9 Rafael J. Wysocki 2018-06-20 08:39:58 UTC
Created attachment 276703 [details]
PCI / ACPI / PM: Resume bridges on system suspend

Please test this patch too
Comment 10 n0000b.n000b 2018-06-22 00:32:37 UTC
with the patch of comment 8 i can suspend and resume multiple times with kernel 4.17.2. I couldn't apply the patch on comment 9, on top of what kernel version should it be applied?
Comment 11 Rafael J. Wysocki 2018-06-24 21:05:51 UTC
The patch from comment #9 applies on top of the mainline 4.18-rc2 without any modifications (for me at least).  Please test it on top of that kernel.
Comment 12 n0000b.n000b 2018-06-25 22:16:02 UTC
patches applied on top of 4.18-rc1, can suspend more than 3 times now, haven't seen any negative effects. Will continue testing.

Thanks!
Comment 13 Rafael J. Wysocki 2018-06-26 09:00:38 UTC
OK, thanks for testing!

I'll submit the patch from comment #9 for inclusion.
Comment 14 Rafael J. Wysocki 2018-06-26 10:22:57 UTC
Patch submitted: https://patchwork.kernel.org/patch/10488563/
Comment 15 Rafael J. Wysocki 2018-06-26 10:24:15 UTC
BTW, please test the patch from comment #9 without the patch from comment #8 too (that might have been unclear).
Comment 16 n0000b.n000b 2018-06-27 00:39:55 UTC
ok will test the patch from #9 alone and will report back
Comment 17 n0000b.n000b 2018-06-27 06:36:00 UTC
With only the patch of comment 9 in top of 4.18-rc1 the system CAN'T suspend multiple times.

In resume: 
patch from comment 8 alone WORKS
patch from comment 9 alone DOESN'T WORKS
both patches applied WORKS
Comment 18 Rafael J. Wysocki 2018-06-27 07:13:15 UTC
OK, thanks!  I'll send more patches to test in the next few days.
Comment 19 Rafael J. Wysocki 2018-06-27 10:57:09 UTC
Created attachment 276907 [details]
PCI / ACPI / PM: Resume bridges w/o drivers on suspend-to-RAM

This is a replacement for both the patches from comment #9 and from comment #9.

Please test this one.
Comment 20 Rafael J. Wysocki 2018-06-27 12:28:13 UTC
I mean the patches from comment #8 and from comment #9, of course.

That is, please test the patch from comment #19 alone.
Comment 21 n0000b.n000b 2018-06-28 22:59:03 UTC
The patch in comment 19 WORKS, I can now suspend multiple times.

Thanks a lot
Comment 22 Rafael J. Wysocki 2018-06-29 08:24:18 UTC
Cool, thanks for the confirmation!