diff --git a/patches.kabi/fb_deferred_io-kABI-workaround.patch b/patches.kabi/fb_deferred_io-kABI-workaround.patch new file mode 100644 index 0000000..99fda19 --- /dev/null +++ b/patches.kabi/fb_deferred_io-kABI-workaround.patch @@ -0,0 +1,28 @@ +From: Takashi Iwai +Subject: kABI workaround for struct fb_deferred_io changes +Patch-mainline: Never, kABI workaround +References: bsc#1208266 + +A new field was added to struct fb_deferred_io that broke kABI. +For keeping kABI compatibility, change it for short to fit into the +existing hole (3 bytes for armv7hl), and wrap with __GENKSYMS__. + +Signed-off-by: Takashi Iwai + +--- + include/linux/fb.h | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/include/linux/fb.h ++++ b/include/linux/fb.h +@@ -212,7 +212,9 @@ struct fb_deferred_io { + /* delay between mkwrite and deferred handler */ + unsigned long delay; + bool sort_pagereflist; /* sort pagelist by offset */ +- int open_count; /* number of opened files; protected by fb_info lock */ ++#ifndef __GENKSYMS__ ++ short open_count; /* number of opened files; protected by fb_info lock */ ++#endif + struct mutex lock; /* mutex that protects the pageref list */ + struct list_head pagereflist; /* list of pagerefs for touched pages */ + /* callback */ diff --git a/patches.suse/fbdev-Fix-incorrect-page-mapping-clearance-at-fb_def.patch b/patches.suse/fbdev-Fix-incorrect-page-mapping-clearance-at-fb_def.patch new file mode 100644 index 0000000..caa13a6 --- /dev/null +++ b/patches.suse/fbdev-Fix-incorrect-page-mapping-clearance-at-fb_def.patch @@ -0,0 +1,92 @@ +From: Takashi Iwai +Date: Wed, 8 Mar 2023 11:50:12 +0100 +Subject: [PATCH] fbdev: Fix incorrect page mapping clearance at fb_deferred_io_release() +Message-Id: <20230308105012.1845-1-tiwai@suse.de> +Patch-mainline: Submitted, linux-fbdev ML +References: bsc#1208266 + +The recent fix for the deferred I/O by the commit + 3efc61d95259 ("fbdev: Fix invalid page access after closing deferred I/O devices") +caused a regression when the same fb device is opened/closed while +it's being used. It resulted in a frozen screen even if something +is redrawn there after the close. The breakage is because the patch +was made under a wrong assumption of a single open; in the current +code, fb_deferred_io_release() cleans up the page mapping of the +pageref list and it calls cancel_delayed_work_sync() unconditionally, +where both are no correct behavior for multiple opens. + +This patch adds a refcount for the opens of the device, and applies +the cleanup only when all files get closed. + +As both fb_deferred_io_open() and _close() are called always in the +fb_info lock (mutex), it's safe to use the normal int for the +refcounting. + +Also, a useless BUG_ON() is dropped. + +Fixes: 3efc61d95259 ("fbdev: Fix invalid page access after closing deferred I/O devices") +Cc: +Signed-off-by: Takashi Iwai + +--- + drivers/video/fbdev/core/fb_defio.c | 17 +++++++++++++---- + include/linux/fb.h | 1 + + 2 files changed, 14 insertions(+), 4 deletions(-) + +--- a/drivers/video/fbdev/core/fb_defio.c ++++ b/drivers/video/fbdev/core/fb_defio.c +@@ -316,17 +316,18 @@ void fb_deferred_io_open(struct fb_info + struct inode *inode, + struct file *file) + { ++ struct fb_deferred_io *fbdefio = info->fbdefio; ++ + file->f_mapping->a_ops = &fb_deferred_io_aops; ++ fbdefio->open_count++; + } + EXPORT_SYMBOL_GPL(fb_deferred_io_open); + +-void fb_deferred_io_release(struct fb_info *info) ++static void fb_deferred_io_lastclose(struct fb_info *info) + { +- struct fb_deferred_io *fbdefio = info->fbdefio; + struct page *page; + int i; + +- BUG_ON(!fbdefio); + cancel_delayed_work_sync(&info->deferred_work); + + /* clear out the mapping that we setup */ +@@ -335,13 +336,21 @@ void fb_deferred_io_release(struct fb_in + page->mapping = NULL; + } + } ++ ++void fb_deferred_io_release(struct fb_info *info) ++{ ++ struct fb_deferred_io *fbdefio = info->fbdefio; ++ ++ if (!--fbdefio->open_count) ++ fb_deferred_io_lastclose(info); ++} + EXPORT_SYMBOL_GPL(fb_deferred_io_release); + + void fb_deferred_io_cleanup(struct fb_info *info) + { + struct fb_deferred_io *fbdefio = info->fbdefio; + +- fb_deferred_io_release(info); ++ fb_deferred_io_lastclose(info); + + kvfree(info->pagerefs); + mutex_destroy(&fbdefio->lock); +--- a/include/linux/fb.h ++++ b/include/linux/fb.h +@@ -212,6 +212,7 @@ struct fb_deferred_io { + /* delay between mkwrite and deferred handler */ + unsigned long delay; + bool sort_pagereflist; /* sort pagelist by offset */ ++ int open_count; /* number of opened files; protected by fb_info lock */ + struct mutex lock; /* mutex that protects the pageref list */ + struct list_head pagereflist; /* list of pagerefs for touched pages */ + /* callback */ diff --git a/patches.suse/fbdev-Fix-invalid-page-access-after-closing-deferred.patch b/patches.suse/fbdev-Fix-invalid-page-access-after-closing-deferred.patch index 015988d..4708e35 100644 --- a/patches.suse/fbdev-Fix-invalid-page-access-after-closing-deferred.patch +++ b/patches.suse/fbdev-Fix-invalid-page-access-after-closing-deferred.patch @@ -2,8 +2,8 @@ From: Takashi Iwai Date: Sun, 29 Jan 2023 09:28:56 +0100 Subject: [PATCH] fbdev: Fix invalid page access after closing deferred I/O devices -Message-Id: <20230129082856.22113-1-tiwai@suse.de> -Patch-mainline: Submitted, linux-fbdev ML +Git-commit: 3efc61d95259956db25347e2a9562c3e54546e20 +Patch-mainline: v6.2 References: bsc#1207284 When a fbdev with deferred I/O is once opened and closed, the dirty diff --git a/series.conf b/series.conf index 0aa9a6c..62e734a 100644 --- a/series.conf +++ b/series.conf @@ -36872,6 +36872,7 @@ patches.suse/VMCI-Use-threaded-irqs-instead-of-tasklets.patch patches.suse/module-Don-t-wait-for-GOING-modules.patch patches.suse/Fix-page-corruption-caused-by-racy-check-in-__free_pages.patch + patches.suse/fbdev-Fix-invalid-page-access-after-closing-deferred.patch patches.suse/ibmvnic-Toggle-between-queue-types-in-affinity-mappi.patch patches.suse/ipmi-ssif-resend_msg-cannot-fail.patch patches.suse/ipmi_ssif-Rename-idle-state-and-check.patch @@ -37192,7 +37193,7 @@ ######################################################## patches.suse/0001-firmware-sysfb-Add-parameter-to-enable-sysfb-support.patch patches.suse/0001-drm-i915-gvt-fix-double-free-bug-in-split_2MB_gtt_en.patch - patches.suse/fbdev-Fix-invalid-page-access-after-closing-deferred.patch + patches.suse/fbdev-Fix-incorrect-page-mapping-clearance-at-fb_def.patch ######################################################## # Storage @@ -37383,6 +37384,7 @@ # kABI consistency patches ######################################################## patches.rpmify/BTF-Don-t-break-ABI-when-debuginfo-is-disabled.patch + patches.kabi/fb_deferred_io-kABI-workaround.patch ######################################################## # SLE15-SP3 OOT performance patches evaluated but left