5.9.4-rc1 review
Subsystems (6)
Greg Kroah-Hartman
maintainerPATCH 346/391 ext4: fix bdev write error check failed when mount fs with ro
In reply to Greg Kroah-HartmanFrom: Zhang Xiaoxu <[email protected]>
commit 9704a322ea67fdb05fc66cf431fdd01c2424bbd9 upstream.
Consider a situation when a filesystem was uncleanly shutdown and the orphan list is not empty and a read-only mount is attempted. The orphan list cleanup during mount will fail with:
ext4_check_bdev_write_error:193: comm mount: Error while async write back metadata
This happens because sbi->s_bdev_wb_err is not initialized when mounting the filesystem in read only mode and so ext4_check_bdev_write_error() falsely triggers.
Initialize sbi->s_bdev_wb_err unconditionally to avoid this problem.
--- fs/ext4/super.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-)
fs/ext4/super.c +2 -11
@@ -4826,9 +4826,8 @@ no_journal:* used to detect the metadata async write error. */ spin_lock_init (&sbi->s_bdev_wb_lock); -if (!sb_rdonly (sb)) -errseq_check_and_advance (&sb->s_bdev->bd_inode->i_mapping->wb_err, - &sbi->s_bdev_wb_err); +errseq_check_and_advance (&sb->s_bdev->bd_inode->i_mapping->wb_err, + &sbi->s_bdev_wb_err); sb->s_bdev->bd_super = sb;EXT4_SB (sb)->s_mount_state |=EXT4_ORPHAN_FS ;ext4_orphan_cleanup (sb, es);
@@ -5721,14 +5720,6 @@ static int ext4_remount(struct super_blo }/* -* Update the original bdev mapping's wb_err value -* which could be used to detect the metadata async -* write error. -*/ -errseq_check_and_advance (&sb->s_bdev->bd_inode->i_mapping->wb_err, - &sbi->s_bdev_wb_err); - -/* * Mounting a RDONLY partition read-write, so reread * and store the current valid flag. (It may have * been changed by e2fsck since we originally mounted
Greg Kroah-Hartman
maintainerPATCH 379/391 KVM: arm64: Fix AArch32 handling of DBGD{CCINT,SCRext} and DBGVCR
In reply to Greg Kroah-HartmanFrom: Marc Zyngier <[email protected]>
commit 4a1c2c7f63c52ccb11770b5ae25920a6b79d3548 upstream.
The DBGD{CCINT,SCRext} and DBGVCR register entries in the cp14 array are missing their target register, resulting in all accesses being targetted at the guard sysreg (indexed by __INVALID_SYSREG__).
Point the emulation code at the actual register entries.
--- arch/arm64/include/asm/kvm_host.h | 1 + arch/arm64/kvm/sys_regs.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-)
arch/arm64/include/asm/kvm_host.h +1 -0
@@ -231,6 +231,7 @@ enum vcpu_sysreg {#define cp14_DBGWCR0 (DBGWCR0_EL1 * 2)#define cp14_DBGWVR0 (DBGWVR0_EL1 * 2)#define cp14_DBGDCCINT (MDCCINT_EL1 * 2) +#define cp14_DBGVCR (DBGVCR32_EL2 * 2)#define NR_COPRO_REGS (NR_SYS_REGS * 2)
arch/arm64/kvm/sys_regs.c +3 -3
@@ -1881,9 +1881,9 @@ static const struct sys_reg_desc cp14_re { Op1( 0), CRn( 0), CRm( 1), Op2( 0), trap_raz_wi },DBG_BCR_BVR_WCR_WVR (1 ),/* DBGDCCINT */ - { Op1( 0), CRn( 0), CRm( 2), Op2( 0), trap_debug32 }, + { Op1( 0), CRn( 0), CRm( 2), Op2( 0), trap_debug32, NULL, cp14_DBGDCCINT },/* DBGDSCRext */ - { Op1( 0), CRn( 0), CRm( 2), Op2( 2), trap_debug32 }, + { Op1( 0), CRn( 0), CRm( 2), Op2( 2), trap_debug32, NULL, cp14_DBGDSCRext },DBG_BCR_BVR_WCR_WVR (2 ),/* DBGDTR[RT]Xint */ { Op1( 0), CRn( 0), CRm( 3), Op2( 0), trap_raz_wi },
@@ -1898,7 +1898,7 @@ static const struct sys_reg_desc cp14_re { Op1( 0), CRn( 0), CRm( 6), Op2( 2), trap_raz_wi },DBG_BCR_BVR_WCR_WVR (6 ),/* DBGVCR */ - { Op1( 0), CRn( 0), CRm( 7), Op2( 0), trap_debug32 }, + { Op1( 0), CRn( 0), CRm( 7), Op2( 0), trap_debug32, NULL, cp14_DBGVCR },DBG_BCR_BVR_WCR_WVR (7 ),DBG_BCR_BVR_WCR_WVR (8 ), DBG_BCR_BVR_WCR_WVR(9),
Greg Kroah-Hartman
maintainerPATCH 380/391 stop_machine, rcu: Mark functions as notrace
In reply to Greg Kroah-HartmanFrom: Zong Li <[email protected]>
commit 4230e2deaa484b385aa01d598b2aea8e7f2660a6 upstream.
Some architectures assume that the stopped CPUs don't make function calls to traceable functions when they are in the stopped state. See also commit cb9d7fd51d9f ("watchdog: Mark watchdog touch functions as notrace").
Violating this assumption causes kernel crashes when switching tracer on RISC-V.
Mark rcu_momentary_dyntick_idle() and stop_machine_yield() notrace to prevent this.
--- kernel/rcu/tree.c | 2 +- kernel/stop_machine.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
kernel/rcu/tree.c +1 -1
@@ -416,7 +416,7 @@ bool rcu_eqs_special_set(int cpu)* * The caller must have disabled interrupts and must not be idle. */ -void rcu_momentary_dyntick_idle (void ) +notrace void rcu_momentary_dyntick_idle(void) {int special;
kernel/stop_machine.c +1 -1
@@ -178,7 +178,7 @@ static void ack_state(struct multi_stop_set_state (msdata, msdata->state +1 ); } -void __weak stop_machine_yield (const struct cpumask *cpumask) +notrace void __weak stop_machine_yield(const struct cpumask *cpumask) {cpu_relax (); }
Greg Kroah-Hartman
maintainerPATCH 378/391 KVM: x86: Fix NULL dereference at kvm_msr_ignored_check()
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit d383b3146d805a743658225c8973f5d38c6fedf4 upstream.
The newly introduced kvm_msr_ignored_check() tries to print error or debug messages via vcpu_*() macros, but those may cause Oops when NULL vcpu is passed for KVM_GET_MSRS ioctl.
Fix it by replacing the print calls with kvm_*() macros.
(Note that this will leave vcpu argument completely unused in the
function, but I didn't touch it to make the fix as small as possible. A clean up may be applied later.)
Message-Id: <[email protected]>
--- arch/x86/kvm/x86.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/x86/kvm/x86.c +4 -4
@@ -259,13 +259,13 @@ static int kvm_msr_ignored_check(structif (ignore_msrs) {if (report_ignored_msrs) -vcpu_unimpl (vcpu,"ignored %s: 0x%x data 0x%llx\n" , - op, msr, data); +kvm_pr_unimpl ("ignored %s: 0x%x data 0x%llx\n" , + op, msr, data);/* Mask the error */ return 0 ; }else { -vcpu_debug_ratelimited (vcpu,"unhandled %s: 0x%x data 0x%llx\n" , - op, msr, data); +kvm_debug_ratelimited ("unhandled %s: 0x%x data 0x%llx\n" , + op, msr, data);return 1 ; } }
Greg Kroah-Hartman
maintainerPATCH 370/391 ARM: samsung: fix PM debug build with DEBUG_LL but !MMU
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
commit 7be0d19c751b02db778ca95e3274d5ea7f31891c upstream.
Selecting CONFIG_SAMSUNG_PM_DEBUG (depending on CONFIG_DEBUG_LL) but without CONFIG_MMU leads to build errors:
arch/arm/plat-samsung/pm-debug.c: In function ‘s3c_pm_uart_base’:
arch/arm/plat-samsung/pm-debug.c:57:2: error:
implicit declaration of function ‘debug_ll_addr’ [-Werror=implicit-function-declaration]
--- arch/arm/plat-samsung/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm/plat-samsung/Kconfig +1 -0
@@ -241,6 +241,7 @@ config SAMSUNG_PM_DEBUG depends on PM && DEBUG_KERNEL depends on PLAT_S3C24XX || ARCH_S3C64XX || ARCH_S5PV210 depends on DEBUG_EXYNOS_UART || DEBUG_S3C24XX_UART || DEBUG_S3C2410_UART + depends on DEBUG_LL && MMU help Say Y here if you want verbose debugging from the PM Suspend and Resume code. See <file:Documentation/arm/samsung-s3c24xx/suspend.rst>
Greg Kroah-Hartman
maintainerPATCH 365/391 hil/parisc: Disable HIL driver when it gets stuck
In reply to Greg Kroah-HartmanFrom: Helge Deller <[email protected]>
commit 879bc2d27904354b98ca295b6168718e045c4aa2 upstream.
When starting a HP machine with HIL driver but without an HIL keyboard or HIL mouse attached, it may happen that data written to the HIL loop gets stuck (e.g. because the transaction queue is full). Usually one will then have to reboot the machine because all you see is and endless output of:
Transaction add failed: transaction already queued?
In the higher layers hp_sdc_enqueue_transaction() is called to queued up a HIL packet. This function returns an error code, and this patch adds the necessary checks for this return code and disables the HIL driver if further packets can't be sent.
Tested on a HP 730 and a HP 715/64 machine.
--- drivers/input/serio/hil_mlc.c | 21 ++++++++++++++++++--- drivers/input/serio/hp_sdc_mlc.c | 8 ++++---- include/linux/hil_mlc.h | 2 +- 3 files changed, 23 insertions(+), 8 deletions(-)
drivers/input/serio/hil_mlc.c +18 -3
@@ -74,7 +74,7 @@ EXPORT_SYMBOL(hil_mlc_unregister);static LIST_HEAD (hil_mlcs);static DEFINE_RWLOCK (hil_mlcs_lock);static struct timer_list hil_mlcs_kicker; -static int hil_mlcs_probe; +static int hil_mlcs_probe, hil_mlc_stop;static void hil_mlcs_process (unsigned long unused); static DECLARE_TASKLET_DISABLED_OLD(hil_mlcs_tasklet, hil_mlcs_process);
@@ -702,9 +702,13 @@ static int hilse_donode(hil_mlc *mlc)if (!mlc->ostarted) { mlc->ostarted =1 ; mlc->opacket = pack; - mlc->out (mlc); + rc = mlc->out (mlc); nextidx =HILSEN_DOZE ;write_unlock_irqrestore (&mlc->lock, flags); +if (rc) { + hil_mlc_stop =1 ; +return 1 ; + }break ; } mlc->ostarted =0 ;
@@ -715,8 +719,13 @@ static int hilse_donode(hil_mlc *mlc)case HILSE_CTS :write_lock_irqsave (&mlc->lock, flags); - nextidx = mlc->cts (mlc) ? node->bad : node->good; + rc = mlc->cts (mlc); + nextidx = rc ? node->bad : node->good;write_unlock_irqrestore (&mlc->lock, flags); +if (rc) { + hil_mlc_stop =1 ; +return 1 ; + }break ;default :
@@ -780,6 +789,12 @@ static void hil_mlcs_process(unsigned lostatic void hil_mlcs_timer (struct timer_list *unused) { +if (hil_mlc_stop) { +/* could not send packet - stop immediately. */ +pr_warn (PREFIX "HIL seems stuck - Disabling HIL MLC.\n" ); +return ; + } + hil_mlcs_probe =1 ;tasklet_schedule (&hil_mlcs_tasklet);/* Re-insert the periodic task. */
drivers/input/serio/hp_sdc_mlc.c +4 -4
@@ -210,7 +210,7 @@ static int hp_sdc_mlc_cts(hil_mlc *mlc) priv->tseq[2 ] =1 ; priv->tseq[3 ] =0 ; priv->tseq[4 ] =0 ; -__hp_sdc_enqueue_transaction (&priv->trans); +return __hp_sdc_enqueue_transaction (&priv->trans); busy:return 1 ; done:
@@ -219,7 +219,7 @@ static int hp_sdc_mlc_cts(hil_mlc *mlc)return 0 ; } -static void hp_sdc_mlc_out (hil_mlc *mlc) +static int hp_sdc_mlc_out (hil_mlc *mlc) {struct hp_sdc_mlc_priv_s *priv;
@@ -234,7 +234,7 @@ static void hp_sdc_mlc_out(hil_mlc *mlc) do_data:if (priv->emtestmode) {up (&mlc->osem); -return ; +return 0 ; }/* Shouldn't be sending commands when loop may be busy */ BUG_ON (down_trylock (&mlc->csem));
@@ -296,7 +296,7 @@ static void hp_sdc_mlc_out(hil_mlc *mlc)BUG_ON (down_trylock (&mlc->csem)); } enqueue: -hp_sdc_enqueue_transaction (&priv->trans); +return hp_sdc_enqueue_transaction (&priv->trans); }static int __init hp_sdc_mlc_init (void )
include/linux/hil_mlc.h +1 -1
@@ -103,7 +103,7 @@ struct hilse_node {/* Methods for back-end drivers, e.g. hp_sdc_mlc */ typedef int (hil_mlc_cts ) (hil_mlc *mlc); -typedef void (hil_mlc_out ) (hil_mlc *mlc); +typedef int (hil_mlc_out ) (hil_mlc *mlc);typedef int (hil_mlc_in ) (hil_mlc *mlc,suseconds_t timeout);struct hil_mlc_devinfo {
Greg Kroah-Hartman
maintainerPATCH 362/391 tty: make FONTX ioctl use the tty pointer they were actually passed
In reply to Greg Kroah-HartmanFrom: Linus Torvalds <[email protected]>
commit 90bfdeef83f1d6c696039b6a917190dcbbad3220 upstream.
Some of the font tty ioctl's always used the current foreground VC for their operations. Don't do that then.
This fixes a data race on fg_console.
Side note: both Michael Ellerman and Jiri Slaby point out that all these ioctls are deprecated, and should probably have been removed long ago, and everything seems to be using the KDFONTOP ioctl instead.
In fact, Michael points out that it looks like busybox's loadfont program seems to have switched over to using KDFONTOP exactly _because_ of this bug (ahem.. 12 years ago ;-).
--- drivers/tty/vt/vt_ioctl.c | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-)
drivers/tty/vt/vt_ioctl.c +19 -17
@@ -485,7 +485,7 @@ static int vt_k_ioctl(struct tty_structreturn 0 ; } -static inline int do_fontx_ioctl (int cmd, +static inline int do_fontx_ioctl (struct vc_data *vc,int cmd,struct consolefontdesc __user *user_cfd,struct console_font_op *op) {
@@ -503,15 +503,16 @@ static inline int do_fontx_ioctl(int cmd op->height = cfdarg.charheight; op->charcount = cfdarg.charcount; op->data = cfdarg.chardata; -return con_font_op (vc_cons[fg_console].d, op); -case GIO_FONTX : { +return con_font_op (vc, op); + +case GIO_FONTX : op->op =KD_FONT_OP_GET ; op->flags =KD_FONT_FLAG_OLD ; op->width =8 ; op->height = cfdarg.charheight; op->charcount = cfdarg.charcount; op->data = cfdarg.chardata; - i =con_font_op (vc_cons[fg_console].d, op); + i =con_font_op (vc, op);if (i)return i; cfdarg.charheight = op->height;
@@ -519,12 +520,11 @@ static inline int do_fontx_ioctl(int cmdif (copy_to_user (user_cfd, &cfdarg,sizeof (struct consolefontdesc )))return -EFAULT ;return 0 ; - } }return -EINVAL ; } -static int vt_io_fontreset (struct console_font_op *op) +static int vt_io_fontreset (struct vc_data *vc,struct console_font_op *op) {int ret;
@@ -538,12 +538,12 @@ static int vt_io_fontreset(struct consol op->op =KD_FONT_OP_SET_DEFAULT ; op->data =NULL ; - ret =con_font_op (vc_cons[fg_console].d, op); + ret =con_font_op (vc, op);if (ret)return ret;console_lock (); -con_set_default_unimap (vc_cons[fg_console].d); +con_set_default_unimap (vc);console_unlock ();return 0 ;
@@ -585,7 +585,7 @@ static int vt_io_ioctl(struct vc_data *v op.height =0 ; op.charcount =256 ; op.data = up; -return con_font_op (vc_cons[fg_console].d, &op); +return con_font_op (vc, &op);case GIO_FONT : op.op =KD_FONT_OP_GET ;
@@ -594,7 +594,7 @@ static int vt_io_ioctl(struct vc_data *v op.height =32 ; op.charcount =256 ; op.data = up; -return con_font_op (vc_cons[fg_console].d, &op); +return con_font_op (vc, &op);case PIO_CMAP :if (!perm)
@@ -610,13 +610,13 @@ static int vt_io_ioctl(struct vc_data *v fallthrough;case GIO_FONTX : -return do_fontx_ioctl (cmd, up, &op); +return do_fontx_ioctl (vc, cmd, up, &op);case PIO_FONTRESET :if (!perm)return -EPERM ; -return vt_io_fontreset (&op); +return vt_io_fontreset (vc, &op);case PIO_SCRNMAP :if (!perm)
@@ -1067,8 +1067,9 @@ struct compat_consolefontdesc { };static inline int -compat_fontx_ioctl (int cmd,struct compat_consolefontdesc __user *user_cfd, -int perm,struct console_font_op *op) +compat_fontx_ioctl (struct vc_data *vc,int cmd, +struct compat_consolefontdesc __user *user_cfd, +int perm,struct console_font_op *op) {struct compat_consolefontdesc cfdarg;int i;
@@ -1086,7 +1087,8 @@ compat_fontx_ioctl(int cmd, struct compa op->height = cfdarg.charheight; op->charcount = cfdarg.charcount; op->data =compat_ptr (cfdarg.chardata); -return con_font_op (vc_cons[fg_console].d, op); +return con_font_op (vc, op); +case GIO_FONTX : op->op =KD_FONT_OP_GET ; op->flags =KD_FONT_FLAG_OLD ;
@@ -1094,7 +1096,7 @@ compat_fontx_ioctl(int cmd, struct compa op->height = cfdarg.charheight; op->charcount = cfdarg.charcount; op->data =compat_ptr (cfdarg.chardata); - i =con_font_op (vc_cons[fg_console].d, op); + i =con_font_op (vc, op);if (i)return i; cfdarg.charheight = op->height;
@@ -1184,7 +1186,7 @@ long vt_compat_ioctl(struct tty_struct **/ case PIO_FONTX :case GIO_FONTX : -return compat_fontx_ioctl (cmd, up, perm, &op); +return compat_fontx_ioctl (vc, cmd, up, perm, &op);case KDFONTOP :return compat_kdfontop_ioctl (up, perm, &op, vc);
Greg Kroah-Hartman
maintainerPATCH 361/391 drm/amdgpu: correct the cu and rb info for sienna cichlid
In reply to Greg Kroah-HartmanFrom: Likun Gao <[email protected]>
commit 687e79c0feb4243b141b1e9a20adba3c0ec66f7f upstream.
Skip disabled sa to correct the cu_info and active_rbs for sienna cichlid.
--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +9 -0
@@ -4537,12 +4537,17 @@ static void gfx_v10_0_setup_rb(struct amint i, j;u32 data;u32 active_rbs =0 ; +u32 bitmap;u32 rb_bitmap_width_per_sh = adev->gfx.config.max_backends_per_se / adev->gfx.config.max_sh_per_se;mutex_lock (&adev->grbm_idx_mutex);for (i =0 ; i < adev->gfx.config.max_shader_engines; i++) {for (j =0 ; j < adev->gfx.config.max_sh_per_se; j++) { + bitmap = i * adev->gfx.config.max_sh_per_se + j; +if ((adev->asic_type ==CHIP_SIENNA_CICHLID ) && + ((gfx_v10_3_get_disabled_sa (adev) >> bitmap) &1 )) +continue ;gfx_v10_0_select_se_sh (adev, i, j,0xffffffff ); data =gfx_v10_0_get_rb_active_bitmap (adev); active_rbs |= data << ((i * adev->gfx.config.max_sh_per_se + j) *
@@ -8761,6 +8766,10 @@ static int gfx_v10_0_get_cu_info(structmutex_lock (&adev->grbm_idx_mutex);for (i =0 ; i < adev->gfx.config.max_shader_engines; i++) {for (j =0 ; j < adev->gfx.config.max_sh_per_se; j++) { + bitmap = i * adev->gfx.config.max_sh_per_se + j; +if ((adev->asic_type ==CHIP_SIENNA_CICHLID ) && + ((gfx_v10_3_get_disabled_sa (adev) >> bitmap) &1 )) +continue ; mask =1 ; ao_bitmap =0 ; counter =0 ;
Greg Kroah-Hartman
maintainerPATCH 358/391 drm/amd/pm: fix pp_dpm_fclk
In reply to Greg Kroah-HartmanFrom: Kenneth Feng <[email protected]>
commit 392d256fa26d943fb0a019fea4be80382780d3b1 upstream.
fclk value is missing in pp_dpm_fclk. add this to correctly show the current value.
--- drivers/gpu/drm/amd/powerplay/sienna_cichlid_ppt.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/powerplay/sienna_cichlid_ppt.c +3 -0
@@ -447,6 +447,9 @@ static int sienna_cichlid_get_smu_metriccase METRICS_CURR_DCEFCLK : *value = metrics->CurrClock[PPCLK_DCEFCLK ];break ; +case METRICS_CURR_FCLK : + *value = metrics->CurrClock[PPCLK_FCLK ]; +break ;case METRICS_AVERAGE_GFXCLK :if (metrics->AverageGfxActivity <=SMU_11_0_7_GFX_BUSY_THRESHOLD ) *value = metrics->AverageGfxclkFrequencyPostDs;
Greg Kroah-Hartman
maintainerPATCH 354/391 memory: brcmstb_dpfe: Fix memory leak
In reply to Greg Kroah-HartmanFrom: Alex Dewar <[email protected]>
commit 4da1edcf8f226d53c02c6b0e3077d581115b30d0 upstream.
In brcmstb_dpfe_download_firmware(), memory is allocated to variable fw by firmware_request_nowarn(), but never released. Fix up to release fw on all return paths.
--- drivers/memory/brcmstb_dpfe.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/memory/brcmstb_dpfe.c +10 -6
@@ -656,8 +656,10 @@ static int brcmstb_dpfe_download_firmwarreturn (ret == -ENOENT ) ? -EPROBE_DEFER : ret; ret =__verify_firmware (&init, fw); -if (ret) -return -EFAULT ; +if (ret) { + ret = -EFAULT ; + goto release_fw; + }__disable_dcpu (priv);
@@ -676,18 +678,20 @@ static int brcmstb_dpfe_download_firmwar ret =__write_firmware (priv->dmem, dmem, dmem_size, is_big_endian);if (ret) -return ret; + goto release_fw; ret =__write_firmware (priv->imem, imem, imem_size, is_big_endian);if (ret) -return ret; + goto release_fw; ret =__verify_fw_checksum (&init, priv, header, init.chksum);if (ret) -return ret; + goto release_fw;__enable_dcpu (priv); -return 0 ; +release_fw: +release_firmware (fw); +return ret; } static ssize_t generic_show(unsigned int command, u32 response[],
Greg Kroah-Hartman
maintainerPATCH 353/391 memory: tegra: Remove GPU from DRM IOMMU group
In reply to Greg Kroah-HartmanFrom: Thierry Reding <[email protected]>
commit ea90f66f2a8629dde07328df0b8314aae5e54a47 upstream.
Commit 63a613fdb16c ("memory: tegra: Add gr2d and gr3d to DRM IOMMU group") added the GPU to the DRM IOMMU group, which doesn't make any sense. This causes problems when Nouveau tries to attach to the SMMU and causes it to fall back to using the DMA API.
Remove the GPU from the DRM groups to restore the old behaviour. The GPU should always have its own IOMMU domain to make sure it can map buffers into contiguous chunks (for big page support) without getting in the way of mappings from the DRM group.
--- drivers/memory/tegra/tegra124.c | 1 - 1 file changed, 1 deletion(-)
drivers/memory/tegra/tegra124.c +0 -1
@@ -957,7 +957,6 @@ static const struct tegra_smmu_swgroup tstatic const unsigned int tegra124_group_drm[] = {TEGRA_SWGROUP_DC ,TEGRA_SWGROUP_DCB , -TEGRA_SWGROUP_GPU ,TEGRA_SWGROUP_VIC , };
Greg Kroah-Hartman
maintainerPATCH 310/391 perf python scripting: Fix printable strings in python3 scripts
In reply to Greg Kroah-HartmanFrom: Jiri Olsa <[email protected]>
commit 6fcd5ddc3b1467b3586972ef785d0d926ae4cdf4 upstream.
Hagen reported broken strings in python3 tracepoint scripts:
make PYTHON=python3 perf record -e sched:sched_switch -a -- sleep 5 perf script --gen-script py perf script -s ./perf-script.py
[..]
sched__sched_switch 7 563231.759525792 0 swapper prev_comm=bytearray(b'swapper/7\x00\x00\x00\x00\x00\x00\x00'), prev_pid=0, prev_prio=120, prev_state=, next_comm=bytearray(b'mutex-thread-co\x00'),
The problem is in the is_printable_array function that does not take the zero byte into account and claim such string as not printable, so the code will create byte array instead of string.
Committer testing:
After this fix:
sched__sched_switch 3 484522.497072626 1158680 kworker/3:0-eve prev_comm=kworker/3:0, prev_pid=1158680, prev_prio=120, prev_state=I, next_comm=swapper/3, next_pid=0, next_prio=120
Sample: {addr=0, cpu=3, datasrc=84410401, datasrc_decode=N/A|SNP N/A|TLB N/A|LCK N/A, ip=18446744071841817196, period=1, phys_addr=0, pid=1158680, tid=1158680, time=484522497072626, transaction=0, values=[(0, 0)], weight=0}
sched__sched_switch 4 484522.497085610 1225814 perf prev_comm=perf, prev_pid=1225814, prev_prio=120, prev_state=, next_comm=migration/4, next_pid=30, next_prio=0
Sample: {addr=0, cpu=4, datasrc=84410401, datasrc_decode=N/A|SNP N/A|TLB N/A|LCK N/A, ip=18446744071841817196, period=1, phys_addr=0, pid=1225814, tid=1225814, time=484522497085610, transaction=0, values=[(0, 0)], weight=0}
--- tools/perf/util/print_binary.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/print_binary.c +1 -1
@@ -50,7 +50,7 @@ int is_printable_array(char *p, unsigned len--; -for (i =0 ; i < len; i++) { +for (i =0 ; i < len && p[i]; i++) {if (!isprint (p[i]) && !isspace (p[i]))return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 306/391 ubifs: Fix a memleak after dumping authentication mount options
In reply to Greg Kroah-HartmanFrom: Zhihao Cheng <[email protected]>
commit 47f6d9ce45b03a40c34b668a9884754c58122b39 upstream.
Fix a memory leak after dumping authentication mount options in error handling branch.
--- fs/ubifs/super.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
fs/ubifs/super.c +14 -2
@@ -1141,6 +1141,18 @@ static int ubifs_parse_options(struct ubreturn 0 ; } +/* +* ubifs_release_options - release mount parameters which have been dumped. +* @c: UBIFS file-system description object +*/ +static void ubifs_release_options (struct ubifs_info *c) +{ +kfree (c->auth_key_name); + c->auth_key_name =NULL ; +kfree (c->auth_hash_name); + c->auth_hash_name =NULL ; +} +/** * destroy_journal - destroy journal data structures. * @c: UBIFS file-system description object
@@ -1650,8 +1662,7 @@ static void ubifs_umount(struct ubifs_inubifs_lpt_free (c,0 );ubifs_exit_authentication (c); -kfree (c->auth_key_name); -kfree (c->auth_hash_name); +ubifs_release_options (c);kfree (c->cbuf);kfree (c->rcvrd_mst_node);kfree (c->mst_node);
@@ -2219,6 +2230,7 @@ out_umount: out_unlock:mutex_unlock (&c->umount_mutex); out_close: +ubifs_release_options (c);ubi_close_volume (c->ubi); out:return err;
Greg Kroah-Hartman
maintainerPATCH 305/391 ubifs: journal: Make sure to not dirty twice for auth nodes
In reply to Greg Kroah-HartmanFrom: Richard Weinberger <[email protected]>
commit 78c7d49f55d8631b67c09f9bfbe8155211a9ea06 upstream.
When removing the last reference of an inode the size of an auth node is already part of write_len. So we must not call ubifs_add_auth_dirt(). Call it only when needed.
--- fs/ubifs/journal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/ubifs/journal.c +2 -2
@@ -938,8 +938,6 @@ int ubifs_jnl_write_inode(struct ubifs_i inode->i_ino);release_head (c,BASEHD ); -ubifs_add_auth_dirt (c, lnum); -if (last_reference) { err =ubifs_tnc_remove_ino (c, inode->i_ino);if (err)
@@ -949,6 +947,8 @@ int ubifs_jnl_write_inode(struct ubifs_i }else {union ubifs_key key; +ubifs_add_auth_dirt (c, lnum); +ino_key_init (c, &key, inode->i_ino); err =ubifs_tnc_add (c, &key, lnum, offs, ilen, hash); }
Greg Kroah-Hartman
maintainerPATCH 304/391 ubifs: xattr: Fix some potential memory leaks while iterating entries
In reply to Greg Kroah-HartmanFrom: Zhihao Cheng <[email protected]>
commit f2aae745b82c842221f4f233051f9ac641790959 upstream.
Fix some potential memory leaks in error handling branches while iterating xattr entries. For example, function ubifs_tnc_remove_ino() forgets to free pxent if it exists. Similar problems also exist in ubifs_purge_xattrs(), ubifs_add_orphan() and ubifs_jnl_write_inode().
--- fs/ubifs/journal.c | 2 ++ fs/ubifs/orphan.c | 2 ++ fs/ubifs/tnc.c | 3 +++ fs/ubifs/xattr.c | 2 ++ 4 files changed, 9 insertions(+)
fs/ubifs/journal.c +2 -0
@@ -894,6 +894,7 @@ int ubifs_jnl_write_inode(struct ubifs_iif (err == -ENOENT )break ; +kfree (pxent); goto out_release; }
@@ -906,6 +907,7 @@ int ubifs_jnl_write_inode(struct ubifs_iubifs_err (c,"dead directory entry '%s', error %d" , xent->name, err);ubifs_ro_mode (c, err); +kfree (pxent);kfree (xent); goto out_release; }
fs/ubifs/orphan.c +2 -0
@@ -173,6 +173,7 @@ int ubifs_add_orphan(struct ubifs_info * err =PTR_ERR (xent);if (err == -ENOENT )break ; +kfree (pxent);return err; }
@@ -182,6 +183,7 @@ int ubifs_add_orphan(struct ubifs_info * xattr_orphan =orphan_add (c, xattr_inum, orphan);if (IS_ERR (xattr_orphan)) { +kfree (pxent);kfree (xent);return PTR_ERR (xattr_orphan); }
fs/ubifs/tnc.c +3 -0
@@ -2885,6 +2885,7 @@ int ubifs_tnc_remove_ino(struct ubifs_in err =PTR_ERR (xent);if (err == -ENOENT )break ; +kfree (pxent);return err; }
@@ -2898,6 +2899,7 @@ int ubifs_tnc_remove_ino(struct ubifs_infname_len (&nm) =le16_to_cpu (xent->nlen); err =ubifs_tnc_remove_nm (c, &key1, &nm);if (err) { +kfree (pxent);kfree (xent);return err; }
@@ -2906,6 +2908,7 @@ int ubifs_tnc_remove_ino(struct ubifs_inhighest_ino_key (c, &key2, xattr_inum); err =ubifs_tnc_remove_range (c, &key1, &key2);if (err) { +kfree (pxent);kfree (xent);return err; }
fs/ubifs/xattr.c +2 -0
@@ -522,6 +522,7 @@ int ubifs_purge_xattrs(struct inode *hos xent->name, err);ubifs_ro_mode (c, err);kfree (pxent); +kfree (xent);return err; }
@@ -531,6 +532,7 @@ int ubifs_purge_xattrs(struct inode *hos err =remove_xattr (c, host, xino, &nm);if (err) {kfree (pxent); +kfree (xent);iput (xino);ubifs_err (c,"cannot remove xattr, error %d" , err);return err;
Greg Kroah-Hartman
maintainerPATCH 330/391 9P: Cast to loff_t before multiplying
In reply to Greg Kroah-HartmanFrom: Matthew Wilcox (Oracle) <[email protected]>
commit f5f7ab168b9a60e12a4b8f2bb6fcc91321dc23c1 upstream.
On 32-bit systems, this multiplication will overflow for files larger than 4GB.
--- fs/9p/vfs_file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/9p/vfs_file.c +2 -2
@@ -612,9 +612,9 @@ static void v9fs_mmap_vm_close(struct vmstruct writeback_control wbc = { .nr_to_write =LONG_MAX , .sync_mode =WB_SYNC_ALL , - .range_start = vma->vm_pgoff *PAGE_SIZE , + .range_start = (loff_t )vma->vm_pgoff *PAGE_SIZE ,/* absolute end, byte at end included */ - .range_end = vma->vm_pgoff *PAGE_SIZE + + .range_end = (loff_t )vma->vm_pgoff *PAGE_SIZE + (vma->vm_end - vma->vm_start -1 ), };
Greg Kroah-Hartman
maintainerPATCH 323/391 drm/amd/display: Avoid MST manager resource leak.
In reply to Greg Kroah-HartmanFrom: Andrey Grodzovsky <[email protected]>
commit 5dff80bdce9e385af5716ed083f9e33e814484ab upstream.
On connector destruction call drm_dp_mst_topology_mgr_destroy to release resources allocated in drm_dp_mst_topology_mgr_init. Do it only if MST manager was initilized before otherwsie a crash is seen on driver unload/device unplug.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +7 -0
@@ -4882,6 +4882,13 @@ static void amdgpu_dm_connector_destroy(struct amdgpu_device *adev = connector->dev->dev_private;struct amdgpu_display_manager *dm = &adev->dm; +/* +* Call only if mst_mgr was iniitalized before since it's not done +* for all connector types. +*/ +if (aconnector->mst_mgr.dev) +drm_dp_mst_topology_mgr_destroy (&aconnector->mst_mgr); +#if defined(CONFIG_BACKLIGHT_CLASS_DEVICE ) ||\ defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE )
Greg Kroah-Hartman
maintainerPATCH 303/391 ubifs: dent: Fix some potential memory leaks while iterating entries
In reply to Greg Kroah-HartmanFrom: Zhihao Cheng <[email protected]>
commit 58f6e78a65f1fcbf732f60a7478ccc99873ff3ba upstream.
Fix some potential memory leaks in error handling branches while iterating dent entries. For example, function dbg_check_dir() forgets to free pdent if it exists.
--- fs/ubifs/debug.c | 1 + 1 file changed, 1 insertion(+)
fs/ubifs/debug.c +1 -0
@@ -1123,6 +1123,7 @@ int dbg_check_dir(struct ubifs_info *c, err =PTR_ERR (dent);if (err == -ENOENT )break ; +kfree (pdent);return err; }
Greg Kroah-Hartman
maintainerPATCH 319/391 drm/amdgpu: vcn and jpeg ring synchronization
In reply to Greg Kroah-HartmanFrom: Veerabadhran G <[email protected]>
commit 187561dd76531945126b15c9486fec7cfa5f0415 upstream.
Synchronize the ring usage for vcn1 and jpeg1 to workaround a hardware bug.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 2 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h | 1 + drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.c | 24 ++++++++++++++++++++++-- drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c | 28 ++++++++++++++++++++++++---- drivers/gpu/drm/amd/amdgpu/vcn_v1_0.h | 3 ++- 5 files changed, 51 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +2 -0
@@ -68,6 +68,7 @@ int amdgpu_vcn_sw_init(struct amdgpu_devINIT_DELAYED_WORK (&adev->vcn.idle_work, amdgpu_vcn_idle_work_handler);mutex_init (&adev->vcn.vcn_pg_lock); +mutex_init (&adev->vcn.vcn1_jpeg1_workaround);atomic_set (&adev->vcn.total_submission_cnt,0 );for (i =0 ; i < adev->vcn.num_vcn_inst; i++)atomic_set (&adev->vcn.inst[i].dpg_enc_submission_cnt,0 );
@@ -237,6 +238,7 @@ int amdgpu_vcn_sw_fini(struct amdgpu_dev }release_firmware (adev->vcn.fw); +mutex_destroy (&adev->vcn.vcn1_jpeg1_workaround);mutex_destroy (&adev->vcn.vcn_pg_lock);return 0 ;
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +1 -0
@@ -220,6 +220,7 @@ struct amdgpu_vcn {struct amdgpu_vcn_inst inst[AMDGPU_MAX_VCN_INSTANCES ];struct amdgpu_vcn_reg internal;struct mutex vcn_pg_lock; +struct mutex vcn1_jpeg1_workaround;atomic_t total_submission_cnt;unsigned harvest_config;
drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.c +22 -2
@@ -33,6 +33,7 @@static void jpeg_v1_0_set_dec_ring_funcs (struct amdgpu_device *adev);static void jpeg_v1_0_set_irq_funcs (struct amdgpu_device *adev); +static void jpeg_v1_0_ring_begin_use (struct amdgpu_ring *ring);static void jpeg_v1_0_decode_ring_patch_wreg (struct amdgpu_ring *ring,uint32_t *ptr,uint32_t reg_offset,uint32_t val) {
@@ -564,8 +565,8 @@ static const struct amdgpu_ring_funcs jp .insert_start = jpeg_v1_0_decode_ring_insert_start, .insert_end = jpeg_v1_0_decode_ring_insert_end, .pad_ib = amdgpu_ring_generic_pad_ib, - .begin_use = vcn_v1_0_ring_begin_use, - .end_use = amdgpu_vcn_ring_end_use, + .begin_use = jpeg_v1_0_ring_begin_use, + .end_use = vcn_v1_0_ring_end_use, .emit_wreg = jpeg_v1_0_decode_ring_emit_wreg, .emit_reg_wait = jpeg_v1_0_decode_ring_emit_reg_wait, .emit_reg_write_reg_wait = amdgpu_ring_emit_reg_write_reg_wait_helper,
@@ -586,3 +587,22 @@ static void jpeg_v1_0_set_irq_funcs(stru { adev->jpeg.inst->irq.funcs = &jpeg_v1_0_irq_funcs; } + +static void jpeg_v1_0_ring_begin_use (struct amdgpu_ring *ring) +{ +struct amdgpu_device *adev = ring->adev; +bool set_clocks = !cancel_delayed_work_sync (&adev->vcn.idle_work); +int cnt =0 ; + +mutex_lock (&adev->vcn.vcn1_jpeg1_workaround); + +if (amdgpu_fence_wait_empty (&adev->vcn.inst->ring_dec)) +DRM_ERROR ("JPEG dec: vcn dec ring may not be empty\n" ); + +for (cnt =0 ; cnt < adev->vcn.num_enc_rings; cnt++) { +if (amdgpu_fence_wait_empty (&adev->vcn.inst->ring_enc[cnt])) +DRM_ERROR ("JPEG dec: vcn enc ring[%d] may not be empty\n" , cnt); + } + +vcn_v1_0_set_pg_for_begin_use (ring, set_clocks); +}
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +24 -4
@@ -54,6 +54,7 @@ static int vcn_v1_0_pause_dpg_mode(struc int inst_idx, struct dpg_pause_state *new_state);static void vcn_v1_0_idle_work_handler (struct work_struct *work); +static void vcn_v1_0_ring_begin_use (struct amdgpu_ring *ring);/** * vcn_v1_0_early_init - set function pointers
@@ -1804,11 +1805,24 @@ static void vcn_v1_0_idle_work_handler(s } } -void vcn_v1_0_ring_begin_use (struct amdgpu_ring *ring) +static void vcn_v1_0_ring_begin_use (struct amdgpu_ring *ring) { -struct amdgpu_device *adev = ring->adev; +struct amdgpu_device *adev = ring->adev;bool set_clocks = !cancel_delayed_work_sync (&adev->vcn.idle_work); +mutex_lock (&adev->vcn.vcn1_jpeg1_workaround); + +if (amdgpu_fence_wait_empty (&ring->adev->jpeg.inst->ring_dec)) +DRM_ERROR ("VCN dec: jpeg dec ring may not be empty\n" ); + +vcn_v1_0_set_pg_for_begin_use (ring, set_clocks); + +} + +void vcn_v1_0_set_pg_for_begin_use (struct amdgpu_ring *ring,bool set_clocks) +{ +struct amdgpu_device *adev = ring->adev; +if (set_clocks) {amdgpu_gfx_off_ctrl (adev, false);if (adev->pm.dpm_enabled)
@@ -1844,6 +1858,12 @@ void vcn_v1_0_ring_begin_use(struct amdg } } +void vcn_v1_0_ring_end_use (struct amdgpu_ring *ring) +{ +schedule_delayed_work (&ring->adev->vcn.idle_work,VCN_IDLE_TIMEOUT ); +mutex_unlock (&ring->adev->vcn.vcn1_jpeg1_workaround); +} +static const struct amd_ip_funcs vcn_v1_0_ip_funcs = { .name ="vcn_v1_0" , .early_init = vcn_v1_0_early_init,
@@ -1891,7 +1911,7 @@ static const struct amdgpu_ring_funcs vc .insert_end = vcn_v1_0_dec_ring_insert_end, .pad_ib = amdgpu_ring_generic_pad_ib, .begin_use = vcn_v1_0_ring_begin_use, - .end_use = amdgpu_vcn_ring_end_use, + .end_use = vcn_v1_0_ring_end_use, .emit_wreg = vcn_v1_0_dec_ring_emit_wreg, .emit_reg_wait = vcn_v1_0_dec_ring_emit_reg_wait, .emit_reg_write_reg_wait = amdgpu_ring_emit_reg_write_reg_wait_helper,
@@ -1923,7 +1943,7 @@ static const struct amdgpu_ring_funcs vc .insert_end = vcn_v1_0_enc_ring_insert_end, .pad_ib = amdgpu_ring_generic_pad_ib, .begin_use = vcn_v1_0_ring_begin_use, - .end_use = amdgpu_vcn_ring_end_use, + .end_use = vcn_v1_0_ring_end_use, .emit_wreg = vcn_v1_0_enc_ring_emit_wreg, .emit_reg_wait = vcn_v1_0_enc_ring_emit_reg_wait, .emit_reg_write_reg_wait = amdgpu_ring_emit_reg_write_reg_wait_helper,
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.h +2 -1
@@ -24,7 +24,8 @@#ifndef __VCN_V1_0_H__#define __VCN_V1_0_H__ -void vcn_v1_0_ring_begin_use (struct amdgpu_ring *ring); +void vcn_v1_0_ring_end_use (struct amdgpu_ring *ring); +void vcn_v1_0_set_pg_for_begin_use (struct amdgpu_ring *ring,bool set_clocks);extern const struct amdgpu_ip_block_version vcn_v1_0_ip_block;
Greg Kroah-Hartman
maintainerPATCH 318/391 drm/amd/display: Increase timeout for DP Disable
In reply to Greg Kroah-HartmanFrom: Wesley Chalmers <[email protected]>
commit 37b7cb10f07c1174522faafc1d51c6591b1501d4 upstream.
[WHY]
When disabling DP video, the current REG_WAIT timeout of 50ms is too low for certain cases with very high VSYNC intervals.
[HOW]
Increase the timeout to 102ms, so that refresh rates as low as 10Hz can be handled properly.
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_stream_encoder.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_stream_encoder.c +2 -2
@@ -896,10 +896,10 @@ void enc1_stream_encoder_dp_blank(*/ REG_UPDATE (DP_VID_STREAM_CNTL ,DP_VID_STREAM_DIS_DEFER ,2 );/* Larger delay to wait until VBLANK - use max retry of -* 10us*5000=50ms. This covers 41.7ms of minimum 24 Hz mode + +* 10us*10200=102ms. This covers 100.0ms of minimum 10 Hz mode + * a little more because we may not trust delay accuracy. */ - max_retries =DP_BLANK_MAX_RETRY *250 ; + max_retries =DP_BLANK_MAX_RETRY *501 ;/* disable DP stream */ REG_UPDATE (DP_VID_STREAM_CNTL ,DP_VID_STREAM_ENABLE ,0 );
Greg Kroah-Hartman
maintainerPATCH 336/391 cpufreq: Avoid configuring old governors as default with intel_pstate
In reply to Greg Kroah-HartmanFrom: Rafael J. Wysocki <[email protected]>
commit db865272d9c4687520dc29f77e701a1b2669872f upstream.
Commit 33aa46f252c7 ("cpufreq: intel_pstate: Use passive mode by default without HWP") was meant to cause intel_pstate to be used in the passive mode with the schedutil governor on top of it, but it missed the case in which either "ondemand" or "conservative" was selected as the default governor in the existing kernel config, in which case the previous old governor configuration would be used, causing the default legacy governor to be used on top of intel_pstate instead of schedutil.
Address this by preventing "ondemand" and "conservative" from being configured as the default cpufreq governor in the case when schedutil is the default choice for the default governor setting.
[Note that the default cpufreq governor can still be set via the
kernel command line if need be and that choice is not limited, so if anyone really wants to use one of the legacy governors by default, it can be achieved this way.]
--- drivers/cpufreq/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
drivers/cpufreq/Kconfig +2 -0
@@ -71,6 +71,7 @@ config CPU_FREQ_DEFAULT_GOV_USERSPACE config CPU_FREQ_DEFAULT_GOV_ONDEMAND bool "ondemand" + depends on !(X86_INTEL_PSTATE && SMP) select CPU_FREQ_GOV_ONDEMAND select CPU_FREQ_GOV_PERFORMANCE help
@@ -83,6 +84,7 @@ config CPU_FREQ_DEFAULT_GOV_ONDEMAND config CPU_FREQ_DEFAULT_GOV_CONSERVATIVE bool "conservative" + depends on !(X86_INTEL_PSTATE && SMP) select CPU_FREQ_GOV_CONSERVATIVE select CPU_FREQ_GOV_PERFORMANCE help
Greg Kroah-Hartman
maintainerPATCH 337/391 cpufreq: Introduce CPUFREQ_NEED_UPDATE_LIMITS driver flag
In reply to Greg Kroah-HartmanFrom: Rafael J. Wysocki <[email protected]>
commit 1c534352f47fd83eb08075ac2474f707e74bf7f7 upstream.
Generally, a cpufreq driver may need to update some internal upper and lower frequency boundaries on policy max and min changes, respectively, but currently this does not work if the target frequency does not change along with the policy limit.
Namely, if the target frequency does not change along with the policy min or max, the "target_freq == policy->cur" check in __cpufreq_driver_target() prevents driver callbacks from being invoked and they do not even have a chance to update the corresponding internal boundary.
This particularly affects the "powersave" and "performance" governors that always set the target frequency to one of the policy limits and it never changes when the other limit is updated.
To allow cpufreq the drivers needing to update internal frequency boundaries on policy limits changes to avoid this issue, introduce a new driver flag, CPUFREQ_NEED_UPDATE_LIMITS, that (when set) will neutralize the check mentioned above.
--- drivers/cpufreq/cpufreq.c | 3 ++- include/linux/cpufreq.h | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-)
drivers/cpufreq/cpufreq.c +2 -1
@@ -2166,7 +2166,8 @@ int __cpufreq_driver_target(struct cpufr* exactly same freq is called again and so we can save on few function * calls. */ -if (target_freq == policy->cur) +if (target_freq == policy->cur && + !(cpufreq_driver->flags &CPUFREQ_NEED_UPDATE_LIMITS ))return 0 ;/* Save last value to restore later on errors */
include/linux/cpufreq.h +9 -1
@@ -293,7 +293,7 @@ __ATTR(_name, 0644, show_##_name, store_struct cpufreq_driver {char name[CPUFREQ_NAME_LEN ]; -u8 flags; +u16 flags;void *driver_data;/* needed by all drivers */
@@ -417,6 +417,14 @@ struct cpufreq_driver {*/ #define CPUFREQ_IS_COOLING_DEV BIT(7) +/* +* Set by drivers that need to update internale upper and lower boundaries along +* with the target frequency and so the core and governors should also invoke +* the diver if the target frequency does not change, but the policy min or max +* may have changed. +*/ +#define CPUFREQ_NEED_UPDATE_LIMITS BIT(8) +int cpufreq_register_driver (struct cpufreq_driver *driver_data);int cpufreq_unregister_driver (struct cpufreq_driver *driver_data);
Greg Kroah-Hartman
maintainerPATCH 311/391 ARC: perf: redo the pct irq missing in device-tree handling
In reply to Greg Kroah-HartmanFrom: Vineet Gupta <[email protected]>
commit 8c42a5c02bec6c7eccf08957be3c6c8fccf9790b upstream.
commit feb92d7d3813456c11dce21 "(ARC: perf: don't bail setup if pct irq missing in device-tree)" introduced a silly brown-paper bag bug:
The assignment and comparison in an if statement were not bracketed correctly leaving the order of evaluation undefined.
|
| if (has_interrupts && (irq = platform_get_irq(pdev, 0) >= 0)) {
| ^^^ ^^^^And given such a chance, the compiler will bite you hard, fully entitled to generating this piece of beauty:
|
| # if (has_interrupts && (irq = platform_get_irq(pdev, 0) >= 0)) {
|
| bl.d @platform_get_irq <-- irq returned in r0
|
| setge r2, r0, 0 <-- r2 is bool 1 or 0 if irq >= 0 true/false
| brlt.d r0, 0, @.L114
|
| st_s r2,[sp] <-- irq saved is bool 1 or 0, not actual return val
| st 1,[r3,160] # arc_pmu.18_29->irq <-- drops bool and assumes 1
|
| # return __request_percpu_irq(irq, handler, 0,
|
| bl.d @__request_percpu_irq;
| mov_s r0,1 <-- drops even bool and assumes 1 which failsWith the snafu fixed, everything is as expected.
| bl.d @platform_get_irq <-- returns irq in r0 | | mov_s r2,r0 | brlt.d r2, 0, @.L112 | | st_s r0,[sp] <-- irq isaved is actual return value above | st r0,[r13,160] #arc_pmu.18_27->irq | | bl.d @__request_percpu_irq <-- r0 unchanged so actual irq returned | add r4,r4,r12 #, tmp363, __ptr
--- arch/arc/kernel/perf_event.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-)
arch/arc/kernel/perf_event.c +19 -10
@@ -562,7 +562,7 @@ static int arc_pmu_device_probe(struct p {struct arc_reg_pct_build pct_bcr;struct arc_reg_cc_build cc_bcr; -int i, has_interrupts, irq; +int i, has_interrupts, irq =-1 ;int counter_size;/* in bits */ union cc_name {
@@ -637,18 +637,27 @@ static int arc_pmu_device_probe(struct p .attr_groups = arc_pmu->attr_groups, }; -if (has_interrupts && (irq =platform_get_irq (pdev,0 ) >=0 )) { +if (has_interrupts) { + irq =platform_get_irq (pdev,0 ); +if (irq >=0 ) { +int ret; + + arc_pmu->irq = irq; + +/* intc map function ensures irq_set_percpu_devid() called */ + ret =request_percpu_irq (irq, arc_pmu_intr,"ARC perf counters" , +this_cpu_ptr (&arc_pmu_cpu)); + +if (!ret) +on_each_cpu (arc_cpu_pmu_irq_init, &irq,1 ); +else + irq =-1 ; + } - arc_pmu->irq = irq; - -/* intc map function ensures irq_set_percpu_devid() called */ -request_percpu_irq (irq, arc_pmu_intr,"ARC perf counters" , -this_cpu_ptr (&arc_pmu_cpu)); + } -on_each_cpu (arc_cpu_pmu_irq_init, &irq,1 ); - }else { +if (irq ==-1 ) arc_pmu->pmu.capabilities |=PERF_PMU_CAP_NO_INTERRUPT ; - }/* * perf parser doesn't really like '-' symbol in events name, so let's
Greg Kroah-Hartman
maintainerPATCH 312/391 ubi: check kthread_should_stop() after the setting of task state
In reply to Greg Kroah-HartmanFrom: Zhihao Cheng <[email protected]>
commit d005f8c6588efcfbe88099b6edafc6f58c84a9c1 upstream.
A detach hung is possible when a race occurs between the detach process and the ubi background thread. The following sequences outline the race:
ubi thread: if (list_empty(&ubi->works)...
ubi detach: set_bit(KTHREAD_SHOULD_STOP, &kthread->flags)
=> by kthread_stop()
wake_up_process()
=> ubi thread is still running, so 0 is returned
ubi thread: set_current_state(TASK_INTERRUPTIBLE)
schedule()
=> ubi thread will never be scheduled again
ubi detach: wait_for_completion()
=> hung task!
To fix that, we need to check kthread_should_stop() after we set the task state, so the ubi thread will either see the stop bit and exit or the task state is reset to runnable such that it isn't scheduled out indefinitely.
--- drivers/mtd/ubi/wl.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/mtd/ubi/wl.c +13 -0
@@ -1639,6 +1639,19 @@ int ubi_thread(void *u) !ubi->thread_enabled || ubi_dbg_is_bgt_disabled(ubi)) {set_current_state (TASK_INTERRUPTIBLE );spin_unlock (&ubi->wl_lock); + +/* +* Check kthread_should_stop() after we set the task +* state to guarantee that we either see the stop bit +* and exit or the task state is reset to runnable such +* that it's not scheduled out indefinitely and detects +* the stop bit at kthread_should_stop(). +*/ +if (kthread_should_stop ()) { +set_current_state (TASK_RUNNING ); +break ; + } +schedule ();continue ; }
Greg Kroah-Hartman
maintainerPATCH 302/391 NFSD: Add missing NFSv2 .pc_func methods
In reply to Greg Kroah-HartmanFrom: Chuck Lever <[email protected]>
commit 6b3dccd48de8a4c650b01499a0b09d1e2279649e upstream.
There's no protection in nfsd_dispatch() against a NULL .pc_func helpers. A malicious NFS client can trigger a crash by invoking the unused/unsupported NFSv2 ROOT or WRITECACHE procedures.
The current NFSD dispatcher does not support returning a void reply to a non-NULL procedure, so the reply to both of these is wrong, for the moment.
--- fs/nfsd/nfsproc.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
fs/nfsd/nfsproc.c +16 -0
@@ -118,6 +118,13 @@ done:return nfsd_return_attrs (nfserr, resp); } +/* Obsolete, replaced by MNTPROC_MNT. */ +static __be32 +nfsd_proc_root (struct svc_rqst *rqstp) +{ +return nfs_ok; +} +/* * Look up a path name component * Note: the dentry in the resp->fh may be negative if the file
@@ -203,6 +210,13 @@ nfsd_proc_read(struct svc_rqst *rqstp)return fh_getattr (&resp->fh, &resp->stat); } +/* Reserved */ +static __be32 +nfsd_proc_writecache (struct svc_rqst *rqstp) +{ +return nfs_ok; +} +/* * Write data to a file * N.B. After this call resp->fh needs an fh_put
@@ -617,6 +631,7 @@ static const struct svc_procedure nfsd_p .pc_xdrressize = ST+AT, }, [NFSPROC_ROOT] = { + .pc_func = nfsd_proc_root, .pc_decode = nfssvc_decode_void, .pc_encode = nfssvc_encode_void, .pc_argsize = sizeof(struct nfsd_void),
@@ -654,6 +669,7 @@ static const struct svc_procedure nfsd_p .pc_xdrressize = ST+AT+1+NFSSVC_MAXBLKSIZE_V2/4, }, [NFSPROC_WRITECACHE] = { + .pc_func = nfsd_proc_writecache, .pc_decode = nfssvc_decode_void, .pc_encode = nfssvc_encode_void, .pc_argsize = sizeof(struct nfsd_void),
Greg Kroah-Hartman
maintainerPATCH 300/391 NFSv4: Wait for stateid updates after CLOSE/OPEN_DOWNGRADE
In reply to Greg Kroah-HartmanFrom: Benjamin Coddington <[email protected]>
commit b4868b44c5628995fdd8ef2e24dda73cef963a75 upstream.
Since commit 0e0cb35b417f ("NFSv4: Handle NFS4ERR_OLD_STATEID in CLOSE/OPEN_DOWNGRADE") the following livelock may occur if a CLOSE races with the update of the nfs_state:
Process 1 Process 2 Server
========= ========= ========
OPEN file
OPEN file
Reply OPEN (1)
Reply OPEN (2)
Update state (1)
CLOSE file (1)
Reply OLD_STATEID (1)
CLOSE file (2)
Reply CLOSE (-1)
Update state (2)
wait for state change
OPEN file
wake
CLOSE file
OPEN file
wake
CLOSE file
...
...We can avoid this situation by not issuing an immediate retry with a bumped seqid when CLOSE/OPEN_DOWNGRADE receives NFS4ERR_OLD_STATEID. Instead, take the same approach used by OPEN and wait at least 5 seconds for outstanding stateid updates to complete if we can detect that we're out of sequence.
Note that after this change it is still possible (though unlikely) that CLOSE waits a full 5 seconds, bumps the seqid, and retries -- and that attempt races with another OPEN at the same time. In order to avoid this race (which would result in the livelock), update nfs_need_update_open_stateid() to handle the case where:
- the state is NFS_OPEN_STATE, and
- the stateid doesn't match the current open stateid
Finally, nfs_need_update_open_stateid() is modified to be idempotent and renamed to better suit the purpose of signaling that the stateid passed is the next stateid in sequence.
--- fs/nfs/nfs4_fs.h | 8 +++++ fs/nfs/nfs4proc.c | 81 ++++++++++++++++++++++++++++++----------------------- fs/nfs/nfs4trace.h | 1 3 files changed, 56 insertions(+), 34 deletions(-)
fs/nfs/nfs4_fs.h +8 -0
@@ -599,6 +599,14 @@ static inline bool nfs4_stateid_is_newerreturn (s32)(be32_to_cpu (s1->seqid) -be32_to_cpu (s2->seqid)) >0 ; } +static inline bool nfs4_stateid_is_next (const nfs4_stateid *s1,const nfs4_stateid *s2) +{ +u32 seq1 =be32_to_cpu (s1->seqid); +u32 seq2 =be32_to_cpu (s2->seqid); + +return seq2 == seq1 +1U || (seq2 ==1U && seq1 ==0xffffffffU ); +} +static inline bool nfs4_stateid_match_or_older (const nfs4_stateid *dst,const nfs4_stateid *src) { return nfs4_stateid_match_other(dst, src) &&
fs/nfs/nfs4proc.c +47 -34
131 lines not on this page · raw message
fs/nfs/nfs4trace.h +1 -0
@@ -1511,6 +1511,7 @@ DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_setDEFINE_NFS4_INODE_STATEID_EVENT (nfs4_delegreturn);DEFINE_NFS4_INODE_STATEID_EVENT (nfs4_open_stateid_update);DEFINE_NFS4_INODE_STATEID_EVENT (nfs4_open_stateid_update_wait); +DEFINE_NFS4_INODE_STATEID_EVENT (nfs4_close_stateid_update_wait); DECLARE_EVENT_CLASS(nfs4_getattr_event, TP_PROTO(
Greg Kroah-Hartman
maintainerPATCH 299/391 gfs2: Only access gl_delete for iopen glocks
In reply to Greg Kroah-HartmanFrom: Bob Peterson <[email protected]>
commit 2ffed5290b3bff7562d29fd06621be4705704242 upstream.
Only initialize gl_delete for iopen glocks, but more importantly, only access it for iopen glocks in flush_delete_work: flush_delete_work is called for different types of glocks including rgrp glocks, and those use gl_vm which is in a union with gl_delete. Without this fix, we'll end up clobbering gl_vm, which results in general memory corruption.
--- fs/gfs2/glock.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
fs/gfs2/glock.c +7 -4
@@ -1054,7 +1054,8 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, gl->gl_object =NULL ; gl->gl_hold_time =GL_GLOCK_DFT_HOLD ;INIT_DELAYED_WORK (&gl->gl_work, glock_work_func); -INIT_DELAYED_WORK (&gl->gl_delete, delete_work_func); +if (gl->gl_name.ln_type ==LM_TYPE_IOPEN ) +INIT_DELAYED_WORK (&gl->gl_delete, delete_work_func); mapping =gfs2_glock2aspace (gl);if (mapping) {
@@ -1906,9 +1907,11 @@ bool gfs2_delete_work_queued(const strucstatic void flush_delete_work (struct gfs2_glock *gl) { -if (cancel_delayed_work (&gl->gl_delete)) { -queue_delayed_work (gfs2_delete_workqueue, - &gl->gl_delete,0 ); +if (gl->gl_name.ln_type ==LM_TYPE_IOPEN ) { +if (cancel_delayed_work (&gl->gl_delete)) { +queue_delayed_work (gfs2_delete_workqueue, + &gl->gl_delete,0 ); + } }gfs2_glock_queue_work (gl,0 ); }
Greg Kroah-Hartman
maintainerPATCH 260/391 tty: serial: fsl_lpuart: LS1021A has a FIFO size of 16 words, like LS1028A
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
commit c97f2a6fb3dfbfbbc88edc8ea62ef2b944e18849 upstream.
Prior to the commit that this one fixes, the FIFO size was derived from the read-only register LPUARTx_FIFO[TXFIFOSIZE] using the following formula:
TX FIFO size = 2 ^ (LPUARTx_FIFO[TXFIFOSIZE] - 1)
The documentation for LS1021A is a mess. Under chapter 26.1.3 LS1021A LPUART module special consideration, it mentions TXFIFO_SZ and RXFIFO_SZ being equal to 4, and in the register description for LPUARTx_FIFO, it shows the out-of-reset value of TXFIFOSIZE and RXFIFOSIZE fields as "011", even though these registers read as "101" in reality.
And when LPUART on LS1021A was working, the "101" value did correspond to "16 datawords", by applying the formula above, even though the documentation is wrong again (!!!!) and says that "101" means 64 datawords (hint: it doesn't).
So the "new" formula created by commit f77ebb241ce0 has all the premises of being wrong for LS1021A, because it relied only on false data and no actual experimentation.
Interestingly, in commit c2f448cff22a ("tty: serial: fsl_lpuart: add LS1028A support"), Michael Walle applied a workaround to this by manually setting the FIFO widths for LS1028A. It looks like the same values are used by LS1021A as well, in fact.
When the driver thinks that it has a deeper FIFO than it really has, getty (user space) output gets truncated.
Many thanks to Michael for pointing out where to look.
Reviewed-by:Fugang Duan <[email protected]>
--- drivers/tty/serial/fsl_lpuart.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/tty/serial/fsl_lpuart.c +7 -6
@@ -314,9 +314,10 @@ MODULE_DEVICE_TABLE(of, lpuart_dt_ids);/* Forward declare this for the dma callbacks*/ static void lpuart_dma_tx_complete (void *arg); -static inline bool is_ls1028a_lpuart (struct lpuart_port *sport) +static inline bool is_layerscape_lpuart (struct lpuart_port *sport) { -return sport->devtype ==LS1028A_LPUART ; +return (sport->devtype ==LS1021A_LPUART || + sport->devtype ==LS1028A_LPUART ); }static inline bool is_imx8qxp_lpuart (struct lpuart_port *sport)
@@ -1644,11 +1645,11 @@ static int lpuart32_startup(struct uart_ UARTFIFO_FIFOSIZE_MASK);/* -* The LS1028A has a fixed length of 16 words. Although it supports the -* RX/TXSIZE fields their encoding is different. Eg the reference manual -* states 0b101 is 16 words. +* The LS1021A and LS1028A have a fixed FIFO depth of 16 words. +* Although they support the RX/TXSIZE fields, their encoding is +* different. Eg the reference manual states 0b101 is 16 words. */ -if (is_ls1028a_lpuart (sport)) { +if (is_layerscape_lpuart (sport)) { sport->rxfifo_size =16 ; sport->txfifo_size =16 ; sport->port.fifosize = sport->txfifo_size;
Greg Kroah-Hartman
maintainerPATCH 269/391 iio: adc: at91-sama5d2_adc: fix DMA conversion crash
In reply to Greg Kroah-HartmanFrom: Eugen Hristev <[email protected]>
commit 1a198794451449113fa86994ed491d6986802c23 upstream.
After the move of the postenable code to preenable, the DMA start was done before the DMA init, which is not correct.
The DMA is initialized in set_watermark. Because of this, we need to call the DMA start functions in set_watermark, after the DMA init, instead of preenable hook, when the DMA is not properly setup yet.
--- drivers/iio/adc/at91-sama5d2_adc.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/iio/adc/at91-sama5d2_adc.c +12 -4
@@ -884,7 +884,7 @@ static bool at91_adc_current_chan_is_tou AT91_SAMA5D2_MAX_CHAN_IDX + 1); } -static int at91_adc_buffer_preenable (struct iio_dev *indio_dev) +static int at91_adc_buffer_prepare (struct iio_dev *indio_dev) {int ret;u8 bit;
@@ -901,7 +901,7 @@ static int at91_adc_buffer_preenable(str/* we continue with the triggered buffer */ ret =at91_adc_dma_start (indio_dev);if (ret) { -dev_err (&indio_dev->dev,"buffer postenable failed\n" ); +dev_err (&indio_dev->dev,"buffer prepare failed\n" );return ret; }
@@ -989,7 +989,6 @@ static int at91_adc_buffer_postdisable(s }static const struct iio_buffer_setup_ops at91_buffer_setup_ops = { - .preenable = &at91_adc_buffer_preenable, .postdisable = &at91_adc_buffer_postdisable, };
@@ -1563,6 +1562,7 @@ static void at91_adc_dma_disable(structstatic int at91_adc_set_watermark (struct iio_dev *indio_dev,unsigned int val) {struct at91_adc_state *st =iio_priv (indio_dev); +int ret;if (val >AT91_HWFIFO_MAX_SIZE )return -EINVAL ;
@@ -1586,7 +1586,15 @@ static int at91_adc_set_watermark(structelse if (val >1 )at91_adc_dma_init (to_platform_device (&indio_dev->dev)); -return 0 ; +/* +* We can start the DMA only after setting the watermark and +* having the DMA initialization completed +*/ + ret =at91_adc_buffer_prepare (indio_dev); +if (ret) +at91_adc_dma_disable (to_platform_device (&indio_dev->dev)); + +return ret; } static int at91_adc_update_scan_mode(struct iio_dev *indio_dev,
Greg Kroah-Hartman
maintainerPATCH 265/391 dmaengine: dma-jz4780: Fix race in jz4780_dma_tx_status
In reply to Greg Kroah-HartmanFrom: Paul Cercueil <[email protected]>
commit baf6fd97b16ea8f981b8a8b04039596f32fc2972 upstream.
The jz4780_dma_tx_status() function would check if a channel's cookie state was set to 'completed', and if not, it would enter the critical section. However, in that time frame, the jz4780_dma_chan_irq() function was able to set the cookie to 'completed', and clear the jzchan->vchan pointer, which was deferenced in the critical section of the first function.
Fix this race by checking the channel's cookie state after entering the critical function and not before.
--- drivers/dma/dma-jz4780.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/dma/dma-jz4780.c +4 -3
@@ -639,11 +639,11 @@ static enum dma_status jz4780_dma_tx_staunsigned long flags;unsigned long residue =0 ; +spin_lock_irqsave (&jzchan->vchan.lock, flags); + status =dma_cookie_status (chan, cookie, txstate);if ((status ==DMA_COMPLETE ) || (txstate ==NULL )) -return status; - -spin_lock_irqsave (&jzchan->vchan.lock, flags); + goto out_unlock_irqrestore; vdesc =vchan_find_desc (&jzchan->vchan, cookie);if (vdesc) {
@@ -660,6 +660,7 @@ static enum dma_status jz4780_dma_tx_sta && jzchan->desc->status & (JZ_DMA_DCS_AR | JZ_DMA_DCS_HLT)) status =DMA_ERROR ; +out_unlock_irqrestore:spin_unlock_irqrestore (&jzchan->vchan.lock, flags);return status; }
Greg Kroah-Hartman
maintainerPATCH 228/391 btrfs: send, recompute reference path after orphanization of a directory
In reply to Greg Kroah-HartmanFrom: Filipe Manana <[email protected]>
commit 9c2b4e0347067396ceb3ae929d6888c81d610259 upstream.
During an incremental send, when an inode has multiple new references we might end up emitting rename operations for orphanizations that have a source path that is no longer valid due to a previous orphanization of some directory inode. This causes the receiver to fail since it tries to rename a path that does not exists.
Example reproducer:
$ cat reproducer.sh #!/bin/bash
mkfs.btrfs -f /dev/sdi >/dev/null
mount /dev/sdi /mnt/sdi
touch /mnt/sdi/f1
touch /mnt/sdi/f2
mkdir /mnt/sdi/d1
mkdir /mnt/sdi/d1/d2
# Filesystem looks like:
#
# . (ino 256) # |----- f1 (ino 257) # |----- f2 (ino 258) # |----- d1/ (ino 259) # |----- d2/ (ino 260)
btrfs subvolume snapshot -r /mnt/sdi /mnt/sdi/snap1 btrfs send -f /tmp/snap1.send /mnt/sdi/snap1
# Now do a series of changes such that:
#
# *) inode 258 has one new hardlink and the previous name changed #
# *) both names conflict with the old names of two other inodes:
#
# 1) the new name "d1" conflicts with the old name of inode 259,
# under directory inode 256 (root)
#
# 2) the new name "d2" conflicts with the old name of inode 260
# under directory inode 259
#
# *) inodes 259 and 260 now have the old names of inode 258 #
# *) inode 257 is now located under inode 260 - an inode with a number
# smaller than the inode (258) for which we created a second hard
# link and swapped its names with inodes 259 and 260
#
ln /mnt/sdi/f2 /mnt/sdi/d1/f2_link
mv /mnt/sdi/f1 /mnt/sdi/d1/d2/f1
# Swap d1 and f2.
mv /mnt/sdi/d1 /mnt/sdi/tmp
mv /mnt/sdi/f2 /mnt/sdi/d1
mv /mnt/sdi/tmp /mnt/sdi/f2
# Swap d2 and f2_link
mv /mnt/sdi/f2/d2 /mnt/sdi/tmp
mv /mnt/sdi/f2/f2_link /mnt/sdi/f2/d2
mv /mnt/sdi/tmp /mnt/sdi/f2/f2_link
# Filesystem now looks like:
#
# . (ino 256) # |----- d1 (ino 258) # |----- f2/ (ino 259) # |----- f2_link/ (ino 260) # | |----- f1 (ino 257) # | # |----- d2 (ino 258)
btrfs subvolume snapshot -r /mnt/sdi /mnt/sdi/snap2 btrfs send -f /tmp/snap2.send -p /mnt/sdi/snap1 /mnt/sdi/snap2
mkfs.btrfs -f /dev/sdj >/dev/null
mount /dev/sdj /mnt/sdj
btrfs receive -f /tmp/snap1.send /mnt/sdj
btrfs receive -f /tmp/snap2.send /mnt/sdj
umount /mnt/sdi
umount /mnt/sdj
When executed the receive of the incremental stream fails:
$ ./reproducer.sh Create a readonly snapshot of '/mnt/sdi' in '/mnt/sdi/snap1' At subvol /mnt/sdi/snap1 Create a readonly snapshot of '/mnt/sdi' in '/mnt/sdi/snap2' At subvol /mnt/sdi/snap2 At subvol snap1 At snapshot snap2 ERROR: rename d1/d2 -> o260-6-0 failed: No such file or directory
This happens because:
1) When processing inode 257 we end up computing the name for inode 259 because it is an ancestor in the send snapshot, and at that point it still has its old name, "d1", from the parent snapshot because inode 259 was not yet processed. We then cache that name, which is valid until we start processing inode 259 (or set the progress to 260 after processing its references);
2) Later we start processing inode 258 and collecting all its new references into the list sctx->new_refs. The first reference in the list happens to be the reference for name "d1" while the reference for name "d2" is next (the last element of the list).
We compute the full path "d1/d2" for this second reference and store it in the reference (its ->full_path member). The path used for the new parent directory was "d1" and not "f2" because inode 259, the new parent, was not yet processed;
3) When we start processing the new references at process_recorded_refs() we start with the first reference in the list, for the new name "d1". Because there is a conflicting inode that was not yet processed, which is directory inode 259, we orphanize it, renaming it from "d1" to "o259-6-0";
4) Then we start processing the new reference for name "d2", and we realize it conflicts with the reference of inode 260 in the parent snapshot. So we issue an orphanization operation for inode 260 by emitting a rename operation with a destination path of "o260-6-0" and a source path of "d1/d2" - this source path is the value we stored in the reference earlier at step 2), corresponding to the ->full_path member of the reference, however that path is no longer valid due to the orphanization of the directory inode 259 in step 3). This makes the receiver fail since the path does not exists, it should have been "o259-6-0/d2".
Fix this by recomputing the full path of a reference before emitting an orphanization if we previously orphanized any directory, since that directory could be a parent in the new path. This is a rare scenario so keeping it simple and not checking if that previously orphanized directory is in fact an ancestor of the inode we are trying to orphanize.
A test case for fstests follows soon.
--- fs/btrfs/send.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+)
fs/btrfs/send.c +72 -0
@@ -3813,6 +3813,72 @@ static int update_ref_path(struct send_c }/* +* When processing the new references for an inode we may orphanize an existing +* directory inode because its old name conflicts with one of the new references +* of the current inode. Later, when processing another new reference of our +* inode, we might need to orphanize another inode, but the path we have in the +* reference reflects the pre-orphanization name of the directory we previously +* orphanized. For example: +* +* parent snapshot looks like: +* +* . (ino 256) +* |----- f1 (ino 257) +* |----- f2 (ino 258) +* |----- d1/ (ino 259) +* |----- d2/ (ino 260) +* +* send snapshot looks like: +* +* . (ino 256) +* |----- d1 (ino 258) +* |----- f2/ (ino 259) +* |----- f2_link/ (ino 260) +* | |----- f1 (ino 257) +* | +* |----- d2 (ino 258) +* +* When processing inode 257 we compute the name for inode 259 as "d1", and we +* cache it in the name cache. Later when we start processing inode 258, when +* collecting all its new references we set a full path of "d1/d2" for its new +* reference with name "d2". When we start processing the new references we +* start by processing the new reference with name "d1", and this results in +* orphanizing inode 259, since its old reference causes a conflict. Then we +* move on the next new reference, with name "d2", and we find out we must +* orphanize inode 260, as its old reference conflicts with ours - but for the +* orphanization we use a source path corresponding to the path we stored in the +* new reference, which is "d1/d2" and not "o259-6-0/d2" - this makes the +* receiver fail since the path component "d1/" no longer exists, it was renamed +* to "o259-6-0/" when processing the previous new reference. So in this case we +* must recompute the path in the new reference and use it for the new +* orphanization operation. +*/ +static int refresh_ref_path (struct send_ctx *sctx,struct recorded_ref *ref) +{ +char *name; +int ret; + + name =kmemdup (ref->name, ref->name_len,GFP_KERNEL ); +if (!name) +return -ENOMEM ; + +fs_path_reset (ref->full_path); + ret =get_cur_path (sctx, ref->dir, ref->dir_gen, ref->full_path); +if (ret <0 ) + goto out; + + ret =fs_path_add (ref->full_path, name, ref->name_len); +if (ret <0 ) + goto out; + +/* Update the reference's base name pointer. */ +set_ref_path (ref, ref->full_path); +out: +kfree (name); +return ret; +} + +/* * This does all the move/link/unlink/rmdir magic. */ static int process_recorded_refs (struct send_ctx *sctx,int *pending_move)
@@ -3946,6 +4012,12 @@ static int process_recorded_refs(structstruct name_cache_entry *nce;struct waiting_dir_move *wdm; +if (orphanized_dir) { + ret =refresh_ref_path (sctx, cur); +if (ret <0 ) + goto out; + } + ret =orphanize_inode (sctx, ow_inode, ow_gen, cur->full_path);if (ret <0 )
Greg Kroah-Hartman
maintainerPATCH 264/391 udf: Fix memory leak when mounting
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
commit a7be300de800e755714c71103ae4a0d205e41e99 upstream.
udf_process_sequence() allocates temporary array for processing partition descriptors on volume which it fails to free. Free the array when it is not needed anymore.
--- fs/udf/super.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)
fs/udf/super.c +13 -8
@@ -1704,7 +1704,8 @@ static noinline int udf_process_sequence"Pointers (max %u supported)\n" , UDF_MAX_TD_NESTING);brelse (bh); -return -EIO ; + ret = -EIO ; + goto out; } vdp = (struct volDescPtr *)bh->b_data;
@@ -1724,7 +1725,8 @@ static noinline int udf_process_sequence curr =get_volume_descriptor_record (ident, bh, &data);if (IS_ERR (curr)) {brelse (bh); -return PTR_ERR (curr); + ret =PTR_ERR (curr); + goto out; }/* Descriptor we don't care about? */ if (!curr)
@@ -1746,28 +1748,31 @@ static noinline int udf_process_sequence*/ if (!data.vds[VDS_POS_PRIMARY_VOL_DESC ].block) {udf_err (sb,"Primary Volume Descriptor not found!\n" ); -return -EAGAIN ; + ret = -EAGAIN ; + goto out; } ret =udf_load_pvoldesc (sb, data.vds[VDS_POS_PRIMARY_VOL_DESC ].block);if (ret <0 ) -return ret; + goto out;if (data.vds[VDS_POS_LOGICAL_VOL_DESC ].block) { ret =udf_load_logicalvol (sb, data.vds[VDS_POS_LOGICAL_VOL_DESC ].block, fileset);if (ret <0 ) -return ret; + goto out; }/* Now handle prevailing Partition Descriptors */ for (i =0 ; i < data.num_part_descs; i++) { ret =udf_load_partdesc (sb, data.part_descs_loc[i].rec.block);if (ret <0 ) -return ret; + goto out; } - -return 0 ; + ret =0 ; +out: +kfree (data.part_descs_loc); +return ret; }/*
Greg Kroah-Hartman
maintainerPATCH 271/391 iio:imu:st_lsm6dsx: check st_lsm6dsx_shub_read_output return
In reply to Greg Kroah-HartmanFrom: Tom Rix <[email protected]>
commit f71e41e23e129640f620b65fc362a6da02580310 upstream.
Potential error return is not checked. This can lead to use of undefined data.
Detected by clang static analysis.
st_lsm6dsx_shub.c:540:8: warning: Assigned value is garbage or undefined
*val = (s16)le16_to_cpu(*((__le16 *)data));
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--- drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c +2 -0
@@ -313,6 +313,8 @@ st_lsm6dsx_shub_read(struct st_lsm6dsx_s err =st_lsm6dsx_shub_read_output (hw, data, len &ST_LS6DSX_READ_OP_MASK ); +if (err <0 ) +return err;st_lsm6dsx_shub_master_enable (sensor, false);
Greg Kroah-Hartman
maintainerPATCH 296/391 io_uring: use type appropriate io_kiocb handler for double poll
In reply to Greg Kroah-HartmanFrom: Jens Axboe <[email protected]>
commit c8b5e2600a2cfa1cdfbecf151afd67aee227381d upstream.
io_poll_double_wake() is called for both request types - both pure poll requests, and internal polls. This means that we should be using the right handler based on the request type. Use the one that the original caller already assigned for the waitqueue handling, that will always match the correct type.
--- fs/io_uring.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
fs/io_uring.c +4 -2
@@ -4786,8 +4786,10 @@ static int io_poll_double_wake(struct wa/* make sure double remove sees this as being gone */ wait->private =NULL ;spin_unlock (&poll->head->lock); -if (!done) -__io_async_wake (req, poll, mask, io_poll_task_func); +if (!done) { +/* use wait func handler, so it matches the rq type */ + poll->wait.func (&poll->wait, mode, sync, key); + } }refcount_dec (&req->refs);return 1 ;
Greg Kroah-Hartman
maintainerPATCH 295/391 block: advance iov_iter on bio_add_hw_page failure
In reply to Greg Kroah-HartmanFrom: Naohiro Aota <[email protected]>
commit 4977d121bc9bc5138d4d48b85469123001859573 upstream.
When the bio's size reaches max_append_sectors, bio_add_hw_page returns 0 then __bio_iov_append_get_pages returns -EINVAL. This is an expected result of building a small enough bio not to be split in the IO path. However, iov_iter is not advanced in this case, causing the same pages are filled for the bio again and again.
Fix the case by properly advancing the iov_iter for already processed pages.
--- block/bio.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
block/bio.c +7 -4
@@ -1046,6 +1046,7 @@ static int __bio_iov_append_get_pages(stssize_t size, left;unsigned len, i;size_t offset; +int ret =0 ;if (WARN_ON_ONCE (!max_append_sectors))return 0 ;
@@ -1068,15 +1069,17 @@ static int __bio_iov_append_get_pages(st len =min_t (size_t,PAGE_SIZE - offset, left);if (bio_add_hw_page (q, bio, page, len, offset, - max_append_sectors, &same_page) != len) -return -EINVAL ; + max_append_sectors, &same_page) != len) { + ret = -EINVAL ; +break ; + }if (same_page)put_page (page); offset =0 ; } -iov_iter_advance (iter, size); -return 0 ; +iov_iter_advance (iter, size - left); +return ret; }/**
Greg Kroah-Hartman
maintainerPATCH 292/391 powerpc: Fix undetected data corruption with P9N DD2.1 VSX CI load emulation
In reply to Greg Kroah-HartmanFrom: Michael Neuling <[email protected]>
commit 1da4a0272c5469169f78cd76cf175ff984f52f06 upstream.
__get_user_atomic_128_aligned() stores to kaddr using stvx which is a VMX store instruction, hence kaddr must be 16 byte aligned otherwise the store won't occur as expected.
Unfortunately when we call __get_user_atomic_128_aligned() in p9_hmi_special_emu(), the buffer we pass as kaddr (ie. vbuf) isn't guaranteed to be 16B aligned. This means that the write to vbuf in __get_user_atomic_128_aligned() has the bottom bits of the address truncated. This results in other local variables being overwritten. Also vbuf will not contain the correct data which results in the userspace emulation being wrong and hence undetected user data corruption.
In the past we've been mostly lucky as vbuf has ended up aligned but this is fragile and isn't always true. CONFIG_STACKPROTECTOR in particular can change the stack arrangement enough that our luck runs out.
This issue only occurs on POWER9 Nimbus <= DD2.1 bare metal.
The fix is to align vbuf to a 16 byte boundary.
--- arch/powerpc/kernel/traps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/traps.c +1 -1
@@ -889,7 +889,7 @@ static void p9_hmi_special_emu(struct pt {unsigned int ra, rb, t, i, sel, instr, rc;const void __user *addr; -u8 vbuf[16 ], *vdst; +u8 vbuf[16 ]__aligned(16) , *vdst;unsigned long ea, msr, msr_mask;bool swap;
Greg Kroah-Hartman
maintainerPATCH 289/391 powerpc/powernv/elog: Fix race while processing OPAL error log event.
In reply to Greg Kroah-HartmanFrom: Mahesh Salgaonkar <[email protected]>
commit aea948bb80b478ddc2448f7359d574387521a52d upstream.
Every error log reported by OPAL is exported to userspace through a sysfs interface and notified using kobject_uevent(). The userspace daemon (opal_errd) then reads the error log and acknowledges the error log is saved safely to disk. Once acknowledged the kernel removes the respective sysfs file entry causing respective resources to be released including kobject.
However it's possible the userspace daemon may already be scanning elog entries when a new sysfs elog entry is created by the kernel. User daemon may read this new entry and ack it even before kernel can notify userspace about it through kobject_uevent() call. If that happens then we have a potential race between elog_ack_store->kobject_put() and kobject_uevent which can lead to use-after-free of a kernfs object resulting in a kernel crash. eg:
BUG: Unable to handle kernel data access on read at 0x6b6b6b6b6b6b6bfb
Faulting instruction address: 0xc0000000008ff2a0
Oops: Kernel access of bad area, sig: 11 [#1]
LE PAGE_SIZE=64K MMU=Hash SMP NR_CPUS=2048 NUMA PowerNV
CPU: 27 PID: 805 Comm: irq/29-opal-elo Not tainted 5.9.0-rc2-gcc-8.2.0-00214-g6f56a67bcbb5-dirty #363
...
NIP kobject_uevent_env+0xa0/0x910
LR elog_event+0x1f4/0x2d0
Call Trace:
0x5deadbeef0000122 (unreliable)
elog_event+0x1f4/0x2d0
irq_thread_fn+0x4c/0xc0
irq_thread+0x1c0/0x2b0
kthread+0x1c4/0x1d0
ret_from_kernel_thread+0x5c/0x6cThis patch fixes this race by protecting the sysfs file creation/notification by holding a reference count on kobject until we safely send kobject_uevent().
The function create_elog_obj() returns the elog object which if used by caller function will end up in use-after-free problem again. However, the return value of create_elog_obj() function isn't being used today and there is no need as well. Hence change it to return void to make this fix complete.
--- arch/powerpc/platforms/powernv/opal-elog.c | 33 ++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-)
arch/powerpc/platforms/powernv/opal-elog.c +26 -7
@@ -179,14 +179,14 @@ static ssize_t raw_attr_read(struct filereturn count; } -static struct elog_obj *create_elog_obj (uint64_t id,size_t size,uint64_t type) +static void create_elog_obj (uint64_t id,size_t size,uint64_t type) {struct elog_obj *elog;int rc; elog =kzalloc (sizeof (*elog),GFP_KERNEL );if (!elog) -return NULL ; +return ; elog->kobj.kset = elog_kset;
@@ -219,18 +219,37 @@ static struct elog_obj *create_elog_obj( rc =kobject_add (&elog->kobj,NULL ,"0x%llx" , id);if (rc) {kobject_put (&elog->kobj); -return NULL ; +return ; } +/* +* As soon as the sysfs file for this elog is created/activated there is +* a chance the opal_errd daemon (or any userspace) might read and +* acknowledge the elog before kobject_uevent() is called. If that +* happens then there is a potential race between +* elog_ack_store->kobject_put() and kobject_uevent() which leads to a +* use-after-free of a kernfs object resulting in a kernel crash. +* +* To avoid that, we need to take a reference on behalf of the bin file, +* so that our reference remains valid while we call kobject_uevent(). +* We then drop our reference before exiting the function, leaving the +* bin file to drop the last reference (if it hasn't already). +*/ + +/* Take a reference for the bin file */ +kobject_get (&elog->kobj); rc =sysfs_create_bin_file (&elog->kobj, &elog->raw_attr); -if (rc) { +if (rc ==0 ) { +kobject_uevent (&elog->kobj,KOBJ_ADD ); + }else { +/* Drop the reference taken for the bin file */ kobject_put (&elog->kobj); -return NULL ; } -kobject_uevent (&elog->kobj,KOBJ_ADD ); +/* Drop our reference */ +kobject_put (&elog->kobj); -return elog; +return ; }static irqreturn_t elog_event (int irq,void *data)
Greg Kroah-Hartman
maintainerPATCH 286/391 powerpc/rtas: Restrict RTAS requests from userspace
In reply to Greg Kroah-HartmanFrom: Andrew Donnellan <[email protected]>
commit bd59380c5ba4147dcbaad3e582b55ccfd120b764 upstream.
A number of userspace utilities depend on making calls to RTAS to retrieve information and update various things.
The existing API through which we expose RTAS to userspace exposes more RTAS functionality than we actually need, through the sys_rtas syscall, which allows root (or anyone with CAP_SYS_ADMIN) to make any RTAS call they want with arbitrary arguments.
Many RTAS calls take the address of a buffer as an argument, and it's up to the caller to specify the physical address of the buffer as an argument. We allocate a buffer (the "RMO buffer") in the Real Memory Area that RTAS can access, and then expose the physical address and size of this buffer in /proc/powerpc/rtas/rmo_buffer. Userspace is expected to read this address, poke at the buffer using /dev/mem, and pass an address in the RMO buffer to the RTAS call.
However, there's nothing stopping the caller from specifying whatever address they want in the RTAS call, and it's easy to construct a series of RTAS calls that can overwrite arbitrary bytes (even without /dev/mem access).
Additionally, there are some RTAS calls that do potentially dangerous things and for which there are no legitimate userspace use cases.
In the past, this would not have been a particularly big deal as it was assumed that root could modify all system state freely, but with Secure Boot and lockdown we need to care about this.
We can't fundamentally change the ABI at this point, however we can address this by implementing a filter that checks RTAS calls against a list of permitted calls and forces the caller to use addresses within the RMO buffer.
The list is based off the list of calls that are used by the librtas userspace library, and has been tested with a number of existing userspace RTAS utilities. For compatibility with any applications we are not aware of that require other calls, the filter can be turned off at build time.
--- arch/powerpc/Kconfig | 13 +++ arch/powerpc/kernel/rtas.c | 153 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 166 insertions(+)
arch/powerpc/Kconfig +13 -0
@@ -1001,6 +1001,19 @@ config PPC_SECVAR_SYSFS read/write operations on these variables. Say Y if you have secure boot enabled and want to expose variables to userspace. +config PPC_RTAS_FILTER + bool "Enable filtering of RTAS syscalls" + default y + depends on PPC_RTAS + help + The RTAS syscall API has security issues that could be used to + compromise system integrity. This option enforces restrictions on the + RTAS calls and arguments passed by userspace programs to mitigate + these issues. + + Say Y unless you know what you are doing and the filter is causing + problems for you. + endmenu config ISA_DMA_API
arch/powerpc/kernel/rtas.c +153 -0
177 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 285/391 s390/stp: add locking to sysfs functions
In reply to Greg Kroah-HartmanFrom: Sven Schnelle <[email protected]>
commit b3bd02495cb339124f13135d51940cf48d83e5cb upstream.
The sysfs function might race with stp_work_fn. To prevent that, add the required locking. Another issue is that the sysfs functions are checking the stp_online flag, but this flag just holds the user setting whether STP is enabled. Add a flag to clock_sync_flag whether stp_info holds valid data and use that instead.
--- arch/s390/kernel/time.c | 118 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 85 insertions(+), 33 deletions(-)
arch/s390/kernel/time.c +85 -33
@@ -345,8 +345,9 @@ static DEFINE_PER_CPU(atomic_t, clock_systatic DEFINE_MUTEX (clock_sync_mutex);static unsigned long clock_sync_flags; -#define CLOCK_SYNC_HAS_STP 0 -#define CLOCK_SYNC_STP 1 +#define CLOCK_SYNC_HAS_STP 0 +#define CLOCK_SYNC_STP 1 +#define CLOCK_SYNC_STPINFO_VALID 2/* * The get_clock function for the physical clock. It will get the current
@@ -583,6 +584,22 @@ void stp_queue_work(void)queue_work (time_sync_wq, &stp_work); } +static int __store_stpinfo (void ) +{ +int rc =chsc_sstpi (stp_page, &stp_info,sizeof (struct stp_sstpi )); + +if (rc) +clear_bit (CLOCK_SYNC_STPINFO_VALID , &clock_sync_flags); +else +set_bit (CLOCK_SYNC_STPINFO_VALID , &clock_sync_flags); +return rc; +} + +static int stpinfo_valid (void ) +{ +return stp_online &&test_bit (CLOCK_SYNC_STPINFO_VALID , &clock_sync_flags); +} +static int stp_sync_clock (void *data) {struct clock_sync_data *sync = data;
@@ -604,8 +621,7 @@ static int stp_sync_clock(void *data)if (rc ==0 ) { sync->clock_delta = clock_delta;clock_sync_global (clock_delta); - rc =chsc_sstpi (stp_page, &stp_info, -sizeof (struct stp_sstpi )); + rc =__store_stpinfo ();if (rc ==0 && stp_info.tmd !=2 ) rc = -EAGAIN ; }
@@ -650,7 +666,7 @@ static void stp_work_fn(struct work_struif (rc) goto out_unlock; - rc =chsc_sstpi (stp_page, &stp_info,sizeof (struct stp_sstpi )); + rc =__store_stpinfo ();if (rc || stp_info.c ==0 ) goto out_unlock;
@@ -687,10 +703,14 @@ static ssize_t ctn_id_show(struct devicestruct device_attribute *attr, char *buf) { -if (!stp_online) -return -ENODATA ; -return sprintf (buf,"%016llx\n" , - *(unsigned long long *) stp_info.ctnid); + ssize_t ret = -ENODATA; + +mutex_lock (&stp_work_mutex); +if (stpinfo_valid ()) + ret =sprintf (buf,"%016llx\n" , + *(unsigned long long *) stp_info.ctnid); +mutex_unlock (&stp_work_mutex); +return ret; }static DEVICE_ATTR_RO (ctn_id);
@@ -699,9 +719,13 @@ static ssize_t ctn_type_show(struct devistruct device_attribute *attr, char *buf) { -if (!stp_online) -return -ENODATA ; -return sprintf (buf,"%i\n" , stp_info.ctn); + ssize_t ret = -ENODATA; + +mutex_lock (&stp_work_mutex); +if (stpinfo_valid ()) + ret =sprintf (buf,"%i\n" , stp_info.ctn); +mutex_unlock (&stp_work_mutex); +return ret; }static DEVICE_ATTR_RO (ctn_type);
@@ -710,9 +734,13 @@ static ssize_t dst_offset_show(struct destruct device_attribute *attr, char *buf) { -if (!stp_online || !(stp_info.vbits &0x2000 )) -return -ENODATA ; -return sprintf (buf,"%i\n" , (int )(s16 ) stp_info.dsto); + ssize_t ret = -ENODATA; + +mutex_lock (&stp_work_mutex); +if (stpinfo_valid () && (stp_info.vbits &0x2000 )) + ret =sprintf (buf,"%i\n" , (int )(s16 ) stp_info.dsto); +mutex_unlock (&stp_work_mutex); +return ret; }static DEVICE_ATTR_RO (dst_offset);
@@ -721,9 +749,13 @@ static ssize_t leap_seconds_show(structstruct device_attribute *attr, char *buf) { -if (!stp_online || !(stp_info.vbits &0x8000 )) -return -ENODATA ; -return sprintf (buf,"%i\n" , (int )(s16 ) stp_info.leaps); + ssize_t ret = -ENODATA; + +mutex_lock (&stp_work_mutex); +if (stpinfo_valid () && (stp_info.vbits &0x8000 )) + ret =sprintf (buf,"%i\n" , (int )(s16 ) stp_info.leaps); +mutex_unlock (&stp_work_mutex); +return ret; }static DEVICE_ATTR_RO (leap_seconds);
@@ -732,9 +764,13 @@ static ssize_t stratum_show(struct devicstruct device_attribute *attr, char *buf) { -if (!stp_online) -return -ENODATA ; -return sprintf (buf,"%i\n" , (int )(s16 ) stp_info.stratum); + ssize_t ret = -ENODATA; + +mutex_lock (&stp_work_mutex); +if (stpinfo_valid ()) + ret =sprintf (buf,"%i\n" , (int )(s16 ) stp_info.stratum); +mutex_unlock (&stp_work_mutex); +return ret; }static DEVICE_ATTR_RO (stratum);
@@ -743,9 +779,13 @@ static ssize_t time_offset_show(struct dstruct device_attribute *attr, char *buf) { -if (!stp_online || !(stp_info.vbits &0x0800 )) -return -ENODATA ; -return sprintf (buf,"%i\n" , (int ) stp_info.tto); + ssize_t ret = -ENODATA; + +mutex_lock (&stp_work_mutex); +if (stpinfo_valid () && (stp_info.vbits &0x0800 )) + ret =sprintf (buf,"%i\n" , (int ) stp_info.tto); +mutex_unlock (&stp_work_mutex); +return ret; }static DEVICE_ATTR_RO (time_offset);
@@ -754,9 +794,13 @@ static ssize_t time_zone_offset_show(strstruct device_attribute *attr, char *buf) { -if (!stp_online || !(stp_info.vbits &0x4000 )) -return -ENODATA ; -return sprintf (buf,"%i\n" , (int )(s16 ) stp_info.tzo); + ssize_t ret = -ENODATA; + +mutex_lock (&stp_work_mutex); +if (stpinfo_valid () && (stp_info.vbits &0x4000 )) + ret =sprintf (buf,"%i\n" , (int )(s16 ) stp_info.tzo); +mutex_unlock (&stp_work_mutex); +return ret; }static DEVICE_ATTR_RO (time_zone_offset);
@@ -765,9 +809,13 @@ static ssize_t timing_mode_show(struct dstruct device_attribute *attr, char *buf) { -if (!stp_online) -return -ENODATA ; -return sprintf (buf,"%i\n" , stp_info.tmd); + ssize_t ret = -ENODATA; + +mutex_lock (&stp_work_mutex); +if (stpinfo_valid ()) + ret =sprintf (buf,"%i\n" , stp_info.tmd); +mutex_unlock (&stp_work_mutex); +return ret; }static DEVICE_ATTR_RO (timing_mode);
@@ -776,9 +824,13 @@ static ssize_t timing_state_show(structstruct device_attribute *attr, char *buf) { -if (!stp_online) -return -ENODATA ; -return sprintf (buf,"%i\n" , stp_info.tst); + ssize_t ret = -ENODATA; + +mutex_lock (&stp_work_mutex); +if (stpinfo_valid ()) + ret =sprintf (buf,"%i\n" , stp_info.tst); +mutex_unlock (&stp_work_mutex); +return ret; }static DEVICE_ATTR_RO (timing_state);
Greg Kroah-Hartman
maintainerPATCH 281/391 rcu-tasks: Fix low-probability task_struct leak
In reply to Greg Kroah-HartmanFrom: Paul E. McKenney <[email protected]>
commit 592031cc10858be4adb10f6c0f2608f6f21824aa upstream.
When rcu_tasks_trace_postgp() function detects an RCU Tasks Trace CPU stall, it adds all tasks blocking the current grace period to a list, invoking get_task_struct() on each to prevent them from being freed while on the list. It then traverses that list, printing stall-warning messages for each one that is still blocking the current grace period and removing it from the list. The list removal invokes the matching put_task_struct().
This of course means that in the admittedly unlikely event that some task executes its outermost rcu_read_unlock_trace() in the meantime, it won't be removed from the list and put_task_struct() won't be executing, resulting in a task_struct leak. This commit therefore makes the list removal and put_task_struct() unconditional, stopping the leak.
Note further that this bug can occur only after an RCU Tasks Trace CPU stall warning, which by default only happens after a grace period has extended for ten minutes (yes, not a typo, minutes).
--- kernel/rcu/tasks.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
kernel/rcu/tasks.h +4 -4
@@ -1082,11 +1082,11 @@ static void rcu_tasks_trace_postgp(strucif (READ_ONCE (t->trc_reader_special.b.need_qs))trc_add_holdout (t, &holdouts); firstreport = true; -list_for_each_entry_safe (t, g, &holdouts, trc_holdout_list) -if (READ_ONCE (t->trc_reader_special.b.need_qs)) { +list_for_each_entry_safe (t, g, &holdouts, trc_holdout_list) { +if (READ_ONCE (t->trc_reader_special.b.need_qs))show_stalled_task_trace (t, &firstreport); -trc_del_holdout (t); - } +trc_del_holdout (t);// Release task_struct reference. + }if (firstreport)pr_err ("INFO: rcu_tasks_trace detected stalls? (Counter/taskslist mismatch?)\n" );show_stalled_ipi_trace ();
Greg Kroah-Hartman
maintainerPATCH 262/391 Revert "vhost-vdpa: fix page pinning leakage in error path"
In reply to Greg Kroah-HartmanFrom: Michael S. Tsirkin <[email protected]>
commit 5e1a3149eec8675c2767cc465903f5e4829de5b0 upstream.
This reverts commit 7ed9e3d97c32d969caded2dfb6e67c1a2cc5a0b1.
The patch creates a DoS risk since it can result in a high order memory allocation.
--- drivers/vhost/vdpa.c | 117 ++++++++++++++++++++------------------------------- 1 file changed, 47 insertions(+), 70 deletions(-)
drivers/vhost/vdpa.c +47 -70
@@ -595,19 +595,21 @@ static int vhost_vdpa_process_iotlb_updastruct vhost_dev *dev = &v->vdev;struct vhost_iotlb *iotlb = dev->iotlb;struct page **page_list; -struct vm_area_struct **vmas; +unsigned long list_size =PAGE_SIZE /sizeof (struct page *);unsigned int gup_flags =FOLL_LONGTERM ; -unsigned long map_pfn, last_pfn =0 ; -unsigned long npages, lock_limit; -unsigned long i, nmap =0 ; +unsigned long npages, cur_base, map_pfn, last_pfn =0 ; +unsigned long locked, lock_limit, pinned, i;u64 iova = msg->iova; -long pinned;int ret =0 ;if (vhost_iotlb_itree_first (iotlb, msg->iova, msg->iova + msg->size -1 ))return -EEXIST ; + page_list = (struct page **)__get_free_page (GFP_KERNEL ); +if (!page_list) +return -ENOMEM ; +if (msg->perm &VHOST_ACCESS_WO ) gup_flags |=FOLL_WRITE ;
@@ -615,86 +617,61 @@ static int vhost_vdpa_process_iotlb_updaif (!npages)return -EINVAL ; - page_list =kvmalloc_array (npages,sizeof (struct page *),GFP_KERNEL ); - vmas =kvmalloc_array (npages,sizeof (struct vm_area_struct *), -GFP_KERNEL ); -if (!page_list || !vmas) { - ret = -ENOMEM ; - goto free; - } -mmap_read_lock (dev->mm); + locked =atomic64_add_return (npages, &dev->mm->pinned_vm); lock_limit =rlimit (RLIMIT_MEMLOCK ) >>PAGE_SHIFT ; -if (npages +atomic64_read (&dev->mm->pinned_vm) > lock_limit) { - ret = -ENOMEM ; - goto unlock; - } - pinned =pin_user_pages (msg->uaddr &PAGE_MASK , npages, gup_flags, - page_list, vmas); -if (npages != pinned) { -if (pinned <0 ) { - ret = pinned; - }else { -unpin_user_pages (page_list, pinned); - ret = -ENOMEM ; - } - goto unlock; +if (locked > lock_limit) { + ret = -ENOMEM ; + goto out; } + cur_base = msg->uaddr &PAGE_MASK ; iova &=PAGE_MASK ; - map_pfn =page_to_pfn (page_list[0 ]); -/* One more iteration to avoid extra vdpa_map() call out of loop. */ -for (i =0 ; i <= npages; i++) { -unsigned long this_pfn; -u64 csize; - -/* The last chunk may have no valid PFN next to it */ - this_pfn = i < npages ?page_to_pfn (page_list[i]) :-1UL ; - -if (last_pfn && (this_pfn ==-1UL || - this_pfn != last_pfn +1 )) { -/* Pin a contiguous chunk of memory */ - csize = last_pfn - map_pfn +1 ; - ret =vhost_vdpa_map (v, iova, csize <<PAGE_SHIFT , - map_pfn <<PAGE_SHIFT , - msg->perm); -if (ret) { -/* -* Unpin the rest chunks of memory on the -* flight with no corresponding vdpa_map() -* calls having been made yet. On the other -* hand, vdpa_unmap() in the failure path -* is in charge of accounting the number of -* pinned pages for its own. -* This asymmetrical pattern of accounting -* is for efficiency to pin all pages at -* once, while there is no other callsite -* of vdpa_map() than here above. -*/ -unpin_user_pages (&page_list[nmap], - npages - nmap); - goto out; +while (npages) { + pinned = min_t(unsigned long, npages, list_size); + ret =pin_user_pages (cur_base, pinned, + gup_flags, page_list,NULL ); +if (ret != pinned) + goto out; + +if (!last_pfn) + map_pfn =page_to_pfn (page_list[0 ]); + +for (i =0 ; i < ret; i++) { +unsigned long this_pfn =page_to_pfn (page_list[i]); +u64 csize; + +if (last_pfn && (this_pfn != last_pfn +1 )) { +/* Pin a contiguous chunk of memory */ + csize = (last_pfn - map_pfn +1 ) <<PAGE_SHIFT ; +if (vhost_vdpa_map (v, iova, csize, + map_pfn <<PAGE_SHIFT , + msg->perm)) + goto out; + map_pfn = this_pfn; + iova += csize; } -atomic64_add (csize, &dev->mm->pinned_vm); - nmap += csize; - iova += csize <<PAGE_SHIFT ; - map_pfn = this_pfn; + + last_pfn = this_pfn; } - last_pfn = this_pfn; + + cur_base += ret <<PAGE_SHIFT ; + npages -= ret; } -WARN_ON (nmap != npages); +/* Pin the rest chunk */ + ret =vhost_vdpa_map (v, iova, (last_pfn - map_pfn +1 ) <<PAGE_SHIFT , + map_pfn <<PAGE_SHIFT , msg->perm); out: -if (ret) +if (ret) {vhost_vdpa_unmap (v, msg->iova, msg->size); -unlock: +atomic64_sub (npages, &dev->mm->pinned_vm); + }mmap_read_unlock (dev->mm); -free: -kvfree (vmas); -kvfree (page_list); +free_page ((unsigned long )page_list);return ret; }
Greg Kroah-Hartman
maintainerPATCH 278/391 iio:gyro:itg3200: Fix timestamp alignment and prevent data leak.
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
commit 10ab7cfd5522f0041028556dac864a003e158556 upstream.
One of a class of bugs pointed out by Lars in a recent review. iio_push_to_buffers_with_timestamp assumes the buffer used is aligned to the size of the timestamp (8 bytes). This is not guaranteed in this driver which uses a 16 byte array of smaller elements on the stack. This is fixed by using an explicit c structure. As there are no holes in the structure, there is no possiblity of data leakage in this case.
The explicit alignment of ts is not strictly necessary but potentially makes the code slightly less fragile. It also removes the possibility of this being cut and paste into another driver where the alignment isn't already true.
--- drivers/iio/gyro/itg3200_buffer.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/iio/gyro/itg3200_buffer.c +10 -3
@@ -46,13 +46,20 @@ static irqreturn_t itg3200_trigger_handlstruct iio_poll_func *pf = p;struct iio_dev *indio_dev = pf->indio_dev;struct itg3200 *st =iio_priv (indio_dev); -__be16 buf[ITG3200_SCAN_ELEMENTS +sizeof (s64)/sizeof (u16)]; +/* +* Ensure correct alignment and padding including for the +* timestamp that may be inserted. +*/ +struct { +__be16 buf[ITG3200_SCAN_ELEMENTS ]; +s64 ts__aligned(8) ; + } scan; -int ret =itg3200_read_all_channels (st->i2c, buf); +int ret =itg3200_read_all_channels (st->i2c, scan.buf);if (ret <0 ) goto error_ret; -iio_push_to_buffers_with_timestamp (indio_dev, buf, pf->timestamp); +iio_push_to_buffers_with_timestamp (indio_dev, &scan, pf->timestamp);iio_trigger_notify_done (indio_dev->trig);
Greg Kroah-Hartman
maintainerPATCH 276/391 iio:adc:ti-adc12138 Fix alignment issue with timestamp
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
commit 293e809b2e8e608b65a949101aaf7c0bd1224247 upstream.
One of a class of bugs pointed out by Lars in a recent review. iio_push_to_buffers_with_timestamp assumes the buffer used is aligned to the size of the timestamp (8 bytes). This is not guaranteed in this driver which uses an array of smaller elements on the stack.
We move to a suitable structure in the iio_priv() data with alignment explicitly requested. This data is allocated with kzalloc so no data can leak apart from previous readings. Note that previously no leak at all could occur, but previous readings should never be a problem.
In this case the timestamp location depends on what other channels are enabled. As such we can't use a structure without misleading by suggesting only one possible timestamp location.
--- drivers/iio/adc/ti-adc12138.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/iio/adc/ti-adc12138.c +9 -4
@@ -47,6 +47,12 @@ struct adc12138 {struct completion complete;/* The number of cclk periods for the S/H's acquisition time */ unsigned int acquisition_time; +/* +* Maximum size needed: 16x 2 bytes ADC data + 8 bytes timestamp. +* Less may be need if not all channels are enabled, as long as +* the 8 byte alignment of the timestamp is maintained. +*/ +__be16 data[20 ]__aligned(8) ;u8 tx_buf[2 ]____cacheline_aligned ;u8 rx_buf[2 ];
@@ -329,7 +335,6 @@ static irqreturn_t adc12138_trigger_handstruct iio_poll_func *pf = p;struct iio_dev *indio_dev = pf->indio_dev;struct adc12138 *adc =iio_priv (indio_dev); -__be16 data[20 ] = { };/* 16x 2 bytes ADC data + 8 bytes timestamp */ __be16 trash;int ret;int scan_index;
@@ -345,7 +350,7 @@ static irqreturn_t adc12138_trigger_handreinit_completion (&adc->complete); ret =adc12138_start_and_read_conv (adc, scan_chan, - i ? &data[i -1 ] : &trash); + i ? &adc->data[i -1 ] : &trash);if (ret) {dev_warn (&adc->spi->dev,"failed to start conversion\n" );
@@ -362,7 +367,7 @@ static irqreturn_t adc12138_trigger_hand }if (i) { - ret =adc12138_read_conv_data (adc, &data[i -1 ]); + ret =adc12138_read_conv_data (adc, &adc->data[i -1 ]);if (ret) {dev_warn (&adc->spi->dev,"failed to get conversion data\n" );
@@ -370,7 +375,7 @@ static irqreturn_t adc12138_trigger_hand } } -iio_push_to_buffers_with_timestamp (indio_dev, data, +iio_push_to_buffers_with_timestamp (indio_dev, adc->data,iio_get_time_ns (indio_dev)); out:mutex_unlock (&adc->lock);
Greg Kroah-Hartman
maintainerPATCH 258/391 x86/mce: Allow for copy_mc_fragile symbol checksum to be generated
In reply to Greg Kroah-HartmanFrom: Borislav Petkov <[email protected]>
commit b3149ffcdb31a8eb854cc442a389ae0b539bf28a upstream.
Add asm/mce.h to asm/asm-prototypes.h so that that asm symbol's checksum can be generated in order to support CONFIG_MODVERSIONS with it and fix:
WARNING: modpost: EXPORT symbol "copy_mc_fragile" [vmlinux] version \
generation failed, symbol will not be versioned.
For reference see:
4efca4ed05cb ("kbuild: modversions for EXPORT_SYMBOL() for asm") 334bb7738764 ("x86/kbuild: enable modversions for symbols exported from asm")
--- arch/x86/include/asm/asm-prototypes.h | 1 + 1 file changed, 1 insertion(+)
arch/x86/include/asm/asm-prototypes.h +1 -0
@@ -5,6 +5,7 @@#include <asm/string.h> #include <asm/page.h> #include <asm/checksum.h> +#include <asm/mce.h> #include <asm-generic/asm-prototypes.h>
Greg Kroah-Hartman
maintainerPATCH 255/391 vt: keyboard, extend func_buf_lock to readers
In reply to Greg Kroah-HartmanFrom: Jiri Slaby <[email protected]>
commit 82e61c3909db51d91b9d3e2071557b6435018b80 upstream.
Both read-side users of func_table/func_buf need locking. Without that, one can easily confuse the code by repeatedly setting altering strings like:
while (1)
for (a = 0; a < 2; a++) {
struct kbsentry kbs = {};
strcpy((char *)kbs.kb_string, a ? ".\n" : "88888\n");
ioctl(fd, KDSKBSENT, &kbs);
}When that program runs, one can get unexpected output by holding F1 (note the unxpected period on the last line):
.
88888
.8888
So protect all accesses to 'func_table' (and func_buf) by preexisting 'func_buf_lock'.
It is easy in 'k_fn' handler as 'puts_queue' is expected not to sleep. On the other hand, KDGKBSENT needs a local (atomic) copy of the string because copy_to_user can sleep. Use already allocated, but unused 'kbs->kb_string' for that purpose.
Note that the program above needs at least CAP_SYS_TTY_CONFIG.
This depends on the previous patch and on the func_buf_lock lock added in commit 46ca3f735f34 (tty/vt: fix write/write race in ioctl(KDSKBSENT) handler) in 5.2.
Likely fixes CVE-2020-25656.
--- drivers/tty/vt/keyboard.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
drivers/tty/vt/keyboard.c +13 -4
@@ -743,8 +743,13 @@ static void k_fn(struct vc_data *vc, unsreturn ;if ((unsigned )value <ARRAY_SIZE (func_table)) { +unsigned long flags; + +spin_lock_irqsave (&func_buf_lock, flags);if (func_table[value])puts_queue (vc, func_table[value]); +spin_unlock_irqrestore (&func_buf_lock, flags); + }else pr_err ("k_fn called with value=%d\n" , value); }
@@ -1991,7 +1996,7 @@ out:#undef s#undef v -/* FIXME: This one needs untangling and locking */ +/* FIXME: This one needs untangling */ int vt_do_kdgkb_ioctl (int cmd,struct kbsentry __user *user_kdgkb,int perm) {struct kbsentry *kbs;
@@ -2023,10 +2028,14 @@ int vt_do_kdgkb_ioctl(int cmd, struct kbswitch (cmd) {case KDGKBSENT : {/* size should have been a struct member */ -unsigned char *from = func_table[i] ? :"" ; +ssize_t len =sizeof (user_kdgkb->kb_string); + +spin_lock_irqsave (&func_buf_lock, flags); + len =strlcpy (kbs->kb_string, func_table[i] ? :"" , len); +spin_unlock_irqrestore (&func_buf_lock, flags); - ret =copy_to_user (user_kdgkb->kb_string, from, -strlen (from) +1 ) ? -EFAULT :0 ; + ret =copy_to_user (user_kdgkb->kb_string, kbs->kb_string, + len +1 ) ? -EFAULT :0 ; goto reterr; }
Greg Kroah-Hartman
maintainerPATCH 251/391 usbcore: Check both id_table and match() when both available
In reply to Greg Kroah-HartmanFrom: Bastien Nocera <[email protected]>
commit 0942d59b0af46511d59dbf5bd69ec4a64d1a854c upstream.
From: Bastien Nocera <[email protected]>
When a USB device driver has both an id_table and a match() function, make sure to check both to find a match, first matching the id_table, then checking the match() function.
This makes it possible to have module autoloading done through the id_table when devices are plugged in, before checking for further device eligibility in the match() function.
--- drivers/usb/core/driver.c | 30 +++++++++++++++++++++--------- drivers/usb/core/generic.c | 4 +--- drivers/usb/core/usb.h | 2 ++ 3 files changed, 24 insertions(+), 12 deletions(-)
drivers/usb/core/driver.c +21 -9
@@ -839,6 +839,22 @@ const struct usb_device_id *usb_device_mreturn NULL ; } +bool usb_driver_applicable (struct usb_device *udev, +struct usb_device_driver *udrv) +{ +if (udrv->id_table && udrv->match) +return usb_device_match_id (udev, udrv->id_table) !=NULL && + udrv->match (udev); + +if (udrv->id_table) +return usb_device_match_id (udev, udrv->id_table) !=NULL ; + +if (udrv->match) +return udrv->match (udev); + +return false; +} +static int usb_device_match (struct device *dev,struct device_driver *drv) {/* devices and interfaces are handled separately */
@@ -853,17 +869,14 @@ static int usb_device_match(struct devic udev =to_usb_device (dev); udrv =to_usb_device_driver (drv); -if (udrv->id_table) -return usb_device_match_id (udev, udrv->id_table) !=NULL ; - -if (udrv->match) -return udrv->match (udev); -/* If the device driver under consideration does not have a * id_table or a match function, then let the driver's probe * function decide. */ -return 1 ; +if (!udrv->id_table && !udrv->match) +return 1 ; + +return usb_driver_applicable (udev, udrv); }else if (is_usb_interface (dev)) {struct usb_interface *intf;
@@ -941,8 +954,7 @@ static int __usb_bus_reprobe_drivers(strreturn 0 ; udev =to_usb_device (dev); -if (usb_device_match_id (udev, new_udriver->id_table) ==NULL && - (!new_udriver->match || new_udriver->match (udev) ==0 )) +if (!usb_driver_applicable (udev, new_udriver))return 0 ; ret =device_reprobe (dev);
drivers/usb/core/generic.c +1 -3
@@ -205,9 +205,7 @@ static int __check_usb_generic(struct de udrv =to_usb_device_driver (drv);if (udrv == &usb_generic_driver)return 0 ; -if (usb_device_match_id (udev, udrv->id_table) !=NULL ) -return 1 ; -return (udrv->match && udrv->match (udev)); +return usb_driver_applicable (udev, udrv); }static bool usb_generic_driver_match (struct usb_device *udev)
drivers/usb/core/usb.h +2 -0
@@ -74,6 +74,8 @@ extern int usb_match_device(struct usb_d const struct usb_device_id *id);extern const struct usb_device_id *usb_device_match_id (struct usb_device *udev,const struct usb_device_id *id); +extern bool usb_driver_applicable (struct usb_device *udev, +struct usb_device_driver *udrv);extern void usb_forced_unbind_intf (struct usb_interface *intf);extern void usb_unbind_and_rebind_marked_interfaces (struct usb_device *udev);
Greg Kroah-Hartman
maintainerPATCH 222/391 btrfs: improve device scanning messages
In reply to Greg Kroah-HartmanFrom: Anand Jain <[email protected]>
commit 79dae17d8d44b2d15779e332180080af45df5352 upstream.
Systems booting without the initramfs seems to scan an unusual kind of device path (/dev/root). And at a later time, the device is updated to the correct path. We generally print the process name and PID of the process scanning the device but we don't capture the same information if the device path is rescanned with a different pathname.
The current message is too long, so drop the unnecessary UUID and add process name and PID.
While at this also update the duplicate device warning to include the process name and PID so the messages are consistent
CC: [email protected] # 4.19+
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=89721
--- fs/btrfs/volumes.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
fs/btrfs/volumes.c +8 -6
@@ -942,16 +942,18 @@ static noinline struct btrfs_device *devbdput (path_bdev);mutex_unlock (&fs_devices->device_list_mutex);btrfs_warn_in_rcu (device->fs_info, -"duplicate device fsid:devid for %pU:%llu old:%s new:%s" , - disk_super->fsid, devid, -rcu_str_deref (device->name), path); +"duplicate device %s devid %llu generation %llu scanned by %s (%d)" , + path, devid, found_transid, + current->comm, +task_pid_nr (current));return ERR_PTR (-EEXIST ); }bdput (path_bdev);btrfs_info_in_rcu (device->fs_info, -"device fsid %pU devid %llu moved old:%s new:%s" , - disk_super->fsid, devid, -rcu_str_deref (device->name), path); +"devid %llu device path %s changed to %s scanned by %s (%d)" , + devid,rcu_str_deref (device->name), + path, current->comm, +task_pid_nr (current)); } name =rcu_string_strdup (path,GFP_NOFS );
Greg Kroah-Hartman
maintainerPATCH 244/391 usb: dwc3: core: dont trigger runtime pm when remove driver
In reply to Greg Kroah-HartmanFrom: Li Jun <[email protected]>
commit 266d0493900ac5d6a21cdbe6b1624ed2da94d47a upstream.
No need to trigger runtime pm in driver removal, otherwise if user disable auto suspend via sys file, runtime suspend may be entered, which will call dwc3_core_exit() again and there will be clock disable not balance warning:
[ 2026.820154] xhci-hcd xhci-hcd.0.auto: remove, state 4 [ 2026.825268] usb usb2: USB disconnect, device number 1 [ 2026.831017] xhci-hcd xhci-hcd.0.auto: USB bus 2 deregistered [ 2026.836806] xhci-hcd xhci-hcd.0.auto: remove, state 4 [ 2026.842029] usb usb1: USB disconnect, device number 1 [ 2026.848029] xhci-hcd xhci-hcd.0.auto: USB bus 1 deregistered [ 2026.865889] ------------[ cut here ]------------ [ 2026.870506] usb2_ctrl_root_clk already disabled [ 2026.875082] WARNING: CPU: 0 PID: 731 at drivers/clk/clk.c:958 clk_core_disable+0xa0/0xa8 [ 2026.883170] Modules linked in: dwc3(-) phy_fsl_imx8mq_usb [last unloaded: dwc3] [ 2026.890488] CPU: 0 PID: 731 Comm: rmmod Not tainted 5.8.0-rc7-00280-g9d08cca-dirty #245 [ 2026.898489] Hardware name: NXP i.MX8MQ EVK (DT) [ 2026.903020] pstate: 20000085 (nzCv daIf -PAN -UAO BTYPE=--) [ 2026.908594] pc : clk_core_disable+0xa0/0xa8 [ 2026.912777] lr : clk_core_disable+0xa0/0xa8 [ 2026.916958] sp : ffff8000121b39a0 [ 2026.920271] x29: ffff8000121b39a0 x28: ffff0000b11f3700 [ 2026.925583] x27: 0000000000000000 x26: ffff0000b539c700 [ 2026.930895] x25: 000001d7e44e1232 x24: ffff0000b76fa800 [ 2026.936208] x23: ffff0000b76fa6f8 x22: ffff800008d01040 [ 2026.941520] x21: ffff0000b539ce00 x20: ffff0000b7105000 [ 2026.946832] x19: ffff0000b7105000 x18: 0000000000000010 [ 2026.952144] x17: 0000000000000001 x16: 0000000000000000 [ 2026.957456] x15: ffff0000b11f3b70 x14: ffffffffffffffff [ 2026.962768] x13: ffff8000921b36f7 x12: ffff8000121b36ff [ 2026.968080] x11: ffff8000119e1000 x10: ffff800011bf26d0 [ 2026.973392] x9 : 0000000000000000 x8 : ffff800011bf3000 [ 2026.978704] x7 : ffff800010695d68 x6 : 0000000000000252 [ 2026.984016] x5 : ffff0000bb9881f0 x4 : 0000000000000000 [ 2026.989327] x3 : 0000000000000027 x2 : 0000000000000023 [ 2026.994639] x1 : ac2fa471aa7cab00 x0 : 0000000000000000 [ 2026.999951] Call trace: [ 2027.002401] clk_core_disable+0xa0/0xa8 [ 2027.006238] clk_core_disable_lock+0x20/0x38 [ 2027.010508] clk_disable+0x1c/0x28 [ 2027.013911] clk_bulk_disable+0x34/0x50 [ 2027.017758] dwc3_core_exit+0xec/0x110 [dwc3] [ 2027.022122] dwc3_suspend_common+0x84/0x188 [dwc3] [ 2027.026919] dwc3_runtime_suspend+0x74/0x9c [dwc3] [ 2027.031712] pm_generic_runtime_suspend+0x28/0x40 [ 2027.036419] genpd_runtime_suspend+0xa0/0x258 [ 2027.040777] __rpm_callback+0x88/0x140 [ 2027.044526] rpm_callback+0x20/0x80 [ 2027.048015] rpm_suspend+0xd0/0x418 [ 2027.051503] __pm_runtime_suspend+0x58/0xa0 [ 2027.055693] dwc3_runtime_idle+0x7c/0x90 [dwc3] [ 2027.060224] __rpm_callback+0x88/0x140 [ 2027.063973] rpm_idle+0x78/0x150 [ 2027.067201] __pm_runtime_idle+0x58/0xa0 [ 2027.071130] dwc3_remove+0x64/0xc0 [dwc3] [ 2027.075140] platform_drv_remove+0x28/0x48 [ 2027.079239] device_release_driver_internal+0xf4/0x1c0 [ 2027.084377] driver_detach+0x4c/0xd8 [ 2027.087954] bus_remove_driver+0x54/0xa8 [ 2027.091877] driver_unregister+0x2c/0x58 [ 2027.095799] platform_driver_unregister+0x10/0x18 [ 2027.100509] dwc3_driver_exit+0x14/0x1408 [dwc3] [ 2027.105129] __arm64_sys_delete_module+0x178/0x218 [ 2027.109922] el0_svc_common.constprop.0+0x68/0x160 [ 2027.114714] do_el0_svc+0x20/0x80 [ 2027.118031] el0_sync_handler+0x88/0x190 [ 2027.121953] el0_sync+0x140/0x180 [ 2027.125267] ---[ end trace 027f4f8189958f1f ]--- [ 2027.129976] ------------[ cut here ]------------
--- drivers/usb/dwc3/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/dwc3/core.c +2 -2
@@ -1610,9 +1610,9 @@ static int dwc3_remove(struct platform_ddwc3_core_exit (dwc);dwc3_ulpi_exit (dwc); -pm_runtime_put_sync (&pdev->dev); -pm_runtime_allow (&pdev->dev);pm_runtime_disable (&pdev->dev); +pm_runtime_put_noidle (&pdev->dev); +pm_runtime_set_suspended (&pdev->dev);dwc3_free_event_buffers (dwc);dwc3_free_scratch_buffers (dwc);
Greg Kroah-Hartman
maintainerPATCH 239/391 usb: dwc3: pci: Allow Elkhart Lake to utilize DSM method for PM functionality
In reply to Greg Kroah-HartmanFrom: Raymond Tan <[email protected]>
commit a609ce2a13360d639b384b6ca783b38c1247f2db upstream.
Similar to some other IA platforms, Elkhart Lake too depends on the PMU register write to request transition of Dx power state.
Thus, we add the PCI_DEVICE_ID_INTEL_EHLLP to the list of devices that shall execute the ACPI _DSM method during D0/D3 sequence.
[[email protected]: included Fixes tag]
--- drivers/usb/dwc3/dwc3-pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/dwc3/dwc3-pci.c +2 -1
@@ -147,7 +147,8 @@ static int dwc3_pci_quirks(struct dwc3_pif (pdev->vendor ==PCI_VENDOR_ID_INTEL ) {if (pdev->device ==PCI_DEVICE_ID_INTEL_BXT || - pdev->device ==PCI_DEVICE_ID_INTEL_BXT_M ) { + pdev->device ==PCI_DEVICE_ID_INTEL_BXT_M || + pdev->device ==PCI_DEVICE_ID_INTEL_EHLLP ) {guid_parse (PCI_INTEL_BXT_DSM_GUID , &dwc->guid); dwc->has_dsm_for_pm = true; }
Greg Kroah-Hartman
maintainerPATCH 237/391 btrfs: drop the path before adding block group sysfs files
In reply to Greg Kroah-HartmanFrom: Josef Bacik <[email protected]>
commit 7837fa88704a66257404bb14144c9e4ab631a28a upstream.
Dave reported a problem with my rwsem conversion patch where we got the following lockdep splat:
======================================================
WARNING: possible circular locking dependency detected
5.9.0-default+ #1297 Not tainted
------------------------------------------------------
kswapd0/76 is trying to acquire lock:
ffff9d5d25df2530 (&delayed_node->mutex){+.+.}-{3:3}, at: __btrfs_release_delayed_node.part.0+0x3f/0x320 [btrfs]
but task is already holding lock:
ffffffffa40cbba0 (fs_reclaim){+.+.}-{0:0}, at: __fs_reclaim_acquire+0x5/0x30
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #4 (fs_reclaim){+.+.}-{0:0}:
__lock_acquire+0x582/0xac0 lock_acquire+0xca/0x430 fs_reclaim_acquire.part.0+0x25/0x30 kmem_cache_alloc+0x30/0x9c0 alloc_inode+0x81/0x90 iget_locked+0xcd/0x1a0 kernfs_get_inode+0x1b/0x130 kernfs_get_tree+0x136/0x210 sysfs_get_tree+0x1a/0x50 vfs_get_tree+0x1d/0xb0 path_mount+0x70f/0xa80 do_mount+0x75/0x90 __x64_sys_mount+0x8e/0xd0 do_syscall_64+0x2d/0x70 entry_SYSCALL_64_after_hwframe+0x44/0xa9
-> #3 (kernfs_mutex){+.+.}-{3:3}:
__lock_acquire+0x582/0xac0 lock_acquire+0xca/0x430 __mutex_lock+0xa0/0xaf0 kernfs_add_one+0x23/0x150 kernfs_create_dir_ns+0x58/0x80 sysfs_create_dir_ns+0x70/0xd0 kobject_add_internal+0xbb/0x2d0 kobject_add+0x7a/0xd0 btrfs_sysfs_add_block_group_type+0x141/0x1d0 [btrfs] btrfs_read_block_groups+0x1f1/0x8c0 [btrfs] open_ctree+0x981/0x1108 [btrfs] btrfs_mount_root.cold+0xe/0xb0 [btrfs] legacy_get_tree+0x2d/0x60 vfs_get_tree+0x1d/0xb0 fc_mount+0xe/0x40 vfs_kern_mount.part.0+0x71/0x90 btrfs_mount+0x13b/0x3e0 [btrfs] legacy_get_tree+0x2d/0x60 vfs_get_tree+0x1d/0xb0 path_mount+0x70f/0xa80 do_mount+0x75/0x90 __x64_sys_mount+0x8e/0xd0 do_syscall_64+0x2d/0x70 entry_SYSCALL_64_after_hwframe+0x44/0xa9
-> #2 (btrfs-extent-00){++++}-{3:3}:
__lock_acquire+0x582/0xac0 lock_acquire+0xca/0x430 down_read_nested+0x45/0x220 __btrfs_tree_read_lock+0x35/0x1c0 [btrfs] __btrfs_read_lock_root_node+0x3a/0x50 [btrfs] btrfs_search_slot+0x6d4/0xfd0 [btrfs] check_committed_ref+0x69/0x200 [btrfs] btrfs_cross_ref_exist+0x65/0xb0 [btrfs] run_delalloc_nocow+0x446/0x9b0 [btrfs] btrfs_run_delalloc_range+0x61/0x6a0 [btrfs] writepage_delalloc+0xae/0x160 [btrfs] __extent_writepage+0x262/0x420 [btrfs] extent_write_cache_pages+0x2b6/0x510 [btrfs] extent_writepages+0x43/0x90 [btrfs] do_writepages+0x40/0xe0 __writeback_single_inode+0x62/0x610 writeback_sb_inodes+0x20f/0x500 wb_writeback+0xef/0x4a0 wb_do_writeback+0x49/0x2e0 wb_workfn+0x81/0x340 process_one_work+0x233/0x5d0 worker_thread+0x50/0x3b0 kthread+0x137/0x150 ret_from_fork+0x1f/0x30
-> #1 (btrfs-fs-00){++++}-{3:3}:
__lock_acquire+0x582/0xac0 lock_acquire+0xca/0x430 down_read_nested+0x45/0x220 __btrfs_tree_read_lock+0x35/0x1c0 [btrfs] __btrfs_read_lock_root_node+0x3a/0x50 [btrfs] btrfs_search_slot+0x6d4/0xfd0 [btrfs] btrfs_lookup_inode+0x3a/0xc0 [btrfs] __btrfs_update_delayed_inode+0x93/0x2c0 [btrfs] __btrfs_commit_inode_delayed_items+0x7de/0x850 [btrfs] __btrfs_run_delayed_items+0x8e/0x140 [btrfs] btrfs_commit_transaction+0x367/0xbc0 [btrfs] btrfs_mksubvol+0x2db/0x470 [btrfs] btrfs_mksnapshot+0x7b/0xb0 [btrfs] __btrfs_ioctl_snap_create+0x16f/0x1a0 [btrfs] btrfs_ioctl_snap_create_v2+0xb0/0xf0 [btrfs] btrfs_ioctl+0xd0b/0x2690 [btrfs] __x64_sys_ioctl+0x6f/0xa0 do_syscall_64+0x2d/0x70 entry_SYSCALL_64_after_hwframe+0x44/0xa9
-> #0 (&delayed_node->mutex){+.+.}-{3:3}:
check_prev_add+0x91/0xc60 validate_chain+0xa6e/0x2a20 __lock_acquire+0x582/0xac0 lock_acquire+0xca/0x430 __mutex_lock+0xa0/0xaf0 __btrfs_release_delayed_node.part.0+0x3f/0x320 [btrfs] btrfs_evict_inode+0x3cc/0x560 [btrfs] evict+0xd6/0x1c0 dispose_list+0x48/0x70 prune_icache_sb+0x54/0x80 super_cache_scan+0x121/0x1a0 do_shrink_slab+0x16d/0x3b0 shrink_slab+0xb1/0x2e0 shrink_node+0x230/0x6a0 balance_pgdat+0x325/0x750 kswapd+0x206/0x4d0 kthread+0x137/0x150 ret_from_fork+0x1f/0x30
other info that might help us debug this:
Chain exists of:
&delayed_node->mutex --> kernfs_mutex --> fs_reclaim
Possible unsafe locking scenario: CPU0 CPU1
---- ----
lock(fs_reclaim);
lock(kernfs_mutex);
lock(fs_reclaim);
lock(&delayed_node->mutex);*** DEADLOCK ***
3 locks held by kswapd0/76:
#0: ffffffffa40cbba0 (fs_reclaim){+.+.}-{0:0}, at: __fs_reclaim_acquire+0x5/0x30 #1: ffffffffa40b8b58 (shrinker_rwsem){++++}-{3:3}, at: shrink_slab+0x54/0x2e0 #2: ffff9d5d322390e8 (&type->s_umount_key#26){++++}-{3:3}, at: trylock_super+0x16/0x50
stack backtrace: CPU: 2 PID: 76 Comm: kswapd0 Not tainted 5.9.0-default+ #1297 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.0-59-gc9ba527-rebuilt.opensuse.org 04/01/2014 Call Trace: dump_stack+0x77/0x97 check_noncircular+0xff/0x110 ? save_trace+0x50/0x470 check_prev_add+0x91/0xc60 validate_chain+0xa6e/0x2a20 ? save_trace+0x50/0x470 __lock_acquire+0x582/0xac0 lock_acquire+0xca/0x430 ? __btrfs_release_delayed_node.part.0+0x3f/0x320 [btrfs] __mutex_lock+0xa0/0xaf0 ? __btrfs_release_delayed_node.part.0+0x3f/0x320 [btrfs] ? __lock_acquire+0x582/0xac0 ? __btrfs_release_delayed_node.part.0+0x3f/0x320 [btrfs] ? btrfs_evict_inode+0x30b/0x560 [btrfs] ? __btrfs_release_delayed_node.part.0+0x3f/0x320 [btrfs] __btrfs_release_delayed_node.part.0+0x3f/0x320 [btrfs] btrfs_evict_inode+0x3cc/0x560 [btrfs] evict+0xd6/0x1c0 dispose_list+0x48/0x70 prune_icache_sb+0x54/0x80 super_cache_scan+0x121/0x1a0 do_shrink_slab+0x16d/0x3b0 shrink_slab+0xb1/0x2e0 shrink_node+0x230/0x6a0 balance_pgdat+0x325/0x750 kswapd+0x206/0x4d0 ? finish_wait+0x90/0x90 ? balance_pgdat+0x750/0x750 kthread+0x137/0x150 ? kthread_mod_delayed_work+0xc0/0xc0 ret_from_fork+0x1f/0x30
This happens because we are still holding the path open when we start adding the sysfs files for the block groups, which creates a dependency on fs_reclaim via the tree lock. Fix this by dropping the path before we start doing anything with sysfs.
--- fs/btrfs/block-group.c | 1 + 1 file changed, 1 insertion(+)
fs/btrfs/block-group.c +1 -0
@@ -2034,6 +2034,7 @@ int btrfs_read_block_groups(struct btrfs key.offset =0 ;btrfs_release_path (path); } +btrfs_release_path (path);rcu_read_lock ();list_for_each_entry_rcu (space_info, &info->space_info, list) {
Greg Kroah-Hartman
maintainerPATCH 238/391 usb: xhci: Workaround for S3 issue on AMD SNPS 3.0 xHC
In reply to Greg Kroah-HartmanFrom: Sandeep Singh <[email protected]>
commit 2a632815683d2d34df52b701a36fe5ac6654e719 upstream.
On some platform of AMD, S3 fails with HCE and SRE errors. To fix this, need to disable a bit which is enable in sparse controller.
--- drivers/usb/host/xhci-pci.c | 17 +++++++++++++++++ drivers/usb/host/xhci.h | 1 + 2 files changed, 18 insertions(+)
drivers/usb/host/xhci-pci.c +17 -0
@@ -22,6 +22,8 @@#define SSIC_PORT_CFG2_OFFSET 0x30#define PROG_DONE (1 << 30)#define SSIC_PORT_UNUSED (1 << 31) +#define SPARSE_DISABLE_BIT 17 +#define SPARSE_CNTL_ENABLE 0xC12C/* Device for a quirk */ #define PCI_VENDOR_ID_FRESCO_LOGIC 0x1b73
@@ -160,6 +162,9 @@ static void xhci_pci_quirks(struct devic (pdev->device == 0x15e0 || pdev->device == 0x15e1)) xhci->quirks |= XHCI_SNPS_BROKEN_SUSPEND; +if (pdev->vendor ==PCI_VENDOR_ID_AMD && pdev->device ==0x15e5 ) + xhci->quirks |=XHCI_DISABLE_SPARSE ; +if (pdev->vendor ==PCI_VENDOR_ID_AMD ) xhci->quirks |=XHCI_TRUST_TX_LENGTH ;
@@ -490,6 +495,15 @@ static void xhci_pme_quirk(struct usb_hcreadl (reg); } +static void xhci_sparse_control_quirk (struct usb_hcd *hcd) +{ +u32 reg; + + reg =readl (hcd->regs +SPARSE_CNTL_ENABLE ); + reg &= ~BIT (SPARSE_DISABLE_BIT ); +writel (reg, hcd->regs +SPARSE_CNTL_ENABLE ); +} +static int xhci_pci_suspend (struct usb_hcd *hcd,bool do_wakeup) {struct xhci_hcd *xhci =hcd_to_xhci (hcd);
@@ -509,6 +523,9 @@ static int xhci_pci_suspend(struct usb_hif (xhci->quirks &XHCI_SSIC_PORT_UNUSED )xhci_ssic_port_unused_quirk (hcd, true); +if (xhci->quirks &XHCI_DISABLE_SPARSE ) +xhci_sparse_control_quirk (hcd); + ret =xhci_suspend (xhci, do_wakeup);if (ret && (xhci->quirks &XHCI_SSIC_PORT_UNUSED ))xhci_ssic_port_unused_quirk (hcd, false);
drivers/usb/host/xhci.h +1 -0
@@ -1874,6 +1874,7 @@ struct xhci_hcd {#define XHCI_RESET_PLL_ON_DISCONNECT BIT_ULL(34)#define XHCI_SNPS_BROKEN_SUSPEND BIT_ULL(35)#define XHCI_RENESAS_FW_QUIRK BIT_ULL(36) +#define XHCI_DISABLE_SPARSE BIT_ULL(38)unsigned int num_active_eps;unsigned int limit_active_eps;
Greg Kroah-Hartman
maintainerPATCH 236/391 btrfs: fix readahead hang and use-after-free after removing a device
In reply to Greg Kroah-HartmanFrom: Filipe Manana <[email protected]>
commit 66d204a16c94f24ad08290a7663ab67e7fc04e82 upstream.
Very sporadically I had test case btrfs/069 from fstests hanging (for years, it is not a recent regression), with the following traces in dmesg/syslog:
[162301.160628] BTRFS info (device sdc): dev_replace from /dev/sdd (devid 2) to /dev/sdg started
[162301.181196] BTRFS info (device sdc): scrub: finished on devid 4 with status: 0
[162301.287162] BTRFS info (device sdc): dev_replace from /dev/sdd (devid 2) to /dev/sdg finished
[162513.513792] INFO: task btrfs-transacti:1356167 blocked for more than 120 seconds.
[162513.514318] Not tainted 5.9.0-rc6-btrfs-next-69 #1
[162513.514522] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[162513.514747] task:btrfs-transacti state:D stack: 0 pid:1356167 ppid: 2 flags:0x00004000
[162513.514751] Call Trace:
[162513.514761] __schedule+0x5ce/0xd00
[162513.514765] ? _raw_spin_unlock_irqrestore+0x3c/0x60
[162513.514771] schedule+0x46/0xf0
[162513.514844] wait_current_trans+0xde/0x140 [btrfs]
[162513.514850] ? finish_wait+0x90/0x90
[162513.514864] start_transaction+0x37c/0x5f0 [btrfs]
[162513.514879] transaction_kthread+0xa4/0x170 [btrfs]
[162513.514891] ? btrfs_cleanup_transaction+0x660/0x660 [btrfs]
[162513.514894] kthread+0x153/0x170
[162513.514897] ? kthread_stop+0x2c0/0x2c0
[162513.514902] ret_from_fork+0x22/0x30
[162513.514916] INFO: task fsstress:1356184 blocked for more than 120 seconds.
[162513.515192] Not tainted 5.9.0-rc6-btrfs-next-69 #1
[162513.515431] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[162513.515680] task:fsstress state:D stack: 0 pid:1356184 ppid:1356177 flags:0x00004000
[162513.515682] Call Trace:
[162513.515688] __schedule+0x5ce/0xd00
[162513.515691] ? _raw_spin_unlock_irqrestore+0x3c/0x60
[162513.515697] schedule+0x46/0xf0
[162513.515712] wait_current_trans+0xde/0x140 [btrfs]
[162513.515716] ? finish_wait+0x90/0x90
[162513.515729] start_transaction+0x37c/0x5f0 [btrfs]
[162513.515743] btrfs_attach_transaction_barrier+0x1f/0x50 [btrfs]
[162513.515753] btrfs_sync_fs+0x61/0x1c0 [btrfs]
[162513.515758] ? __ia32_sys_fdatasync+0x20/0x20
[162513.515761] iterate_supers+0x87/0xf0
[162513.515765] ksys_sync+0x60/0xb0
[162513.515768] __do_sys_sync+0xa/0x10
[162513.515771] do_syscall_64+0x33/0x80
[162513.515774] entry_SYSCALL_64_after_hwframe+0x44/0xa9
[162513.515781] RIP: 0033:0x7f5238f50bd7
[162513.515782] Code: Bad RIP value.
[162513.515784] RSP: 002b:00007fff67b978e8 EFLAGS: 00000206 ORIG_RAX: 00000000000000a2
[162513.515786] RAX: ffffffffffffffda RBX: 000055b1fad2c560 RCX: 00007f5238f50bd7
[162513.515788] RDX: 00000000ffffffff RSI: 000000000daf0e74 RDI: 000000000000003a
[162513.515789] RBP: 0000000000000032 R08: 000000000000000a R09: 00007f5239019be0
[162513.515791] R10: fffffffffffff24f R11: 0000000000000206 R12: 000000000000003a
[162513.515792] R13: 00007fff67b97950 R14: 00007fff67b97906 R15: 000055b1fad1a340
[162513.515804] INFO: task fsstress:1356185 blocked for more than 120 seconds.
[162513.516064] Not tainted 5.9.0-rc6-btrfs-next-69 #1
[162513.516329] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[162513.516617] task:fsstress state:D stack: 0 pid:1356185 ppid:1356177 flags:0x00000000
[162513.516620] Call Trace:
[162513.516625] __schedule+0x5ce/0xd00
[162513.516628] ? _raw_spin_unlock_irqrestore+0x3c/0x60
[162513.516634] schedule+0x46/0xf0
[162513.516647] wait_current_trans+0xde/0x140 [btrfs]
[162513.516650] ? finish_wait+0x90/0x90
[162513.516662] start_transaction+0x4d7/0x5f0 [btrfs]
[162513.516679] btrfs_setxattr_trans+0x3c/0x100 [btrfs]
[162513.516686] __vfs_setxattr+0x66/0x80
[162513.516691] __vfs_setxattr_noperm+0x70/0x200
[162513.516697] vfs_setxattr+0x6b/0x120
[162513.516703] setxattr+0x125/0x240
[162513.516709] ? lock_acquire+0xb1/0x480
[162513.516712] ? mnt_want_write+0x20/0x50
[162513.516721] ? rcu_read_lock_any_held+0x8e/0xb0
[162513.516723] ? preempt_count_add+0x49/0xa0
[162513.516725] ? __sb_start_write+0x19b/0x290
[162513.516727] ? preempt_count_add+0x49/0xa0
[162513.516732] path_setxattr+0xba/0xd0
[162513.516739] __x64_sys_setxattr+0x27/0x30
[162513.516741] do_syscall_64+0x33/0x80
[162513.516743] entry_SYSCALL_64_after_hwframe+0x44/0xa9
[162513.516745] RIP: 0033:0x7f5238f56d5a
[162513.516746] Code: Bad RIP value.
[162513.516748] RSP: 002b:00007fff67b97868 EFLAGS: 00000202 ORIG_RAX: 00000000000000bc
[162513.516750] RAX: ffffffffffffffda RBX: 0000000000000001 RCX: 00007f5238f56d5a
[162513.516751] RDX: 000055b1fbb0d5a0 RSI: 00007fff67b978a0 RDI: 000055b1fbb0d470
[162513.516753] RBP: 000055b1fbb0d5a0 R08: 0000000000000001 R09: 00007fff67b97700
[162513.516754] R10: 0000000000000004 R11: 0000000000000202 R12: 0000000000000004
[162513.516756] R13: 0000000000000024 R14: 0000000000000001 R15: 00007fff67b978a0
[162513.516767] INFO: task fsstress:1356196 blocked for more than 120 seconds.
[162513.517064] Not tainted 5.9.0-rc6-btrfs-next-69 #1
[162513.517365] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[162513.517763] task:fsstress state:D stack: 0 pid:1356196 ppid:1356177 flags:0x00004000
[162513.517780] Call Trace:
[162513.517786] __schedule+0x5ce/0xd00
[162513.517789] ? _raw_spin_unlock_irqrestore+0x3c/0x60
[162513.517796] schedule+0x46/0xf0
[162513.517810] wait_current_trans+0xde/0x140 [btrfs]
[162513.517814] ? finish_wait+0x90/0x90
[162513.517829] start_transaction+0x37c/0x5f0 [btrfs]
[162513.517845] btrfs_attach_transaction_barrier+0x1f/0x50 [btrfs]
[162513.517857] btrfs_sync_fs+0x61/0x1c0 [btrfs]
[162513.517862] ? __ia32_sys_fdatasync+0x20/0x20
[162513.517865] iterate_supers+0x87/0xf0
[162513.517869] ksys_sync+0x60/0xb0
[162513.517872] __do_sys_sync+0xa/0x10
[162513.517875] do_syscall_64+0x33/0x80
[162513.517878] entry_SYSCALL_64_after_hwframe+0x44/0xa9
[162513.517881] RIP: 0033:0x7f5238f50bd7
[162513.517883] Code: Bad RIP value.
[162513.517885] RSP: 002b:00007fff67b978e8 EFLAGS: 00000206 ORIG_RAX: 00000000000000a2
[162513.517887] RAX: ffffffffffffffda RBX: 000055b1fad2c560 RCX: 00007f5238f50bd7
[162513.517889] RDX: 0000000000000000 RSI: 000000007660add2 RDI: 0000000000000053
[162513.517891] RBP: 0000000000000032 R08: 0000000000000067 R09: 00007f5239019be0
[162513.517893] R10: fffffffffffff24f R11: 0000000000000206 R12: 0000000000000053
[162513.517895] R13: 00007fff67b97950 R14: 00007fff67b97906 R15: 000055b1fad1a340
[162513.517908] INFO: task fsstress:1356197 blocked for more than 120 seconds.
[162513.518298] Not tainted 5.9.0-rc6-btrfs-next-69 #1
[162513.518672] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[162513.519157] task:fsstress state:D stack: 0 pid:1356197 ppid:1356177 flags:0x00000000
[162513.519160] Call Trace:
[162513.519165] __schedule+0x5ce/0xd00
[162513.519168] ? _raw_spin_unlock_irqrestore+0x3c/0x60
[162513.519174] schedule+0x46/0xf0
[162513.519190] wait_current_trans+0xde/0x140 [btrfs]
[162513.519193] ? finish_wait+0x90/0x90
[162513.519206] start_transaction+0x4d7/0x5f0 [btrfs]
[162513.519222] btrfs_create+0x57/0x200 [btrfs]
[162513.519230] lookup_open+0x522/0x650
[162513.519246] path_openat+0x2b8/0xa50
[162513.519270] do_filp_open+0x91/0x100
[162513.519275] ? find_held_lock+0x32/0x90
[162513.519280] ? lock_acquired+0x33b/0x470
[162513.519285] ? do_raw_spin_unlock+0x4b/0xc0
[162513.519287] ? _raw_spin_unlock+0x29/0x40
[162513.519295] do_sys_openat2+0x20d/0x2d0
[162513.519300] do_sys_open+0x44/0x80
[162513.519304] do_syscall_64+0x33/0x80
[162513.519307] entry_SYSCALL_64_after_hwframe+0x44/0xa9
[162513.519309] RIP: 0033:0x7f5238f4a903
[162513.519310] Code: Bad RIP value.
[162513.519312] RSP: 002b:00007fff67b97758 EFLAGS: 00000246 ORIG_RAX: 0000000000000055
[162513.519314] RAX: ffffffffffffffda RBX: 00000000ffffffff RCX: 00007f5238f4a903
[162513.519316] RDX: 0000000000000000 RSI: 00000000000001b6 RDI: 000055b1fbb0d470
[162513.519317] RBP: 00007fff67b978c0 R08: 0000000000000001 R09: 0000000000000002
[162513.519319] R10: 00007fff67b974f7 R11: 0000000000000246 R12: 0000000000000013
[162513.519320] R13: 00000000000001b6 R14: 00007fff67b97906 R15: 000055b1fad1c620
[162513.519332] INFO: task btrfs:1356211 blocked for more than 120 seconds.
[162513.519727] Not tainted 5.9.0-rc6-btrfs-next-69 #1
[162513.520115] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[162513.520508] task:btrfs state:D stack: 0 pid:1356211 ppid:1356178 flags:0x00004002
[162513.520511] Call Trace:
[162513.520516] __schedule+0x5ce/0xd00
[162513.520519] ? _raw_spin_unlock_irqrestore+0x3c/0x60
[162513.520525] schedule+0x46/0xf0
[162513.520544] btrfs_scrub_pause+0x11f/0x180 [btrfs]
[162513.520548] ? finish_wait+0x90/0x90
[162513.520562] btrfs_commit_transaction+0x45a/0xc30 [btrfs]
[162513.520574] ? start_transaction+0xe0/0x5f0 [btrfs]
[162513.520596] btrfs_dev_replace_finishing+0x6d8/0x711 [btrfs]
[162513.520619] btrfs_dev_replace_by_ioctl.cold+0x1cc/0x1fd [btrfs]
[162513.520639] btrfs_ioctl+0x2a25/0x36f0 [btrfs]
[162513.520643] ? do_sigaction+0xf3/0x240
[162513.520645] ? find_held_lock+0x32/0x90
[162513.520648] ? do_sigaction+0xf3/0x240
[162513.520651] ? lock_acquired+0x33b/0x470
[162513.520655] ? _raw_spin_unlock_irq+0x24/0x50
[162513.520657] ? lockdep_hardirqs_on+0x7d/0x100
[162513.520660] ? _raw_spin_unlock_irq+0x35/0x50
[162513.520662] ? do_sigaction+0xf3/0x240
[162513.520671] ? __x64_sys_ioctl+0x83/0xb0
[162513.520672] __x64_sys_ioctl+0x83/0xb0
[162513.520677] do_syscall_64+0x33/0x80
[162513.520679] entry_SYSCALL_64_after_hwframe+0x44/0xa9
[162513.520681] RIP: 0033:0x7fc3cd307d87
[162513.520682] Code: Bad RIP value.
[162513.520684] RSP: 002b:00007ffe30a56bb8 EFLAGS: 00000202 ORIG_RAX: 0000000000000010
[162513.520686] RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 00007fc3cd307d87
[162513.520687] RDX: 00007ffe30a57a30 RSI: 00000000ca289435 RDI: 0000000000000003
[162513.520689] RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
[162513.520690] R10: 0000000000000008 R11: 0000000000000202 R12: 0000000000000003
[162513.520692] R13: 0000557323a212e0 R14: 00007ffe30a5a520 R15: 0000000000000001
[162513.520703]
Showing all locks held in the system:
[162513.520712] 1 lock held by khungtaskd/54:
[162513.520713] #0: ffffffffb40a91a0 (rcu_read_lock){....}-{1:2}, at: debug_show_all_locks+0x15/0x197
[162513.520728] 1 lock held by in:imklog/596:
[162513.520729] #0: ffff8f3f0d781400 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0x4d/0x60
[162513.520782] 1 lock held by btrfs-transacti/1356167:
[162513.520784] #0: ffff8f3d810cc848 (&fs_info->transaction_kthread_mutex){+.+.}-{3:3}, at: transaction_kthread+0x4a/0x170 [btrfs]
[162513.520798] 1 lock held by btrfs/1356190:
[162513.520800] #0: ffff8f3d57644470 (sb_writers#15){.+.+}-{0:0}, at: mnt_want_write_file+0x22/0x60
[162513.520805] 1 lock held by fsstress/1356184:
[162513.520806] #0: ffff8f3d576440e8 (&type->s_umount_key#62){++++}-{3:3}, at: iterate_supers+0x6f/0xf0
[162513.520811] 3 locks held by fsstress/1356185:
[162513.520812] #0: ffff8f3d57644470 (sb_writers#15){.+.+}-{0:0}, at: mnt_want_write+0x20/0x50
[162513.520815] #1: ffff8f3d80a650b8 (&type->i_mutex_dir_key#10){++++}-{3:3}, at: vfs_setxattr+0x50/0x120
[162513.520820] #2: ffff8f3d57644690 (sb_internal#2){.+.+}-{0:0}, at: start_transaction+0x40e/0x5f0 [btrfs]
[162513.520833] 1 lock held by fsstress/1356196:
[162513.520834] #0: ffff8f3d576440e8 (&type->s_umount_key#62){++++}-{3:3}, at: iterate_supers+0x6f/0xf0
[162513.520838] 3 locks held by fsstress/1356197:
[162513.520839] #0: ffff8f3d57644470 (sb_writers#15){.+.+}-{0:0}, at: mnt_want_write+0x20/0x50
[162513.520843] #1: ffff8f3d506465e8 (&type->i_mutex_dir_key#10){++++}-{3:3}, at: path_openat+0x2a7/0xa50
[162513.520846] #2: ffff8f3d57644690 (sb_internal#2){.+.+}-{0:0}, at: start_transaction+0x40e/0x5f0 [btrfs]
[162513.520858] 2 locks held by btrfs/1356211:
[162513.520859] #0: ffff8f3d810cde30 (&fs_info->dev_replace.lock_finishing_cancel_unmount){+.+.}-{3:3}, at: btrfs_dev_replace_finishing+0x52/0x711 [btrfs]
[162513.520877] #1: ffff8f3d57644690 (sb_internal#2){.+.+}-{0:0}, at: start_transaction+0x40e/0x5f0 [btrfs]This was weird because the stack traces show that a transaction commit, triggered by a device replace operation, is blocking trying to pause any running scrubs but there are no stack traces of blocked tasks doing a scrub.
After poking around with drgn, I noticed there was a scrub task that was constantly running and blocking for shorts periods of time:
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
t =
find_task(prog, 1356190)prog.stack_trace(t)
#0 __schedule+0x5ce/0xcfc #1 schedule+0x46/0xe4 #2 schedule_timeout+0x1df/0x475 #3 btrfs_reada_wait+0xda/0x132 #4 scrub_stripe+0x2a8/0x112f #5 scrub_chunk+0xcd/0x134 #6 scrub_enumerate_chunks+0x29e/0x5ee #7 btrfs_scrub_dev+0x2d5/0x91b #8 btrfs_ioctl+0x7f5/0x36e7 #9 __x64_sys_ioctl+0x83/0xb0
#10 do_syscall_64+0x33/0x77
#11 entry_SYSCALL_64+0x7c/0x156
Which corresponds to:
int btrfs_reada_wait(void *handle)
{
struct reada_control *rc = handle;
struct btrfs_fs_info *fs_info = rc->fs_info;
while (atomic_read(&rc->elems)) {
if (!atomic_read(&fs_info->reada_works_cnt))
reada_start_machine(fs_info);
wait_event_timeout(rc->wait, atomic_read(&rc->elems) == 0,
(HZ + 9) / 10);
}(...)
So the counter "rc->elems" was set to 1 and never decreased to 0, causing the scrub task to loop forever in that function. Then I used the following script for drgn to check the readahead requests:
$ cat dump_reada.py
import sys
import drgn
from drgn import NULL, Object, cast, container_of, execscript, \
reinterpret, sizeof
from drgn.helpers.linux import * mnt_path = b"/home/fdmanana/btrfs-tests/scratch_1"
mnt = None
for mnt in for_each_mount(prog, dst = mnt_path):
pass
if mnt is None:
sys.stderr.write(f'Error: mount point {mnt_path} not found\n') sys.exit(1)
fs_info = cast('struct btrfs_fs_info *', mnt.mnt.mnt_sb.s_fs_info)
def dump_re(re):
nzones = re.nzones.value_()
print(f're at {hex(re.value_())}')
print(f'\t logical {re.logical.value_()}') print(f'\t refcnt {re.refcnt.value_()}') print(f'\t nzones {nzones}')
for i in range(nzones):
dev = re.zones[i].device
name = dev.name.str.string_()
print(f'\t\t dev id {dev.devid.value_()} name {name}')
print()
for _, e in radix_tree_for_each(fs_info.reada_tree):
re = cast('struct reada_extent *', e) dump_re(re)
$ drgn dump_reada.py
re at 0xffff8f3da9d25ad8
logical 38928384
refcnt 1
nzones 1
dev id 0 name b'/dev/sdd'
$So there was one readahead extent with a single zone corresponding to the source device of that last device replace operation logged in dmesg/syslog. Also the ID of that zone's device was 0 which is a special value set in the source device of a device replace operation when the operation finishes (constant BTRFS_DEV_REPLACE_DEVID set at btrfs_dev_replace_finishing()), confirming again that device /dev/sdd was the source of a device replace operation.
Normally there should be as many zones in the readahead extent as there are devices, and I wasn't expecting the extent to be in a block group with a 'single' profile, so I went and confirmed with the following drgn script that there weren't any single profile block groups:
$ cat dump_block_groups.py
import sys
import drgn
from drgn import NULL, Object, cast, container_of, execscript, \
reinterpret, sizeof
from drgn.helpers.linux import * mnt_path = b"/home/fdmanana/btrfs-tests/scratch_1"
mnt = None
for mnt in for_each_mount(prog, dst = mnt_path):
pass
if mnt is None:
sys.stderr.write(f'Error: mount point {mnt_path} not found\n') sys.exit(1)
fs_info = cast('struct btrfs_fs_info *', mnt.mnt.mnt_sb.s_fs_info)
BTRFS_BLOCK_GROUP_DATA = (1 << 0)
BTRFS_BLOCK_GROUP_SYSTEM = (1 << 1)
BTRFS_BLOCK_GROUP_METADATA = (1 << 2)
BTRFS_BLOCK_GROUP_RAID0 = (1 << 3)
BTRFS_BLOCK_GROUP_RAID1 = (1 << 4)
BTRFS_BLOCK_GROUP_DUP = (1 << 5)
BTRFS_BLOCK_GROUP_RAID10 = (1 << 6)
BTRFS_BLOCK_GROUP_RAID5 = (1 << 7)
BTRFS_BLOCK_GROUP_RAID6 = (1 << 8)
BTRFS_BLOCK_GROUP_RAID1C3 = (1 << 9)
BTRFS_BLOCK_GROUP_RAID1C4 = (1 << 10)
def bg_flags_string(bg):
flags = bg.flags.value_()
ret = ''
if flags & BTRFS_BLOCK_GROUP_DATA:
ret = 'data'
if flags & BTRFS_BLOCK_GROUP_METADATA:
if len(ret) > 0:
ret += '|'
ret += 'meta'
if flags & BTRFS_BLOCK_GROUP_SYSTEM:
if len(ret) > 0:
ret += '|'
ret += 'system'
if flags & BTRFS_BLOCK_GROUP_RAID0:
ret += ' raid0'
elif flags & BTRFS_BLOCK_GROUP_RAID1:
ret += ' raid1'
elif flags & BTRFS_BLOCK_GROUP_DUP:
ret += ' dup'
elif flags & BTRFS_BLOCK_GROUP_RAID10:
ret += ' raid10'
elif flags & BTRFS_BLOCK_GROUP_RAID5:
ret += ' raid5'
elif flags & BTRFS_BLOCK_GROUP_RAID6:
ret += ' raid6'
elif flags & BTRFS_BLOCK_GROUP_RAID1C3:
ret += ' raid1c3'
elif flags & BTRFS_BLOCK_GROUP_RAID1C4:
ret += ' raid1c4'
else:
ret += ' single'
return ret def dump_bg(bg):
print()
print(f'block group at {hex(bg.value_())}')
print(f'\t start {bg.start.value_()} length {bg.length.value_()}')
print(f'\t flags {bg.flags.value_()} - {bg_flags_string(bg)}') bg_root = fs_info.block_group_cache_tree.address_of_()
for bg in rbtree_inorder_for_each_entry('struct btrfs_block_group', bg_root, 'cache_node'):
dump_bg(bg)
$ drgn dump_block_groups.py
block group at 0xffff8f3d673b0400
start 22020096 length 16777216
flags 258 - system raid6
block group at 0xffff8f3d53ddb400
start 38797312 length 536870912
flags 260 - meta raid6
block group at 0xffff8f3d5f4d9c00
start 575668224 length 2147483648
flags 257 - data raid6
block group at 0xffff8f3d08189000
start 2723151872 length 67108864
flags 258 - system raid6
block group at 0xffff8f3db70ff000
start 2790260736 length 1073741824
flags 260 - meta raid6
block group at 0xffff8f3d5f4dd800
start 3864002560 length 67108864
flags 258 - system raid6
block group at 0xffff8f3d67037000
start 3931111424 length 2147483648
flags 257 - data raid6
$
So there were only 2 reasons left for having a readahead extent with a single zone: reada_find_zone(), called when creating a readahead extent, returned NULL either because we failed to find the corresponding block group or because a memory allocation failed. With some additional and custom tracing I figured out that on every further ocurrence of the problem the block group had just been deleted when we were looping to create the zones for the readahead extent (at reada_find_extent()), so we ended up with only one zone in the readahead extent, corresponding to a device that ends up getting replaced.
So after figuring that out it became obvious why the hang happens:
1) Task A starts a scrub on any device of the filesystem, except for device /dev/sdd;
2) Task B starts a device replace with /dev/sdd as the source device;
3) Task A calls btrfs_reada_add() from scrub_stripe() and it is currently starting to scrub a stripe from block group X. This call to btrfs_reada_add() is the one for the extent tree. When btrfs_reada_add() calls reada_add_block(), it passes the logical address of the extent tree's root node as its 'logical' argument - a value of 38928384;
4) Task A then enters reada_find_extent(), called from reada_add_block(). It finds there isn't any existing readahead extent for the logical address 38928384, so it proceeds to the path of creating a new one.
It calls btrfs_map_block() to find out which stripes exist for the block group X. On the first iteration of the for loop that iterates over the stripes, it finds the stripe for device /dev/sdd, so it creates one zone for that device and adds it to the readahead extent. Before getting into the second iteration of the loop, the cleanup kthread deletes block group X because it was empty. So in the iterations for the remaining stripes it does not add more zones to the readahead extent, because the calls to reada_find_zone() returned NULL because they couldn't find block group X anymore.
As a result the new readahead extent has a single zone, corresponding to the device /dev/sdd;
4) Before task A returns to btrfs_reada_add() and queues the readahead job for the readahead work queue, task B finishes the device replace and at btrfs_dev_replace_finishing() swaps the device /dev/sdd with the new device /dev/sdg;
5) Task A returns to reada_add_block(), which increments the counter "->elems" of the reada_control structure allocated at btrfs_reada_add().
Then it returns back to btrfs_reada_add() and calls reada_start_machine(). This queues a job in the readahead work queue to run the function reada_start_machine_worker(), which calls __reada_start_machine().
At __reada_start_machine() we take the device list mutex and for each device found in the current device list, we call reada_start_machine_dev() to start the readahead work. However at this point the device /dev/sdd was already freed and is not in the device list anymore.
This means the corresponding readahead for the extent at 38928384 is never started, and therefore the "->elems" counter of the reada_control structure allocated at btrfs_reada_add() never goes down to 0, causing the call to btrfs_reada_wait(), done by the scrub task, to wait forever.
Note that the readahead request can be made either after the device replace started or before it started, however in pratice it is very unlikely that a device replace is able to start after a readahead request is made and is able to complete before the readahead request completes - maybe only on a very small and nearly empty filesystem.
This hang however is not the only problem we can have with readahead and device removals. When the readahead extent has other zones other than the one corresponding to the device that is being removed (either by a device replace or a device remove operation), we risk having a use-after-free on the device when dropping the last reference of the readahead extent.
For example if we create a readahead extent with two zones, one for the device /dev/sdd and one for the device /dev/sde:
1) Before the readahead worker starts, the device /dev/sdd is removed, and the corresponding btrfs_device structure is freed. However the readahead extent still has the zone pointing to the device structure;
2) When the readahead worker starts, it only finds device /dev/sde in the current device list of the filesystem;
3) It starts the readahead work, at reada_start_machine_dev(), using the device /dev/sde;
4) Then when it finishes reading the extent from device /dev/sde, it calls __readahead_hook() which ends up dropping the last reference on the readahead extent through the last call to reada_extent_put();
5) At reada_extent_put() it iterates over each zone of the readahead extent and attempts to delete an element from the device's 'reada_extents' radix tree, resulting in a use-after-free, as the device pointer of the zone for /dev/sdd is now stale. We can also access the device after dropping the last reference of a zone, through reada_zone_release(), also called by reada_extent_put().
And a device remove suffers the same problem, however since it shrinks the device size down to zero before removing the device, it is very unlikely to still have readahead requests not completed by the time we free the device, the only possibility is if the device has a very little space allocated.
While the hang problem is exclusive to scrub, since it is currently the only user of btrfs_reada_add() and btrfs_reada_wait(), the use-after-free problem affects any path that triggers readhead, which includes btree_readahead_hook() and __readahead_hook() (a readahead worker can trigger readahed for the children of a node) for example - any path that ends up calling reada_add_block() can trigger the use-after-free after a device is removed.
So fix this by waiting for any readahead requests for a device to complete before removing a device, ensuring that while waiting for existing ones no new ones can be made.
This problem has been around for a very long time - the readahead code was added in 2011, device remove exists since 2008 and device replace was introduced in 2013, hard to pick a specific commit for a git Fixes tag.
--- fs/btrfs/ctree.h | 2 ++ fs/btrfs/dev-replace.c | 5 +++++ fs/btrfs/reada.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ fs/btrfs/volumes.c | 3 +++ fs/btrfs/volumes.h | 1 + 5 files changed, 56 insertions(+)
fs/btrfs/ctree.h +2 -0
@@ -3517,6 +3517,8 @@ struct reada_control *btrfs_reada_add(stint btrfs_reada_wait (void *handle);void btrfs_reada_detach (void *handle);int btree_readahead_hook (struct extent_buffer *eb,int err); +void btrfs_reada_remove_dev (struct btrfs_device *dev); +void btrfs_reada_undo_remove_dev (struct btrfs_device *dev);static inline int is_fstree (u64 rootid) {
fs/btrfs/dev-replace.c +5 -0
@@ -668,6 +668,9 @@ static int btrfs_dev_replace_finishing(s }btrfs_wait_ordered_roots (fs_info,U64_MAX ,0 , (u64)-1 ); +if (!scrub_ret) +btrfs_reada_remove_dev (src_device); +/* * We have to use this loop approach because at this point src_device * has to be available for transaction commit to complete, yet new
@@ -676,6 +679,7 @@ static int btrfs_dev_replace_finishing(swhile (1 ) { trans =btrfs_start_transaction (root,0 );if (IS_ERR (trans)) { +btrfs_reada_undo_remove_dev (src_device);mutex_unlock (&dev_replace->lock_finishing_cancel_unmount);return PTR_ERR (trans); }
@@ -726,6 +730,7 @@ error:up_write (&dev_replace->rwsem);mutex_unlock (&fs_info->chunk_mutex);mutex_unlock (&fs_info->fs_devices->device_list_mutex); +btrfs_reada_undo_remove_dev (src_device);btrfs_rm_dev_replace_blocked (fs_info);if (tgt_device)btrfs_destroy_dev_replace_tgtdev (tgt_device);
fs/btrfs/reada.c +45 -0
54 lines not on this page · raw message
fs/btrfs/volumes.c +3 -0
@@ -2104,6 +2104,8 @@ int btrfs_rm_device(struct btrfs_fs_infomutex_unlock (&uuid_mutex); ret =btrfs_shrink_device (device,0 ); +if (!ret) +btrfs_reada_remove_dev (device);mutex_lock (&uuid_mutex);if (ret) goto error_undo;
@@ -2191,6 +2193,7 @@ out:return ret; error_undo: +btrfs_reada_undo_remove_dev (device);if (test_bit (BTRFS_DEV_STATE_WRITEABLE , &device->dev_state)) {mutex_lock (&fs_info->chunk_mutex); list_add(&device->dev_alloc_list,
fs/btrfs/volumes.h +1 -0
@@ -50,6 +50,7 @@ struct btrfs_io_geometry {#define BTRFS_DEV_STATE_MISSING (2)#define BTRFS_DEV_STATE_REPLACE_TGT (3)#define BTRFS_DEV_STATE_FLUSH_SENT (4) +#define BTRFS_DEV_STATE_NO_READA (5)struct btrfs_device {struct list_head dev_list;/* device_list_mutex */
Greg Kroah-Hartman
maintainerPATCH 230/391 btrfs: tree-checker: fix false alert caused by legacy btrfs root item
In reply to Greg Kroah-HartmanFrom: Qu Wenruo <[email protected]>
commit 1465af12e254a68706e110846f59cf0f09683184 upstream.
Commit 259ee7754b67 ("btrfs: tree-checker: Add ROOT_ITEM check") introduced btrfs root item size check, however btrfs root item has two versions, the legacy one which just ends before generation_v2 member, is smaller than current btrfs root item size.
This caused btrfs kernel to reject valid but old tree root leaves.
Fix this problem by also allowing legacy root item, since kernel can already handle them pretty well and upgrade to newer root item format when needed.
--- fs/btrfs/tree-checker.c | 17 ++++++++++++----- include/uapi/linux/btrfs_tree.h | 14 ++++++++++++++ 2 files changed, 26 insertions(+), 5 deletions(-)
fs/btrfs/tree-checker.c +12 -5
@@ -1035,7 +1035,7 @@ static int check_root_item(struct extent int slot) {struct btrfs_fs_info *fs_info = leaf->fs_info; -struct btrfs_root_item ri; +struct btrfs_root_item ri = {0 };const u64 valid_root_flags =BTRFS_ROOT_SUBVOL_RDONLY |BTRFS_ROOT_SUBVOL_DEAD ;int ret;
@@ -1044,14 +1044,21 @@ static int check_root_item(struct extentif (ret <0 )return ret; -if (btrfs_item_size_nr (leaf, slot) !=sizeof (ri)) { +if (btrfs_item_size_nr (leaf, slot) !=sizeof (ri) && +btrfs_item_size_nr (leaf, slot) !=btrfs_legacy_root_item_size ()) {generic_err (leaf, slot, -"invalid root item size, have %u expect %zu" , -btrfs_item_size_nr (leaf, slot),sizeof (ri)); +"invalid root item size, have %u expect %zu or %u" , +btrfs_item_size_nr (leaf, slot),sizeof (ri), +btrfs_legacy_root_item_size ()); } +/* +* For legacy root item, the members starting at generation_v2 will be +* all filled with 0. +* And since we allow geneartion_v2 as 0, it will still pass the check. +*/ read_extent_buffer (leaf, &ri,btrfs_item_ptr_offset (leaf, slot), -sizeof (ri)); +btrfs_item_size_nr (leaf, slot));/* Generation related */ if (btrfs_root_generation(&ri) >
include/uapi/linux/btrfs_tree.h +14 -0
@@ -4,6 +4,11 @@#include <linux/btrfs.h> #include <linux/types.h> +#ifdef __KERNEL__ +#include <linux/stddef.h> +#else +#include <stddef.h> +#endif /* * This header contains the structure definitions and constants used
@@ -645,6 +650,15 @@ struct btrfs_root_item { } __attribute__ ((__packed__));/* +* Btrfs root item used to be smaller than current size. The old format ends +* at where member generation_v2 is. +*/ +static inline __u32 btrfs_legacy_root_item_size (void ) +{ +return offsetof(struct btrfs_root_item , generation_v2); +} + +/* * this is used for both forward and backward root refs */ struct btrfs_root_ref {
Greg Kroah-Hartman
maintainerPATCH 184/391 md: fix the checking of wrong work queue
In reply to Greg Kroah-HartmanFrom: Guoqing Jiang <[email protected]>
commit cf0b9b4821a2955f8a23813ef8f422208ced9bd7 upstream.
It should check md_rdev_misc_wq instead of md_misc_wq.
--- drivers/md/md.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/md.c +1 -1
@@ -9545,7 +9545,7 @@ static int __init md_init(void) goto err_misc_wq; md_rdev_misc_wq =alloc_workqueue ("md_rdev_misc" ,0 ,0 ); -if (!md_misc_wq) +if (!md_rdev_misc_wq) goto err_rdev_misc_wq;if ((ret =register_blkdev (MD_MAJOR ,"md" )) <0 )
Greg Kroah-Hartman
maintainerPATCH 183/391 irqchip/loongson-htvec: Fix initial interrupt clearing
In reply to Greg Kroah-HartmanFrom: Huacai Chen <[email protected]>
commit 1d1e5630de78f7253ac24b92cee6427c3ff04d56 upstream.
In htvec_reset() only the first group of initial interrupts is cleared. This sometimes causes spurious interrupts, so let's clear all groups.
While at it, fix the nearby comment that to match the reality of what the driver does.
--- drivers/irqchip/irq-loongson-htvec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/irqchip/irq-loongson-htvec.c +2 -2
@@ -151,7 +151,7 @@ static void htvec_reset(struct htvec *pr/* Clear IRQ cause registers, mask all interrupts */ for (idx =0 ; idx < priv->num_parents; idx++) {writel_relaxed (0x0 , priv->base +HTVEC_EN_OFF +4 * idx); -writel_relaxed (0xFFFFFFFF , priv->base); +writel_relaxed (0xFFFFFFFF , priv->base +4 * idx); } }
@@ -172,7 +172,7 @@ static int htvec_of_init(struct device_n goto free_priv; } -/* Interrupt may come from any of the 4 interrupt line */ +/* Interrupt may come from any of the 8 interrupt lines */ for (i =0 ; i <HTVEC_MAX_PARENT_IRQ ; i++) { parent_irq[i] =irq_of_parse_and_map (node, i);if (parent_irq[i] <=0 )
Greg Kroah-Hartman
maintainerPATCH 216/391 scsi: mptfusion: Fix null pointer dereferences in mptscsih_remove()
In reply to Greg Kroah-HartmanFrom: Helge Deller <[email protected]>
commit 2f4843b172c2c0360ee7792ad98025fae7baefde upstream.
The mptscsih_remove() function triggers a kernel oops if the Scsi_Host pointer (ioc->sh) is NULL, as can be seen in this syslog:
ioc0: LSI53C1030 B2: Capabilities={Initiator,Target}
Begin: Waiting for root file system ...
scsi host2: error handler thread failed to spawn, error = -4
mptspi: ioc0: WARNING - Unable to register controller with SCSI subsystem
Backtrace: [<000000001045b7cc>] mptspi_probe+0x248/0x3d0 [mptspi] [<0000000040946470>] pci_device_probe+0x1ac/0x2d8 [<0000000040add668>] really_probe+0x1bc/0x988 [<0000000040ade704>] driver_probe_device+0x160/0x218 [<0000000040adee24>] device_driver_attach+0x160/0x188 [<0000000040adef90>] __driver_attach+0x144/0x320 [<0000000040ad7c78>] bus_for_each_dev+0xd4/0x158 [<0000000040adc138>] driver_attach+0x4c/0x80 [<0000000040adb3ec>] bus_add_driver+0x3e0/0x498 [<0000000040ae0130>] driver_register+0xf4/0x298 [<00000000409450c4>] __pci_register_driver+0x78/0xa8 [<000000000007d248>] mptspi_init+0x18c/0x1c4 [mptspi]
This patch adds the necessary NULL-pointer checks. Successfully tested on a HP C8000 parisc workstation with buggy SCSI drives.
--- drivers/message/fusion/mptscsih.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/message/fusion/mptscsih.c +8 -5
@@ -1176,8 +1176,10 @@ mptscsih_remove(struct pci_dev *pdev)MPT_SCSI_HOST *hd;int sz1; -if ((hd =shost_priv (host)) ==NULL ) -return ; +if (host ==NULL ) + hd =NULL ; +else + hd =shost_priv (host);mptscsih_shutdown (pdev);
@@ -1193,14 +1195,15 @@ mptscsih_remove(struct pci_dev *pdev)"Free'd ScsiLookup (%d) memory\n" , ioc->name, sz1)); -kfree (hd->info_kbuf); +if (hd) +kfree (hd->info_kbuf);/* NULL the Scsi_Host pointer */ ioc->sh =NULL ; -scsi_host_put (host); - +if (host) +scsi_host_put (host);mpt_detach (pdev); }
Greg Kroah-Hartman
maintainerPATCH 212/391 acpi-cpufreq: Honor _PSD table setting on new AMD CPUs
In reply to Greg Kroah-HartmanFrom: Wei Huang <[email protected]>
commit 5368512abe08a28525d9b24abbfc2a72493e8dba upstream.
acpi-cpufreq has a old quirk that overrides the _PSD table supplied by BIOS on AMD CPUs. However the _PSD table of new AMD CPUs (Family 19h+) now accurately reports the P-state dependency of CPU cores. Hence this quirk needs to be fixed in order to support new CPUs' frequency control.
--- drivers/cpufreq/acpi-cpufreq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/cpufreq/acpi-cpufreq.c +2 -1
@@ -691,7 +691,8 @@ static int acpi_cpufreq_cpu_init(structcpumask_copy (policy->cpus,topology_core_cpumask (cpu)); } -if (check_amd_hwpstate_cpu (cpu) && !acpi_pstate_strict) { +if (check_amd_hwpstate_cpu (cpu) && boot_cpu_data.x86 <0x19 && + !acpi_pstate_strict) {cpumask_clear (policy->cpus);cpumask_set_cpu (cpu, policy->cpus); cpumask_copy(data->freqdomain_cpus,
Greg Kroah-Hartman
maintainerPATCH 210/391 ACPI: EC: PM: Flush EC work unconditionally after wakeup
In reply to Greg Kroah-HartmanFrom: Rafael J. Wysocki <[email protected]>
commit 5e92442bb4121562231e6daf8a2d1306cb5f8805 upstream.
Commit 607b9df63057 ("ACPI: EC: PM: Avoid flushing EC work when EC GPE is inactive") has been reported to cause some power button wakeup events to be missed on some systems, so modify acpi_ec_dispatch_gpe() to call acpi_ec_flush_work() unconditionally to effectively reverse the changes made by that commit.
Also note that the problem which prompted commit 607b9df63057 is not reproducible any more on the affected machine.
--- drivers/acpi/ec.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/acpi/ec.c +3 -4
@@ -2019,12 +2019,11 @@ bool acpi_ec_dispatch_gpe(void)* to allow the caller to process events properly after that. */ ret =acpi_dispatch_gpe (NULL , first_ec->gpe); -if (ret ==ACPI_INTERRUPT_HANDLED ) { +if (ret ==ACPI_INTERRUPT_HANDLED )pm_pr_dbg ("ACPI EC GPE dispatched\n" ); -/* Flush the event and query workqueues. */ -acpi_ec_flush_work (); - } +/* Flush the event and query workqueues. */ +acpi_ec_flush_work ();return false; }
Greg Kroah-Hartman
maintainerPATCH 204/391 NFS: fix nfs_path in case of a rename retry
In reply to Greg Kroah-HartmanFrom: Ashish Sangwan <[email protected]>
commit 247db73560bc3e5aef6db50c443c3c0db115bc93 upstream.
We are generating incorrect path in case of rename retry because we are restarting from wrong dentry. We should restart from the dentry which was received in the call to nfs_path.
--- fs/nfs/namespace.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
fs/nfs/namespace.c +8 -4
@@ -32,9 +32,9 @@ int nfs_mountpoint_expiry_timeout = 500/* * nfs_path - reconstruct the path given an arbitrary dentry * @base - used to return pointer to the end of devname part of path -* @dentry - pointer to dentry +* @dentry_in - pointer to dentry * @buffer - result buffer -* @buflen - length of buffer +* @buflen_in - length of buffer * @flags - options (see below) * * Helper function for constructing the server pathname
@@ -49,15 +49,19 @@ int nfs_mountpoint_expiry_timeout = 500* the original device (export) name * (if unset, the original name is returned verbatim) */ -char *nfs_path (char **p,struct dentry *dentry,char *buffer,ssize_t buflen, -unsigned flags) +char *nfs_path (char **p,struct dentry *dentry_in,char *buffer, +ssize_t buflen_in,unsigned flags) {char *end;int namelen;unsigned seq;const char *base; +struct dentry *dentry; +ssize_t buflen; rename_retry: + buflen = buflen_in; + dentry = dentry_in; end = buffer+buflen; *--end ='\0' ; buflen--;
Greg Kroah-Hartman
maintainerPATCH 199/391 leds: bcm6328, bcm6358: use devres LED registering function
In reply to Greg Kroah-HartmanFrom: Marek Behún <[email protected]>
commit ff5c89d44453e7ad99502b04bf798a3fc32c758b upstream.
These two drivers do not provide remove method and use devres for allocation of other resources, yet they use led_classdev_register instead of the devres variant, devm_led_classdev_register.
Fix this.
--- drivers/leds/leds-bcm6328.c | 2 +- drivers/leds/leds-bcm6358.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/leds/leds-bcm6328.c +1 -1
@@ -383,7 +383,7 @@ static int bcm6328_led(struct device *de led->cdev.brightness_set = bcm6328_led_set; led->cdev.blink_set = bcm6328_blink_set; - rc =led_classdev_register (dev, &led->cdev); + rc =devm_led_classdev_register (dev, &led->cdev);if (rc <0 )return rc;
drivers/leds/leds-bcm6358.c +1 -1
@@ -137,7 +137,7 @@ static int bcm6358_led(struct device *de led->cdev.brightness_set = bcm6358_led_set; - rc =led_classdev_register (dev, &led->cdev); + rc =devm_led_classdev_register (dev, &led->cdev);if (rc <0 )return rc;
Greg Kroah-Hartman
maintainerPATCH 180/391 sgl_alloc_order: fix memory leak
In reply to Greg Kroah-HartmanFrom: Douglas Gilbert <[email protected]>
[ Upstream commit b2a182a40278bc5849730e66bca01a762188ed86 ]
sgl_alloc_order() can fail when 'length' is large on a memory constrained system. When order > 0 it will potentially be making several multi-page allocations with the later ones more likely to fail than the earlier one. So it is important that sgl_alloc_order() frees up any pages it has obtained before returning NULL. In the case when order > 0 it calls the wrong free page function and leaks. In testing the leak was sufficient to bring down my 8 GiB laptop with OOM.
--- lib/scatterlist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/scatterlist.c +1 -1
@@ -514,7 +514,7 @@ struct scatterlist *sgl_alloc_order(unsigned long long length, elem_len =min_t (u64, length,PAGE_SIZE << order); page =alloc_pages (gfp, order);if (!page) { -sgl_free (sgl); +sgl_free_order (sgl, order);return NULL ; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 195/391 perf/x86/amd/ibs: Fix raw sample data accumulation
In reply to Greg Kroah-HartmanFrom: Kim Phillips <[email protected]>
commit 36e1be8ada994d509538b3b1d0af8b63c351e729 upstream.
Neither IbsBrTarget nor OPDATA4 are populated in IBS Fetch mode. Don't accumulate them into raw sample user data in that case.
Also, in Fetch mode, add saving the IBS Fetch Control Extended MSR.
Technically, there is an ABI change here with respect to the IBS raw sample data format, but I don't see any perf driver version information being included in perf.data file headers, but, existing users can detect whether the size of the sample record has reduced by 8 bytes to determine whether the IBS driver has this fix.
--- arch/x86/events/amd/ibs.c | 26 ++++++++++++++++---------- arch/x86/include/asm/msr-index.h | 1 + 2 files changed, 17 insertions(+), 10 deletions(-)
arch/x86/events/amd/ibs.c +16 -10
@@ -636,18 +636,24 @@ fail: perf_ibs->offset_max, offset + 1); }while (offset < offset_max); +/* +* Read IbsBrTarget, IbsOpData4, and IbsExtdCtl separately +* depending on their availability. +* Can't add to offset_max as they are staggered +*/ if (event->attr.sample_type &PERF_SAMPLE_RAW ) { -/* -* Read IbsBrTarget and IbsOpData4 separately -* depending on their availability. -* Can't add to offset_max as they are staggered -*/ -if (ibs_caps &IBS_CAPS_BRNTRGT ) { -rdmsrl (MSR_AMD64_IBSBRTARGET , *buf++); - size++; +if (perf_ibs == &perf_ibs_op) { +if (ibs_caps &IBS_CAPS_BRNTRGT ) { +rdmsrl (MSR_AMD64_IBSBRTARGET , *buf++); + size++; + } +if (ibs_caps &IBS_CAPS_OPDATA4 ) { +rdmsrl (MSR_AMD64_IBSOPDATA4 , *buf++); + size++; + } } -if (ibs_caps &IBS_CAPS_OPDATA4 ) { -rdmsrl (MSR_AMD64_IBSOPDATA4 , *buf++); +if (perf_ibs == &perf_ibs_fetch && (ibs_caps &IBS_CAPS_FETCHCTLEXTD )) { +rdmsrl (MSR_AMD64_ICIBSEXTDCTL , *buf++); size++; } }
arch/x86/include/asm/msr-index.h +1 -0
@@ -464,6 +464,7 @@#define MSR_AMD64_IBSOP_REG_MASK ((1UL<<MSR_AMD64_IBSOP_REG_COUNT)-1)#define MSR_AMD64_IBSCTL 0xc001103a#define MSR_AMD64_IBSBRTARGET 0xc001103b +#define MSR_AMD64_ICIBSEXTDCTL 0xc001103c#define MSR_AMD64_IBSOPDATA4 0xc001103d#define MSR_AMD64_IBS_REG_COUNT_MAX 8/* includes MSR_AMD64_IBSBRTARGET */ #define MSR_AMD64_SEV 0xc0010131
Greg Kroah-Hartman
maintainerPATCH 189/391 seccomp: Make duplicate listener detection non-racy
In reply to Greg Kroah-HartmanFrom: Jann Horn <[email protected]>
commit dfe719fef03d752f1682fa8aeddf30ba501c8555 upstream.
Currently, init_listener() tries to prevent adding a filter with SECCOMP_FILTER_FLAG_NEW_LISTENER if one of the existing filters already has a listener. However, this check happens without holding any lock that would prevent another thread from concurrently installing a new filter (potentially with a listener) on top of the ones we already have.
Theoretically, this is also a data race: The plain load from current->seccomp.filter can race with concurrent writes to the same location.
Fix it by moving the check into the region that holds the siglock to guard against concurrent TSYNC.
(The "Fixes" tag points to the commit that introduced the theoretical data race; concurrent installation of another filter with TSYNC only became possible later, in commit 51891498f2da ("seccomp: allow TSYNC and USER_NOTIF together").)
--- kernel/seccomp.c | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-)
kernel/seccomp.c +31 -7
@@ -1472,13 +1472,7 @@ static const struct file_operations seccstatic struct file *init_listener (struct seccomp_filter *filter) { -struct file *ret =ERR_PTR (-EBUSY ); -struct seccomp_filter *cur; - -for (cur = current->seccomp.filter; cur; cur = cur->prev) { -if (cur->notif) - goto out; - } +struct file *ret; ret =ERR_PTR (-ENOMEM ); filter->notif =kzalloc (sizeof (*(filter->notif)),GFP_KERNEL );
@@ -1504,6 +1498,31 @@ out:return ret; } +/* +* Does @new_child have a listener while an ancestor also has a listener? +* If so, we'll want to reject this filter. +* This only has to be tested for the current process, even in the TSYNC case, +* because TSYNC installs @child with the same parent on all threads. +* Note that @new_child is not hooked up to its parent at this point yet, so +* we use current->seccomp.filter. +*/ +static bool has_duplicate_listener (struct seccomp_filter *new_child) +{ +struct seccomp_filter *cur; + +/* must be protected against concurrent TSYNC */ +lockdep_assert_held (¤t->sighand->siglock); + +if (!new_child->notif) +return false; +for (cur = current->seccomp.filter; cur; cur = cur->prev) { +if (cur->notif) +return true; + } + +return false; +} +/** * seccomp_set_mode_filter: internal function for setting seccomp filter * @flags: flags to change filter behavior
@@ -1575,6 +1594,11 @@ static long seccomp_set_mode_filter(unsiif (!seccomp_may_assign_mode (seccomp_mode)) goto out; +if (has_duplicate_listener (prepared)) { + ret = -EBUSY ; + goto out; + } + ret =seccomp_attach_filter (flags, prepared);if (ret) goto out;
Greg Kroah-Hartman
maintainerPATCH 144/391 f2fs: fix to set SBI_NEED_FSCK flag for inconsistent inode
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
[ Upstream commit d662fad143c0470ad7f46ea7b02da539f613d7d7 ]
If compressed inode has inconsistent fields on i_compress_algorithm, i_compr_blocks and i_log_cluster_size, we missed to set SBI_NEED_FSCK to notice fsck to repair the inode, fix it.
--- fs/f2fs/inode.c | 3 +++ 1 file changed, 3 insertions(+)
fs/f2fs/inode.c +3 -0
@@ -299,6 +299,7 @@ static bool sanity_check_inode(struct inode *inode, struct page *node_page) F2FS_FITS_IN_INODE(ri, fi->i_extra_isize, i_log_cluster_size)) {if (ri->i_compress_algorithm >=COMPRESS_MAX ) { +set_sbi_flag (sbi,SBI_NEED_FSCK ); f2fs_warn(sbi, "%s: inode (ino=%lx) has unsupported " "compress algorithm: %u, run fsck to fix", __func__, inode->i_ino,
@@ -307,6 +308,7 @@ static bool sanity_check_inode(struct inode *inode, struct page *node_page) }if (le64_to_cpu (ri->i_compr_blocks) >SECTOR_TO_BLOCK (inode->i_blocks)) { +set_sbi_flag (sbi,SBI_NEED_FSCK ); f2fs_warn(sbi, "%s: inode (ino=%lx) has inconsistent " "i_compr_blocks:%llu, i_blocks:%llu, run fsck to fix", __func__, inode->i_ino,
@@ -316,6 +318,7 @@ static bool sanity_check_inode(struct inode *inode, struct page *node_page) }if (ri->i_log_cluster_size <MIN_COMPRESS_LOG_SIZE || ri->i_log_cluster_size >MAX_COMPRESS_LOG_SIZE ) { +set_sbi_flag (sbi,SBI_NEED_FSCK ); f2fs_warn(sbi, "%s: inode (ino=%lx) has unsupported " "log cluster size: %u, run fsck to fix", __func__, inode->i_ino,
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 147/391 PCI/ACPI: Add Ampere Altra SOC MCFG quirk
In reply to Greg Kroah-HartmanFrom: Tuan Phan <[email protected]>
[ Upstream commit 877c1a5f79c6984bbe3f2924234c08e2f4f1acd5 ]
Ampere Altra SOC supports only 32-bit ECAM reads. Add an MCFG quirk for the platform.
--- drivers/acpi/pci_mcfg.c | 20 ++++++++++++++++++++ drivers/pci/ecam.c | 10 ++++++++++ include/linux/pci-ecam.h | 1 + 3 files changed, 31 insertions(+)
drivers/acpi/pci_mcfg.c +20 -0
@@ -142,6 +142,26 @@ static struct mcfg_fixup mcfg_quirks[] = {XGENE_V2_ECAM_MCFG (4 ,0 ),XGENE_V2_ECAM_MCFG (4 ,1 ),XGENE_V2_ECAM_MCFG (4 ,2 ), + +#define ALTRA_ECAM_QUIRK(rev, seg) \ + { "Ampere", "Altra ", rev, seg, MCFG_BUS_ANY, &pci_32b_read_ops } + +ALTRA_ECAM_QUIRK (1 ,0 ), +ALTRA_ECAM_QUIRK (1 ,1 ), +ALTRA_ECAM_QUIRK (1 ,2 ), +ALTRA_ECAM_QUIRK (1 ,3 ), +ALTRA_ECAM_QUIRK (1 ,4 ), +ALTRA_ECAM_QUIRK (1 ,5 ), +ALTRA_ECAM_QUIRK (1 ,6 ), +ALTRA_ECAM_QUIRK (1 ,7 ), +ALTRA_ECAM_QUIRK (1 ,8 ), +ALTRA_ECAM_QUIRK (1 ,9 ), +ALTRA_ECAM_QUIRK (1 ,10 ), +ALTRA_ECAM_QUIRK (1 ,11 ), +ALTRA_ECAM_QUIRK (1 ,12 ), +ALTRA_ECAM_QUIRK (1 ,13 ), +ALTRA_ECAM_QUIRK (1 ,14 ), + ALTRA_ECAM_QUIRK(1, 15), };static char mcfg_oem_id[ACPI_OEM_ID_SIZE ];
drivers/pci/ecam.c +10 -0
@@ -168,4 +168,14 @@ const struct pci_ecam_ops pci_32b_ops = { .write = pci_generic_config_write32, } }; + +/* ECAM ops for 32-bit read only (non-compliant) */ +const struct pci_ecam_ops pci_32b_read_ops = { + .bus_shift =20 , + .pci_ops = { + .map_bus = pci_ecam_map_bus, + .read = pci_generic_config_read32, + .write = pci_generic_config_write, + } +};#endif
include/linux/pci-ecam.h +1 -0
@@ -51,6 +51,7 @@ extern const struct pci_ecam_ops pci_generic_ecam_ops;#if defined(CONFIG_ACPI ) && defined(CONFIG_PCI_QUIRKS )extern const struct pci_ecam_ops pci_32b_ops;/* 32-bit accesses only */ +extern const struct pci_ecam_ops pci_32b_read_ops;/* 32-bit read only */ extern const struct pci_ecam_ops hisi_pcie_ops;/* HiSilicon */ extern const struct pci_ecam_ops thunder_pem_ecam_ops;/* Cavium ThunderX 1.x & 2.x */ extern const struct pci_ecam_ops pci_thunder_ecam_ops;/* Cavium ThunderX 1.x */
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 145/391 bnxt_en: Log unknown link speed appropriately.
In reply to Greg Kroah-HartmanFrom: Michael Chan <[email protected]>
[ Upstream commit 8eddb3e7ce124dd6375d3664f1aae13873318b0f ]
If the VF virtual link is set to always enabled, the speed may be unknown when the physical link is down. The driver currently logs the link speed as 4294967295 Mbps which is SPEED_UNKNOWN. Modify the link up log message as "speed unknown" which makes more sense.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +5 -1
@@ -8735,6 +8735,11 @@ static void bnxt_report_link(struct bnxt *bp)u16 fec;netif_carrier_on (bp->dev); + speed =bnxt_fw_to_ethtool_speed (bp->link_info.link_speed); +if (speed ==SPEED_UNKNOWN ) { +netdev_info (bp->dev,"NIC Link is Up, speed unknown\n" ); +return ; + }if (bp->link_info.duplex ==BNXT_LINK_DUPLEX_FULL ) duplex ="full" ;else
@@ -8747,7 +8752,6 @@ static void bnxt_report_link(struct bnxt *bp) flow_ctrl ="ON - receive" ; else flow_ctrl ="none" ; - speed =bnxt_fw_to_ethtool_speed (bp->link_info.link_speed);netdev_info (bp->dev,"NIC Link is Up, %u Mbps %s duplex, Flow control: %s\n" , speed, duplex, flow_ctrl);if (bp->flags &BNXT_FLAG_EEE_CAP )
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 177/391 firmware: arm_scmi: Move scmi bus init and exit calls into the driver
In reply to Greg Kroah-HartmanFrom: Sudeep Holla <[email protected]>
[ Upstream commit 5a2f0a0bdf201e2183904b6217f9c74774c961a8 ]
In preparation to enable building scmi as a single module, let us move the scmi bus {de-,}initialisation call into the driver.
The main reason for this is to keep it simple instead of maintaining it as separate modules and dealing with all possible initcall races and deferred probe handling. We can move it as separate modules if needed in future.
--- drivers/firmware/arm_scmi/bus.c | 6 ++---- drivers/firmware/arm_scmi/common.h | 3 +++ drivers/firmware/arm_scmi/driver.c | 16 +++++++++++++++- 3 files changed, 20 insertions(+), 5 deletions(-)
drivers/firmware/arm_scmi/bus.c +2 -4
@@ -230,7 +230,7 @@ static void scmi_devices_unregister(void)bus_for_each_dev (&scmi_bus_type,NULL ,NULL , __scmi_devices_unregister); } -static int __init scmi_bus_init (void ) +int __init scmi_bus_init (void ) {int retval;
@@ -240,12 +240,10 @@ static int __init scmi_bus_init(void)return retval; } -subsys_initcall (scmi_bus_init); -static void __exit scmi_bus_exit(void) +void __exit scmi_bus_exit(void) {scmi_devices_unregister ();bus_unregister (&scmi_bus_type);ida_destroy (&scmi_bus_id); } -module_exit (scmi_bus_exit);
drivers/firmware/arm_scmi/common.h +3 -0
@@ -158,6 +158,9 @@ void scmi_setup_protocol_implemented(const struct scmi_handle *handle,int scmi_base_protocol_init (struct scmi_handle *h); +int __init scmi_bus_init (void ); +void __exit scmi_bus_exit(void); +/* SCMI Transport */ /** * struct scmi_chan_info - Structure representing a SCMI channel information
drivers/firmware/arm_scmi/driver.c +15 -1
@@ -936,7 +936,21 @@ static struct platform_driver scmi_driver = { .remove = scmi_remove, }; -module_platform_driver (scmi_driver); +static int __init scmi_driver_init (void ) +{ +scmi_bus_init (); + +return platform_driver_register (&scmi_driver); +} +module_init (scmi_driver_init); + +static void __exit scmi_driver_exit(void) +{ +scmi_bus_exit (); + +platform_driver_unregister (&scmi_driver); +} +module_exit (scmi_driver_exit);MODULE_ALIAS ("platform: arm-scmi" );MODULE_AUTHOR ("Sudeep Holla <[email protected]>" );
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 172/391 ARM: dts: s5pv210: add RTC 32 KHz clock in Aries family
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 086c4498b0cc87fdb09188f3da7056e898814948 ]
The S3C RTC requires 32768 Hz clock as input which is provided by PMIC. However there is no such clock provider but rather a regulator driver which registers the clock as a regulator. This is an old driver which will not be updated so add a workaround - a fixed-clock to fill missing clock phandle reference in S3C RTC.
This fixes dtbs_check warnings:
rtc@e2800000: clocks: [[2, 145]] is too short
rtc@e2800000: clock-names: ['rtc'] is too short
--- arch/arm/boot/dts/s5pv210-aries.dtsi | 12 ++++++++++++ 1 file changed, 12 insertions(+)
arch/arm/boot/dts/s5pv210-aries.dtsi +12 -0
@@ -47,6 +47,13 @@ }; }; + pmic_ap_clk: clock-0 { + /* Workaround for missing clock on PMIC */ + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <32768>; + }; + bt_codec: bt_sco { compatible = "linux,bt-sco"; #sound-dai-cells = <0>;
@@ -825,6 +832,11 @@ samsung,pwm-outputs = <1>; }; +&rtc { + clocks = <&clocks CLK_RTC>, <&pmic_ap_clk>; + clock-names = "rtc", "rtc_src"; +}; + &sdhci1 { #address-cells = <1>; #size-cells = <0>;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 165/391 ARM: dts: omap4: Fix sgx clock rate for 4430
In reply to Greg Kroah-HartmanFrom: Tony Lindgren <[email protected]>
[ Upstream commit 19d3e9a0bdd57b90175f30390edeb06851f5f9f3 ]
We currently have a different clock rate for droid4 compared to the stock v3.0.8 based Android Linux kernel:
# cat /sys/kernel/debug/clk/dpll_*_m7x2_ck/clk_rate 266666667 307200000 # cat /sys/kernel/debug/clk/l3_gfx_cm:clk:0000:0/clk_rate 307200000
Let's fix this by configuring sgx to use 153.6 MHz instead of 307.2 MHz. Looks like also at least duover needs this change to avoid hangs, so let's apply it for all 4430.
This helps a bit with thermal issues that seem to be related to memory corruption when using sgx. It seems that other driver related issues still remain though.
--- arch/arm/boot/dts/omap4.dtsi | 2 +- arch/arm/boot/dts/omap443x.dtsi | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-)
arch/arm/boot/dts/omap4.dtsi +1 -1
@@ -410,7 +410,7 @@ status = "disabled"; }; - target-module@56000000 { + sgx_module: target-module@56000000 { compatible = "ti,sysc-omap4", "ti,sysc"; reg = <0x5600fe00 0x4>, <0x5600fe10 0x4>;
arch/arm/boot/dts/omap443x.dtsi +10 -0
@@ -74,3 +74,13 @@ }; /include/ "omap443x-clocks.dtsi" + +/* + * Use dpll_per for sgx at 153.6MHz like droid4 stock v3.0.8 Android kernel + */ +&sgx_module { + assigned-clocks = <&l3_gfx_clkctrl OMAP4_GPU_CLKCTRL 24>, + <&dpll_per_m7x2_ck>; + assigned-clock-rates = <0>, <153600000>; + assigned-clock-parents = <&dpll_per_m7x2_ck>; +};
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 156/391 KVM: PPC: Book3S HV: Do not allocate HPT for a nested guest
In reply to Greg Kroah-HartmanFrom: Fabiano Rosas <[email protected]>
[ Upstream commit 05e6295dc7de859c9d56334805485c4d20bebf25 ]
The current nested KVM code does not support HPT guests. This is informed/enforced in some ways:
- Hosts < P9 will not be able to enable the nested HV feature;
- The nested hypervisor MMU capabilities will not contain KVM_CAP_PPC_MMU_HASH_V3;
- QEMU reflects the MMU capabilities in the 'ibm,arch-vec-5-platform-support' device-tree property;
- The nested guest, at 'prom_parse_mmu_model' ignores the 'disable_radix' kernel command line option if HPT is not supported;
- The KVM_PPC_CONFIGURE_V3_MMU ioctl will fail if trying to use HPT.
There is, however, still a way to start a HPT guest by using max-compat-cpu=power8 at the QEMU machine options. This leads to the guest being set to use hash after QEMU calls the KVM_PPC_ALLOCATE_HTAB ioctl.
With the guest set to hash, the nested hypervisor goes through the entry path that has no knowledge of nesting (kvmppc_run_vcpu) and crashes when it tries to execute an hypervisor-privileged (mtspr HDEC) instruction at __kvmppc_vcore_entry:
root@L1:~ $ qemu-system-ppc64 -machine pseries,max-cpu-compat=power8 ...
<snip>
[ 538.543303] CPU: 83 PID: 25185 Comm: CPU 0/KVM Not tainted 5.9.0-rc4 #1
[ 538.543355] NIP: c00800000753f388 LR: c00800000753f368 CTR: c0000000001e5ec0
[ 538.543417] REGS: c0000013e91e33b0 TRAP: 0700 Not tainted (5.9.0-rc4)
[ 538.543470] MSR: 8000000002843033 <SF,VEC,VSX,FP,ME,IR,DR,RI,LE> CR: 22422882 XER: 20040000
[ 538.543546] CFAR: c00800000753f4b0 IRQMASK: 3
GPR00: c0080000075397a0 c0000013e91e3640 c00800000755e600 0000000080000000
GPR04: 0000000000000000 c0000013eab19800 c000001394de0000 00000043a054db72
GPR08: 00000000003b1652 0000000000000000 0000000000000000 c0080000075502e0
GPR12: c0000000001e5ec0 c0000007ffa74200 c0000013eab19800 0000000000000008
GPR16: 0000000000000000 c00000139676c6c0 c000000001d23948 c0000013e91e38b8
GPR20: 0000000000000053 0000000000000000 0000000000000001 0000000000000000
GPR24: 0000000000000001 0000000000000001 0000000000000000 0000000000000001
GPR28: 0000000000000001 0000000000000053 c0000013eab19800 0000000000000001
[ 538.544067] NIP [c00800000753f388] __kvmppc_vcore_entry+0x90/0x104 [kvm_hv]
[ 538.544121] LR [c00800000753f368] __kvmppc_vcore_entry+0x70/0x104 [kvm_hv]
[ 538.544173] Call Trace:
[ 538.544196] [c0000013e91e3640] [c0000013e91e3680] 0xc0000013e91e3680 (unreliable)
[ 538.544260] [c0000013e91e3820] [c0080000075397a0] kvmppc_run_core+0xbc8/0x19d0 [kvm_hv]
[ 538.544325] [c0000013e91e39e0] [c00800000753d99c] kvmppc_vcpu_run_hv+0x404/0xc00 [kvm_hv]
[ 538.544394] [c0000013e91e3ad0] [c0080000072da4fc] kvmppc_vcpu_run+0x34/0x48 [kvm]
[ 538.544472] [c0000013e91e3af0] [c0080000072d61b8] kvm_arch_vcpu_ioctl_run+0x310/0x420 [kvm]
[ 538.544539] [c0000013e91e3b80] [c0080000072c7450] kvm_vcpu_ioctl+0x298/0x778 [kvm]
[ 538.544605] [c0000013e91e3ce0] [c0000000004b8c2c] sys_ioctl+0x1dc/0xc90
[ 538.544662] [c0000013e91e3dc0] [c00000000002f9a4] system_call_exception+0xe4/0x1c0
[ 538.544726] [c0000013e91e3e20] [c00000000000d140] system_call_common+0xf0/0x27c
[ 538.544787] Instruction dump:
[ 538.544821] f86d1098 60000000 60000000 48000099 e8ad0fe8 e8c500a0 e9264140 75290002
[ 538.544886] 7d1602a6 7cec42a6 40820008 7d0807b4 <7d164ba6> 7d083a14 f90d10a0 480104fd
[ 538.544953] ---[ end trace 74423e2b948c2e0c ]---This patch makes the KVM_PPC_ALLOCATE_HTAB ioctl fail when running in the nested hypervisor, causing QEMU to abort.
--- arch/powerpc/kvm/book3s_hv.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/powerpc/kvm/book3s_hv.c +6 -0
@@ -5257,6 +5257,12 @@ static long kvm_arch_vm_ioctl_hv(struct file *filp,case KVM_PPC_ALLOCATE_HTAB : {u32 htab_order; +/* If we're a nested hypervisor, we currently only support radix */ +if (kvmhv_on_pseries ()) { + r = -EOPNOTSUPP ; +break ; + } + r = -EFAULT ;if (get_user (htab_order, (u32 __user *)argp))break ;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 140/391 ARC: [dts] fix the errors detected by dtbs_check
In reply to Greg Kroah-HartmanFrom: Zhen Lei <[email protected]>
[ Upstream commit 05b1be68c4d6d76970025e6139bfd735c2256ee5 ]
xxx/arc/boot/dts/axs101.dt.yaml: dw-apb-ictl@e0012000: $nodename:0: \
'dw-apb-ictl@e0012000' does not match '^interrupt-controller(@[0-9a-f,]+)*$'
From schema: xxx/interrupt-controller/snps,dw-apb-ictl.yaml
The node name of the interrupt controller must start with "interrupt-controller" instead of "dw-apb-ictl".
--- arch/arc/boot/dts/axc001.dtsi | 2 +- arch/arc/boot/dts/axc003.dtsi | 2 +- arch/arc/boot/dts/axc003_idu.dtsi | 2 +- arch/arc/boot/dts/vdk_axc003.dtsi | 2 +- arch/arc/boot/dts/vdk_axc003_idu.dtsi | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-)
arch/arc/boot/dts/axc001.dtsi +1 -1
@@ -91,7 +91,7 @@ * avoid duplicating the MB dtsi file given that IRQ from * this intc to cpu intc are different for axs101 and axs103 */ - mb_intc: dw-apb-ictl@e0012000 { + mb_intc: interrupt-controller@e0012000 { #interrupt-cells = <1>; compatible = "snps,dw-apb-ictl"; reg = < 0x0 0xe0012000 0x0 0x200 >;
arch/arc/boot/dts/axc003.dtsi +1 -1
@@ -129,7 +129,7 @@ * avoid duplicating the MB dtsi file given that IRQ from * this intc to cpu intc are different for axs101 and axs103 */ - mb_intc: dw-apb-ictl@e0012000 { + mb_intc: interrupt-controller@e0012000 { #interrupt-cells = <1>; compatible = "snps,dw-apb-ictl"; reg = < 0x0 0xe0012000 0x0 0x200 >;
arch/arc/boot/dts/axc003_idu.dtsi +1 -1
@@ -135,7 +135,7 @@ * avoid duplicating the MB dtsi file given that IRQ from * this intc to cpu intc are different for axs101 and axs103 */ - mb_intc: dw-apb-ictl@e0012000 { + mb_intc: interrupt-controller@e0012000 { #interrupt-cells = <1>; compatible = "snps,dw-apb-ictl"; reg = < 0x0 0xe0012000 0x0 0x200 >;
arch/arc/boot/dts/vdk_axc003.dtsi +1 -1
@@ -46,7 +46,7 @@ }; - mb_intc: dw-apb-ictl@e0012000 { + mb_intc: interrupt-controller@e0012000 { #interrupt-cells = <1>; compatible = "snps,dw-apb-ictl"; reg = < 0xe0012000 0x200 >;
arch/arc/boot/dts/vdk_axc003_idu.dtsi +1 -1
@@ -54,7 +54,7 @@ }; - mb_intc: dw-apb-ictl@e0012000 { + mb_intc: interrupt-controller@e0012000 { #interrupt-cells = <1>; compatible = "snps,dw-apb-ictl"; reg = < 0xe0012000 0x200 >;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 153/391 drivers: watchdog: rdc321x_wdt: Fix race condition bugs
In reply to Greg Kroah-HartmanFrom: Madhuparna Bhowmik <[email protected]>
[ Upstream commit 4b2e7f99cdd314263c9d172bc17193b8b6bba463 ]
In rdc321x_wdt_probe(), rdc321x_wdt_device.queue is initialized after misc_register(), hence if ioctl is called before its initialization which can call rdc321x_wdt_start() function, it will see an uninitialized value of rdc321x_wdt_device.queue, hence initialize it before misc_register().
Also, rdc321x_wdt_device.default_ticks is accessed in reset() function called from write callback, thus initialize it before misc_register().
Found by Linux Driver Verification project (linuxtesting.org).
--- drivers/watchdog/rdc321x_wdt.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/watchdog/rdc321x_wdt.c +2 -3
@@ -231,6 +231,8 @@ static int rdc321x_wdt_probe(struct platform_device *pdev) rdc321x_wdt_device.sb_pdev = pdata->sb_pdev; rdc321x_wdt_device.base_reg = r->start; + rdc321x_wdt_device.queue =0 ; + rdc321x_wdt_device.default_ticks = ticks; err =misc_register (&rdc321x_wdt_misc);if (err <0 ) {
@@ -245,14 +247,11 @@ static int rdc321x_wdt_probe(struct platform_device *pdev) rdc321x_wdt_device.base_reg, RDC_WDT_RST);init_completion (&rdc321x_wdt_device.stop); - rdc321x_wdt_device.queue =0 ;clear_bit (0 , &rdc321x_wdt_device.inuse);timer_setup (&rdc321x_wdt_device.timer, rdc321x_wdt_trigger,0 ); - rdc321x_wdt_device.default_ticks = ticks; -dev_info (&pdev->dev,"watchdog init success\n" );return 0 ;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 148/391 clk: ti: clockdomain: fix static checker warning
In reply to Greg Kroah-HartmanFrom: Tero Kristo <[email protected]>
[ Upstream commit b7a7943fe291b983b104bcbd2f16e8e896f56590 ]
Fix a memory leak induced by not calling clk_put after doing of_clk_get.
--- drivers/clk/ti/clockdomain.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/clk/ti/clockdomain.c +2 -0
@@ -148,10 +148,12 @@ static void __init of_ti_clockdomain_setup(struct device_node *node)if (!omap2_clk_is_hw_omap (clk_hw)) {pr_warn ("can't setup clkdm for basic clk %s\n" ,__clk_get_name (clk)); +clk_put (clk);continue ; }to_clk_hw_omap (clk_hw)->clkdm_name = clkdm_name;omap2_init_clk_clkdm (clk_hw); +clk_put (clk); } }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 106/391 nfc: s3fwrn5: Add missing CRYPTO_HASH dependency
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 4aa62c62d4c41d71b2bda5ed01b78961829ee93c ]
The driver uses crypto hash functions so it needs to select CRYPTO_HASH. This fixes build errors:
arc-linux-ld: drivers/nfc/s3fwrn5/firmware.o: in function `s3fwrn5_fw_download':
firmware.c:(.text+0x152): undefined reference to `crypto_alloc_shash'
--- drivers/nfc/s3fwrn5/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/nfc/s3fwrn5/Kconfig +1 -0
@@ -2,6 +2,7 @@ config NFC_S3FWRN5 tristate select CRYPTO + select CRYPTO_HASH help Core driver for Samsung S3FWRN5 NFC chip. Contains core utilities of chip. It's intended to be used by PHYs to avoid duplicating lots
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 103/391 drm: lima: fix common struct sg_table related issues
In reply to Greg Kroah-HartmanFrom: Marek Szyprowski <[email protected]>
[ Upstream commit c3d9c17f486d5c54940487dc31a54ebfdeeb371a ]
The Documentation/DMA-API-HOWTO.txt states that the dma_map_sg() function returns the number of the created entries in the DMA address space. However the subsequent calls to the dma_sync_sg_for_{device,cpu}() and dma_unmap_sg must be called with the original number of the entries passed to the dma_map_sg().
struct sg_table is a common structure used for describing a non-contiguous memory buffer, used commonly in the DRM and graphics subsystems. It consists of a scatterlist with memory pages and DMA addresses (sgl entry), as well as the number of scatterlist entries: CPU pages (orig_nents entry) and DMA mapped pages (nents entry).
It turned out that it was a common mistake to misuse nents and orig_nents entries, calling DMA-mapping functions with a wrong number of entries or ignoring the number of mapped entries returned by the dma_map_sg() function.
To avoid such issues, lets use a common dma-mapping wrappers operating directly on the struct sg_table objects and use scatterlist page iterators where possible. This, almost always, hides references to the nents and orig_nents entries, making the code robust, easier to follow and copy/paste safe.
--- drivers/gpu/drm/lima/lima_gem.c | 11 ++++++++--- drivers/gpu/drm/lima/lima_vm.c | 5 ++--- 2 files changed, 10 insertions(+), 6 deletions(-)
drivers/gpu/drm/lima/lima_gem.c +8 -3
@@ -69,8 +69,7 @@ int lima_heap_alloc(struct lima_bo *bo, struct lima_vm *vm)return ret;if (bo->base.sgt) { -dma_unmap_sg (dev, bo->base.sgt->sgl, - bo->base.sgt->nents,DMA_BIDIRECTIONAL ); +dma_unmap_sgtable (dev, bo->base.sgt,DMA_BIDIRECTIONAL ,0 );sg_free_table (bo->base.sgt); }else { bo->base.sgt =kmalloc (sizeof (*bo->base.sgt),GFP_KERNEL );
@@ -80,7 +79,13 @@ int lima_heap_alloc(struct lima_bo *bo, struct lima_vm *vm) } } -dma_map_sg (dev, sgt.sgl, sgt.nents,DMA_BIDIRECTIONAL ); + ret =dma_map_sgtable (dev, &sgt,DMA_BIDIRECTIONAL ,0 ); +if (ret) { +sg_free_table (&sgt); +kfree (bo->base.sgt); + bo->base.sgt =NULL ; +return ret; + } *bo->base.sgt = sgt;
drivers/gpu/drm/lima/lima_vm.c +2 -3
@@ -124,7 +124,7 @@ int lima_vm_bo_add(struct lima_vm *vm, struct lima_bo *bo, bool create)if (err) goto err_out1; -for_each_sg_dma_page (bo->base.sgt->sgl, &sg_iter, bo->base.sgt->nents,0 ) { +for_each_sgtable_dma_page (bo->base.sgt, &sg_iter,0 ) { err =lima_vm_map_page (vm,sg_page_iter_dma_address (&sg_iter), bo_va->node.start + offset);if (err)
@@ -298,8 +298,7 @@ int lima_vm_map_bo(struct lima_vm *vm, struct lima_bo *bo, int pageoff)mutex_lock (&vm->lock); base = bo_va->node.start + (pageoff <<PAGE_SHIFT ); -for_each_sg_dma_page (bo->base.sgt->sgl, &sg_iter, - bo->base.sgt->nents, pageoff) { +for_each_sgtable_dma_page (bo->base.sgt, &sg_iter, pageoff) { err =lima_vm_map_page (vm,sg_page_iter_dma_address (&sg_iter), base + offset);if (err)
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 102/391 xen: gntdev: fix common struct sg_table related issues
In reply to Greg Kroah-HartmanFrom: Marek Szyprowski <[email protected]>
[ Upstream commit d1749eb1ab85e04e58c29e58900e3abebbdd6e82 ]
The Documentation/DMA-API-HOWTO.txt states that the dma_map_sg() function returns the number of the created entries in the DMA address space. However the subsequent calls to the dma_sync_sg_for_{device,cpu}() and dma_unmap_sg must be called with the original number of the entries passed to the dma_map_sg().
struct sg_table is a common structure used for describing a non-contiguous memory buffer, used commonly in the DRM and graphics subsystems. It consists of a scatterlist with memory pages and DMA addresses (sgl entry), as well as the number of scatterlist entries: CPU pages (orig_nents entry) and DMA mapped pages (nents entry).
It turned out that it was a common mistake to misuse nents and orig_nents entries, calling DMA-mapping functions with a wrong number of entries or ignoring the number of mapped entries returned by the dma_map_sg() function.
To avoid such issues, lets use a common dma-mapping wrappers operating directly on the struct sg_table objects and use scatterlist page iterators where possible. This, almost always, hides references to the nents and orig_nents entries, making the code robust, easier to follow and copy/paste safe.
--- drivers/xen/gntdev-dmabuf.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/xen/gntdev-dmabuf.c +6 -7
@@ -247,10 +247,9 @@ static void dmabuf_exp_ops_detach(struct dma_buf *dma_buf,if (sgt) {if (gntdev_dmabuf_attach->dir !=DMA_NONE ) -dma_unmap_sg_attrs (attach->dev, sgt->sgl, - sgt->nents, - gntdev_dmabuf_attach->dir, -DMA_ATTR_SKIP_CPU_SYNC ); +dma_unmap_sgtable (attach->dev, sgt, + gntdev_dmabuf_attach->dir, +DMA_ATTR_SKIP_CPU_SYNC );sg_free_table (sgt); }
@@ -288,8 +287,8 @@ dmabuf_exp_ops_map_dma_buf(struct dma_buf_attachment *attach, sgt =dmabuf_pages_to_sgt (gntdev_dmabuf->pages, gntdev_dmabuf->nr_pages);if (!IS_ERR (sgt)) { -if (!dma_map_sg_attrs (attach->dev, sgt->sgl, sgt->nents, dir, -DMA_ATTR_SKIP_CPU_SYNC )) { +if (dma_map_sgtable (attach->dev, sgt, dir, +DMA_ATTR_SKIP_CPU_SYNC )) {sg_free_table (sgt);kfree (sgt); sgt =ERR_PTR (-ENOMEM );
@@ -633,7 +632,7 @@ dmabuf_imp_to_refs(struct gntdev_dmabuf_priv *priv, struct device *dev,/* Now convert sgt to array of pages and check for page validity. */ i =0 ; -for_each_sg_page (sgt->sgl, &sg_iter, sgt->nents,0 ) { +for_each_sgtable_page (sgt, &sg_iter,0 ) {struct page *page =sg_page_iter_page (&sg_iter);/* * Check if page is valid: this can happen if we are given
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 130/391 ath11k: fix warning caused by lockdep_assert_held
In reply to Greg Kroah-HartmanFrom: Carl Huang <[email protected]>
[ Upstream commit 2f588660e34a982377109872757f1b99d7748d21 ]
Fix warning caused by lockdep_assert_held when CONFIG_LOCKDEP is enabled.
[ 271.940647] WARNING: CPU: 6 PID: 0 at drivers/net/wireless/ath/ath11k/hal.c:818 ath11k_hal_srng_access_begin+0x31/0x40 [ath11k] [ 271.940655] Modules linked in: qrtr_mhi qrtr ns ath11k_pci mhi ath11k qmi_helpers nvme nvme_core [ 271.940675] CPU: 6 PID: 0 Comm: swapper/6 Kdump: loaded Tainted: G W 5.9.0-rc5-kalle-bringup-wt-ath+ #4 [ 271.940682] Hardware name: Dell Inc. Inspiron 7590/08717F, BIOS 1.3.0 07/22/2019 [ 271.940698] RIP: 0010:ath11k_hal_srng_access_begin+0x31/0x40 [ath11k] [ 271.940708] Code: 48 89 f3 85 c0 75 11 48 8b 83 a8 00 00 00 8b 00 89 83 b0 00 00 00 5b c3 48 8d 7e 58 be ff ff ff ff e8 53 24 ec fa 85 c0 75 dd <0f> 0b eb d9 90 66 2e 0f 1f 84 00 00 00 00 00 55 53 48 89 f3 8b 35 [ 271.940718] RSP: 0018:ffffbdf0c0230df8 EFLAGS: 00010246 [ 271.940727] RAX: 0000000000000000 RBX: ffffa12b34e67680 RCX: ffffa12b57a0d800 [ 271.940735] RDX: 0000000000000000 RSI: 00000000ffffffff RDI: ffffa12b34e676d8 [ 271.940742] RBP: ffffa12b34e60000 R08: 0000000000000001 R09: 0000000000000001 [ 271.940753] R10: 0000000000000001 R11: 0000000000000046 R12: 0000000000000000 [ 271.940763] R13: ffffa12b34e60000 R14: ffffa12b34e60000 R15: 0000000000000000 [ 271.940774] FS: 0000000000000000(0000) GS:ffffa12b5a400000(0000) knlGS:0000000000000000 [ 271.940788] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 271.940798] CR2: 00007f8bef282008 CR3: 00000001f4224004 CR4: 00000000003706e0 [ 271.940805] Call Trace: [ 271.940813] <IRQ> [ 271.940835] ath11k_dp_tx_completion_handler+0x9e/0x950 [ath11k] [ 271.940847] ? lock_acquire+0xba/0x3b0 [ 271.940876] ath11k_dp_service_srng+0x5a/0x2e0 [ath11k] [ 271.940893] ath11k_pci_ext_grp_napi_poll+0x1e/0x80 [ath11k_pci] [ 271.940908] net_rx_action+0x283/0x4f0 [ 271.940931] __do_softirq+0xcb/0x499 [ 271.940950] asm_call_on_stack+0x12/0x20 [ 271.940963] </IRQ> [ 271.940979] do_softirq_own_stack+0x4d/0x60 [ 271.940991] irq_exit_rcu+0xb0/0xc0 [ 271.941001] common_interrupt+0xce/0x190 [ 271.941014] asm_common_interrupt+0x1e/0x40 [ 271.941026] RIP: 0010:cpuidle_enter_state+0x115/0x500
Tested-on: QCA6390 hw2.0 PCI WLAN.HST.1.0.1-01740-QCAHSTSWPLZ_V2_TO_X86-1
--- drivers/net/wireless/ath/ath11k/dp_tx.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/ath/ath11k/dp_tx.c +4 -0
@@ -514,6 +514,8 @@ void ath11k_dp_tx_completion_handler(struct ath11k_base *ab, int ring_id)u32 msdu_id;u8 mac_id; +spin_lock_bh (&status_ring->lock); +ath11k_hal_srng_access_begin (ab, status_ring); while ((ATH11K_TX_COMPL_NEXT(tx_ring->tx_status_head) !=
@@ -533,6 +535,8 @@ void ath11k_dp_tx_completion_handler(struct ath11k_base *ab, int ring_id)ath11k_hal_srng_access_end (ab, status_ring); +spin_unlock_bh (&status_ring->lock); +while (ATH11K_TX_COMPL_NEXT (tx_ring->tx_status_tail) != tx_ring->tx_status_head) {struct hal_wbm_release_ring *tx_status;u32 desc_id;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 129/391 ath11k: Use GFP_ATOMIC instead of GFP_KERNEL in ath11k_dp_htt_get_ppdu_desc
In reply to Greg Kroah-HartmanFrom: Wen Gong <[email protected]>
[ Upstream commit 6a8be1baa9116a038cb4f6158cc10134387ca0d0 ]
With SLUB DEBUG CONFIG below crash is seen as kmem_cache_alloc is being called in non-atomic context.
To fix this issue, use GFP_ATOMIC instead of GFP_KERNEL kzalloc.
[ 357.217088] BUG: sleeping function called from invalid context at mm/slab.h:498 [ 357.217091] in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 0, name: swapper/0 [ 357.217092] INFO: lockdep is turned off. [ 357.217095] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G W 5.9.0-rc5-wt-ath+ #196 [ 357.217096] Hardware name: Intel(R) Client Systems NUC8i7HVK/NUC8i7HVB, BIOS HNKBLi70.86A.0049.2018.0801.1601 08/01/2018 [ 357.217097] Call Trace: [ 357.217098] <IRQ> [ 357.217107] ? ath11k_dp_htt_get_ppdu_desc+0xa9/0x170 [ath11k] [ 357.217110] dump_stack+0x77/0xa0 [ 357.217113] ___might_sleep.cold+0xa6/0xb6 [ 357.217116] kmem_cache_alloc_trace+0x1f2/0x270 [ 357.217122] ath11k_dp_htt_get_ppdu_desc+0xa9/0x170 [ath11k] [ 357.217129] ath11k_htt_pull_ppdu_stats.isra.0+0x96/0x270 [ath11k] [ 357.217135] ath11k_dp_htt_htc_t2h_msg_handler+0xe7/0x1d0 [ath11k] [ 357.217137] ? trace_hardirqs_on+0x1c/0x100 [ 357.217143] ath11k_htc_rx_completion_handler+0x207/0x370 [ath11k] [ 357.217149] ath11k_ce_recv_process_cb+0x15e/0x1e0 [ath11k] [ 357.217151] ? handle_irq_event+0x70/0xa8 [ 357.217154] ath11k_pci_ce_tasklet+0x10/0x30 [ath11k_pci] [ 357.217157] tasklet_action_common.constprop.0+0xd4/0xf0 [ 357.217160] __do_softirq+0xc9/0x482 [ 357.217162] asm_call_on_stack+0x12/0x20 [ 357.217163] </IRQ> [ 357.217166] do_softirq_own_stack+0x49/0x60 [ 357.217167] irq_exit_rcu+0x9a/0xd0 [ 357.217169] common_interrupt+0xa1/0x190 [ 357.217171] asm_common_interrupt+0x1e/0x40 [ 357.217173] RIP: 0010:cpu_idle_poll.isra.0+0x2e/0x60 [ 357.217175] Code: 8b 35 26 27 74 69 e8 11 c8 3d ff e8 bc fa 42 ff e8 e7 9f 4a ff fb 65 48 8b 1c 25 80 90 01 00 48 8b 03 a8 08 74 0b eb 1c f3 90 <48> 8b 03 a8 08 75 13 8b 0 [ 357.217177] RSP: 0018:ffffffff97403ee0 EFLAGS: 00000202 [ 357.217178] RAX: 0000000000000001 RBX: ffffffff9742b8c0 RCX: 0000000000b890ca [ 357.217180] RDX: 0000000000b890ca RSI: 0000000000000001 RDI: ffffffff968d0c49 [ 357.217181] RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000001 [ 357.217182] R10: ffffffff9742b8c0 R11: 0000000000000046 R12: 0000000000000000 [ 357.217183] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000066fdf520 [ 357.217186] ? cpu_idle_poll.isra.0+0x19/0x60 [ 357.217189] do_idle+0x5f/0xe0 [ 357.217191] cpu_startup_entry+0x14/0x20 [ 357.217193] start_kernel+0x443/0x464 [ 357.217196] secondary_startup_64+0xa4/0xb0
Tested-on: QCA6390 hw2.0 PCI WLAN.HST.1.0.1-01740-QCAHSTSWPLZ_V2_TO_X86-1
--- drivers/net/wireless/ath/ath11k/dp_rx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath11k/dp_rx.c +1 -1
@@ -1421,7 +1421,7 @@ struct htt_ppdu_stats_info *ath11k_dp_htt_get_ppdu_desc(struct ath11k *ar, }spin_unlock_bh (&ar->data_lock); - ppdu_info =kzalloc (sizeof (*ppdu_info),GFP_KERNEL ); + ppdu_info =kzalloc (sizeof (*ppdu_info),GFP_ATOMIC );if (!ppdu_info)return NULL ;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 127/391 octeontx2-af: fix LD CUSTOM LTYPE aliasing
In reply to Greg Kroah-HartmanFrom: Stanislaw Kardach <[email protected]>
[ Upstream commit 450f0b978870c384dd81d1176088536555f3170e ]
Since LD contains LTYPE definitions tweaked toward efficient NIX_AF_RX_FLOW_KEY_ALG(0..31)_FIELD(0..4) usage, the original location of NPC_LT_LD_CUSTOM0/1 was aliased with MPLS_IN_* definitions. Moving custom frame to value 6 and 7 removes the aliasing at the cost of custom frames being also considered when TCP/UDP RSS algo is configured.
However since the goal of CUSTOM frames is to classify them to a separate set of RQs, this cost is acceptable.
--- drivers/net/ethernet/marvell/octeontx2/af/npc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/npc.h +2 -2
@@ -77,6 +77,8 @@ enum npc_kpu_ld_ltype {NPC_LT_LD_ICMP ,NPC_LT_LD_SCTP ,NPC_LT_LD_ICMP6 , +NPC_LT_LD_CUSTOM0 , +NPC_LT_LD_CUSTOM1 ,NPC_LT_LD_IGMP =8 ,NPC_LT_LD_ESP , NPC_LT_LD_AH,
@@ -85,8 +87,6 @@ enum npc_kpu_ld_ltype {NPC_LT_LD_NSH ,NPC_LT_LD_TU_MPLS_IN_NSH , NPC_LT_LD_TU_MPLS_IN_IP, -NPC_LT_LD_CUSTOM0 =0xE , - NPC_LT_LD_CUSTOM1 = 0xF, }; enum npc_kpu_le_ltype {
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 124/391 xfs: dont free rt blocks when were doing a REMAP bunmapi call
In reply to Greg Kroah-HartmanFrom: Darrick J. Wong <[email protected]>
[ Upstream commit 8df0fa39bdd86ca81a8d706a6ed9d33cc65ca625 ]
When callers pass XFS_BMAPI_REMAP into xfs_bunmapi, they want the extent to be unmapped from the given file fork without the extent being freed. We do this for non-rt files, but we forgot to do this for realtime files. So far this isn't a big deal since nobody makes a bunmapi call to a rt file with the REMAP flag set, but don't leave a logic bomb.
--- fs/xfs/libxfs/xfs_bmap.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
fs/xfs/libxfs/xfs_bmap.c +12 -7
@@ -5046,20 +5046,25 @@ xfs_bmap_del_extent_real( flags =XFS_ILOG_CORE ;if (whichfork ==XFS_DATA_FORK &&XFS_IS_REALTIME_INODE (ip)) { -xfs_fsblock_t bno;xfs_filblks_t len;xfs_extlen_t mod; - bno =div_u64_rem (del->br_startblock, mp->m_sb.sb_rextsize, - &mod); -ASSERT (mod ==0 ); len =div_u64_rem (del->br_blockcount, mp->m_sb.sb_rextsize, &mod);ASSERT (mod ==0 ); - error =xfs_rtfree_extent (tp, bno, (xfs_extlen_t )len); -if (error) - goto done; +if (!(bflags &XFS_BMAPI_REMAP )) { +xfs_fsblock_t bno; + + bno =div_u64_rem (del->br_startblock, + mp->m_sb.sb_rextsize, &mod); +ASSERT (mod ==0 ); + + error =xfs_rtfree_extent (tp, bno, (xfs_extlen_t )len); +if (error) + goto done; + } + do_fx =0 ; nblks = len * mp->m_sb.sb_rextsize; qfield =XFS_TRANS_DQ_RTBCOUNT ;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 123/391 habanalabs: remove security from ARB_MST_QUIET register
In reply to Greg Kroah-HartmanFrom: farah kassabri <[email protected]>
[ Upstream commit acd330c141b4c49f468f00719ebc944656061eac ]
Allow user application to write to this register in order to be able to configure the quiet period of the QMAN between grants.
--- .../misc/habanalabs/gaudi/gaudi_security.c | 55 +++++++------------ 1 file changed, 19 insertions(+), 36 deletions(-)
drivers/misc/habanalabs/gaudi/gaudi_security.c +19 -36
@@ -831,8 +831,7 @@ static void gaudi_init_mme_protection_bits(struct hl_device *hdev)PROT_BITS_OFFS ; word_offset = ((mmMME0_QM_ARB_MST_CHOISE_PUSH_OFST_23 &PROT_BITS_OFFS ) >>7 ) <<2 ; - mask =1 << ((mmMME0_QM_ARB_MST_QUIET_PER &0x7F ) >>2 ); - mask |=1 << ((mmMME0_QM_ARB_SLV_CHOISE_WDT &0x7F ) >>2 ); + mask =1 << ((mmMME0_QM_ARB_SLV_CHOISE_WDT &0x7F ) >>2 ); mask |=1 << ((mmMME0_QM_ARB_MSG_MAX_INFLIGHT &0x7F ) >>2 ); mask |=1 << ((mmMME0_QM_ARB_MSG_AWUSER_31_11 &0x7F ) >>2 ); mask |=1 << ((mmMME0_QM_ARB_MSG_AWUSER_SEC_PROP &0x7F ) >>2 );
@@ -1311,8 +1310,7 @@ static void gaudi_init_mme_protection_bits(struct hl_device *hdev)PROT_BITS_OFFS ; word_offset = ((mmMME2_QM_ARB_MST_CHOISE_PUSH_OFST_23 &PROT_BITS_OFFS ) >>7 ) <<2 ; - mask =1 << ((mmMME2_QM_ARB_MST_QUIET_PER &0x7F ) >>2 ); - mask |=1 << ((mmMME2_QM_ARB_SLV_CHOISE_WDT &0x7F ) >>2 ); + mask =1 << ((mmMME2_QM_ARB_SLV_CHOISE_WDT &0x7F ) >>2 ); mask |=1 << ((mmMME2_QM_ARB_MSG_MAX_INFLIGHT &0x7F ) >>2 ); mask |=1 << ((mmMME2_QM_ARB_MSG_AWUSER_31_11 &0x7F ) >>2 ); mask |=1 << ((mmMME2_QM_ARB_MSG_AWUSER_SEC_PROP &0x7F ) >>2 );
@@ -1790,8 +1788,7 @@ static void gaudi_init_dma_protection_bits(struct hl_device *hdev) word_offset = ((mmDMA0_QM_ARB_MST_CHOISE_PUSH_OFST_23 &PROT_BITS_OFFS ) >>7 ) <<2 ; - mask =1 << ((mmDMA0_QM_ARB_MST_QUIET_PER &0x7F ) >>2 ); - mask |=1 << ((mmDMA0_QM_ARB_SLV_CHOISE_WDT &0x7F ) >>2 ); + mask =1 << ((mmDMA0_QM_ARB_SLV_CHOISE_WDT &0x7F ) >>2 ); mask |=1 << ((mmDMA0_QM_ARB_MSG_MAX_INFLIGHT &0x7F ) >>2 ); mask |=1 << ((mmDMA0_QM_ARB_MSG_AWUSER_31_11 &0x7F ) >>2 ); mask |=1 << ((mmDMA0_QM_ARB_MSG_AWUSER_SEC_PROP &0x7F ) >>2 );
@@ -2186,8 +2183,7 @@ static void gaudi_init_dma_protection_bits(struct hl_device *hdev) word_offset = ((mmDMA1_QM_ARB_MST_CHOISE_PUSH_OFST_23 &PROT_BITS_OFFS ) >>7 ) <<2 ; - mask =1 << ((mmDMA1_QM_ARB_MST_QUIET_PER &0x7F ) >>2 ); - mask |=1 << ((mmDMA1_QM_ARB_SLV_CHOISE_WDT &0x7F ) >>2 ); + mask =1 << ((mmDMA1_QM_ARB_SLV_CHOISE_WDT &0x7F ) >>2 ); mask |=1 << ((mmDMA1_QM_ARB_MSG_MAX_INFLIGHT &0x7F ) >>2 ); mask |=1 << ((mmDMA1_QM_ARB_MSG_AWUSER_31_11 &0x7F ) >>2 ); mask |=1 << ((mmDMA1_QM_ARB_MSG_AWUSER_SEC_PROP &0x7F ) >>2 );
@@ -2582,8 +2578,7 @@ static void gaudi_init_dma_protection_bits(struct hl_device *hdev) word_offset = ((mmDMA2_QM_ARB_MST_CHOISE_PUSH_OFST_23 &PROT_BITS_OFFS ) >>7 ) <<2 ; - mask =1 << ((mmDMA2_QM_ARB_MST_QUIET_PER &0x7F ) >>2 ); - mask |=1 << ((mmDMA2_QM_ARB_SLV_CHOISE_WDT &0x7F ) >>2 ); + mask =1 << ((mmDMA2_QM_ARB_SLV_CHOISE_WDT &0x7F ) >>2 ); mask |=1 << ((mmDMA2_QM_ARB_MSG_MAX_INFLIGHT &0x7F ) >>2 ); mask |=1 << ((mmDMA2_QM_ARB_MSG_AWUSER_31_11 &0x7F ) >>2 ); mask |=1 << ((mmDMA2_QM_ARB_MSG_AWUSER_SEC_PROP &0x7F ) >>2 );
@@ -2978,8 +2973,7 @@ static void gaudi_init_dma_protection_bits(struct hl_device *hdev) word_offset = ((mmDMA3_QM_ARB_MST_CHOISE_PUSH_OFST_23 &PROT_BITS_OFFS ) >>7 ) <<2 ; - mask =1 << ((mmDMA3_QM_ARB_MST_QUIET_PER &0x7F ) >>2 ); - mask |=1 << ((mmDMA3_QM_ARB_SLV_CHOISE_WDT &0x7F ) >>2 ); + mask =1 << ((mmDMA3_QM_ARB_SLV_CHOISE_WDT &0x7F ) >>2 ); mask |=1 << ((mmDMA3_QM_ARB_MSG_MAX_INFLIGHT &0x7F ) >>2 ); mask |=1 << ((mmDMA3_QM_ARB_MSG_AWUSER_31_11 &0x7F ) >>2 ); mask |=1 << ((mmDMA3_QM_ARB_MSG_AWUSER_SEC_PROP &0x7F ) >>2 );
@@ -3374,8 +3368,7 @@ static void gaudi_init_dma_protection_bits(struct hl_device *hdev) word_offset = ((mmDMA4_QM_ARB_MST_CHOISE_PUSH_OFST_23 &PROT_BITS_OFFS ) >>7 ) <<2 ; - mask =1 << ((mmDMA4_QM_ARB_MST_QUIET_PER &0x7F ) >>2 ); - mask |=1 << ((mmDMA4_QM_ARB_SLV_CHOISE_WDT &0x7F ) >>2 ); + mask =1 << ((mmDMA4_QM_ARB_SLV_CHOISE_WDT &0x7F ) >>2 ); mask |=1 << ((mmDMA4_QM_ARB_MSG_MAX_INFLIGHT &0x7F ) >>2 ); mask |=1 << ((mmDMA4_QM_ARB_MSG_AWUSER_31_11 &0x7F ) >>2 ); mask |=1 << ((mmDMA4_QM_ARB_MSG_AWUSER_SEC_PROP &0x7F ) >>2 );
@@ -3770,8 +3763,7 @@ static void gaudi_init_dma_protection_bits(struct hl_device *hdev) word_offset = ((mmDMA5_QM_ARB_MST_CHOISE_PUSH_OFST_23 &PROT_BITS_OFFS ) >>7 ) <<2 ; - mask =1 << ((mmDMA5_QM_ARB_MST_QUIET_PER &0x7F ) >>2 ); - mask |=1 << ((mmDMA5_QM_ARB_SLV_CHOISE_WDT &0x7F ) >>2 ); + mask =1 << ((mmDMA5_QM_ARB_SLV_CHOISE_WDT &0x7F ) >>2 ); mask |=1 << ((mmDMA5_QM_ARB_MSG_MAX_INFLIGHT &0x7F ) >>2 ); mask |=1 << ((mmDMA5_QM_ARB_MSG_AWUSER_31_11 &0x7F ) >>2 ); mask |=1 << ((mmDMA5_QM_ARB_MSG_AWUSER_SEC_PROP &0x7F ) >>2 );
@@ -4166,8 +4158,8 @@ static void gaudi_init_dma_protection_bits(struct hl_device *hdev) word_offset = ((mmDMA6_QM_ARB_MST_CHOISE_PUSH_OFST_23 &PROT_BITS_OFFS ) >>7 ) <<2 ; - mask =1 << ((mmDMA6_QM_ARB_MST_QUIET_PER &0x7F ) >>2 ); - mask |=1 << ((mmDMA6_QM_ARB_SLV_CHOISE_WDT &0x7F ) >>2 ); + + mask =1 << ((mmDMA6_QM_ARB_SLV_CHOISE_WDT &0x7F ) >>2 ); mask |=1 << ((mmDMA6_QM_ARB_MSG_MAX_INFLIGHT &0x7F ) >>2 ); mask |=1 << ((mmDMA6_QM_ARB_MSG_AWUSER_31_11 &0x7F ) >>2 ); mask |=1 << ((mmDMA6_QM_ARB_MSG_AWUSER_SEC_PROP &0x7F ) >>2 );
@@ -4562,8 +4554,7 @@ static void gaudi_init_dma_protection_bits(struct hl_device *hdev) word_offset = ((mmDMA7_QM_ARB_MST_CHOISE_PUSH_OFST_23 &PROT_BITS_OFFS ) >>7 ) <<2 ; - mask =1 << ((mmDMA7_QM_ARB_MST_QUIET_PER &0x7F ) >>2 ); - mask |=1 << ((mmDMA7_QM_ARB_SLV_CHOISE_WDT &0x7F ) >>2 ); + mask =1 << ((mmDMA7_QM_ARB_SLV_CHOISE_WDT &0x7F ) >>2 ); mask |=1 << ((mmDMA7_QM_ARB_MSG_MAX_INFLIGHT &0x7F ) >>2 ); mask |=1 << ((mmDMA7_QM_ARB_MSG_AWUSER_31_11 &0x7F ) >>2 ); mask |=1 << ((mmDMA7_QM_ARB_MSG_AWUSER_SEC_PROP &0x7F ) >>2 );
@@ -5491,8 +5482,7 @@ static void gaudi_init_tpc_protection_bits(struct hl_device *hdev) word_offset = ((mmTPC0_QM_ARB_MST_CHOISE_PUSH_OFST_23 &PROT_BITS_OFFS ) >>7 ) <<2 ; - mask =1 << ((mmTPC0_QM_ARB_MST_QUIET_PER &0x7F ) >>2 ); - mask |=1 << ((mmTPC0_QM_ARB_SLV_CHOISE_WDT &0x7F ) >>2 ); + mask =1 << ((mmTPC0_QM_ARB_SLV_CHOISE_WDT &0x7F ) >>2 ); mask |=1 << ((mmTPC0_QM_ARB_MSG_MAX_INFLIGHT &0x7F ) >>2 ); mask |=1 << ((mmTPC0_QM_ARB_MSG_AWUSER_31_11 &0x7F ) >>2 ); mask |=1 << ((mmTPC0_QM_ARB_MSG_AWUSER_SEC_PROP &0x7F ) >>2 );
@@ -5947,8 +5937,7 @@ static void gaudi_init_tpc_protection_bits(struct hl_device *hdev) word_offset = ((mmTPC1_QM_ARB_MST_CHOISE_PUSH_OFST_23 &PROT_BITS_OFFS ) >>7 ) <<2 ; - mask =1 << ((mmTPC1_QM_ARB_MST_QUIET_PER &0x7F ) >>2 ); - mask |=1 << ((mmTPC1_QM_ARB_SLV_CHOISE_WDT &0x7F ) >>2 ); + mask =1 << ((mmTPC1_QM_ARB_SLV_CHOISE_WDT &0x7F ) >>2 ); mask |=1 << ((mmTPC1_QM_ARB_MSG_MAX_INFLIGHT &0x7F ) >>2 ); mask |=1 << ((mmTPC1_QM_ARB_MSG_AWUSER_31_11 &0x7F ) >>2 ); mask |=1 << ((mmTPC1_QM_ARB_MSG_AWUSER_SEC_PROP &0x7F ) >>2 );
@@ -6402,8 +6391,7 @@ static void gaudi_init_tpc_protection_bits(struct hl_device *hdev)PROT_BITS_OFFS ; word_offset = ((mmTPC2_QM_ARB_MST_CHOISE_PUSH_OFST_23 &PROT_BITS_OFFS ) >>7 ) <<2 ; - mask =1 << ((mmTPC2_QM_ARB_MST_QUIET_PER &0x7F ) >>2 ); - mask |=1 << ((mmTPC2_QM_ARB_SLV_CHOISE_WDT &0x7F ) >>2 ); + mask =1 << ((mmTPC2_QM_ARB_SLV_CHOISE_WDT &0x7F ) >>2 ); mask |=1 << ((mmTPC2_QM_ARB_MSG_MAX_INFLIGHT &0x7F ) >>2 ); mask |=1 << ((mmTPC2_QM_ARB_MSG_AWUSER_31_11 &0x7F ) >>2 ); mask |=1 << ((mmTPC2_QM_ARB_MSG_AWUSER_SEC_PROP &0x7F ) >>2 );
@@ -6857,8 +6845,7 @@ static void gaudi_init_tpc_protection_bits(struct hl_device *hdev)PROT_BITS_OFFS ; word_offset = ((mmTPC3_QM_ARB_MST_CHOISE_PUSH_OFST_23 &PROT_BITS_OFFS ) >>7 ) <<2 ; - mask =1 << ((mmTPC3_QM_ARB_MST_QUIET_PER &0x7F ) >>2 ); - mask |=1 << ((mmTPC3_QM_ARB_SLV_CHOISE_WDT &0x7F ) >>2 ); + mask =1 << ((mmTPC3_QM_ARB_SLV_CHOISE_WDT &0x7F ) >>2 ); mask |=1 << ((mmTPC3_QM_ARB_MSG_MAX_INFLIGHT &0x7F ) >>2 ); mask |=1 << ((mmTPC3_QM_ARB_MSG_AWUSER_31_11 &0x7F ) >>2 ); mask |=1 << ((mmTPC3_QM_ARB_MSG_AWUSER_SEC_PROP &0x7F ) >>2 );
@@ -7312,8 +7299,7 @@ static void gaudi_init_tpc_protection_bits(struct hl_device *hdev)PROT_BITS_OFFS ; word_offset = ((mmTPC4_QM_ARB_MST_CHOISE_PUSH_OFST_23 &PROT_BITS_OFFS ) >>7 ) <<2 ; - mask =1 << ((mmTPC4_QM_ARB_MST_QUIET_PER &0x7F ) >>2 ); - mask |=1 << ((mmTPC4_QM_ARB_SLV_CHOISE_WDT &0x7F ) >>2 ); + mask =1 << ((mmTPC4_QM_ARB_SLV_CHOISE_WDT &0x7F ) >>2 ); mask |=1 << ((mmTPC4_QM_ARB_MSG_MAX_INFLIGHT &0x7F ) >>2 ); mask |=1 << ((mmTPC4_QM_ARB_MSG_AWUSER_31_11 &0x7F ) >>2 ); mask |=1 << ((mmTPC4_QM_ARB_MSG_AWUSER_SEC_PROP &0x7F ) >>2 );
@@ -7767,8 +7753,7 @@ static void gaudi_init_tpc_protection_bits(struct hl_device *hdev)PROT_BITS_OFFS ; word_offset = ((mmTPC5_QM_ARB_MST_CHOISE_PUSH_OFST_23 &PROT_BITS_OFFS ) >>7 ) <<2 ; - mask =1 << ((mmTPC5_QM_ARB_MST_QUIET_PER &0x7F ) >>2 ); - mask |=1 << ((mmTPC5_QM_ARB_SLV_CHOISE_WDT &0x7F ) >>2 ); + mask =1 << ((mmTPC5_QM_ARB_SLV_CHOISE_WDT &0x7F ) >>2 ); mask |=1 << ((mmTPC5_QM_ARB_MSG_MAX_INFLIGHT &0x7F ) >>2 ); mask |=1 << ((mmTPC5_QM_ARB_MSG_AWUSER_31_11 &0x7F ) >>2 ); mask |=1 << ((mmTPC5_QM_ARB_MSG_AWUSER_SEC_PROP &0x7F ) >>2 );
@@ -8223,8 +8208,7 @@ static void gaudi_init_tpc_protection_bits(struct hl_device *hdev) word_offset = ((mmTPC6_QM_ARB_MST_CHOISE_PUSH_OFST_23 &PROT_BITS_OFFS ) >>7 ) <<2 ; - mask =1 << ((mmTPC6_QM_ARB_MST_QUIET_PER &0x7F ) >>2 ); - mask |=1 << ((mmTPC6_QM_ARB_SLV_CHOISE_WDT &0x7F ) >>2 ); + mask =1 << ((mmTPC6_QM_ARB_SLV_CHOISE_WDT &0x7F ) >>2 ); mask |=1 << ((mmTPC6_QM_ARB_MSG_MAX_INFLIGHT &0x7F ) >>2 ); mask |=1 << ((mmTPC6_QM_ARB_MSG_AWUSER_31_11 &0x7F ) >>2 ); mask |=1 << ((mmTPC6_QM_ARB_MSG_AWUSER_SEC_PROP &0x7F ) >>2 );
@@ -8681,8 +8665,7 @@ static void gaudi_init_tpc_protection_bits(struct hl_device *hdev)PROT_BITS_OFFS ; word_offset = ((mmTPC7_QM_ARB_MST_CHOISE_PUSH_OFST_23 &PROT_BITS_OFFS ) >>7 ) <<2 ; - mask =1 << ((mmTPC7_QM_ARB_MST_QUIET_PER &0x7F ) >>2 ); - mask |=1 << ((mmTPC7_QM_ARB_SLV_CHOISE_WDT &0x7F ) >>2 ); + mask =1 << ((mmTPC7_QM_ARB_SLV_CHOISE_WDT &0x7F ) >>2 ); mask |=1 << ((mmTPC7_QM_ARB_MSG_MAX_INFLIGHT &0x7F ) >>2 ); mask |=1 << ((mmTPC7_QM_ARB_MSG_AWUSER_31_11 &0x7F ) >>2 ); mask |=1 << ((mmTPC7_QM_ARB_MSG_AWUSER_SEC_PROP &0x7F ) >>2 );
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 121/391 arm64/mm: return cpu_all_mask when node is NUMA_NO_NODE
In reply to Greg Kroah-HartmanFrom: Zhengyuan Liu <[email protected]>
[ Upstream commit a194c5f2d2b3a05428805146afcabe5140b5d378 ]
The @node passed to cpumask_of_node() can be NUMA_NO_NODE, in that case it will trigger the following WARN_ON(node >= nr_node_ids) due to mismatched data types of @node and @nr_node_ids. Actually we should return cpu_all_mask just like most other architectures do if passed NUMA_NO_NODE.
Also add a similar check to the inline cpumask_of_node() in numa.h.
--- arch/arm64/include/asm/numa.h | 3 +++ arch/arm64/mm/numa.c | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-)
arch/arm64/include/asm/numa.h +3 -0
@@ -25,6 +25,9 @@ const struct cpumask *cpumask_of_node(int node);/* Returns a pointer to the cpumask of CPUs on Node 'node'. */ static inline const struct cpumask *cpumask_of_node (int node) { +if (node ==NUMA_NO_NODE ) +return cpu_all_mask; +return node_to_cpumask_map[node]; }#endif
arch/arm64/mm/numa.c +5 -1
@@ -46,7 +46,11 @@ EXPORT_SYMBOL(node_to_cpumask_map);*/ const struct cpumask *cpumask_of_node (int node) { -if (WARN_ON (node >= nr_node_ids)) + +if (node ==NUMA_NO_NODE ) +return cpu_all_mask; + +if (WARN_ON (node <0 || node >= nr_node_ids))return cpu_none_mask;if (WARN_ON (node_to_cpumask_map[node] ==NULL ))
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 118/391 usb: xhci: omit duplicate actions when suspending a runtime suspended host.
In reply to Greg Kroah-HartmanFrom: Peter Chen <[email protected]>
[ Upstream commit 18a367e8947d72dd91b6fc401e88a2952c6363f7 ]
If the xhci-plat.c is the platform driver, after the runtime pm is enabled, the xhci_suspend is called if nothing is connected on the port. When the system goes to suspend, it will call xhci_suspend again if USB wakeup is enabled.
Since the runtime suspend wakeup setting is not always the same as system suspend wakeup setting, eg, at runtime suspend we always need wakeup if the controller is in low power mode; but at system suspend, we may not need wakeup. So, we move the judgement after changing wakeup setting.
[commit message rewording -Mathias]
--- drivers/usb/host/xhci.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/usb/host/xhci.c +5 -2
@@ -982,12 +982,15 @@ int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup) xhci->shared_hcd->state != HC_STATE_SUSPENDED)return -EINVAL ; -xhci_dbc_suspend (xhci); -/* Clear root port wake on bits if wakeup not allowed. */ if (!do_wakeup)xhci_disable_port_wake_on_bits (xhci); +if (!HCD_HW_ACCESSIBLE (hcd)) +return 0 ; + +xhci_dbc_suspend (xhci); +/* Don't poll the roothubs on bus suspend. */ xhci_dbg (xhci,"%s: stopping port polling.\n" , __func__);clear_bit (HCD_FLAG_POLL_RH , &hcd->flags);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 116/391 drm/amdgpu: No sysfs, not an error condition
In reply to Greg Kroah-HartmanFrom: Luben Tuikov <[email protected]>
[ Upstream commit 5aea5327ea2ddf544cbeff096f45fc2319b0714e ]
Not being able to create amdgpu sysfs attributes is not a fatal error warranting not to continue to try to bring up the display. Thus, if we get an error trying to create amdgpu sysfs attrs, report it and continue on to try to bring up
a display.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -3
@@ -3316,10 +3316,8 @@ fence_driver_init:flush_delayed_work (&adev->delayed_init_work); r =sysfs_create_files (&adev->dev->kobj, amdgpu_dev_attributes); -if (r) { +if (r)dev_err (adev->dev,"Could not create amdgpu device attr\n" ); -return r; - }if (IS_ENABLED (CONFIG_PERF_EVENTS )) r =amdgpu_pmu_init (adev);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 112/391 cpufreq: sti-cpufreq: add stih418 support
In reply to Greg Kroah-HartmanFrom: Alain Volmat <[email protected]>
[ Upstream commit 01a163c52039e9426c7d3d3ab16ca261ad622597 ]
The STiH418 can be controlled the same way as STiH407 & STiH410 regarding cpufreq.
--- drivers/cpufreq/sti-cpufreq.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/cpufreq/sti-cpufreq.c +4 -2
@@ -141,7 +141,8 @@ static const struct reg_field sti_stih407_dvfs_regfields[DVFS_MAX_REGFIELDS] = {static const struct reg_field *sti_cpufreq_match (void ) {if (of_machine_is_compatible ("st,stih407" ) || -of_machine_is_compatible ("st,stih410" )) +of_machine_is_compatible ("st,stih410" ) || +of_machine_is_compatible ("st,stih418" ))return sti_stih407_dvfs_regfields;return NULL ;
@@ -258,7 +259,8 @@ static int sti_cpufreq_init(void)int ret;if ((!of_machine_is_compatible ("st,stih407" )) && - (!of_machine_is_compatible ("st,stih410" ))) + (!of_machine_is_compatible ("st,stih410" )) && + (!of_machine_is_compatible ("st,stih418" )))return -ENODEV ; ddata.cpu =get_cpu_device (0 );
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 65/391 xfs: Set xfs_bufs b_ops member when zeroing bitmap/summary files
In reply to Greg Kroah-HartmanFrom: Chandan Babu R <[email protected]>
[ Upstream commit c54e14d155f5fdbac73a8cd4bd2678cb252149dc ]
In xfs_growfs_rt(), we enlarge bitmap and summary files by allocating new blocks for both files. For each of the new blocks allocated, we allocate an xfs_buf, zero the payload, log the contents and commit the transaction. Hence these buffers will eventually find themselves appended to list at xfs_ail->ail_buf_list.
Later, xfs_growfs_rt() loops across all of the new blocks belonging to the bitmap inode to set the bitmap values to 1. In doing so, it allocates a new transaction and invokes the following sequence of functions,
- xfs_rtfree_range()
- xfs_rtmodify_range()
- xfs_rtbuf_get()
We pass '&xfs_rtbuf_ops' as the ops pointer to xfs_trans_read_buf().
- xfs_trans_read_buf()
We find the xfs_buf of interest in per-ag hash table, invoke xfs_buf_reverify() which ends up assigning '&xfs_rtbuf_ops' to xfs_buf->b_ops.
On the other hand, if xfs_growfs_rt_alloc() had allocated a few blocks for the bitmap inode and returned with an error, all the xfs_bufs corresponding to the new bitmap blocks that have been allocated would continue to be on xfs_ail->ail_buf_list list without ever having a non-NULL value assigned to their b_ops members. An AIL flush operation would then trigger the following warning message to be printed on the console,
XFS (loop0): _xfs_buf_ioapply: no buf ops on daddr 0x58 len 8
00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ CPU: 3 PID: 449 Comm: xfsaild/loop0 Not tainted 5.8.0-rc4-chandan-00038-g4d8c2b9de9ab-dirty #37 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014 Call Trace: dump_stack+0x57/0x70 _xfs_buf_ioapply+0x37c/0x3b0 ? xfs_rw_bdev+0x1e0/0x1e0 ? xfs_buf_delwri_submit_buffers+0xd4/0x210 __xfs_buf_submit+0x6d/0x1f0 xfs_buf_delwri_submit_buffers+0xd4/0x210 xfsaild+0x2c8/0x9e0 ? __switch_to_asm+0x42/0x70 ? xfs_trans_ail_cursor_first+0x80/0x80 kthread+0xfe/0x140 ? kthread_park+0x90/0x90 ret_from_fork+0x22/0x30
This message indicates that the xfs_buf had its b_ops member set to NULL.
This commit fixes the issue by assigning "&xfs_rtbuf_ops" to b_ops member of each of the xfs_bufs logged by xfs_growfs_rt_alloc().
--- fs/xfs/xfs_rtalloc.c | 1 + 1 file changed, 1 insertion(+)
fs/xfs/xfs_rtalloc.c +1 -0
@@ -849,6 +849,7 @@ xfs_growfs_rt_alloc( goto out_trans_cancel;xfs_trans_buf_set_type (tp, bp, buf_type); + bp->b_ops = &xfs_rtbuf_ops;memset (bp->b_addr,0 , mp->m_sb.sb_blocksize);xfs_trans_log_buf (tp, bp,0 , mp->m_sb.sb_blocksize -1 );/*
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 56/391 f2fs: compress: fix to disallow enabling compress on non-empty file
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
[ Upstream commit 519a5a2f37b850f4eb86674a10d143088670a390 ]
Compressed inode and normal inode has different layout, so we should disallow enabling compress on non-empty file to avoid race condition during inode .i_addr array parsing and updating.
--- fs/f2fs/file.c | 2 ++ 1 file changed, 2 insertions(+)
fs/f2fs/file.c +2 -0
@@ -1836,6 +1836,8 @@ static int f2fs_setflags_common(struct inode *inode, u32 iflags, u32 mask)if (iflags &F2FS_COMPR_FL ) {if (!f2fs_may_compress (inode))return -EINVAL ; +if (S_ISREG (inode->i_mode) && inode->i_size) +return -EINVAL ;set_compress_context (inode); }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 64/391 xfs: Set xfs_buf type flag when growing summary/bitmap files
In reply to Greg Kroah-HartmanFrom: Chandan Babu R <[email protected]>
[ Upstream commit 72cc95132a93293dcd0b6f68353f4741591c9aeb ]
The following sequence of commands,
mkfs.xfs -f -m reflink=0 -r rtdev=/dev/loop1,size=10M /dev/loop0 mount -o rtdev=/dev/loop1 /dev/loop0 /mnt
xfs_growfs /mnt
... causes the following call trace to be printed on the console,
XFS: Assertion failed: (bip->bli_flags & XFS_BLI_STALE) || (xfs_blft_from_flags(&bip->__bli_format) > XFS_BLFT_UNKNOWN_BUF && xfs_blft_from_flags(&bip->__bli_format) < XFS_BLFT_MAX_BUF), file: fs/xfs/xfs_buf_item.c, line: 331
Call Trace: xfs_buf_item_format+0x632/0x680 ? kmem_alloc_large+0x29/0x90 ? kmem_alloc+0x70/0x120 ? xfs_log_commit_cil+0x132/0x940 xfs_log_commit_cil+0x26f/0x940 ? xfs_buf_item_init+0x1ad/0x240 ? xfs_growfs_rt_alloc+0x1fc/0x280 __xfs_trans_commit+0xac/0x370 xfs_growfs_rt_alloc+0x1fc/0x280 xfs_growfs_rt+0x1a0/0x5e0 xfs_file_ioctl+0x3fd/0xc70 ? selinux_file_ioctl+0x174/0x220 ksys_ioctl+0x87/0xc0 __x64_sys_ioctl+0x16/0x20 do_syscall_64+0x3e/0x70 entry_SYSCALL_64_after_hwframe+0x44/0xa9
This occurs because the buffer being formatted has the value of XFS_BLFT_UNKNOWN_BUF assigned to the 'type' subfield of bip->bli_formats->blf_flags.
This commit fixes the issue by assigning one of XFS_BLFT_RTSUMMARY_BUF and XFS_BLFT_RTBITMAP_BUF to the 'type' subfield of bip->bli_formats->blf_flags before committing the corresponding transaction.
--- fs/xfs/xfs_rtalloc.c | 8 ++++++++ 1 file changed, 8 insertions(+)
fs/xfs/xfs_rtalloc.c +8 -0
@@ -778,8 +778,14 @@ xfs_growfs_rt_alloc(struct xfs_bmbt_irec map;/* block map output */ int nmap;/* number of block maps */ int resblks;/* space reservation */ +enum xfs_blft buf_type;struct xfs_trans *tp; +if (ip == mp->m_rsumip) + buf_type =XFS_BLFT_RTSUMMARY_BUF ; +else + buf_type =XFS_BLFT_RTBITMAP_BUF ; +/* * Allocate space to the file, as necessary. */
@@ -841,6 +847,8 @@ xfs_growfs_rt_alloc( mp->m_bsize, 0, &bp);if (error) goto out_trans_cancel; + +xfs_trans_buf_set_type (tp, bp, buf_type);memset (bp->b_addr,0 , mp->m_sb.sb_blocksize);xfs_trans_log_buf (tp, bp,0 , mp->m_sb.sb_blocksize -1 );/*
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 60/391 afs: Dont assert on unpurgeable server records
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit 7530d3eb3dcf1a30750e8e7f1f88b782b96b72b8 ]
Don't give an assertion failure on unpurgeable afs_server records - which kills the thread - but rather emit a trace line when we are purging a record (which only happens during network namespace removal or rmmod) and print a notice of the problem.
--- fs/afs/server.c | 7 ++++++- include/trace/events/afs.h | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-)
fs/afs/server.c +6 -1
@@ -550,7 +550,12 @@ void afs_manage_servers(struct work_struct *work)_debug ("manage %pU %u" , &server->uuid, active); - ASSERTIFCMP(purging, active, ==, 0); +if (purging) { +trace_afs_server (server,atomic_read (&server->ref), + active, afs_server_trace_purging); +if (active !=0 ) +pr_notice ("Can't purge s=%08x\n" , server->debug_id); + }if (active ==0 ) {time64_t expire_at = server->unuse_time;
include/trace/events/afs.h +2 -0
@@ -40,6 +40,7 @@ enum afs_server_trace { afs_server_trace_get_new_cbi, afs_server_trace_get_probe, afs_server_trace_give_up_cb, + afs_server_trace_purging, afs_server_trace_put_call, afs_server_trace_put_cbi, afs_server_trace_put_find_rsq,
@@ -270,6 +271,7 @@ enum afs_cb_break_reason { EM(afs_server_trace_get_new_cbi, "GET cbi ") \ EM(afs_server_trace_get_probe, "GET probe") \ EM(afs_server_trace_give_up_cb, "giveup-cb") \ + EM(afs_server_trace_purging, "PURGE ") \ EM(afs_server_trace_put_call, "PUT call ") \ EM(afs_server_trace_put_cbi, "PUT cbi ") \EM (afs_server_trace_put_find_rsq,"PUT f-rsq" ) \
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 93/391 drm/bridge/synopsys: dsi: add support for non-continuous HS clock
In reply to Greg Kroah-HartmanFrom: Antonio Borneo <[email protected]>
[ Upstream commit c6d94e37bdbb6dfe7e581e937a915ab58399b8a5 ]
Current code enables the HS clock when video mode is started or to send out a HS command, and disables the HS clock to send out a LP command. This is not what DSI spec specify.
Enable HS clock either in command and in video mode. Set automatic HS clock management for panels and devices that support non-continuous HS clock.
--- drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +7 -2
@@ -365,7 +365,6 @@ static void dw_mipi_message_config(struct dw_mipi_dsi *dsi,if (lpm) val |=CMD_MODE_ALL_LP ; -dsi_write (dsi,DSI_LPCLK_CTRL , lpm ?0 :PHY_TXREQUESTCLKHS );dsi_write (dsi,DSI_CMD_MODE_CFG , val); }
@@ -541,16 +540,22 @@ static void dw_mipi_dsi_video_mode_config(struct dw_mipi_dsi *dsi)static void dw_mipi_dsi_set_mode (struct dw_mipi_dsi *dsi,unsigned long mode_flags) { +u32 val; +dsi_write (dsi,DSI_PWR_UP ,RESET );if (mode_flags &MIPI_DSI_MODE_VIDEO ) {dsi_write (dsi,DSI_MODE_CFG ,ENABLE_VIDEO_MODE );dw_mipi_dsi_video_mode_config (dsi); -dsi_write (dsi,DSI_LPCLK_CTRL ,PHY_TXREQUESTCLKHS ); }else {dsi_write (dsi,DSI_MODE_CFG ,ENABLE_CMD_MODE ); } + val =PHY_TXREQUESTCLKHS ; +if (dsi->mode_flags &MIPI_DSI_CLOCK_NON_CONTINUOUS ) + val |=AUTO_CLKLANE_CTRL ; +dsi_write (dsi,DSI_LPCLK_CTRL , val); +dsi_write (dsi,DSI_PWR_UP ,POWERUP ); }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 92/391 mmc: via-sdmmc: Fix data race bug
In reply to Greg Kroah-HartmanFrom: Madhuparna Bhowmik <[email protected]>
[ Upstream commit 87d7ad089b318b4f319bf57f1daa64eb6d1d10ad ]
via_save_pcictrlreg() should be called with host->lock held as it writes to pm_pcictrl_reg, otherwise there can be a race condition between via_sd_suspend() and via_sdc_card_detect(). The same pattern is used in the function via_reset_pcictrl() as well, where via_save_pcictrlreg() is called with host->lock held.
Found by Linux Driver Verification project (linuxtesting.org).
--- drivers/mmc/host/via-sdmmc.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/mmc/host/via-sdmmc.c +3 -0
@@ -1257,11 +1257,14 @@ static void __maybe_unused via_init_sdc_pm(struct via_crdr_mmc_host *host)static int __maybe_unused via_sd_suspend (struct device *dev) {struct via_crdr_mmc_host *host; +unsigned long flags; host =dev_get_drvdata (dev); +spin_lock_irqsave (&host->lock, flags);via_save_pcictrlreg (host);via_save_sdcreg (host); +spin_unlock_irqrestore (&host->lock, flags);device_wakeup_enable (dev);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 86/391 staging: wfx: fix potential use before init
In reply to Greg Kroah-HartmanFrom: Jérôme Pouiller <[email protected]>
[ Upstream commit ce3653a8d3db096aa163fc80239d8ec1305c81fa ]
The trace below can appear:
[83613.832200] INFO: trying to register non-static key.
[83613.837248] the code is fine but needs lockdep annotation.
[83613.842808] turning off the locking correctness validator.
[83613.848375] CPU: 3 PID: 141 Comm: kworker/3:2H Tainted: G O 5.6.13-silabs15 #2
[83613.857019] Hardware name: BCM2835
[83613.860605] Workqueue: events_highpri bh_work [wfx]
[83613.865552] Backtrace:
[83613.868041] [<c010f2cc>] (dump_backtrace) from [<c010f7b8>] (show_stack+0x20/0x24)
[83613.881463] [<c010f798>] (show_stack) from [<c0d82138>] (dump_stack+0xe8/0x114)
[83613.888882] [<c0d82050>] (dump_stack) from [<c01a02ec>] (register_lock_class+0x748/0x768)
[83613.905035] [<c019fba4>] (register_lock_class) from [<c019da04>] (__lock_acquire+0x88/0x13dc)
[83613.924192] [<c019d97c>] (__lock_acquire) from [<c019f6a4>] (lock_acquire+0xe8/0x274)
[83613.942644] [<c019f5bc>] (lock_acquire) from [<c0daa5dc>] (_raw_spin_lock_irqsave+0x58/0x6c)
[83613.961714] [<c0daa584>] (_raw_spin_lock_irqsave) from [<c0ab3248>] (skb_dequeue+0x24/0x78)
[83613.974967] [<c0ab3224>] (skb_dequeue) from [<bf330db0>] (wfx_tx_queues_get+0x96c/0x1294 [wfx])
[83613.989728] [<bf330444>] (wfx_tx_queues_get [wfx]) from [<bf320454>] (bh_work+0x454/0x26d8 [wfx])
[83614.009337] [<bf320000>] (bh_work [wfx]) from [<c014c920>] (process_one_work+0x23c/0x7ec)
[83614.028141] [<c014c6e4>] (process_one_work) from [<c014cf1c>] (worker_thread+0x4c/0x55c)
[83614.046861] [<c014ced0>] (worker_thread) from [<c0154c04>] (kthread+0x138/0x168)
[83614.064876] [<c0154acc>] (kthread) from [<c01010b4>] (ret_from_fork+0x14/0x20)
[83614.072200] Exception stack(0xecad3fb0 to 0xecad3ff8)
[83614.077323] 3fa0: 00000000 00000000 00000000 00000000
[83614.085620] 3fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[83614.093914] 3fe0: 00000000 00000000 00000000 00000000 00000013 00000000Indeed, the code of wfx_add_interface() shows that the interface is enabled to early. So, the spinlock associated with some skb_queue may not yet initialized when wfx_tx_queues_get() is called.
--- drivers/staging/wfx/sta.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/staging/wfx/sta.c +14 -14
@@ -761,17 +761,6 @@ int wfx_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)return -EOPNOTSUPP ; } -for (i =0 ; i <ARRAY_SIZE (wdev->vif); i++) { -if (!wdev->vif[i]) { - wdev->vif[i] = vif; - wvif->id = i; -break ; - } - } -if (i ==ARRAY_SIZE (wdev->vif)) { -mutex_unlock (&wdev->conf_mutex); -return -EOPNOTSUPP ; - }// FIXME: prefer use of container_of() to get vif wvif->vif = vif; wvif->wdev = wdev;
@@ -788,12 +777,22 @@ int wfx_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)init_completion (&wvif->scan_complete);INIT_WORK (&wvif->scan_work, wfx_hw_scan_work); -mutex_unlock (&wdev->conf_mutex); +wfx_tx_queues_init (wvif); +wfx_tx_policy_init (wvif); + +for (i =0 ; i <ARRAY_SIZE (wdev->vif); i++) { +if (!wdev->vif[i]) { + wdev->vif[i] = vif; + wvif->id = i; +break ; + } + } +WARN (i ==ARRAY_SIZE (wdev->vif),"try to instantiate more vif than supported" );hif_set_macaddr (wvif, vif->addr); -wfx_tx_queues_init (wvif); -wfx_tx_policy_init (wvif); +mutex_unlock (&wdev->conf_mutex); + wvif =NULL ;while ((wvif =wvif_iterate (wdev, wvif)) !=NULL ) {// Combo mode does not support Block Acks. We can re-enable them
@@ -825,6 +824,7 @@ void wfx_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) wvif->vif =NULL ;mutex_unlock (&wdev->conf_mutex); + wvif =NULL ;while ((wvif =wvif_iterate (wdev, wvif)) !=NULL ) {// Combo mode does not support Block Acks. We can re-enable them
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 85/391 misc: fastrpc: fix common struct sg_table related issues
In reply to Greg Kroah-HartmanFrom: Marek Szyprowski <[email protected]>
[ Upstream commit 7cd7edb89437457ec36ffdbb970cc314d00c4aba ]
The Documentation/DMA-API-HOWTO.txt states that the dma_map_sg() function returns the number of the created entries in the DMA address space. However the subsequent calls to the dma_sync_sg_for_{device,cpu}() and dma_unmap_sg must be called with the original number of the entries passed to the dma_map_sg().
struct sg_table is a common structure used for describing a non-contiguous memory buffer, used commonly in the DRM and graphics subsystems. It consists of a scatterlist with memory pages and DMA addresses (sgl entry), as well as the number of scatterlist entries: CPU pages (orig_nents entry) and DMA mapped pages (nents entry).
It turned out that it was a common mistake to misuse nents and orig_nents entries, calling DMA-mapping functions with a wrong number of entries or ignoring the number of mapped entries returned by the dma_map_sg() function.
To avoid such issues, lets use a common dma-mapping wrappers operating directly on the struct sg_table objects and use scatterlist page iterators where possible. This, almost always, hides references to the nents and orig_nents entries, making the code robust, easier to follow and copy/paste safe.
--- drivers/misc/fastrpc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/misc/fastrpc.c +2 -2
@@ -518,7 +518,7 @@ fastrpc_map_dma_buf(struct dma_buf_attachment *attachment, table = &a->sgt; -if (!dma_map_sg (attachment->dev, table->sgl, table->nents, dir)) +if (!dma_map_sgtable (attachment->dev, table, dir,0 ))return ERR_PTR (-ENOMEM );return table;
@@ -528,7 +528,7 @@ static void fastrpc_unmap_dma_buf(struct dma_buf_attachment *attach,struct sg_table *table, enum dma_data_direction dir) { - dma_unmap_sg(attach->dev, table->sgl, table->nents, dir); + dma_unmap_sgtable(attach->dev, table, dir, 0); }static void fastrpc_release (struct dma_buf *dmabuf)
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 81/391 selftests/x86/fsgsbase: Reap a forgotten child
In reply to Greg Kroah-HartmanFrom: Andy Lutomirski <[email protected]>
[ Upstream commit ab2dd173330a3f07142e68cd65682205036cd00f ]
The ptrace() test forgot to reap its child. Reap it.
--- tools/testing/selftests/x86/fsgsbase.c | 3 +++ 1 file changed, 3 insertions(+)
tools/testing/selftests/x86/fsgsbase.c +3 -0
@@ -517,6 +517,9 @@ static void test_ptrace_write_gsbase(void) END:ptrace (PTRACE_CONT , child,NULL ,NULL ); +wait (&status); +if (!WIFEXITED (status)) +printf ("[WARN]\tChild didn't exit cleanly.\n" ); }int main ()
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 58/391 um: change sigio_spinlock to a mutex
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit f2d05059e15af3f70502074f4e3a504530af504a ]
Lockdep complains at boot:
=============================
[ BUG: Invalid wait context ]
5.7.0-05093-g46d91ecd597b #98 Not tainted
-----------------------------
swapper/1 is trying to lock:0000000060931b98 (&desc[i].request_mutex){+.+.}-{3:3}, at: __setup_irq+0x11d/0x623 other info that might help us debug this:
context-{4:4}
1 lock held by swapper/1:
#0: 000000006074fed8 (sigio_spinlock){+.+.}-{2:2}, at: sigio_lock+0x1a/0x1c
stack backtrace: CPU: 0 PID: 1 Comm: swapper Not tainted 5.7.0-05093-g46d91ecd597b #98 Stack: 7fa4fab0 6028dfd1 0000002a 6008bea5 7fa50700 7fa50040 7fa4fac0 6028e016 7fa4fb50 6007f6da 60959c18 00000000 Call Trace: [<60023a0e>] show_stack+0x13b/0x155 [<6028e016>] dump_stack+0x2a/0x2c [<6007f6da>] __lock_acquire+0x515/0x15f2 [<6007eb50>] lock_acquire+0x245/0x273 [<6050d9f1>] __mutex_lock+0xbd/0x325 [<6050dc76>] mutex_lock_nested+0x1d/0x1f [<6008e27e>] __setup_irq+0x11d/0x623 [<6008e8ed>] request_threaded_irq+0x169/0x1a6 [<60021eb0>] um_request_irq+0x1ee/0x24b [<600234ee>] write_sigio_irq+0x3b/0x76 [<600383ca>] sigio_broken+0x146/0x2e4 [<60020bd8>] do_one_initcall+0xde/0x281
Because we hold sigio_spinlock and then get into requesting an interrupt with a mutex.
Change the spinlock to a mutex to avoid that.
--- arch/um/kernel/sigio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/um/kernel/sigio.c +3 -3
@@ -35,14 +35,14 @@ int write_sigio_irq(int fd) }/* These are called from os-Linux/sigio.c to protect its pollfds arrays. */ -static DEFINE_SPINLOCK (sigio_spinlock); +static DEFINE_MUTEX (sigio_mutex);void sigio_lock (void ) { -spin_lock (&sigio_spinlock); +mutex_lock (&sigio_mutex); }void sigio_unlock (void ) { -spin_unlock (&sigio_spinlock); +mutex_unlock (&sigio_mutex); }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 72/391 x86/kaslr: Initialize mem_limit to the real maximum address
In reply to Greg Kroah-HartmanFrom: Arvind Sankar <[email protected]>
[ Upstream commit 451286940d95778e83fa7f97006316d995b4c4a8 ]
On 64-bit, the kernel must be placed below MAXMEM (64TiB with 4-level paging or 4PiB with 5-level paging). This is currently not enforced by KASLR, which thus implicitly relies on physical memory being limited to less than 64TiB.
On 32-bit, the limit is KERNEL_IMAGE_SIZE (512MiB). This is enforced by special checks in __process_mem_region().
Initialize mem_limit to the maximum (depending on architecture), instead of ULLONG_MAX, and make sure the command-line arguments can only decrease it. This makes the enforcement explicit on 64-bit, and eliminates the 32-bit specific checks to keep the kernel below 512M.
Check upfront to make sure the minimum address is below the limit before doing any work.
--- arch/x86/boot/compressed/kaslr.c | 41 +++++++++++++++++--------------- 1 file changed, 22 insertions(+), 19 deletions(-)
arch/x86/boot/compressed/kaslr.c +22 -19
@@ -87,8 +87,11 @@ static unsigned long get_boot_seed(void)static bool memmap_too_large; -/* Store memory limit specified by "mem=nn[KMG]" or "memmap=nn[KMG]" */ -static unsigned long long mem_limit =ULLONG_MAX ; +/* +* Store memory limit: MAXMEM on 64-bit and KERNEL_IMAGE_SIZE on 32-bit. +* It may be reduced by "mem=nn[KMG]" or "memmap=nn[KMG]" command line options. +*/ +static unsigned long long mem_limit;/* Number of immovable memory regions */ static int num_immovable_mem;
@@ -214,7 +217,7 @@ static void mem_avoid_memmap(enum parse_mode mode, char *str)if (start ==0 ) {/* Store the specified memory limit if size > 0 */ -if (size >0 ) +if (size >0 && size < mem_limit) mem_limit = size;continue ;
@@ -302,7 +305,8 @@ static void handle_mem_options(void)if (mem_size ==0 ) goto out; - mem_limit = mem_size; +if (mem_size < mem_limit) + mem_limit = mem_size; }else if (!strcmp (param,"efi_fake_mem" )) {mem_avoid_memmap (PARSE_EFI , val); }
@@ -314,7 +318,9 @@ out: }/* -* In theory, KASLR can put the kernel anywhere in the range of [16M, 64T). +* In theory, KASLR can put the kernel anywhere in the range of [16M, MAXMEM) +* on 64-bit, and [16M, KERNEL_IMAGE_SIZE) on 32-bit. +* * The mem_avoid array is used to store the ranges that need to be avoided * when KASLR searches for an appropriate random address. We must avoid any * regions that are unsafe to overlap with during decompression, and other
@@ -614,10 +620,6 @@ static void __process_mem_region(struct mem_vector *entry,unsigned long start_orig, end;struct mem_vector cur_entry; -/* On 32-bit, ignore entries entirely above our maximum. */ -if (IS_ENABLED (CONFIG_X86_32 ) && entry->start >=KERNEL_IMAGE_SIZE ) -return ; -/* Ignore entries entirely below our minimum. */ if (entry->start + entry->size < minimum)return ;
@@ -650,11 +652,6 @@ static void __process_mem_region(struct mem_vector *entry,/* Reduce size by any delta from the original address. */ region.size -= region.start - start_orig; -/* On 32-bit, reduce region size to fit within max size. */ -if (IS_ENABLED (CONFIG_X86_32 ) && - region.start + region.size >KERNEL_IMAGE_SIZE ) - region.size =KERNEL_IMAGE_SIZE - region.start; -/* Return if region can't contain decompressed kernel */ if (region.size < image_size)return ;
@@ -839,15 +836,16 @@ static void process_e820_entries(unsigned long minimum,static unsigned long find_random_phys_addr (unsigned long minimum,unsigned long image_size) { +/* Bail out early if it's impossible to succeed. */ +if (minimum + image_size > mem_limit) +return 0 ; +/* Check if we had too many memmaps. */ if (memmap_too_large) {debug_putstr ("Aborted memory entries scan (more than 4 memmap= args)!\n" );return 0 ; } -/* Make sure minimum is aligned. */ - minimum =ALIGN (minimum,CONFIG_PHYSICAL_ALIGN ); -if (process_efi_entries (minimum, image_size))return slots_fetch_random ();
@@ -860,8 +858,6 @@ static unsigned long find_random_virt_addr(unsigned long minimum, {unsigned long slots, random_addr; -/* Make sure minimum is aligned. */ - minimum =ALIGN (minimum,CONFIG_PHYSICAL_ALIGN );/* Align image_size for easy slot calculations. */ image_size =ALIGN (image_size,CONFIG_PHYSICAL_ALIGN );
@@ -908,6 +904,11 @@ void choose_random_location(unsigned long input,/* Prepare to add new identity pagetables on demand. */ initialize_identity_maps (); +if (IS_ENABLED (CONFIG_X86_32 )) + mem_limit =KERNEL_IMAGE_SIZE ; +else + mem_limit =MAXMEM ; +/* Record the various known unsafe memory ranges. */ mem_avoid_init (input, input_size, *output);
@@ -917,6 +918,8 @@ void choose_random_location(unsigned long input,* location: */ min_addr =min (*output,512UL <<20 ); +/* Make sure minimum is aligned. */ + min_addr =ALIGN (min_addr,CONFIG_PHYSICAL_ALIGN );/* Walk available memory entries to find a random address. */ random_addr =find_random_phys_addr (min_addr, output_size);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 67/391 power: supply: bq27xxx: report "not charging" on all types
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 7bf738ba110722b63e9dc8af760d3fb2aef25593 ]
Commit 6f24ff97e323 ("power: supply: bq27xxx_battery: Add the BQ27Z561 Battery monitor") and commit d74534c27775 ("power:bq27xxx_battery: Add support for additional bq27xxx family devices") added support for new device types by copying most of the code and adding necessary quirks.
However they did not copy the code in bq27xxx_battery_status() responsible for returning POWER_SUPPLY_STATUS_NOT_CHARGING.
Unify the bq27xxx_battery_status() so for all types when charger is supplied, it will return "not charging" status.
--- drivers/power/supply/bq27xxx_battery.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/power/supply/bq27xxx_battery.c +4 -2
@@ -1772,8 +1772,6 @@ static int bq27xxx_battery_status(struct bq27xxx_device_info *di, status =POWER_SUPPLY_STATUS_FULL ; else if (di->cache.flags & BQ27000_FLAG_CHGS) status =POWER_SUPPLY_STATUS_CHARGING ; - else if (power_supply_am_i_supplied(di->bat) > 0) - status =POWER_SUPPLY_STATUS_NOT_CHARGING ; else status =POWER_SUPPLY_STATUS_DISCHARGING ; }else if (di->opts &BQ27Z561_O_BITS ) {
@@ -1792,6 +1790,10 @@ static int bq27xxx_battery_status(struct bq27xxx_device_info *di, status =POWER_SUPPLY_STATUS_CHARGING ; } +if ((status ==POWER_SUPPLY_STATUS_DISCHARGING ) && + (power_supply_am_i_supplied (di->bat) >0 )) + status =POWER_SUPPLY_STATUS_NOT_CHARGING ; + val->intval = status;return 0 ;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 57/391 s390/ap/zcrypt: revisit ap and zcrypt error handling
In reply to Greg Kroah-HartmanFrom: Harald Freudenberger <[email protected]>
[ Upstream commit e0332629e33d1926c93348d918aaaf451ef9a16b ]
Revisit the ap queue error handling: Based on discussions and evaluatios with the firmware folk here is now a rework of the response code handling for all the AP instructions. The idea is to distinguish between failures because of some kind of invalid request where a retry does not make any sense and a failure where another attempt to send the very same request may succeed. The first case is handled by returning EINVAL to the userspace application. The second case results in retries within the zcrypt API controlled by a per message retry counter.
Revisit the zcrpyt error handling: Similar here, based on discussions with the firmware people here comes a rework of the handling of all the reply codes. Main point here is that there are only very few cases left, where a zcrypt device queue is switched to offline. It should never be the case that an AP reply message is 'unknown' to the device driver as it indicates a total mismatch between device driver and crypto card firmware. In all other cases, the code distinguishes between failure because of invalid message (see above - EINVAL) or failures of the infrastructure (see above - EAGAIN).
--- drivers/s390/crypto/ap_bus.h | 1 + drivers/s390/crypto/ap_queue.c | 8 +-- drivers/s390/crypto/zcrypt_debug.h | 8 +++ drivers/s390/crypto/zcrypt_error.h | 88 +++++++++--------------- drivers/s390/crypto/zcrypt_msgtype50.c | 50 +++++++------- drivers/s390/crypto/zcrypt_msgtype6.c | 92 +++++++++++++------------- 6 files changed, 116 insertions(+), 131 deletions(-)
drivers/s390/crypto/ap_bus.h +1 -0
@@ -50,6 +50,7 @@ static inline int ap_test_bit(unsigned int *ptr, unsigned int nr)#define AP_RESPONSE_NO_FIRST_PART 0x13#define AP_RESPONSE_MESSAGE_TOO_BIG 0x15#define AP_RESPONSE_REQ_FAC_NOT_INST 0x16 +#define AP_RESPONSE_INVALID_DOMAIN 0x42/* * Known device types
drivers/s390/crypto/ap_queue.c +3 -5
@@ -237,6 +237,9 @@ static enum ap_sm_wait ap_sm_write(struct ap_queue *aq)case AP_RESPONSE_RESET_IN_PROGRESS : aq->sm_state =AP_SM_STATE_RESET_WAIT ;return AP_SM_WAIT_TIMEOUT ; +case AP_RESPONSE_INVALID_DOMAIN : +AP_DBF (DBF_WARN ,"AP_RESPONSE_INVALID_DOMAIN on NQAP\n" ); + fallthrough;case AP_RESPONSE_MESSAGE_TOO_BIG :case AP_RESPONSE_REQ_FAC_NOT_INST :list_del_init (&ap_msg->list);
@@ -278,11 +281,6 @@ static enum ap_sm_wait ap_sm_reset(struct ap_queue *aq) aq->sm_state =AP_SM_STATE_RESET_WAIT ; aq->interrupt =AP_INTR_DISABLED ;return AP_SM_WAIT_TIMEOUT ; -case AP_RESPONSE_BUSY : -return AP_SM_WAIT_TIMEOUT ; -case AP_RESPONSE_Q_NOT_AVAIL : -case AP_RESPONSE_DECONFIGURED : -case AP_RESPONSE_CHECKSTOPPED :default : aq->sm_state =AP_SM_STATE_BORKED ;return AP_SM_WAIT_NONE ;
drivers/s390/crypto/zcrypt_debug.h +8 -0
@@ -21,6 +21,14 @@#define ZCRYPT_DBF (...) \ debug_sprintf_event(zcrypt_dbf_info, ##__VA_ARGS__) +#define ZCRYPT_DBF_ERR (...) \ + debug_sprintf_event(zcrypt_dbf_info, DBF_ERR, ##__VA_ARGS__) +#define ZCRYPT_DBF_WARN (...) \ + debug_sprintf_event(zcrypt_dbf_info, DBF_WARN, ##__VA_ARGS__) +#define ZCRYPT_DBF_INFO (...) \ + debug_sprintf_event(zcrypt_dbf_info, DBF_INFO, ##__VA_ARGS__) +#define ZCRYPT_DBF_DBG (...) \ + debug_sprintf_event(zcrypt_dbf_info, DBF_DEBUG, ##__VA_ARGS__)extern debug_info_t *zcrypt_dbf_info;
drivers/s390/crypto/zcrypt_error.h +32 -56
124 lines not on this page · raw message
drivers/s390/crypto/zcrypt_msgtype50.c +26 -24
82 lines not on this page · raw message
drivers/s390/crypto/zcrypt_msgtype6.c +46 -46
131 lines not on this page · raw message
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 23/391 RDMA/mlx5: Fix devlink deadlock on net namespace deletion
In reply to Greg Kroah-HartmanFrom: Parav Pandit <[email protected]>
[ Upstream commit fbdd0049d98d44914fc57d4b91f867f4996c787b ]
When a mlx5 core devlink instance is reloaded in different net namespace, its associated IB device is deleted and recreated.
Example sequence is:
$ ip netns add foo $ devlink dev reload pci/0000:00:08.0 netns foo $ ip netns del foo
mlx5 IB device needs to attach and detach the netdevice to it through the netdev notifier chain during load and unload sequence. A below call graph of the unload flow.
cleanup_net()
down_read(&pernet_ops_rwsem); <- first sem acquired
ops_pre_exit_list()
pre_exit()
devlink_pernet_pre_exit()
devlink_reload()
mlx5_devlink_reload_down()
mlx5_unload_one()
[...]
mlx5_ib_remove()
mlx5_ib_unbind_slave_port()
mlx5_remove_netdev_notifier()
unregister_netdevice_notifier()
down_write(&pernet_ops_rwsem);<- recurrsive lockHence, when net namespace is deleted, mlx5 reload results in deadlock.
When deadlock occurs, devlink mutex is also held. This not only deadlocks the mlx5 device under reload, but all the processes which attempt to access unrelated devlink devices are deadlocked.
Hence, fix this by mlx5 ib driver to register for per net netdev notifier instead of global one, which operats on the net namespace without holding the pernet_ops_rwsem.
--- drivers/infiniband/hw/mlx5/main.c | 6 ++++-- .../net/ethernet/mellanox/mlx5/core/lib/mlx5.h | 5 ----- include/linux/mlx5/driver.h | 18 ++++++++++++++++++ 3 files changed, 22 insertions(+), 7 deletions(-)
drivers/infiniband/hw/mlx5/main.c +4 -2
@@ -3318,7 +3318,8 @@ static int mlx5_add_netdev_notifier(struct mlx5_ib_dev *dev, u8 port_num)int err; dev->port[port_num].roce.nb.notifier_call = mlx5_netdev_event; - err =register_netdevice_notifier (&dev->port[port_num].roce.nb); + err =register_netdevice_notifier_net (mlx5_core_net (dev->mdev), + &dev->port[port_num].roce.nb);if (err) { dev->port[port_num].roce.nb.notifier_call =NULL ;return err;
@@ -3330,7 +3331,8 @@ static int mlx5_add_netdev_notifier(struct mlx5_ib_dev *dev, u8 port_num)static void mlx5_remove_netdev_notifier (struct mlx5_ib_dev *dev,u8 port_num) {if (dev->port[port_num].roce.nb.notifier_call) { -unregister_netdevice_notifier (&dev->port[port_num].roce.nb); +unregister_netdevice_notifier_net (mlx5_core_net (dev->mdev), + &dev->port[port_num].roce.nb); dev->port[port_num].roce.nb.notifier_call =NULL ; } }
drivers/net/ethernet/mellanox/mlx5/core/lib/mlx5.h +0 -5
@@ -90,9 +90,4 @@ int mlx5_create_encryption_key(struct mlx5_core_dev *mdev, u32 key_type, u32 *p_key_id);void mlx5_destroy_encryption_key (struct mlx5_core_dev *mdev,u32 key_id); -static inline struct net *mlx5_core_net (struct mlx5_core_dev *dev) -{ -return devlink_net (priv_to_devlink (dev)); -} -#endif
include/linux/mlx5/driver.h +18 -0
@@ -1212,4 +1212,22 @@ static inline bool mlx5_is_roce_enabled(struct mlx5_core_dev *dev) return val.vbool; } +/** +* mlx5_core_net - Provide net namespace of the mlx5_core_dev +* @dev: mlx5 core device +* +* mlx5_core_net() returns the net namespace of mlx5 core device. +* This can be called only in below described limited context. +* (a) When a devlink instance for mlx5_core is registered and +* when devlink reload operation is disabled. +* or +* (b) during devlink reload reload_down() and reload_up callbacks +* where it is ensured that devlink instance's net namespace is +* stable. +*/ +static inline struct net *mlx5_core_net (struct mlx5_core_dev *dev) +{ +return devlink_net (priv_to_devlink (dev)); +} +#endif /* MLX5_DRIVER_H */
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 90/391 drm/vkms: avoid warning in vkms_get_vblank_timestamp
In reply to Greg Kroah-HartmanFrom: Sidong Yang <[email protected]>
[ Upstream commit 05ca530268a9d0ab3547e7b288635e35990a77c4 ]
This patch avoid the warning in vkms_get_vblank_timestamp when vblanks aren't enabled. When running igt test kms_cursor_crc just after vkms module, the warning raised like below. Initial value of vblank time is zero and hrtimer.node.expires is also zero if vblank aren't enabled before. vkms module isn't real hardware but just virtual hardware module. so vkms can't generate a resonable timestamp when hrtimer is off. it's best to grab the current time.
[106444.464503] [IGT] kms_cursor_crc: starting subtest pipe-A-cursor-size-change [106444.471475] WARNING: CPU: 0 PID: 10109 at vkms_get_vblank_timestamp+0x42/0x50 [vkms] [106444.471511] CPU: 0 PID: 10109 Comm: kms_cursor_crc Tainted: G W OE 5.9.0-rc1+ #6 [106444.471514] RIP: 0010:vkms_get_vblank_timestamp+0x42/0x50 [vkms] [106444.471528] Call Trace: [106444.471551] drm_get_last_vbltimestamp+0xb9/0xd0 [drm] [106444.471566] drm_reset_vblank_timestamp+0x63/0xe0 [drm] [106444.471579] drm_crtc_vblank_on+0x85/0x150 [drm] [106444.471582] vkms_crtc_atomic_enable+0xe/0x10 [vkms] [106444.471592] drm_atomic_helper_commit_modeset_enables+0x1db/0x230 [drm_kms_helper] [106444.471594] vkms_atomic_commit_tail+0x38/0xc0 [vkms] [106444.471601] commit_tail+0x97/0x130 [drm_kms_helper] [106444.471608] drm_atomic_helper_commit+0x117/0x140 [drm_kms_helper] [106444.471622] drm_atomic_commit+0x4a/0x50 [drm] [106444.471629] drm_atomic_helper_set_config+0x63/0xb0 [drm_kms_helper] [106444.471642] drm_mode_setcrtc+0x1d9/0x7b0 [drm] [106444.471654] ? drm_mode_getcrtc+0x1a0/0x1a0 [drm] [106444.471666] drm_ioctl_kernel+0xb6/0x100 [drm] [106444.471677] drm_ioctl+0x3ad/0x470 [drm] [106444.471688] ? drm_mode_getcrtc+0x1a0/0x1a0 [drm] [106444.471692] ? tomoyo_file_ioctl+0x19/0x20 [106444.471694] __x64_sys_ioctl+0x96/0xd0 [106444.471697] do_syscall_64+0x37/0x80 [106444.471699] entry_SYSCALL_64_after_hwframe+0x44/0xa9
--- drivers/gpu/drm/vkms/vkms_crtc.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/vkms/vkms_crtc.c +5 -0
@@ -86,6 +86,11 @@ static bool vkms_get_vblank_timestamp(struct drm_crtc *crtc,struct vkms_output *output = &vkmsdev->output;struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; +if (!READ_ONCE (vblank->enabled)) { + *vblank_time =ktime_get (); +return true; + } + *vblank_time =READ_ONCE (output->vblank_hrtimer.node.expires);if (WARN_ON (*vblank_time == vblank->time))
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 20/391 firmware: arm_scmi: Fix duplicate workqueue name
In reply to Greg Kroah-HartmanFrom: Florian Fainelli <[email protected]>
[ Upstream commit b9ceca6be43233845be70792be9b5ab315d2e010 ]
When more than a single SCMI device are present in the system, the creation of the notification workqueue with the WQ_SYSFS flag will lead to the following sysfs duplicate node warning:
sysfs: cannot create duplicate filename '/devices/virtual/workqueue/scmi_notify'
CPU: 0 PID: 20 Comm: kworker/0:1 Not tainted 5.9.0-gdf4dd84a3f7d #29 Hardware name: Broadcom STB (Flattened Device Tree) Workqueue: events deferred_probe_work_func Backtrace: show_stack + 0x20/0x24 dump_stack + 0xbc/0xe0 sysfs_warn_dup + 0x70/0x80 sysfs_create_dir_ns + 0x15c/0x1a4 kobject_add_internal + 0x140/0x4d0 kobject_add + 0xc8/0x138 device_add + 0x1dc/0xc20 device_register + 0x24/0x28 workqueue_sysfs_register + 0xe4/0x1f0 alloc_workqueue + 0x448/0x6ac scmi_notification_init + 0x78/0x1dc scmi_probe + 0x268/0x4fc platform_drv_probe + 0x70/0xc8 really_probe + 0x184/0x728 driver_probe_device + 0xa4/0x278 __device_attach_driver + 0xe8/0x148 bus_for_each_drv + 0x108/0x158 __device_attach + 0x190/0x234 device_initial_probe + 0x1c/0x20 bus_probe_device + 0xdc/0xec deferred_probe_work_func + 0xd4/0x11c process_one_work + 0x420/0x8f0 worker_thread + 0x4fc/0x91c kthread + 0x21c/0x22c ret_from_fork + 0x14/0x20 kobject_add_internal failed for scmi_notify with -EEXIST, don't try to register things with the same name in the same directory. arm-scmi brcm_scmi@1: SCMI Notifications - Initialization Failed. arm-scmi brcm_scmi@1: SCMI Notifications NOT available. arm-scmi brcm_scmi@1: SCMI Protocol v1.0 'brcm-scmi:' Firmware version 0x1
Fix this by using dev_name(handle->dev) which guarantees that the name is unique and this also helps correlate which notification workqueue corresponds to which SCMI device instance.
--- drivers/firmware/arm_scmi/notify.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/arm_scmi/notify.c +1 -1
@@ -1474,7 +1474,7 @@ int scmi_notification_init(struct scmi_handle *handle) ni->gid = gid; ni->handle = handle; - ni->notify_wq =alloc_workqueue ("scmi_notify" , + ni->notify_wq =alloc_workqueue (dev_name (handle->dev),WQ_UNBOUND |WQ_FREEZABLE |WQ_SYSFS ,0 );if (!ni->notify_wq)
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 54/391 f2fs: fix to check segment boundary during SIT page readahead
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
[ Upstream commit 6a257471fa42c8c9c04a875cd3a2a22db148e0f0 ]
As syzbot reported:
kernel BUG at fs/f2fs/segment.h:657!
invalid opcode: 0000 [#1] PREEMPT SMP KASAN
CPU: 1 PID: 16220 Comm: syz-executor.0 Not tainted 5.9.0-rc5-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:f2fs_ra_meta_pages+0xa51/0xdc0 fs/f2fs/segment.h:657 Call Trace: build_sit_entries fs/f2fs/segment.c:4195 [inline] f2fs_build_segment_manager+0x4b8a/0xa3c0 fs/f2fs/segment.c:4779 f2fs_fill_super+0x377d/0x6b80 fs/f2fs/super.c:3633 mount_bdev+0x32e/0x3f0 fs/super.c:1417 legacy_get_tree+0x105/0x220 fs/fs_context.c:592 vfs_get_tree+0x89/0x2f0 fs/super.c:1547 do_new_mount fs/namespace.c:2875 [inline] path_mount+0x1387/0x2070 fs/namespace.c:3192 do_mount fs/namespace.c:3205 [inline] __do_sys_mount fs/namespace.c:3413 [inline] __se_sys_mount fs/namespace.c:3390 [inline] __x64_sys_mount+0x27f/0x300 fs/namespace.c:3390 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9
@blkno in f2fs_ra_meta_pages could exceed max segment count, causing panic in following sanity check in current_sit_addr(), add check condition to avoid this issue.
--- fs/f2fs/checkpoint.c | 2 ++ 1 file changed, 2 insertions(+)
fs/f2fs/checkpoint.c +2 -0
@@ -243,6 +243,8 @@ int f2fs_ra_meta_pages(struct f2fs_sb_info *sbi, block_t start, int nrpages, blkno * NAT_ENTRY_PER_BLOCK);break ;case META_SIT : +if (unlikely (blkno >=TOTAL_SEGS (sbi))) + goto out;/* get sit block addr */ fio.new_blkaddr =current_sit_addr (sbi, blkno *SIT_ENTRY_PER_BLOCK );
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 32/391 afs: Fix page leak on afs_write_begin() failure
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit 21db2cdc667f744691a407105b7712bc18d74023 ]
Fix the leak of the target page in afs_write_begin() when it fails.
--- fs/afs/write.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-)
fs/afs/write.c +11 -12
@@ -76,7 +76,7 @@ static int afs_fill_page(struct afs_vnode *vnode, struct key *key,*/ int afs_write_begin (struct file *file,struct address_space *mapping,loff_t pos,unsigned len,unsigned flags, -struct page **pagep,void **fsdata) +struct page **_page,void **fsdata) {struct afs_vnode *vnode =AFS_FS_I (file_inode (file));struct page *page;
@@ -110,9 +110,6 @@ int afs_write_begin(struct file *file, struct address_space *mapping,SetPageUptodate (page); } -/* page won't leak in error case: it eventually gets cleaned off LRU */ - *pagep = page; - try_again:/* See if this page is already partially written in a way that we can * merge the new write with.
@@ -155,6 +152,7 @@ try_again:set_page_private (page, priv); else attach_page_private(page, (void *)priv); + *_page = page;_leave (" = 0" );return 0 ;
@@ -164,17 +162,18 @@ try_again: flush_conflicting_write:_debug ("flush conflict" ); ret =write_one_page (page); -if (ret <0 ) { -_leave (" = %d" , ret); -return ret; - } +if (ret <0 ) + goto error; ret =lock_page_killable (page); -if (ret <0 ) { -_leave (" = %d" , ret); -return ret; - } +if (ret <0 ) + goto error; goto try_again; + +error: +put_page (page); +_leave (" = %d" , ret); +return ret; }/*
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 30/391 arm64: efi: increase EFI PE/COFF header padding to 64 KB
In reply to Greg Kroah-HartmanFrom: Ard Biesheuvel <[email protected]>
[ Upstream commit a2d50c1c77aa879af24f9f67b33186737b3d4885 ]
Commit 76085aff29f5 ("efi/libstub/arm64: align PE/COFF sections to segment alignment") increased the PE/COFF section alignment to match the minimum segment alignment of the kernel image, which ensures that the kernel does not need to be moved around in memory by the EFI stub if it was built as relocatable.
However, the first PE/COFF section starts at _stext, which is only 4 KB aligned, and so the section layout is inconsistent. Existing EFI loaders seem to care little about this, but it is better to clean this up.
So let's pad the header to 64 KB to match the PE/COFF section alignment.
--- arch/arm64/kernel/efi-header.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/efi-header.S +1 -1
@@ -147,6 +147,6 @@ efi_debug_entry: * correctly at this alignment, we must ensure that .text is * placed at a 4k boundary in the Image to begin with. */ - .align 12 + .balign SEGMENT_ALIGN efi_header_end: .endm
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 29/391 ata: sata_nv: Fix retrieving of active qcs
In reply to Greg Kroah-HartmanFrom: Sascha Hauer <[email protected]>
[ Upstream commit 8e4c309f9f33b76c09daa02b796ef87918eee494 ]
ata_qc_complete_multiple() has to be called with the tags physically active, that is the hw tag is at bit 0. ap->qc_active has the same tag at bit ATA_TAG_INTERNAL instead, so call ata_qc_get_active() to fix that up. This is done in the vein of 8385d756e114 ("libata: Fix retrieving of active qcs").
--- drivers/ata/sata_nv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ata/sata_nv.c +1 -1
@@ -2100,7 +2100,7 @@ static int nv_swncq_sdbfis(struct ata_port *ap) pp->dhfis_bits &= ~done_mask; pp->dmafis_bits &= ~done_mask; pp->sdbfis_bits |= done_mask; -ata_qc_complete_multiple (ap, ap->qc_active ^ done_mask); +ata_qc_complete_multiple (ap,ata_qc_get_active (ap) ^ done_mask);if (!ap->qc_active) {DPRINTK ("over\n" );
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 25/391 tracing, synthetic events: Replace buggy strcat() with seq_buf operations
In reply to Greg Kroah-Hartman[ Upstream commit 761a8c58db6bc884994b28cd6d9707b467d680c1 ]
There was a memory corruption bug happening while running the synthetic event selftests:
kmemleak: Cannot insert 0xffff8c196fa2afe5 into the object search tree (overlaps existing)
CPU: 5 PID: 6866 Comm: ftracetest Tainted: G W 5.9.0-rc5-test+ #577
Hardware name: Hewlett-Packard HP Compaq Pro 6300 SFF/339A, BIOS K01 v03.03 07/14/2016
Call Trace:
dump_stack+0x8d/0xc0
create_object.cold+0x3b/0x60
slab_post_alloc_hook+0x57/0x510
? tracing_map_init+0x178/0x340
__kmalloc+0x1b1/0x390
tracing_map_init+0x178/0x340
event_hist_trigger_func+0x523/0xa40
trigger_process_regex+0xc5/0x110
event_trigger_write+0x71/0xd0
vfs_write+0xca/0x210
ksys_write+0x70/0xf0
do_syscall_64+0x33/0x40
entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x7fef0a63a487
Code: 64 89 02 48 c7 c0 ff ff ff ff eb bb 0f 1f 80 00 00 00 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 51 c3 48 83 ec 28 48 89 54 24 18 48 89 74 24
RSP: 002b:00007fff76f18398 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 0000000000000039 RCX: 00007fef0a63a487
RDX: 0000000000000039 RSI: 000055eb3b26d690 RDI: 0000000000000001
RBP: 000055eb3b26d690 R08: 000000000000000a R09: 0000000000000038
R10: 000055eb3b2cdb80 R11: 0000000000000246 R12: 0000000000000039
R13: 00007fef0a70b500 R14: 0000000000000039 R15: 00007fef0a70b700
kmemleak: Kernel memory leak detector disabled
kmemleak: Object 0xffff8c196fa2afe0 (size 8):
kmemleak: comm "ftracetest", pid 6866, jiffies 4295082531
kmemleak: min_count = 1
kmemleak: count = 0
kmemleak: flags = 0x1
kmemleak: checksum = 0
kmemleak: backtrace:
__kmalloc+0x1b1/0x390
tracing_map_init+0x1be/0x340
event_hist_trigger_func+0x523/0xa40
trigger_process_regex+0xc5/0x110
event_trigger_write+0x71/0xd0
vfs_write+0xca/0x210
ksys_write+0x70/0xf0
do_syscall_64+0x33/0x40
entry_SYSCALL_64_after_hwframe+0x44/0xa9The cause came down to a use of strcat() that was adding an string that was shorten, but the strcat() did not take that into account.
strcat() is extremely dangerous as it does not care how big the buffer is. Replace it with seq_buf operations that prevent the buffer from being overwritten if what is being written is bigger than the buffer.
--- kernel/trace/trace_events_synth.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-)
kernel/trace/trace_events_synth.c +12 -11
@@ -465,6 +465,7 @@ static struct synth_field *parse_synth_field(int argc, const char **argv,struct synth_field *field;const char *prefix =NULL , *field_type = argv[0 ], *field_name, *array;int len, ret =0 ; +struct seq_buf s;ssize_t size;if (field_type[0 ] ==';' )
@@ -503,13 +504,9 @@ static struct synth_field *parse_synth_field(int argc, const char **argv, field_type++; len =strlen (field_type) +1 ; -if (array) { -int l =strlen (array); +if (array) + len +=strlen (array); -if (l && array[l -1 ] ==';' ) - l--; - len += l; - }if (prefix) len +=strlen (prefix);
@@ -518,14 +515,18 @@ static struct synth_field *parse_synth_field(int argc, const char **argv, ret = -ENOMEM ; goto free; } +seq_buf_init (&s, field->type, len);if (prefix) -strcat (field->type, prefix); -strcat (field->type, field_type); +seq_buf_puts (&s, prefix); +seq_buf_puts (&s, field_type);if (array) { -strcat (field->type, array); -if (field->type[len -1 ] ==';' ) - field->type[len -1 ] ='\0' ; +seq_buf_puts (&s, array); +if (s.buffer[s.len -1 ] ==';' ) + s.len--; } +if (WARN_ON_ONCE (!seq_buf_buffer_left (&s))) + goto free; + s.buffer[s.len] ='\0' ; size =synth_field_size (field->type);if (size <=0 ) {
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 8/391 xen/pvcallsback: use lateeoi irq binding
In reply to Greg Kroah-HartmanFrom: Juergen Gross <[email protected]>
commit c8d647a326f06a39a8e5f0f1af946eacfa1835f8 upstream.
In order to reduce the chance for the system becoming unresponsive due to event storms triggered by a misbehaving pvcallsfront use the lateeoi irq binding for pvcallsback and unmask the event channel only after handling all write requests, which are the ones coming in via an irq.
This requires modifying the logic a little bit to not require an event for each write request, but to keep the ioworker running until no further data is found on the ring page to be processed.
This is part of XSA-332.
--- drivers/xen/pvcalls-back.c | 76 +++++++++++++++++++++++++++------------------ 1 file changed, 46 insertions(+), 30 deletions(-)
drivers/xen/pvcalls-back.c +46 -30
@@ -66,6 +66,7 @@ struct sock_mapping {atomic_t write;atomic_t io;atomic_t release; +atomic_t eoi;void (*saved_data_ready)(struct sock *sk);struct pvcalls_ioworker ioworker; };
@@ -87,7 +88,7 @@ static int pvcalls_back_release_active(sstruct pvcalls_fedata *fedata, struct sock_mapping *map); -static void pvcalls_conn_back_read (void *opaque) +static bool pvcalls_conn_back_read (void *opaque) {struct sock_mapping *map = (struct sock_mapping *)opaque;struct msghdr msg;
@@ -107,17 +108,17 @@ static void pvcalls_conn_back_read(voidvirt_mb ();if (error) -return ; +return false; size =pvcalls_queued (prod, cons, array_size);if (size >= array_size) -return ; +return false;spin_lock_irqsave (&map->sock->sk->sk_receive_queue.lock, flags);if (skb_queue_empty (&map->sock->sk->sk_receive_queue)) {atomic_set (&map->read,0 );spin_unlock_irqrestore (&map->sock->sk->sk_receive_queue.lock, flags); -return ; +return true; }spin_unlock_irqrestore (&map->sock->sk->sk_receive_queue.lock, flags); wanted = array_size - size;
@@ -141,7 +142,7 @@ static void pvcalls_conn_back_read(void ret =inet_recvmsg (map->sock, &msg, wanted,MSG_DONTWAIT );WARN_ON (ret > wanted);if (ret == -EAGAIN )/* shouldn't happen */ -return ; +return true;if (!ret) ret = -ENOTCONN ;spin_lock_irqsave (&map->sock->sk->sk_receive_queue.lock, flags);
@@ -160,10 +161,10 @@ static void pvcalls_conn_back_read(voidvirt_wmb ();notify_remote_via_irq (map->irq); -return ; +return true; } -static void pvcalls_conn_back_write (struct sock_mapping *map) +static bool pvcalls_conn_back_write (struct sock_mapping *map) {struct pvcalls_data_intf *intf = map->ring;struct pvcalls_data *data = &map->data;
@@ -180,7 +181,7 @@ static void pvcalls_conn_back_write(stru array_size =XEN_FLEX_RING_SIZE (map->ring_order); size =pvcalls_queued (prod, cons, array_size);if (size ==0 ) -return ; +return false;memset (&msg,0 ,sizeof (msg)); msg.msg_flags |=MSG_DONTWAIT ;
@@ -198,12 +199,11 @@ static void pvcalls_conn_back_write(struatomic_set (&map->write,0 ); ret =inet_sendmsg (map->sock, &msg, size); -if (ret == -EAGAIN || (ret >=0 && ret < size)) { +if (ret == -EAGAIN ) {atomic_inc (&map->write);atomic_inc (&map->io); +return true; } -if (ret == -EAGAIN ) -return ;/* write the data, then update the indexes */ virt_wmb ();
@@ -216,9 +216,13 @@ static void pvcalls_conn_back_write(stru }/* update the indexes, then notify the other end */ virt_wmb (); -if (prod != cons + ret) +if (prod != cons + ret) {atomic_inc (&map->write); +atomic_inc (&map->io); + }notify_remote_via_irq (map->irq); + +return true; }static void pvcalls_back_ioworker (struct work_struct *work)
@@ -227,6 +231,7 @@ static void pvcalls_back_ioworker(struct struct pvcalls_ioworker, register_work); struct sock_mapping *map = container_of(ioworker, struct sock_mapping, ioworker); +unsigned int eoi_flags =XEN_EOI_FLAG_SPURIOUS ;while (atomic_read (&map->io) >0 ) {if (atomic_read (&map->release) >0 ) {
@@ -234,10 +239,18 @@ static void pvcalls_back_ioworker(structreturn ; } -if (atomic_read (&map->read) >0 ) -pvcalls_conn_back_read (map); -if (atomic_read (&map->write) >0 ) -pvcalls_conn_back_write (map); +if (atomic_read (&map->read) >0 && +pvcalls_conn_back_read (map)) + eoi_flags =0 ; +if (atomic_read (&map->write) >0 && +pvcalls_conn_back_write (map)) + eoi_flags =0 ; + +if (atomic_read (&map->eoi) >0 && !atomic_read (&map->write)) { +atomic_set (&map->eoi,0 ); +xen_irq_lateeoi (map->irq, eoi_flags); + eoi_flags =XEN_EOI_FLAG_SPURIOUS ; + }atomic_dec (&map->io); }
@@ -334,12 +347,9 @@ static struct sock_mapping *pvcalls_new_ goto out; map->bytes = page; - ret =bind_interdomain_evtchn_to_irqhandler (fedata->dev->otherend_id, - evtchn, - pvcalls_back_conn_event, -0 , -"pvcalls-backend" , - map); + ret =bind_interdomain_evtchn_to_irqhandler_lateeoi ( + fedata->dev->otherend_id, evtchn, + pvcalls_back_conn_event,0 ,"pvcalls-backend" , map);if (ret <0 ) goto out; map->irq = ret;
@@ -873,15 +883,18 @@ static irqreturn_t pvcalls_back_event(in {struct xenbus_device *dev = dev_id;struct pvcalls_fedata *fedata =NULL ; +unsigned int eoi_flags =XEN_EOI_FLAG_SPURIOUS ; -if (dev ==NULL ) -return IRQ_HANDLED ; +if (dev) { + fedata =dev_get_drvdata (&dev->dev); +if (fedata) { +pvcalls_back_work (fedata); + eoi_flags =0 ; + } + } - fedata =dev_get_drvdata (&dev->dev); -if (fedata ==NULL ) -return IRQ_HANDLED ; +xen_irq_lateeoi (irq, eoi_flags); -pvcalls_back_work (fedata);return IRQ_HANDLED ; }
@@ -891,12 +904,15 @@ static irqreturn_t pvcalls_back_conn_evestruct pvcalls_ioworker *iow;if (map ==NULL || map->sock ==NULL || map->sock->sk ==NULL || - map->sock->sk->sk_user_data != map) + map->sock->sk->sk_user_data != map) { +xen_irq_lateeoi (irq,0 );return IRQ_HANDLED ; + } iow = &map->ioworker;atomic_inc (&map->write); +atomic_inc (&map->eoi);atomic_inc (&map->io);queue_work (iow->wq, &iow->register_work);
@@ -932,7 +948,7 @@ static int backend_connect(struct xenbus goto error; } - err =bind_interdomain_evtchn_to_irq (dev->otherend_id, evtchn); + err =bind_interdomain_evtchn_to_irq_lateeoi (dev->otherend_id, evtchn);if (err <0 ) goto error; fedata->irq = err;
Greg Kroah-Hartman
maintainerPATCH 6/391 xen/netback: use lateeoi irq binding
In reply to Greg Kroah-HartmanFrom: Juergen Gross <[email protected]>
commit 23025393dbeb3b8b3b60ebfa724cdae384992e27 upstream.
In order to reduce the chance for the system becoming unresponsive due to event storms triggered by a misbehaving netfront use the lateeoi irq binding for netback and unmask the event channel only just before going to sleep waiting for new events.
Make sure not to issue an EOI when none is pending by introducing an eoi_pending element to struct xenvif_queue.
When no request has been consumed set the spurious flag when sending the EOI for an interrupt.
This is part of XSA-332.
--- drivers/net/xen-netback/common.h | 15 ++++++++ drivers/net/xen-netback/interface.c | 61 ++++++++++++++++++++++++++++++------ drivers/net/xen-netback/netback.c | 11 +++++- drivers/net/xen-netback/rx.c | 13 +++++-- 4 files changed, 86 insertions(+), 14 deletions(-)
drivers/net/xen-netback/common.h +15 -0
@@ -140,6 +140,20 @@ struct xenvif_queue { /* Per-queue datachar name[QUEUE_NAME_SIZE ];/* DEVNAME-qN */ struct xenvif *vif;/* Parent VIF */ +/* +* TX/RX common EOI handling. +* When feature-split-event-channels = 0, interrupt handler sets +* NETBK_COMMON_EOI, otherwise NETBK_RX_EOI and NETBK_TX_EOI are set +* by the RX and TX interrupt handlers. +* RX and TX handler threads will issue an EOI when either +* NETBK_COMMON_EOI or their specific bits (NETBK_RX_EOI or +* NETBK_TX_EOI) are set and they will reset those bits. +*/ +atomic_t eoi_pending; +#define NETBK_RX_EOI 0x01 +#define NETBK_TX_EOI 0x02 +#define NETBK_COMMON_EOI 0x04 +/* Use NAPI for guest TX */ struct napi_struct napi;/* When feature-split-event-channels = 0, tx_irq = rx_irq. */
@@ -378,6 +392,7 @@ int xenvif_dealloc_kthread(void *data);irqreturn_t xenvif_ctrl_irq_fn (int irq,void *data); +bool xenvif_have_rx_work (struct xenvif_queue *queue,bool test_kthread);void xenvif_rx_action (struct xenvif_queue *queue);void xenvif_rx_queue_tail (struct xenvif_queue *queue,struct sk_buff *skb);
drivers/net/xen-netback/interface.c +52 -9
111 lines not on this page · raw message
drivers/net/xen-netback/netback.c +10 -1
@@ -169,6 +169,10 @@ void xenvif_napi_schedule_or_enable_evenif (more_to_do)napi_schedule (&queue->napi); +else if (atomic_fetch_andnot (NETBK_TX_EOI |NETBK_COMMON_EOI , + &queue->eoi_pending) & + (NETBK_TX_EOI |NETBK_COMMON_EOI )) +xen_irq_lateeoi (queue->tx_irq,0 ); }static void tx_add_credit (struct xenvif_queue *queue)
@@ -1643,9 +1647,14 @@ static bool xenvif_ctrl_work_todo(structirqreturn_t xenvif_ctrl_irq_fn (int irq,void *data) {struct xenvif *vif = data; +unsigned int eoi_flag =XEN_EOI_FLAG_SPURIOUS ; -while (xenvif_ctrl_work_todo (vif)) +while (xenvif_ctrl_work_todo (vif)) {xenvif_ctrl_action (vif); + eoi_flag =0 ; + } + +xen_irq_lateeoi (irq, eoi_flag);return IRQ_HANDLED ; }
drivers/net/xen-netback/rx.c +9 -4
@@ -503,13 +503,13 @@ static bool xenvif_rx_queue_ready(structreturn queue->stalled && prod - cons >=1 ; } -static bool xenvif_have_rx_work (struct xenvif_queue *queue) +bool xenvif_have_rx_work (struct xenvif_queue *queue,bool test_kthread) {return xenvif_rx_ring_slots_available (queue) || (queue->vif->stall_timeout && (xenvif_rx_queue_stalled (queue) ||xenvif_rx_queue_ready (queue))) || -kthread_should_stop () || + (test_kthread &&kthread_should_stop ()) || queue->vif->disabled; }
@@ -540,15 +540,20 @@ static void xenvif_wait_for_rx_work(stru {DEFINE_WAIT (wait); -if (xenvif_have_rx_work (queue)) +if (xenvif_have_rx_work (queue, true))return ;for (;;) {long ret;prepare_to_wait (&queue->wq, &wait,TASK_INTERRUPTIBLE ); -if (xenvif_have_rx_work (queue)) +if (xenvif_have_rx_work (queue, true))break ; +if (atomic_fetch_andnot (NETBK_RX_EOI |NETBK_COMMON_EOI , + &queue->eoi_pending) & + (NETBK_RX_EOI |NETBK_COMMON_EOI )) +xen_irq_lateeoi (queue->rx_irq,0 ); + ret =schedule_timeout (xenvif_rx_queue_timeout (queue));if (!ret)break ;
Greg Kroah-Hartman
maintainerPATCH 7/391 xen/scsiback: use lateeoi irq binding
In reply to Greg Kroah-HartmanFrom: Juergen Gross <[email protected]>
commit 86991b6e7ea6c613b7692f65106076943449b6b7 upstream.
In order to reduce the chance for the system becoming unresponsive due to event storms triggered by a misbehaving scsifront use the lateeoi irq binding for scsiback and unmask the event channel only just before leaving the event handling function.
In case of a ring protocol error don't issue an EOI in order to avoid the possibility to use that for producing an event storm. This at once will result in no further call of scsiback_irq_fn(), so the ring_error struct member can be dropped and scsiback_do_cmd_fn() can signal the protocol error via a negative return value.
This is part of XSA-332.
--- drivers/xen/xen-scsiback.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)
drivers/xen/xen-scsiback.c +13 -10
@@ -91,7 +91,6 @@ struct vscsibk_info {unsigned int irq;struct vscsiif_back_ring ring; -int ring_error;spinlock_t ring_lock;atomic_t nr_unreplied_reqs;
@@ -722,7 +721,8 @@ static struct vscsibk_pend *prepare_pendreturn pending_req; } -static int scsiback_do_cmd_fn (struct vscsibk_info *info) +static int scsiback_do_cmd_fn (struct vscsibk_info *info, +unsigned int *eoi_flags) {struct vscsiif_back_ring *ring = &info->ring;struct vscsiif_request ring_req;
@@ -739,11 +739,12 @@ static int scsiback_do_cmd_fn(struct vsc rc = ring->rsp_prod_pvt;pr_warn ("Dom%d provided bogus ring requests (%#x - %#x = %u). Halting ring processing\n" , info->domid, rp, rc, rp - rc); - info->ring_error =1 ; -return 0 ; +return -EINVAL ; }while ((rc != rp)) { + *eoi_flags &= ~XEN_EOI_FLAG_SPURIOUS ; +if (RING_REQUEST_CONS_OVERFLOW (ring, rc))break ;
@@ -802,13 +803,16 @@ static int scsiback_do_cmd_fn(struct vscstatic irqreturn_t scsiback_irq_fn (int irq,void *dev_id) {struct vscsibk_info *info = dev_id; +int rc; +unsigned int eoi_flags =XEN_EOI_FLAG_SPURIOUS ; -if (info->ring_error) -return IRQ_HANDLED ; - -while (scsiback_do_cmd_fn (info)) +while ((rc =scsiback_do_cmd_fn (info, &eoi_flags)) >0 )cond_resched (); +/* In case of a ring error we keep the event channel masked. */ +if (!rc) +xen_irq_lateeoi (irq, eoi_flags); +return IRQ_HANDLED ; }
@@ -829,7 +833,7 @@ static int scsiback_init_sring(struct vs sring = (struct vscsiif_sring *)area;BACK_RING_INIT (&info->ring, sring,PAGE_SIZE ); - err =bind_interdomain_evtchn_to_irq (info->domid, evtchn); + err =bind_interdomain_evtchn_to_irq_lateeoi (info->domid, evtchn);if (err <0 ) goto unmap_page;
@@ -1253,7 +1257,6 @@ static int scsiback_probe(struct xenbus_ info->domid = dev->otherend_id;spin_lock_init (&info->ring_lock); - info->ring_error =0 ;atomic_set (&info->nr_unreplied_reqs,0 );init_waitqueue_head (&info->waiting_to_free); info->dev = dev;
Greg Kroah-Hartman
maintainerPATCH 3/391 xen/events: fix race in evtchn_fifo_unmask()
In reply to Greg Kroah-HartmanFrom: Juergen Gross <[email protected]>
commit f01337197419b7e8a492e83089552b77d3b5fb90 upstream.
Unmasking a fifo event channel can result in unmasking it twice, once directly in the kernel and once via a hypercall in case the event was pending.
Fix that by doing the local unmask only if the event is not pending.
This is part of XSA-332.
--- drivers/xen/events/events_fifo.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/xen/events/events_fifo.c +9 -4
@@ -227,19 +227,25 @@ static bool evtchn_fifo_is_masked(evtchnreturn sync_test_bit (EVTCHN_FIFO_BIT (MASKED , word),BM (word)); }/* -* Clear MASKED, spinning if BUSY is set. +* Clear MASKED if not PENDING, spinning if BUSY is set. +* Return true if mask was cleared. */ -static void clear_masked (volatile event_word_t *word) +static bool clear_masked_cond (volatile event_word_t *word) {event_word_t new, old, w; w = *word;do { +if (w & (1 <<EVTCHN_FIFO_PENDING )) +return false; + old = w & ~(1 <<EVTCHN_FIFO_BUSY ); new = old & ~(1 <<EVTCHN_FIFO_MASKED ); w =sync_cmpxchg (word, old, new); }while (w != old); + +return true; }static void evtchn_fifo_unmask (evtchn_port_t port)
@@ -248,8 +254,7 @@ static void evtchn_fifo_unmask(evtchn_poBUG_ON (!irqs_disabled ()); -clear_masked (word); -if (evtchn_fifo_is_pending (port)) { +if (!clear_masked_cond (word)) {struct evtchn_unmask unmask = { .port = port }; (void )HYPERVISOR_event_channel_op (EVTCHNOP_unmask, &unmask); }
Greg Kroah-Hartman
maintainerPATCH 2/391 xen/events: add a proper barrier to 2-level uevent unmasking
In reply to Greg Kroah-HartmanFrom: Juergen Gross <[email protected]>
commit 4d3fe31bd993ef504350989786858aefdb877daa upstream.
A follow-up patch will require certain write to happen before an event channel is unmasked.
While the memory barrier is not strictly necessary for all the callers, the main one will need it. In order to avoid an extra memory barrier when using fifo event channels, mandate evtchn_unmask() to provide write ordering.
The 2-level event handling unmask operation is missing an appropriate barrier, so add it. Fifo event channels are fine in this regard due to using sync_cmpxchg().
This is part of XSA-332.
--- drivers/xen/events/events_2l.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/xen/events/events_2l.c +2 -0
@@ -91,6 +91,8 @@ static void evtchn_2l_unmask(evtchn_portBUG_ON (!irqs_disabled ()); +smp_wmb ();/* All writes before unmask must be visible. */ +if (unlikely ((cpu !=cpu_from_evtchn (port)))) do_hypercall =1 ;else {
Greg Kroah-Hartman
maintainerPATCH 14/391 firmware: arm_scmi: Fix ARCH_COLD_RESET
In reply to Greg Kroah-HartmanFrom: Etienne Carriere <[email protected]>
[ Upstream commit 45b9e04d5ba0b043783dfe2b19bb728e712cb32e ]
The defination for ARCH_COLD_RESET is wrong. Let us fix it according to the SCMI specification.
--- drivers/firmware/arm_scmi/reset.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/firmware/arm_scmi/reset.c +1 -3
@@ -36,9 +36,7 @@ struct scmi_msg_reset_domain_reset {#define EXPLICIT_RESET_ASSERT BIT(1)#define ASYNCHRONOUS_RESET BIT(2)__le32 reset_state; -#define ARCH_RESET_TYPE BIT(31) -#define COLD_RESET_STATE BIT(0) -#define ARCH_COLD_RESET (ARCH_RESET_TYPE | COLD_RESET_STATE) +#define ARCH_COLD_RESET 0 };struct scmi_msg_reset_notify {
Signature · 1 line
2.27.0
Re: [PATCH 5.9 374/391] null_blk: synchronization fix for zoned device
In reply to Greg Kroah-HartmanQuoted 10 lines · Greg Kroah-Hartman
From: Kanchan Joshi <[email protected]>
commit
35bc10b2eafbb701064b94f283b77c54d3304842upstream.Parallel write,read,zone-mgmt operations accessing/altering zone state and write-pointer may get into race. Avoid the situation by using a new spinlock for zoned device.
Concurrent zone-appends (on a zone) returning same write-pointer issue is also avoided using this lock.
Quoted 6 lines
Fixes e0489ed5daeb ("null_blk: Support REQ_OP_ZONE_APPEND")Signed-off-by Kanchan Joshi <[email protected]>Reviewed-by Damien Le Moal <[email protected]>Signed-off-by Jens Axboe <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Greg,
I sent a followup patch fixing a bug introduced by this patch, but I forgot to mark it for stable. The patch is
commit aa1c09cb65e2 "null_blk: Fix locking in zoned mode"
Could you pickup that one too please ?
Best regards.
Quoted 74 lines
--- drivers/block/null_blk.h | 1 + drivers/block/null_blk_zoned.c | 22 ++++++++++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-)drivers/block/null_blk.h +1
-0@@ -44,6 +44,7 @@ struct nullb_device {unsigned int nr_zones;struct blk_zone *zones;sector_t zone_size_sects; +spinlock_t zone_lock;unsigned long size;/* device size in MB */ unsigned long completion_nsec;/* time in ns to complete a request */ drivers/block/null_blk_zoned.c +18
-4@@ -45,6 +45,7 @@ int null_init_zoned_dev(struct nullb_devif (!dev->zones)return -ENOMEM ; +spin_lock_init (&dev->zone_lock);if (dev->zone_nr_conv >= dev->nr_zones) { dev->zone_nr_conv = dev->nr_zones -1 ; pr_info("changed the number of conventional zones to %u",@@ -131,8 +132,11 @@ int null_report_zones(struct gendisk *di* So use a local copy to avoid corruption of the device zone * array. */ +spin_lock_irq (&dev->zone_lock);memcpy (&zone, &dev->zones[first_zone + i],sizeof (struct blk_zone )); +spin_unlock_irq (&dev->zone_lock); + error =cb (&zone, i, data);if (error)return error;@@ -277,18 +281,28 @@ static blk_status_t null_zone_mgmt(strucblk_status_t null_process_zoned_cmd (struct nullb_cmd *cmd,enum req_opf op,sector_t sector,sector_t nr_sectors) { +blk_status_t sts; +struct nullb_device *dev = cmd->nq->dev; + +spin_lock_irq (&dev->zone_lock);switch (op) {case REQ_OP_WRITE : -return null_zone_write (cmd, sector, nr_sectors, false); + sts =null_zone_write (cmd, sector, nr_sectors, false); +break ;case REQ_OP_ZONE_APPEND : -return null_zone_write (cmd, sector, nr_sectors, true); + sts =null_zone_write (cmd, sector, nr_sectors, true); +break ;case REQ_OP_ZONE_RESET :case REQ_OP_ZONE_RESET_ALL :case REQ_OP_ZONE_OPEN :case REQ_OP_ZONE_CLOSE :case REQ_OP_ZONE_FINISH : -return null_zone_mgmt (cmd, op, sector); + sts =null_zone_mgmt (cmd, op, sector); +break ;default : -return null_process_cmd (cmd, op, sector, nr_sectors); + sts =null_process_cmd (cmd, op, sector, nr_sectors); } +spin_unlock_irq (&dev->zone_lock); + +return sts; }
Signature · 2 lines
Damien Le Moal Western Digital Research
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.9.4 release. There are 391 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 05 Nov 2020 20:29:58 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.9.4-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.9.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
NOTE:
The kernel warning noticed on arm64 nxp ls2088 device with KASAN config enabled while booting the device. We are not considering this as regression because this is the first arm64 KASAN config enabled on nxp ls2088 device.
[ 3.301882] dwc3 3100000.usb3: Failed to get clk 'ref': -2 [ 3.307433] ------------[ cut here ]------------ [ 3.312048] dwc3 3100000.usb3: request value same as default, ignoring [ 3.318596] WARNING: CPU: 3 PID: 1 at /home/jenkins/ci/lsdk/master/all/packages/linux/linux/drivers/usb/dwc3/core.c:347 dwc3_core_init+0xd14/0xd70 [ 3.331716] Modules linked in: [ 3.334766] CPU: 3 PID: 1 Comm: swapper/0 Not tainted 4.19.46 #1 [ 3.340765] Hardware name: Freescale Layerscape 2088A RDB Board (DT) [ 3.347111] pstate: 40000005 (nZcv daif -PAN -UAO) [ 3.351895] pc : dwc3_core_init+0xd14/0xd70 [ 3.356070] lr : dwc3_core_init+0xd14/0xd70 [ 3.360243] sp : ffff000008063b00 [ 3.363550] x29: ffff000008063b00 x28: 0000000000000007 [ 3.368855] x27: ffff000009624068 x26: ffff000009532768 [ 3.374160] x25: ffff8082cd5ea1a0 x24: ffff000008f27000 [ 3.379465] x23: ffff8082ef45a410 x22: ffff0000096ca000 [ 3.384770] x21: 0000000000000041 x20: 0000000030c11004 [ 3.390075] x19: ffff8082ef6f9080 x18: ffffffffffffffff [ 3.395380] x17: 0000000000000000 x16: 0000000000000000 [ 3.400685] x15: ffff0000096ca708 x14: ffff0000898776ff [ 3.405991] x13: ffff00000987770d x12: ffff0000096ca980 [ 3.411297] x11: ffff000008707260 x10: ffff0000080637d0 [ 3.416603] x9 : 0000000000000016 x8 : 6769202c746c7561 [ 3.421908] x7 : 6665642073612065 x6 : 0000000000000163 [ 3.427213] x5 : 0000000000000000 x4 : 0000000000000000 [ 3.432517] x3 : ffffffffffffffff x2 : ffff0000096e3cf8 [ 3.437823] x1 : 4d579be806451100 x0 : 0000000000000000 [ 3.443129] Call trace: [ 3.445568] dwc3_core_init+0xd14/0xd70 [ 3.449395] dwc3_probe+0x8b0/0xd30 [ 3.452877] platform_drv_probe+0x50/0xa0 [ 3.456878] really_probe+0x1b8/0x288 [ 3.460531] driver_probe_device+0x58/0x100 [ 3.464705] __driver_attach+0xd4/0xd8 [ 3.468446] bus_for_each_dev+0x74/0xc8 [ 3.472273] driver_attach+0x20/0x28 [ 3.475840] bus_add_driver+0x1ac/0x218 [ 3.479667] driver_register+0x60/0x110 [ 3.483494] __platform_driver_register+0x40/0x48 [ 3.488192] dwc3_driver_init+0x18/0x20 [ 3.492020] do_one_initcall+0x5c/0x178 [ 3.495848] kernel_init_freeable+0x198/0x244 [ 3.500197] kernel_init+0x10/0x108 [ 3.503677] ret_from_fork+0x10/0x18 [ 3.507245] ---[ end trace 13f260065c84085c ]--- [ 3.512196] dwc3 3110000.usb3: Failed to get clk 'ref': -2
Summary
------------------------------------------------------------------------
kernel: 5.9.4-rc1
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-5.9.y
git commit: 53574a4c558e8da7cfde86a77fe760ba375394b8
git describe: v5.9.3-392-g53574a4c558e
Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.9.y/build/v5.9.3-392-g53574a4c558e
No regressions (compared to build v5.9.3)
No fixes (compared to build v5.9.3)
Ran 38015 total tests in the following environments and test suites.
Environments
--------------
- dragonboard-410c
- hi6220-hikey
- i386
- juno-r2
- juno-r2-compat
- nxp-ls2088
- nxp-ls2088-kasan
- qemu-arm64-kasan
- qemu-x86_64-kasan
- qemu_arm
- qemu_arm64
- qemu_i386
- qemu_x86_64
- x15
- x86
- x86-kasan
Test Suites
-----------
* build
* install-android-platform-tools-r2600
* libhugetlbfs
* linux-log-parser
* ltp-cap_bounds-tests
* ltp-containers-tests
* ltp-cpuhotplug-tests
* ltp-crypto-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-ipc-tests
* ltp-mm-tests
* ltp-nptl-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-tracing-tests
* perf
* ltp-commands-tests
* ltp-controllers-tests
* ltp-dio-tests
* ltp-io-tests
* ltp-math-tests
* ltp-syscalls-tests
* network-basic-tests
* v4l2-compliance
* kselftest
* ltp-cve-tests
* ltp-open-posix-tests
* kvm-unit-tests
* kunit
* kselftest-vsyscall-mode-none
* kselftest-vsyscall-mode-native
Signature · 2 lines
Linaro LKFT https://lkft.linaro.org
Quoted 32 lines · Naresh Kamboju
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.9.4 release. There are 391 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 05 Nov 2020 20:29:58 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.9.4-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.9.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm,x86_64, and i386.NOTE:
The kernel warning noticed on arm64 nxp ls2088 device with KASAN config enabled while booting the device. We are not considering this as regression because this is the first arm64 KASAN config enabled on nxp ls2088 device.
Quoted 6 lines
[ 3.301882] dwc3 3100000.usb3: Failed to get clk 'ref': -2 [ 3.307433] ------------[ cut here ]------------ [ 3.312048] dwc3 3100000.usb3: request value same as default, ignoring [ 3.318596] WARNING: CPU: 3 PID: 1 at
/home/jenkins/ci/lsdk/master/all/packages/linux/linux/drivers/usb/dwc3/core.c:347dwc3_core_init+0xd14/0xd70
Please ignore this warning that this is coming from stable rc 4.19.
- Naresh
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.9.4 release. There are 391 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 05 Nov 2020 20:29:58 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.9.4-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.9.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v5.9:
15 builds: 15 pass, 0 fail
26 boots: 26 pass, 0 fail
61 tests: 61 pass, 0 failLinux version: 5.9.4-rc1-g53574a4c558e
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra20-ventana,
tegra210-p2371-2180, tegra210-p3450-0000,
tegra30-cardhu-a04Jon
Greg Kroah-Hartman
maintainerRe: [PATCH 5.9 374/391] null_blk: synchronization fix for zoned device
In reply to Damien Le MoalQuoted 18 lines · Damien Le Moal
Quoted 10 lines · Greg Kroah-Hartman
From: Kanchan Joshi <[email protected]>
commit
35bc10b2eafbb701064b94f283b77c54d3304842upstream.Parallel write,read,zone-mgmt operations accessing/altering zone state and write-pointer may get into race. Avoid the situation by using a new spinlock for zoned device.
Concurrent zone-appends (on a zone) returning same write-pointer issue is also avoided using this lock.Quoted 6 lines
Fixes e0489ed5daeb ("null_blk: Support REQ_OP_ZONE_APPEND")Signed-off-by Kanchan Joshi <[email protected]>Reviewed-by Damien Le Moal <[email protected]>Signed-off-by Jens Axboe <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Quoted 8 lines
Greg,
I sent a followup patch fixing a bug introduced by this patch, but I forgot to mark it for stable. The patch is
commit
aa1c09cb65e2"null_blk: Fix locking in zoned mode"Could you pickup that one too please ?
It doesn't apply cleanly at all, can you provide a backport?
thanks,
greg k-h
Hi,
Quoted 26 lines · Naresh Kamboju
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.9.4 release. There are 391 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 05 Nov 2020 20:29:58 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.9.4-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.9.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm,x86_64, and i386.
Quoted 8 lines
NOTE:
The kernel warning noticed on arm64 nxp ls2088 device with KASAN config enabled while booting the device. We are not considering this as regression because this is the first arm64 KASAN config enabled on nxp ls2088 device.[ 3.301882] dwc3 3100000.usb3: Failed to get clk 'ref': -2 [ 3.307433] ------------[ cut here ]------------ [ 3.312048] dwc3 3100000.usb3: request value same as default, ignoring
fix your DTS :-)
You're requesting to change a register value that shouldn't be changed (it should be properly set during coreConsultant instantiation). Whenever the requested value is the same as the reset value of the register we WARN to let users know that the register shouldn't be touched.
Signature · 1 line
balbi
Quoted 37 lines · Felipe Balbi
Hi,
Quoted 31 lines · Naresh Kamboju
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.9.4 release. There are 391 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 05 Nov 2020 20:29:58 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.9.4-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.9.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm,x86_64, and i386.NOTE:
The kernel warning noticed on arm64 nxp ls2088 device with KASAN config enabled while booting the device. We are not considering this as regression because this is the first arm64 KASAN config enabled on nxp ls2088 device.
Quoted 5 lines
Quoted 3 lines
[ 3.301882] dwc3 3100000.usb3: Failed to get clk 'ref': -2 [ 3.307433] ------------[ cut here ]------------ [ 3.312048] dwc3 3100000.usb3: request value same as default, ignoringfix your DTS :-)
Done.
Quoted 6 lines
You're requesting to change a register value that shouldn't be changed (it should be properly set during coreConsultant instantiation). Whenever the requested value is the same as the reset value of the register we WARN to let users know that the register shouldn't be touched.
Thanks for looking into this.
The reported issue is a false alarm. please ignore.
- Naresh
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.9.4 release. There are 391 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 05 Nov 2020 20:29:58 +0000. Anything received after that time might be too late.
Build results:
total: 154 pass: 154 fail: 0 Qemu test results: total: 426 pass: 426 fail: 0
Guenter
Quoted 18 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.9.4 release. There are 391 patches in this series, all will be posted as a response
to this one. If anyone has any issues with these being applied, please
let me know.Responses should be made by Thu, 05 Nov 2020 20:29:58 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.9.4-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-
stable-rc.git linux-5.9.y
and the diffstat can be found below.
Quoted 3 lines
thanks,
greg k-h
Compiled and booted 5.9.4-rc1+ . No typical dmesg regressions.
Signature · 2 lines
software engineer rajagiri school of engineering and technology - autonomous
Greg Kroah-Hartman
maintainerQuoted 17 lines · Naresh Kamboju
Quoted 15 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.9.4 release. There are 391 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 05 Nov 2020 20:29:58 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.9.4-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.9.y
and the diffstat can be found below.
Quoted 8 lines
Quoted 3 lines
thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm,x86_64, and i386.
Thanks for testing all of these and letting me know.
greg k-h
Greg Kroah-Hartman
maintainerQuoted 26 lines · Jon Hunter
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.9.4 release. There are 391 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 05 Nov 2020 20:29:58 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.9.4-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.9.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v5.9:
15 builds: 15 pass, 0 fail 26 boots: 26 pass, 0 fail 61 tests: 61 pass, 0 fail
Quoted 7 lines
Linux version: 5.9.4-rc1-g53574a4c558e
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,tegra194-p2972-0000, tegra20-ventana, tegra210-p2371-2180, tegra210-p3450-0000, tegra30-cardhu-a04Tested-by Jon Hunter <[email protected]>
Great, thanks for testing and letting me know.
greg k-h
Greg Kroah-Hartman
maintainerQuoted 9 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.9.4 release. There are 391 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 05 Nov 2020 20:29:58 +0000. Anything received after that time might be too late.
Quoted 6 lines
Build results:
total: 154 pass: 154 fail: 0 Qemu test results: total: 426 pass: 426 fail: 0Tested-by Guenter Roeck <[email protected]>
I should have fixed up the other build issues, and thanks for letting me know about all of these.
greg k-h
Re: [PATCH 5.9 080/391] ASoC: SOF: fix a runtime pm issue in SOF when HDMI codec doesnt work
In reply to Greg Kroah-HartmanGreg Kroah-Hartman schreef op di 03-11-2020 om 21:32 [+0100]:
Quoted 39 lines
From: Rander Wang <[email protected]>
[ Upstream commit
6c63c954e1c52f1262f986f36d95f557c6f8fa94]When
hda_codec_probe()doesn't initialize audio component, we disable the codec and keep going. However,the resources are not released. Thechild_countof SOF device is increased insnd_hdac_ext_bus_device_initbut is not decrease in error case, so SOF can't get suspended.
snd_hdac_ext_bus_device_exitwill be invoked in HDA framework if it gets a error. Now copy this behavior to release resources and decrease SOF devicechild_countto release SOF device.Signed-off-by Rander Wang <[email protected]>Reviewed-by Pierre-Louis Bossart <[email protected]>Reviewed-by Bard Liao <[email protected]>Reviewed-by Guennadi Liakhovetski <[email protected]>Signed-off-by Ranjani Sridharan <[email protected]>Signed-off-by Mark Brown <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- sound/soc/sof/intel/hda-codec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)sound/soc/sof/intel/hda-codec.c +1
-1@@ -151,7 +151,7 @@ static int hda_codec_probe(struct snd_sof_dev *sdev, int address,if (!hdev->bus->audio_component) {dev_dbg (sdev->dev,"iDisp hw present but no driver\n" ); -return -ENOENT ; + goto error; } hda_priv->need_display_power = true; }
sound/soc/sof/intel/hda-codec.c static int hda_codec_probe(struct snd_sof_dev *sdev, int address, · line 180
Quoted 8 lines
sound/soc/sof/intel/hda-codec.c +1
-1@@ -174,7 +174,7 @@ static int hda_codec_probe(struct snd_sof_dev *sdev, int address,* other return codes without modification */ if (ret ==0 ) - ret = -ENOENT ; + goto error; }return ret;
My local build of v5.9.5 broke on this patch.
sound/soc/sof/intel/hda-codec.c: In function 'hda_codec_probe':sound/soc/sof/intel/hda-codec.c:177:4: error: label 'error' used but not defined
177 | goto error;
| ^~~~ make[4]: *** [scripts/Makefile.build:283: sound/soc/sof/intel/hda-codec.o] Error 1 make[3]: *** [scripts/Makefile.build:500: sound/soc/sof/intel] Error 2 make[2]: *** [scripts/Makefile.build:500: sound/soc/sof] Error 2 make[1]: *** [scripts/Makefile.build:500: sound/soc] Error 2
make: *** [Makefile:1778: sound] Error 2
There's indeed no error label in v5.9.5. (There is one in v5.10-rc2, I just checked.) Is no-one else running into this?
Thanks,
Paul Bolle
Sasha Levin
maintainerRe: [PATCH 5.9 080/391] ASoC: SOF: fix a runtime pm issue in SOF when HDMI codec doesnt work
Quoted 55 lines · Paul Bolle
Greg Kroah-Hartman schreef op di 03-11-2020 om 21:32 [+0100]:
Quoted 39 lines
From: Rander Wang <[email protected]>
[ Upstream commit
6c63c954e1c52f1262f986f36d95f557c6f8fa94]When
hda_codec_probe()doesn't initialize audio component, we disable the codec and keep going. However,the resources are not released. Thechild_countof SOF device is increased insnd_hdac_ext_bus_device_initbut is not decrease in error case, so SOF can't get suspended.
snd_hdac_ext_bus_device_exitwill be invoked in HDA framework if it gets a error. Now copy this behavior to release resources and decrease SOF devicechild_countto release SOF device.Signed-off-by Rander Wang <[email protected]>Reviewed-by Pierre-Louis Bossart <[email protected]>Reviewed-by Bard Liao <[email protected]>Reviewed-by Guennadi Liakhovetski <[email protected]>Signed-off-by Ranjani Sridharan <[email protected]>Signed-off-by Mark Brown <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- sound/soc/sof/intel/hda-codec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)sound/soc/sof/intel/hda-codec.c +1
-1@@ -151,7 +151,7 @@ static int hda_codec_probe(struct snd_sof_dev *sdev, int address,if (!hdev->bus->audio_component) {dev_dbg (sdev->dev,"iDisp hw present but no driver\n" ); -return -ENOENT ; + goto error; } hda_priv->need_display_power = true; }sound/soc/sof/intel/hda-codec.c static int hda_codec_probe(struct snd_sof_dev *sdev, int address, · line 180
Quoted 8 lines
sound/soc/sof/intel/hda-codec.c +1
-1@@ -174,7 +174,7 @@ static int hda_codec_probe(struct snd_sof_dev *sdev, int address,* other return codes without modification */ if (ret ==0 ) - ret = -ENOENT ; + goto error; }return ret;My local build of v5.9.5 broke on this patch.
sound/soc/sof/intel/hda-codec.c: In function 'hda_codec_probe':sound/soc/sof/intel/hda-codec.c:177:4: error: label 'error' used but not defined177 | goto error; | ^~~~
Quoted 8 lines
make[4]: *** [
scripts/Makefile.build:283:sound/soc/sof/intel/hda-codec.o] Error 1 make[3]: *** [scripts/Makefile.build:500:sound/soc/sof/intel] Error 2 make[2]: *** [scripts/Makefile.build:500:sound/soc/sof] Error 2 make[1]: *** [scripts/Makefile.build:500:sound/soc] Error 2
make: *** [Makefile:1778: sound] Error 2There's indeed no error label in v5.9.5. (There is one in v5.10-rc2, I just checked.) Is no-one else running into this?
It seems that setting CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC=y is very "difficult", it's not being set by allmodconfig nor is it easy to manually set it up.
I'll revert the patch, but it would be nice to make sure it's easier to test this out too.
Signature · 2 lines
Thanks, Sasha
Re: [PATCH 5.9 080/391] ASoC: SOF: fix a runtime pm issue in SOF when HDMI codec doesnt work
Quoted 68 lines · Sasha Levin
Quoted 64 lines · Paul Bolle
Greg Kroah-Hartman schreef op di 03-11-2020 om 21:32 [+0100]:
Quoted 49 lines
From: Rander Wang <[email protected]>
[ Upstream commit
6c63c954e1c52f1262f986f36d95f557c6f8fa94]When
hda_codec_probe()doesn't initialize audio component, we disable the codec and keep going. However,the resources are not released. Thechild_countof SOF device is increased insnd_hdac_ext_bus_device_initbut is not decrease in error case, so SOF can't get suspended.
snd_hdac_ext_bus_device_exitwill be invoked in HDA framework if it gets a error. Now copy this behavior to release resources and decrease SOF devicechild_countto release SOF device.Signed-off-by Rander Wang <[email protected]>Reviewed-by Pierre-Louis Bossart <[email protected]>Reviewed-by Bard Liao <[email protected]>Reviewed-by Guennadi Liakhovetski <[email protected]>Signed-off-by Ranjani Sridharan <[email protected]>Signed-off-by Mark Brown <[email protected]>Signed-off-by Sasha Levin <[email protected]>---
sound/soc/sof/intel/hda-codec.c | 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)sound/soc/sof/intel/hda-codec.c +1
-1@@ -151,7 +151,7 @@ static int hda_codec_probe(struct snd_sof_dev *sdev, int address, if (!hdev->bus->audio_component) { dev_dbg(sdev->dev, "iDisp hw present but no driver\n"); - return -ENOENT; + goto error; } hda_priv->need_display_power = true;}
sound/soc/sof/intel/hda-codec.c +1
-1@@ -174,7 +174,7 @@ static int hda_codec_probe(struct snd_sof_dev*sdev, int address, * other return codes without modification */ if (ret == 0) - ret = -ENOENT; + goto error; }Quoted 1 line
return ret;
My local build of v5.9.5 broke on this patch.
sound/soc/sof/intel/hda-codec.c: In function 'hda_codec_probe':sound/soc/sof/intel/hda-codec.c:177:4: error: label 'error' used but not defined 177 | goto error;
| ^~~~
make[4]: *** [scripts/Makefile.build:283:sound/soc/sof/intel/hda-codec.o] Error 1 make[3]: *** [scripts/Makefile.build:500:sound/soc/sof/intel] Error 2 make[2]: *** [scripts/Makefile.build:500:sound/soc/sof] Error 2 make[1]: *** [scripts/Makefile.build:500:sound/soc] Error 2
make: *** [Makefile:1778: sound] Error 2Quoted 2 lines
There's indeed no error label in v5.9.5. (There is one in v5.10-rc2, I just checked.) Is no-one else running into this?
Quoted 6 lines
It seems that setting
CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC=yis very "difficult", it's not being set by allmodconfig nor is it easy to manually set it up.I'll revert the patch, but it would be nice to make sure it's easier to test this out too.
this issue comes from out-of-order patches, give me a couple of hours to look into this before reverting. thanks!
Sasha Levin
maintainerRe: [PATCH 5.9 080/391] ASoC: SOF: fix a runtime pm issue in SOF when HDMI codec doesnt work
Quoted 71 lines · Pierre-Louis Bossart
Quoted 68 lines · Sasha Levin
Quoted 66 lines · Paul Bolle
Greg Kroah-Hartman schreef op di 03-11-2020 om 21:32 [+0100]:
Quoted 49 lines
From: Rander Wang <[email protected]>
[ Upstream commit
6c63c954e1c52f1262f986f36d95f557c6f8fa94]When
hda_codec_probe()doesn't initialize audio component, we disable the codec and keep going. However,the resources are not released. Thechild_countof SOF device is increased insnd_hdac_ext_bus_device_initbut is not decrease in error case, so SOF can't get suspended.
snd_hdac_ext_bus_device_exitwill be invoked in HDA framework if it gets a error. Now copy this behavior to release resources and decrease SOF devicechild_countto release SOF device.Signed-off-by Rander Wang <[email protected]>Reviewed-by Pierre-Louis Bossart <[email protected]>Reviewed-by Bard Liao <[email protected]>Reviewed-by Guennadi Liakhovetski <[email protected]>Signed-off-by Ranjani Sridharan <[email protected]>Signed-off-by Mark Brown <[email protected]>Signed-off-by Sasha Levin <[email protected]>---
sound/soc/sof/intel/hda-codec.c | 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)sound/soc/sof/intel/hda-codec.c +1
-1@@ -151,7 +151,7 @@ static int hda_codec_probe(struct snd_sof_dev *sdev, int address, if (!hdev->bus->audio_component) { dev_dbg(sdev->dev, "iDisp hw present but no driver\n"); - return -ENOENT; + goto error; } hda_priv->need_display_power = true;}
sound/soc/sof/intel/hda-codec.c +1
-1@@ -174,7 +174,7 @@ static int hda_codec_probe(structsnd_sof_dev *sdev, int address, * other return codes without modification */ if (ret == 0) - ret = -ENOENT; + goto error; }Quoted 1 line
return ret;
My local build of v5.9.5 broke on this patch.
sound/soc/sof/intel/hda-codec.c: In function 'hda_codec_probe':sound/soc/sof/intel/hda-codec.c:177:4: error: label 'error' used but not defined 177 | goto error;
| ^~~~
make[4]: *** [scripts/Makefile.build:283:sound/soc/sof/intel/hda-codec.o] Error 1 make[3]: *** [scripts/Makefile.build:500:sound/soc/sof/intel] Error 2 make[2]: *** [scripts/Makefile.build:500:sound/soc/sof] Error 2 make[1]: *** [scripts/Makefile.build:500:sound/soc] Error 2
make: *** [Makefile:1778: sound] Error 2There's indeed no error label in v5.9.5. (There is one in v5.10-rc2, I just checked.) Is no-one else running into this?
Quoted 8 lines
Quoted 6 lines
It seems that setting
CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC=yis very "difficult", it's not being set by allmodconfig nor is it easy to manually set it up.I'll revert the patch, but it would be nice to make sure it's easier to test this out too.
this issue comes from out-of-order patches, give me a couple of hours to look into this before reverting. thanks!
Sure! Thanks for looking into this.
Signature · 2 lines
Thanks, Sasha
Re: [PATCH 5.9 080/391] ASoC: SOF: fix a runtime pm issue in SOF when HDMI codec doesnt work
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 13 lines
My local build of v5.9.5 broke on this patch.
sound/soc/sof/intel/hda-codec.c: In function 'hda_codec_probe':sound/soc/sof/intel/hda-codec.c:177:4: error: label 'error' used but not defined 177 | goto error;
| ^~~~
make[4]: *** [scripts/Makefile.build:283:sound/soc/sof/intel/hda-codec.o] Error 1 make[3]: *** [scripts/Makefile.build:500:sound/soc/sof/intel] Error 2 make[2]: *** [scripts/Makefile.build:500:sound/soc/sof] Error 2 make[1]: *** [scripts/Makefile.build:500:sound/soc] Error 2
make: *** [Makefile:1778: sound] Error 2Quoted 2 lines
There's indeed no error label in v5.9.5. (There is one in v5.10-rc2, I just checked.) Is no-one else running into this?
It seems that setting
CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC=yis very "difficult", it's not being set by allmodconfig nor is it easy to manually set it up.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
I'll revert the patch, but it would be nice to make sure it's easier to test this out too.
this issue comes from out-of-order patches, give me a couple of hours to look into this before reverting. thanks!
Sure! Thanks for looking into this.
I would recommend adding this commit to 5.9-stable:
11ec0edc6408a ('ASOC: SOF: Intel: hda-codec: move unused label to correct position')
I just tried with 5.9.5 and the compilation error is solved with this commit.
It was initially intended to solve a minor 'defined but not used' issue, which somehow became a bad 'used but not defined' one. Probably a bad git merge I did, sorry about that.
Thanks!
-Pierre
Greg Kroah-Hartman
maintainerRe: [PATCH 5.9 080/391] ASoC: SOF: fix a runtime pm issue in SOF when HDMI codec doesnt work
Quoted 36 lines · Pierre-Louis Bossart
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 15 lines
My local build of v5.9.5 broke on this patch.
sound/soc/sof/intel/hda-codec.c: In function 'hda_codec_probe':sound/soc/sof/intel/hda-codec.c:177:4: error: label 'error' used but not defined
177 | goto error;
| ^~~~
make[4]: *** [scripts/Makefile.build:283:sound/soc/sof/intel/hda-codec.o] Error 1
make[3]: *** [scripts/Makefile.build:500:sound/soc/sof/intel] Error 2 make[2]: *** [scripts/Makefile.build:500:sound/soc/sof] Error 2 make[1]: *** [scripts/Makefile.build:500:sound/soc] Error 2
make: *** [Makefile:1778: sound] Error 2Quoted 3 lines
There's indeed no error label in v5.9.5. (There is one in v5.10-rc2, I just
checked.) Is no-one else running into this?It seems that setting
CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC=yis very "difficult", it's not being set by allmodconfig nor is it easy to manually set it up.Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
I'll revert the patch, but it would be nice to make sure it's easier to test this out too.
this issue comes from out-of-order patches, give me a couple of hours to look into this before reverting. thanks!
Sure! Thanks for looking into this.
I would recommend adding this commit to 5.9-stable:
11ec0edc6408a('ASOC: SOF: Intel: hda-codec: move unused label to correct position')
Quoted 6 lines
I just tried with 5.9.5 and the compilation error is solved with this commit.
It was initially intended to solve a minor 'defined but not used' issue, which somehow became a bad 'used but not defined' one. Probably a bad git merge I did, sorry about that.
Will go do that now and push out a new release, thanks!
greg k-h