From: Greg Kroah-Hartman Date: Mon, 15 Nov 2021 13:42:46 +0000 (+0100) Subject: 5.4-stable patches X-Git-Tag: v5.4.160~56 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f54439babbf6c4e1fef20fc497fbc50a00b13f43;p=thirdparty%2Fkernel%2Fstable-queue.git 5.4-stable patches added patches: f2fs-should-use-gfp_nofs-for-directory-inodes.patch irqchip-sifive-plic-fixup-eoi-failed-when-masked.patch --- diff --git a/queue-5.4/f2fs-should-use-gfp_nofs-for-directory-inodes.patch b/queue-5.4/f2fs-should-use-gfp_nofs-for-directory-inodes.patch new file mode 100644 index 00000000000..277f8915f46 --- /dev/null +++ b/queue-5.4/f2fs-should-use-gfp_nofs-for-directory-inodes.patch @@ -0,0 +1,104 @@ +From 92d602bc7177325e7453189a22e0c8764ed3453e Mon Sep 17 00:00:00 2001 +From: Jaegeuk Kim +Date: Tue, 7 Sep 2021 10:24:21 -0700 +Subject: f2fs: should use GFP_NOFS for directory inodes + +From: Jaegeuk Kim + +commit 92d602bc7177325e7453189a22e0c8764ed3453e upstream. + +We use inline_dentry which requires to allocate dentry page when adding a link. +If we allow to reclaim memory from filesystem, we do down_read(&sbi->cp_rwsem) +twice by f2fs_lock_op(). I think this should be okay, but how about stopping +the lockdep complaint [1]? + +f2fs_create() + - f2fs_lock_op() + - f2fs_do_add_link() + - __f2fs_find_entry + - f2fs_get_read_data_page() + -> kswapd + - shrink_node + - f2fs_evict_inode + - f2fs_lock_op() + +[1] + +fs_reclaim +){+.+.}-{0:0} +: +kswapd0: lock_acquire+0x114/0x394 +kswapd0: __fs_reclaim_acquire+0x40/0x50 +kswapd0: prepare_alloc_pages+0x94/0x1ec +kswapd0: __alloc_pages_nodemask+0x78/0x1b0 +kswapd0: pagecache_get_page+0x2e0/0x57c +kswapd0: f2fs_get_read_data_page+0xc0/0x394 +kswapd0: f2fs_find_data_page+0xa4/0x23c +kswapd0: find_in_level+0x1a8/0x36c +kswapd0: __f2fs_find_entry+0x70/0x100 +kswapd0: f2fs_do_add_link+0x84/0x1ec +kswapd0: f2fs_mkdir+0xe4/0x1e4 +kswapd0: vfs_mkdir+0x110/0x1c0 +kswapd0: do_mkdirat+0xa4/0x160 +kswapd0: __arm64_sys_mkdirat+0x24/0x34 +kswapd0: el0_svc_common.llvm.17258447499513131576+0xc4/0x1e8 +kswapd0: do_el0_svc+0x28/0xa0 +kswapd0: el0_svc+0x24/0x38 +kswapd0: el0_sync_handler+0x88/0xec +kswapd0: el0_sync+0x1c0/0x200 +kswapd0: +-> #1 +( +&sbi->cp_rwsem +){++++}-{3:3} +: +kswapd0: lock_acquire+0x114/0x394 +kswapd0: down_read+0x7c/0x98 +kswapd0: f2fs_do_truncate_blocks+0x78/0x3dc +kswapd0: f2fs_truncate+0xc8/0x128 +kswapd0: f2fs_evict_inode+0x2b8/0x8b8 +kswapd0: evict+0xd4/0x2f8 +kswapd0: iput+0x1c0/0x258 +kswapd0: do_unlinkat+0x170/0x2a0 +kswapd0: __arm64_sys_unlinkat+0x4c/0x68 +kswapd0: el0_svc_common.llvm.17258447499513131576+0xc4/0x1e8 +kswapd0: do_el0_svc+0x28/0xa0 +kswapd0: el0_svc+0x24/0x38 +kswapd0: el0_sync_handler+0x88/0xec +kswapd0: el0_sync+0x1c0/0x200 + +Cc: stable@vger.kernel.org +Fixes: bdbc90fa55af ("f2fs: don't put dentry page in pagecache into highmem") +Reviewed-by: Chao Yu +Reviewed-by: Stanley Chu +Reviewed-by: Light Hsieh +Tested-by: Light Hsieh +Signed-off-by: Jaegeuk Kim +Signed-off-by: Greg Kroah-Hartman +--- + fs/f2fs/inode.c | 2 +- + fs/f2fs/namei.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +--- a/fs/f2fs/inode.c ++++ b/fs/f2fs/inode.c +@@ -455,7 +455,7 @@ make_now: + inode->i_op = &f2fs_dir_inode_operations; + inode->i_fop = &f2fs_dir_operations; + inode->i_mapping->a_ops = &f2fs_dblock_aops; +- inode_nohighmem(inode); ++ mapping_set_gfp_mask(inode->i_mapping, GFP_NOFS); + } else if (S_ISLNK(inode->i_mode)) { + if (file_is_encrypt(inode)) + inode->i_op = &f2fs_encrypted_symlink_inode_operations; +--- a/fs/f2fs/namei.c ++++ b/fs/f2fs/namei.c +@@ -679,7 +679,7 @@ static int f2fs_mkdir(struct inode *dir, + inode->i_op = &f2fs_dir_inode_operations; + inode->i_fop = &f2fs_dir_operations; + inode->i_mapping->a_ops = &f2fs_dblock_aops; +- inode_nohighmem(inode); ++ mapping_set_gfp_mask(inode->i_mapping, GFP_NOFS); + + set_inode_flag(inode, FI_INC_LINK); + f2fs_lock_op(sbi); diff --git a/queue-5.4/irqchip-sifive-plic-fixup-eoi-failed-when-masked.patch b/queue-5.4/irqchip-sifive-plic-fixup-eoi-failed-when-masked.patch new file mode 100644 index 00000000000..ce87afefde8 --- /dev/null +++ b/queue-5.4/irqchip-sifive-plic-fixup-eoi-failed-when-masked.patch @@ -0,0 +1,65 @@ +From 69ea463021be0d159ab30f96195fb0dd18ee2272 Mon Sep 17 00:00:00 2001 +From: Guo Ren +Date: Fri, 5 Nov 2021 17:47:48 +0800 +Subject: irqchip/sifive-plic: Fixup EOI failed when masked + +From: Guo Ren + +commit 69ea463021be0d159ab30f96195fb0dd18ee2272 upstream. + +When using "devm_request_threaded_irq(,,,,IRQF_ONESHOT,,)" in a driver, +only the first interrupt is handled, and following interrupts are never +delivered (initially reported in [1]). + +That's because the RISC-V PLIC cannot EOI masked interrupts, as explained +in the description of Interrupt Completion in the PLIC spec [2]: + + +The PLIC signals it has completed executing an interrupt handler by +writing the interrupt ID it received from the claim to the claim/complete +register. The PLIC does not check whether the completion ID is the same +as the last claim ID for that target. If the completion ID does not match +an interrupt source that *is currently enabled* for the target, the +completion is silently ignored. + + +Re-enable the interrupt before completion if it has been masked during +the handling, and remask it afterwards. + +[1] http://lists.infradead.org/pipermail/linux-riscv/2021-July/007441.html +[2] https://github.com/riscv/riscv-plic-spec/blob/8bc15a35d07c9edf7b5d23fec9728302595ffc4d/riscv-plic.adoc + +Fixes: bb0fed1c60cc ("irqchip/sifive-plic: Switch to fasteoi flow") +Reported-by: Vincent Pelletier +Tested-by: Nikita Shubin +Signed-off-by: Guo Ren +Cc: stable@vger.kernel.org +Cc: Thomas Gleixner +Cc: Palmer Dabbelt +Cc: Atish Patra +Reviewed-by: Anup Patel +[maz: amended commit message] +Signed-off-by: Marc Zyngier +Link: https://lore.kernel.org/r/20211105094748.3894453-1-guoren@kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/irqchip/irq-sifive-plic.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +--- a/drivers/irqchip/irq-sifive-plic.c ++++ b/drivers/irqchip/irq-sifive-plic.c +@@ -138,7 +138,13 @@ static void plic_irq_eoi(struct irq_data + { + struct plic_handler *handler = this_cpu_ptr(&plic_handlers); + +- writel(d->hwirq, handler->hart_base + CONTEXT_CLAIM); ++ if (irqd_irq_masked(d)) { ++ plic_irq_unmask(d); ++ writel(d->hwirq, handler->hart_base + CONTEXT_CLAIM); ++ plic_irq_mask(d); ++ } else { ++ writel(d->hwirq, handler->hart_base + CONTEXT_CLAIM); ++ } + } + + static struct irq_chip plic_chip = { diff --git a/queue-5.4/series b/queue-5.4/series index 08cd099139b..979eafcea18 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -336,3 +336,5 @@ arm-9155-1-fix-early-early_iounmap.patch arm-9156-1-drop-cc-option-fallbacks-for-architecture-selection.patch parisc-fix-backtrace-to-always-include-init-funtion-names.patch parisc-fix-set_fixmap-on-pa1.x-cpus.patch +irqchip-sifive-plic-fixup-eoi-failed-when-masked.patch +f2fs-should-use-gfp_nofs-for-directory-inodes.patch