clk: rockchip: rk3036: fix up the sclk_sfc parent error
Subsystems (15)
Sasha Levin
maintainerPATCH 13/37 KVM: PPC: Book3S HV: XICS: Fix mapping of passthrough interrupts
In reply to Sasha LevinFrom: Cédric Le Goater <[email protected]>
[ Upstream commit 1753081f2d445f9157550692fcc4221cd3ff0958 ]
PCI MSIs now live in an MSI domain but the underlying calls, which will EOI the interrupt in real mode, need an HW IRQ number mapped in the XICS IRQ domain. Grab it there.
--- arch/powerpc/kvm/book3s_hv.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
arch/powerpc/kvm/book3s_hv.c +10 -2
@@ -5020,6 +5020,7 @@ static int kvmppc_set_passthru_irq(struct kvm *kvm, int host_irq, int guest_gsi)struct kvmppc_passthru_irqmap *pimap;struct irq_chip *chip;int i, rc =0 ; +struct irq_data *host_data;if (!kvm_irq_bypass)return 1 ;
@@ -5084,7 +5085,14 @@ static int kvmppc_set_passthru_irq(struct kvm *kvm, int host_irq, int guest_gsi)* the KVM real mode handler. */ smp_wmb (); - irq_map->r_hwirq = desc->irq_data.hwirq; + +/* +* The 'host_irq' number is mapped in the PCI-MSI domain but +* the underlying calls, which will EOI the interrupt in real +* mode, need an HW IRQ number mapped in the XICS IRQ domain. +*/ + host_data =irq_domain_get_irq_data (irq_get_default_host (), host_irq); + irq_map->r_hwirq = (unsigned int )irqd_to_hwirq (host_data);if (i = pimap->n_mapped) pimap->n_mapped++;
@@ -5092,7 +5100,7 @@ static int kvmppc_set_passthru_irq(struct kvm *kvm, int host_irq, int guest_gsi)if (xics_on_xive ()) rc =kvmppc_xive_set_mapped (kvm, guest_gsi, desc);else -kvmppc_xics_set_mapped (kvm, guest_gsi, desc->irq_data.hwirq); +kvmppc_xics_set_mapped (kvm, guest_gsi, irq_map->r_hwirq);if (rc) irq_map->r_hwirq =0 ;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 19/37 fs: dlm: fix return -EINTR on recovery stopped
In reply to Sasha LevinFrom: Alexander Aring <[email protected]>
[ Upstream commit aee742c9928ab4f5f4e0b00f41fb2d2cffae179e ]
This patch will return -EINTR instead of 1 if recovery is stopped. In case of ping_members() the return value will be checked if the error is -EINTR for signaling another recovery was triggered and the whole recovery process will come to a clean end to process the next one. Returning 1 will abort the recovery process and can leave the recovery in a broken state.
It was reported with the following kernel log message attached and a gfs2 mount stopped working:
"dlm: bobvirt1: dlm_recover_members error 1"
whereas 1 was returned because of a conversion of "dlm_recovery_stopped()" to an errno was missing which this patch will introduce. While on it all other possible missing errno conversions at other places were added as they are done as in other places.
It might be worth to check the error case at this recovery level, because some of the functionality also returns -ENOBUFS and check why recovery ends in a broken state. However this will fix the issue if another recovery was triggered at some points of recovery handling.
--- fs/dlm/dir.c | 4 +++- fs/dlm/member.c | 4 +++- fs/dlm/recoverd.c | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-)
fs/dlm/dir.c +3 -1
@@ -85,8 +85,10 @@ int dlm_recover_directory(struct dlm_ls *ls)for (;;) {int left; error =dlm_recovery_stopped (ls); -if (error) +if (error) { + error = -EINTR ; goto out_free; + } error =dlm_rcom_names (ls, memb->nodeid, last_name, last_len);
fs/dlm/member.c +3 -1
@@ -433,8 +433,10 @@ static int ping_members(struct dlm_ls *ls)list_for_each_entry (memb, &ls->ls_nodes, list) { error =dlm_recovery_stopped (ls); -if (error) +if (error) { + error = -EINTR ;break ; + } error =dlm_rcom_status (ls, memb->nodeid,0 );if (error)break ;
fs/dlm/recoverd.c +3 -1
@@ -125,8 +125,10 @@ static int ls_recover(struct dlm_ls *ls, struct dlm_recover *rv)dlm_recover_waiters_pre (ls); error =dlm_recovery_stopped (ls); -if (error) +if (error) { + error = -EINTR ; goto fail; + }if (neg ||dlm_no_directory (ls)) {/*
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 26/37 KVM: PPC: Book3S HV: Initialise vcpu MSR with MSR_ME
In reply to Sasha LevinFrom: Nicholas Piggin <[email protected]>
[ Upstream commit fd42b7b09c602c904452c0c3e5955ca21d8e387a ]
It is possible to create a VCPU without setting the MSR before running it, which results in a warning in kvmhv_vcpu_entry_p9() that MSR_ME is not set. This is pretty harmless because the MSR_ME bit is added to HSRR1 before HRFID to guest, and a normal qemu guest doesn't hit it.
Initialise the vcpu MSR with MSR_ME set.
--- arch/powerpc/kvm/book3s_hv.c | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/kvm/book3s_hv.c +1 -0
@@ -2293,6 +2293,7 @@ static struct kvm_vcpu *kvmppc_core_vcpu_create_hv(struct kvm *kvm,spin_lock_init (&vcpu->arch.vpa_update_lock);spin_lock_init (&vcpu->arch.tbacct_lock); vcpu->arch.busy_preempt =TB_NIL ; + vcpu->arch.shregs.msr =MSR_ME ; vcpu->arch.intr_msr =MSR_SF |MSR_ME ;/*
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 27/37 KVM: PPC: Book3S HV P9: Fixes for TM softpatch interrupt NIP
In reply to Sasha LevinFrom: Nicholas Piggin <[email protected]>
[ Upstream commit 4782e0cd0d184d727ad3b0cfe20d1d44d9f98239 ]
The softpatch interrupt sets HSRR0 to the faulting instruction +4, so it should subtract 4 for the faulting instruction address in the case it is a TM softpatch interrupt (the instruction was not executed) and it was not emulated.
--- arch/powerpc/kvm/book3s_hv_tm.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
arch/powerpc/kvm/book3s_hv_tm.c +15 -2
@@ -46,6 +46,15 @@ int kvmhv_p9_tm_emulation(struct kvm_vcpu *vcpu)u64 newmsr, bescr;int ra, rs; +/* +* The TM softpatch interrupt sets NIP to the instruction following +* the faulting instruction, which is not executed. Rewind nip to the +* faulting instruction so it looks like a normal synchronous +* interrupt, then update nip in the places where the instruction is +* emulated. +*/ + vcpu->arch.regs.nip -=4 ; +/* * rfid, rfebb, and mtmsrd encode bit 31 = 0 since it's a reserved bit * in these instructions, so masking bit 31 out doesn't change these
@@ -67,7 +76,7 @@ int kvmhv_p9_tm_emulation(struct kvm_vcpu *vcpu) (newmsr & MSR_TM))); newmsr =sanitize_msr (newmsr); vcpu->arch.shregs.msr = newmsr; - vcpu->arch.cfar = vcpu->arch.regs.nip -4 ; + vcpu->arch.cfar = vcpu->arch.regs.nip; vcpu->arch.regs.nip = vcpu->arch.shregs.srr0;return RESUME_GUEST ;
@@ -100,7 +109,7 @@ int kvmhv_p9_tm_emulation(struct kvm_vcpu *vcpu) vcpu->arch.bescr = bescr; msr = (msr & ~MSR_TS_MASK ) |MSR_TS_T ; vcpu->arch.shregs.msr = msr; - vcpu->arch.cfar = vcpu->arch.regs.nip -4 ; + vcpu->arch.cfar = vcpu->arch.regs.nip; vcpu->arch.regs.nip = vcpu->arch.ebbrr;return RESUME_GUEST ;
@@ -116,6 +125,7 @@ int kvmhv_p9_tm_emulation(struct kvm_vcpu *vcpu) newmsr = (newmsr & ~MSR_LE ) | (msr &MSR_LE ); newmsr =sanitize_msr (newmsr); vcpu->arch.shregs.msr = newmsr; + vcpu->arch.regs.nip +=4 ;return RESUME_GUEST ;/* ignore bit 31, see comment above */
@@ -152,6 +162,7 @@ int kvmhv_p9_tm_emulation(struct kvm_vcpu *vcpu) msr = (msr & ~MSR_TS_MASK ) |MSR_TS_S ; } vcpu->arch.shregs.msr = msr; + vcpu->arch.regs.nip +=4 ;return RESUME_GUEST ;/* ignore bit 31, see comment above */
@@ -189,6 +200,7 @@ int kvmhv_p9_tm_emulation(struct kvm_vcpu *vcpu) vcpu->arch.regs.ccr = (vcpu->arch.regs.ccr &0x0fffffff ) | (((msr &MSR_TS_MASK ) >>MSR_TS_S_LG ) <<29 ); vcpu->arch.shregs.msr &= ~MSR_TS_MASK ; + vcpu->arch.regs.nip +=4 ;return RESUME_GUEST ;/* ignore bit 31, see comment above */
@@ -220,6 +232,7 @@ int kvmhv_p9_tm_emulation(struct kvm_vcpu *vcpu) vcpu->arch.regs.ccr = (vcpu->arch.regs.ccr &0x0fffffff ) | (((msr &MSR_TS_MASK ) >>MSR_TS_S_LG ) <<29 ); vcpu->arch.shregs.msr = msr |MSR_TS_S ; + vcpu->arch.regs.nip +=4 ;return RESUME_GUEST ; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 28/37 KVM: PPC: Book3S HV Nested: Fix TM softpatch HFAC interrupt emulation
In reply to Sasha LevinFrom: Nicholas Piggin <[email protected]>
[ Upstream commit d82b392d9b3556b63e3f9916cf057ea847e173a9 ]
Have the TM softpatch emulation code set up the HFAC interrupt and return -1 in case an instruction was executed with HFSCR bits clear, and have the interrupt exit handler fall through to the HFAC handler. When the L0 is running a nested guest, this ensures the HFAC interrupt is correctly passed up to the L1.
The "direct guest" exit handler will turn these into PROGILL program interrupts so functionality in practice will be unchanged. But it's possible an L1 would want to handle these in a different way.
Also rearrange the FAC interrupt emulation code to match the HFAC format while here (mainly, adding the FSCR_INTR_CAUSE mask).
--- arch/powerpc/include/asm/reg.h | 3 ++- arch/powerpc/kvm/book3s_hv.c | 35 ++++++++++++++++---------- arch/powerpc/kvm/book3s_hv_tm.c | 44 ++++++++++++++++++--------------- 3 files changed, 48 insertions(+), 34 deletions(-)
arch/powerpc/include/asm/reg.h +2 -1
@@ -414,6 +414,7 @@#define FSCR_TAR __MASK(FSCR_TAR_LG)#define FSCR_EBB __MASK(FSCR_EBB_LG)#define FSCR_DSCR __MASK(FSCR_DSCR_LG) +#define FSCR_INTR_CAUSE (ASM_CONST(0xFF) << 56)/* interrupt cause */ #define SPRN_HFSCR 0xbe/* HV=1 Facility Status & Control Register */ #define HFSCR_MSGP __MASK(FSCR_MSGP_LG)#define HFSCR_TAR __MASK(FSCR_TAR_LG)
@@ -424,7 +425,7 @@#define HFSCR_DSCR __MASK(FSCR_DSCR_LG)#define HFSCR_VECVSX __MASK(FSCR_VECVSX_LG)#define HFSCR_FP __MASK(FSCR_FP_LG) -#define HFSCR_INTR_CAUSE (ASM_CONST(0xFF) << 56)/* interrupt cause */ +#define HFSCR_INTR_CAUSE FSCR_INTR_CAUSE#define SPRN_TAR 0x32f/* Target Address Register */ #define SPRN_LPCR 0x13E/* LPAR Control Register */ #define LPCR_VPM0 ASM_CONST(0x8000000000000000)
arch/powerpc/kvm/book3s_hv.c +22 -13
@@ -1390,6 +1390,21 @@ static int kvmppc_handle_exit_hv(struct kvm_run *run, struct kvm_vcpu *vcpu, r =RESUME_GUEST ; }break ; + +#ifdef CONFIG_PPC_TRANSACTIONAL_MEM +case BOOK3S_INTERRUPT_HV_SOFTPATCH : +/* +* This occurs for various TM-related instructions that +* we need to emulate on POWER9 DD2.2. We have already +* handled the cases where the guest was in real-suspend +* mode and was transitioning to transactional state. +*/ + r =kvmhv_p9_tm_emulation (vcpu); +if (r !=-1 ) +break ; + fallthrough;/* go to facility unavailable handler */ +#endif +/* * This occurs if the guest (kernel or userspace), does something that * is prohibited by HFSCR.
@@ -1408,18 +1423,6 @@ static int kvmppc_handle_exit_hv(struct kvm_run *run, struct kvm_vcpu *vcpu, }break ; -#ifdef CONFIG_PPC_TRANSACTIONAL_MEM -case BOOK3S_INTERRUPT_HV_SOFTPATCH : -/* -* This occurs for various TM-related instructions that -* we need to emulate on POWER9 DD2.2. We have already -* handled the cases where the guest was in real-suspend -* mode and was transitioning to transactional state. -*/ - r =kvmhv_p9_tm_emulation (vcpu); -break ; -#endif -case BOOK3S_INTERRUPT_HV_RM_HARD : r =RESUME_PASSTHROUGH ;break ;
@@ -1517,9 +1520,15 @@ static int kvmppc_handle_nested_exit(struct kvm_run *run, struct kvm_vcpu *vcpu)* mode and was transitioning to transactional state. */ r =kvmhv_p9_tm_emulation (vcpu); -break ; +if (r !=-1 ) +break ; + fallthrough;/* go to facility unavailable handler */ #endif +case BOOK3S_INTERRUPT_H_FAC_UNAVAIL : + r =RESUME_HOST ; +break ; +case BOOK3S_INTERRUPT_HV_RM_HARD : vcpu->arch.trap =0 ; r =RESUME_GUEST ;
arch/powerpc/kvm/book3s_hv_tm.c +24 -20
80 lines not on this page · raw message
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 4/37 f2fs: Revert "f2fs: Fix indefinite loop in f2fs_gc() v1"
In reply to Sasha LevinFrom: Jia Yang <[email protected]>
[ Upstream commit 10d0786b39b3b91c4fbf8c2926e97ab456a4eea1 ]
This reverts commit 957fa47823dfe449c5a15a944e4e7a299a6601db.
The patch "f2fs: Fix indefinite loop in f2fs_gc()" v1 and v4 are all merged. Patch v4 is test info for patch v1. Patch v1 doesn't work and may cause that sbi->cur_victim_sec can't be resetted to NULL_SEGNO, which makes SSR unable to get segment of sbi->cur_victim_sec. So it should be reverted.
The mails record:
[1] https://lore.kernel.org/linux-f2fs-devel/[email protected]/T/
[2] https://lore.kernel.org/linux-f2fs-devel/[email protected]/T/
--- fs/f2fs/gc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/gc.c +1 -1
@@ -1332,7 +1332,7 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync, round++; } -if (gc_type ==FG_GC && seg_freed) +if (gc_type ==FG_GC ) sbi->cur_victim_sec =NULL_SEGNO ;if (sync)
Signature · 8 lines
2.30.2 _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Sasha Levin
maintainerPATCH 10/37 f2fs: fix min_seq_blocks can not make sense in some scenes.
In reply to Sasha LevinFrom: Laibin Qiu <[email protected]>
[ Upstream commit dc675a97129c4d9d5af55a3d7f23d7e092b8e032 ]
F2FS have dirty page count control for batched sequential write in writepages, and get the value of min_seq_blocks by blocks_per_seg * segs_per_sec(segs_per_sec defaults to 1). But in some scenes we set a lager section size, Min_seq_blocks will become too large to achieve the expected effect(eg. 4thread sequential write, the number of merge requests will be reduced).
--- fs/f2fs/segment.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/segment.c +1 -1
@@ -4403,7 +4403,7 @@ int f2fs_build_segment_manager(struct f2fs_sb_info *sbi) sm_info->ipu_policy =1 <<F2FS_IPU_FSYNC ; sm_info->min_ipu_util =DEF_MIN_IPU_UTIL ; sm_info->min_fsync_blocks =DEF_MIN_FSYNC_BLOCKS ; - sm_info->min_seq_blocks = sbi->blocks_per_seg * sbi->segs_per_sec; + sm_info->min_seq_blocks = sbi->blocks_per_seg; sm_info->min_hot_blocks =DEF_MIN_HOT_BLOCKS ; sm_info->min_ssr_sections =reserved_sections (sbi);
Signature · 8 lines
2.30.2 _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Sasha Levin
maintainerPATCH 9/37 f2fs: fix to force keeping write barrier for strict fsync mode
In reply to Sasha LevinFrom: Chao Yu <[email protected]>
[ Upstream commit 2787991516468bfafafb9bf2b45a848e6b202e7c ]
[1] https://www.mail-archive.com/[email protected]/msg15126.html
As [1] reported, if lower device doesn't support write barrier, in below case:
- write page #0; persist
- overwrite page #0
- fsync
- write data page #0 OPU into device's cache
- write inode page into device's cache
- issue flush
If SPO is triggered during flush command, inode page can be persisted before data page #0, so that after recovery, inode page can be recovered with new physical block address of data page #0, however there may contains dummy data in new physical block address.
Then what user will see is: after overwrite & fsync + SPO, old data in file was corrupted, if any user do care about such case, we can suggest user to use STRICT fsync mode, in this mode, we will force to use atomic write sematics to keep write order in between data/node and last node, so that it avoids potential data corruption during fsync().
--- fs/f2fs/file.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
fs/f2fs/file.c +12 -0
@@ -259,6 +259,18 @@ static int f2fs_do_sync_file(struct file *file, loff_t start, loff_t end, f2fs_exist_written_data(sbi, ino, UPDATE_INO)) goto flush_out; goto out; + }else { +/* +* for OPU case, during fsync(), node can be persisted before +* data when lower device doesn't support write barrier, result +* in data corruption after SPO. +* So for strict fsync mode, force to use atomic write sematics +* to keep write order in between data/node and last node to +* avoid potential data corruption. +*/ +if (F2FS_OPTION (sbi).fsync_mode == +FSYNC_MODE_STRICT && !atomic) + atomic = true; } go_write:/*
Signature · 8 lines
2.30.2 _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Sasha Levin
maintainerPATCH 34/37 xen: remove stray preempt_disable() from PV AP startup code
In reply to Sasha LevinFrom: Juergen Gross <[email protected]>
[ Upstream commit 58e636039b512697554b579c2bb23774061877f5 ]
In cpu_bringup() there is a call of preempt_disable() without a paired preempt_enable(). This is not needed as interrupts are off initially. Additionally this will result in early boot messages like:
BUG: scheduling while atomic: swapper/1/0/0x00000002
--- arch/x86/xen/smp_pv.c | 1 - 1 file changed, 1 deletion(-)
arch/x86/xen/smp_pv.c +0 -1
@@ -61,7 +61,6 @@ static void cpu_bringup(void)cr4_init ();cpu_init ();touch_softlockup_watchdog (); -preempt_disable ();/* PVH runs in ring 0 and allows us to do native syscalls. Yay! */ if (!xen_feature (XENFEAT_supervisor_mode_kernel)) {
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 36/37 ocfs2: quota_local: fix possible uninitialized-variable access in ocfs2_local_read_info()
In reply to Sasha LevinFrom: Tuo Li <[email protected]>
[ Upstream commit 6c85c2c728193d19d6a908ae9fb312d0325e65ca ]
A memory block is allocated through kmalloc(), and its return value is assigned to the pointer oinfo. However, oinfo->dqi_gqinode is not initialized but it is accessed in:
iput(oinfo->dqi_gqinode);
To fix this possible uninitialized-variable access, assign NULL to oinfo->dqi_gqinode, and add ocfs2_qinfo_lock_res_init() behind the assignment in ocfs2_local_read_info(). Remove ocfs2_qinfo_lock_res_init() in ocfs2_global_read_info().
--- fs/ocfs2/quota_global.c | 1 - fs/ocfs2/quota_local.c | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-)
fs/ocfs2/quota_global.c +0 -1
@@ -357,7 +357,6 @@ int ocfs2_global_read_info(struct super_block *sb, int type) } oinfo->dqi_gi.dqi_sb = sb; oinfo->dqi_gi.dqi_type = type; -ocfs2_qinfo_lock_res_init (&oinfo->dqi_gqlock, oinfo); oinfo->dqi_gi.dqi_entry_size =sizeof (struct ocfs2_global_disk_dqblk ); oinfo->dqi_gi.dqi_ops = &ocfs2_global_ops; oinfo->dqi_gqi_bh =NULL ;
fs/ocfs2/quota_local.c +2 -0
@@ -702,6 +702,8 @@ static int ocfs2_local_read_info(struct super_block *sb, int type) info->dqi_priv = oinfo; oinfo->dqi_type = type;INIT_LIST_HEAD (&oinfo->dqi_chunk); + oinfo->dqi_gqinode =NULL ; +ocfs2_qinfo_lock_res_init (&oinfo->dqi_gqlock, oinfo); oinfo->dqi_rec =NULL ; oinfo->dqi_lqi_bh =NULL ; oinfo->dqi_libh =NULL ;
Signature · 7 lines
2.30.2 _______________________________________________ Ocfs2-devel mailing list [email protected] https://oss.oracle.com/mailman/listinfo/ocfs2-devel
Sasha Levin
maintainerPATCH 37/37 ocfs2: ocfs2_downconvert_lock failure results in deadlock
In reply to Sasha LevinFrom: Gang He <[email protected]>
[ Upstream commit 9673e0050c39b0534d0e2ca431223f52089f4959 ]
Usually, ocfs2_downconvert_lock() function always downconverts dlm lock to the expected level for satisfy dlm bast requests from the other nodes.
But there is a rare situation. When dlm lock conversion is being canceled, ocfs2_downconvert_lock() function will return -EBUSY. You need to be aware that ocfs2_cancel_convert() function is asynchronous in fsdlm implementation.
If we does not requeue this lockres entry, ocfs2 downconvert thread no longer handles this dlm lock bast request. Then, the other nodes will not get the dlm lock again, the current node's process will be blocked when acquire this dlm lock again.
--- fs/ocfs2/dlmglue.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
fs/ocfs2/dlmglue.c +12 -0
@@ -18,6 +18,7 @@#include <linux/debugfs.h> #include <linux/seq_file.h> #include <linux/time.h> +#include <linux/delay.h> #include <linux/quotaops.h> #include <linux/sched/signal.h>
@@ -3906,6 +3907,17 @@ static int ocfs2_unblock_lock(struct ocfs2_super *osb,spin_unlock_irqrestore (&lockres->l_lock, flags); ret =ocfs2_downconvert_lock (osb, lockres, new_level, set_lvb, gen); +/* The dlm lock convert is being cancelled in background, +* ocfs2_cancel_convert() is asynchronous in fs/dlm, +* requeue it, try again later. +*/ +if (ret == -EBUSY ) { + ctl->requeue =1 ; +mlog (ML_BASTS ,"lockres %s, ReQ: Downconvert busy\n" , + lockres->l_name); + ret =0 ; +msleep (20 ); + } leave:if (ret)
Signature · 7 lines
2.30.2 _______________________________________________ Ocfs2-devel mailing list [email protected] https://oss.oracle.com/mailman/listinfo/ocfs2-devel
Sasha Levin
maintainerPATCH 1/37 clk: rockchip: rk3036: fix up the sclk_sfc parent error
From: Jon Lin <[email protected]>
[ Upstream commit 0be3df186f870cbde56b223c1ad7892109c9c440 ]
Choose the correct pll
--- drivers/clk/rockchip/clk-rk3036.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/clk/rockchip/clk-rk3036.c +2 -1
@@ -120,6 +120,7 @@ PNAME(mux_pll_src_3plls_p) = { "apll", "dpll", "gpll" };PNAME (mux_timer_p) = {"xin24m" ,"pclk_peri_src" };PNAME (mux_pll_src_apll_dpll_gpll_usb480m_p) = {"apll" ,"dpll" ,"gpll" ,"usb480m" }; +PNAME (mux_pll_src_dmyapll_dpll_gpll_xin24_p) = {"dummy_apll" ,"dpll" ,"gpll" ,"xin24m" };PNAME (mux_mmc_src_p) = {"apll" ,"dpll" ,"gpll" ,"xin24m" };PNAME (mux_i2s_pre_p) = {"i2s_src" ,"i2s_frac" ,"ext_i2s" ,"xin12m" };
@@ -339,7 +340,7 @@ static struct rockchip_clk_branch rk3036_clk_branches[] __initdata = { RK2928_CLKSEL_CON(16), 8, 2, MFLAGS, 10, 5, DFLAGS, RK2928_CLKGATE_CON(10), 4, GFLAGS), -COMPOSITE (SCLK_SFC ,"sclk_sfc" , mux_pll_src_apll_dpll_gpll_usb480m_p,0 , +COMPOSITE (SCLK_SFC ,"sclk_sfc" , mux_pll_src_dmyapll_dpll_gpll_xin24_p,0 ,RK2928_CLKSEL_CON (16 ),0 ,2 ,MFLAGS ,2 ,5 ,DFLAGS , RK2928_CLKGATE_CON(10), 5, GFLAGS),
Signature · 7 lines
2.30.2 _______________________________________________ Linux-rockchip mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-rockchip
Sasha Levin
maintainerPATCH 12/37 powerpc: make the install target not depend on any build artifact
From: Masahiro Yamada <[email protected]>
[ Upstream commit 9bef456b20581e630ef9a13555ca04fed65a859d ]
The install target should not depend on any build artifact.
The reason is explained in commit 19514fc665ff ("arm, kbuild: make "make install" not depend on vmlinux").
Change the PowerPC installation code in a similar way.
--- arch/powerpc/boot/Makefile | 2 +- arch/powerpc/boot/install.sh | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-)
arch/powerpc/boot/Makefile +1 -1
@@ -438,7 +438,7 @@ $(obj)/zImage.initrd: $(addprefix $(obj)/, $(initrd-y)) $(Q)rm -f $@; ln $< $@ # Only install the vmlinux -install: $(CONFIGURE) $(addprefix $(obj)/, $(image-y)) +install: sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" # Install the vmlinux and other built boot targets.
arch/powerpc/boot/install.sh +14 -0
@@ -21,6 +21,20 @@ # Bail with error code if anything goes wrong set -e +verify () { + if [ ! -f "$1" ]; then + echo "" 1>&2 + echo " *** Missing file: $1" 1>&2 + echo ' *** You need to run "make" before "make install".' 1>&2 + echo "" 1>&2 + exit 1 + fi +} + +# Make sure the files actually exist +verify "$2" +verify "$3" + # User may have a custom install script if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 7/37 clk: mediatek: Fix asymmetrical PLL enable and disable control
In reply to Sasha LevinFrom: Chun-Jie Chen <[email protected]>
[ Upstream commit 7cc4e1bbe300c5cf610ece8eca6c6751b8bc74db ]
In fact, the en_mask is a combination of divider enable mask and pll enable bit(bit0).
Before this patch, we enabled both divider mask and bit0 in prepare(), but only cleared the bit0 in unprepare().
In the future, we hope en_mask will only be used as divider enable mask. The enable register(CON0) will be set in 2 steps:
first is divider mask, and then bit0 during prepare(), and vice versa. But considering backward compatibility, at this stage we allow en_mask to be a combination or a pure divider enable mask.
And then we will make en_mask a pure divider enable mask in another following patch series.
--- drivers/clk/mediatek/clk-pll.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)
drivers/clk/mediatek/clk-pll.c +16 -4
@@ -238,6 +238,7 @@ static int mtk_pll_prepare(struct clk_hw *hw) {struct mtk_clk_pll *pll =to_mtk_clk_pll (hw);u32 r; +u32 div_en_mask; r =readl (pll->pwr_addr) |CON0_PWR_ON ;writel (r, pll->pwr_addr);
@@ -247,10 +248,15 @@ static int mtk_pll_prepare(struct clk_hw *hw)writel (r, pll->pwr_addr);udelay (1 ); - r =readl (pll->base_addr +REG_CON0 ); - r |= pll->data->en_mask; + r =readl (pll->base_addr +REG_CON0 ) |CON0_BASE_EN ;writel (r, pll->base_addr +REG_CON0 ); + div_en_mask = pll->data->en_mask & ~CON0_BASE_EN ; +if (div_en_mask) { + r =readl (pll->base_addr +REG_CON0 ) | div_en_mask; +writel (r, pll->base_addr +REG_CON0 ); + } +__mtk_pll_tuner_enable (pll);udelay (20 );
@@ -268,6 +274,7 @@ static void mtk_pll_unprepare(struct clk_hw *hw) {struct mtk_clk_pll *pll =to_mtk_clk_pll (hw);u32 r; +u32 div_en_mask;if (pll->data->flags &HAVE_RST_BAR ) { r =readl (pll->base_addr +REG_CON0 );
@@ -277,8 +284,13 @@ static void mtk_pll_unprepare(struct clk_hw *hw)__mtk_pll_tuner_disable (pll); - r =readl (pll->base_addr +REG_CON0 ); - r &= ~CON0_BASE_EN ; + div_en_mask = pll->data->en_mask & ~CON0_BASE_EN ; +if (div_en_mask) { + r =readl (pll->base_addr +REG_CON0 ) & ~div_en_mask; +writel (r, pll->base_addr +REG_CON0 ); + } + + r =readl (pll->base_addr +REG_CON0 ) & ~CON0_BASE_EN ;writel (r, pll->base_addr +REG_CON0 ); r =readl (pll->pwr_addr) |CON0_ISO_EN ;
Signature · 7 lines
2.30.2 _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
Sasha Levin
maintainerPATCH 24/37 powerpc/32: indirect function call use bctrl rather than blrl in ret_from_kernel_thread
In reply to Sasha LevinFrom: Christophe Leroy <[email protected]>
[ Upstream commit 113ec9ccc8049c3772f0eab46b62c5d6654c09f7 ]
Copied from commit 89bbe4c798bc ("powerpc/64: indirect function call use bctrl rather than blrl in ret_from_kernel_thread")
blrl is not recommended to use as an indirect function call, as it may corrupt the link stack predictor.
This is not a performance critical path but this should be fixed for consistency.
--- arch/powerpc/kernel/entry_32.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/kernel/entry_32.S +2 -2
@@ -485,10 +485,10 @@ ret_from_fork: ret_from_kernel_thread: REST_NVGPRS(r1) bl schedule_tail - mtlr r14 + mtctr r14 mr r3,r15 PPC440EP_ERR42 - blrl + bctrl li r3,0 b ret_from_syscall
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 11/37 scsi: ufs: Verify UIC locking requirements at runtime
In reply to Sasha LevinFrom: Bart Van Assche <[email protected]>
[ Upstream commit 35c7d874f5993db04ce3aa310ae088f14b801eda ]
Instead of documenting the locking requirements of the UIC code as comments, use lockdep_assert_held() such that lockdep verifies the lockdep requirements at runtime if lockdep is enabled.
--- drivers/scsi/ufs/ufshcd.c | 16 +++++++++------- drivers/scsi/ufs/ufshcd.h | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-)
drivers/scsi/ufs/ufshcd.c +9 -7
@@ -1986,15 +1986,15 @@ static inline u8 ufshcd_get_upmcrs(struct ufs_hba *hba) }/** -* ufshcd_dispatch_uic_cmd - Dispatch UIC commands to unipro layers +* ufshcd_dispatch_uic_cmd - Dispatch an UIC command to the Unipro layer * @hba: per adapter instance * @uic_cmd: UIC command -* -* Mutex must be held. */ static inline void ufshcd_dispatch_uic_cmd (struct ufs_hba *hba,struct uic_command *uic_cmd) { +lockdep_assert_held (&hba->uic_cmd_mutex); +WARN_ON (hba->active_uic_cmd); hba->active_uic_cmd = uic_cmd;
@@ -2010,11 +2010,10 @@ ufshcd_dispatch_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd) }/** -* ufshcd_wait_for_uic_cmd - Wait complectioin of UIC command +* ufshcd_wait_for_uic_cmd - Wait for completion of an UIC command * @hba: per adapter instance * @uic_cmd: UIC command * -* Must be called with mutex held. * Returns 0 only if success. */ static int
@@ -2023,6 +2022,8 @@ ufshcd_wait_for_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd)int ret;unsigned long flags; +lockdep_assert_held (&hba->uic_cmd_mutex); +if (wait_for_completion_timeout (&uic_cmd->done,msecs_to_jiffies (UIC_CMD_TIMEOUT ))) ret = uic_cmd->argument2 &MASK_UIC_COMMAND_RESULT ;
@@ -2042,14 +2043,15 @@ ufshcd_wait_for_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd)* @uic_cmd: UIC command * @completion: initialize the completion only if this is set to true * -* Identical to ufshcd_send_uic_cmd() expect mutex. Must be called -* with mutex held and host_lock locked. * Returns 0 only if success. */ static int __ufshcd_send_uic_cmd (struct ufs_hba *hba,struct uic_command *uic_cmd,bool completion) { +lockdep_assert_held (&hba->uic_cmd_mutex); +lockdep_assert_held (hba->host->host_lock); +if (!ufshcd_ready_for_uic_cmd (hba)) {dev_err (hba->dev,"Controller not ready to accept UIC commands\n" );
drivers/scsi/ufs/ufshcd.h +1 -1
@@ -493,7 +493,7 @@ struct ufs_stats {* @priv: pointer to variant specific private data * @irq: Irq number of the controller * @active_uic_cmd: handle of active UIC command -* @uic_cmd_mutex: mutex for uic command +* @uic_cmd_mutex: mutex for UIC command * @tmf_tag_set: TMF tag set. * @tmf_queue: Used to allocate TMF tags. * @pwr_done: completion for power mode change
Signature · 7 lines
2.30.2 _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
Sasha Levin
maintainerPATCH 25/37 powerpc/booke: Avoid link stack corruption in several places
In reply to Sasha LevinFrom: Christophe Leroy <[email protected]>
[ Upstream commit f5007dbf4da729baa850b33a64dc3cc53757bdf8 ]
Use bcl 20,31,+4 instead of bl in order to preserve link stack.
See commit c974809a26a1 ("powerpc/vdso: Avoid link stack corruption in __get_datapage()") for details.
--- arch/powerpc/include/asm/ppc_asm.h | 2 +- arch/powerpc/kernel/exceptions-64e.S | 6 +++--- arch/powerpc/kernel/fsl_booke_entry_mapping.S | 8 ++++---- arch/powerpc/kernel/head_44x.S | 6 +++--- arch/powerpc/kernel/head_fsl_booke.S | 6 +++--- arch/powerpc/mm/nohash/tlb_low.S | 4 ++-- 6 files changed, 16 insertions(+), 16 deletions(-)
arch/powerpc/include/asm/ppc_asm.h +1 -1
@@ -306,7 +306,7 @@ GLUE(.,name):/* Be careful, this will clobber the lr register. */ #define LOAD_REG_ADDR_PIC (reg, name) \ - bl 0f; \ + bcl 20,31,$+4; \ 0: mflr reg; \ addis reg,reg,(name - 0b)@ha; \ addi reg,reg,(name - 0b)@l;
arch/powerpc/kernel/exceptions-64e.S +3 -3
@@ -1245,7 +1245,7 @@ found_iprot: * r3 = MAS0_TLBSEL (for the iprot array) * r4 = SPRN_TLBnCFG */ - bl invstr /* Find our address */ + bcl 20,31,$+4 /* Find our address */ invstr: mflr r6 /* Make it accessible */ mfmsr r7 rlwinm r5,r7,27,31,31 /* extract MSR[IS] */
@@ -1314,7 +1314,7 @@ skpinv: addi r6,r6,1 /* Increment */ mfmsr r6 xori r6,r6,MSR_IS mtspr SPRN_SRR1,r6 - bl 1f /* Find our address */ + bcl 20,31,$+4 /* Find our address */ 1: mflr r6 addi r6,r6,(2f - 1b) mtspr SPRN_SRR0,r6
@@ -1384,7 +1384,7 @@ skpinv: addi r6,r6,1 /* Increment */ * r4 = MAS0 w/TLBSEL & ESEL for the temp mapping */ /* Now we branch the new virtual address mapped by this entry */ - bl 1f /* Find our address */ + bcl 20,31,$+4 /* Find our address */ 1: mflr r6 addi r6,r6,(2f - 1b) tovirt(r6,r6)
arch/powerpc/kernel/fsl_booke_entry_mapping.S +4 -4
@@ -1,7 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0 */ /* 1. Find the index of the entry we're executing in */ - bl invstr /* Find our address */ + bcl 20,31,$+4 /* Find our address */ invstr: mflr r6 /* Make it accessible */ mfmsr r7 rlwinm r4,r7,27,31,31 /* extract MSR[IS] */
@@ -85,7 +85,7 @@ skpinv: addi r6,r6,1 /* Increment */ addi r6,r6,10 slw r6,r8,r6 /* convert to mask */ - bl 1f /* Find our address */ + bcl 20,31,$+4 /* Find our address */ 1: mflr r7 mfspr r8,SPRN_MAS3
@@ -117,7 +117,7 @@ skpinv: addi r6,r6,1 /* Increment */ xori r6,r4,1 slwi r6,r6,5 /* setup new context with other address space */ - bl 1f /* Find our address */ + bcl 20,31,$+4 /* Find our address */ 1: mflr r9 rlwimi r7,r9,0,20,31 addi r7,r7,(2f - 1b)
@@ -218,7 +218,7 @@ next_tlb_setup: lis r7,MSR_KERNEL@h ori r7,r7,MSR_KERNEL@l - bl 1f /* Find our address */ + bcl 20,31,$+4 /* Find our address */ 1: mflr r9 rlwimi r6,r9,0,20,31 addi r6,r6,(2f - 1b)
arch/powerpc/kernel/head_44x.S +3 -3
@@ -70,7 +70,7 @@ _ENTRY(_start); * address. * r21 will be loaded with the physical runtime address of _stext */ - bl 0f /* Get our runtime address */ + bcl 20,31,$+4 /* Get our runtime address */ 0: mflr r21 /* Make it accessible */ addis r21,r21,(_stext - 0b)@ha addi r21,r21,(_stext - 0b)@l /* Get our current runtime base */
@@ -861,7 +861,7 @@ _GLOBAL(init_cpu_state) wmmucr: mtspr SPRN_MMUCR,r3 /* Put MMUCR */ sync - bl invstr /* Find our address */ + bcl 20,31,$+4 /* Find our address */ invstr: mflr r5 /* Make it accessible */ tlbsx r23,0,r5 /* Find entry we are in */ li r4,0 /* Start at TLB entry 0 */
@@ -1053,7 +1053,7 @@ head_start_47x: sync /* Find the entry we are running from */ - bl 1f + bcl 20,31,$+4 1: mflr r23 tlbsx r23,0,r23 tlbre r24,r23,0
arch/powerpc/kernel/head_fsl_booke.S +3 -3
@@ -79,7 +79,7 @@ _ENTRY(_start); mr r23,r3 mr r25,r4 - bl 0f + bcl 20,31,$+4 0: mflr r8 addis r3,r8,(is_second_reloc - 0b)@ha lwz r19,(is_second_reloc - 0b)@l(r3)
@@ -1139,7 +1139,7 @@ _GLOBAL(switch_to_as1) bne 1b /* Get the tlb entry used by the current running code */ - bl 0f + bcl 20,31,$+4 0: mflr r4 tlbsx 0,r4
@@ -1173,7 +1173,7 @@ _GLOBAL(switch_to_as1) _GLOBAL(restore_to_as0) mflr r0 - bl 0f + bcl 20,31,$+4 0: mflr r9 addi r9,r9,1f - 0b
arch/powerpc/mm/nohash/tlb_low.S +2 -2
@@ -214,7 +214,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_476_DD2) * Touch enough instruction cache lines to ensure cache hits */ 1: mflr r9 - bl 2f + bcl 20,31,$+4 2: mflr r6 li r7,32 PPC_ICBT(0,R6,R7) /* touch next cache line */
@@ -442,7 +442,7 @@ _GLOBAL(loadcam_multi) * Set up temporary TLB entry that is the same as what we're * running from, but in AS=1. */ - bl 1f + bcl 20,31,$+4 1: mflr r6 tlbsx 0,r8 mfspr r6,SPRN_MAS1
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 31/37 clk: zynqmp: Fix a memory leak
In reply to Sasha LevinFrom: Shubhrajyoti Datta <[email protected]>
[ Upstream commit e7296d16ef7be11a6001be9bd89906ef55ab2405 ]
Fix a memory leak of mux.
--- drivers/clk/zynqmp/clk-mux-zynqmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/zynqmp/clk-mux-zynqmp.c +1 -1
@@ -132,7 +132,7 @@ struct clk_hw *zynqmp_clk_register_mux(const char *name, u32 clk_id, hw = &mux->hw; ret =clk_hw_register (NULL , hw);if (ret) { -kfree (hw); +kfree (mux); hw =ERR_PTR (ret); }
Signature · 7 lines
2.30.2 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 8/37 HID: usbhid: free raw_report buffers in usbhid_stop
In reply to Sasha LevinFrom: Anirudh Rayabharam <[email protected]>
[ Upstream commit f7744fa16b96da57187dc8e5634152d3b63d72de ]
Free the unsent raw_report buffers when the device is removed.
Fixes a memory leak reported by syzbot at:
https://syzkaller.appspot.com/bug?id=7b4fa7cb1a7c2d3342a2a8a6c53371c8c418ab47
--- drivers/hid/usbhid/hid-core.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/hid/usbhid/hid-core.c +12 -1
@@ -503,7 +503,7 @@ static void hid_ctrl(struct urb *urb)if (unplug) { usbhid->ctrltail = usbhid->ctrlhead; - }else { + }else if (usbhid->ctrlhead != usbhid->ctrltail) { usbhid->ctrltail = (usbhid->ctrltail +1 ) & (HID_CONTROL_FIFO_SIZE -1 ); if (usbhid->ctrlhead != usbhid->ctrltail &&
@@ -1221,9 +1221,20 @@ static void usbhid_stop(struct hid_device *hid)mutex_lock (&usbhid->mutex);clear_bit (HID_STARTED , &usbhid->iofl); +spin_lock_irq (&usbhid->lock);/* Sync with error and led handlers */ set_bit (HID_DISCONNECTED , &usbhid->iofl); +while (usbhid->ctrltail != usbhid->ctrlhead) { +if (usbhid->ctrl[usbhid->ctrltail].dir ==USB_DIR_OUT ) { +kfree (usbhid->ctrl[usbhid->ctrltail].raw_report); + usbhid->ctrl[usbhid->ctrltail].raw_report =NULL ; + } + + usbhid->ctrltail = (usbhid->ctrltail +1 ) & + (HID_CONTROL_FIFO_SIZE -1 ); + }spin_unlock_irq (&usbhid->lock); +usb_kill_urb (usbhid->urbin);usb_kill_urb (usbhid->urbout);usb_kill_urb (usbhid->urbctrl);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 2/37 scsi: be2iscsi: Fix use-after-free during IP updates
In reply to Sasha LevinFrom: Mike Christie <[email protected]>
[ Upstream commit 7b0ddc1346089b62b45e688e350c9e1c3f7a3ab2 ]
This fixes a bug found by Lv Yunlong where, because beiscsi_exec_nemb_cmd() frees memory for the be_dma_mem cmd(), we can access freed memory when beiscsi_if_clr_ip()/beiscsi_if_set_ip()'s call to beiscsi_exec_nemb_cmd() fails and we access the freed req. This fixes the issue by having the caller free the cmd's memory.
--- drivers/scsi/be2iscsi/be_mgmt.c | 84 ++++++++++++++++++--------------- 1 file changed, 45 insertions(+), 39 deletions(-)
drivers/scsi/be2iscsi/be_mgmt.c +45 -39
@@ -234,8 +234,7 @@ static int beiscsi_exec_nemb_cmd(struct beiscsi_hba *phba, wrb =alloc_mcc_wrb (phba, &tag);if (!wrb) {mutex_unlock (&ctrl->mbox_lock); - rc = -ENOMEM ; - goto free_cmd; +return -ENOMEM ; } sge =nonembedded_sgl (wrb);
@@ -268,24 +267,6 @@ static int beiscsi_exec_nemb_cmd(struct beiscsi_hba *phba,/* copy the response, if any */ if (resp_buf)memcpy (resp_buf, nonemb_cmd->va, resp_buf_len); -/** -* This is special case of NTWK_GET_IF_INFO where the size of -* response is not known. beiscsi_if_get_info checks the return -* value to free DMA buffer. -*/ -if (rc == -EAGAIN ) -return rc; - -/** -* If FW is busy that is driver timed out, DMA buffer is saved with -* the tag, only when the cmd completes this buffer is freed. -*/ -if (rc == -EBUSY ) -return rc; - -free_cmd: -dma_free_coherent (&ctrl->pdev->dev, nonemb_cmd->size, - nonemb_cmd->va, nonemb_cmd->dma);return rc; }
@@ -308,6 +289,19 @@ static int beiscsi_prep_nemb_cmd(struct beiscsi_hba *phba,return 0 ; } +static void beiscsi_free_nemb_cmd (struct beiscsi_hba *phba, +struct be_dma_mem *cmd,int rc) +{ +/* +* If FW is busy the DMA buffer is saved with the tag. When the cmd +* completes this buffer is freed. +*/ +if (rc == -EBUSY ) +return ; + +dma_free_coherent (&phba->ctrl.pdev->dev, cmd->size, cmd->va, cmd->dma); +} +static void __beiscsi_eq_delay_compl (struct beiscsi_hba *phba,unsigned int tag) {struct be_dma_mem *tag_mem;
@@ -343,8 +337,16 @@ int beiscsi_modify_eq_delay(struct beiscsi_hba *phba,cpu_to_le32 (set_eqd[i].delay_multiplier); } -return beiscsi_exec_nemb_cmd (phba, &nonemb_cmd, - __beiscsi_eq_delay_compl,NULL ,0 ); + rc =beiscsi_exec_nemb_cmd (phba, &nonemb_cmd, __beiscsi_eq_delay_compl, +NULL ,0 ); +if (rc) { +/* +* Only free on failure. Async cmds are handled like -EBUSY +* where it's handled for us. +*/ +beiscsi_free_nemb_cmd (phba, &nonemb_cmd, rc); + } +return rc; }/**
@@ -371,6 +373,7 @@ int beiscsi_get_initiator_name(struct beiscsi_hba *phba, char *name, bool cfg) req->hdr.version =1 ; rc =beiscsi_exec_nemb_cmd (phba, &nonemb_cmd,NULL , &resp,sizeof (resp)); +beiscsi_free_nemb_cmd (phba, &nonemb_cmd, rc);if (rc) { beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
@@ -448,7 +451,9 @@ static int beiscsi_if_mod_gw(struct beiscsi_hba *phba, req->ip_addr.ip_type = ip_type;memcpy (req->ip_addr.addr, gw, (ip_type <BEISCSI_IP_TYPE_V6 ) ?IP_V4_LEN :IP_V6_LEN ); -return beiscsi_exec_nemb_cmd (phba, &nonemb_cmd,NULL ,NULL ,0 ); + rt_val =beiscsi_exec_nemb_cmd (phba, &nonemb_cmd,NULL ,NULL ,0 ); +beiscsi_free_nemb_cmd (phba, &nonemb_cmd, rt_val); +return rt_val; }int beiscsi_if_set_gw (struct beiscsi_hba *phba,u32 ip_type,u8 *gw)
@@ -498,8 +503,10 @@ int beiscsi_if_get_gw(struct beiscsi_hba *phba, u32 ip_type, req = nonemb_cmd.va; req->ip_type = ip_type; -return beiscsi_exec_nemb_cmd (phba, &nonemb_cmd,NULL , - resp,sizeof (*resp)); + rc =beiscsi_exec_nemb_cmd (phba, &nonemb_cmd,NULL , resp, +sizeof (*resp)); +beiscsi_free_nemb_cmd (phba, &nonemb_cmd, rc); +return rc; } static int
@@ -536,6 +543,7 @@ beiscsi_if_clr_ip(struct beiscsi_hba *phba,"BG_%d : failed to clear IP: rc %d status %d\n" , rc, req->ip_params.ip_record.status); } +beiscsi_free_nemb_cmd (phba, &nonemb_cmd, rc);return rc; }
@@ -580,6 +588,7 @@ beiscsi_if_set_ip(struct beiscsi_hba *phba, u8 *ip,if (req->ip_params.ip_record.status) rc = -EINVAL ; } +beiscsi_free_nemb_cmd (phba, &nonemb_cmd, rc);return rc; }
@@ -607,6 +616,7 @@ int beiscsi_if_en_static(struct beiscsi_hba *phba, u32 ip_type, reldhcp->interface_hndl = phba->interface_handle; reldhcp->ip_type = ip_type; rc =beiscsi_exec_nemb_cmd (phba, &nonemb_cmd,NULL ,NULL ,0 ); +beiscsi_free_nemb_cmd (phba, &nonemb_cmd, rc);if (rc <0 ) { beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_CONFIG, "BG_%d : failed to release existing DHCP: %d\n",
@@ -688,7 +698,7 @@ int beiscsi_if_en_dhcp(struct beiscsi_hba *phba, u32 ip_type) dhcpreq->interface_hndl = phba->interface_handle; dhcpreq->ip_type = ip_type; rc =beiscsi_exec_nemb_cmd (phba, &nonemb_cmd,NULL ,NULL ,0 ); - +beiscsi_free_nemb_cmd (phba, &nonemb_cmd, rc); exit:kfree (if_info);return rc;
@@ -761,11 +771,8 @@ int beiscsi_if_get_info(struct beiscsi_hba *phba, int ip_type,BEISCSI_LOG_INIT |BEISCSI_LOG_CONFIG , "BG_%d : Memory Allocation Failure\n"); -/* Free the DMA memory for the IOCTL issuing */ -dma_free_coherent (&phba->ctrl.pdev->dev, - nonemb_cmd.size, - nonemb_cmd.va, - nonemb_cmd.dma); +beiscsi_free_nemb_cmd (phba, &nonemb_cmd, + -ENOMEM );return -ENOMEM ; }
@@ -780,15 +787,13 @@ int beiscsi_if_get_info(struct beiscsi_hba *phba, int ip_type, nonemb_cmd.va)->actual_resp_len; ioctl_size +=sizeof (struct be_cmd_req_hdr ); -/* Free the previous allocated DMA memory */ -dma_free_coherent (&phba->ctrl.pdev->dev, nonemb_cmd.size, - nonemb_cmd.va, - nonemb_cmd.dma); - +beiscsi_free_nemb_cmd (phba, &nonemb_cmd, rc);/* Free the virtual memory */ kfree (*if_info); - }else + }else { +beiscsi_free_nemb_cmd (phba, &nonemb_cmd, rc);break ; + } }while (true);return rc; }
@@ -805,8 +810,9 @@ int mgmt_get_nic_conf(struct beiscsi_hba *phba,if (rc)return rc; -return beiscsi_exec_nemb_cmd (phba, &nonemb_cmd,NULL , - nic,sizeof (*nic)); + rc =beiscsi_exec_nemb_cmd (phba, &nonemb_cmd,NULL , nic,sizeof (*nic)); +beiscsi_free_nemb_cmd (phba, &nonemb_cmd, rc); +return rc; } static void beiscsi_boot_process_compl(struct beiscsi_hba *phba,
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 3/37 scsi: lpfc: Fix NVMe support reporting in log message
In reply to Sasha LevinFrom: James Smart <[email protected]>
[ Upstream commit ae463b60235e7a5decffbb0bd7209952ccda78eb ]
The NVMe support indicator in log message 6422 is displaying a field that was initialized but never set to indicate NVMe support. Remove obsolete nvme_support element from the lpfc_hba structure and change log message to display NVMe support status as reported in SLI4 Config Parameters mailbox command.
--- drivers/scsi/lpfc/lpfc.h | 1 - drivers/scsi/lpfc/lpfc_init.c | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-)
drivers/scsi/lpfc/lpfc.h +0 -1
@@ -791,7 +791,6 @@ struct lpfc_hba {uint8_t wwpn[8 ];uint32_t RandomData[7 ];uint8_t fcp_embed_io; -uint8_t nvme_support;/* Firmware supports NVME */ uint8_t nvmet_support;/* driver supports NVMET */ #define LPFC_NVMET_MAX_PORTS 32uint8_t mds_diags_support;
drivers/scsi/lpfc/lpfc_init.c +1 -2
@@ -11653,7 +11653,6 @@ lpfc_get_sli4_parameters(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)bf_get (cfg_xib, mbx_sli4_parameters), phba->cfg_enable_fc4_type); fcponly: - phba->nvme_support =0 ; phba->nvmet_support =0 ; phba->cfg_nvmet_mrq =0 ; phba->cfg_nvme_seg_cnt =0 ;
@@ -11714,7 +11713,7 @@ lpfc_get_sli4_parameters(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)"6422 XIB %d PBDE %d: FCP %d NVME %d %d %d\n" ,bf_get (cfg_xib, mbx_sli4_parameters), phba->cfg_enable_pbde, - phba->fcp_embed_io, phba->nvme_support, + phba->fcp_embed_io, sli4_params->nvme, phba->cfg_nvme_embed_cmd, phba->cfg_suppress_rsp); if ((bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) ==
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 5/37 scsi: smartpqi: Fix ISR accessing uninitialized data
In reply to Sasha LevinFrom: Mike McGowen <[email protected]>
[ Upstream commit 0777a3fb98f0ea546561d04db4fd325248c39961 ]
Correct driver's ISR accessing a data structure member that has not been fully initialized during driver initialization.
The pqi queue groups can have uninitialized members when an interrupt fires. This has not resulted in any driver crashes. This was found during our own internal testing. No bugs were ever filed.
--- drivers/scsi/smartpqi/smartpqi_init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/smartpqi/smartpqi_init.c +2 -2
@@ -7208,11 +7208,11 @@ static int pqi_ctrl_init(struct pqi_ctrl_info *ctrl_info)pqi_init_operational_queues (ctrl_info); - rc =pqi_request_irqs (ctrl_info); + rc =pqi_create_queues (ctrl_info);if (rc)return rc; - rc =pqi_create_queues (ctrl_info); + rc =pqi_request_irqs (ctrl_info);if (rc)return rc;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 6/37 scsi: lpfc: Fix cq_id truncation in rq create
In reply to Sasha LevinFrom: James Smart <[email protected]>
[ Upstream commit df3d78c3eb4eba13b3ef9740a8c664508ee644ae ]
On the newer hardware, CQ_ID values can be larger than seen on previous generations. This exposed an issue in the driver where its definition of cq_id in the RQ Create mailbox cmd was too small, thus the cq_id was truncated, causing the command to fail.
Revise the RQ_CREATE CQ_ID field to its proper size (16 bits).
--- drivers/scsi/lpfc/lpfc_hw4.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_hw4.h +1 -1
@@ -1548,7 +1548,7 @@ struct rq_context {#define lpfc_rq_context_hdr_size_WORD word1uint32_t word2;#define lpfc_rq_context_cq_id_SHIFT 16 -#define lpfc_rq_context_cq_id_MASK 0x000003FF +#define lpfc_rq_context_cq_id_MASK 0x0000FFFF#define lpfc_rq_context_cq_id_WORD word2#define lpfc_rq_context_buf_size_SHIFT 0#define lpfc_rq_context_buf_size_MASK 0x0000FFFF
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 15/37 scsi: qla2xxx: Fix port type info
In reply to Sasha LevinFrom: Quinn Tran <[email protected]>
[ Upstream commit 01c97f2dd8fb4d2188c779a975031c0fe1ec061d ]
Over time, fcport->port_type became a flag field. The flags within this field were not defined properly. This caused external tools to read wrong info.
--- drivers/scsi/qla2xxx/qla_def.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/scsi/qla2xxx/qla_def.h +3 -5
@@ -2307,11 +2307,9 @@ struct mbx_24xx_entry {*/ typedef enum { FCT_UNKNOWN, - FCT_RSCN, - FCT_SWITCH, - FCT_BROADCAST, - FCT_INITIATOR, - FCT_TARGET, + FCT_BROADCAST = 0x01, + FCT_INITIATOR = 0x02, + FCT_TARGET = 0x04, FCT_NVME_INITIATOR = 0x10, FCT_NVME_TARGET = 0x20, FCT_NVME_DISCOVERY = 0x40,
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 16/37 scsi: qla2xxx: Fix NPIV create erroneous error
In reply to Sasha LevinFrom: Quinn Tran <[email protected]>
[ Upstream commit a57214443f0f85639a0d9bbb8bd658d82dbf0927 ]
When user creates multiple NPIVs, the switch capabilities field is checked before a vport is allowed to be created. This field is being toggled if a switch scan is in progress. This creates erroneous reject of vport create.
--- drivers/scsi/qla2xxx/qla_init.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_init.c +3 -1
@@ -4359,11 +4359,11 @@ qla2x00_configure_hba(scsi_qla_host_t *vha)/* initialize */ ha->min_external_loopid =SNS_FIRST_LOOP_ID ; ha->operating_mode =LOOP ; - ha->switch_cap =0 ;switch (topo) {case 0 :ql_dbg (ql_dbg_disc, vha,0x200b ,"HBA in NL topology.\n" ); + ha->switch_cap =0 ; ha->current_topology =ISP_CFG_NL ;strcpy (connect_type,"(Loop)" );break ;
@@ -4377,6 +4377,7 @@ qla2x00_configure_hba(scsi_qla_host_t *vha)case 2 :ql_dbg (ql_dbg_disc, vha,0x200d ,"HBA in N P2P topology.\n" ); + ha->switch_cap =0 ; ha->operating_mode =P2P ; ha->current_topology =ISP_CFG_N ;strcpy (connect_type,"(N_Port-to-N_Port)" );
@@ -4393,6 +4394,7 @@ qla2x00_configure_hba(scsi_qla_host_t *vha)default :ql_dbg (ql_dbg_disc, vha,0x200f ,"HBA in unknown topology %x, using NL.\n" , topo); + ha->switch_cap =0 ; ha->current_topology =ISP_CFG_NL ;strcpy (connect_type,"(Loop)" );break ;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 18/37 scsi: target: pscsi: Fix possible null-pointer dereference in pscsi_complete_cmd()
In reply to Sasha LevinFrom: Tuo Li <[email protected]>
[ Upstream commit 0f99792c01d1d6d35b86e850e9ccadd98d6f3e0c ]
The return value of transport_kmap_data_sg() is assigned to the variable buf:
buf = transport_kmap_data_sg(cmd);
And then it is checked:
if (!buf) {This indicates that buf can be NULL. However, it is dereferenced in the following statements:
if (!(buf[3] & 0x80))
buf[3] |= 0x80;
if (!(buf[2] & 0x80))
buf[2] |= 0x80;To fix these possible null-pointer dereferences, dereference buf and call transport_kunmap_data_sg() only when buf is not NULL.
--- drivers/target/target_core_pscsi.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/target/target_core_pscsi.c +9 -9
@@ -622,17 +622,17 @@ static void pscsi_complete_cmd(struct se_cmd *cmd, u8 scsi_status, buf =transport_kmap_data_sg (cmd);if (!buf) { ;/* XXX: TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE */ - } - -if (cdb[0 ] ==MODE_SENSE_10 ) { -if (!(buf[3 ] &0x80 )) - buf[3 ] |=0x80 ; }else { -if (!(buf[2 ] &0x80 )) - buf[2 ] |=0x80 ; - } +if (cdb[0 ] ==MODE_SENSE_10 ) { +if (!(buf[3 ] &0x80 )) + buf[3 ] |=0x80 ; + }else { +if (!(buf[2 ] &0x80 )) + buf[2 ] |=0x80 ; + } -transport_kunmap_data_sg (cmd); +transport_kunmap_data_sg (cmd); + } } } after_mode_sense:
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 23/37 scsi: core: Fix missing FORCE for scsi_devinfo_tbl.c build rule
In reply to Sasha LevinFrom: Masahiro Yamada <[email protected]>
[ Upstream commit 98079418c53fff5f9e2d4087f08eaff2a9ce7714 ]
Add FORCE so that if_changed can detect the command line change. scsi_devinfo_tbl.c must be added to 'targets' too.
--- drivers/scsi/Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/scsi/Makefile +4 -2
@@ -183,7 +183,7 @@ CFLAGS_ncr53c8xx.o := $(ncr53c8xx-flags-y) $(ncr53c8xx-flags-m) zalon7xx-objs := zalon.o ncr53c8xx.o # Files generated that shall be removed upon make clean -clean-files := 53c700_d.h 53c700_u.h scsi_devinfo_tbl.c +clean-files := 53c700_d.h 53c700_u.h $(obj)/53c700.o: $(obj)/53c700_d.h
@@ -192,9 +192,11 @@ $(obj)/scsi_sysfs.o: $(obj)/scsi_devinfo_tbl.c quiet_cmd_bflags = GEN $@ cmd_bflags = sed -n 's/.*define *BLIST_\([A-Z0-9_]*\) *.*/BLIST_FLAG_NAME(\1),/p' $< > $@ -$(obj)/scsi_devinfo_tbl.c: include/scsi/scsi_devinfo.h +$(obj)/scsi_devinfo_tbl.c: include/scsi/scsi_devinfo.h FORCE $(call if_changed,bflags) +targets += scsi_devinfo_tbl.c + # If you want to play with the firmware, uncomment # GENERATE_FIRMWARE := 1
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 21/37 MIPS: mscc: ocelot: disable all switch ports by default
In reply to Sasha LevinFrom: Vladimir Oltean <[email protected]>
[ Upstream commit 0181f6f19c6c35b24f1516d8db22f3bbce762633 ]
The ocelot switch driver used to ignore ports which do not have a phy-handle property and not probe those, but this is not quite ok since it is valid to not have a phy-handle property if there is a fixed-link.
It seems that checking for a phy-handle was a proxy for the proper check which is for the status, but that doesn't make a lot of sense, since the ocelot driver already iterates using for_each_available_child_of_node which skips the disabled ports, so I have no idea.
Anyway, a widespread pattern in device trees is for a SoC dtsi to disable by default all hardware, and let board dts files enable what is used. So let's do that and enable only the ports with a phy-handle in the pcb120 and pcb123 device tree files.
--- arch/mips/boot/dts/mscc/ocelot.dtsi | 11 +++++++++++ arch/mips/boot/dts/mscc/ocelot_pcb120.dts | 8 ++++++++ arch/mips/boot/dts/mscc/ocelot_pcb123.dts | 4 ++++ 3 files changed, 23 insertions(+)
arch/mips/boot/dts/mscc/ocelot.dtsi +11 -0
@@ -148,36 +148,47 @@ ethernet-ports { port0: port@0 { reg = <0>; + status = "disabled"; }; port1: port@1 { reg = <1>; + status = "disabled"; }; port2: port@2 { reg = <2>; + status = "disabled"; }; port3: port@3 { reg = <3>; + status = "disabled"; }; port4: port@4 { reg = <4>; + status = "disabled"; }; port5: port@5 { reg = <5>; + status = "disabled"; }; port6: port@6 { reg = <6>; + status = "disabled"; }; port7: port@7 { reg = <7>; + status = "disabled"; }; port8: port@8 { reg = <8>; + status = "disabled"; }; port9: port@9 { reg = <9>; + status = "disabled"; }; port10: port@10 { reg = <10>; + status = "disabled"; }; }; };
arch/mips/boot/dts/mscc/ocelot_pcb120.dts +8 -0
@@ -59,40 +59,48 @@ phy4: ethernet-phy@3 { }; &port0 { + status = "okay"; phy-handle = <&phy0>; }; &port1 { + status = "okay"; phy-handle = <&phy1>; }; &port2 { + status = "okay"; phy-handle = <&phy2>; }; &port3 { + status = "okay"; phy-handle = <&phy3>; }; &port4 { + status = "okay"; phy-handle = <&phy7>; phy-mode = "sgmii"; phys = <&serdes 4 SERDES1G(2)>; }; &port5 { + status = "okay"; phy-handle = <&phy4>; phy-mode = "sgmii"; phys = <&serdes 5 SERDES1G(5)>; }; &port6 { + status = "okay"; phy-handle = <&phy6>; phy-mode = "sgmii"; phys = <&serdes 6 SERDES1G(3)>; }; &port9 { + status = "okay"; phy-handle = <&phy5>; phy-mode = "sgmii"; phys = <&serdes 9 SERDES1G(4)>;
arch/mips/boot/dts/mscc/ocelot_pcb123.dts +4 -0
@@ -47,17 +47,21 @@ &mdio0 { }; &port0 { + status = "okay"; phy-handle = <&phy0>; }; &port1 { + status = "okay"; phy-handle = <&phy1>; }; &port2 { + status = "okay"; phy-handle = <&phy2>; }; &port3 { + status = "okay"; phy-handle = <&phy3>; };
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 22/37 MIPS: mscc: ocelot: mark the phy-mode for internal PHY ports
In reply to Sasha LevinFrom: Vladimir Oltean <[email protected]>
[ Upstream commit eba54cbb92d28b4f6dc1ed5f73f5187b09d82c08 ]
The ocelot driver was converted to phylink, and that expects a valid phy_interface_t. Without a phy-mode, of_get_phy_mode returns PHY_INTERFACE_MODE_NA, which is not ideal because phylink rejects that.
The ocelot driver was patched to treat PHY_INTERFACE_MODE_NA as PHY_INTERFACE_MODE_INTERNAL to work with the broken DT blobs, but we should fix the device trees and specify the phy-mode too.
--- arch/mips/boot/dts/mscc/ocelot_pcb120.dts | 4 ++++ arch/mips/boot/dts/mscc/ocelot_pcb123.dts | 4 ++++ 2 files changed, 8 insertions(+)
arch/mips/boot/dts/mscc/ocelot_pcb120.dts +4 -0
@@ -61,21 +61,25 @@ phy4: ethernet-phy@3 { &port0 { status = "okay"; phy-handle = <&phy0>; + phy-mode = "internal"; }; &port1 { status = "okay"; phy-handle = <&phy1>; + phy-mode = "internal"; }; &port2 { status = "okay"; phy-handle = <&phy2>; + phy-mode = "internal"; }; &port3 { status = "okay"; phy-handle = <&phy3>; + phy-mode = "internal"; }; &port4 {
arch/mips/boot/dts/mscc/ocelot_pcb123.dts +4 -0
@@ -49,19 +49,23 @@ &mdio0 { &port0 { status = "okay"; phy-handle = <&phy0>; + phy-mode = "internal"; }; &port1 { status = "okay"; phy-handle = <&phy1>; + phy-mode = "internal"; }; &port2 { status = "okay"; phy-handle = <&phy2>; + phy-mode = "internal"; }; &port3 { status = "okay"; phy-handle = <&phy3>; + phy-mode = "internal"; };
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 17/37 ovl: skip checking lower file's i_writecount on truncate
In reply to Sasha LevinFrom: Chengguang Xu <[email protected]>
[ Upstream commit b71759ef1e1730db81dab98e9dab9455e8c7f5a2 ]
It is possible that a directory tree is shared between multiple overlay instances as a lower layer. In this case when one instance executes a file residing on the lower layer, the other instance denies a truncate(2) call on this file.
This only happens for truncate(2) and not for open(2) with the O_TRUNC flag.
Fix this interference and inconsistency by removing the preliminary i_writecount check before copy-up.
This means that unlike on normal filesystems truncate(argv[0]) will now succeed. If this ever causes a regression in a real world use case this needs to be revisited.
One way to fix this properly would be to keep a correct i_writecount in the overlay inode, but that is difficult due to memory mapping code only dealing with the real file/inode.
--- Documentation/filesystems/overlayfs.txt | 3 +++ fs/overlayfs/inode.c | 6 ------ 2 files changed, 3 insertions(+), 6 deletions(-)
Documentation/filesystems/overlayfs.txt +3 -0
@@ -348,6 +348,9 @@ b) If a file residing on a lower layer is opened for read-only and then memory mapped with MAP_SHARED, then subsequent changes to the file are not reflected in the memory mapping. +c) If a file residing on a lower layer is being executed, then opening that +file for write or truncating the file will not be denied with ETXTBSY. + The following options allow overlayfs to act more like a standards compliant filesystem:
fs/overlayfs/inode.c +0 -6
@@ -29,12 +29,6 @@ int ovl_setattr(struct dentry *dentry, struct iattr *attr) goto out;if (attr->ia_valid &ATTR_SIZE ) { -struct inode *realinode =d_inode (ovl_dentry_real (dentry)); - - err = -ETXTBSY ; -if (atomic_read (&realinode->i_writecount) <0 ) - goto out_drop_write; -/* Truncate should trigger data copy up as well */ full_copy_up = true; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 14/37 jbd2: fix portability problems caused by unaligned accesses
In reply to Sasha LevinFrom: Theodore Ts'o <[email protected]>
[ Upstream commit a20d1cebb98bba75f2e34fddc768dd8712c1bded ]
This commit applies the e2fsck/recovery.c portions of commit 1e0c8ca7c08a ("e2fsck: fix portability problems caused by unaligned accesses) from the e2fsprogs git tree.
The on-disk format for the ext4 journal can have unaigned 32-bit integers. This can happen when replaying a journal using a obsolete checksum format (which was never popularly used, since the v3 format replaced v2 while the metadata checksum feature was being stablized).
--- fs/jbd2/recovery.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
fs/jbd2/recovery.c +11 -11
@@ -197,7 +197,7 @@ static int jbd2_descriptor_block_csum_verify(journal_t *j, void *buf)static int count_tags (journal_t *journal,struct buffer_head *bh) {char * tagp; -journal_block_tag_t * tag; +journal_block_tag_t tag;int nr =0 , size = journal->j_blocksize;int tag_bytes =journal_tag_bytes (journal);
@@ -207,14 +207,14 @@ static int count_tags(journal_t *journal, struct buffer_head *bh) tagp = &bh->b_data[sizeof (journal_header_t)];while ((tagp - bh->b_data + tag_bytes) <= size) { - tag = (journal_block_tag_t *) tagp; +memcpy (&tag, tagp,sizeof (tag)); nr++; tagp += tag_bytes; -if (!(tag->t_flags &cpu_to_be16 (JBD2_FLAG_SAME_UUID ))) +if (!(tag.t_flags &cpu_to_be16 (JBD2_FLAG_SAME_UUID ))) tagp +=16 ; -if (tag->t_flags &cpu_to_be16 (JBD2_FLAG_LAST_TAG )) +if (tag.t_flags &cpu_to_be16 (JBD2_FLAG_LAST_TAG ))break ; }
@@ -394,9 +394,9 @@ static int jbd2_commit_block_csum_verify(journal_t *j, void *buf) }static int jbd2_block_tag_csum_verify (journal_t *j,journal_block_tag_t *tag, +journal_block_tag3_t *tag3,void *buf,__u32 sequence) { -journal_block_tag3_t *tag3 = (journal_block_tag3_t *)tag;__u32 csum32;__be32 seq;
@@ -455,7 +455,7 @@ static int do_one_pass(journal_t *journal,while (1 ) {int flags;char * tagp; -journal_block_tag_t * tag; +journal_block_tag_t tag;struct buffer_head * obh;struct buffer_head * nbh;
@@ -560,8 +560,8 @@ static int do_one_pass(journal_t *journal, <= journal->j_blocksize - descr_csum_size) {unsigned long io_block; - tag = (journal_block_tag_t *) tagp; - flags =be16_to_cpu (tag->t_flags); +memcpy (&tag, tagp,sizeof (tag)); + flags =be16_to_cpu (tag.t_flags); io_block = next_log_block++;wrap (journal, next_log_block);
@@ -579,7 +579,7 @@ static int do_one_pass(journal_t *journal,J_ASSERT (obh !=NULL ); blocknr =read_tag_block (journal, - tag); + &tag);/* If the block has been * revoked, then we're all done
@@ -594,8 +594,8 @@ static int do_one_pass(journal_t *journal,/* Look for block corruption */ if (!jbd2_block_tag_csum_verify ( - journal, tag, obh->b_data, -be32_to_cpu (tmp->h_sequence))) { + journal, &tag, (journal_block_tag3_t *)tagp, + obh->b_data,be32_to_cpu (tmp->h_sequence))) {brelse (obh); success = -EFSBADCRC ; printk(KERN_ERR "JBD2: Invalid "
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 30/37 platform/x86: dell-smbios-wmi: Avoid false-positive memcpy() warning
In reply to Sasha LevinFrom: Kees Cook <[email protected]>
[ Upstream commit fb49d9946f96081f9a05d8f305b3f40285afe4a9 ]
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields.
Since all the size checking has already happened, use input.pointer (void *) so memcpy() doesn't get confused about how much is being written.
Avoids this false-positive warning when run-time memcpy() strict bounds checking is enabled:
memcpy: detected field-spanning write (size 4096) of single field (size 36)
WARNING: CPU: 0 PID: 357 at drivers/platform/x86/dell/dell-smbios-wmi.c:74 run_smbios_call+0x110/0x1e0 [dell_smbios]
--- drivers/platform/x86/dell-smbios-wmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/dell-smbios-wmi.c +1 -1
@@ -71,7 +71,7 @@ static int run_smbios_call(struct wmi_device *wdev) obj->integer.value);return -EIO ; } -memcpy (&priv->buf->std, obj->buffer.pointer, obj->buffer.length); +memcpy (input.pointer, obj->buffer.pointer, obj->buffer.length);dev_dbg (&wdev->dev,"result: [%08x,%08x,%08x,%08x]\n" , priv->buf->std.output[0 ], priv->buf->std.output[1 ], priv->buf->std.output[2 ], priv->buf->std.output[3 ]);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 32/37 ext4: if zeroout fails fall back to splitting the extent node
In reply to Sasha LevinFrom: Theodore Ts'o <[email protected]>
[ Upstream commit 308c57ccf4318236be75dfa251c84713e694457b ]
If the underlying storage device is using thin-provisioning, it's possible for a zeroout operation to return ENOSPC.
Commit df22291ff0fd ("ext4: Retry block allocation if we have free blocks left") added logic to retry block allocation since we might get free block after we commit a transaction. But the ENOSPC from thin-provisioning will confuse ext4, and lead to an infinite loop.
Since using zeroout instead of splitting the extent node is an optimization, if it fails, we might as well fall back to splitting the extent node.
--- fs/ext4/extents.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/ext4/extents.c +3 -2
@@ -3740,7 +3740,7 @@ static int ext4_ext_convert_to_initialized(handle_t *handle, split_map.m_len - ee_block); err =ext4_ext_zeroout (inode, &zero_ex1);if (err) - goto out; + goto fallback; split_map.m_len = allocated; } if (split_map.m_lblk - ee_block + split_map.m_len <
@@ -3754,7 +3754,7 @@ static int ext4_ext_convert_to_initialized(handle_t *handle, ext4_ext_pblock(ex)); err =ext4_ext_zeroout (inode, &zero_ex2);if (err) - goto out; + goto fallback; } split_map.m_len += split_map.m_lblk - ee_block;
@@ -3763,6 +3763,7 @@ static int ext4_ext_convert_to_initialized(handle_t *handle, } } +fallback: err =ext4_split_extent (handle, inode, ppath, &split_map, split_flag, flags);if (err >0 )
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 33/37 ext4: Make sure quota files are not grabbed accidentally
In reply to Sasha LevinFrom: Jan Kara <[email protected]>
[ Upstream commit bd2c38cf1726ea913024393a0d11f2e2a3f4c180 ]
If ext4 filesystem is corrupted so that quota files are linked from directory hirerarchy, bad things can happen. E.g. quota files can get corrupted or deleted. Make sure we are not grabbing quota file inodes when we expect normal inodes.
--- fs/ext4/inode.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
fs/ext4/inode.c +6 -2
@@ -4846,6 +4846,7 @@ struct inode *__ext4_iget(struct super_block *sb, unsigned long ino,struct ext4_iloc iloc;struct ext4_inode *raw_inode;struct ext4_inode_info *ei; +struct ext4_super_block *es =EXT4_SB (sb)->s_es;struct inode *inode;journal_t *journal =EXT4_SB (sb)->s_journal;long ret;
@@ -4856,9 +4857,12 @@ struct inode *__ext4_iget(struct super_block *sb, unsigned long ino,projid_t i_projid;if ((!(flags &EXT4_IGET_SPECIAL ) && - (ino <EXT4_FIRST_INO (sb) && ino !=EXT4_ROOT_INO )) || + ((ino <EXT4_FIRST_INO (sb) && ino !=EXT4_ROOT_INO ) || + ino ==le32_to_cpu (es->s_usr_quota_inum) || + ino ==le32_to_cpu (es->s_grp_quota_inum) || + ino ==le32_to_cpu (es->s_prj_quota_inum))) || (ino <EXT4_ROOT_INO ) || - (ino >le32_to_cpu (EXT4_SB (sb)->s_es->s_inodes_count))) { + (ino >le32_to_cpu (es->s_inodes_count))) {if (flags &EXT4_IGET_HANDLE )return ERR_PTR (-ESTALE ); __ext4_error(sb, function, line,
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 29/37 RDMA/core/sa_query: Retry SA queries
In reply to Sasha LevinFrom: Håkon Bugge <[email protected]>
[ Upstream commit 5f5a650999d5718af766fc70a120230b04235a6f ]
A MAD packet is sent as an unreliable datagram (UD). SA requests are sent as MAD packets. As such, SA requests or responses may be silently dropped.
IB Core's MAD layer has a timeout and retry mechanism, which amongst other, is used by RDMA CM. But it is not used by SA queries. The lack of retries of SA queries leads to long specified timeout, and error being returned in case of packet loss. The ULP or user-land process has to perform the retry.
Fix this by taking advantage of the MAD layer's retry mechanism.
First, a check against a zero timeout is added in rdma_resolve_route(). In send_mad(), we set the MAD layer timeout to one tenth of the specified timeout and the number of retries to 10. The special case when timeout is less than 10 is handled.
With this fix:
# ucmatose -c 1000 -S 1024 -C 1
runs stable on an Infiniband fabric. Without this fix, we see an intermittent behavior and it errors out with:
cmatose: event: RDMA_CM_EVENT_ROUTE_ERROR, error: -110
(110 is ETIMEDOUT)
--- drivers/infiniband/core/cma.c | 3 +++ drivers/infiniband/core/sa_query.c | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-)
drivers/infiniband/core/cma.c +3 -0
@@ -2937,6 +2937,9 @@ int rdma_resolve_route(struct rdma_cm_id *id, unsigned long timeout_ms)struct rdma_id_private *id_priv;int ret; +if (!timeout_ms) +return -EINVAL ; + id_priv = container_of(id, struct rdma_id_private, id);if (!cma_comp_exch (id_priv,RDMA_CM_ADDR_RESOLVED ,RDMA_CM_ROUTE_QUERY ))return -EINVAL ;
drivers/infiniband/core/sa_query.c +8 -1
@@ -1360,6 +1360,7 @@ static int send_mad(struct ib_sa_query *query, unsigned long timeout_ms, {unsigned long flags;int ret, id; +const int nmbr_sa_query_retries =10 ;xa_lock_irqsave (&queries, flags); ret =__xa_alloc (&queries, &id, query, xa_limit_32b, gfp_mask);
@@ -1367,7 +1368,13 @@ static int send_mad(struct ib_sa_query *query, unsigned long timeout_ms,if (ret <0 )return ret; - query->mad_buf->timeout_ms = timeout_ms; + query->mad_buf->timeout_ms = timeout_ms / nmbr_sa_query_retries; + query->mad_buf->retries = nmbr_sa_query_retries; +if (!query->mad_buf->timeout_ms) { +/* Special case, very small timeout_ms */ + query->mad_buf->timeout_ms =1 ; + query->mad_buf->retries = timeout_ms; + } query->mad_buf->context[0 ] = query; query->id = id;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 20/37 HID: sony: Fix more ShanWan clone gamepads to not rumble when plugged in.
In reply to Sasha LevinFrom: Ulrich Spörlein <[email protected]>
[ Upstream commit bab94e97323baefe0afccad66e776f9c78b4f521 ]
The device string on these can differ, apparently, including typos. I've bought 2 of these in 2012 and googling shows many folks out there with that broken spelling in their dmesg.
--- drivers/hid/hid-sony.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/hid/hid-sony.c +2 -1
@@ -2847,7 +2847,8 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)if (!strcmp (hdev->name,"FutureMax Dance Mat" )) quirks |=FUTUREMAX_DANCE_MAT ; -if (!strcmp (hdev->name,"SHANWAN PS3 GamePad" )) +if (!strcmp (hdev->name,"SHANWAN PS3 GamePad" ) || + !strcmp (hdev->name,"ShanWan PS(R) Ga`epad" )) quirks |=SHANWAN_GAMEPAD ; sc =devm_kzalloc (&hdev->dev,sizeof (*sc),GFP_KERNEL );
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 35/37 checkkconfigsymbols.py: Fix the '--ignore' option
In reply to Sasha LevinFrom: Ariel Marcovitch <[email protected]>
[ Upstream commit 1439ebd2ce77242400518d4e6a1e85bebcd8084f ]
It seems like the implementation of the --ignore option is broken.
In check_symbols_helper, when going through the list of files, a file is added to the list of source files to check if it matches the ignore pattern. Instead, as stated in the comment below this condition, the file should be added if it doesn't match the pattern.
This means that when providing an ignore pattern, the only files that will be checked will be the ones we want the ignore, in addition to the Kconfig files that don't match the pattern (the check in parse_kconfig_files is done right)
--- scripts/checkkconfigsymbols.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/checkkconfigsymbols.py +1 -1
@@ -329,7 +329,7 @@ def check_symbols_helper(pool, ignore): if REGEX_FILE_KCONFIG.match(gitfile): kconfig_files.append(gitfile) else: - if ignore and not re.match(ignore, gitfile): + if ignore and re.match(ignore, gitfile): continue # add source files that do not match the ignore pattern source_files.append(gitfile)
Signature · 1 line
2.30.2
Re: [PATCH AUTOSEL 5.4 22/37] MIPS: mscc: ocelot: mark the phy-mode for internal PHY ports
In reply to Sasha LevinHi Sasha,
Quoted 8 lines · Sasha Levin
From: Vladimir Oltean <[email protected]>
[ Upstream commit
eba54cbb92d28b4f6dc1ed5f73f5187b09d82c08]The ocelot driver was converted to phylink, and that expects a valid
phy_interface_t. Without a phy-mode,of_get_phy_modereturnsPHY_INTERFACE_MODE_NA, which is not ideal because phylink rejects that.
Quoted 8 lines
The ocelot driver was patched to treat
PHY_INTERFACE_MODE_NAasPHY_INTERFACE_MODE_INTERNALto work with the broken DT blobs, but we should fix the device trees and specify the phy-mode too.Signed-off-by Vladimir Oltean <[email protected]>Signed-off-by Thomas Bogendoerfer <[email protected]>Signed-off-by Sasha Levin <[email protected]>---
Could you please drop this patch?
As discussed here, I did not bother to patch the ocelot switch driver on stable kernels to support the new device tree binding too:
https://lore.kernel.org/lkml/[email protected]/
So backporting the device tree change would break the old driver.