From: Greg Kroah-Hartman Date: Mon, 20 Apr 2020 09:15:50 +0000 (+0200) Subject: 5.4-stable patches X-Git-Tag: v4.19.117~11 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f4fb739978732c636387dc6b0981a79307937e3c;p=thirdparty%2Fkernel%2Fstable-queue.git 5.4-stable patches added patches: ext4-do-not-zeroout-extents-beyond-i_disksize.patch irqchip-ti-sci-inta-fix-processing-of-masked-irqs.patch x86-resctrl-fix-invalid-attempt-at-removing-the-default-resource-group.patch x86-resctrl-preserve-cdp-enable-over-cpu-hotplug.patch --- diff --git a/queue-5.4/ext4-do-not-zeroout-extents-beyond-i_disksize.patch b/queue-5.4/ext4-do-not-zeroout-extents-beyond-i_disksize.patch new file mode 100644 index 00000000000..34cf97c5c1f --- /dev/null +++ b/queue-5.4/ext4-do-not-zeroout-extents-beyond-i_disksize.patch @@ -0,0 +1,63 @@ +From 801674f34ecfed033b062a0f217506b93c8d5e8a Mon Sep 17 00:00:00 2001 +From: Jan Kara +Date: Tue, 31 Mar 2020 12:50:16 +0200 +Subject: ext4: do not zeroout extents beyond i_disksize + +From: Jan Kara + +commit 801674f34ecfed033b062a0f217506b93c8d5e8a upstream. + +We do not want to create initialized extents beyond end of file because +for e2fsck it is impossible to distinguish them from a case of corrupted +file size / extent tree and so it complains like: + +Inode 12, i_size is 147456, should be 163840. Fix? no + +Code in ext4_ext_convert_to_initialized() and +ext4_split_convert_extents() try to make sure it does not create +initialized extents beyond inode size however they check against +inode->i_size which is wrong. They should instead check against +EXT4_I(inode)->i_disksize which is the current inode size on disk. +That's what e2fsck is going to see in case of crash before all dirty +data is written. This bug manifests as generic/456 test failure (with +recent enough fstests where fsx got fixed to properly pass +FALLOC_KEEP_SIZE_FL flags to the kernel) when run with dioread_lock +mount option. + +CC: stable@vger.kernel.org +Fixes: 21ca087a3891 ("ext4: Do not zero out uninitialized extents beyond i_size") +Reviewed-by: Lukas Czerner +Signed-off-by: Jan Kara +Signed-off-by: Theodore Ts'o +Link: https://lore.kernel.org/r/20200331105016.8674-1-jack@suse.cz +Signed-off-by: Theodore Ts'o +Signed-off-by: Greg Kroah-Hartman + +--- + fs/ext4/extents.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/fs/ext4/extents.c ++++ b/fs/ext4/extents.c +@@ -3549,8 +3549,8 @@ static int ext4_ext_convert_to_initializ + (unsigned long long)map->m_lblk, map_len); + + sbi = EXT4_SB(inode->i_sb); +- eof_block = (inode->i_size + inode->i_sb->s_blocksize - 1) >> +- inode->i_sb->s_blocksize_bits; ++ eof_block = (EXT4_I(inode)->i_disksize + inode->i_sb->s_blocksize - 1) ++ >> inode->i_sb->s_blocksize_bits; + if (eof_block < map->m_lblk + map_len) + eof_block = map->m_lblk + map_len; + +@@ -3805,8 +3805,8 @@ static int ext4_split_convert_extents(ha + __func__, inode->i_ino, + (unsigned long long)map->m_lblk, map->m_len); + +- eof_block = (inode->i_size + inode->i_sb->s_blocksize - 1) >> +- inode->i_sb->s_blocksize_bits; ++ eof_block = (EXT4_I(inode)->i_disksize + inode->i_sb->s_blocksize - 1) ++ >> inode->i_sb->s_blocksize_bits; + if (eof_block < map->m_lblk + map->m_len) + eof_block = map->m_lblk + map->m_len; + /* diff --git a/queue-5.4/irqchip-ti-sci-inta-fix-processing-of-masked-irqs.patch b/queue-5.4/irqchip-ti-sci-inta-fix-processing-of-masked-irqs.patch new file mode 100644 index 00000000000..88ee9e6e684 --- /dev/null +++ b/queue-5.4/irqchip-ti-sci-inta-fix-processing-of-masked-irqs.patch @@ -0,0 +1,51 @@ +From 3688b0db5c331f4ec3fa5eb9f670a4b04f530700 Mon Sep 17 00:00:00 2001 +From: Grygorii Strashko +Date: Wed, 8 Apr 2020 22:15:32 +0300 +Subject: irqchip/ti-sci-inta: Fix processing of masked irqs + +From: Grygorii Strashko + +commit 3688b0db5c331f4ec3fa5eb9f670a4b04f530700 upstream. + +The ti_sci_inta_irq_handler() does not take into account INTA IRQs state +(masked/unmasked) as it uses INTA_STATUS_CLEAR_j register to get INTA IRQs +status, which provides raw status value. +This causes hard IRQ handlers to be called or threaded handlers to be +scheduled many times even if corresponding INTA IRQ is masked. +Above, first of all, affects the LEVEL interrupts processing and causes +unexpected behavior up the system stack or crash. + +Fix it by using the Interrupt Masked Status INTA_STATUSM_j register which +provides masked INTA IRQs status. + +Fixes: 9f1463b86c13 ("irqchip/ti-sci-inta: Add support for Interrupt Aggregator driver") +Signed-off-by: Grygorii Strashko +Signed-off-by: Marc Zyngier +Reviewed-by: Lokesh Vutla +Link: https://lore.kernel.org/r/20200408191532.31252-1-grygorii.strashko@ti.com +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/irqchip/irq-ti-sci-inta.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/irqchip/irq-ti-sci-inta.c ++++ b/drivers/irqchip/irq-ti-sci-inta.c +@@ -37,6 +37,7 @@ + #define VINT_ENABLE_SET_OFFSET 0x0 + #define VINT_ENABLE_CLR_OFFSET 0x8 + #define VINT_STATUS_OFFSET 0x18 ++#define VINT_STATUS_MASKED_OFFSET 0x20 + + /** + * struct ti_sci_inta_event_desc - Description of an event coming to +@@ -116,7 +117,7 @@ static void ti_sci_inta_irq_handler(stru + chained_irq_enter(irq_desc_get_chip(desc), desc); + + val = readq_relaxed(inta->base + vint_desc->vint_id * 0x1000 + +- VINT_STATUS_OFFSET); ++ VINT_STATUS_MASKED_OFFSET); + + for_each_set_bit(bit, &val, MAX_EVENTS_PER_VINT) { + virq = irq_find_mapping(domain, vint_desc->events[bit].hwirq); diff --git a/queue-5.4/series b/queue-5.4/series index 4ddf0ca180c..3ccb2174d14 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -51,3 +51,7 @@ net-mlx5e-use-preactivate-hook-to-set-the-indirectio.patch drm-amd-powerplay-force-the-trim-of-the-mclk-dpm_levels-if-od-is-enabled.patch drm-amdgpu-fix-the-hw-hang-during-perform-system-reboot-and-reset.patch i2c-designware-platdrv-remove-dpm_flag_smart_suspend-flag-on-byt-and-cht.patch +ext4-do-not-zeroout-extents-beyond-i_disksize.patch +irqchip-ti-sci-inta-fix-processing-of-masked-irqs.patch +x86-resctrl-preserve-cdp-enable-over-cpu-hotplug.patch +x86-resctrl-fix-invalid-attempt-at-removing-the-default-resource-group.patch diff --git a/queue-5.4/x86-resctrl-fix-invalid-attempt-at-removing-the-default-resource-group.patch b/queue-5.4/x86-resctrl-fix-invalid-attempt-at-removing-the-default-resource-group.patch new file mode 100644 index 00000000000..6badade9bd1 --- /dev/null +++ b/queue-5.4/x86-resctrl-fix-invalid-attempt-at-removing-the-default-resource-group.patch @@ -0,0 +1,71 @@ +From b0151da52a6d4f3951ea24c083e7a95977621436 Mon Sep 17 00:00:00 2001 +From: Reinette Chatre +Date: Tue, 17 Mar 2020 09:26:45 -0700 +Subject: x86/resctrl: Fix invalid attempt at removing the default resource group + +From: Reinette Chatre + +commit b0151da52a6d4f3951ea24c083e7a95977621436 upstream. + +The default resource group ("rdtgroup_default") is associated with the +root of the resctrl filesystem and should never be removed. New resource +groups can be created as subdirectories of the resctrl filesystem and +they can be removed from user space. + +There exists a safeguard in the directory removal code +(rdtgroup_rmdir()) that ensures that only subdirectories can be removed +by testing that the directory to be removed has to be a child of the +root directory. + +A possible deadlock was recently fixed with + + 334b0f4e9b1b ("x86/resctrl: Fix a deadlock due to inaccurate reference"). + +This fix involved associating the private data of the "mon_groups" +and "mon_data" directories to the resource group to which they belong +instead of NULL as before. A consequence of this change was that +the original safeguard code preventing removal of "mon_groups" and +"mon_data" found in the root directory failed resulting in attempts to +remove the default resource group that ends in a BUG: + + kernel BUG at mm/slub.c:3969! + invalid opcode: 0000 [#1] SMP PTI + + Call Trace: + rdtgroup_rmdir+0x16b/0x2c0 + kernfs_iop_rmdir+0x5c/0x90 + vfs_rmdir+0x7a/0x160 + do_rmdir+0x17d/0x1e0 + do_syscall_64+0x55/0x1d0 + entry_SYSCALL_64_after_hwframe+0x44/0xa9 + +Fix this by improving the directory removal safeguard to ensure that +subdirectories of the resctrl root directory can only be removed if they +are a child of the resctrl filesystem's root _and_ not associated with +the default resource group. + +Fixes: 334b0f4e9b1b ("x86/resctrl: Fix a deadlock due to inaccurate reference") +Reported-by: Sai Praneeth Prakhya +Signed-off-by: Reinette Chatre +Signed-off-by: Borislav Petkov +Tested-by: Sai Praneeth Prakhya +Cc: stable@vger.kernel.org +Link: https://lkml.kernel.org/r/884cbe1773496b5dbec1b6bd11bb50cffa83603d.1584461853.git.reinette.chatre@intel.com +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86/kernel/cpu/resctrl/rdtgroup.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c ++++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c +@@ -3006,7 +3006,8 @@ static int rdtgroup_rmdir(struct kernfs_ + * If the rdtgroup is a mon group and parent directory + * is a valid "mon_groups" directory, remove the mon group. + */ +- if (rdtgrp->type == RDTCTRL_GROUP && parent_kn == rdtgroup_default.kn) { ++ if (rdtgrp->type == RDTCTRL_GROUP && parent_kn == rdtgroup_default.kn && ++ rdtgrp != &rdtgroup_default) { + if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP || + rdtgrp->mode == RDT_MODE_PSEUDO_LOCKED) { + ret = rdtgroup_ctrl_remove(kn, rdtgrp); diff --git a/queue-5.4/x86-resctrl-preserve-cdp-enable-over-cpu-hotplug.patch b/queue-5.4/x86-resctrl-preserve-cdp-enable-over-cpu-hotplug.patch new file mode 100644 index 00000000000..e0af42b1f02 --- /dev/null +++ b/queue-5.4/x86-resctrl-preserve-cdp-enable-over-cpu-hotplug.patch @@ -0,0 +1,74 @@ +From 9fe0450785abbc04b0ed5d3cf61fcdb8ab656b4b Mon Sep 17 00:00:00 2001 +From: James Morse +Date: Fri, 21 Feb 2020 16:21:05 +0000 +Subject: x86/resctrl: Preserve CDP enable over CPU hotplug + +From: James Morse + +commit 9fe0450785abbc04b0ed5d3cf61fcdb8ab656b4b upstream. + +Resctrl assumes that all CPUs are online when the filesystem is mounted, +and that CPUs remember their CDP-enabled state over CPU hotplug. + +This goes wrong when resctrl's CDP-enabled state changes while all the +CPUs in a domain are offline. + +When a domain comes online, enable (or disable!) CDP to match resctrl's +current setting. + +Fixes: 5ff193fbde20 ("x86/intel_rdt: Add basic resctrl filesystem support") +Suggested-by: Reinette Chatre +Signed-off-by: James Morse +Signed-off-by: Borislav Petkov +Cc: +Link: https://lkml.kernel.org/r/20200221162105.154163-1-james.morse@arm.com +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86/kernel/cpu/resctrl/core.c | 2 ++ + arch/x86/kernel/cpu/resctrl/internal.h | 1 + + arch/x86/kernel/cpu/resctrl/rdtgroup.c | 13 +++++++++++++ + 3 files changed, 16 insertions(+) + +--- a/arch/x86/kernel/cpu/resctrl/core.c ++++ b/arch/x86/kernel/cpu/resctrl/core.c +@@ -578,6 +578,8 @@ static void domain_add_cpu(int cpu, stru + d->id = id; + cpumask_set_cpu(cpu, &d->cpu_mask); + ++ rdt_domain_reconfigure_cdp(r); ++ + if (r->alloc_capable && domain_setup_ctrlval(r, d)) { + kfree(d); + return; +--- a/arch/x86/kernel/cpu/resctrl/internal.h ++++ b/arch/x86/kernel/cpu/resctrl/internal.h +@@ -601,5 +601,6 @@ bool has_busy_rmid(struct rdt_resource * + void __check_limbo(struct rdt_domain *d, bool force_free); + bool cbm_validate_intel(char *buf, u32 *data, struct rdt_resource *r); + bool cbm_validate_amd(char *buf, u32 *data, struct rdt_resource *r); ++void rdt_domain_reconfigure_cdp(struct rdt_resource *r); + + #endif /* _ASM_X86_RESCTRL_INTERNAL_H */ +--- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c ++++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c +@@ -1769,6 +1769,19 @@ static int set_cache_qos_cfg(int level, + return 0; + } + ++/* Restore the qos cfg state when a domain comes online */ ++void rdt_domain_reconfigure_cdp(struct rdt_resource *r) ++{ ++ if (!r->alloc_capable) ++ return; ++ ++ if (r == &rdt_resources_all[RDT_RESOURCE_L2DATA]) ++ l2_qos_cfg_update(&r->alloc_enabled); ++ ++ if (r == &rdt_resources_all[RDT_RESOURCE_L3DATA]) ++ l3_qos_cfg_update(&r->alloc_enabled); ++} ++ + /* + * Enable or disable the MBA software controller + * which helps user specify bandwidth in MBps.