6.6.120-rc1 review
Subsystems (6)
Greg Kroah-Hartman
maintainerPATCH 701/737 media: mediatek: vcodec: Use spinlock for context list protection lock
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen-Yu Tsai <[email protected]>
[ Upstream commit a5844227e0f030d2af2d85d4aed10c5eca6ca176 ]
Previously a mutex was added to protect the encoder and decoder context lists from unexpected changes originating from the SCP IP block, causing the context pointer to go invalid, resulting in a NULL pointer dereference in the IPI handler.
Turns out on the MT8173, the VPU IPI handler is called from hard IRQ context. This causes a big warning from the scheduler. This was first reported downstream on the ChromeOS kernels, but is also reproducible on mainline using Fluster with the FFmpeg v4l2m2m decoders. Even though the actual capture format is not supported, the affected code paths are triggered.
Since this lock just protects the context list and operations on it are very fast, it should be OK to switch to a spinlock.
--- drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_vpu.c | 10 +++++--- drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c | 12 +++++----- drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.h | 2 - drivers/media/platform/mediatek/vcodec/decoder/vdec_vpu_if.c | 5 ++-- drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c | 12 +++++----- drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.h | 2 - drivers/media/platform/mediatek/vcodec/encoder/venc_vpu_if.c | 5 ++-- 7 files changed, 28 insertions(+), 20 deletions(-)
drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_vpu.c +6 -4
@@ -47,30 +47,32 @@ static void mtk_vcodec_vpu_reset_dec_han {struct mtk_vcodec_dec_dev *dev = priv;struct mtk_vcodec_dec_ctx *ctx; +unsigned long flags;dev_err (&dev->plat_dev->dev,"Watchdog timeout!!" ); -mutex_lock (&dev->dev_ctx_lock); +spin_lock_irqsave (&dev->dev_ctx_lock, flags);list_for_each_entry (ctx, &dev->ctx_list, list) { ctx->state =MTK_STATE_ABORT ;mtk_v4l2_vdec_dbg (0 , ctx,"[%d] Change to state MTK_STATE_ABORT" , ctx->id); } -mutex_unlock (&dev->dev_ctx_lock); +spin_unlock_irqrestore (&dev->dev_ctx_lock, flags); }static void mtk_vcodec_vpu_reset_enc_handler (void *priv) {struct mtk_vcodec_enc_dev *dev = priv;struct mtk_vcodec_enc_ctx *ctx; +unsigned long flags;dev_err (&dev->plat_dev->dev,"Watchdog timeout!!" ); -mutex_lock (&dev->dev_ctx_lock); +spin_lock_irqsave (&dev->dev_ctx_lock, flags);list_for_each_entry (ctx, &dev->ctx_list, list) { ctx->state =MTK_STATE_ABORT ;mtk_v4l2_vdec_dbg (0 , ctx,"[%d] Change to state MTK_STATE_ABORT" , ctx->id); } -mutex_unlock (&dev->dev_ctx_lock); +spin_unlock_irqrestore (&dev->dev_ctx_lock, flags); }static const struct mtk_vcodec_fw_ops mtk_vcodec_vpu_msg = {
drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c +7 -5
@@ -198,6 +198,7 @@ static int fops_vcodec_open(struct filestruct mtk_vcodec_dec_ctx *ctx =NULL ;int ret =0 , i, hw_count;struct vb2_queue *src_vq; +unsigned long flags; ctx =kzalloc (sizeof (*ctx),GFP_KERNEL );if (!ctx)
@@ -268,9 +269,9 @@ static int fops_vcodec_open(struct file ctx->dev->vdec_pdata->init_vdec_params (ctx); -mutex_lock (&dev->dev_ctx_lock); +spin_lock_irqsave (&dev->dev_ctx_lock, flags);list_add (&ctx->list, &dev->ctx_list); -mutex_unlock (&dev->dev_ctx_lock); +spin_unlock_irqrestore (&dev->dev_ctx_lock, flags);mtk_vcodec_dbgfs_create (ctx);mutex_unlock (&dev->dev_mutex);
@@ -295,6 +296,7 @@ static int fops_vcodec_release(struct fi {struct mtk_vcodec_dec_dev *dev =video_drvdata (file);struct mtk_vcodec_dec_ctx *ctx =fh_to_dec_ctx (file->private_data); +unsigned long flags;mtk_v4l2_vdec_dbg (0 , ctx,"[%d] decoder" , ctx->id);mutex_lock (&dev->dev_mutex);
@@ -313,9 +315,9 @@ static int fops_vcodec_release(struct fiv4l2_ctrl_handler_free (&ctx->ctrl_hdl);mtk_vcodec_dbgfs_remove (dev, ctx->id); -mutex_lock (&dev->dev_ctx_lock); +spin_lock_irqsave (&dev->dev_ctx_lock, flags);list_del_init (&ctx->list); -mutex_unlock (&dev->dev_ctx_lock); +spin_unlock_irqrestore (&dev->dev_ctx_lock, flags);kfree (ctx);mutex_unlock (&dev->dev_mutex);return 0 ;
@@ -382,7 +384,7 @@ static int mtk_vcodec_probe(struct platffor (i =0 ; i <MTK_VDEC_HW_MAX ; i++)mutex_init (&dev->dec_mutex[i]);mutex_init (&dev->dev_mutex); -mutex_init (&dev->dev_ctx_lock); +spin_lock_init (&dev->dev_ctx_lock);spin_lock_init (&dev->irqlock); snprintf(dev->v4l2_dev.name, sizeof(dev->v4l2_dev.name), "%s",
drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.h +1 -1
@@ -271,7 +271,7 @@ struct mtk_vcodec_dec_dev {/* decoder hardware mutex lock */ struct mutex dec_mutex[MTK_VDEC_HW_MAX ];struct mutex dev_mutex; -struct mutex dev_ctx_lock; +spinlock_t dev_ctx_lock;struct workqueue_struct *decode_workqueue;spinlock_t irqlock;
drivers/media/platform/mediatek/vcodec/decoder/vdec_vpu_if.c +3 -2
@@ -75,16 +75,17 @@ static void handle_get_param_msg_ack(constatic bool vpu_dec_check_ap_inst (struct mtk_vcodec_dec_dev *dec_dev,struct vdec_vpu_inst *vpu) {struct mtk_vcodec_dec_ctx *ctx; +unsigned long flags;int ret = false; -mutex_lock (&dec_dev->dev_ctx_lock); +spin_lock_irqsave (&dec_dev->dev_ctx_lock, flags);list_for_each_entry (ctx, &dec_dev->ctx_list, list) {if (!IS_ERR_OR_NULL (ctx) && ctx->vpu_inst == vpu) { ret = true;break ; } } -mutex_unlock (&dec_dev->dev_ctx_lock); +spin_unlock_irqrestore (&dec_dev->dev_ctx_lock, flags);return ret; }
drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c +7 -5
@@ -117,6 +117,7 @@ static int fops_vcodec_open(struct filestruct mtk_vcodec_enc_ctx *ctx =NULL ;int ret =0 ;struct vb2_queue *src_vq; +unsigned long flags; ctx =kzalloc (sizeof (*ctx),GFP_KERNEL );if (!ctx)
@@ -177,9 +178,9 @@ static int fops_vcodec_open(struct filemtk_v4l2_venc_dbg (2 , ctx,"Create instance [%d]@%p m2m_ctx=%p " , ctx->id, ctx, ctx->m2m_ctx); -mutex_lock (&dev->dev_ctx_lock); +spin_lock_irqsave (&dev->dev_ctx_lock, flags);list_add (&ctx->list, &dev->ctx_list); -mutex_unlock (&dev->dev_ctx_lock); +spin_unlock_irqrestore (&dev->dev_ctx_lock, flags);mutex_unlock (&dev->dev_mutex); mtk_v4l2_venc_dbg(0, ctx, "%s encoder [%d]", dev_name(&dev->plat_dev->dev),
@@ -204,6 +205,7 @@ static int fops_vcodec_release(struct fi {struct mtk_vcodec_enc_dev *dev =video_drvdata (file);struct mtk_vcodec_enc_ctx *ctx =fh_to_enc_ctx (file->private_data); +unsigned long flags;mtk_v4l2_venc_dbg (1 , ctx,"[%d] encoder" , ctx->id);mutex_lock (&dev->dev_mutex);
@@ -214,9 +216,9 @@ static int fops_vcodec_release(struct fiv4l2_fh_exit (&ctx->fh);v4l2_ctrl_handler_free (&ctx->ctrl_hdl); -mutex_lock (&dev->dev_ctx_lock); +spin_lock_irqsave (&dev->dev_ctx_lock, flags);list_del_init (&ctx->list); -mutex_unlock (&dev->dev_ctx_lock); +spin_unlock_irqrestore (&dev->dev_ctx_lock, flags);kfree (ctx);mutex_unlock (&dev->dev_mutex);return 0 ;
@@ -298,7 +300,7 @@ static int mtk_vcodec_probe(struct platfmutex_init (&dev->enc_mutex);mutex_init (&dev->dev_mutex); -mutex_init (&dev->dev_ctx_lock); +spin_lock_init (&dev->dev_ctx_lock);spin_lock_init (&dev->irqlock); snprintf(dev->v4l2_dev.name, sizeof(dev->v4l2_dev.name), "%s",
drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.h +1 -1
@@ -206,7 +206,7 @@ struct mtk_vcodec_enc_dev {/* encoder hardware mutex lock */ struct mutex enc_mutex;struct mutex dev_mutex; -struct mutex dev_ctx_lock; +spinlock_t dev_ctx_lock;struct workqueue_struct *encode_workqueue;int enc_irq;
drivers/media/platform/mediatek/vcodec/encoder/venc_vpu_if.c +3 -2
@@ -45,16 +45,17 @@ static void handle_enc_encode_msg(structstatic bool vpu_enc_check_ap_inst (struct mtk_vcodec_enc_dev *enc_dev,struct venc_vpu_inst *vpu) {struct mtk_vcodec_enc_ctx *ctx; +unsigned long flags;int ret = false; -mutex_lock (&enc_dev->dev_ctx_lock); +spin_lock_irqsave (&enc_dev->dev_ctx_lock, flags);list_for_each_entry (ctx, &enc_dev->ctx_list, list) {if (!IS_ERR_OR_NULL (ctx) && ctx->vpu_inst == vpu) { ret = true;break ; } } -mutex_unlock (&enc_dev->dev_ctx_lock); +spin_unlock_irqrestore (&enc_dev->dev_ctx_lock, flags);return ret; }
Greg Kroah-Hartman
maintainerPATCH 702/737 KVM: SVM: Introduce svm_recalc_lbr_msr_intercepts()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yosry Ahmed <[email protected]>
Introduce a helper updating the intercepts for LBR MSRs, similar to the one introduced upstream by commit 160f143cc131 ("KVM: SVM: Manually recalc all MSR intercepts on userspace MSR filter change"). The main difference is that this version uses set_msr_interception(), which has inverted polarity compared to svm_set_intercept_for_msr().
This is intended to simplify incoming backports. No functional changes intended.
--- arch/x86/kvm/svm/svm.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-)
arch/x86/kvm/svm/svm.c +21 -11
@@ -1012,18 +1012,31 @@ void svm_copy_lbrs(struct vmcb *to_vmcb,vmcb_mark_dirty (to_vmcb,VMCB_LBR ); } -void svm_enable_lbrv (struct kvm_vcpu *vcpu) +static void svm_recalc_lbr_msr_intercepts (struct kvm_vcpu *vcpu) {struct vcpu_svm *svm =to_svm (vcpu); +bool intercept = !(svm->vmcb->control.virt_ext &LBR_CTL_ENABLE_MASK ); - svm->vmcb->control.virt_ext |=LBR_CTL_ENABLE_MASK ; -set_msr_interception (vcpu, svm->msrpm,MSR_IA32_LASTBRANCHFROMIP ,1 ,1 ); -set_msr_interception (vcpu, svm->msrpm,MSR_IA32_LASTBRANCHTOIP ,1 ,1 ); -set_msr_interception (vcpu, svm->msrpm,MSR_IA32_LASTINTFROMIP ,1 ,1 ); -set_msr_interception (vcpu, svm->msrpm,MSR_IA32_LASTINTTOIP ,1 ,1 ); +set_msr_interception (vcpu, svm->msrpm,MSR_IA32_LASTBRANCHFROMIP , + !intercept, !intercept); +set_msr_interception (vcpu, svm->msrpm,MSR_IA32_LASTBRANCHTOIP , + !intercept, !intercept); +set_msr_interception (vcpu, svm->msrpm,MSR_IA32_LASTINTFROMIP , + !intercept, !intercept); +set_msr_interception (vcpu, svm->msrpm,MSR_IA32_LASTINTTOIP , + !intercept, !intercept);if (sev_es_guest (vcpu->kvm)) -set_msr_interception (vcpu, svm->msrpm,MSR_IA32_DEBUGCTLMSR ,1 ,1 ); +set_msr_interception (vcpu, svm->msrpm,MSR_IA32_DEBUGCTLMSR , + !intercept, !intercept); +} + +void svm_enable_lbrv (struct kvm_vcpu *vcpu) +{ +struct vcpu_svm *svm =to_svm (vcpu); + + svm->vmcb->control.virt_ext |=LBR_CTL_ENABLE_MASK ; +svm_recalc_lbr_msr_intercepts (vcpu);/* Move the LBR msrs to the vmcb02 so that the guest can see them. */ if (is_guest_mode (vcpu))
@@ -1037,10 +1050,7 @@ static void svm_disable_lbrv(struct kvm_KVM_BUG_ON (sev_es_guest (vcpu->kvm), vcpu->kvm); svm->vmcb->control.virt_ext &= ~LBR_CTL_ENABLE_MASK ; -set_msr_interception (vcpu, svm->msrpm,MSR_IA32_LASTBRANCHFROMIP ,0 ,0 ); -set_msr_interception (vcpu, svm->msrpm,MSR_IA32_LASTBRANCHTOIP ,0 ,0 ); -set_msr_interception (vcpu, svm->msrpm,MSR_IA32_LASTINTFROMIP ,0 ,0 ); -set_msr_interception (vcpu, svm->msrpm,MSR_IA32_LASTINTTOIP ,0 ,0 ); +svm_recalc_lbr_msr_intercepts (vcpu);/* * Move the LBR msrs back to the vmcb01 to avoid copying them
Greg Kroah-Hartman
maintainerPATCH 703/737 KVM: nSVM: Always recalculate LBR MSR intercepts in svm_update_lbrv()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yosry Ahmed <[email protected]>
commit fbe5e5f030c22ae717ee422aaab0e00ea84fab5e upstream.
svm_update_lbrv() is called when MSR_IA32_DEBUGCTLMSR is updated, and on nested transitions where LBRV is used. It checks whether LBRV enablement needs to be changed in the current VMCB, and if it does, it also recalculate intercepts to LBR MSRs.
However, there are cases where intercepts need to be updated even when LBRV enablement doesn't. Example scenario:
- L1 has MSR_IA32_DEBUGCTLMSR cleared.
- L1 runs L2 without LBR_CTL_ENABLE (no LBRV).
- L2 sets DEBUGCTLMSR_LBR in MSR_IA32_DEBUGCTLMSR, svm_update_lbrv() sets LBR_CTL_ENABLE in VMCB02 and disables intercepts to LBR MSRs.
- L2 exits to L1, svm_update_lbrv() is not called on this transition.
- L1 clears MSR_IA32_DEBUGCTLMSR, svm_update_lbrv() finds that LBR_CTL_ENABLE is already cleared in VMCB01 and does nothing.
- Intercepts remain disabled, L1 reads to LBR MSRs read the host MSRs.
Fix it by always recalculating intercepts in svm_update_lbrv().
--- arch/x86/kvm/svm/svm.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-)
arch/x86/kvm/svm/svm.c +19 -10
@@ -1031,26 +1031,30 @@ static void svm_recalc_lbr_msr_intercept !intercept, !intercept); } -void svm_enable_lbrv (struct kvm_vcpu *vcpu) +static void __svm_enable_lbrv (struct kvm_vcpu *vcpu) {struct vcpu_svm *svm =to_svm (vcpu); svm->vmcb->control.virt_ext |=LBR_CTL_ENABLE_MASK ; -svm_recalc_lbr_msr_intercepts (vcpu);/* Move the LBR msrs to the vmcb02 so that the guest can see them. */ if (is_guest_mode (vcpu))svm_copy_lbrs (svm->vmcb, svm->vmcb01.ptr); } -static void svm_disable_lbrv (struct kvm_vcpu *vcpu) +void svm_enable_lbrv (struct kvm_vcpu *vcpu) +{ +__svm_enable_lbrv (vcpu); +svm_recalc_lbr_msr_intercepts (vcpu); +} + +static void __svm_disable_lbrv (struct kvm_vcpu *vcpu) {struct vcpu_svm *svm =to_svm (vcpu);KVM_BUG_ON (sev_es_guest (vcpu->kvm), vcpu->kvm); svm->vmcb->control.virt_ext &= ~LBR_CTL_ENABLE_MASK ; -svm_recalc_lbr_msr_intercepts (vcpu);/* * Move the LBR msrs back to the vmcb01 to avoid copying them
@@ -1079,13 +1083,18 @@ void svm_update_lbrv(struct kvm_vcpu *vc (is_guest_mode (vcpu) &&guest_can_use (vcpu,X86_FEATURE_LBRV ) && (svm->nested.ctl.virt_ext &LBR_CTL_ENABLE_MASK )); -if (enable_lbrv == current_enable_lbrv) -return ; +if (enable_lbrv && !current_enable_lbrv) +__svm_enable_lbrv (vcpu); +else if (!enable_lbrv && current_enable_lbrv) +__svm_disable_lbrv (vcpu); -if (enable_lbrv) -svm_enable_lbrv (vcpu); -else -svm_disable_lbrv (vcpu); +/* +* During nested transitions, it is possible that the current VMCB has +* LBR_CTL set, but the previous LBR_CTL had it cleared (or vice versa). +* In this case, even though LBR_CTL does not need an update, intercepts +* do, so always recalculate the intercepts here. +*/ +svm_recalc_lbr_msr_intercepts (vcpu); }void disable_nmi_singlestep (struct vcpu_svm *svm)
Greg Kroah-Hartman
maintainerPATCH 704/737 KVM: nSVM: Fix and simplify LBR virtualization handling with nested
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yosry Ahmed <[email protected]>
commit 8a4821412cf2c1429fffa07c012dd150f2edf78c upstream.
The current scheme for handling LBRV when nested is used is very complicated, especially when L1 does not enable LBRV (i.e. does not set LBR_CTL_ENABLE_MASK).
To avoid copying LBRs between VMCB01 and VMCB02 on every nested transition, the current implementation switches between using VMCB01 or VMCB02 as the source of truth for the LBRs while L2 is running. If L2 enables LBR, VMCB02 is used as the source of truth. When L2 disables LBR, the LBRs are copied to VMCB01 and VMCB01 is used as the source of truth. This introduces significant complexity, and incorrect behavior in some cases.
For example, on a nested #VMEXIT, the LBRs are only copied from VMCB02 to VMCB01 if LBRV is enabled in VMCB01. This is because L2's writes to MSR_IA32_DEBUGCTLMSR to enable LBR are intercepted and propagated to VMCB01 instead of VMCB02. However, LBRV is only enabled in VMCB02 when L2 is running.
This means that if L2 enables LBR and exits to L1, the LBRs will not be propagated from VMCB02 to VMCB01, because LBRV is disabled in VMCB01.
There is no meaningful difference in CPUID rate in L2 when copying LBRs on every nested transition vs. the current approach, so do the simple and correct thing and always copy LBRs between VMCB01 and VMCB02 on nested transitions (when LBRV is disabled by L1). Drop the conditional LBRs copying in __svm_{enable/disable}_lbrv() as it is now unnecessary.
VMCB02 becomes the only source of truth for LBRs when L2 is running, regardless of LBRV being enabled by L1, drop svm_get_lbr_vmcb() and use svm->vmcb directly in its place.
--- arch/x86/kvm/svm/nested.c | 20 ++++++------------- arch/x86/kvm/svm/svm.c | 47 +++++++++------------------------------------- 2 files changed, 17 insertions(+), 50 deletions(-)
arch/x86/kvm/svm/nested.c +7 -13
@@ -601,11 +601,10 @@ static void nested_vmcb02_prepare_save(s*/ svm_copy_lbrs (vmcb02, vmcb12); vmcb02->save.dbgctl &= ~DEBUGCTL_RESERVED_BITS ; -svm_update_lbrv (&svm->vcpu); - - }else if (unlikely (vmcb01->control.virt_ext &LBR_CTL_ENABLE_MASK )) { + }else {svm_copy_lbrs (vmcb02, vmcb01); } +svm_update_lbrv (&svm->vcpu); }static inline bool is_evtinj_soft (u32 evtinj)
@@ -731,11 +730,7 @@ static void nested_vmcb02_prepare_contro svm->soft_int_next_rip = vmcb12_rip; } - vmcb02->control.virt_ext = vmcb01->control.virt_ext & -LBR_CTL_ENABLE_MASK ; -if (guest_can_use (vcpu,X86_FEATURE_LBRV )) - vmcb02->control.virt_ext |= - (svm->nested.ctl.virt_ext &LBR_CTL_ENABLE_MASK ); +/* LBR_CTL_ENABLE_MASK is controlled by svm_update_lbrv() */ if (!nested_vmcb_needs_vls_intercept (svm)) vmcb02->control.virt_ext |=VIRTUAL_VMLOAD_VMSAVE_ENABLE_MASK ;
@@ -1066,13 +1061,12 @@ int nested_svm_vmexit(struct vcpu_svm *skvm_make_request (KVM_REQ_EVENT , &svm->vcpu);if (unlikely (guest_can_use (vcpu,X86_FEATURE_LBRV ) && - (svm->nested.ctl.virt_ext &LBR_CTL_ENABLE_MASK ))) { + (svm->nested.ctl.virt_ext &LBR_CTL_ENABLE_MASK )))svm_copy_lbrs (vmcb12, vmcb02); -svm_update_lbrv (vcpu); - }else if (unlikely (vmcb01->control.virt_ext &LBR_CTL_ENABLE_MASK )) { +else svm_copy_lbrs (vmcb01, vmcb02); -svm_update_lbrv (vcpu); - } + +svm_update_lbrv (vcpu);if (vnmi) {if (vmcb02->control.int_ctl &V_NMI_BLOCKING_MASK )
arch/x86/kvm/svm/svm.c +10 -37
88 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 675/737 ext4: fix error message when rejecting the default hash
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gabriel Krisman Bertazi <[email protected]>
[ Upstream commit a2187431c395cdfbf144e3536f25468c64fc7cfa ]
Commit 985b67cd8639 ("ext4: filesystems without casefold feature cannot be mounted with siphash") properly rejects volumes where s_def_hash_version is set to DX_HASH_SIPHASH, but the check and the error message should not look into casefold setup - a filesystem should never have DX_HASH_SIPHASH as the default hash. Fix it and, since we are there, move the check to ext4_hash_info_init.
be mounted with siphash")
[ The commit a2187431c395 intended to remove the if-block which was used
for an old SIPHASH rejection check. ]
--- fs/ext4/ext4.h | 1 + fs/ext4/super.c | 20 +++++++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-)
fs/ext4/ext4.h +1 -0
@@ -2459,6 +2459,7 @@ static inline __le16 ext4_rec_len_to_dis#define DX_HASH_HALF_MD4_UNSIGNED 4#define DX_HASH_TEA_UNSIGNED 5#define DX_HASH_SIPHASH 6 +#define DX_HASH_LAST DX_HASH_SIPHASHstatic inline u32 ext4_chksum (struct ext4_sb_info *sbi,u32 crc,const void *address,unsigned int length)
fs/ext4/super.c +17 -3
@@ -5140,16 +5140,27 @@ out:return ret; } -static void ext4_hash_info_init (struct super_block *sb) +static int ext4_hash_info_init (struct super_block *sb) {struct ext4_sb_info *sbi =EXT4_SB (sb);struct ext4_super_block *es = sbi->s_es;unsigned int i; + sbi->s_def_hash_version = es->s_def_hash_version; + +if (sbi->s_def_hash_version >DX_HASH_LAST ) { +ext4_msg (sb,KERN_ERR , +"Invalid default hash set in the superblock" ); +return -EINVAL ; + }else if (sbi->s_def_hash_version ==DX_HASH_SIPHASH ) { +ext4_msg (sb,KERN_ERR , +"SIPHASH is not a valid default hash value" ); +return -EINVAL ; + } +for (i =0 ; i <4 ; i++) sbi->s_hash_seed[i] =le32_to_cpu (es->s_hash_seed[i]); - sbi->s_def_hash_version = es->s_def_hash_version;if (ext4_has_feature_dir_index (sb)) { i =le32_to_cpu (es->s_flags);if (i &EXT2_FLAGS_UNSIGNED_HASH )
@@ -5167,6 +5178,7 @@ static void ext4_hash_info_init(struct s#endif } } +return 0 ; }static int ext4_block_group_meta_init (struct super_block *sb,int silent)
@@ -5311,7 +5323,9 @@ static int __ext4_fill_super(struct fs_cif (err) goto failed_mount; -ext4_hash_info_init (sb); + err =ext4_hash_info_init (sb); +if (err) + goto failed_mount; err =ext4_handle_clustersize (sb);if (err)
Greg Kroah-Hartman
maintainerPATCH 676/737 ext4: introduce ITAIL helper
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ye Bin <[email protected]>
[ Upstream commit 69f3a3039b0d0003de008659cafd5a1eaaa0a7a4 ]
Introduce ITAIL helper to get the bound of xattr in inode.
--- fs/ext4/xattr.c | 10 +++++----- fs/ext4/xattr.h | 3 +++ 2 files changed, 8 insertions(+), 5 deletions(-)
fs/ext4/xattr.c +5 -5
@@ -653,7 +653,7 @@ ext4_xattr_ibody_get(struct inode *inodereturn error; raw_inode =ext4_raw_inode (&iloc); header =IHDR (inode, raw_inode); - end = (void *)raw_inode +EXT4_SB (inode->i_sb)->s_inode_size; + end =ITAIL (inode, raw_inode); error =xattr_check_inode (inode, header, end);if (error) goto cleanup;
@@ -797,7 +797,7 @@ ext4_xattr_ibody_list(struct dentry *denreturn error; raw_inode =ext4_raw_inode (&iloc); header =IHDR (inode, raw_inode); - end = (void *)raw_inode +EXT4_SB (inode->i_sb)->s_inode_size; + end =ITAIL (inode, raw_inode); error =xattr_check_inode (inode, header, end);if (error) goto cleanup;
@@ -883,7 +883,7 @@ int ext4_get_inode_usage(struct inode *i goto out; raw_inode =ext4_raw_inode (&iloc); header =IHDR (inode, raw_inode); - end = (void *)raw_inode +EXT4_SB (inode->i_sb)->s_inode_size; + end =ITAIL (inode, raw_inode); ret =xattr_check_inode (inode, header, end);if (ret) goto out;
@@ -2248,7 +2248,7 @@ int ext4_xattr_ibody_find(struct inode * header =IHDR (inode, raw_inode); is->s.base = is->s.first =IFIRST (header); is->s.here = is->s.first; - is->s.end = (void *)raw_inode +EXT4_SB (inode->i_sb)->s_inode_size; + is->s.end =ITAIL (inode, raw_inode);if (ext4_test_inode_state (inode,EXT4_STATE_XATTR )) { error =xattr_check_inode (inode, header, is->s.end);if (error)
@@ -2799,7 +2799,7 @@ retry:*/ base =IFIRST (header); - end = (void *)raw_inode +EXT4_SB (inode->i_sb)->s_inode_size; + end =ITAIL (inode, raw_inode); min_offs = end - base; total_ino =sizeof (struct ext4_xattr_ibody_header ) +sizeof (u32);
fs/ext4/xattr.h +3 -0
@@ -68,6 +68,9 @@ struct ext4_xattr_entry { ((void *)raw_inode + \ EXT4_GOOD_OLD_INODE_SIZE + \ EXT4_I(inode)->i_extra_isize)) +#define ITAIL (inode, raw_inode) \ + ((void *)(raw_inode) + \ + EXT4_SB((inode)->i_sb)->s_inode_size)#define IFIRST (hdr) ((struct ext4_xattr_entry *)((hdr)+1))/*
Greg Kroah-Hartman
maintainerPATCH 677/737 ext4: fix out-of-bound read in ext4_xattr_inode_dec_ref_all()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ye Bin <[email protected]>
[ Upstream commit 5701875f9609b000d91351eaa6bfd97fe2f157f4 ]
There's issue as follows:
BUG: KASAN: use-after-free in ext4_xattr_inode_dec_ref_all+0x6ff/0x790
Read of size 4 at addr ffff88807b003000 by task syz-executor.0/15172
CPU: 3 PID: 15172 Comm: syz-executor.0
Call Trace:
__dump_stack lib/dump_stack.c:82 [inline]
dump_stack+0xbe/0xfd lib/dump_stack.c:123
print_address_description.constprop.0+0x1e/0x280 mm/kasan/report.c:400
__kasan_report.cold+0x6c/0x84 mm/kasan/report.c:560
kasan_report+0x3a/0x50 mm/kasan/report.c:585
ext4_xattr_inode_dec_ref_all+0x6ff/0x790 fs/ext4/xattr.c:1137
ext4_xattr_delete_inode+0x4c7/0xda0 fs/ext4/xattr.c:2896
ext4_evict_inode+0xb3b/0x1670 fs/ext4/inode.c:323
evict+0x39f/0x880 fs/inode.c:622
iput_final fs/inode.c:1746 [inline]
iput fs/inode.c:1772 [inline]
iput+0x525/0x6c0 fs/inode.c:1758
ext4_orphan_cleanup fs/ext4/super.c:3298 [inline]
ext4_fill_super+0x8c57/0xba40 fs/ext4/super.c:5300
mount_bdev+0x355/0x410 fs/super.c:1446
legacy_get_tree+0xfe/0x220 fs/fs_context.c:611
vfs_get_tree+0x8d/0x2f0 fs/super.c:1576
do_new_mount fs/namespace.c:2983 [inline]
path_mount+0x119a/0x1ad0 fs/namespace.c:3316
do_mount+0xfc/0x110 fs/namespace.c:3329
__do_sys_mount fs/namespace.c:3540 [inline]
__se_sys_mount+0x219/0x2e0 fs/namespace.c:3514
do_syscall_64+0x33/0x40 arch/x86/entry/common.c:46
entry_SYSCALL_64_after_hwframe+0x67/0xd1
Memory state around the buggy address:
ffff88807b002f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff88807b002f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88807b003000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
^
ffff88807b003080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff88807b003100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffAbove issue happens as ext4_xattr_delete_inode() isn't check xattr is valid if xattr is in inode.
To solve above issue call xattr_check_inode() check if xattr if valid in inode. In fact, we can directly verify in ext4_iget_extra_inode(), so that there is no divergent verification.
--- fs/ext4/inode.c | 5 +++++ fs/ext4/xattr.c | 26 +------------------------- fs/ext4/xattr.h | 7 +++++++ 3 files changed, 13 insertions(+), 25 deletions(-)
fs/ext4/inode.c +5 -0
@@ -4728,6 +4728,11 @@ static inline int ext4_iget_extra_inode( *magic == cpu_to_le32(EXT4_XATTR_MAGIC)) {int err; + err =xattr_check_inode (inode,IHDR (inode, raw_inode), +ITAIL (inode, raw_inode)); +if (err) +return err; +ext4_set_inode_state (inode,EXT4_STATE_XATTR ); err =ext4_find_inline_data_nolock (inode);if (!err &&ext4_has_inline_data (inode))
fs/ext4/xattr.c +1 -25
@@ -312,7 +312,7 @@ __ext4_xattr_check_block(struct inode *i __ext4_xattr_check_block((inode), (bh), __func__, __LINE__) -static inline int +int __xattr_check_inode (struct inode *inode,struct ext4_xattr_ibody_header *header,void *end,const char *function,unsigned int line) {
@@ -320,9 +320,6 @@ __xattr_check_inode(struct inode *inode, function, line); } -#define xattr_check_inode (inode, header, end) \ - __xattr_check_inode((inode), (header), (end), __func__, __LINE__) -static int xattr_find_entry (struct inode *inode,struct ext4_xattr_entry **pentry,void *end,int name_index,const char *name,int sorted)
@@ -654,9 +651,6 @@ ext4_xattr_ibody_get(struct inode *inode raw_inode =ext4_raw_inode (&iloc); header =IHDR (inode, raw_inode); end =ITAIL (inode, raw_inode); - error =xattr_check_inode (inode, header, end); -if (error) - goto cleanup; entry =IFIRST (header); error =xattr_find_entry (inode, &entry, end, name_index, name,0 );if (error)
@@ -787,7 +781,6 @@ ext4_xattr_ibody_list(struct dentry *denstruct ext4_xattr_ibody_header *header;struct ext4_inode *raw_inode;struct ext4_iloc iloc; -void *end;int error;if (!ext4_test_inode_state (inode,EXT4_STATE_XATTR ))
@@ -797,14 +790,9 @@ ext4_xattr_ibody_list(struct dentry *denreturn error; raw_inode =ext4_raw_inode (&iloc); header =IHDR (inode, raw_inode); - end =ITAIL (inode, raw_inode); - error =xattr_check_inode (inode, header, end); -if (error) - goto cleanup; error =ext4_xattr_list_entries (dentry,IFIRST (header), buffer, buffer_size); -cleanup:brelse (iloc.bh);return error; }
@@ -872,7 +860,6 @@ int ext4_get_inode_usage(struct inode *istruct ext4_xattr_ibody_header *header;struct ext4_xattr_entry *entry;qsize_t ea_inode_refs =0 ; -void *end;int ret;lockdep_assert_held_read (&EXT4_I (inode)->xattr_sem);
@@ -883,10 +870,6 @@ int ext4_get_inode_usage(struct inode *i goto out; raw_inode =ext4_raw_inode (&iloc); header =IHDR (inode, raw_inode); - end =ITAIL (inode, raw_inode); - ret =xattr_check_inode (inode, header, end); -if (ret) - goto out;for (entry =IFIRST (header); !IS_LAST_ENTRY (entry); entry =EXT4_XATTR_NEXT (entry))
@@ -2250,9 +2233,6 @@ int ext4_xattr_ibody_find(struct inode * is->s.here = is->s.first; is->s.end =ITAIL (inode, raw_inode);if (ext4_test_inode_state (inode,EXT4_STATE_XATTR )) { - error =xattr_check_inode (inode, header, is->s.end); -if (error) -return error;/* Find the named attribute. */ error =xattr_find_entry (inode, &is->s.here, is->s.end, i->name_index, i->name,0 );
@@ -2803,10 +2783,6 @@ retry: min_offs = end - base; total_ino =sizeof (struct ext4_xattr_ibody_header ) +sizeof (u32); - error =xattr_check_inode (inode, header, end); -if (error) - goto cleanup; - ifree =ext4_xattr_free_space (base, &min_offs, base, &total_ino);if (ifree >= isize_diff) goto shift;
fs/ext4/xattr.h +7 -0
@@ -210,6 +210,13 @@ extern int ext4_xattr_ibody_set(handle_textern struct mb_cache *ext4_xattr_create_cache (void );extern void ext4_xattr_destroy_cache (struct mb_cache *); +extern int +__xattr_check_inode (struct inode *inode,struct ext4_xattr_ibody_header *header, +void *end,const char *function,unsigned int line); + +#define xattr_check_inode (inode, header, end) \ + __xattr_check_inode((inode), (header), (end), __func__, __LINE__) +#ifdef CONFIG_EXT4_FS_SECURITY extern int ext4_init_security (handle_t *handle,struct inode *inode,struct inode *dir,const struct qstr *qstr);
Greg Kroah-Hartman
maintainerPATCH 678/737 xfrm: state: fix out-of-bounds read during lookup
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit e952837f3ddb0ff726d5b582aa1aad9aa38d024d ]
lookup and resize can run in parallel.
The xfrm_state_hash_generation seqlock ensures a retry, but the hash functions can observe a hmask value that is too large for the new hlist array.
rehash does:
rcu_assign_pointer(net->xfrm.state_bydst, ndst) [..] net->xfrm.state_hmask = nhashmask;
While state lookup does:
h = xfrm_dst_hash(net, daddr, saddr, tmpl->reqid, encap_family); hlist_for_each_entry_rcu(x, net->xfrm.state_bydst + h, bydst) {
This is only safe in case the update to state_bydst is larger than net->xfrm.xfrm_state_hmask (or if the lookup function gets serialized via state spinlock again).
Fix this by prefetching state_hmask and the associated pointers. The xfrm_state_hash_generation seqlock retry will ensure that the pointer and the hmask will be consistent.
The existing helpers, like xfrm_dst_hash(), are now unsafe for RCU side, add lockdep assertions to document that they are only safe for insert side.
xfrm_state_lookup_byaddr() uses the spinlock rather than RCU. AFAICS this is an oversight from back when state lookup was converted to RCU, this lock should be replaced with RCU in a future patch.
--- net/xfrm/xfrm_state.c | 84 +++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 66 insertions(+), 18 deletions(-)
net/xfrm/xfrm_state.c +66 -18
@@ -34,6 +34,8 @@#define xfrm_state_deref_prot (table, net) \ rcu_dereference_protected((table), lockdep_is_held(&(net)->xfrm.xfrm_state_lock)) +#define xfrm_state_deref_check (table, net) \ + rcu_dereference_check((table), lockdep_is_held(&(net)->xfrm.xfrm_state_lock))static void xfrm_state_gc_task (struct work_struct *work);
@@ -62,6 +64,8 @@ static inline unsigned int xfrm_dst_hash u32 reqid, unsigned short family) { +lockdep_assert_held (&net->xfrm.xfrm_state_lock); +return __xfrm_dst_hash (daddr, saddr, reqid, family, net->xfrm.state_hmask); }
@@ -70,6 +74,8 @@ static inline unsigned int xfrm_src_hashconst xfrm_address_t *saddr, unsigned short family) { + lockdep_assert_held(&net->xfrm.xfrm_state_lock); +return __xfrm_src_hash (daddr, saddr, family, net->xfrm.state_hmask); }
@@ -77,11 +83,15 @@ static inline unsigned int xfrm_spi_hash(struct net *net, const xfrm_address_t *daddr, __be32 spi, u8 proto, unsigned short family) { + lockdep_assert_held(&net->xfrm.xfrm_state_lock); +return __xfrm_spi_hash (daddr, spi, proto, family, net->xfrm.state_hmask); }static unsigned int xfrm_seq_hash (struct net *net,u32 seq) { +lockdep_assert_held (&net->xfrm.xfrm_state_lock); +return __xfrm_seq_hash (seq, net->xfrm.state_hmask); }
@@ -1025,16 +1035,38 @@ xfrm_init_tempstate(struct xfrm_state *x x->props.family = tmpl->encap_family; } -static struct xfrm_state *__xfrm_state_lookup_all (struct net *net,u32 mark, +struct xfrm_hash_state_ptrs { +const struct hlist_head *bydst; +const struct hlist_head *bysrc; +const struct hlist_head *byspi; +unsigned int hmask; +}; + +static void xfrm_hash_ptrs_get (const struct net *net,struct xfrm_hash_state_ptrs *ptrs) +{ +unsigned int sequence; + +do { + sequence =read_seqcount_begin (&net->xfrm.xfrm_state_hash_generation); + + ptrs->bydst =xfrm_state_deref_check (net->xfrm.state_bydst, net); + ptrs->bysrc =xfrm_state_deref_check (net->xfrm.state_bysrc, net); + ptrs->byspi =xfrm_state_deref_check (net->xfrm.state_byspi, net); + ptrs->hmask = net->xfrm.state_hmask; + }while (read_seqcount_retry (&net->xfrm.xfrm_state_hash_generation, sequence)); +} + +static struct xfrm_state *__xfrm_state_lookup_all (const struct xfrm_hash_state_ptrs *state_ptrs, +u32 mark,const xfrm_address_t *daddr,__be32 spi,u8 proto,unsigned short family,struct xfrm_dev_offload *xdo) { -unsigned int h =xfrm_spi_hash (net, daddr, spi, proto, family); +unsigned int h =__xfrm_spi_hash (daddr, spi, proto, family, state_ptrs->hmask);struct xfrm_state *x; -hlist_for_each_entry_rcu (x, net->xfrm.state_byspi + h, byspi) { +hlist_for_each_entry_rcu (x, state_ptrs->byspi + h, byspi) {#ifdef CONFIG_XFRM_OFFLOAD if (xdo->type ==XFRM_DEV_OFFLOAD_PACKET ) {if (x->xso.type !=XFRM_DEV_OFFLOAD_PACKET )
@@ -1068,15 +1100,16 @@ static struct xfrm_state *__xfrm_state_lreturn NULL ; } -static struct xfrm_state *__xfrm_state_lookup (struct net *net,u32 mark, +static struct xfrm_state *__xfrm_state_lookup (const struct xfrm_hash_state_ptrs *state_ptrs, +u32 mark,const xfrm_address_t *daddr,__be32 spi,u8 proto,unsigned short family) { -unsigned int h =xfrm_spi_hash (net, daddr, spi, proto, family); +unsigned int h =__xfrm_spi_hash (daddr, spi, proto, family, state_ptrs->hmask);struct xfrm_state *x; -hlist_for_each_entry_rcu (x, net->xfrm.state_byspi + h, byspi) { +hlist_for_each_entry_rcu (x, state_ptrs->byspi + h, byspi) { if (x->props.family != family || x->id.spi != spi || x->id.proto != proto ||
@@ -1093,15 +1126,16 @@ static struct xfrm_state *__xfrm_state_lreturn NULL ; } -static struct xfrm_state *__xfrm_state_lookup_byaddr (struct net *net,u32 mark, +static struct xfrm_state *__xfrm_state_lookup_byaddr (const struct xfrm_hash_state_ptrs *state_ptrs, +u32 mark,const xfrm_address_t *daddr,const xfrm_address_t *saddr,u8 proto,unsigned short family) { -unsigned int h =xfrm_src_hash (net, daddr, saddr, family); +unsigned int h =__xfrm_src_hash (daddr, saddr, family, state_ptrs->hmask);struct xfrm_state *x; -hlist_for_each_entry_rcu (x, net->xfrm.state_bysrc + h, bysrc) { +hlist_for_each_entry_rcu (x, state_ptrs->bysrc + h, bysrc) { if (x->props.family != family || x->id.proto != proto || !xfrm_addr_equal(&x->id.daddr, daddr, family) ||
@@ -1121,14 +1155,17 @@ static struct xfrm_state *__xfrm_state_lstatic inline struct xfrm_state *__xfrm_state_locate (struct xfrm_state *x,int use_spi,int family) { +struct xfrm_hash_state_ptrs state_ptrs;struct net *net =xs_net (x);u32 mark = x->mark.v & x->mark.m; +xfrm_hash_ptrs_get (net, &state_ptrs); +if (use_spi) -return __xfrm_state_lookup (net, mark, &x->id.daddr, +return __xfrm_state_lookup (&state_ptrs, mark, &x->id.daddr, x->id.spi, x->id.proto, family);else -return __xfrm_state_lookup_byaddr (net, mark, +return __xfrm_state_lookup_byaddr (&state_ptrs, mark, &x->id.daddr, &x->props.saddr, x->id.proto, family);
@@ -1191,6 +1228,7 @@ xfrm_state_find(const xfrm_address_t *da unsigned short family, u32 if_id) {static xfrm_address_t saddr_wildcard = { }; +struct xfrm_hash_state_ptrs state_ptrs;struct net *net =xp_net (pol);unsigned int h, h_wildcard;struct xfrm_state *x, *x0, *to_put;
@@ -1207,8 +1245,10 @@ xfrm_state_find(const xfrm_address_t *da sequence =read_seqcount_begin (&net->xfrm.xfrm_state_hash_generation);rcu_read_lock (); - h =xfrm_dst_hash (net, daddr, saddr, tmpl->reqid, encap_family); -hlist_for_each_entry_rcu (x, net->xfrm.state_bydst + h, bydst) { +xfrm_hash_ptrs_get (net, &state_ptrs); + + h =__xfrm_dst_hash (daddr, saddr, tmpl->reqid, encap_family, state_ptrs.hmask); +hlist_for_each_entry_rcu (x, state_ptrs.bydst + h, bydst) {#ifdef CONFIG_XFRM_OFFLOAD if (pol->xdo.type ==XFRM_DEV_OFFLOAD_PACKET ) {if (x->xso.type !=XFRM_DEV_OFFLOAD_PACKET )
@@ -1241,8 +1281,9 @@ xfrm_state_find(const xfrm_address_t *daif (best || acquire_in_progress) goto found; - h_wildcard =xfrm_dst_hash (net, daddr, &saddr_wildcard, tmpl->reqid, encap_family); -hlist_for_each_entry_rcu (x, net->xfrm.state_bydst + h_wildcard, bydst) { + h_wildcard =__xfrm_dst_hash (daddr, &saddr_wildcard, tmpl->reqid, + encap_family, state_ptrs.hmask); +hlist_for_each_entry_rcu (x, state_ptrs.bydst + h_wildcard, bydst) {#ifdef CONFIG_XFRM_OFFLOAD if (pol->xdo.type ==XFRM_DEV_OFFLOAD_PACKET ) {if (x->xso.type !=XFRM_DEV_OFFLOAD_PACKET )
@@ -1277,7 +1318,7 @@ found: x = best;if (!x && !error && !acquire_in_progress) {if (tmpl->id.spi && - (x0 =__xfrm_state_lookup_all (net, mark, daddr, + (x0 =__xfrm_state_lookup_all (&state_ptrs, mark, daddr, tmpl->id.spi, tmpl->id.proto, encap_family, &pol->xdo)) !=NULL ) {
@@ -2032,10 +2073,13 @@ struct xfrm_state * xfrm_state_lookup(struct net *net, u32 mark, const xfrm_address_t *daddr, __be32 spi, u8 proto, unsigned short family) { + struct xfrm_hash_state_ptrs state_ptrs;struct xfrm_state *x;rcu_read_lock (); - x =__xfrm_state_lookup (net, mark, daddr, spi, proto, family); +xfrm_hash_ptrs_get (net, &state_ptrs); + + x =__xfrm_state_lookup (&state_ptrs, mark, daddr, spi, proto, family);rcu_read_unlock ();return x; }
@@ -2046,10 +2090,14 @@ xfrm_state_lookup_byaddr(struct net *net const xfrm_address_t *daddr, const xfrm_address_t *saddr, u8 proto, unsigned short family) { + struct xfrm_hash_state_ptrs state_ptrs;struct xfrm_state *x;spin_lock_bh (&net->xfrm.xfrm_state_lock); - x =__xfrm_state_lookup_byaddr (net, mark, daddr, saddr, proto, family); + +xfrm_hash_ptrs_get (net, &state_ptrs); + + x =__xfrm_state_lookup_byaddr (&state_ptrs, mark, daddr, saddr, proto, family);spin_unlock_bh (&net->xfrm.xfrm_state_lock);return x; }
Greg Kroah-Hartman
maintainerPATCH 679/737 page_pool: Fix use-after-free in page_pool_recycle_in_ring
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dong Chenchen <[email protected]>
[ Upstream commit 271683bb2cf32e5126c592b5d5e6a756fa374fd9 ]
syzbot reported a uaf in page_pool_recycle_in_ring:
BUG: KASAN: slab-use-after-free in lock_release+0x151/0xa30 kernel/locking/lockdep.c:5862 Read of size 8 at addr ffff8880286045a0 by task syz.0.284/6943 CPU: 0 UID: 0 PID: 6943 Comm: syz.0.284 Not tainted 6.13.0-rc3-syzkaller-gdfa94ce54f41 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: <TASK> __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0x169/0x550 mm/kasan/report.c:489 kasan_report+0x143/0x180 mm/kasan/report.c:602 lock_release+0x151/0xa30 kernel/locking/lockdep.c:5862 __raw_spin_unlock_bh include/linux/spinlock_api_smp.h:165 [inline] _raw_spin_unlock_bh+0x1b/0x40 kernel/locking/spinlock.c:210 spin_unlock_bh include/linux/spinlock.h:396 [inline] ptr_ring_produce_bh include/linux/ptr_ring.h:164 [inline] page_pool_recycle_in_ring net/core/page_pool.c:707 [inline] page_pool_put_unrefed_netmem+0x748/0xb00 net/core/page_pool.c:826 page_pool_put_netmem include/net/page_pool/helpers.h:323 [inline] page_pool_put_full_netmem include/net/page_pool/helpers.h:353 [inline] napi_pp_put_page+0x149/0x2b0 net/core/skbuff.c:1036 skb_pp_recycle net/core/skbuff.c:1047 [inline] skb_free_head net/core/skbuff.c:1094 [inline] skb_release_data+0x6c4/0x8a0 net/core/skbuff.c:1125 skb_release_all net/core/skbuff.c:1190 [inline] __kfree_skb net/core/skbuff.c:1204 [inline] sk_skb_reason_drop+0x1c9/0x380 net/core/skbuff.c:1242 kfree_skb_reason include/linux/skbuff.h:1263 [inline] __skb_queue_purge_reason include/linux/skbuff.h:3343 [inline]
root cause is:
page_pool_recycle_in_ring
ptr_ring_produce
spin_lock(&r->producer_lock);
WRITE_ONCE(r->queue[r->producer++], ptr)
//recycle last page to pool
page_pool_release
page_pool_scrub
page_pool_empty_ring
ptr_ring_consume
page_pool_return_page //release all page
__page_pool_destroy
free_percpu(pool->recycle_stats);
free(pool) //free
spin_unlock(&r->producer_lock); //pool->ring uaf read recycle_stat_inc(pool, ring);
page_pool can be free while page pool recycle the last page in ring. Add producer-lock barrier to page_pool_release to prevent the page pool from being free before all pages have been recycled.
recycle_stat_inc() is empty when CONFIG_PAGE_POOL_STATS is not enabled, which will trigger Wempty-body build warning. Add definition for pool stat macro to fix warning.
--- net/core/page_pool.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-)
net/core/page_pool.c +14 -13
@@ -140,9 +140,9 @@ u64 *page_pool_ethtool_stats_get(u64 *daEXPORT_SYMBOL (page_pool_ethtool_stats_get);#else -#define alloc_stat_inc (pool, __stat) -#define recycle_stat_inc (pool, __stat) -#define recycle_stat_add (pool, __stat, val) +#define alloc_stat_inc (...) do { } while (0) +#define recycle_stat_inc (...) do { } while (0) +#define recycle_stat_add (...) do { } while (0)#endif static bool page_pool_producer_lock (struct page_pool *pool)
@@ -549,19 +549,16 @@ skip_dma_unmap:static bool page_pool_recycle_in_ring (struct page_pool *pool,struct page *page) { -int ret; -/* BH protection not needed if current is softirq */ -if (in_softirq ()) - ret =ptr_ring_produce (&pool->ring, page); -else - ret =ptr_ring_produce_bh (&pool->ring, page); +bool in_softirq, ret; -if (!ret) { +/* BH protection not needed if current is softirq */ + in_softirq =page_pool_producer_lock (pool); + ret = !__ptr_ring_produce (&pool->ring, page); +if (ret)recycle_stat_inc (pool, ring); -return true; - } +page_pool_producer_unlock (pool, in_softirq); -return false; +return ret; }/* Only allow direct recycling in special circumstances, into the
@@ -850,10 +847,14 @@ static void page_pool_scrub(struct page_static int page_pool_release (struct page_pool *pool) { +bool in_softirq;int inflight;page_pool_scrub (pool); inflight =page_pool_inflight (pool); +/* Acquire producer lock to make sure producers have exited. */ + in_softirq =page_pool_producer_lock (pool); +page_pool_producer_unlock (pool, in_softirq);if (!inflight)page_pool_free (pool);
Greg Kroah-Hartman
maintainerPATCH 680/737 net: dsa: sja1105: fix kasan out-of-bounds warning in sja1105_table_delete_entry()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vladimir Oltean <[email protected]>
[ Upstream commit 5f2b28b79d2d1946ee36ad8b3dc0066f73c90481 ]
There are actually 2 problems:
- deleting the last element doesn't require the memmove of elements [i + 1, end) over it. Actually, element i+1 is out of bounds.
- The memmove itself should move size - i - 1 elements, because the last element is out of bounds.
The out-of-bounds element still remains out of bounds after being accessed, so the problem is only that we touch it, not that it becomes in active use. But I suppose it can lead to issues if the out-of-bounds element is part of an unmapped page.
--- drivers/net/dsa/sja1105/sja1105_static_config.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/dsa/sja1105/sja1105_static_config.c +4 -2
@@ -1921,8 +1921,10 @@ int sja1105_table_delete_entry(struct sjif (i > table->entry_count)return -ERANGE ; -memmove (entries + i * entry_size, entries + (i +1 ) * entry_size, - (table->entry_count - i) * entry_size); +if (i +1 < table->entry_count) { +memmove (entries + i * entry_size, entries + (i +1 ) * entry_size, + (table->entry_count - i -1 ) * entry_size); + } table->entry_count--;
Greg Kroah-Hartman
maintainerPATCH 671/737 net: Remove RTNL dance for SIOCBRADDIF and SIOCBRDELIF.
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thadeu Lima de Souza Cascardo <[email protected]>
commit ed3ba9b6e280e14cc3148c1b226ba453f02fa76c upstream.
SIOCBRDELIF is passed to dev_ioctl() first and later forwarded to br_ioctl_call(), which causes unnecessary RTNL dance and the splat below [0] under RTNL pressure.
Let's say Thread A is trying to detach a device from a bridge and Thread B is trying to remove the bridge.
In dev_ioctl(), Thread A bumps the bridge device's refcnt by netdev_hold() and releases RTNL because the following br_ioctl_call() also re-acquires RTNL.
In the race window, Thread B could acquire RTNL and try to remove the bridge device. Then, rtnl_unlock() by Thread B will release RTNL and wait for netdev_put() by Thread A.
Thread A, however, must hold RTNL after the unlock in dev_ifsioc(), which may take long under RTNL pressure, resulting in the splat by Thread B.
Thread A (SIOCBRDELIF) Thread B (SIOCBRDELBR)
---------------------- ----------------------
sock_ioctl sock_ioctl
`- sock_do_ioctl `- br_ioctl_call
`- dev_ioctl `- br_ioctl_stub
|- rtnl_lock |
|- dev_ifsioc '
' |- dev = __dev_get_by_name(...)
|- netdev_hold(dev, ...) .
/ |- rtnl_unlock ------. |
| |- br_ioctl_call `---> |- rtnl_lock
Race | | `- br_ioctl_stub |- br_del_bridge
Window | | | |- dev = __dev_get_by_name(...)
| | | May take long | `- br_dev_delete(dev, ...)
| | | under RTNL pressure | `- unregister_netdevice_queue(dev, ...)
| | | | `- rtnl_unlock
\ | |- rtnl_lock <-' `- netdev_run_todo
| |- ... `- netdev_run_todo
| `- rtnl_unlock |- __rtnl_unlock
| |- netdev_wait_allrefs_any
|- netdev_put(dev, ...) <----------------'Wait refcnt decrement and log splat below
To avoid blocking SIOCBRDELBR unnecessarily, let's not call dev_ioctl() for SIOCBRADDIF and SIOCBRDELIF.
In the dev_ioctl() path, we do the following:
1. Copy struct ifreq by get_user_ifreq in sock_do_ioctl()
2. Check CAP_NET_ADMIN in dev_ioctl()
3. Call dev_load() in dev_ioctl()
4. Fetch the master dev from ifr.ifr_name in dev_ifsioc()
3. can be done by request_module() in br_ioctl_call(), so we move 1., 2., and 4. to br_ioctl_stub().
Note that 2. is also checked later in add_del_if(), but it's better performed before RTNL.
SIOCBRADDIF and SIOCBRDELIF have been processed in dev_ioctl() since the pre-git era, and there seems to be no specific reason to process them there.
[0]:unregister_netdevice: waiting for wpan3 to become free. Usage count = 2ref_tracker: wpan3@ffff8880662d8608 has 1/1 users at
__netdev_tracker_alloc include/linux/netdevice.h:4282 [inline]
netdev_hold include/linux/netdevice.h:4311 [inline]
dev_ifsioc+0xc6a/0x1160 net/core/dev_ioctl.c:624
dev_ioctl+0x255/0x10c0 net/core/dev_ioctl.c:826
sock_do_ioctl+0x1ca/0x260 net/socket.c:1213
sock_ioctl+0x23a/0x6c0 net/socket.c:1318
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:906 [inline]
__se_sys_ioctl fs/ioctl.c:892 [inline]
__x64_sys_ioctl+0x1a4/0x210 fs/ioctl.c:892
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xcb/0x250 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f--- include/linux/if_bridge.h | 6 ++---- net/bridge/br_ioctl.c | 36 +++++++++++++++++++++++++++++++++--- net/bridge/br_private.h | 3 +-- net/core/dev_ioctl.c | 16 ---------------- net/socket.c | 19 +++++++++---------- 5 files changed, 45 insertions(+), 35 deletions(-)
include/linux/if_bridge.h +2 -4
@@ -65,11 +65,9 @@ struct br_ip_list {#define BR_DEFAULT_AGEING_TIME (300 * HZ)struct net_bridge ; -void brioctl_set (int (*hook)(struct net *net,struct net_bridge *br, -unsigned int cmd,struct ifreq *ifr, +void brioctl_set (int (*hook)(struct net *net,unsigned int cmd,void __user *uarg)); -int br_ioctl_call (struct net *net,struct net_bridge *br,unsigned int cmd, -struct ifreq *ifr,void __user *uarg); +int br_ioctl_call (struct net *net,unsigned int cmd,void __user *uarg);#if IS_ENABLED (CONFIG_BRIDGE ) &&IS_ENABLED (CONFIG_BRIDGE_IGMP_SNOOPING ) int br_multicast_list_adjacent(struct net_device *dev,
net/bridge/br_ioctl.c +33 -3
@@ -394,10 +394,26 @@ static int old_deviceless(struct net *nereturn -EOPNOTSUPP ; } -int br_ioctl_stub (struct net *net,struct net_bridge *br,unsigned int cmd, -struct ifreq *ifr,void __user *uarg) +int br_ioctl_stub (struct net *net,unsigned int cmd,void __user *uarg) {int ret = -EOPNOTSUPP ; +struct ifreq ifr; + +if (cmd ==SIOCBRADDIF || cmd ==SIOCBRDELIF ) { +void __user *data; +char *colon; + +if (!ns_capable (net->user_ns,CAP_NET_ADMIN )) +return -EPERM ; + +if (get_user_ifreq (&ifr, &data, uarg)) +return -EFAULT ; + + ifr.ifr_name[IFNAMSIZ -1 ] =0 ; + colon =strchr (ifr.ifr_name,':' ); +if (colon) + *colon =0 ; + }rtnl_lock ();
@@ -430,7 +446,21 @@ int br_ioctl_stub(struct net *net, strucbreak ;case SIOCBRADDIF :case SIOCBRDELIF : - ret =add_del_if (br, ifr->ifr_ifindex, cmd ==SIOCBRADDIF ); + { +struct net_device *dev; + + dev =__dev_get_by_name (net, ifr.ifr_name); +if (!dev || !netif_device_present (dev)) { + ret = -ENODEV ; +break ; + } +if (!netif_is_bridge_master (dev)) { + ret = -EOPNOTSUPP ; +break ; + } + + ret =add_del_if (netdev_priv (dev), ifr.ifr_ifindex, cmd ==SIOCBRADDIF ); + }break ; }
net/bridge/br_private.h +1 -2
@@ -948,8 +948,7 @@ br_port_get_check_rtnl(const struct net_/* br_ioctl.c */ int br_dev_siocdevprivate (struct net_device *dev,struct ifreq *rq,void __user *data,int cmd); -int br_ioctl_stub (struct net *net,struct net_bridge *br,unsigned int cmd, -struct ifreq *ifr,void __user *uarg); +int br_ioctl_stub (struct net *net,unsigned int cmd,void __user *uarg);/* br_multicast.c */ #ifdef CONFIG_BRIDGE_IGMP_SNOOPING
net/core/dev_ioctl.c +0 -16
@@ -517,7 +517,6 @@ static int dev_ifsioc(struct net *net, sint err;struct net_device *dev =__dev_get_by_name (net, ifr->ifr_name);const struct net_device_ops *ops; -netdevice_tracker dev_tracker;if (!dev)return -ENODEV ;
@@ -580,19 +579,6 @@ static int dev_ifsioc(struct net *net, scase SIOCWANDEV :return dev_siocwandev (dev, &ifr->ifr_settings); -case SIOCBRADDIF : -case SIOCBRDELIF : -if (!netif_device_present (dev)) -return -ENODEV ; -if (!netif_is_bridge_master (dev)) -return -EOPNOTSUPP ; -netdev_hold (dev, &dev_tracker,GFP_KERNEL ); -rtnl_unlock (); - err =br_ioctl_call (net,netdev_priv (dev), cmd, ifr,NULL ); -netdev_put (dev, &dev_tracker); -rtnl_lock (); -return err; - case SIOCDEVPRIVATE ... SIOCDEVPRIVATE + 15:return dev_siocdevprivate (dev, ifr, data, cmd);
@@ -773,8 +759,6 @@ int dev_ioctl(struct net *net, unsignedcase SIOCBONDRELEASE :case SIOCBONDSETHWADDR :case SIOCBONDCHANGEACTIVE : -case SIOCBRADDIF : -case SIOCBRDELIF :case SIOCSHWTSTAMP :if (!ns_capable (net->user_ns,CAP_NET_ADMIN ))return -EPERM ;
net/socket.c +9 -10
@@ -1168,12 +1168,10 @@ static ssize_t sock_write_iter(struct ki*/ static DEFINE_MUTEX (br_ioctl_mutex); -static int (*br_ioctl_hook)(struct net *net,struct net_bridge *br, -unsigned int cmd,struct ifreq *ifr, +static int (*br_ioctl_hook)(struct net *net,unsigned int cmd,void __user *uarg); -void brioctl_set (int (*hook)(struct net *net,struct net_bridge *br, -unsigned int cmd,struct ifreq *ifr, +void brioctl_set (int (*hook)(struct net *net,unsigned int cmd,void __user *uarg)) {mutex_lock (&br_ioctl_mutex);
@@ -1182,8 +1180,7 @@ void brioctl_set(int (*hook)(struct net }EXPORT_SYMBOL (brioctl_set); -int br_ioctl_call (struct net *net,struct net_bridge *br,unsigned int cmd, -struct ifreq *ifr,void __user *uarg) +int br_ioctl_call (struct net *net,unsigned int cmd,void __user *uarg) {int err = -ENOPKG ;
@@ -1192,7 +1189,7 @@ int br_ioctl_call(struct net *net, strucmutex_lock (&br_ioctl_mutex);if (br_ioctl_hook) - err =br_ioctl_hook (net, br, cmd, ifr, uarg); + err =br_ioctl_hook (net, cmd, uarg);mutex_unlock (&br_ioctl_mutex);return err;
@@ -1292,7 +1289,9 @@ static long sock_ioctl(struct file *filecase SIOCSIFBR :case SIOCBRADDBR :case SIOCBRDELBR : - err =br_ioctl_call (net,NULL , cmd,NULL , argp); +case SIOCBRADDIF : +case SIOCBRDELIF : + err =br_ioctl_call (net, cmd, argp);break ;case SIOCGIFVLAN :case SIOCSIFVLAN :
@@ -3454,6 +3453,8 @@ static int compat_sock_ioctl_trans(struccase SIOCGPGRP :case SIOCBRADDBR :case SIOCBRDELBR : +case SIOCBRADDIF : +case SIOCBRDELIF :case SIOCGIFVLAN :case SIOCSIFVLAN :case SIOCGSKNS :
@@ -3493,8 +3494,6 @@ static int compat_sock_ioctl_trans(struccase SIOCGIFPFLAGS :case SIOCGIFTXQLEN :case SIOCSIFTXQLEN : -case SIOCBRADDIF : -case SIOCBRDELIF :case SIOCGIFNAME :case SIOCSIFNAME :case SIOCGMIIPHY :
Greg Kroah-Hartman
maintainerPATCH 706/737 mm/damon/tests/vaddr-kunit: handle alloc failures in damon_test_split_evenly_fail()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: SeongJae Park <[email protected]>
commit 7890e5b5bb6e386155c6e755fe70e0cdcc77f18e upstream.
damon_test_split_evenly_fail() is assuming all dynamic memory allocation in it will succeed. Those are indeed likely in the real use cases since those allocations are too small to fail, but theoretically those could fail. In the case, inappropriate memory access can happen. Fix it by appropriately cleanup pre-allocated memory and skip the execution of the remaining tests in the failure cases.
--- mm/damon/vaddr-test.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
mm/damon/vaddr-test.h +10 -1
@@ -250,7 +250,16 @@ static void damon_test_split_evenly_fail unsigned long start, unsigned long end, unsigned int nr_pieces) { struct damon_target *t = damon_new_target(); -struct damon_region *r =damon_new_region (start, end); +struct damon_region *r; + +if (!t) +kunit_skip (test,"target alloc fail" ); + + r =damon_new_region (start, end); +if (!r) { +damon_free_target (t); +kunit_skip (test,"region alloc fail" ); + }damon_add_region (r, t); KUNIT_EXPECT_EQ(test,
Greg Kroah-Hartman
maintainerPATCH 715/737 RDMA/rxe: Fix the failure of ibv_query_device() and ibv_query_device_ex() tests
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhu Yanjun <[email protected]>
[ Upstream commit 8ce2eb9dfac8743d1c423b86339336a5b6a6069e ]
In rdma-core, the following failures appear.
"
$ ./build/bin/run_tests.py -k device
ssssssss....FF........s
======================================================================
FAIL: test_query_device (tests.test_device.DeviceTest.test_query_device)
Test ibv_query_device()
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/ubuntu/rdma-core/tests/test_device.py", line 63, in
test_query_device
self.verify_device_attr(attr, dev)
File "/home/ubuntu/rdma-core/tests/test_device.py", line 200, in
verify_device_attr
assert attr.sys_image_guid != 0
^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError======================================================================
FAIL: test_query_device_ex (tests.test_device.DeviceTest.test_query_device_ex) Test ibv_query_device_ex()
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/ubuntu/rdma-core/tests/test_device.py", line 222, in test_query_device_ex
self.verify_device_attr(attr_ex.orig_attr, dev)
File "/home/ubuntu/rdma-core/tests/test_device.py", line 200, in verify_device_attr
assert attr.sys_image_guid != 0
^^^^^^^^^^^^^^^^^^^^^^^^AssertionError
"
The root cause is: before a net device is set with rxe, this net device is used to generate a sys_image_guid.
--- drivers/infiniband/sw/rxe/rxe.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-)
drivers/infiniband/sw/rxe/rxe.c +6 -19
@@ -38,10 +38,8 @@ void rxe_dealloc(struct ib_device *ib_de }/* initialize rxe device parameters */ -static void rxe_init_device_param (struct rxe_dev *rxe) +static void rxe_init_device_param (struct rxe_dev *rxe,struct net_device *ndev) { -struct net_device *ndev; - rxe->max_inline_data =RXE_MAX_INLINE_DATA ; rxe->attr.vendor_id =RXE_VENDOR_ID ;
@@ -74,15 +72,9 @@ static void rxe_init_device_param(struct rxe->attr.max_pkeys =RXE_MAX_PKEYS ; rxe->attr.local_ca_ack_delay =RXE_LOCAL_CA_ACK_DELAY ; - ndev =rxe_ib_device_get_netdev (&rxe->ib_dev); -if (!ndev) -return ; -addrconf_addr_eui48 ((unsigned char *)&rxe->attr.sys_image_guid, ndev->dev_addr); -dev_put (ndev); - rxe->max_ucontext =RXE_MAX_UCONTEXT ; }
@@ -115,18 +107,13 @@ static void rxe_init_port_param(struct r/* initialize port state, note IB convention that HCA ports are always * numbered from 1 */ -static void rxe_init_ports (struct rxe_dev *rxe) +static void rxe_init_ports (struct rxe_dev *rxe,struct net_device *ndev) {struct rxe_port *port = &rxe->port; -struct net_device *ndev;rxe_init_port_param (port); - ndev =rxe_ib_device_get_netdev (&rxe->ib_dev); -if (!ndev) -return ;addrconf_addr_eui48 ((unsigned char *)&port->port_guid, ndev->dev_addr); -dev_put (ndev);spin_lock_init (&port->port_lock); }
@@ -144,12 +131,12 @@ static void rxe_init_pools(struct rxe_de }/* initialize rxe device state */ -static void rxe_init (struct rxe_dev *rxe) +static void rxe_init (struct rxe_dev *rxe,struct net_device *ndev) {/* init default device parameters */ -rxe_init_device_param (rxe); +rxe_init_device_param (rxe, ndev); -rxe_init_ports (rxe); +rxe_init_ports (rxe, ndev);rxe_init_pools (rxe);/* init pending mmap list */
@@ -186,7 +173,7 @@ void rxe_set_mtu(struct rxe_dev *rxe, unint rxe_add (struct rxe_dev *rxe,unsigned int mtu,const char *ibdev_name,struct net_device *ndev) { -rxe_init (rxe); +rxe_init (rxe, ndev);rxe_set_mtu (rxe, mtu);return rxe_register_device (rxe, ibdev_name, ndev);
Greg Kroah-Hartman
maintainerPATCH 716/737 mm/damon/tests/vaddr-kunit: handle alloc failures on damon_test_split_evenly_succ()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: SeongJae Park <[email protected]>
commit 0a63a0e7570b9b2631dfb8d836dc572709dce39e upstream.
damon_test_split_evenly_succ() is assuming all dynamic memory allocation in it will succeed. Those are indeed likely in the real use cases since those allocations are too small to fail, but theoretically those could fail. In the case, inappropriate memory access can happen. Fix it by appropriately cleanup pre-allocated memory and skip the execution of the remaining tests in the failure cases.
--- mm/damon/vaddr-test.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
mm/damon/vaddr-test.h +8 -1
@@ -284,10 +284,17 @@ static void damon_test_split_evenly_succ unsigned long start, unsigned long end, unsigned int nr_pieces) { struct damon_target *t = damon_new_target(); -struct damon_region *r =damon_new_region (start, end); +struct damon_region *r;unsigned long expected_width = (end - start) / nr_pieces;unsigned long i =0 ; +if (!t) +kunit_skip (test,"target alloc fail" ); + r =damon_new_region (start, end); +if (!r) { +damon_free_target (t); +kunit_skip (test,"region alloc fail" ); + }damon_add_region (r, t);KUNIT_EXPECT_EQ (test,damon_va_evenly_split_region (t, r, nr_pieces),0 );
Greg Kroah-Hartman
maintainerPATCH 717/737 mm/damon/tests/core-kunit: handle alloc failres in damon_test_new_filter()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: SeongJae Park <[email protected]>
commit 28ab2265e9422ccd81e4beafc0ace90f78de04c4 upstream.
damon_test_new_filter() is assuming all dynamic memory allocation in it will succeed. Those are indeed likely in the real use cases since those allocations are too small to fail, but theoretically those could fail. In the case, inappropriate memory access can happen. Fix it by appropriately cleanup pre-allocated memory and skip the execution of the remaining tests in the failure cases.
--- mm/damon/core-test.h | 2 ++ 1 file changed, 2 insertions(+)
mm/damon/core-test.h +2 -0
@@ -346,6 +346,8 @@ static void damos_test_new_filter(structstruct damos_filter *filter; filter =damos_new_filter (DAMOS_FILTER_TYPE_ANON , true); +if (!filter) +kunit_skip (test,"filter alloc fail" );KUNIT_EXPECT_EQ (test, filter->type,DAMOS_FILTER_TYPE_ANON );KUNIT_EXPECT_EQ (test, filter->matching, true);KUNIT_EXPECT_PTR_EQ (test, filter->list.prev, &filter->list);
Greg Kroah-Hartman
maintainerPATCH 718/737 mm/damon/tests/core-kunit: handle allocation failures in damon_test_regions()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: SeongJae Park <[email protected]>
commit e16fdd4f754048d6e23c56bd8d920b71e41e3777 upstream.
damon_test_regions() is assuming all dynamic memory allocation in it will succeed. Those are indeed likely in the real use cases since those allocations are too small to fail, but theoretically those could fail. In the case, inappropriate memory access can happen. Fix it by appropriately cleanup pre-allocated memory and skip the execution of the remaining tests in the failure cases.
--- mm/damon/core-test.h | 6 ++++++ 1 file changed, 6 insertions(+)
mm/damon/core-test.h +6 -0
@@ -20,11 +20,17 @@ static void damon_test_regions(struct kustruct damon_target *t; r =damon_new_region (1 ,2 ); +if (!r) +kunit_skip (test,"region alloc fail" );KUNIT_EXPECT_EQ (test,1ul , r->ar.start);KUNIT_EXPECT_EQ (test,2ul , r->ar.end);KUNIT_EXPECT_EQ (test,0u , r->nr_accesses); t =damon_new_target (); +if (!t) { +damon_free_region (r); +kunit_skip (test,"target alloc fail" ); + }KUNIT_EXPECT_EQ (test,0u ,damon_nr_regions (t));damon_add_region (r, t);
Greg Kroah-Hartman
maintainerPATCH 719/737 mm/damon/tests/core-kunit: handle alloc failures on damon_test_split_at()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: SeongJae Park <[email protected]>
commit 5e80d73f22043c59c8ad36452a3253937ed77955 upstream.
damon_test_split_at() is assuming all dynamic memory allocation in it will succeed. Those are indeed likely in the real use cases since those allocations are too small to fail, but theoretically those could fail. In the case, inappropriate memory access can happen. Fix it by appropriately cleanup pre-allocated memory and skip the execution of the remaining tests in the failure cases.
--- mm/damon/core-test.h | 11 +++++++++++ 1 file changed, 11 insertions(+)
mm/damon/core-test.h +11 -0
@@ -129,8 +129,19 @@ static void damon_test_split_at(struct kstruct damon_target *t;struct damon_region *r; +if (!c) +kunit_skip (test,"ctx alloc fail" ); t =damon_new_target (); +if (!t) { +damon_destroy_ctx (c); +kunit_skip (test,"target alloc fail" ); + } r =damon_new_region (0 ,100 ); +if (!r) { +damon_destroy_ctx (c); +damon_free_target (t); +kunit_skip (test,"region alloc fail" ); + }damon_add_region (r, t);damon_split_region_at (t, r,25 );KUNIT_EXPECT_EQ (test, r->ar.start,0ul );
Greg Kroah-Hartman
maintainerPATCH 720/737 mm/damon/tests/core-kunit: handle alloc failures on dasmon_test_merge_regions_of()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: SeongJae Park <[email protected]>
commit 0998d2757218771c59d5ca59ccf13d1542a38f17 upstream.
damon_test_merge_regions_of() is assuming all dynamic memory allocation in it will succeed. Those are indeed likely in the real use cases since those allocations are too small to fail, but theoretically those could fail. In the case, inappropriate memory access can happen. Fix it by appropriately cleanup pre-allocated memory and skip the execution of the remaining tests in the failure cases.
--- mm/damon/core-test.h | 6 ++++++ 1 file changed, 6 insertions(+)
mm/damon/core-test.h +6 -0
@@ -210,8 +210,14 @@ static void damon_test_merge_regions_of(int i; t =damon_new_target (); +if (!t) +kunit_skip (test,"target alloc fail" );for (i =0 ; i <ARRAY_SIZE (sa); i++) { r =damon_new_region (sa[i], ea[i]); +if (!r) { +damon_free_target (t); +kunit_skip (test,"region alloc fail" ); + } r->nr_accesses = nrs[i];damon_add_region (r, t); }
Greg Kroah-Hartman
maintainerPATCH 721/737 mm/damon/tests/core-kunit: handle alloc failures on damon_test_merge_two()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: SeongJae Park <[email protected]>
commit 3d443dd29a1db7efa587a4bb0c06a497e13ca9e4 upstream.
damon_test_merge_two() is assuming all dynamic memory allocation in it will succeed. Those are indeed likely in the real use cases since those allocations are too small to fail, but theoretically those could fail. In the case, inappropriate memory access can happen. Fix it by appropriately cleanup pre-allocated memory and skip the execution of the remaining tests in the failure cases.
--- mm/damon/core-test.h | 10 ++++++++++ 1 file changed, 10 insertions(+)
mm/damon/core-test.h +10 -0
@@ -162,10 +162,20 @@ static void damon_test_merge_two(structint i; t =damon_new_target (); +if (!t) +kunit_skip (test,"target alloc fail" ); r =damon_new_region (0 ,100 ); +if (!r) { +damon_free_target (t); +kunit_skip (test,"region alloc fail" ); + } r->nr_accesses =10 ;damon_add_region (r, t); r2 =damon_new_region (100 ,300 ); +if (!r2) { +damon_free_target (t); +kunit_skip (test,"second region alloc fail" ); + } r2->nr_accesses =20 ;damon_add_region (r2, t);
Greg Kroah-Hartman
maintainerPATCH 722/737 mm/damon/tests/core-kunit: handle memory failure from damon_test_target()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: SeongJae Park <[email protected]>
commit fafe953de2c661907c94055a2497c6b8dbfd26f3 upstream.
damon_test_target() is assuming all dynamic memory allocation in it will succeed. Those are indeed likely in the real use cases since those allocations are too small to fail, but theoretically those could fail. In the case, inappropriate memory access can happen. Fix it by appropriately cleanup pre-allocated memory and skip the execution of the remaining tests in the failure cases.
--- mm/damon/core-test.h | 7 +++++++ 1 file changed, 7 insertions(+)
mm/damon/core-test.h +7 -0
@@ -58,7 +58,14 @@ static void damon_test_target(struct kunstruct damon_ctx *c =damon_new_ctx ();struct damon_target *t; +if (!c) +kunit_skip (test,"ctx alloc fail" ); + t =damon_new_target (); +if (!t) { +damon_destroy_ctx (c); +kunit_skip (test,"target alloc fail" ); + }KUNIT_EXPECT_EQ (test,0u ,nr_damon_targets (c));damon_add_target (c, t);
Greg Kroah-Hartman
maintainerPATCH 723/737 mm/damon/tests/core-kunit: handle alloc failures on damon_test_split_regions_of()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: SeongJae Park <[email protected]>
commit eded254cb69044bd4abde87394ea44909708d7c0 upstream.
damon_test_split_regions_of() is assuming all dynamic memory allocation in it will succeed. Those are indeed likely in the real use cases since those allocations are too small to fail, but theoretically those could fail. In the case, inappropriate memory access can happen. Fix it by appropriately cleanup pre-allocated memory and skip the execution of the remaining tests in the failure cases.
--- mm/damon/core-test.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
mm/damon/core-test.h +20 -0
@@ -256,15 +256,35 @@ static void damon_test_split_regions_of(struct damon_target *t;struct damon_region *r; +if (!c) +kunit_skip (test,"ctx alloc fail" ); t =damon_new_target (); +if (!t) { +damon_destroy_ctx (c); +kunit_skip (test,"target alloc fail" ); + } r =damon_new_region (0 ,22 ); +if (!r) { +damon_destroy_ctx (c); +damon_free_target (t); +kunit_skip (test,"region alloc fail" ); + }damon_add_region (r, t);damon_split_regions_of (t,2 );KUNIT_EXPECT_LE (test,damon_nr_regions (t),2u );damon_free_target (t); t =damon_new_target (); +if (!t) { +damon_destroy_ctx (c); +kunit_skip (test,"second target alloc fail" ); + } r =damon_new_region (0 ,220 ); +if (!r) { +damon_destroy_ctx (c); +damon_free_target (t); +kunit_skip (test,"second region alloc fail" ); + }damon_add_region (r, t);damon_split_regions_of (t,4 );KUNIT_EXPECT_LE (test,damon_nr_regions (t),4u );
Greg Kroah-Hartman
maintainerPATCH 724/737 mm/damon/tests/core-kunit: handle memory alloc failure from damon_test_aggregate()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: SeongJae Park <[email protected]>
commit f79f2fc44ebd0ed655239046be3e80e8804b5545 upstream.
damon_test_aggregate() is assuming all dynamic memory allocation in it will succeed. Those are indeed likely in the real use cases since those allocations are too small to fail, but theoretically those could fail. In the case, inappropriate memory access can happen. Fix it by appropriately cleanup pre-allocated memory and skip the execution of the remaining tests in the failure cases.
--- mm/damon/core-test.h | 11 +++++++++++ 1 file changed, 11 insertions(+)
mm/damon/core-test.h +11 -0
@@ -97,8 +97,15 @@ static void damon_test_aggregate(structstruct damon_region *r;int it, ir; +if (!ctx) +kunit_skip (test,"ctx alloc fail" ); +for (it =0 ; it <3 ; it++) { t =damon_new_target (); +if (!t) { +damon_destroy_ctx (ctx); +kunit_skip (test,"target alloc fail" ); + }damon_add_target (ctx, t); }
@@ -106,6 +113,10 @@ static void damon_test_aggregate(structdamon_for_each_target (t, ctx) {for (ir =0 ; ir <3 ; ir++) { r =damon_new_region (saddr[it][ir], eaddr[it][ir]); +if (!r) { +damon_destroy_ctx (ctx); +kunit_skip (test,"region alloc fail" ); + } r->nr_accesses = accesses[it][ir];damon_add_region (r, t); }
Greg Kroah-Hartman
maintainerPATCH 707/737 mm/damon/tests/vaddr-kunit: handle alloc failures on damon_do_test_apply_three_regions()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: SeongJae Park <[email protected]>
commit 2b22d0fcc6320ba29b2122434c1d2f0785fb0a25 upstream.
damon_do_test_apply_three_regions() is assuming all dynamic memory allocation in it will succeed. Those are indeed likely in the real use cases since those allocations are too small to fail, but theoretically those could fail. In the case, inappropriate memory access can happen. Fix it by appropriately cleanup pre-allocated memory and skip the execution of the remaining tests in the failure cases.
--- mm/damon/vaddr-test.h | 6 ++++++ 1 file changed, 6 insertions(+)
mm/damon/vaddr-test.h +6 -0
@@ -136,8 +136,14 @@ static void damon_do_test_apply_three_reint i; t =damon_new_target (); +if (!t) +kunit_skip (test,"target alloc fail" );for (i =0 ; i < nr_regions /2 ; i++) { r =damon_new_region (regions[i *2 ], regions[i *2 +1 ]); +if (!r) { +damon_destroy_target (t); +kunit_skip (test,"region alloc fail" ); + }damon_add_region (r, t); }
Greg Kroah-Hartman
maintainerPATCH 725/737 mm/damon/tests/core-kunit: handle alloc failures on damos_test_filter_out()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: SeongJae Park <[email protected]>
commit d14d5671e7c9cc788c5a1edfa94e6f9064275905 upstream.
damon_test_filter_out() is assuming all dynamic memory allocation in it will succeed. Those are indeed likely in the real use cases since those allocations are too small to fail, but theoretically those could fail. In the case, inappropriate memory access can happen. Fix it by appropriately cleanup pre-allocated memory and skip the execution of the remaining tests in the failure cases.
--- mm/damon/core-test.h | 11 +++++++++++ 1 file changed, 11 insertions(+)
mm/damon/core-test.h +11 -0
@@ -433,11 +433,22 @@ static void damos_test_filter_out(structstruct damos_filter *f; f =damos_new_filter (DAMOS_FILTER_TYPE_ADDR , true); +if (!f) +kunit_skip (test,"filter alloc fail" ); f->addr_range = (struct damon_addr_range ){ .start =DAMON_MIN_REGION *2 , .end =DAMON_MIN_REGION *6 }; t =damon_new_target (); +if (!t) { +damos_destroy_filter (f); +kunit_skip (test,"target alloc fail" ); + } r =damon_new_region (DAMON_MIN_REGION *3 ,DAMON_MIN_REGION *5 ); +if (!r) { +damos_destroy_filter (f); +damon_free_target (t); +kunit_skip (test,"region alloc fail" ); + }damon_add_region (r, t);/* region in the range */
Greg Kroah-Hartman
maintainerPATCH 726/737 mm/damon/tests/core-kunit: handle alloc failures in damon_test_set_regions()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: SeongJae Park <[email protected]>
commit 74d5969995d129fd59dd93b9c7daa6669cb6810f upstream.
damon_test_set_regions() is assuming all dynamic memory allocation in it will succeed. Those are indeed likely in the real use cases since those allocations are too small to fail, but theoretically those could fail. In the case, inappropriate memory access can happen. Fix it by appropriately cleanup pre-allocated memory and skip the execution of the remaining tests in the failure cases.
--- mm/damon/core-test.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
mm/damon/core-test.h +15 -2
@@ -341,13 +341,26 @@ static void damon_test_ops_registration(static void damon_test_set_regions (struct kunit *test) {struct damon_target *t =damon_new_target (); -struct damon_region *r1 =damon_new_region (4 ,16 ); -struct damon_region *r2 =damon_new_region (24 ,32 ); +struct damon_region *r1, *r2;struct damon_addr_range range = {.start =8 , .end =28 };unsigned long expects[] = {8 ,16 ,16 ,24 ,24 ,28 };int expect_idx =0 ;struct damon_region *r; +if (!t) +kunit_skip (test,"target alloc fail" ); + r1 =damon_new_region (4 ,16 ); +if (!r1) { +damon_free_target (t); +kunit_skip (test,"region alloc fail" ); + } + r2 =damon_new_region (24 ,32 ); +if (!r2) { +damon_free_target (t); +damon_free_region (r1); +kunit_skip (test,"second region alloc fail" ); + } +damon_add_region (r1, t);damon_add_region (r2, t);damon_set_regions (t, &range,1 );
Greg Kroah-Hartman
maintainerPATCH 727/737 mm/damon/tests/core-kunit: handle alloc failures in damon_test_ops_registration()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: SeongJae Park <[email protected]>
commit 4f835f4e8c863985f15abd69db033c2f66546094 upstream.
damon_test_ops_registration() is assuming all dynamic memory allocation in it will succeed. Those are indeed likely in the real use cases since those allocations are too small to fail, but theoretically those could fail. In the case, inappropriate memory access can happen. Fix it by appropriately cleanup pre-allocated memory and skip the execution of the remaining tests in the failure cases.
--- mm/damon/core-test.h | 3 +++ 1 file changed, 3 insertions(+)
mm/damon/core-test.h +3 -0
@@ -308,6 +308,9 @@ static void damon_test_ops_registration(struct damon_ctx *c =damon_new_ctx ();struct damon_operations ops, bak; +if (!c) +kunit_skip (test,"ctx alloc fail" ); +/* DAMON_OPS_{V,P}ADDR are registered on subsys_initcall */ KUNIT_EXPECT_EQ (test,damon_select_ops (c,DAMON_OPS_VADDR ),0 );KUNIT_EXPECT_EQ (test,damon_select_ops (c,DAMON_OPS_PADDR ),0 );
Greg Kroah-Hartman
maintainerPATCH 728/737 mm/damon/tests/core-kunit: handle alloc failure on damon_test_set_attrs()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: SeongJae Park <[email protected]>
commit 915a2453d824a9b6bf724e3f970d86ae1d092a61 upstream.
damon_test_set_attrs() is assuming all dynamic memory allocation in it will succeed. Those are indeed likely in the real use cases since those allocations are too small to fail, but theoretically those could fail. In the case, inappropriate memory access can happen. Fix it by appropriately cleanup pre-allocated memory and skip the execution of the remaining tests in the failure cases.
--- mm/damon/core-test.h | 3 +++ 1 file changed, 3 insertions(+)
mm/damon/core-test.h +3 -0
@@ -413,6 +413,9 @@ static void damon_test_set_attrs(struct .sample_interval = 5000, .aggr_interval = 100000,};struct damon_attrs invalid_attrs; +if (!c) +kunit_skip (test,"ctx alloc fail" ); +KUNIT_EXPECT_EQ (test,damon_set_attrs (c, &valid_attrs),0 ); invalid_attrs = valid_attrs;
Greg Kroah-Hartman
maintainerPATCH 729/737 mm/damon/tests/core-kunit: handle alloc failures in damon_test_update_monitoring_result()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: SeongJae Park <[email protected]>
commit 8cf298c01b7fdb08eef5b6b26d0fe98d48134d72 upstream.
damon_test_update_monitoring_result() is assuming all dynamic memory allocation in it will succeed. Those are indeed likely in the real use cases since those allocations are too small to fail, but theoretically those could fail. In the case, inappropriate memory access can happen. Fix it by appropriately cleanup pre-allocated memory and skip the execution of the remaining tests in the failure cases.
--- mm/damon/core-test.h | 3 +++ 1 file changed, 3 insertions(+)
mm/damon/core-test.h +3 -0
@@ -383,6 +383,9 @@ static void damon_test_update_monitoringstruct damon_attrs new_attrs;struct damon_region *r =damon_new_region (3 ,7 ); +if (!r) +kunit_skip (test,"region alloc fail" ); + r->nr_accesses =15 ; r->age =20 ;
Greg Kroah-Hartman
maintainerPATCH 730/737 virtio_console: fix order of fields cols and rows
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maximilian Immanuel Brandtner <[email protected]>
commit 5326ab737a47278dbd16ed3ee7380b26c7056ddd upstream.
According to section 5.3.6.2 (Multiport Device Operation) of the virtio spec(version 1.2) a control buffer with the event VIRTIO_CONSOLE_RESIZE is followed by a virtio_console_resize struct containing cols then rows. The kernel implements this the wrong way around (rows then cols) resulting in the two values being swapped.
Message-Id: <[email protected]>
--- drivers/char/virtio_console.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/virtio_console.c +1 -1
@@ -1612,8 +1612,8 @@ static void handle_control_message(strucbreak ;case VIRTIO_CONSOLE_RESIZE : {struct { -__virtio16 rows;__virtio16 cols; +__virtio16 rows; } size;if (!is_console_port (port))
Greg Kroah-Hartman
maintainerPATCH 731/737 ext4: filesystems without casefold feature cannot be mounted with siphash
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lizhi Xu <[email protected]>
commit 985b67cd86392310d9e9326de941c22fc9340eec upstream.
When mounting the ext4 filesystem, if the default hash version is set to DX_HASH_SIPHASH but the casefold feature is not set, exit the mounting.
--- fs/ext4/super.c | 8 ++++++++ 1 file changed, 8 insertions(+)
fs/ext4/super.c +8 -0
@@ -3632,6 +3632,14 @@ int ext4_feature_set_ok(struct super_blo }#endif +if (EXT4_SB (sb)->s_es->s_def_hash_version ==DX_HASH_SIPHASH && + !ext4_has_feature_casefold (sb)) { +ext4_msg (sb,KERN_ERR , +"Filesystem without casefold feature cannot be " +"mounted with siphash" ); +return 0 ; + } +if (readonly)return 1 ;
Greg Kroah-Hartman
maintainerPATCH 732/737 net: stmmac: make sure that ptp_rate is not 0 before configuring EST
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexis Lothoré <[email protected]>
commit cbefe2ffa7784525ec5d008ba87c7add19ec631a upstream.
If the ptp_rate recorded earlier in the driver happens to be 0, this bogus value will propagate up to EST configuration, where it will trigger a division by 0.
Prevent this division by 0 by adding the corresponding check and error code.
[ The context change is due to the commit c3f3b97238f6
("net: stmmac: Refactor EST implementation") which is irrelevant to the logic of this patch. ]
--- drivers/net/ethernet/stmicro/stmmac/dwmac5.c | 5 +++++ drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 5 +++++ 2 files changed, 10 insertions(+)
drivers/net/ethernet/stmicro/stmmac/dwmac5.c +5 -0
@@ -597,6 +597,11 @@ int dwmac5_est_configure(void __iomem *iint i, ret =0x0 ;u32 ctrl; +if (!ptp_rate) { +pr_warn ("Dwmac5: Invalid PTP rate" ); +return -EINVAL ; + } + ret |=dwmac5_est_write (ioaddr,BTR_LOW , cfg->btr[0 ], false); ret |=dwmac5_est_write (ioaddr,BTR_HIGH , cfg->btr[1 ], false); ret |=dwmac5_est_write (ioaddr,TER , cfg->ter, false);
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c +5 -0
@@ -1537,6 +1537,11 @@ static int dwxgmac3_est_configure(void _int i, ret =0x0 ;u32 ctrl; +if (!ptp_rate) { +pr_warn ("Dwxgmac2: Invalid PTP rate" ); +return -EINVAL ; + } + ret |=dwxgmac3_est_write (ioaddr,XGMAC_BTR_LOW , cfg->btr[0 ], false); ret |=dwxgmac3_est_write (ioaddr,XGMAC_BTR_HIGH , cfg->btr[1 ], false); ret |=dwxgmac3_est_write (ioaddr,XGMAC_TER , cfg->ter, false);
Greg Kroah-Hartman
maintainerPATCH 733/737 pwm: stm32: Always program polarity
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Nyekjaer <[email protected]>
Commit 7346e7a058a2 ("pwm: stm32: Always do lazy disabling") triggered a regression where PWM polarity changes could be ignored.
stm32_pwm_set_polarity() was skipped due to a mismatch between the cached pwm->state.polarity and the actual hardware state, leaving the hardware polarity unchanged.
--- drivers/pwm/pwm-stm32.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/pwm/pwm-stm32.c +1 -2
@@ -462,8 +462,7 @@ static int stm32_pwm_apply(struct pwm_chreturn 0 ; } -if (state->polarity != pwm->state.polarity) -stm32_pwm_set_polarity (priv, pwm->hwpwm, state->polarity); +stm32_pwm_set_polarity (priv, pwm->hwpwm, state->polarity); ret =stm32_pwm_config (priv, pwm->hwpwm, state->duty_cycle, state->period);
Greg Kroah-Hartman
maintainerPATCH 734/737 blk-mq: setup queue ->tag_set before initializing hctx
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Lei <[email protected]>
commit c25c0c9035bb8b28c844dfddeda7b8bdbcfcae95 upstream.
Commit 7b815817aa58 ("blk-mq: add helper for checking if one CPU is mapped to specified hctx") needs to check queue mapping via tag set in hctx's cpuhp handler.
However, q->tag_set may not be setup yet when the cpuhp handler is enabled, then kernel oops is triggered.
Fix the issue by setup queue tag_set before initializing hctx.
--- block/blk-mq.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
block/blk-mq.c +6 -2
@@ -4453,6 +4453,12 @@ int blk_mq_init_allocated_queue(struct b/* mark the queue as mq asap */ q->mq_ops = set->ops; +/* +* ->tag_set has to be setup before initialize hctx, which cpuphp +* handler needs it for checking queue mapping +*/ + q->tag_set = set; +if (blk_mq_alloc_ctxs (q)) goto err_exit;
@@ -4471,8 +4477,6 @@ int blk_mq_init_allocated_queue(struct bINIT_WORK (&q->timeout_work, blk_mq_timeout_work);blk_queue_rq_timeout (q, set->timeout ? set->timeout :30 *HZ ); - q->tag_set = set; - q->queue_flags |=QUEUE_FLAG_MQ_DEFAULT ;blk_mq_update_poll_flag (q);
Greg Kroah-Hartman
maintainerPATCH 708/737 RDMA/core: Fix "KASAN: slab-use-after-free Read in ib_register_device" problem
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhu Yanjun <[email protected]>
commit d0706bfd3ee40923c001c6827b786a309e2a8713 upstream.
Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:408 [inline] print_report+0xc3/0x670 mm/kasan/report.c:521 kasan_report+0xe0/0x110 mm/kasan/report.c:634 strlen+0x93/0xa0 lib/string.c:420 __fortify_strlen include/linux/fortify-string.h:268 [inline] get_kobj_path_length lib/kobject.c:118 [inline] kobject_get_path+0x3f/0x2a0 lib/kobject.c:158 kobject_uevent_env+0x289/0x1870 lib/kobject_uevent.c:545 ib_register_device drivers/infiniband/core/device.c:1472 [inline] ib_register_device+0x8cf/0xe00 drivers/infiniband/core/device.c:1393 rxe_register_device+0x275/0x320 drivers/infiniband/sw/rxe/rxe_verbs.c:1552 rxe_net_add+0x8e/0xe0 drivers/infiniband/sw/rxe/rxe_net.c:550 rxe_newlink+0x70/0x190 drivers/infiniband/sw/rxe/rxe.c:225 nldev_newlink+0x3a3/0x680 drivers/infiniband/core/nldev.c:1796 rdma_nl_rcv_msg+0x387/0x6e0 drivers/infiniband/core/netlink.c:195 rdma_nl_rcv_skb.constprop.0.isra.0+0x2e5/0x450 netlink_unicast_kernel net/netlink/af_netlink.c:1313 [inline] netlink_unicast+0x53a/0x7f0 net/netlink/af_netlink.c:1339 netlink_sendmsg+0x8d1/0xdd0 net/netlink/af_netlink.c:1883 sock_sendmsg_nosec net/socket.c:712 [inline] __sock_sendmsg net/socket.c:727 [inline] ____sys_sendmsg+0xa95/0xc70 net/socket.c:2566 ___sys_sendmsg+0x134/0x1d0 net/socket.c:2620 __sys_sendmsg+0x16d/0x220 net/socket.c:2652 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x260 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f
This problem is similar to the problem that the
commit 1d6a9e7449e2 ("RDMA/core: Fix use-after-free when rename device name") fixes.
The root cause is: the function ib_device_rename() renames the name with lock. But in the function kobject_uevent(), this name is accessed without lock protection at the same time.
The solution is to add the lock protection when this name is accessed in the function kobject_uevent().
[ Ajay: Modified to apply on v5.10.y-v6.6.y
ib_device_notify_register() not present in v5.10.y-v6.6.y, so directly added lock for kobject_uevent() ]
--- drivers/infiniband/core/device.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/infiniband/core/device.c +5 -0
@@ -1450,8 +1450,13 @@ int ib_register_device(struct ib_devicereturn ret; }dev_set_uevent_suppress (&device->dev, false); + +down_read (&devices_rwsem); +/* Mark for userspace that device is ready */ kobject_uevent (&device->dev.kobj,KOBJ_ADD ); + +up_read (&devices_rwsem);ib_device_put (device);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 735/737 tty: fix tty_port_tty_*hangup() kernel-doc
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Slaby (SUSE) <[email protected]>
commit 6241b49540a65a6d5274fa938fd3eb4cbfe2e076 upstream.
The commit below added a new helper, but omitted to move (and add) the corressponding kernel-doc. Do it now.
--- Documentation/driver-api/tty/tty_port.rst | 5 +++-- drivers/tty/tty_port.c | 5 ----- include/linux/tty_port.h | 9 +++++++++ 3 files changed, 12 insertions(+), 7 deletions(-)
Documentation/driver-api/tty/tty_port.rst +3 -2
@@ -42,9 +42,10 @@ TTY Refcounting TTY Helpers ----------- +.. kernel-doc:: include/linux/tty_port.h + :identifiers: tty_port_tty_hangup tty_port_tty_vhangup .. kernel-doc:: drivers/tty/tty_port.c - :identifiers: tty_port_tty_hangup tty_port_tty_wakeup - + :identifiers: tty_port_tty_wakeup Modem Signals -------------
drivers/tty/tty_port.c +0 -5
@@ -409,11 +409,6 @@ void tty_port_hangup(struct tty_port *po }EXPORT_SYMBOL (tty_port_hangup); -/** -* tty_port_tty_hangup - helper to hang up a tty -* @port: tty port -* @check_clocal: hang only ttys with %CLOCAL unset? -*/ void __tty_port_tty_hangup (struct tty_port *port,bool check_clocal,bool async) {struct tty_struct *tty =tty_port_tty_get (port);
include/linux/tty_port.h +9 -0
@@ -254,11 +254,20 @@ static inline int tty_port_users(structreturn port->count + port->blocked_open; } +/** +* tty_port_tty_hangup - helper to hang up a tty asynchronously +* @port: tty port +* @check_clocal: hang only ttys with %CLOCAL unset? +*/ static inline void tty_port_tty_hangup (struct tty_port *port,bool check_clocal) {__tty_port_tty_hangup (port, check_clocal, true); } +/** +* tty_port_tty_vhangup - helper to hang up a tty synchronously +* @port: tty port +*/ static inline void tty_port_tty_vhangup (struct tty_port *port) {__tty_port_tty_hangup (port, false, false);
Greg Kroah-Hartman
maintainerPATCH 736/737 firmware: arm_scmi: Fix unused notifier-block in unregister
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amitai Gottlieb <[email protected]>
In scmi_devm_notifier_unregister(), the notifier-block argument was ignored and never passed to devres_release(). As a result, the function always returned -ENOENT and failed to unregister the notifier.
Drivers that depend on this helper for teardown could therefore hit unexpected failures, including kernel panics.
Commit 264a2c520628 ("firmware: arm_scmi: Simplify scmi_devm_notifier_unregister") removed the faulty code path during refactoring and hence this fix is not required upstream.
--- drivers/firmware/arm_scmi/notify.c | 1 + 1 file changed, 1 insertion(+)
drivers/firmware/arm_scmi/notify.c +1 -0
@@ -1539,6 +1539,7 @@ static int scmi_devm_notifier_unregister dres.handle = sdev->handle; dres.proto_id = proto_id; dres.evt_id = evt_id; + dres.nb = nb;if (src_id) { dres.__src_id = *src_id; dres.src_id = &dres.__src_id;
Greg Kroah-Hartman
maintainerPATCH 737/737 Revert "iommu/amd: Skip enabling command/event buffers for kdump"
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
This reverts commit 44a764aec64b3f3235b9cbac2525222f69685418 which is commit 9be15fbfc6c5c89c22cf6e209f66ea43ee0e58bb upstream.
This causes problems in older kernel trees as SNP host kdump is not supported in them, so drop it from the stable branches.
--- drivers/iommu/amd/init.c | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-)
drivers/iommu/amd/init.c +9 -19
@@ -840,16 +840,11 @@ static void iommu_enable_command_buffer(BUG_ON (iommu->cmd_buf ==NULL ); -if (!is_kdump_kernel ()) { -/* -* Command buffer is re-used for kdump kernel and setting -* of MMIO register is not required. -*/ - entry =iommu_virt_to_phys (iommu->cmd_buf); - entry |=MMIO_CMD_SIZE_512 ; -memcpy_toio (iommu->mmio_base +MMIO_CMD_BUF_OFFSET , - &entry,sizeof (entry)); - } + entry =iommu_virt_to_phys (iommu->cmd_buf); + entry |=MMIO_CMD_SIZE_512 ; + +memcpy_toio (iommu->mmio_base +MMIO_CMD_BUF_OFFSET , + &entry,sizeof (entry));amd_iommu_reset_cmd_buffer (iommu); }
@@ -898,15 +893,10 @@ static void iommu_enable_event_buffer(stBUG_ON (iommu->evt_buf ==NULL ); -if (!is_kdump_kernel ()) { -/* -* Event buffer is re-used for kdump kernel and setting -* of MMIO register is not required. -*/ - entry =iommu_virt_to_phys (iommu->evt_buf) |EVT_LEN_MASK ; -memcpy_toio (iommu->mmio_base +MMIO_EVT_BUF_OFFSET , - &entry,sizeof (entry)); - } + entry =iommu_virt_to_phys (iommu->evt_buf) |EVT_LEN_MASK ; + +memcpy_toio (iommu->mmio_base +MMIO_EVT_BUF_OFFSET , + &entry,sizeof (entry));/* set head and tail to zero manually */ writel (0x00 , iommu->mmio_base +MMIO_EVT_HEAD_OFFSET );
Greg Kroah-Hartman
maintainerPATCH 709/737 sched/fair: Small cleanup to sched_balance_newidle()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
commit e78e70dbf603c1425f15f32b455ca148c932f6c1 upstream.
Pull out the !sd check to simplify code.
--- kernel/sched/fair.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
kernel/sched/fair.c +6 -5
@@ -12374,14 +12374,15 @@ static int sched_balance_newidle(structrcu_read_lock (); sd =rcu_dereference_check_sched_domain (this_rq->sd); +if (!sd) { +rcu_read_unlock (); + goto out; + }if (!READ_ONCE (this_rq->rd->overload) || - (sd && this_rq->avg_idle < sd->max_newidle_lb_cost)) { - -if (sd) -update_next_balance (sd, &next_balance); + this_rq->avg_idle < sd->max_newidle_lb_cost) { +update_next_balance (sd, &next_balance);rcu_read_unlock (); - goto out; }rcu_read_unlock ();
Greg Kroah-Hartman
maintainerPATCH 710/737 sched/fair: Small cleanup to update_newidle_cost()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
commit 08d473dd8718e4a4d698b1113a14a40ad64a909b upstream.
Simplify code by adding a few variables.
--- kernel/sched/fair.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
kernel/sched/fair.c +7 -4
@@ -11718,22 +11718,25 @@ void update_max_interval(void)static inline bool update_newidle_cost (struct sched_domain *sd,u64 cost) { +unsigned long next_decay = sd->last_decay_max_lb_cost +HZ ; +unsigned long now = jiffies; +if (cost > sd->max_newidle_lb_cost) {/* * Track max cost of a domain to make sure to not delay the * next wakeup on the CPU. */ sd->max_newidle_lb_cost = cost; - sd->last_decay_max_lb_cost = jiffies; - }else if (time_after (jiffies, sd->last_decay_max_lb_cost +HZ )) { + sd->last_decay_max_lb_cost = now; + + }else if (time_after (now, next_decay)) {/* * Decay the newidle max times by ~1% per second to ensure that * it is not outdated and the current max cost is actually * shorter. */ sd->max_newidle_lb_cost = (sd->max_newidle_lb_cost *253 ) /256 ; - sd->last_decay_max_lb_cost = jiffies; - + sd->last_decay_max_lb_cost = now;return true; }
Greg Kroah-Hartman
maintainerPATCH 711/737 sched/fair: Proportional newidle balance
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra (Intel) <[email protected]>
commit 33cf66d88306663d16e4759e9d24766b0aaa2e17 upstream.
Add a randomized algorithm that runs newidle balancing proportional to its success rate.
This improves schbench significantly:
6.18-rc4: 2.22 Mrps/s
6.18-rc4+revert: 2.04 Mrps/s
6.18-rc4+revert+random: 2.18 Mrps/S
Conversely, per Adam Li this affects SpecJBB slightly, reducing it by 1%:
6.17: -6%
6.17+revert: 0%
6.17+revert+random: -1%
--- include/linux/sched/topology.h | 3 ++ kernel/sched/core.c | 3 ++ kernel/sched/fair.c | 44 +++++++++++++++++++++++++++++++++++++---- kernel/sched/features.h | 5 ++++ kernel/sched/sched.h | 7 ++++++ kernel/sched/topology.c | 6 +++++ 6 files changed, 64 insertions(+), 4 deletions(-)
include/linux/sched/topology.h +3 -0
@@ -106,6 +106,9 @@ struct sched_domain {unsigned int nr_balance_failed;/* initialise to 0 */ /* idle_balance() stats */ +unsigned int newidle_call; +unsigned int newidle_success; +unsigned int newidle_ratio;u64 max_newidle_lb_cost;unsigned long last_decay_max_lb_cost;
kernel/sched/core.c +3 -0
@@ -116,6 +116,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(sched_util_EXPORT_TRACEPOINT_SYMBOL_GPL (sched_update_nr_running_tp); DEFINE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues); +DEFINE_PER_CPU(struct rnd_state, sched_rnd_state);#ifdef CONFIG_SCHED_DEBUG /*
@@ -9872,6 +9873,8 @@ void __init sched_init_smp(void) {sched_init_numa (NUMA_NO_NODE ); +prandom_init_once (&sched_rnd_state); +/* * There's no userspace yet to cause hotplug operations; hence all the * CPU masks are stable and all blatant races in the below code cannot
kernel/sched/fair.c +40 -4
74 lines not on this page · raw message
kernel/sched/features.h +5 -0
@@ -88,4 +88,9 @@ SCHED_FEAT(UTIL_EST_FASTUP, true)SCHED_FEAT (LATENCY_WARN , false) +/* +* Do newidle balancing proportional to its success rate using randomization. + */ +SCHED_FEAT(NI_RANDOM, true) +SCHED_FEAT (HZ_BW , true)
kernel/sched/sched.h +7 -0
@@ -5,6 +5,7 @@#ifndef _KERNEL_SCHED_SCHED_H#define _KERNEL_SCHED_SCHED_H +#include <linux/prandom.h> #include <linux/sched/affinity.h> #include <linux/sched/autogroup.h> #include <linux/sched/cpufreq.h>
@@ -1205,6 +1206,12 @@ static inline bool is_migration_disabled } DECLARE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues); +DECLARE_PER_CPU(struct rnd_state, sched_rnd_state); + +static inline u32 sched_rng (void ) +{ +return prandom_u32_state (this_cpu_ptr (&sched_rnd_state)); +}#define cpu_rq (cpu) (&per_cpu(runqueues, (cpu)))#define this_rq () this_cpu_ptr(&runqueues)
kernel/sched/topology.c +6 -0
@@ -1600,6 +1600,12 @@ sd_init(struct sched_domain_topology_lev .last_balance = jiffies, .balance_interval = sd_weight, + +/* 50% success rate */ + .newidle_call = 512, + .newidle_success = 256, + .newidle_ratio = 512, + .max_newidle_lb_cost = 0, .last_decay_max_lb_cost = jiffies, .child = child,
Greg Kroah-Hartman
maintainerPATCH 712/737 net: Remove conditional threaded-NAPI wakeup based on task state.
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Andrzej Siewior <[email protected]>
commit 56364c910691f6d10ba88c964c9041b9ab777bd6 upstream.
A NAPI thread is scheduled by first setting NAPI_STATE_SCHED bit. If successful (the bit was not yet set) then the NAPI_STATE_SCHED_THREADED is set but only if thread's state is not TASK_INTERRUPTIBLE (is TASK_RUNNING) followed by task wakeup.
If the task is idle (TASK_INTERRUPTIBLE) then the NAPI_STATE_SCHED_THREADED bit is not set. The thread is no relying on the bit but always leaving the wait-loop after returning from schedule() because there must have been a wakeup.
The smpboot-threads implementation for per-CPU threads requires an explicit condition and does not support "if we get out of schedule() then there must be something to do".
Removing this optimisation simplifies the following integration.
Set NAPI_STATE_SCHED_THREADED unconditionally on wakeup and rely on it in the wait path by removing the `woken' condition.
--- net/core/dev.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)
net/core/dev.c +2 -12
@@ -4526,13 +4526,7 @@ static inline void ____napi_schedule(str*/ thread =READ_ONCE (napi->thread);if (thread) { -/* Avoid doing set_bit() if the thread is in -* INTERRUPTIBLE state, cause napi_thread_wait() -* makes sure to proceed with napi polling -* if the thread is explicitly woken from here. -*/ -if (READ_ONCE (thread->__state) !=TASK_INTERRUPTIBLE ) -set_bit (NAPI_STATE_SCHED_THREADED , &napi->state); +set_bit (NAPI_STATE_SCHED_THREADED , &napi->state);wake_up_process (thread);return ; }
@@ -6688,8 +6682,6 @@ static int napi_poll(struct napi_structstatic int napi_thread_wait (struct napi_struct *napi) { -bool woken = false; -set_current_state (TASK_INTERRUPTIBLE );while (!kthread_should_stop ()) {
@@ -6698,15 +6690,13 @@ static int napi_thread_wait(struct napi_* Testing SCHED bit is not enough because SCHED bit might be * set by some other busy poll thread or by napi_disable(). */ -if (test_bit (NAPI_STATE_SCHED_THREADED , &napi->state) || woken) { +if (test_bit (NAPI_STATE_SCHED_THREADED , &napi->state)) {WARN_ON (!list_empty (&napi->poll_list));__set_current_state (TASK_RUNNING );return 0 ; }schedule (); -/* woken being true indicates this thread owns this napi. */ - woken = true;set_current_state (TASK_INTERRUPTIBLE ); }__set_current_state (TASK_RUNNING );
Greg Kroah-Hartman
maintainerPATCH 713/737 net: Allow to use SMP threads for backlog NAPI.
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Andrzej Siewior <[email protected]>
commit dad6b97702639fba27a2bd3e986982ad6f0db3a7 upstream.
Backlog NAPI is a per-CPU NAPI struct only (with no device behind it) used by drivers which don't do NAPI them self, RPS and parts of the stack which need to avoid recursive deadlocks while processing a packet.
The non-NAPI driver use the CPU local backlog NAPI. If RPS is enabled then a flow for the skb is computed and based on the flow the skb can be enqueued on a remote CPU. Scheduling/ raising the softirq (for backlog's NAPI) on the remote CPU isn't trivial because the softirq is only scheduled on the local CPU and performed after the hardirq is done. In order to schedule a softirq on the remote CPU, an IPI is sent to the remote CPU which schedules the backlog-NAPI on the then local CPU.
On PREEMPT_RT interrupts are force-threaded. The soft interrupts are raised within the interrupt thread and processed after the interrupt handler completed still within the context of the interrupt thread. The softirq is handled in the context where it originated.
With force-threaded interrupts enabled, ksoftirqd is woken up if a softirq is raised from hardirq context. This is the case if it is raised from an IPI. Additionally there is a warning on PREEMPT_RT if the softirq is raised from the idle thread.
This was done for two reasons:
- With threaded interrupts the processing should happen in thread context (where it originated) and ksoftirqd is the only thread for this context if raised from hardirq. Using the currently running task instead would "punish" a random task.
- Once ksoftirqd is active it consumes all further softirqs until it stops running. This changed recently and is no longer the case.
Instead of keeping the backlog NAPI in ksoftirqd (in force-threaded/ PREEMPT_RT setups) I am proposing NAPI-threads for backlog. The "proper" setup with threaded-NAPI is not doable because the threads are not pinned to an individual CPU and can be modified by the user. Additionally a dummy network device would have to be assigned. Also CPU-hotplug has to be considered if additional CPUs show up. All this can be probably done/ solved but the smpboot-threads already provide this infrastructure.
Sending UDP packets over loopback expects that the packet is processed within the call. Delaying it by handing it over to the thread hurts performance. It is not beneficial to the outcome if the context switch happens immediately after enqueue or after a while to process a few packets in a batch.
There is no need to always use the thread if the backlog NAPI is requested on the local CPU. This restores the loopback throuput. The performance drops mostly to the same value after enabling RPS on the loopback comparing the IPI and the tread result.
Create NAPI-threads for backlog if request during boot. The thread runs the inner loop from napi_threaded_poll(), the wait part is different. It checks for NAPI_STATE_SCHED (the backlog NAPI can not be disabled).
The NAPI threads for backlog are optional, it has to be enabled via the boot argument "thread_backlog_napi". It is mandatory for PREEMPT_RT to avoid the wakeup of ksoftirqd from the IPI.
--- net/core/dev.c | 152 +++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 115 insertions(+), 37 deletions(-)
net/core/dev.c +115 -37
@@ -78,6 +78,7 @@#include <linux/slab.h> #include <linux/sched.h> #include <linux/sched/mm.h> +#include <linux/smpboot.h> #include <linux/mutex.h> #include <linux/rwsem.h> #include <linux/string.h>
@@ -217,6 +218,31 @@ static inline struct hlist_head *dev_indreturn &net->dev_index_head[ifindex & (NETDEV_HASHENTRIES -1 )]; } +#ifndef CONFIG_PREEMPT_RT + +static DEFINE_STATIC_KEY_FALSE (use_backlog_threads_key); + +static int __init setup_backlog_napi_threads (char *arg) +{ +static_branch_enable (&use_backlog_threads_key); +return 0 ; +} +early_param ("thread_backlog_napi" , setup_backlog_napi_threads); + +static bool use_backlog_threads (void ) +{ +return static_branch_unlikely (&use_backlog_threads_key); +} + +#else + +static bool use_backlog_threads (void ) +{ +return true; +} + +#endif +static inline void rps_lock_irqsave (struct softnet_data *sd,unsigned long *flags) {
@@ -4494,6 +4520,7 @@ EXPORT_SYMBOL(__dev_direct_xmit);/************************************************************************* * Receiver routines *************************************************************************/ +static DEFINE_PER_CPU(struct task_struct *, backlog_napi);int netdev_max_backlog__read_mostly =1000 ;EXPORT_SYMBOL (netdev_max_backlog);
@@ -4526,12 +4553,16 @@ static inline void ____napi_schedule(str*/ thread =READ_ONCE (napi->thread);if (thread) { +if (use_backlog_threads () && thread ==raw_cpu_read (backlog_napi)) + goto use_local_napi; +set_bit (NAPI_STATE_SCHED_THREADED , &napi->state);wake_up_process (thread);return ; } } +use_local_napi:list_add_tail (&napi->poll_list, &sd->poll_list);WRITE_ONCE (napi->list_owner,smp_processor_id ());/* If not called from net_rx_action()
@@ -4777,6 +4808,11 @@ static void napi_schedule_rps(struct sof#ifdef CONFIG_RPS if (sd != mysd) { +if (use_backlog_threads ()) { +__napi_schedule_irqoff (&sd->backlog); +return ; + } + sd->rps_ipi_next = mysd->rps_ipi_list; mysd->rps_ipi_list = sd;
@@ -6000,7 +6036,7 @@ static void net_rps_action_and_irq_enabl#ifdef CONFIG_RPS struct softnet_data *remsd = sd->rps_ipi_list; -if (remsd) { +if (!use_backlog_threads () && remsd) { sd->rps_ipi_list =NULL ;local_irq_enable ();
@@ -6015,7 +6051,7 @@ static void net_rps_action_and_irq_enablstatic bool sd_has_rps_ipi_waiting (struct softnet_data *sd) {#ifdef CONFIG_RPS -return sd->rps_ipi_list !=NULL ; +return !use_backlog_threads () && sd->rps_ipi_list;#else return false;#endif
@@ -6059,7 +6095,7 @@ static int process_backlog(struct napi_s* We can use a plain write instead of clear_bit(), * and we dont need an smp_mb() memory barrier. */ - napi->state =0 ; + napi->state &=NAPIF_STATE_THREADED ; again = false; }else { skb_queue_splice_tail_init(&sd->input_pkt_queue,
@@ -6725,43 +6761,48 @@ static void skb_defer_free_flush(struct } } -static int napi_threaded_poll (void *data) +static void napi_threaded_poll_loop (struct napi_struct *napi) { -struct napi_struct *napi = data;struct softnet_data *sd; -void *have; +unsigned long last_qs = jiffies; -while (!napi_thread_wait (napi)) { -unsigned long last_qs = jiffies; +for (;;) { +bool repoll = false; +void *have; -for (;;) { -bool repoll = false; +local_bh_disable (); + sd =this_cpu_ptr (&softnet_data); + sd->in_napi_threaded_poll = true; -local_bh_disable (); - sd =this_cpu_ptr (&softnet_data); - sd->in_napi_threaded_poll = true; - - have =netpoll_poll_lock (napi); -__napi_poll (napi, &repoll); -netpoll_poll_unlock (have); - - sd->in_napi_threaded_poll = false; -barrier (); - -if (sd_has_rps_ipi_waiting (sd)) { -local_irq_disable (); -net_rps_action_and_irq_enable (sd); - } -skb_defer_free_flush (sd); -local_bh_enable (); + have =netpoll_poll_lock (napi); +__napi_poll (napi, &repoll); +netpoll_poll_unlock (have); + + sd->in_napi_threaded_poll = false; +barrier (); + +if (sd_has_rps_ipi_waiting (sd)) { +local_irq_disable (); +net_rps_action_and_irq_enable (sd); + } +skb_defer_free_flush (sd); +local_bh_enable (); -if (!repoll) -break ; +if (!repoll) +break ; -rcu_softirq_qs_periodic (last_qs); -cond_resched (); - } +rcu_softirq_qs_periodic (last_qs); +cond_resched (); } +} + +static int napi_threaded_poll (void *data) +{ +struct napi_struct *napi = data; + +while (!napi_thread_wait (napi)) +napi_threaded_poll_loop (napi); +return 0 ; }
@@ -11346,7 +11387,7 @@ static int dev_cpu_dead(unsigned int oldlist_del_init (&napi->poll_list);if (napi->poll == process_backlog) - napi->state =0 ; + napi->state &=NAPIF_STATE_THREADED ;else ____napi_schedule (sd, napi); }
@@ -11354,12 +11395,14 @@ static int dev_cpu_dead(unsigned int oldraise_softirq_irqoff (NET_TX_SOFTIRQ );local_irq_enable (); +if (!use_backlog_threads ()) {#ifdef CONFIG_RPS - remsd = oldsd->rps_ipi_list; - oldsd->rps_ipi_list =NULL ; + remsd = oldsd->rps_ipi_list; + oldsd->rps_ipi_list =NULL ;#endif -/* send out pending IPI's on offline CPU */ -net_rps_send_ipi (remsd); +/* send out pending IPI's on offline CPU */ +net_rps_send_ipi (remsd); + }/* Process offline CPU's input_pkt_queue */ while ((skb =__skb_dequeue (&oldsd->process_queue))) {
@@ -11622,6 +11665,38 @@ static struct pernet_operations __net_in* */ +static int backlog_napi_should_run (unsigned int cpu) +{ +struct softnet_data *sd =per_cpu_ptr (&softnet_data, cpu); +struct napi_struct *napi = &sd->backlog; + +return test_bit (NAPI_STATE_SCHED_THREADED , &napi->state); +} + +static void run_backlog_napi (unsigned int cpu) +{ +struct softnet_data *sd =per_cpu_ptr (&softnet_data, cpu); + +napi_threaded_poll_loop (&sd->backlog); +} + +static void backlog_napi_setup (unsigned int cpu) +{ +struct softnet_data *sd =per_cpu_ptr (&softnet_data, cpu); +struct napi_struct *napi = &sd->backlog; + + napi->thread =this_cpu_read (backlog_napi); +set_bit (NAPI_STATE_THREADED , &napi->state); +} + +static struct smp_hotplug_thread backlog_threads = { + .store = &backlog_napi, + .thread_should_run = backlog_napi_should_run, + .thread_fn = run_backlog_napi, + .thread_comm ="backlog_napi/%u" , + .setup = backlog_napi_setup, +}; +/* * This is called single threaded during boot, so no need * to take the rtnl semaphore.
@@ -11672,7 +11747,10 @@ static int __init net_dev_init(void)init_gro_hash (&sd->backlog); sd->backlog.poll = process_backlog; sd->backlog.weight = weight_p; +INIT_LIST_HEAD (&sd->backlog.poll_list); } +if (use_backlog_threads ()) +smpboot_register_percpu_thread (&backlog_threads); dev_boot_phase =0 ;
Greg Kroah-Hartman
maintainerPATCH 714/737 RDMA/rxe: Remove the direct link to net_device
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhu Yanjun <[email protected]>
[ Upstream commit 2ac5415022d16d63d912a39a06f32f1f51140261 ]
The similar patch in siw is in the link:
https://git.kernel.org/rdma/rdma/c/16b87037b48889
This problem also occurred in RXE. The following analyze this problem. In the following Call Traces:
"
BUG: KASAN: slab-use-after-free in dev_get_flags+0x188/0x1d0 net/core/dev.c:8782 Read of size 4 at addr ffff8880554640b0 by task kworker/1:4/5295 CPU: 1 UID: 0 PID: 5295 Comm: kworker/1:4 Not tainted 6.12.0-rc3-syzkaller-00399-g9197b73fd7bb #0 Hardware name: Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Workqueue: infiniband ib_cache_event_task Call Trace: <TASK> __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:377 [inline] print_report+0x169/0x550 mm/kasan/report.c:488 kasan_report+0x143/0x180 mm/kasan/report.c:601 dev_get_flags+0x188/0x1d0 net/core/dev.c:8782 rxe_query_port+0x12d/0x260 drivers/infiniband/sw/rxe/rxe_verbs.c:60 __ib_query_port drivers/infiniband/core/device.c:2111 [inline] ib_query_port+0x168/0x7d0 drivers/infiniband/core/device.c:2143 ib_cache_update+0x1a9/0xb80 drivers/infiniband/core/cache.c:1494 ib_cache_event_task+0xf3/0x1e0 drivers/infiniband/core/cache.c:1568 process_one_work kernel/workqueue.c:3229 [inline] process_scheduled_works+0xa65/0x1850 kernel/workqueue.c:3310 worker_thread+0x870/0xd30 kernel/workqueue.c:3391 kthread+0x2f2/0x390 kernel/kthread.c:389 ret_from_fork+0x4d/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 </TASK>
"
1). In the link [1],
"
infiniband syz2: set down
"
This means that on 839.350575, the event ib_cache_event_task was sent andi queued in ib_wq.
2). In the link [1],
"
team0 (unregistering): Port device team_slave_0 removed
"
It indicates that before 843.251853, the net device should be freed.
3). In the link [1],
"
BUG: KASAN: slab-use-after-free in dev_get_flags+0x188/0x1d0
"
This means that on 850.559070, this slab-use-after-free problem occurred.
In all, on 839.350575, the event ib_cache_event_task was sent and queued in ib_wq,
before 843.251853, the net device veth was freed.
on 850.559070, this event was executed, and the mentioned freed net device was called. Thus, the above call trace occurred.
[1] https://syzkaller.appspot.com/x/log.txt?x=12e7025f980000
[Shivani: - exported ib_device_get_netdev() function.
- added ib_device_get_netdev() to ib_verbs.h.]
--- drivers/infiniband/core/device.c | 1 + drivers/infiniband/sw/rxe/rxe.c | 23 +++++++++++++++++++---- drivers/infiniband/sw/rxe/rxe.h | 3 ++- drivers/infiniband/sw/rxe/rxe_mcast.c | 22 ++++++++++++++++++++-- drivers/infiniband/sw/rxe/rxe_net.c | 25 ++++++++++++++++++++----- drivers/infiniband/sw/rxe/rxe_verbs.c | 26 +++++++++++++++++++++----- drivers/infiniband/sw/rxe/rxe_verbs.h | 11 ++++++++--- include/rdma/ib_verbs.h | 2 ++ 8 files changed, 93 insertions(+), 20 deletions(-)
drivers/infiniband/core/device.c +1 -0
@@ -2259,6 +2259,7 @@ struct net_device *ib_device_get_netdev(return res; } +EXPORT_SYMBOL (ib_device_get_netdev);/** * ib_device_get_by_netdev - Find an IB device associated with a netdev
drivers/infiniband/sw/rxe/rxe.c +19 -4
@@ -40,6 +40,8 @@ void rxe_dealloc(struct ib_device *ib_de/* initialize rxe device parameters */ static void rxe_init_device_param (struct rxe_dev *rxe) { +struct net_device *ndev; + rxe->max_inline_data =RXE_MAX_INLINE_DATA ; rxe->attr.vendor_id =RXE_VENDOR_ID ;
@@ -71,8 +73,15 @@ static void rxe_init_device_param(struct rxe->attr.max_fast_reg_page_list_len =RXE_MAX_FMR_PAGE_LIST_LEN ; rxe->attr.max_pkeys =RXE_MAX_PKEYS ; rxe->attr.local_ca_ack_delay =RXE_LOCAL_CA_ACK_DELAY ; + + ndev =rxe_ib_device_get_netdev (&rxe->ib_dev); +if (!ndev) +return ; +addrconf_addr_eui48 ((unsigned char *)&rxe->attr.sys_image_guid, - rxe->ndev->dev_addr); + ndev->dev_addr); + +dev_put (ndev); rxe->max_ucontext =RXE_MAX_UCONTEXT ; }
@@ -109,10 +118,15 @@ static void rxe_init_port_param(struct rstatic void rxe_init_ports (struct rxe_dev *rxe) {struct rxe_port *port = &rxe->port; +struct net_device *ndev;rxe_init_port_param (port); + ndev =rxe_ib_device_get_netdev (&rxe->ib_dev); +if (!ndev) +return ;addrconf_addr_eui48 ((unsigned char *)&port->port_guid, - rxe->ndev->dev_addr); + ndev->dev_addr); +dev_put (ndev);spin_lock_init (&port->port_lock); }
@@ -169,12 +183,13 @@ void rxe_set_mtu(struct rxe_dev *rxe, un/* called by ifc layer to create new rxe device. * The caller should allocate memory for rxe by calling ib_alloc_device. */ -int rxe_add (struct rxe_dev *rxe,unsigned int mtu,const char *ibdev_name) +int rxe_add (struct rxe_dev *rxe,unsigned int mtu,const char *ibdev_name, +struct net_device *ndev) {rxe_init (rxe);rxe_set_mtu (rxe, mtu); -return rxe_register_device (rxe, ibdev_name); +return rxe_register_device (rxe, ibdev_name, ndev); }static int rxe_newlink (const char *ibdev_name,struct net_device *ndev)
drivers/infiniband/sw/rxe/rxe.h +2 -1
@@ -139,7 +139,8 @@ enum resp_states {void rxe_set_mtu (struct rxe_dev *rxe,unsigned int dev_mtu); -int rxe_add (struct rxe_dev *rxe,unsigned int mtu,const char *ibdev_name); +int rxe_add (struct rxe_dev *rxe,unsigned int mtu,const char *ibdev_name, +struct net_device *ndev);void rxe_rcv (struct sk_buff *skb);
drivers/infiniband/sw/rxe/rxe_mcast.c +20 -2
@@ -31,10 +31,19 @@static int rxe_mcast_add (struct rxe_dev *rxe,union ib_gid *mgid) {unsigned char ll_addr[ETH_ALEN ]; +struct net_device *ndev; +int ret; + + ndev =rxe_ib_device_get_netdev (&rxe->ib_dev); +if (!ndev) +return -ENODEV ;ipv6_eth_mc_map ((struct in6_addr *)mgid->raw, ll_addr); -return dev_mc_add (rxe->ndev, ll_addr); + ret =dev_mc_add (ndev, ll_addr); +dev_put (ndev); + +return ret; }/**
@@ -47,10 +56,19 @@ static int rxe_mcast_add(struct rxe_devstatic int rxe_mcast_del (struct rxe_dev *rxe,union ib_gid *mgid) {unsigned char ll_addr[ETH_ALEN ]; +struct net_device *ndev; +int ret; + + ndev =rxe_ib_device_get_netdev (&rxe->ib_dev); +if (!ndev) +return -ENODEV ;ipv6_eth_mc_map ((struct in6_addr *)mgid->raw, ll_addr); -return dev_mc_del (rxe->ndev, ll_addr); + ret =dev_mc_del (ndev, ll_addr); +dev_put (ndev); + +return ret; }/**
drivers/infiniband/sw/rxe/rxe_net.c +20 -5
@@ -509,7 +509,16 @@ out:*/ const char *rxe_parent_name (struct rxe_dev *rxe,unsigned int port_num) { -return rxe->ndev->name; +struct net_device *ndev; +char *ndev_name; + + ndev =rxe_ib_device_get_netdev (&rxe->ib_dev); +if (!ndev) +return NULL ; + ndev_name = ndev->name; +dev_put (ndev); + +return ndev_name; }int rxe_net_add (const char *ibdev_name,struct net_device *ndev)
@@ -521,9 +530,7 @@ int rxe_net_add(const char *ibdev_name,if (!rxe)return -ENOMEM ; - rxe->ndev = ndev; - - err =rxe_add (rxe, ndev->mtu, ibdev_name); + err =rxe_add (rxe, ndev->mtu, ibdev_name, ndev);if (err) {ib_dealloc_device (&rxe->ib_dev);return err;
@@ -571,10 +578,18 @@ void rxe_port_down(struct rxe_dev *rxe)void rxe_set_port_state (struct rxe_dev *rxe) { -if (netif_running (rxe->ndev) &&netif_carrier_ok (rxe->ndev)) +struct net_device *ndev; + + ndev =rxe_ib_device_get_netdev (&rxe->ib_dev); +if (!ndev) +return ; + +if (netif_running (ndev) &&netif_carrier_ok (ndev))rxe_port_up (rxe);else rxe_port_down (rxe); + +dev_put (ndev); } static int rxe_notify(struct notifier_block *not_blk,
drivers/infiniband/sw/rxe/rxe_verbs.c +21 -5
@@ -41,6 +41,7 @@ static int rxe_query_port(struct ib_devi u32 port_num, struct ib_port_attr *attr) { struct rxe_dev *rxe = to_rdev(ibdev); +struct net_device *ndev;int err, ret;if (port_num !=1 ) {
@@ -51,19 +52,26 @@ static int rxe_query_port(struct ib_devimemcpy (attr, &rxe->port.attr,sizeof (*attr)); + ndev =rxe_ib_device_get_netdev (ibdev); +if (!ndev) { + err = -ENODEV ; + goto err_out; + } +mutex_lock (&rxe->usdev_lock); ret =ib_get_eth_speed (ibdev, port_num, &attr->active_speed, &attr->active_width);if (attr->state ==IB_PORT_ACTIVE ) attr->phys_state =IB_PORT_PHYS_STATE_LINK_UP ; -else if (dev_get_flags (rxe->ndev) &IFF_UP ) +else if (dev_get_flags (ndev) &IFF_UP ) attr->phys_state =IB_PORT_PHYS_STATE_POLLING ;else attr->phys_state =IB_PORT_PHYS_STATE_DISABLED ;mutex_unlock (&rxe->usdev_lock); +dev_put (ndev);return ret; err_out:
@@ -1428,9 +1436,16 @@ static const struct attribute_group rxe_static int rxe_enable_driver (struct ib_device *ib_dev) { struct rxe_dev *rxe = container_of(ib_dev, struct rxe_dev, ib_dev); +struct net_device *ndev; + + ndev =rxe_ib_device_get_netdev (ib_dev); +if (!ndev) +return -ENODEV ;rxe_set_port_state (rxe); -dev_info (&rxe->ib_dev.dev,"added %s\n" ,netdev_name (rxe->ndev)); +dev_info (&rxe->ib_dev.dev,"added %s\n" ,netdev_name (ndev)); + +dev_put (ndev);return 0 ; }
@@ -1498,7 +1513,8 @@ static const struct ib_device_ops rxe_de INIT_RDMA_OBJ_SIZE(ib_mw, rxe_mw, ibmw), }; -int rxe_register_device (struct rxe_dev *rxe,const char *ibdev_name) +int rxe_register_device (struct rxe_dev *rxe,const char *ibdev_name, +struct net_device *ndev) {int err;struct ib_device *dev = &rxe->ib_dev;
@@ -1510,13 +1526,13 @@ int rxe_register_device(struct rxe_dev * dev->num_comp_vectors =num_possible_cpus (); dev->local_dma_lkey =0 ;addrconf_addr_eui48 ((unsigned char *)&dev->node_guid, - rxe->ndev->dev_addr); + ndev->dev_addr); dev->uverbs_cmd_mask |=BIT_ULL (IB_USER_VERBS_CMD_POST_SEND ) |BIT_ULL (IB_USER_VERBS_CMD_REQ_NOTIFY_CQ );ib_set_device_ops (dev, &rxe_dev_ops); - err =ib_device_set_netdev (&rxe->ib_dev, rxe->ndev,1 ); + err =ib_device_set_netdev (&rxe->ib_dev, ndev,1 );if (err)return err;
drivers/infiniband/sw/rxe/rxe_verbs.h +8 -3
@@ -369,6 +369,7 @@ struct rxe_port {u32 qp_gsi_index; }; +#define RXE_PORT 1struct rxe_dev {struct ib_device ib_dev;struct ib_device_attr attr;
@@ -376,8 +377,6 @@ struct rxe_dev {int max_inline_data;struct mutex usdev_lock; -struct net_device *ndev; -struct rxe_pool uc_pool;struct rxe_pool pd_pool;struct rxe_pool ah_pool;
@@ -405,6 +404,11 @@ struct rxe_dev {struct crypto_shash *tfm; }; +static inline struct net_device *rxe_ib_device_get_netdev (struct ib_device *dev) +{ +return ib_device_get_netdev (dev,RXE_PORT ); +} +static inline void rxe_counter_inc (struct rxe_dev *rxe,enum rxe_counters index) {atomic64_inc (&rxe->stats_counters[index]);
@@ -470,6 +474,7 @@ static inline struct rxe_pd *rxe_mw_pd(s return to_rpd(mw->ibmw.pd); } -int rxe_register_device (struct rxe_dev *rxe,const char *ibdev_name); +int rxe_register_device (struct rxe_dev *rxe,const char *ibdev_name, +struct net_device *ndev);#endif /* RXE_VERBS_H */
include/rdma/ib_verbs.h +2 -0
@@ -4444,6 +4444,8 @@ struct net_device *ib_get_net_dev_by_par const struct sockaddr *addr);int ib_device_set_netdev (struct ib_device *ib_dev,struct net_device *ndev,unsigned int port); +struct net_device *ib_device_get_netdev (struct ib_device *ib_dev, +u32 port);struct ib_wq *ib_create_wq (struct ib_pd *pd,struct ib_wq_init_attr *init_attr);int ib_destroy_wq_user (struct ib_wq *wq,struct ib_udata *udata);
Greg Kroah-Hartman
maintainerPATCH 705/737 KVM: SVM: Fix redundant updates of LBR MSR intercepts
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yosry Ahmed <[email protected]>
commit 3fa05f96fc08dff5e846c2cc283a249c1bf029a1 upstream.
Don't update the LBR MSR intercept bitmaps if they're already up-to-date, as unconditionally updating the intercepts forces KVM to recalculate the MSR bitmaps for vmcb02 on every nested VMRUN. The redundant updates are functionally okay; however, they neuter an optimization in Hyper-V nested virtualization enlightenments and this manifests as a self-test failure.
In particular, Hyper-V lets L1 mark "nested enlightenments" as clean, i.e. tell KVM that no changes were made to the MSR bitmap since the last VMRUN. The hyperv_svm_test KVM selftest intentionally changes the MSR bitmap "without telling KVM about it" to verify that KVM honors the clean hint, correctly fails because KVM notices the changed bitmap anyway:
==== Test Assertion Failure ==== x86/hyperv_svm_test.c:120: vmcb->control.exit_code == 0x081 pid=193558 tid=193558 errno=4 - Interrupted system call
1 0x0000000000411361: assert_on_unhandled_exception at processor.c:659
2 0x0000000000406186: _vcpu_run at kvm_util.c:1699
3 (inlined by) vcpu_run at kvm_util.c:1710
4 0x0000000000401f2a: main at hyperv_svm_test.c:175
5 0x000000000041d0d3: __libc_start_call_main at libc-start.o:?
6 0x000000000041f27c: __libc_start_main_impl at ??:?
7 0x00000000004021a0: _start at ??:? vmcb->control.exit_code == SVM_EXIT_VMMCALL
Do *not* fix this by skipping svm_hv_vmcb_dirty_nested_enlightenments() when svm_set_intercept_for_msr() performs a no-op change. changes to the L0 MSR interception bitmap are only triggered by full CPUID updates and MSR filter updates, both of which should be rare. Changing svm_set_intercept_for_msr() risks hiding unintended pessimizations like this one, and is actually more complex than this change.
--- arch/x86/kvm/svm/svm.c | 6 ++++++ arch/x86/kvm/svm/svm.h | 1 + 2 files changed, 7 insertions(+)
arch/x86/kvm/svm/svm.c +6 -0
@@ -1017,6 +1017,9 @@ static void svm_recalc_lbr_msr_interceptstruct vcpu_svm *svm =to_svm (vcpu);bool intercept = !(svm->vmcb->control.virt_ext &LBR_CTL_ENABLE_MASK ); +if (intercept == svm->lbr_msrs_intercepted) +return ; +set_msr_interception (vcpu, svm->msrpm,MSR_IA32_LASTBRANCHFROMIP , !intercept, !intercept); set_msr_interception(vcpu, svm->msrpm, MSR_IA32_LASTBRANCHTOIP,
@@ -1029,6 +1032,8 @@ static void svm_recalc_lbr_msr_interceptif (sev_es_guest (vcpu->kvm))set_msr_interception (vcpu, svm->msrpm,MSR_IA32_DEBUGCTLMSR , !intercept, !intercept); + + svm->lbr_msrs_intercepted = intercept; }static void __svm_enable_lbrv (struct kvm_vcpu *vcpu)
@@ -1473,6 +1478,7 @@ static int svm_vcpu_create(struct kvm_vc } svm->x2avic_msrs_intercepted = true; + svm->lbr_msrs_intercepted = true; svm->vmcb01.ptr =page_address (vmcb01_page); svm->vmcb01.pa =__sme_set (page_to_pfn (vmcb01_page) <<PAGE_SHIFT );
arch/x86/kvm/svm/svm.h +1 -0
@@ -288,6 +288,7 @@ struct vcpu_svm {bool guest_state_loaded;bool x2avic_msrs_intercepted; +bool lbr_msrs_intercepted;/* Guest GIF value, used when vGIF is not enabled */ bool guest_gif;
Re: [PATCH 6.6 731/737] ext4: filesystems without casefold feature cannot be mounted with siphash
In reply to Greg Kroah-HartmanHi, Greg.
The followup to 985b67cd86392310d9e9326de941c22fc9340eec, that I submitted in the same thread, has not been picked up.
[email protected]
https://lore.kernel.org/stable/[email protected]/a2187431c395 ("ext4: fix error message when rejecting the default hash")
You picked it up for 6.1 and 5.15 though.
Regards.
Cascardo.
Quoted 41 lines · Greg Kroah-Hartman
6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lizhi Xu <[email protected]>
commit
985b67cd86392310d9e9326de941c22fc9340eecupstream.When mounting the ext4 filesystem, if the default hash version is set to
DX_HASH_SIPHASHbut the casefold feature is not set, exit the mounting.Reported-by [email protected]Signed-off-by Lizhi Xu <[email protected]>Signed-off-by Theodore Ts'o <[email protected]>[cascardo: small conflict fixup]Signed-off-by Thadeu Lima de Souza Cascardo <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- fs/ext4/super.c | 8 ++++++++ 1 file changed, 8 insertions(+)fs/ext4/super.c +8
-0@@ -3632,6 +3632,14 @@ int ext4_feature_set_ok(struct super_blo }#endif +if (EXT4_SB (sb)->s_es->s_def_hash_version ==DX_HASH_SIPHASH && + !ext4_has_feature_casefold (sb)) { +ext4_msg (sb,KERN_ERR , +"Filesystem without casefold feature cannot be " +"mounted with siphash" ); +return 0 ; + } +if (readonly)return 1 ;
# Librecast Test Results
020/020 [ OK ] liblcrq
010/010 [ OK ] libmld
120/120 [ OK ] liblibrecast
CPU/kernel: Linux auntie 6.6.120-rc1-g00f48cae9e13 #1 SMP PREEMPT_DYNAMIC Fri Jan 9 18:23:00 -00 2026 x86_64 AMD Ryzen 9 9950X 16-Core Processor AuthenticAMD GNU/Linux
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.6.120 release. There are 737 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 Sun, 11 Jan 2026 11:19:41 +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/v6.x/stable-review/patch-6.6.120-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.6.y
and the diffstat can be found below.thanks,
greg k-h
On ARCH_BRCMSTB using 32-bit and 64-bit ARM kernels, build tested on BMIPS_GENERIC:
Signature · 1 line
Florian
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.6.120 release. There are 737 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 Sun, 11 Jan 2026 11:19:41 +0000. Anything received after that time might be too late.
6.6.120-rc1 built and run on my x86_64 test system (AMD Ryzen 9 9900X, System76 thelio-mira-r4-n3). No errors or regressions.
Thanks,
Slade
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.6.120 release. There are 737 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 Sun, 11 Jan 2026 11:19:41 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.6.120-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.6.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Am 09.01.2026 um 12:32 schrieb Greg Kroah-Hartman:
Quoted 4 lines
This is the start of the stable review cycle for the 6.6.120 release. There are 737 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.
Builds, boots and works on my 2-socket Ivy Bridge Xeon E5-2697 v2 server. No dmesg oddities or regressions found.
Beste Grüße,
Peter Schneider
Signature · 8 lines
Climb the mountain not to plant your flag, but to embrace the challenge, enjoy the air and behold the view. Climb it so you can see the world, not so the world can see you. -- David McCullough Jr. OpenPGP: 0xA3828BD796CCE11A8CADE8866E3A92C92C3FF244 Download: https://www.peters-netzplatz.de/download/pschneider1968_pub.asc https://keys.mailvelope.com/pks/lookup?op=get&[email protected] https://keys.mailvelope.com/pks/lookup?op=get&[email protected]
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.6.120 release. There are 737 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 Sun, 11 Jan 2026 11:19:41 +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/v6.x/stable-review/patch-6.6.120-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.6.y
and the diffstat can be found below.thanks,
greg k-h
Built and booted successfully on RISC-V RV64 (HiFive Unmatched).
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.6.120 release. There are 737 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.
Compiled and tested on
- Verdin iMX8MM
- Colibri iMX6
- Apalis iMX6
- Colibri iMX6ULL
- Colibri iMX7
hello
Compiled and booted 6.6.120-rc1+
No typical new regressions from dmesg.
As per dmidecode command.
Version: AMD Ryzen 3 3250U with Radeon Graphics
Processor Information
Socket Designation: FP5
Type: Central Processor
Family: Zen
Manufacturer: Advanced Micro Devices, Inc.
ID: 81 0F 81 00 FF FB 8B 17
Signature: Family 23, Model 24, Stepping 1
--
software engineer
rajagiri school of engineering and technology
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.6.120 release. There are 737 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 Sun, 11 Jan 2026 11:19:41 +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/v6.x/stable-review/patch-6.6.120-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.6.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v6.6:
10 builds: 10 pass, 0 fail
28 boots: 28 pass, 0 fail
120 tests: 120 pass, 0 failLinux version: 6.6.120-rc1-g00f48cae9e13
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra186-p3509-0000+p3636-0001, tegra194-p2972-0000,
tegra194-p3509-0000+p3668-0000, tegra20-ventana,
tegra210-p2371-2180, tegra210-p3450-0000,
tegra30-cardhu-a04Jon
Greg Kroah-Hartman
maintainerRe: [PATCH 6.6 731/737] ext4: filesystems without casefold feature cannot be mounted with siphash
In reply to Thadeu Lima de Souza CascardoQuoted 10 lines · Thadeu Lima de Souza Cascardo
Hi, Greg.
The followup to
985b67cd86392310d9e9326de941c22fc9340eec, that I submitted in the same thread, has not been picked up.[email protected]
https://lore.kernel.org/stable/[email protected]/a2187431c395("ext4: fix error message when rejecting the default hash")You picked it up for 6.1 and 5.15 though.
It's in the queue, odd you didn't get an email.
thanks,
greg k-h
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.6.120 release. There are 737 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.
Quoted 8 lines · On Fri, 09 Jan 2026 12:32:19 +0100 Greg Kroah-Hartman…
This is the start of the stable review cycle for the 6.6.120 release. There are 737 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 Sun, 11 Jan 2026 11:19:41 +0000. Anything received after that time might be too late.
Boot-tested under QEMU for Rust x86_64:
Thanks!
Cheers,
Miguel
Re: [PATCH 6.6 731/737] ext4: filesystems without casefold feature cannot be mounted with siphash
In reply to Greg Kroah-HartmanQuoted 10 lines · Greg Kroah-Hartman
Quoted 9 lines · Thadeu Lima de Souza Cascardo
Hi, Greg.
The followup to
985b67cd86392310d9e9326de941c22fc9340eec, that I submitted in the same thread, has not been picked up.[email protected]
https://lore.kernel.org/stable/[email protected]/a2187431c395("ext4: fix error message when rejecting the default hash")
Quoted 7 lines
Quoted 1 line
You picked it up for 6.1 and 5.15 though.
It's in the queue, odd you didn't get an email.
thanks,
greg k-h
Ah, I see it now, when looking for the upstream hash and not my sign-off. It was a different backport that ommitted the original fix and only applied the fixup/followup.
The original fix adds a hunk that is then removed by the followup. So when applying the followup that ignores that hunk and then the original fix with that hunk, 6.6 queue now is carrying an undesired hunk message.
If you drop a032fc761cc3f1112c42732d9a2482f23acad5fc and apply
https://lore.kernel.org/stable/[email protected]/
instead, it should be in the expected final state. I would rather do that, as then 6.6.y would be carrying the original fix, avoiding it to be backported again.
Cascardo.
Greg Kroah-Hartman
maintainerRe: [PATCH 6.6 731/737] ext4: filesystems without casefold feature cannot be mounted with siphash
Quoted 27 lines · Thadeu Lima de Souza Cascardo
Quoted 10 lines · Greg Kroah-Hartman
Quoted 9 lines · Thadeu Lima de Souza Cascardo
Hi, Greg.
The followup to
985b67cd86392310d9e9326de941c22fc9340eec, that I submitted in the same thread, has not been picked up.[email protected]
https://lore.kernel.org/stable/[email protected]/a2187431c395("ext4: fix error message when rejecting the default hash")Quoted 7 lines
Quoted 1 line
You picked it up for 6.1 and 5.15 though.
It's in the queue, odd you didn't get an email.
thanks,
greg k-h
Ah, I see it now, when looking for the upstream hash and not my sign-off. It was a different backport that ommitted the original fix and only applied the fixup/followup.
The original fix adds a hunk that is then removed by the followup. So when applying the followup that ignores that hunk and then the original fix with that hunk, 6.6 queue now is carrying an undesired hunk message.
Quoted 5 lines
If you drop
a032fc761cc3f1112c42732d9a2482f23acad5fcand apply
https://lore.kernel.org/stable/[email protected]/
instead, it should be in the expected final state. I would rather do that, as then 6.6.y would be carrying the original fix, avoiding it to be backported again.
Ok, thanks, now done!
greg k-h
PATCH 1/1 cpuset: Treat cpusets in attaching as populated
In reply to Greg Kroah-HartmanFrom: Greg Kroah-Hartman <[email protected]>
6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Ridong <[email protected]>
[ Upstream commit b1bcaed1e39a9e0dfbe324a15d2ca4253deda316 ]
Currently, the check for whether a partition is populated does not account for tasks in the cpuset of attaching. This is a corner case that can leave a task stuck in a partition with no effective CPUs.
The race condition occurs as follows:
cpu0 cpu1
//cpuset A with cpu N
migrate task p to Acpuset_can_attach
// with effective cpus
// check ok
// cpuset_mutex is not held // clear cpuset.cpus.exclusive
// making effective cpus empty update_exclusive_cpumask // tasks_nocpu_error check ok // empty effective cpus, partition valid
cpuset_attach
...
// task p stays in A, with non-effective cpus.
To fix this issue, this patch introduces cs_is_populated, which considers tasks in the attaching cpuset. This new helper is used in validate_change and partition_is_populated.
--- kernel/cgroup/cpuset.c | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-)
kernel/cgroup/cpuset.c +28 -9
@@ -453,6 +453,15 @@ static inline bool is_in_v2_mode(void) (cpuset_cgrp_subsys.root->flags &CGRP_ROOT_CPUSET_V2_MODE ); } +static inline bool cpuset_is_populated (struct cpuset *cs) +{ +lockdep_assert_held (&cpuset_mutex); + +/* Cpusets in the process of attaching should be considered as populated */ +return cgroup_is_populated (cs->css.cgroup) || + cs->attach_in_progress; +} +/** * partition_is_populated - check if partition has tasks * @cs: partition root to be checked
@@ -465,21 +474,31 @@ static inline bool is_in_v2_mode(void)static inline bool partition_is_populated (struct cpuset *cs,struct cpuset *excluded_child) { -struct cgroup_subsys_state *css; -struct cpuset *child; +struct cpuset *cp; +struct cgroup_subsys_state *pos_css; -if (cs->css.cgroup->nr_populated_csets) +/* +* We cannot call cs_is_populated(cs) directly, as +* nr_populated_domain_children may include populated +* csets from descendants that are partitions. +*/ +if (cs->css.cgroup->nr_populated_csets || + cs->attach_in_progress)return true;if (!excluded_child && !cs->nr_subparts_cpus) -return cgroup_is_populated (cs->css.cgroup); +return cpuset_is_populated (cs);rcu_read_lock (); -cpuset_for_each_child (child, css, cs) { -if (child == excluded_child) +cpuset_for_each_descendant_pre (cp, pos_css, cs) { +if (cp == cs || cp == excluded_child)continue ; -if (is_partition_valid (child)) + +if (is_partition_valid (cp)) { + pos_css =css_rightmost_descendant (pos_css);continue ; -if (cgroup_is_populated (child->css.cgroup)) { + } + +if (cpuset_is_populated (cp)) {rcu_read_unlock ();return true; }
@@ -751,7 +770,7 @@ static int validate_change(struct cpuset *cur, struct cpuset *trial)* be changed to have empty cpus_allowed or mems_allowed. */ ret = -ENOSPC ; -if ((cgroup_is_populated (cur->css.cgroup) || cur->attach_in_progress)) { +if (cpuset_is_populated (cur)) {if (!cpumask_empty (cur->cpus_allowed) &&cpumask_empty (trial->cpus_allowed)) goto out;
Signature · 1 line
2.34.1
Re: [PATCH] cpuset: Treat cpusets in attaching as populated
Quoted 77 lines · Chen Ridong
From: Greg Kroah-Hartman <[email protected]>
6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Ridong <[email protected]>
[ Upstream commit
b1bcaed1e39a9e0dfbe324a15d2ca4253deda316]Currently, the check for whether a partition is populated does not account for tasks in the cpuset of attaching. This is a corner case that can leave a task stuck in a partition with no effective CPUs.
The race condition occurs as follows:
cpu0 cpu1
//cpuset A with cpu Nmigrate task p to A
cpuset_can_attach
// with effective cpus
// check ok//
cpuset_mutexis not held // clear cpuset.cpus.exclusive// making effective cpus empty update_exclusive_cpumask // tasks_nocpu_error check ok // empty effective cpus, partition valid
cpuset_attach
...
// task p stays in A, with non-effective cpus.To fix this issue, this patch introduces
cs_is_populated, which considers tasks in the attaching cpuset. This new helper is used invalidate_changeandpartition_is_populated.Fixes e2d59900d936 ("cgroup/cpuset: Allow no-task partition to have empty cpuset.cpus.effective")Signed-off-by Chen Ridong <[email protected]>Reviewed-by Waiman Long <[email protected]>Signed-off-by Tejun Heo <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- kernel/cgroup/cpuset.c | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-)kernel/cgroup/cpuset.c +13
-3@@ -453,6 +453,15 @@ static inline bool is_in_v2_mode(void) (cpuset_cgrp_subsys.root->flags &CGRP_ROOT_CPUSET_V2_MODE ); } +static inline bool cpuset_is_populated (struct cpuset *cs) +{ +lockdep_assert_held (&cpuset_mutex); + +/* Cpusets in the process of attaching should be considered as populated */ +return cgroup_is_populated (cs->css.cgroup) || + cs->attach_in_progress; +} +/** * partition_is_populated - check if partition has tasks * @cs: partition root to be checked @@ -465,21 +474,31 @@ static inline bool is_in_v2_mode(void)static inline bool partition_is_populated (struct cpuset *cs,struct cpuset *excluded_child) { -struct cgroup_subsys_state *css; -struct cpuset *child; +struct cpuset *cp; +struct cgroup_subsys_state *pos_css; -if (cs->css.cgroup->nr_populated_csets) +/* +* We cannot call cs_is_populated(cs) directly, as
kernel/cgroup/cpuset.c static inline bool is_in_v2_mode(void) · line 490
Quoted 10 lines
kernel/cgroup/cpuset.c +6
-1+* nr_populated_domain_children may include populated +* csets from descendants that are partitions. +*/ +if (cs->css.cgroup->nr_populated_csets || + cs->attach_in_progress)return true;if (!excluded_child && !cs->nr_subparts_cpus) -return cgroup_is_populated (cs->css.cgroup); +return cpuset_is_populated (cs);
We should adjust this part to use cpuset_is_populated instead of cgroup_is_populated.
Thanks.
Quoted 27 lines
kernel/cgroup/cpuset.c +9
-5rcu_read_lock (); -cpuset_for_each_child (child, css, cs) { -if (child == excluded_child) +cpuset_for_each_descendant_pre (cp, pos_css, cs) { +if (cp == cs || cp == excluded_child)continue ; -if (is_partition_valid (child)) + +if (is_partition_valid (cp)) { + pos_css =css_rightmost_descendant (pos_css);continue ; -if (cgroup_is_populated (child->css.cgroup)) { + } + +if (cpuset_is_populated (cp)) {rcu_read_unlock ();return true; }@@ -751,7 +770,7 @@ static int validate_change(struct cpuset *cur, struct cpuset *trial)* be changed to have empty cpus_allowed or mems_allowed. */ ret = -ENOSPC ; -if ((cgroup_is_populated (cur->css.cgroup) || cur->attach_in_progress)) { +if (cpuset_is_populated (cur)) {if (!cpumask_empty (cur->cpus_allowed) &&cpumask_empty (trial->cpus_allowed)) goto out;
Signature · 2 lines
Best regards, Ridong
Greg KH
maintainerRe: [PATCH] cpuset: Treat cpusets in attaching as populated
In reply to Chen RidongQuoted 1 line · Chen Ridong
From: Greg Kroah-Hartman <[email protected]>
I did not send this :(
Quoted 1 line
6.6-stable review patch. If anyone has any objections, please let me know.
This is already in the 6.6.120 release.
thanks,
greg k-h
Re: [PATCH] cpuset: Treat cpusets in attaching as populated
Quoted 5 lines · Greg KH
Quoted 1 line · Chen Ridong
From: Greg Kroah-Hartman <[email protected]>
I did not send this :(
Quoted 7 lines
Quoted 1 line
6.6-stable review patch. If anyone has any objections, please let me know.
This is already in the 6.6.120 release.
thanks,
greg k-h
I am sorry for the confusion.
I downloaded and modified the patch, and replied.
My point is that the patch intended for the 6.6.120 release should include an adaptation. Specifically, the following block:
[...]
if (!excluded_child && !cs->nr_subparts_cpus)
return cgroup_is_populated(cs->css.cgroup);
[...]
Should be corrected to:
if (!excluded_child && !cs->nr_subparts_cpus)
- return cgroup_is_populated(cs->css.cgroup);
+ return cpuset_is_populated(cs);
Signature · 2 lines
Best regards, Ridong
Greg KH
maintainerRe: [PATCH] cpuset: Treat cpusets in attaching as populated
Quoted 31 lines · Chen Ridong
Quoted 5 lines · Greg KH
Quoted 1 line · Chen Ridong
From: Greg Kroah-Hartman <[email protected]>
I did not send this :(
Quoted 7 lines
Quoted 1 line
6.6-stable review patch. If anyone has any objections, please let me know.
This is already in the 6.6.120 release.
thanks,
greg k-h
I am sorry for the confusion.
I downloaded and modified the patch, and replied.
My point is that the patch intended for the 6.6.120 release should include an adaptation. Specifically, the following block:
[...]
(quoted diff) +0
-0if (!excluded_child && !cs->nr_subparts_cpus) return cgroup_is_populated(cs->css.cgroup);Should be corrected to:
kernel/cgroup/cpuset.c static inline bool is_in_v2_mode(void) · line 489
Quoted 3 lines
kernel/cgroup/cpuset.c +1
-1if (!excluded_child && !cs->nr_subparts_cpus) -return cgroup_is_populated (cs->css.cgroup); +return cpuset_is_populated (cs);
Great, can you send a fixup patch for this that we can apply to the next release?
thanks,
greg k-h
PATCH 1/1 cpuset: Fix missing adaptation for cpuset_is_populated
From: Chen Ridong <[email protected]>
Commit b1bcaed1e39a ("cpuset: Treat cpusets in attaching as populated") was backported to the long‑term support (LTS) branches. However, because commit d5cf4d34a333 ("cgroup/cpuset: Don't track # of local child partitions") was not backported, a corresponding adaptation to the backported code is still required.
To ensure correct behavior, replace cgroup_is_populated with cpuset_is_populated in the partition_is_populated function.
--- kernel/cgroup/cpuset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/cgroup/cpuset.c +1 -1
@@ -486,7 +486,7 @@ static inline bool partition_is_populated(struct cpuset *cs, cs->attach_in_progress)return true;if (!excluded_child && !cs->nr_subparts_cpus) -return cgroup_is_populated (cs->css.cgroup); +return cpuset_is_populated (cs);rcu_read_lock ();cpuset_for_each_descendant_pre (cp, pos_css, cs) {
Signature · 1 line
2.34.1
Re: [PATCH stable] cpuset: Fix missing adaptation for cpuset_is_populated
Quoted 23 lines · Chen Ridong
From: Chen Ridong <[email protected]>
Commit
b1bcaed1e39a("cpuset: Treat cpusets in attaching as populated") was backported to the long‑term support (LTS) branches. However, because commitd5cf4d34a333("cgroup/cpuset: Don't track # of local child partitions") was not backported, a corresponding adaptation to the backported code is still required.To ensure correct behavior, replace
cgroup_is_populatedwithcpuset_is_populatedin thepartition_is_populatedfunction.Cc [email protected] # 6.1+Fixes b1bcaed1e39a ("cpuset: Treat cpusets in attaching as populated")Signed-off-by Chen Ridong <[email protected]>--- kernel/cgroup/cpuset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/cgroup/cpuset.c +0
-0
kernel/cgroup/cpuset.c static inline bool partition_is_populated(struct cpuset *cs, · line 492
Quoted 8 lines
kernel/cgroup/cpuset.c +1
-1@@ -486,7 +486,7 @@ static inline bool partition_is_populated(struct cpuset *cs, cs->attach_in_progress)return true;if (!excluded_child && !cs->nr_subparts_cpus) -return cgroup_is_populated (cs->css.cgroup); +return cpuset_is_populated (cs);rcu_read_lock ();cpuset_for_each_descendant_pre (cp, pos_css, cs) {
Hi Greg,
Is this patch suitable for applying?
Note: Because the corresponding commit varies between LTS branches,, the Fixes tag points to a mainline commit.
Signature · 2 lines
Best regards, Ridong
Greg KH
maintainerRe: [PATCH stable] cpuset: Fix missing adaptation for cpuset_is_populated
Quoted 32 lines · Chen Ridong
Quoted 29 lines · Chen Ridong
From: Chen Ridong <[email protected]>
Commit
b1bcaed1e39a("cpuset: Treat cpusets in attaching as populated") was backported to the long‑term support (LTS) branches. However, because commitd5cf4d34a333("cgroup/cpuset: Don't track # of local child partitions") was not backported, a corresponding adaptation to the backported code is still required.To ensure correct behavior, replace
cgroup_is_populatedwithcpuset_is_populatedin thepartition_is_populatedfunction.Cc [email protected] # 6.1+Fixes b1bcaed1e39a ("cpuset: Treat cpusets in attaching as populated")Signed-off-by Chen Ridong <[email protected]>--- kernel/cgroup/cpuset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/cgroup/cpuset.c +1
-1@@ -486,7 +486,7 @@ static inline bool partition_is_populated(struct cpuset *cs, cs->attach_in_progress)return true;if (!excluded_child && !cs->nr_subparts_cpus) -return cgroup_is_populated (cs->css.cgroup); +return cpuset_is_populated (cs);
Quoted 6 lines
kernel/cgroup/cpuset.c static inline bool partition_is_populated(struct cpuset *cs, · line 492
Quoted 2 lines
kernel/cgroup/cpuset.c +0
-0rcu_read_lock ();cpuset_for_each_descendant_pre (cp, pos_css, cs) {Hi Greg,
Is this patch suitable for applying?
It needs approval from the maintainers of this file.
Quoted 2 lines
Note: Because the corresponding commit varies between LTS branches,, the Fixes tag points to a mainline commit.
As this is only for 6.1.y, why not point it at the commit there?
Or is this for other branches? If so, which ones? It might be best to provide a backport for all of the relevant ones so that we get it right.
thanks,
greg k-h
Re: [PATCH stable] cpuset: Fix missing adaptation for cpuset_is_populated
Quoted 33 lines · Greg KH
Quoted 32 lines · Chen Ridong
Quoted 29 lines · Chen Ridong
From: Chen Ridong <[email protected]>
Commit
b1bcaed1e39a("cpuset: Treat cpusets in attaching as populated") was backported to the long‑term support (LTS) branches. However, because commitd5cf4d34a333("cgroup/cpuset: Don't track # of local child partitions") was not backported, a corresponding adaptation to the backported code is still required.To ensure correct behavior, replace
cgroup_is_populatedwithcpuset_is_populatedin thepartition_is_populatedfunction.Cc [email protected] # 6.1+Fixes b1bcaed1e39a ("cpuset: Treat cpusets in attaching as populated")Signed-off-by Chen Ridong <[email protected]>--- kernel/cgroup/cpuset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/cgroup/cpuset.c +1
-1@@ -486,7 +486,7 @@ static inline bool partition_is_populated(struct cpuset *cs, cs->attach_in_progress)return true;if (!excluded_child && !cs->nr_subparts_cpus) -return cgroup_is_populated (cs->css.cgroup); +return cpuset_is_populated (cs);
Quoted 8 lines
Quoted 7 lines
kernel/cgroup/cpuset.c static inline bool partition_is_populated(struct cpuset *cs, · line 492
Quoted 2 lines
kernel/cgroup/cpuset.c +0
-0rcu_read_lock ();cpuset_for_each_descendant_pre (cp, pos_css, cs) {Hi Greg,
Is this patch suitable for applying?
It needs approval from the maintainers of this file.
Hi, Longman,
I appreciate you could have a review.
Quoted 5 lines
Quoted 2 lines
Note: Because the corresponding commit varies between LTS branches,, the Fixes tag points to a mainline commit.
As this is only for 6.1.y, why not point it at the commit there?
This fix (commit b1bcaed1e39a "cpuset: Treat cpusets in attaching as populated") was backported to the stable branches v6.1 and later. The latest LTS(v6.18) has this issue, so it should be v6.1+.
Quoted 6 lines
Or is this for other branches? If so, which ones? It might be best to provide a backport for all of the relevant ones so that we get it right.
thanks,
greg k-h
Signature · 2 lines
Best regards, Ridong
Re: [PATCH 6.6 176/737] perf arm-spe: Extend branch operations
In reply to Thadeu Lima de Souza CascardoHi,
It appears that this patch broke the build, see:
In file included from util/arm-spe-decoder/arm-spe-pkt-decoder.h:10,
from util/arm-spe-decoder/arm-spe-pkt-decoder.c:14:linux/tools/include/linux/bitfield.h: In function ‘le16_encode_bits’:linux/tools/include/linux/bitfield.h:166:38: error: implicit declaration of function ‘cpu_to_le16’ [-Wimplicit-function-declaration]
166 | ____MAKE_OP(le##size,u##size,cpu_to_le##size,le##size##_to_cpu) \
| ^~~~~~~~~linux/tools/include/linux/bitfield.h:149:16: note: in definition of macro ‘____MAKE_OP’
149 | return to((v & field_mask(field)) * field_multiplier(field)); \
| ^~linux/tools/include/linux/bitfield.h:170:1: note: in expansion of macro ‘__MAKE_OP’
170 | __MAKE_OP(16)
| ^~~~~~~~~
linux/tools/include/linux/bitfield.h: In function ‘le16_get_bits’:linux/tools/include/linux/bitfield.h:166:54: error: implicit declaration of function ‘le16_to_cpu’ [-Wimplicit-function-declaration]
166 | ____MAKE_OP(le##size,u##size,cpu_to_le##size,le##size##_to_cpu) \
| ^~linux/tools/include/linux/bitfield.h:163:17: note: in definition of macro ‘____MAKE_OP’
163 | return (from(v) & field)/field_multiplier(field); \
| ^~~~linux/tools/include/linux/bitfield.h:170:1: note: in expansion of macro ‘__MAKE_OP’
170 | __MAKE_OP(16)
| ^~~~~~~~~
linux/tools/include/linux/bitfield.h: In function ‘be16_encode_bits’:linux/tools/include/linux/bitfield.h:167:38: error: implicit declaration of function ‘cpu_to_be16’ [-Wimplicit-function-declaration]
167 | ____MAKE_OP(be##size,u##size,cpu_to_be##size,be##size##_to_cpu) \
| ^~~~~~~~~linux/tools/include/linux/bitfield.h:149:16: note: in definition of macro ‘____MAKE_OP’
149 | return to((v & field_mask(field)) * field_multiplier(field)); \
| ^~linux/tools/include/linux/bitfield.h:170:1: note: in expansion of macro ‘__MAKE_OP’
170 | __MAKE_OP(16)
| ^~~~~~~~~
linux/tools/include/linux/bitfield.h: In function ‘be16_get_bits’:linux/tools/include/linux/bitfield.h:167:54: error: implicit declaration of function ‘be16_to_cpu’ [-Wimplicit-function-declaration]
167 | ____MAKE_OP(be##size,u##size,cpu_to_be##size,be##size##_to_cpu) \
| ^~linux/tools/include/linux/bitfield.h:163:17: note: in definition of macro ‘____MAKE_OP’
163 | return (from(v) & field)/field_multiplier(field); \
| ^~~~linux/tools/include/linux/bitfield.h:170:1: note: in expansion of macro ‘__MAKE_OP’
170 | __MAKE_OP(16)
| ^~~~~~~~~
linux/tools/include/linux/bitfield.h: In function ‘le32_encode_bits’:linux/tools/include/linux/bitfield.h:166:38: error: implicit declaration of function ‘cpu_to_le32’ [-Wimplicit-function-declaration]
166 | ____MAKE_OP(le##size,u##size,cpu_to_le##size,le##size##_to_cpu) \
| ^~~~~~~~~linux/tools/include/linux/bitfield.h:149:16: note: in definition of macro ‘____MAKE_OP’
149 | return to((v & field_mask(field)) * field_multiplier(field)); \
| ^~linux/tools/include/linux/bitfield.h:171:1: note: in expansion of macro ‘__MAKE_OP’
171 | __MAKE_OP(32)
| ^~~~~~~~~
linux/tools/include/linux/bitfield.h: In function ‘le32_get_bits’:linux/tools/include/linux/bitfield.h:166:54: error: implicit declaration of function ‘le32_to_cpu’ [-Wimplicit-function-declaration]
166 | ____MAKE_OP(le##size,u##size,cpu_to_le##size,le##size##_to_cpu) \
| ^~linux/tools/include/linux/bitfield.h:163:17: note: in definition of macro ‘____MAKE_OP’
163 | return (from(v) & field)/field_multiplier(field); \
| ^~~~linux/tools/include/linux/bitfield.h:171:1: note: in expansion of macro ‘__MAKE_OP’
171 | __MAKE_OP(32)
| ^~~~~~~~~
linux/tools/include/linux/bitfield.h: In function ‘be32_encode_bits’:linux/tools/include/linux/bitfield.h:167:38: error: implicit declaration of function ‘cpu_to_be32’ [-Wimplicit-function-declaration]
167 | ____MAKE_OP(be##size,u##size,cpu_to_be##size,be##size##_to_cpu) \
| ^~~~~~~~~linux/tools/include/linux/bitfield.h:149:16: note: in definition of macro ‘____MAKE_OP’
149 | return to((v & field_mask(field)) * field_multiplier(field)); \
| ^~linux/tools/include/linux/bitfield.h:171:1: note: in expansion of macro ‘__MAKE_OP’
171 | __MAKE_OP(32)
| ^~~~~~~~~
linux/tools/include/linux/bitfield.h: In function ‘be32_get_bits’:linux/tools/include/linux/bitfield.h:167:54: error: implicit declaration of function ‘be32_to_cpu’ [-Wimplicit-function-declaration]
167 | ____MAKE_OP(be##size,u##size,cpu_to_be##size,be##size##_to_cpu) \
| ^~linux/tools/include/linux/bitfield.h:163:17: note: in definition of macro ‘____MAKE_OP’
163 | return (from(v) & field)/field_multiplier(field); \
| ^~~~linux/tools/include/linux/bitfield.h:171:1: note: in expansion of macro ‘__MAKE_OP’
171 | __MAKE_OP(32)
| ^~~~~~~~~
CC util/thread.olinux/tools/include/linux/bitfield.h: In function ‘le64_encode_bits’:linux/tools/include/linux/bitfield.h:166:38: error: implicit declaration of function ‘cpu_to_le64’ [-Wimplicit-function-declaration]
166 | ____MAKE_OP(le##size,u##size,cpu_to_le##size,le##size##_to_cpu) \
| ^~~~~~~~~linux/tools/include/linux/bitfield.h:149:16: note: in definition of macro ‘____MAKE_OP’
149 | return to((v & field_mask(field)) * field_multiplier(field)); \
| ^~linux/tools/include/linux/bitfield.h:172:1: note: in expansion of macro ‘__MAKE_OP’
172 | __MAKE_OP(64)
| ^~~~~~~~~
linux/tools/include/linux/bitfield.h: In function ‘le64_get_bits’:linux/tools/include/linux/bitfield.h:166:54: error: implicit declaration of function ‘le64_to_cpu’ [-Wimplicit-function-declaration]
166 | ____MAKE_OP(le##size,u##size,cpu_to_le##size,le##size##_to_cpu) \
| ^~linux/tools/include/linux/bitfield.h:163:17: note: in definition of macro ‘____MAKE_OP’
163 | return (from(v) & field)/field_multiplier(field); \
| ^~~~linux/tools/include/linux/bitfield.h:172:1: note: in expansion of macro ‘__MAKE_OP’
172 | __MAKE_OP(64)
| ^~~~~~~~~
linux/tools/include/linux/bitfield.h: In function ‘be64_encode_bits’:
CC util/thread_map.olinux/tools/include/linux/bitfield.h:167:38: error: implicit declaration of function ‘cpu_to_be64’ [-Wimplicit-function-declaration]
167 | ____MAKE_OP(be##size,u##size,cpu_to_be##size,be##size##_to_cpu) \
| ^~~~~~~~~linux/tools/include/linux/bitfield.h:149:16: note: in definition of macro ‘____MAKE_OP’
149 | return to((v & field_mask(field)) * field_multiplier(field)); \
| ^~linux/tools/include/linux/bitfield.h:172:1: note: in expansion of macro ‘__MAKE_OP’
172 | __MAKE_OP(64)
| ^~~~~~~~~
linux/tools/include/linux/bitfield.h: In function ‘be64_get_bits’:linux/tools/include/linux/bitfield.h:167:54: error: implicit declaration of function ‘be64_to_cpu’ [-Wimplicit-function-declaration]
167 | ____MAKE_OP(be##size,u##size,cpu_to_be##size,be##size##_to_cpu) \
| ^~linux/tools/include/linux/bitfield.h:163:17: note: in definition of macro ‘____MAKE_OP’
163 | return (from(v) & field)/field_multiplier(field); \
| ^~~~linux/tools/include/linux/bitfield.h:172:1: note: in expansion of macro ‘__MAKE_OP’
172 | __MAKE_OP(64)
| ^~~~~~~~~
BR,
Hamza
Re: [PATCH 6.6 176/737] perf arm-spe: Extend branch operations
In reply to Greg Kroah-HartmanHi,
It appears that this patch broke the build, see:
In file included from util/arm-spe-decoder/arm-spe-pkt-decoder.h:10,
from util/arm-spe-decoder/arm-spe-pkt-decoder.c:14:linux/tools/include/linux/bitfield.h: In function ‘le16_encode_bits’:linux/tools/include/linux/bitfield.h:166:38: error: implicit declaration of function ‘cpu_to_le16’ [-Wimplicit-function-declaration]
166 | ____MAKE_OP(le##size,u##size,cpu_to_le##size,le##size##_to_cpu) \
| ^~~~~~~~~linux/tools/include/linux/bitfield.h:149:16: note: in definition of macro ‘____MAKE_OP’
149 | return to((v & field_mask(field)) * field_multiplier(field)); \
| ^~linux/tools/include/linux/bitfield.h:170:1: note: in expansion of macro ‘__MAKE_OP’
170 | __MAKE_OP(16)
| ^~~~~~~~~
linux/tools/include/linux/bitfield.h: In function ‘le16_get_bits’:linux/tools/include/linux/bitfield.h:166:54: error: implicit declaration of function ‘le16_to_cpu’ [-Wimplicit-function-declaration]
166 | ____MAKE_OP(le##size,u##size,cpu_to_le##size,le##size##_to_cpu) \
| ^~linux/tools/include/linux/bitfield.h:163:17: note: in definition of macro ‘____MAKE_OP’
163 | return (from(v) & field)/field_multiplier(field); \
| ^~~~linux/tools/include/linux/bitfield.h:170:1: note: in expansion of macro ‘__MAKE_OP’
170 | __MAKE_OP(16)
| ^~~~~~~~~
linux/tools/include/linux/bitfield.h: In function ‘be16_encode_bits’:linux/tools/include/linux/bitfield.h:167:38: error: implicit declaration of function ‘cpu_to_be16’ [-Wimplicit-function-declaration]
167 | ____MAKE_OP(be##size,u##size,cpu_to_be##size,be##size##_to_cpu) \
| ^~~~~~~~~linux/tools/include/linux/bitfield.h:149:16: note: in definition of macro ‘____MAKE_OP’
149 | return to((v & field_mask(field)) * field_multiplier(field)); \
| ^~linux/tools/include/linux/bitfield.h:170:1: note: in expansion of macro ‘__MAKE_OP’
170 | __MAKE_OP(16)
| ^~~~~~~~~
linux/tools/include/linux/bitfield.h: In function ‘be16_get_bits’:linux/tools/include/linux/bitfield.h:167:54: error: implicit declaration of function ‘be16_to_cpu’ [-Wimplicit-function-declaration]
167 | ____MAKE_OP(be##size,u##size,cpu_to_be##size,be##size##_to_cpu) \
| ^~linux/tools/include/linux/bitfield.h:163:17: note: in definition of macro ‘____MAKE_OP’
163 | return (from(v) & field)/field_multiplier(field); \
| ^~~~linux/tools/include/linux/bitfield.h:170:1: note: in expansion of macro ‘__MAKE_OP’
170 | __MAKE_OP(16)
| ^~~~~~~~~
linux/tools/include/linux/bitfield.h: In function ‘le32_encode_bits’:linux/tools/include/linux/bitfield.h:166:38: error: implicit declaration of function ‘cpu_to_le32’ [-Wimplicit-function-declaration]
166 | ____MAKE_OP(le##size,u##size,cpu_to_le##size,le##size##_to_cpu) \
| ^~~~~~~~~linux/tools/include/linux/bitfield.h:149:16: note: in definition of macro ‘____MAKE_OP’
149 | return to((v & field_mask(field)) * field_multiplier(field)); \
| ^~linux/tools/include/linux/bitfield.h:171:1: note: in expansion of macro ‘__MAKE_OP’
171 | __MAKE_OP(32)
| ^~~~~~~~~
linux/tools/include/linux/bitfield.h: In function ‘le32_get_bits’:linux/tools/include/linux/bitfield.h:166:54: error: implicit declaration of function ‘le32_to_cpu’ [-Wimplicit-function-declaration]
166 | ____MAKE_OP(le##size,u##size,cpu_to_le##size,le##size##_to_cpu) \
| ^~linux/tools/include/linux/bitfield.h:163:17: note: in definition of macro ‘____MAKE_OP’
163 | return (from(v) & field)/field_multiplier(field); \
| ^~~~linux/tools/include/linux/bitfield.h:171:1: note: in expansion of macro ‘__MAKE_OP’
171 | __MAKE_OP(32)
| ^~~~~~~~~
linux/tools/include/linux/bitfield.h: In function ‘be32_encode_bits’:linux/tools/include/linux/bitfield.h:167:38: error: implicit declaration of function ‘cpu_to_be32’ [-Wimplicit-function-declaration]
167 | ____MAKE_OP(be##size,u##size,cpu_to_be##size,be##size##_to_cpu) \
| ^~~~~~~~~linux/tools/include/linux/bitfield.h:149:16: note: in definition of macro ‘____MAKE_OP’
149 | return to((v & field_mask(field)) * field_multiplier(field)); \
| ^~linux/tools/include/linux/bitfield.h:171:1: note: in expansion of macro ‘__MAKE_OP’
171 | __MAKE_OP(32)
| ^~~~~~~~~
linux/tools/include/linux/bitfield.h: In function ‘be32_get_bits’:linux/tools/include/linux/bitfield.h:167:54: error: implicit declaration of function ‘be32_to_cpu’ [-Wimplicit-function-declaration]
167 | ____MAKE_OP(be##size,u##size,cpu_to_be##size,be##size##_to_cpu) \
| ^~linux/tools/include/linux/bitfield.h:163:17: note: in definition of macro ‘____MAKE_OP’
163 | return (from(v) & field)/field_multiplier(field); \
| ^~~~linux/tools/include/linux/bitfield.h:171:1: note: in expansion of macro ‘__MAKE_OP’
171 | __MAKE_OP(32)
| ^~~~~~~~~
CC util/thread.olinux/tools/include/linux/bitfield.h: In function ‘le64_encode_bits’:linux/tools/include/linux/bitfield.h:166:38: error: implicit declaration of function ‘cpu_to_le64’ [-Wimplicit-function-declaration]
166 | ____MAKE_OP(le##size,u##size,cpu_to_le##size,le##size##_to_cpu) \
| ^~~~~~~~~linux/tools/include/linux/bitfield.h:149:16: note: in definition of macro ‘____MAKE_OP’
149 | return to((v & field_mask(field)) * field_multiplier(field)); \
| ^~linux/tools/include/linux/bitfield.h:172:1: note: in expansion of macro ‘__MAKE_OP’
172 | __MAKE_OP(64)
| ^~~~~~~~~
linux/tools/include/linux/bitfield.h: In function ‘le64_get_bits’:linux/tools/include/linux/bitfield.h:166:54: error: implicit declaration of function ‘le64_to_cpu’ [-Wimplicit-function-declaration]
166 | ____MAKE_OP(le##size,u##size,cpu_to_le##size,le##size##_to_cpu) \
| ^~linux/tools/include/linux/bitfield.h:163:17: note: in definition of macro ‘____MAKE_OP’
163 | return (from(v) & field)/field_multiplier(field); \
| ^~~~linux/tools/include/linux/bitfield.h:172:1: note: in expansion of macro ‘__MAKE_OP’
172 | __MAKE_OP(64)
| ^~~~~~~~~
linux/tools/include/linux/bitfield.h: In function ‘be64_encode_bits’:
CC util/thread_map.olinux/tools/include/linux/bitfield.h:167:38: error: implicit declaration of function ‘cpu_to_be64’ [-Wimplicit-function-declaration]
167 | ____MAKE_OP(be##size,u##size,cpu_to_be##size,be##size##_to_cpu) \
| ^~~~~~~~~linux/tools/include/linux/bitfield.h:149:16: note: in definition of macro ‘____MAKE_OP’
149 | return to((v & field_mask(field)) * field_multiplier(field)); \
| ^~linux/tools/include/linux/bitfield.h:172:1: note: in expansion of macro ‘__MAKE_OP’
172 | __MAKE_OP(64)
| ^~~~~~~~~
linux/tools/include/linux/bitfield.h: In function ‘be64_get_bits’:linux/tools/include/linux/bitfield.h:167:54: error: implicit declaration of function ‘be64_to_cpu’ [-Wimplicit-function-declaration]
167 | ____MAKE_OP(be##size,u##size,cpu_to_be##size,be##size##_to_cpu) \
| ^~linux/tools/include/linux/bitfield.h:163:17: note: in definition of macro ‘____MAKE_OP’
163 | return (from(v) & field)/field_multiplier(field); \
| ^~~~linux/tools/include/linux/bitfield.h:172:1: note: in expansion of macro ‘__MAKE_OP’
172 | __MAKE_OP(64)
| ^~~~~~~~~
BR,
Hamza
Re: [PATCH 6.6 176/737] perf arm-spe: Extend branch operations
In reply to Hamza MahfoozI replied to the wrong thread, please disregard this message.
Re: [PATCH 6.6 176/737] perf arm-spe: Extend branch operations
In reply to Hamza MahfoozHi,
[ + Arnaldo ]
Quoted 15 lines · Hamza Mahfooz
Hi,
It appears that this patch broke the build, see:
In file included from
util/arm-spe-decoder/arm-spe-pkt-decoder.h:10,
fromutil/arm-spe-decoder/arm-spe-pkt-decoder.c:14:linux/tools/include/linux/bitfield.h: In function ‘le16_encode_bits’:linux/tools/include/linux/bitfield.h:166:38: error: implicit declaration of function ‘cpu_to_le16’ [-Wimplicit-function-declaration]
166 |____MAKE_OP(le##size,u##size,cpu_to_le##size,le##size##_to_cpu)\
| ^~~~~~~~~linux/tools/include/linux/bitfield.h:149:16: note: in definition of macro ‘____MAKE_OP’
149 | returnto((v & field_mask(field)) * field_multiplier(field)); \
| ^~linux/tools/include/linux/bitfield.h:170:1: note: in expansion of macro ‘__MAKE_OP’
170 |__MAKE_OP(16)
Quoted 1 line
| ^~~~~~~~~
FYI, the fix has been sent out:
https://lore.kernel.org/linux-perf-users/[email protected]/
Thanks,
Leo
Arnaldo Carvalho de Melo
AppliedRe: [PATCH 6.6 176/737] perf arm-spe: Extend branch operations
Quoted 21 lines · Leo Yan
Hi,
[ + Arnaldo ]
Quoted 13 lines · Hamza Mahfooz
It appears that this patch broke the build, see:
In file included from
util/arm-spe-decoder/arm-spe-pkt-decoder.h:10,
fromutil/arm-spe-decoder/arm-spe-pkt-decoder.c:14:linux/tools/include/linux/bitfield.h: In function ‘le16_encode_bits’:linux/tools/include/linux/bitfield.h:166:38: error: implicit declaration of function ‘cpu_to_le16’ [-Wimplicit-function-declaration]
166 |____MAKE_OP(le##size,u##size,cpu_to_le##size,le##size##_to_cpu)\
| ^~~~~~~~~linux/tools/include/linux/bitfield.h:149:16: note: in definition of macro ‘____MAKE_OP’
149 | returnto((v & field_mask(field)) * field_multiplier(field)); \
| ^~linux/tools/include/linux/bitfield.h:170:1: note: in expansion of macro ‘__MAKE_OP’
170 |__MAKE_OP(16)Quoted 1 line
| ^~~~~~~~~
Quoted 2 lines
FYI, the fix has been sent out:
https://lore.kernel.org/linux-perf-users/[email protected]/
Thanks, applied to perf-tools-next, I also added a Reported-by: Hamza,
- Arnaldo
Re: [PATCH 6.6 176/737] perf arm-spe: Extend branch operations
Quoted 22 lines · Arnaldo Carvalho de Melo
Quoted 20 lines · Leo Yan
Hi,
[ + Arnaldo ]
Quoted 14 lines · Hamza Mahfooz
It appears that this patch broke the build, see:
In file included from
util/arm-spe-decoder/arm-spe-pkt-decoder.h:10,
fromutil/arm-spe-decoder/arm-spe-pkt-decoder.c:14:linux/tools/include/linux/bitfield.h: In function ‘le16_encode_bits’:linux/tools/include/linux/bitfield.h:166:38: error: implicit declaration of function ‘cpu_to_le16’ [-Wimplicit-function-declaration]
166 |____MAKE_OP(le##size,u##size,cpu_to_le##size,le##size##_to_cpu)\
| ^~~~~~~~~linux/tools/include/linux/bitfield.h:149:16: note: in definition of macro ‘____MAKE_OP’
149 | returnto((v & field_mask(field)) * field_multiplier(field)); \
| ^~linux/tools/include/linux/bitfield.h:170:1: note: in expansion of macro ‘__MAKE_OP’
170 |__MAKE_OP(16)| ^~~~~~~~~
Quoted 4 lines
Quoted 2 lines
FYI, the fix has been sent out:
https://lore.kernel.org/linux-perf-users/[email protected]/Thanks, applied to perf-tools-next, I also added a Reported-by: Hamza,
Humm, this applies cleanly to perf-tools-next and seems legit as bitfield.h uses things defined in kernel.h, but then it drifts further from what is in the tools kernel.h :-\
Anyway, I'll keep it there for now.
- Arnaldo
Greg KH
maintainerRe: [PATCH stable] cpuset: Fix missing adaptation for cpuset_is_populated
In reply to Chen RidongQuoted 52 lines · Chen Ridong
Quoted 33 lines · Greg KH
Quoted 32 lines · Chen Ridong
Quoted 29 lines · Chen Ridong
From: Chen Ridong <[email protected]>
Commit
b1bcaed1e39a("cpuset: Treat cpusets in attaching as populated") was backported to the long‑term support (LTS) branches. However, because commitd5cf4d34a333("cgroup/cpuset: Don't track # of local child partitions") was not backported, a corresponding adaptation to the backported code is still required.To ensure correct behavior, replace
cgroup_is_populatedwithcpuset_is_populatedin thepartition_is_populatedfunction.Cc [email protected] # 6.1+Fixes b1bcaed1e39a ("cpuset: Treat cpusets in attaching as populated")Signed-off-by Chen Ridong <[email protected]>--- kernel/cgroup/cpuset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/cgroup/cpuset.c +1
-1@@ -486,7 +486,7 @@ static inline bool partition_is_populated(struct cpuset *cs, cs->attach_in_progress)return true;if (!excluded_child && !cs->nr_subparts_cpus) -return cgroup_is_populated (cs->css.cgroup); +return cpuset_is_populated (cs);Quoted 8 lines
Quoted 7 lines
kernel/cgroup/cpuset.c static inline bool partition_is_populated(struct cpuset *cs, · line 492
Quoted 2 lines
kernel/cgroup/cpuset.c +0
-0rcu_read_lock ();cpuset_for_each_descendant_pre (cp, pos_css, cs) {Hi Greg,
Is this patch suitable for applying?
It needs approval from the maintainers of this file.Hi, Longman,
I appreciate you could have a review.
Quoted 3 lines
Quoted 2 lines
Note: Because the corresponding commit varies between LTS branches,, the Fixes tag points to a mainline commit.
Quoted 7 lines
Quoted 2 lines
As this is only for 6.1.y, why not point it at the commit there?
This fix (commit
b1bcaed1e39a"cpuset: Treat cpusets in attaching as populated") was backported to the stable branches v6.1 and later. The latest LTS(v6.18) has this issue, so it should be v6.1+.Cc [email protected] # v6.1+
Ok, makes sense. I've applied this, with manual fixups for 6.18.y and 6.12.y, to the relevent trees.
greg k-h