Bug#964839: bbswitch-dkms: Fails to re-enable graphics after suspend with kernel 5.7

2020-08-09 Thread Andreas Beckmann
Control: reassign -1 src:linux 5.7.6-1
Control: affects -1 + src:bbswitch
Control: retitle -1 PM_SUSPEND_PREPARE event missing in Linux 5.7

On 8/9/20 2:39 AM, Felix Dörre wrote:
> So to me, it seems that the suspend event is just missing.
> 
> Another, independent experiment has shown, that this missing
> reactivation is the cause for the problem: Enabling the card manually
> before going to suspend is a workaround for the problem.

Reassigning to the kernel.

Andreas



Bug#964839: bbswitch-dkms: Fails to re-enable graphics after suspend with kernel 5.7

2020-08-08 Thread Felix Dörre

Thanks for the hint, this are the observations:
On 5.6:

[389399.743191] PM: suspend entry (deep)
[389399.766750] Filesystems sync: 0.023 seconds
[389399.767062] (NULL device *): firmware: direct-loading firmware 
i915/kbl_dmc_ver1_04.bin
[389399.767088] (NULL device *): firmware: direct-loading firmware 
intel/ibt-12-16.ddc
[389399.767167] (NULL device *): firmware: direct-loading firmware 
regulatory.db
[389399.767170] (NULL device *): firmware: direct-loading firmware 
regulatory.db.p7s
[389399.768870] (NULL device *): firmware: direct-loading firmware 
intel/ibt-12-16.sfi
[389399.770169] (NULL device *): firmware: direct-loading firmware 
iwlwifi-8265-36.ucode
[389399.770188] bbswitch: bbswitch_pm_handler: event_type=3 
is_card_disabled=1 dis_before_suspend_disabled=0

[389399.770189] bbswitch: enabling discrete graphics
[389399.920138] Freezing user space processes ... (elapsed 0.004 
seconds) done.

[389399.924632] OOM killer disabled.
[389399.924633] Freezing remaining freezable tasks ... (elapsed 0.001 
seconds) done.
[389399.926456] printk: Suspending console(s) (use no_console_suspend to 
debug)


[389408.348659] OOM killer enabled.
[389408.348660] Restarting tasks ... done.
[389408.428103] bbswitch: bbswitch_pm_handler: event_type=4 
is_card_disabled=0 dis_before_suspend_disabled=1

[389408.428106] bbswitch: disabling discrete graphics
[389408.493000] pci :01:00.0: refused to change power state from D0 
to D3hot

[389408.495182] PM: suspend exit

On 5.7:
[   89.560733] PM: suspend entry (deep)
[   89.656060] Filesystems sync: 0.095 seconds
[   89.656623] (NULL device *): firmware: direct-loading firmware 
regulatory.db
[   89.656630] (NULL device *): firmware: direct-loading firmware 
regulatory.db.p7s
[   89.657274] (NULL device *): firmware: direct-loading firmware 
iwlwifi-8265-36.ucode
[   89.657646] (NULL device *): firmware: direct-loading firmware 
i915/kbl_dmc_ver1_04.bin
[   89.777521] Freezing user space processes ... (elapsed 0.003 seconds) 
done.

[   89.780568] OOM killer disabled.
[   89.780569] Freezing remaining freezable tasks ... (elapsed 0.001 
seconds) done.
[   89.782023] printk: Suspending console(s) (use no_console_suspend to 
debug)


[   93.238967] OOM killer enabled.
[   93.238968] Restarting tasks ... done.
[   93.304163] bbswitch: bbswitch_pm_handler: event_type=4 
is_card_disabled=1 dis_before_suspend_disabled=0

[   93.304165] PM: suspend exit

So to me, it seems that the suspend event is just missing.

Another, independent experiment has shown, that this missing 
reactivation is the cause for the problem: Enabling the card manually 
before going to suspend is a workaround for the problem.


Kind regards,
Felix



Bug#964839: bbswitch-dkms: Fails to re-enable graphics after suspend with kernel 5.7

2020-08-08 Thread Andreas Beckmann
You could start with adding this (untested) line:

  pr_info("bbswitch_pm_handler: event_type=%ld is_card_disabled=%d
dis_before_suspend_disabled=%d\n", event_type, is_card_disabled(),
dis_before_suspend_disabled);

at the start of bbswitch_pm_handler() (right before the "switch") to get
some more output (test it on both kernels).


Andreas



Bug#964839: bbswitch-dkms: Fails to re-enable graphics after suspend with kernel 5.7

2020-08-08 Thread Felix Dörre

On 2020-07-31 10:50, Andreas Beckmann wrote:

I'd guess that bbswitch needs to be adusted to the corresponding kernel
changes.


I just compared the log output to the bbswitch source code and from what 
I can tell:


