patch exist, please apply for ubuntu 20.04:
marian@kubuntu2004:~/kernelubuntu/linux$ git diff
diff --git a/include/linux/swap.h b/include/linux/swap.h
index de2c67a33b7e..da1dc5a338cc 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -456,6 +456,7 @@ extern void swap_free(swp_entry_t);
extern void swapcache_free_entries(swp_entry_t *entries, int n);
extern int free_swap_and_cache(swp_entry_t);
extern int swap_type_of(dev_t, sector_t, struct block_device **);
+extern void swap_relockall(void);
extern unsigned int count_swap_pages(int, int);
extern sector_t map_swap_page(struct page *, struct block_device **);
extern sector_t swapdev_block(int, pgoff_t);
diff --git a/kernel/power/user.c b/kernel/power/user.c
index 77438954cc2b..bfef2097edaa 100644
--- a/kernel/power/user.c
+++ b/kernel/power/user.c
@@ -271,6 +271,8 @@ static long snapshot_ioctl(struct file *filp, unsigned int
cmd,
break;
}
error = hibernation_restore(data->platform_support);
+ if (!error)
+ swap_relockall();
break;
case SNAPSHOT_FREE:
@@ -372,10 +374,16 @@ static long snapshot_ioctl(struct file *filp, unsigned
int cmd,
*/
swdev = new_decode_dev(swap_area.dev);
if (swdev) {
+ struct block_device *bd;
offset = swap_area.offset;
- data->swap = swap_type_of(swdev, offset, NULL);
+ data->swap = swap_type_of(swdev, offset, &bd);
if (data->swap < 0)
error = -ENODEV;
+
+ inode_lock(bd->bd_inode);
+ bd->bd_inode->i_flags &= ~S_SWAPFILE;
+ inode_unlock(bd->bd_inode);
+ bdput(bd);
} else {
data->swap = -1;
error = -EINVAL;
diff --git a/mm/swapfile.c b/mm/swapfile.c
index dab43523afdd..c7c83d3a313b 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -1799,6 +1799,32 @@ int swap_type_of(dev_t device, sector_t offset, struct
block_device **bdev_p)
return -ENODEV;
}
+/* Re-lock swap devices after resuming from userspace suspend. */
+void swap_relockall(void)
+{
+ int type;
+
+ spin_lock(&swap_lock);
+ for (type = 0; type < nr_swapfiles; type++) {
+ struct swap_info_struct *sis = swap_info[type];
+ struct block_device *bdev = bdgrab(sis->bdev);
+
+ /*
+ * uswsusp only knows how to suspend to block devices, so we
+ * can skip swap files.
+ */
+ if (!(sis->flags & SWP_WRITEOK) ||
+ !(sis->flags & SWP_BLKDEV))
+ continue;
+
+ inode_lock(bdev->bd_inode);
+ bdev->bd_inode->i_flags |= S_SWAPFILE;
+ inode_unlock(bdev->bd_inode);
+ bdput(bdev);
+ }
+ spin_unlock(&swap_lock);
+}
+
/*
* Get the (PAGE_SIZE) block corresponding to given offset on the swapdev
* corresponding to given index in swap_info (swap type).
--
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux-5.4 in Ubuntu.
https://bugs.launchpad.net/bugs/1864930
Title:
brightness setting and sleep/suspend (echo mem > /sys/power/state) ,
s2ram and s2disk fail for 5.4.0 and s2disk fail for 5.4.22
Status in linux-5.4 package in Ubuntu:
New
Bug description:
1) After resuming from suspend (uswsusp/s2ram) and/or after resuming
from "echo mem > /sys/power/state" there is a black screen on laptop
after resume with 5.4.0-14-generic kernel only. Kernel seems to be
working as CTRL+ALT+F2 and CTRL+ALT+DEL restarts laptop.
A) 3 Different combinations of this distro with other kernels work
well:
kubunut20.04 + linux-image-5.3.0-40-generic
(copied from kubuntu 19.10 from /lib/modules/5.3.0-40-generic and
/boot/vmlinuz-5.3.0-40-generic)
Installed from
https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.6-rc3/
kubuntu20.04 + linux-image-unsigned-5.5.6-050506-generic is working.
kubuntu20.04 + linux-image-unsigned-5.6.0-050600rc3-generic is working.
B) This kernel 5.4.0-14-generic when copied manually into kubuntu 19.10
behaves the same as in 20.04 (NOT WORKING for suspend to ram)
2) setting brightness with keys on laptop keyboard does not work for this
kernel 5.4.0-14-generic only
Neither using this command line method
marian@kubuntu2004:~/Downloads$ cat
/sys/class/backlight/intel_backlight/max_brightness
255
marian@kubuntu2004:~/Downloads$ cat
/sys/class/backlight/intel_backlight/max_brightness
255
marian@kubuntu2004:~/Downloads$ cat
/sys/class/backlight/intel_backlight/actual_brightness
255
marian@kubuntu2004:~/Downloads$ cat
/sys/class/backlight/intel_backlight/brightness
242
marian@kubuntu2004:~/Downloads$ echo 200 | sudo tee
/sys/class/backlight/intel_backlight/brightness
200
marian@kubuntu2004:~/Downloads$ cat
/sys/class/backlight/intel_backlight/brightness
Again kernel 5.3 copied into kubuntu20.04 got working brigthness keys.
However this works for all tested kernels above (including 5.4.0-14-generic)
xrandr --output eDP-1 --brightness 0.8
3) after uswsusp/hibernate (s2disk) and "echo disk > /sys/power/state" do
not seem to resume/thaw
for those kernels: linux-image-5.4.0-14-generic,
linux-image-unsigned-5.5.6-050506-generic ,
linux-image-unsigned-5.6.0-050600rc3-generic, on the other hand kernel
linux-image-5.3.0-40-generic manually copied from kubuntu 19.10 into kubuntu
20.04 seems to be working fine when thawing/resuming from hibernation.
Again I tested different combination of kernels and distros for this issue.
This kernel (5.4.0-14-generic) also does not work for hibernate/resume even
when copied from kubuntu20.04 into kubuntu19.10
4)
Starting kubuntu without installation from daily build from 25th Feb 2020
shows the same problem for brightness setting and for black screen after
resuming from sleep.
http://cdimage.ubuntu.com/kubuntu/daily-live/current/
Note I always recreated imagerd in target place when copied kernels manually:
update-initramfs -u -k 5.3.0-40-generic
ProblemType: Bug
DistroRelease: Ubuntu 20.04
Package: linux-image-5.4.0-14-generic 5.4.0-14.17
ProcVersionSignature: Ubuntu 5.4.0-14.17-generic 5.4.18
Uname: Linux 5.4.0-14-generic x86_64
ApportVersion: 2.20.11-0ubuntu18
Architecture: amd64
AudioDevicesInUse:
USER PID ACCESS COMMAND
/dev/snd/controlC0: marian 1214 F.... pulseaudio
CurrentDesktop: KDE
Date: Wed Feb 26 22:20:29 2020
Lsusb:
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 8087:0a2b Intel Corp.
Bus 001 Device 002: ID 05c8:0815 Cheng Uei Precision Industry Co., Ltd
(Foxlink) HP Wide Vision FHD Camera
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
MachineType: HP HP Spectre x360 Convertible 13-ae0xx
ProcEnviron:
LANGUAGE=
TERM=xterm-256color
PATH=(custom, no user)
XDG_RUNTIME_DIR=<set>
SHELL=/bin/bash
ProcFB: 0 i915drmfb
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-5.4.0-14-generic
root=/dev/mapper/sysvg-ub2004deboot ro resume=/dev/nvme0n1p8 quiet splash
resume=/dev/nvme0n1p8 vt.handoff=7
RelatedPackageVersions:
linux-restricted-modules-5.4.0-14-generic N/A
linux-backports-modules-5.4.0-14-generic N/A
linux-firmware 1.186
SourcePackage: linux-5.4
UpgradeStatus: No upgrade log present (probably fresh install)
WifiSyslog:
dmi.bios.date: 01/07/2019
dmi.bios.vendor: AMI
dmi.bios.version: F.24
dmi.board.asset.tag: Base Board Asset Tag
dmi.board.name: 83B9
dmi.board.vendor: HP
dmi.board.version: 56.43
dmi.chassis.type: 31
dmi.chassis.vendor: HP
dmi.chassis.version: Chassis Version
dmi.modalias:
dmi:bvnAMI:bvrF.24:bd01/07/2019:svnHP:pnHPSpectrex360Convertible13-ae0xx:pvr:rvnHP:rn83B9:rvr56.43:cvnHP:ct31:cvrChassisVersion:
dmi.product.family: 103C_5335KV HP Spectre
dmi.product.name: HP Spectre x360 Convertible 13-ae0xx
dmi.product.sku: 2QH34EA#ABU
dmi.sys.vendor: HP
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux-5.4/+bug/1864930/+subscriptions
--
Mailing list: https://launchpad.net/~kernel-packages
Post to : [email protected]
Unsubscribe : https://launchpad.net/~kernel-packages
More help : https://help.launchpad.net/ListHelp