- There is logic to always enable the discrete graphics card just before 
standby:
> enable the device before suspend to avoid the PCI config space from 
being saved incorrectly

- This logic does not seem to be invoked:
from 5.6:
[   37.338585] Filesystems sync: 3.833 seconds
[   37.339219] (NULL device *): firmware: direct-loading firmware 
regulatory.db
[   37.339222] (NULL device *): firmware: direct-loading firmware 
regulatory.db.p7s
[   37.339918] (NULL device *): firmware: direct-loading firmware 
iwlwifi-8265-36.ucode
[   37.340208] (NULL device *): firmware: direct-loading firmware 
i915/kbl_dmc_ver1_04.bin

[   37.340311] bbswitch: enabling discrete graphics
[   37.493527] Freezing user space processes ... (elapsed 0.003 seconds) 
done.

[   37.496725] OOM killer disabled.
[   37.496727] Freezing remaining freezable tasks ... (elapsed 0.001 
seconds) done.

from 5.7:
[   42.399698] Filesystems sync: 2.100 seconds
[   42.400331] (NULL device *): firmware: direct-loading firmware 
regulatory.db.p7s
[   42.400338] (NULL device *): firmware: direct-loading firmware 
regulatory.db
[   42.401065] (NULL device *): firmware: direct-loading firmware 
iwlwifi-8265-36.ucode
[   42.401339] (NULL device *): firmware: direct-loading firmware 
i915/kbl_dmc_ver1_04.bin
[   42.523291] Freezing user space processes ... (elapsed 0.003 seconds) 
done.

[   42.526435] OOM killer disabled.
[   42.526436] Freezing remaining freezable tasks ... (elapsed 0.001 
seconds) done.


The next step would probably be to look if this 
"register_pm_notifier()" is intended to not work and there is a 
replacement, or what is happening there.


--
Kind regards,
Felix Dörre



Bug#964839: bbswitch-dkms: Fails to re-enable graphics after suspend with kernel 5.7

2020-08-08 Thread Felix Dörre

On 2020-07-31 10:50, Andreas Beckmann wrote:

I'd guess that bbswitch needs to be adusted to the corresponding kernel
changes.


I am quite unfamiliar with the low-level parts of the linux kernel, so I 
probably wouldn't get far if I'd try to look at it. Should I open a 
github issue upstream? Or how would we progress to make bbswitch work again.


--
Kind regards,
Felix Dörre



Bug#964839: bbswitch-dkms: Fails to re-enable graphics after suspend with kernel 5.7

2020-07-31 Thread Andreas Beckmann
On 7/11/20 12:12 AM, Felix Dörre wrote:
> I am also not sure, if this is a kernel bug or a bbswitch bug. With kernel 
> 5.6 bbswitch works flawlessly.

I'd guess that bbswitch needs to be adusted to the corresponding kernel
changes.

Andreas



Bug#964839: bbswitch-dkms: Fails to re-enable graphics after suspend with kernel 5.7

2020-07-10 Thread Felix Dörre
Package: bbswitch-dkms
Version: 0.8-9
Severity: important

Dear Maintainer,

After upgrading to kernel 5.7, bbswitch fails to re-enable the graphics card 
deterministically after resuming from standby.
Rebooting the system solves the problem until the next standby. Booting with 
the still installed kernel 5.6 does not show any problems.

The relevant errors from dmesg (when booting with a 5.7 kernel, verifying that 
bbswitch works, entering standby, resuming from standby, verifying that 
bbswitch does not work):
[   34.472822] nvidia-modeset: Unloading
[   34.489477] nvidia-nvlink: Unregistered the Nvlink Core, major device number 
243
[   34.583390] bbswitch: disabling discrete graphics
[   34.600540] pci :01:00.0: refused to change power state from D0 to D3hot
[   40.298879] PM: suspend entry (deep)

[   45.751278] PM: suspend exit

[   48.589904] bbswitch: enabling discrete graphics
[   48.589911] pci :01:00.0: can't change power state from D3cold to D0 
(config space inaccessible)
[   48.589915] pci :01:00.0: can't change power state from D3cold to D0 
(config space inaccessible)

I can provide a full dmesg log if this is needed. I am also not sure, if this 
is a kernel bug or a bbswitch bug. With kernel 5.6 bbswitch works flawlessly.

-- System Information:
Debian Release: bullseye/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'unstable'), (500, 'stable'), (1, 
'experimental-debug'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.6.0-1-amd64 (SMP w/8 CPU cores)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, 
TAINT_UNSIGNED_MODULE
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE=C.UTF-8 
(charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages bbswitch-dkms depends on:
ii  dkms  2.8.2-2

bbswitch-dkms recommends no packages.

Versions of packages bbswitch-dkms suggests:
ii  bumblebee  3.2.1-23

-- no debconf information