media: Revert "media: rkisp1: Drop IRQF_SHARED"
Subsystems (13)
Sasha Levin
maintainerPATCH 1/21 media: Revert "media: rkisp1: Drop IRQF_SHARED"
From: Tomi Valkeinen <[email protected]>
[ Upstream commit a107d643b2a3382e0a2d2c4ef08bf8c6bff4561d ]
This reverts commit 85d2a31fe4d9be1555f621ead7a520d8791e0f74.
The rkisp1 does share interrupt lines on some platforms, after all. Thus we need to revert this, and implement a fix for the rkisp1 shared irq handling in a follow-up patch.
--- drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c +1 -1
@@ -559,7 +559,7 @@ static int rkisp1_probe(struct platform_device *pdev) rkisp1->irqs[il] = irq; } - ret =devm_request_irq (dev, irq, info->isrs[i].isr,0 , + ret =devm_request_irq (dev, irq, info->isrs[i].isr,IRQF_SHARED ,dev_driver_string (dev), dev);if (ret) {dev_err (dev,"request irq failed: %d\n" , ret);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 2/21 media: rkisp1: Fix IRQ handling due to shared interrupts
From: Tomi Valkeinen <[email protected]>
[ Upstream commit ffb635bb398fc07cb38f8a7b4a82cbe5f412f08e ]
The driver requests the interrupts as IRQF_SHARED, so the interrupt handlers can be called at any time. If such a call happens while the ISP is powered down, the SoC will hang as the driver tries to access the ISP registers.
This can be reproduced even without the platform sharing the IRQ line:
Enable CONFIG_DEBUG_SHIRQ and unload the driver, and the board will hang.
Fix this by adding a new field, 'irqs_enabled', which is used to bail out from the interrupt handler when the ISP is not operational.
--- .../platform/rockchip/rkisp1/rkisp1-capture.c | 3 +++ .../platform/rockchip/rkisp1/rkisp1-common.h | 2 ++ .../platform/rockchip/rkisp1/rkisp1-csi.c | 3 +++ .../platform/rockchip/rkisp1/rkisp1-dev.c | 22 +++++++++++++++++++ .../platform/rockchip/rkisp1/rkisp1-isp.c | 3 +++ 5 files changed, 33 insertions(+)
drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c +3 -0
@@ -723,6 +723,9 @@ irqreturn_t rkisp1_capture_isr(int irq, void *ctx)unsigned int i;u32 status; +if (!rkisp1->irqs_enabled) +return IRQ_NONE ; + status =rkisp1_read (rkisp1,RKISP1_CIF_MI_MIS );if (!status)return IRQ_NONE ;
drivers/media/platform/rockchip/rkisp1/rkisp1-common.h +2 -0
@@ -467,6 +467,7 @@ struct rkisp1_debug {* @debug: debug params to be exposed on debugfs * @info: version-specific ISP information * @irqs: IRQ line numbers +* @irqs_enabled: the hardware is enabled and can cause interrupts */ struct rkisp1_device {void __iomem *base_addr;
@@ -488,6 +489,7 @@ struct rkisp1_device {struct rkisp1_debug debug;const struct rkisp1_info *info;int irqs[RKISP1_NUM_IRQS ]; +bool irqs_enabled; };/*
drivers/media/platform/rockchip/rkisp1/rkisp1-csi.c +3 -0
@@ -211,6 +211,9 @@ irqreturn_t rkisp1_csi_isr(int irq, void *ctx)struct rkisp1_device *rkisp1 =dev_get_drvdata (dev);u32 val, status; +if (!rkisp1->irqs_enabled) +return IRQ_NONE ; + status =rkisp1_read (rkisp1,RKISP1_CIF_MIPI_MIS );if (!status)return IRQ_NONE ;
drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c +22 -0
@@ -305,6 +305,24 @@ static int __maybe_unused rkisp1_runtime_suspend(struct device *dev) {struct rkisp1_device *rkisp1 =dev_get_drvdata (dev); + rkisp1->irqs_enabled = false; +/* Make sure the IRQ handler will see the above */ +mb (); + +/* +* Wait until any running IRQ handler has returned. The IRQ handler +* may get called even after this (as it's a shared interrupt line) +* but the 'irqs_enabled' flag will make the handler return immediately. +*/ +for (unsigned int il =0 ; il <ARRAY_SIZE (rkisp1->irqs); ++il) { +if (rkisp1->irqs[il] ==-1 ) +continue ; + +/* Skip if the irq line is the same as previous */ +if (il ==0 || rkisp1->irqs[il -1 ] != rkisp1->irqs[il]) +synchronize_irq (rkisp1->irqs[il]); + } +clk_bulk_disable_unprepare (rkisp1->clk_size, rkisp1->clks);return pinctrl_pm_select_sleep_state (dev); }
@@ -321,6 +339,10 @@ static int __maybe_unused rkisp1_runtime_resume(struct device *dev)if (ret)return ret; + rkisp1->irqs_enabled = true; +/* Make sure the IRQ handler will see the above */ +mb (); +return 0 ; }
drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c +3 -0
@@ -1027,6 +1027,9 @@ irqreturn_t rkisp1_isp_isr(int irq, void *ctx)struct rkisp1_device *rkisp1 =dev_get_drvdata (dev);u32 status, isp_err; +if (!rkisp1->irqs_enabled) +return IRQ_NONE ; + status =rkisp1_read (rkisp1,RKISP1_CIF_ISP_MIS );if (!status)return IRQ_NONE ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 3/21 Revert "drm/msm/gpu: Push gpu lock down past runpm"
In reply to Sasha LevinFrom: Rob Clark <[email protected]>
[ Upstream commit 917e9b7c2350e3e53162fcf5035e5f2d68e2cbed ]
This reverts commit abe2023b4cea192ab266b351fd38dc9dbd846df0.
Changing the locking order means that scheduler/msm_job_run() can race with the recovery kthread worker, with the result that the GPU gets an extra runpm get when we are trying to power it off. Leaving the GPU in an unrecovered state.
I'll need to come up with a different scheme for appeasing lockdep.
Patchwork: https://patchwork.freedesktop.org/patch/573835/
--- drivers/gpu/drm/msm/msm_gpu.c | 11 +++++------ drivers/gpu/drm/msm/msm_ringbuffer.c | 7 +++++-- 2 files changed, 10 insertions(+), 8 deletions(-)
drivers/gpu/drm/msm/msm_gpu.c +5 -6
@@ -749,12 +749,14 @@ void msm_gpu_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit)struct msm_ringbuffer *ring = submit->ring;unsigned long flags; -pm_runtime_get_sync (&gpu->pdev->dev); +WARN_ON (!mutex_is_locked (&gpu->lock)); -mutex_lock (&gpu->lock); +pm_runtime_get_sync (&gpu->pdev->dev);msm_gpu_hw_init (gpu); + submit->seqno = submit->hw_fence->seqno; +update_sw_cntrs (gpu);/*
@@ -779,11 +781,8 @@ void msm_gpu_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit) gpu->funcs->submit (gpu, submit); gpu->cur_ctx_seqno = submit->queue->ctx->seqno; -hangcheck_timer_reset (gpu); - -mutex_unlock (&gpu->lock); -pm_runtime_put (&gpu->pdev->dev); +hangcheck_timer_reset (gpu); }/*
drivers/gpu/drm/msm/msm_ringbuffer.c +5 -2
@@ -21,8 +21,6 @@ static struct dma_fence *msm_job_run(struct drm_sched_job *job)msm_fence_init (submit->hw_fence, fctx); - submit->seqno = submit->hw_fence->seqno; -mutex_lock (&priv->lru.lock);for (i =0 ; i < submit->nr_bos; i++) {
@@ -34,8 +32,13 @@ static struct dma_fence *msm_job_run(struct drm_sched_job *job)mutex_unlock (&priv->lru.lock); +/* TODO move submit path over to using a per-ring lock.. */ +mutex_lock (&gpu->lock); +msm_gpu_submit (gpu, submit); +mutex_unlock (&gpu->lock); +return dma_fence_get (submit->hw_fence); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 4/21 ASoC: cs42l43: Handle error from devm_pm_runtime_enable
In reply to Sasha LevinFrom: Charles Keepax <[email protected]>
[ Upstream commit d1722057477a3786b8c0d60c28fc281f6ecf1cc3 ]
As devm_pm_runtime_enable can fail due to memory allocations, it is best to handle the error.
--- sound/soc/codecs/cs42l43.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
sound/soc/codecs/cs42l43.c +4 -1
@@ -2175,7 +2175,10 @@ static int cs42l43_codec_probe(struct platform_device *pdev)pm_runtime_use_autosuspend (priv->dev);pm_runtime_set_active (priv->dev);pm_runtime_get_noresume (priv->dev); -devm_pm_runtime_enable (priv->dev); + + ret =devm_pm_runtime_enable (priv->dev); +if (ret) + goto err_pm;for (i =0 ; i <ARRAY_SIZE (cs42l43_irqs); i++) { ret = cs42l43_request_irq(priv, dom, cs42l43_irqs[i].name,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 5/21 wifi: iwlwifi: mvm: use correct address 3 in A-MSDU
In reply to Sasha LevinFrom: Daniel Gabay <[email protected]>
[ Upstream commit 2e57b77583ca34fdb6e14f253172636c52f81cf2 ]
As described in IEEE sta 802.11-2020, table 9-30 (Address field contents), A-MSDU address 3 should contain the BSSID address.
In TX_CMD we copy the MAC header from skb, and skb address 3 holds the destination address, but it may not be identical to the BSSID.
Using the wrong destination address appears to work with (most) receivers without MLO, but in MLO some devices are checking for it carefully, perhaps as a consequence of link to MLD address translation.
Replace address 3 in the TX_CMD MAC header with the correct address while retaining the skb address 3 unchanged. This ensures that skb address 3 will be utilized later for constructing the A-MSDU subframes.
Note that we fill in the MLD address, but the firmware will do the necessary translation to link address after encryption.
--- drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 69 ++++++++++++++++++--- 1 file changed, 59 insertions(+), 10 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/tx.c +59 -10
@@ -500,13 +500,24 @@ static void iwl_mvm_set_tx_cmd_crypto(struct iwl_mvm *mvm, } } +static void iwl_mvm_copy_hdr (void *cmd,const void *hdr,int hdrlen, +const u8 *addr3_override) +{ +struct ieee80211_hdr *out_hdr = cmd; + +memcpy (cmd, hdr, hdrlen); +if (addr3_override) +memcpy (out_hdr->addr3, addr3_override,ETH_ALEN ); +} +/* * Allocates and sets the Tx cmd the driver data pointers in the skb */ static struct iwl_device_tx_cmd *iwl_mvm_set_tx_params (struct iwl_mvm *mvm,struct sk_buff *skb,struct ieee80211_tx_info *info,int hdrlen, -struct ieee80211_sta *sta,u8 sta_id) +struct ieee80211_sta *sta,u8 sta_id, +const u8 *addr3_override) {struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;struct iwl_device_tx_cmd *dev_cmd;
@@ -564,7 +575,7 @@ iwl_mvm_set_tx_params(struct iwl_mvm *mvm, struct sk_buff *skb, cmd->len =cpu_to_le16 ((u16 )skb->len);/* Copy MAC header from skb into command buffer */ -memcpy (cmd->hdr, hdr, hdrlen); +iwl_mvm_copy_hdr (cmd->hdr, hdr, hdrlen, addr3_override); cmd->flags =cpu_to_le16 (flags); cmd->rate_n_flags =cpu_to_le32 (rate_n_flags);
@@ -579,7 +590,7 @@ iwl_mvm_set_tx_params(struct iwl_mvm *mvm, struct sk_buff *skb, cmd->len =cpu_to_le16 ((u16 )skb->len);/* Copy MAC header from skb into command buffer */ -memcpy (cmd->hdr, hdr, hdrlen); +iwl_mvm_copy_hdr (cmd->hdr, hdr, hdrlen, addr3_override); cmd->flags =cpu_to_le32 (flags); cmd->rate_n_flags =cpu_to_le32 (rate_n_flags);
@@ -597,7 +608,7 @@ iwl_mvm_set_tx_params(struct iwl_mvm *mvm, struct sk_buff *skb,iwl_mvm_set_tx_cmd_rate (mvm, tx_cmd, info, sta, hdr->frame_control);/* Copy MAC header from skb into command buffer */ -memcpy (tx_cmd->hdr, hdr, hdrlen); +iwl_mvm_copy_hdr (tx_cmd->hdr, hdr, hdrlen, addr3_override); out:return dev_cmd;
@@ -800,7 +811,8 @@ int iwl_mvm_tx_skb_non_sta(struct iwl_mvm *mvm, struct sk_buff *skb)IWL_DEBUG_TX (mvm,"station Id %d, queue=%d\n" , sta_id, queue); - dev_cmd =iwl_mvm_set_tx_params (mvm, skb, &info, hdrlen,NULL , sta_id); + dev_cmd =iwl_mvm_set_tx_params (mvm, skb, &info, hdrlen,NULL , sta_id, +NULL );if (!dev_cmd)return -1 ;
@@ -1120,7 +1132,8 @@ static int iwl_mvm_tx_pkt_queued(struct iwl_mvm *mvm,*/ static int iwl_mvm_tx_mpdu (struct iwl_mvm *mvm,struct sk_buff *skb,struct ieee80211_tx_info *info, -struct ieee80211_sta *sta) +struct ieee80211_sta *sta, +const u8 *addr3_override) {struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;struct iwl_mvm_sta *mvmsta;
@@ -1152,7 +1165,8 @@ static int iwl_mvm_tx_mpdu(struct iwl_mvm *mvm, struct sk_buff *skb,iwl_mvm_probe_resp_set_noa (mvm, skb); dev_cmd =iwl_mvm_set_tx_params (mvm, skb, info, hdrlen, - sta, mvmsta->deflink.sta_id); + sta, mvmsta->deflink.sta_id, + addr3_override);if (!dev_cmd) goto drop;
@@ -1274,9 +1288,11 @@ int iwl_mvm_tx_skb_sta(struct iwl_mvm *mvm, struct sk_buff *skb,struct iwl_mvm_sta *mvmsta =iwl_mvm_sta_from_mac80211 (sta);struct ieee80211_tx_info info;struct sk_buff_head mpdus_skbs; +struct ieee80211_vif *vif;unsigned int payload_len;int ret;struct sk_buff *orig_skb = skb; +const u8 *addr3;if (WARN_ON_ONCE (!mvmsta))return -1 ;
@@ -1287,26 +1303,59 @@ int iwl_mvm_tx_skb_sta(struct iwl_mvm *mvm, struct sk_buff *skb,memcpy (&info, skb->cb,sizeof (info));if (!skb_is_gso (skb)) -return iwl_mvm_tx_mpdu (mvm, skb, &info, sta); +return iwl_mvm_tx_mpdu (mvm, skb, &info, sta,NULL ); payload_len =skb_tail_pointer (skb) -skb_transport_header (skb) -tcp_hdrlen (skb) + skb->data_len;if (payload_len <=skb_shinfo (skb)->gso_size) -return iwl_mvm_tx_mpdu (mvm, skb, &info, sta); +return iwl_mvm_tx_mpdu (mvm, skb, &info, sta,NULL );__skb_queue_head_init (&mpdus_skbs); + vif = info.control.vif; +if (!vif) +return -1 ; + ret =iwl_mvm_tx_tso (mvm, skb, &info, sta, &mpdus_skbs);if (ret)return ret;WARN_ON (skb_queue_empty (&mpdus_skbs)); +/* +* As described in IEEE sta 802.11-2020, table 9-30 (Address +* field contents), A-MSDU address 3 should contain the BSSID +* address. +* Pass address 3 down to iwl_mvm_tx_mpdu() and further to set it +* in the command header. We need to preserve the original +* address 3 in the skb header to correctly create all the +* A-MSDU subframe headers from it. +*/ +switch (vif->type) { +case NL80211_IFTYPE_STATION : + addr3 = vif->cfg.ap_addr; +break ; +case NL80211_IFTYPE_AP : + addr3 = vif->addr; +break ; +default : + addr3 =NULL ; +break ; + } +while (!skb_queue_empty (&mpdus_skbs)) { +struct ieee80211_hdr *hdr; +bool amsdu; + skb =__skb_dequeue (&mpdus_skbs); + hdr = (void *)skb->data; + amsdu =ieee80211_is_data_qos (hdr->frame_control) && + (*ieee80211_get_qos_ctl (hdr) & +IEEE80211_QOS_CTL_A_MSDU_PRESENT ); - ret =iwl_mvm_tx_mpdu (mvm, skb, &info, sta); + ret =iwl_mvm_tx_mpdu (mvm, skb, &info, sta, + amsdu ? addr3 :NULL );if (ret) {/* Free skbs created as part of TSO logic that have not yet been dequeued */ __skb_queue_purge (&mpdus_skbs);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 6/21 arm64: jump_label: use constraints "Si" instead of "i"
In reply to Sasha LevinFrom: Fangrui Song <[email protected]>
[ Upstream commit f9daab0ad01cf9d165dbbbf106ca4e61d06e7fe8 ]
The generic constraint "i" seems to be copied from x86 or arm (and with a redundant generic operand modifier "c"). It works with -fno-PIE but not with -fPIE/-fPIC in GCC's aarch64 port.
The machine constraint "S", which denotes a symbol or label reference with a constant offset, supports PIC and has been available in GCC since 2012 and in Clang since 7.0. However, Clang before 19 does not support "S" on a symbol with a constant offset [1] (e.g. static_key_false(&nf_hooks_needed[pf][hook]) in include/linux/netfilter.h), so we use "i" as a fallback.
--- arch/arm64/include/asm/jump_label.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
arch/arm64/include/asm/jump_label.h +8 -4
@@ -15,6 +15,10 @@#define JUMP_LABEL_NOP_SIZE AARCH64_INSN_SIZE +/* +* Prefer the constraint "S" to support PIC with GCC. Clang before 19 does not +* support "S" on a symbol with a constant offset, so we use "i" as a fallback. +*/ static __always_inline bool arch_static_branch(struct static_key * const key,const bool branch) {
@@ -23,9 +27,9 @@ static __always_inline bool arch_static_branch(struct static_key * const key," .pushsection __jump_table, \"aw\" \n\t" " .align 3 \n\t" " .long 1b - ., %l[l_yes] - . \n\t" - " .quad %c0 - . \n\t" +" .quad (%[key] - .) + %[bit0] \n\t" " .popsection \n\t" - : : "i"(&((char *)key)[branch]) : : l_yes); + : : [key]"Si"(key), [bit0]"i"(branch) : : l_yes);return false; l_yes:
@@ -40,9 +44,9 @@ static __always_inline bool arch_static_branch_jump(struct static_key * const ke" .pushsection __jump_table, \"aw\" \n\t" " .align 3 \n\t" " .long 1b - ., %l[l_yes] - . \n\t" - " .quad %c0 - . \n\t" +" .quad (%[key] - .) + %[bit0] \n\t" " .popsection \n\t" - : : "i"(&((char *)key)[branch]) : : l_yes); + : : [key]"Si"(key), [bit0]"i"(branch) : : l_yes);return false; l_yes:
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 7/21 perf/arm-cmn: Workaround AmpereOneX errata AC04_MESH_1 (incorrect child count)
In reply to Sasha LevinFrom: Ilkka Koskinen <[email protected]>
[ Upstream commit 50572064ec7109b00eef8880e905f55861c8b3de ]
AmpereOneX mesh implementation has a bug in HN-P nodes that makes them report incorrect child count. The failing crosspoints report 8 children while they only have two.
When the driver tries to access the inexistent child nodes, it believes it has reached an invalid node type and probing fails. The workaround is to ignore those incorrect child nodes and continue normally.
--- drivers/perf/arm-cmn.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/perf/arm-cmn.c +11 -0
@@ -2301,6 +2301,17 @@ static int arm_cmn_discover(struct arm_cmn *cmn, unsigned int rgn_offset)dev_dbg (cmn->dev,"ignoring external node %llx\n" , reg);continue ; } +/* +* AmpereOneX erratum AC04_MESH_1 makes some XPs report a bogus +* child count larger than the number of valid child pointers. +* A child offset of 0 can only occur on CMN-600; otherwise it +* would imply the root node being its own grandchild, which +* we can safely dismiss in general. +*/ +if (reg ==0 && cmn->part !=PART_CMN600 ) { +dev_dbg (cmn->dev,"bogus child pointer?\n" ); +continue ; + }arm_cmn_init_node_info (cmn, reg &CMN_CHILD_NODE_ADDR , dn);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 8/21 btrfs: add and use helper to check if block group is used
In reply to Sasha LevinFrom: Filipe Manana <[email protected]>
[ Upstream commit 1693d5442c458ae8d5b0d58463b873cd879569ed ]
Add a helper function to determine if a block group is being used and make use of it at btrfs_delete_unused_bgs(). This helper will also be used in future code changes.
--- fs/btrfs/block-group.c | 3 +-- fs/btrfs/block-group.h | 7 +++++++ 2 files changed, 8 insertions(+), 2 deletions(-)
fs/btrfs/block-group.c +1 -2
@@ -1524,8 +1524,7 @@ void btrfs_delete_unused_bgs(struct btrfs_fs_info *fs_info) }spin_lock (&block_group->lock); -if (block_group->reserved || block_group->pinned || - block_group->used || block_group->ro || +if (btrfs_is_block_group_used (block_group) || block_group->ro ||list_is_singular (&block_group->list)) {/* * We want to bail if we made new allocations or have
fs/btrfs/block-group.h +7 -0
@@ -255,6 +255,13 @@ static inline u64 btrfs_block_group_end(struct btrfs_block_group *block_group)return (block_group->start + block_group->length); } +static inline bool btrfs_is_block_group_used (const struct btrfs_block_group *bg) +{ +lockdep_assert_held (&bg->lock); + +return (bg->used >0 || bg->reserved >0 || bg->pinned >0 ); +} +static inline bool btrfs_is_block_group_data_only (struct btrfs_block_group *block_group) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 9/21 selftests: openvswitch: Add validation for the recursion test
In reply to Sasha LevinFrom: Aaron Conole <[email protected]>
[ Upstream commit bd128f62c365504e1268dc09fcccdfb1f091e93a ]
Add a test case into the netlink checks that will show the number of nested action recursions won't exceed 16. Going to 17 on a small clone call isn't enough to exhaust the stack on (most) systems, so it should be safe to run even on systems that don't have the fix applied.
--- .../selftests/net/openvswitch/openvswitch.sh | 13 ++++ .../selftests/net/openvswitch/ovs-dpctl.py | 71 +++++++++++++++---- 2 files changed, 69 insertions(+), 15 deletions(-)
tools/testing/selftests/net/openvswitch/openvswitch.sh +13 -0
@@ -502,7 +502,20 @@ test_netlink_checks () { wc -l) == 2 ] || \ return 1 + info "Checking clone depth" ERR_MSG="Flow actions may not be safe on all matching packets" + PRE_TEST=$(dmesg | grep -c "${ERR_MSG}") + ovs_add_flow "test_netlink_checks" nv0 \ + 'in_port(1),eth(),eth_type(0x800),ipv4()' \ + 'clone(clone(clone(clone(clone(clone(clone(clone(clone(clone(clone(clone(clone(clone(clone(clone(clone(drop)))))))))))))))))' \ + >/dev/null 2>&1 && return 1 + POST_TEST=$(dmesg | grep -c "${ERR_MSG}") + + if [ "$PRE_TEST" == "$POST_TEST" ]; then + info "failed - clone depth too large" + return 1 + fi + PRE_TEST=$(dmesg | grep -c "${ERR_MSG}") ovs_add_flow "test_netlink_checks" nv0 \ 'in_port(1),eth(),eth_type(0x0806),arp()' 'drop(0),2' \
tools/testing/selftests/net/openvswitch/ovs-dpctl.py +56 -15
137 lines not on this page · raw message
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 10/21 net: tls: factor out tls_*crypt_async_wait()
In reply to Sasha LevinFrom: Jakub Kicinski <[email protected]>
[ Upstream commit c57ca512f3b68ddcd62bda9cc24a8f5584ab01b1 ]
Factor out waiting for async encrypt and decrypt to finish. There are already multiple copies and a subsequent fix will need more. No functional changes.
Note that crypto_wait_req() returns wait->err
--- net/tls/tls_sw.c | 96 +++++++++++++++++++++++------------------------- 1 file changed, 45 insertions(+), 51 deletions(-)
net/tls/tls_sw.c +45 -51
@@ -230,6 +230,20 @@ static void tls_decrypt_done(void *data, int err)spin_unlock_bh (&ctx->decrypt_compl_lock); } +static int tls_decrypt_async_wait (struct tls_sw_context_rx *ctx) +{ +int pending; + +spin_lock_bh (&ctx->decrypt_compl_lock); +reinit_completion (&ctx->async_wait.completion); + pending =atomic_read (&ctx->decrypt_pending); +spin_unlock_bh (&ctx->decrypt_compl_lock); +if (pending) +crypto_wait_req (-EINPROGRESS , &ctx->async_wait); + +return ctx->async_wait.err; +} + static int tls_do_decryption(struct sock *sk, struct scatterlist *sgin, struct scatterlist *sgout,
@@ -495,6 +509,28 @@ static void tls_encrypt_done(void *data, int err)schedule_delayed_work (&ctx->tx_work.work,1 ); } +static int tls_encrypt_async_wait (struct tls_sw_context_tx *ctx) +{ +int pending; + +spin_lock_bh (&ctx->encrypt_compl_lock); + ctx->async_notify = true; + + pending =atomic_read (&ctx->encrypt_pending); +spin_unlock_bh (&ctx->encrypt_compl_lock); +if (pending) +crypto_wait_req (-EINPROGRESS , &ctx->async_wait); +else +reinit_completion (&ctx->async_wait.completion); + +/* There can be no concurrent accesses, since we have no +* pending encrypt operations +*/ +WRITE_ONCE (ctx->async_notify, false); + +return ctx->async_wait.err; +} + static int tls_do_encryption(struct sock *sk, struct tls_context *tls_ctx, struct tls_sw_context_tx *ctx,
@@ -984,7 +1020,6 @@ static int tls_sw_sendmsg_locked(struct sock *sk, struct msghdr *msg,int num_zc =0 ;int orig_size;int ret =0 ; -int pending;if (!eor && (msg->msg_flags &MSG_EOR ))return -EINVAL ;
@@ -1163,24 +1198,12 @@ static int tls_sw_sendmsg_locked(struct sock *sk, struct msghdr *msg,if (!num_async) { goto send_end; }else if (num_zc) { -/* Wait for pending encryptions to get completed */ -spin_lock_bh (&ctx->encrypt_compl_lock); - ctx->async_notify = true; - - pending =atomic_read (&ctx->encrypt_pending); -spin_unlock_bh (&ctx->encrypt_compl_lock); -if (pending) -crypto_wait_req (-EINPROGRESS , &ctx->async_wait); -else -reinit_completion (&ctx->async_wait.completion); - -/* There can be no concurrent accesses, since we have no -* pending encrypt operations -*/ -WRITE_ONCE (ctx->async_notify, false); +int err; -if (ctx->async_wait.err) { - ret = ctx->async_wait.err; +/* Wait for pending encryptions to get completed */ + err =tls_encrypt_async_wait (ctx); +if (err) { + ret = err; copied =0 ; } }
@@ -1229,7 +1252,6 @@ void tls_sw_splice_eof(struct socket *sock)ssize_t copied =0 ;bool retrying = false;int ret =0 ; -int pending;if (!ctx->open_rec)return ;
@@ -1264,22 +1286,7 @@ void tls_sw_splice_eof(struct socket *sock) }/* Wait for pending encryptions to get completed */ -spin_lock_bh (&ctx->encrypt_compl_lock); - ctx->async_notify = true; - - pending =atomic_read (&ctx->encrypt_pending); -spin_unlock_bh (&ctx->encrypt_compl_lock); -if (pending) -crypto_wait_req (-EINPROGRESS , &ctx->async_wait); -else -reinit_completion (&ctx->async_wait.completion); - -/* There can be no concurrent accesses, since we have no pending -* encrypt operations -*/ -WRITE_ONCE (ctx->async_notify, false); - -if (ctx->async_wait.err) +if (tls_encrypt_async_wait (ctx)) goto unlock;/* Transmit if any encryptions have completed */
@@ -2109,16 +2116,10 @@ int tls_sw_recvmsg(struct sock *sk, recv_end:if (async) { -int ret, pending; +int ret;/* Wait for all previously submitted records to be decrypted */ -spin_lock_bh (&ctx->decrypt_compl_lock); -reinit_completion (&ctx->async_wait.completion); - pending =atomic_read (&ctx->decrypt_pending); -spin_unlock_bh (&ctx->decrypt_compl_lock); - ret =0 ; -if (pending) - ret =crypto_wait_req (-EINPROGRESS , &ctx->async_wait); + ret =tls_decrypt_async_wait (ctx);__skb_queue_purge (&ctx->async_hold);if (ret) {
@@ -2435,16 +2436,9 @@ void tls_sw_release_resources_tx(struct sock *sk)struct tls_context *tls_ctx =tls_get_ctx (sk);struct tls_sw_context_tx *ctx =tls_sw_ctx_tx (tls_ctx);struct tls_rec *rec, *tmp; -int pending;/* Wait for any pending async encryptions to complete */ -spin_lock_bh (&ctx->encrypt_compl_lock); - ctx->async_notify = true; - pending =atomic_read (&ctx->encrypt_pending); -spin_unlock_bh (&ctx->encrypt_compl_lock); - -if (pending) -crypto_wait_req (-EINPROGRESS , &ctx->async_wait); +tls_encrypt_async_wait (ctx);tls_tx_records (sk,-1 );
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 11/21 selftests: tls: use exact comparison in recv_partial
In reply to Sasha LevinFrom: Jakub Kicinski <[email protected]>
[ Upstream commit 49d821064c44cb5ffdf272905236012ea9ce50e3 ]
This exact case was fail for async crypto and we weren't catching it.
--- tools/testing/selftests/net/tls.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
tools/testing/selftests/net/tls.c +4 -4
@@ -988,12 +988,12 @@ TEST_F(tls, recv_partial)memset (recv_mem,0 ,sizeof (recv_mem));EXPECT_EQ (send (self->fd, test_str, send_len,0 ), send_len); -EXPECT_NE (recv (self->cfd, recv_mem,strlen (test_str_first), -MSG_WAITALL ),-1 ); +EXPECT_EQ (recv (self->cfd, recv_mem,strlen (test_str_first), +MSG_WAITALL ),strlen (test_str_first));EXPECT_EQ (memcmp (test_str_first, recv_mem,strlen (test_str_first)),0 );memset (recv_mem,0 ,sizeof (recv_mem)); -EXPECT_NE (recv (self->cfd, recv_mem,strlen (test_str_second), -MSG_WAITALL ),-1 ); +EXPECT_EQ (recv (self->cfd, recv_mem,strlen (test_str_second), +MSG_WAITALL ),strlen (test_str_second));EXPECT_EQ (memcmp (test_str_second, recv_mem,strlen (test_str_second)),0 ); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 12/21 ASoC: rt5645: Make LattePanda board DMI match more precise
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit 551539a8606e28cb2a130f8ef3e9834235b456c4 ]
The DMI strings used for the LattePanda board DMI quirks are very generic.
Using the dmidecode database from https://linux-hardware.org/ shows that the chosen DMI strings also match the following 2 laptops which also have a rt5645 codec:
Insignia NS-P11W7100 https://linux-hardware.org/?computer=E092FFF8BA04
Insignia NS-P10W8100 https://linux-hardware.org/?computer=AFB6C0BF7934
All 4 hw revisions of the LattePanda board have "S70CR" in their BIOS version DMI strings:
DF-BI-7-S70CR100-*
DF-BI-7-S70CR110-*
DF-BI-7-S70CR200-*
LP-BS-7-S70CR700-*
See e.g. https://linux-hardware.org/?computer=D98250A817C0
Add a partial (non exact) DMI match on this string to make the LattePanda board DMI match more precise to avoid false-positive matches.
--- sound/soc/codecs/rt5645.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
sound/soc/codecs/rt5645.c +10 -0
@@ -3828,6 +3828,16 @@ static const struct dmi_system_id dmi_platform_data[] = { DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"), DMI_EXACT_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"), DMI_EXACT_MATCH(DMI_BOARD_VERSION, "Default string"), +/* +* Above strings are too generic, LattePanda BIOS versions for +* all 4 hw revisions are: +* DF-BI-7-S70CR100-* +* DF-BI-7-S70CR110-* +* DF-BI-7-S70CR200-* +* LP-BS-7-S70CR700-* +* Do a partial match for S70CR to avoid false positive matches. +*/ + DMI_MATCH(DMI_BIOS_VERSION, "S70CR"), }, .driver_data = (void *)&lattepanda_board_platform_data, },
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 13/21 spi: intel-pci: Add support for Lunar Lake-M SPI serial flash
In reply to Sasha LevinFrom: Mika Westerberg <[email protected]>
[ Upstream commit 8f44e3808200c1434c26ef459722f88f48b306df ]
Add Intel Lunar Lake-M PCI ID to the driver list of supported devices. This is the same controller found in previous generations.
--- drivers/spi/spi-intel-pci.c | 1 + 1 file changed, 1 insertion(+)
drivers/spi/spi-intel-pci.c +1 -0
@@ -84,6 +84,7 @@ static const struct pci_device_id intel_spi_pci_ids[] = { { PCI_VDEVICE(INTEL, 0xa2a4), (unsigned long)&cnl_info }, { PCI_VDEVICE(INTEL, 0xa324), (unsigned long)&cnl_info }, { PCI_VDEVICE(INTEL, 0xa3a4), (unsigned long)&cnl_info }, + { PCI_VDEVICE(INTEL, 0xa823), (unsigned long)&cnl_info }, { }, };MODULE_DEVICE_TABLE (pci, intel_spi_pci_ids);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 14/21 regmap: kunit: Ensure that changed bytes are actually different
In reply to Sasha LevinFrom: Mark Brown <[email protected]>
[ Upstream commit 2f0dbb24f78a333433a2b875c0b76bf55c119cd4 ]
During the cache sync test we verify that values we expect to have been written only to the cache do not appear in the hardware. This works most of the time but since we randomly generate both the original and new values there is a low probability that these values may actually be the same. Wrap get_random_bytes() to ensure that the values are different, there are other tests which should have similar verification that we actually changed something.
While we're at it refactor the test to use three changed values rather than attempting to use one of them twice, that just complicates checking that our new values are actually new.
We use random generation to try to avoid data dependencies in the tests.
--- drivers/base/regmap/regmap-kunit.c | 54 +++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 16 deletions(-)
drivers/base/regmap/regmap-kunit.c +38 -16
@@ -9,6 +9,23 @@#define BLOCK_TEST_SIZE 12 +static void get_changed_bytes (void *orig,void *new,size_t size) +{ +char *o = orig; +char *n = new; +int i; + +get_random_bytes (new, size); + +/* +* This could be nicer and more efficient but we shouldn't +* super care. +*/ +for (i =0 ; i < size; i++) +while (n[i] == o[i]) +get_random_bytes (&n[i],1 ); +} +static const struct regmap_config test_regmap_config = { .max_register =BLOCK_TEST_SIZE , .reg_stride =1 ,
@@ -1131,7 +1148,7 @@ static void raw_sync(struct kunit *test)struct regmap *map;struct regmap_config config;struct regmap_ram_data *data; -u16 val[2 ]; +u16 val[3 ];u16 *hw_buf;unsigned int rval;int i;
@@ -1145,17 +1162,13 @@ static void raw_sync(struct kunit *test) hw_buf = (u16 *)data->vals; -get_random_bytes (&val,sizeof (val)); +get_changed_bytes (&hw_buf[2 ], &val[0 ],sizeof (val));/* Do a regular write and a raw write in cache only mode */ regcache_cache_only (map, true); -KUNIT_EXPECT_EQ (test,0 ,regmap_raw_write (map,2 , val,sizeof (val))); -if (config.val_format_endian ==REGMAP_ENDIAN_BIG ) -KUNIT_EXPECT_EQ (test,0 ,regmap_write (map,6 , -be16_to_cpu (val[0 ]))); -else -KUNIT_EXPECT_EQ (test,0 ,regmap_write (map,6 , -le16_to_cpu (val[0 ]))); +KUNIT_EXPECT_EQ (test,0 ,regmap_raw_write (map,2 , val, +sizeof (u16) *2 )); +KUNIT_EXPECT_EQ (test,0 ,regmap_write (map,4 , val[2 ]));/* We should read back the new values, and defaults for the rest */ for (i =0 ; i < config.max_register +1 ; i++) {
@@ -1164,24 +1177,34 @@ static void raw_sync(struct kunit *test)switch (i) {case 2 :case 3 : -case 6 :if (config.val_format_endian ==REGMAP_ENDIAN_BIG ) {KUNIT_EXPECT_EQ (test, rval, -be16_to_cpu (val[i %2 ])); +be16_to_cpu (val[i -2 ])); }else {KUNIT_EXPECT_EQ (test, rval, -le16_to_cpu (val[i %2 ])); +le16_to_cpu (val[i -2 ])); }break ; +case 4 : +KUNIT_EXPECT_EQ (test, rval, val[i -2 ]); +break ;default :KUNIT_EXPECT_EQ (test, config.reg_defaults[i].def, rval);break ; } } + +/* +* The value written via _write() was translated by the core, +* translate the original copy for comparison purposes. +*/ +if (config.val_format_endian ==REGMAP_ENDIAN_BIG ) + val[2 ] =cpu_to_be16 (val[2 ]); +else + val[2 ] =cpu_to_le16 (val[2 ]);/* The values should not appear in the "hardware" */ -KUNIT_EXPECT_MEMNEQ (test, &hw_buf[2 ], val,sizeof (val)); -KUNIT_EXPECT_MEMNEQ (test, &hw_buf[6 ], val,sizeof (u16)); +KUNIT_EXPECT_MEMNEQ (test, &hw_buf[2 ], &val[0 ],sizeof (val));for (i =0 ; i < config.max_register +1 ; i++) data->written[i] = false;
@@ -1192,8 +1215,7 @@ static void raw_sync(struct kunit *test)KUNIT_EXPECT_EQ (test,0 ,regcache_sync (map));/* The values should now appear in the "hardware" */ -KUNIT_EXPECT_MEMEQ (test, &hw_buf[2 ], val,sizeof (val)); -KUNIT_EXPECT_MEMEQ (test, &hw_buf[6 ], val,sizeof (u16)); +KUNIT_EXPECT_MEMEQ (test, &hw_buf[2 ], &val[0 ],sizeof (val));regmap_exit (map); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 15/21 ASoC: amd: yc: Fix non-functional mic on Lenovo 82UU
In reply to Sasha LevinFrom: Attila Tőkés <[email protected]>
[ Upstream commit f7fe85b229bc30cb5dc95b4e9015a601c9e3a8cd ]
Like many other models, the Lenovo 82UU (Yoga Slim 7 Pro 14ARH7) needs a quirk entry for the internal microphone to function.
--- sound/soc/amd/yc/acp6x-mach.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/soc/amd/yc/acp6x-mach.c +7 -0
@@ -234,6 +234,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "82UG"), } }, + { + .driver_data = &acp6x_card, + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ), + DMI_MATCH(DMI_PRODUCT_NAME, "82UU"), + } + }, { .driver_data = &acp6x_card, .matches = {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 16/21 x86/xen: Add some null pointer checking to smp.c
In reply to Sasha LevinFrom: Kunwu Chan <[email protected]>
[ Upstream commit 3693bb4465e6e32a204a5b86d3ec7e6b9f7e67c2 ]
kasprintf() returns a pointer to dynamically allocated memory which can be NULL upon failure. Ensure the allocation was successful by checking the pointer validity.
--- arch/x86/xen/smp.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
arch/x86/xen/smp.c +12 -0
@@ -65,6 +65,8 @@ int xen_smp_intr_init(unsigned int cpu)char *resched_name, *callfunc_name, *debug_name; resched_name =kasprintf (GFP_KERNEL ,"resched%d" , cpu); +if (!resched_name) + goto fail_mem;per_cpu (xen_resched_irq, cpu).name = resched_name; rc = bind_ipi_to_irqhandler(XEN_RESCHEDULE_VECTOR, cpu,
@@ -77,6 +79,8 @@ int xen_smp_intr_init(unsigned int cpu)per_cpu (xen_resched_irq, cpu).irq = rc; callfunc_name =kasprintf (GFP_KERNEL ,"callfunc%d" , cpu); +if (!callfunc_name) + goto fail_mem;per_cpu (xen_callfunc_irq, cpu).name = callfunc_name; rc = bind_ipi_to_irqhandler(XEN_CALL_FUNCTION_VECTOR, cpu,
@@ -90,6 +94,9 @@ int xen_smp_intr_init(unsigned int cpu)if (!xen_fifo_events) { debug_name =kasprintf (GFP_KERNEL ,"debug%d" , cpu); +if (!debug_name) + goto fail_mem; +per_cpu (xen_debug_irq, cpu).name = debug_name; rc = bind_virq_to_irqhandler(VIRQ_DEBUG, cpu, xen_debug_interrupt,
@@ -101,6 +108,9 @@ int xen_smp_intr_init(unsigned int cpu) } callfunc_name =kasprintf (GFP_KERNEL ,"callfuncsingle%d" , cpu); +if (!callfunc_name) + goto fail_mem; +per_cpu (xen_callfuncsingle_irq, cpu).name = callfunc_name; rc = bind_ipi_to_irqhandler(XEN_CALL_FUNCTION_SINGLE_VECTOR, cpu,
@@ -114,6 +124,8 @@ int xen_smp_intr_init(unsigned int cpu)return 0 ; + fail_mem: + rc = -ENOMEM ; fail:xen_smp_intr_free (cpu);return rc;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 17/21 MIPS: Clear Cause.BD in instruction_pointer_set
In reply to Sasha LevinFrom: Jiaxun Yang <[email protected]>
[ Upstream commit 9d6e21ddf20293b3880ae55b9d14de91c5891c59 ]
Clear Cause.BD after we use instruction_pointer_set to override EPC.
This can prevent exception_epc check against instruction code at new return address.
It won't be considered as "in delay slot" after epc being overridden anyway.
--- arch/mips/include/asm/ptrace.h | 1 + 1 file changed, 1 insertion(+)
arch/mips/include/asm/ptrace.h +1 -0
@@ -60,6 +60,7 @@ static inline void instruction_pointer_set(struct pt_regs *regs, unsigned long val) { regs->cp0_epc = val; + regs->cp0_cause &= ~CAUSEF_BD ; }/* Query offset/name of register from its name/offset */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 18/21 HID: multitouch: Add required quirk for Synaptics 0xcddc device
In reply to Sasha LevinFrom: Manuel Fombuena <[email protected]>
[ Upstream commit 1741a8269e1c51fa08d4bfdf34667387a6eb10ec ]
Add support for the pointing stick (Accupoint) and 2 mouse buttons.
Present on some Toshiba/dynabook Portege X30 and X40 laptops.
It should close https://bugzilla.kernel.org/show_bug.cgi?id=205817
--- drivers/hid/hid-multitouch.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/hid/hid-multitouch.c +4 -0
@@ -2153,6 +2153,10 @@ static const struct hid_device_id mt_devices[] = {HID_DEVICE (BUS_I2C ,HID_GROUP_MULTITOUCH_WIN_8 , USB_VENDOR_ID_SYNAPTICS, 0xcd7e) }, + { .driver_data = MT_CLS_WIN_8_FORCE_MULTI_INPUT, +HID_DEVICE (BUS_I2C ,HID_GROUP_MULTITOUCH_WIN_8 , + USB_VENDOR_ID_SYNAPTICS, 0xcddc) }, + { .driver_data = MT_CLS_WIN_8_FORCE_MULTI_INPUT,HID_DEVICE (BUS_I2C ,HID_GROUP_MULTITOUCH_WIN_8 , USB_VENDOR_ID_SYNAPTICS, 0xce08) },
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 19/21 ASoC: SOF: ipc4-pcm: Workaround for crashed firmware on system suspend
In reply to Sasha LevinFrom: Peter Ujfalusi <[email protected]>
[ Upstream commit c40aad7c81e5fba34b70123ed7ce3397fa62a4d2 ]
When the system is suspended while audio is active, the sof_ipc4_pcm_hw_free() is invoked to reset the pipelines since during suspend the DSP is turned off, streams will be re-started after resume.
If the firmware crashes during while audio is running (or when we reset the stream before suspend) then the sof_ipc4_set_multi_pipeline_state() will fail with IPC error and the state change is interrupted. This will cause misalignment between the kernel and firmware state on next DSP boot resulting errors returned by firmware for IPC messages, eventually failing the audio resume.
On stream close the errors are ignored so the kernel state will be corrected on the next DSP boot, so the second boot after the DSP panic.
If sof_ipc4_trigger_pipelines() is called from sof_ipc4_pcm_hw_free() then state parameter is SOF_IPC4_PIPE_RESET and only in this case.
Treat a forced pipeline reset similarly to how we treat a pcm_free by ignoring error on state sending to allow the kernel's state to be consistent with the state the firmware will have after the next boot.
--- sound/soc/sof/ipc4-pcm.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
sound/soc/sof/ipc4-pcm.c +12 -1
@@ -377,7 +377,18 @@ static int sof_ipc4_trigger_pipelines(struct snd_soc_component *component, ret =sof_ipc4_set_multi_pipeline_state (sdev, state, trigger_list);if (ret <0 ) {dev_err (sdev->dev,"failed to set final state %d for all pipelines\n" , state); - goto free; +/* +* workaround: if the firmware is crashed while setting the +* pipelines to reset state we must ignore the error code and +* reset it to 0. +* Since the firmware is crashed we will not send IPC messages +* and we are going to see errors printed, but the state of the +* widgets will be correct for the next boot. +*/ +if (sdev->fw_state !=SOF_FW_CRASHED || state !=SOF_IPC4_PIPE_RESET ) + goto free; + + ret =0 ; }/* update RUNNING/RESET state for all pipelines that were just triggered */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 20/21 gen_compile_commands: fix invalid escape sequence warning
In reply to Sasha LevinFrom: Andrew Ballance <[email protected]>
[ Upstream commit dae4a0171e25884787da32823b3081b4c2acebb2 ]
With python 3.12, '\#' results in this warning
SyntaxWarning: invalid escape sequence '\#'
--- scripts/clang-tools/gen_compile_commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/clang-tools/gen_compile_commands.py +1 -1
@@ -170,7 +170,7 @@ def process_line(root_directory, command_prefix, file_path): # escape the pound sign '#', either as '\#' or '$(pound)' (depending on the # kernel version). The compile_commands.json file is not interepreted # by Make, so this code replaces the escaped version with '#'. - prefix = command_prefix.replace('\#', '#').replace('$(pound)', '#') + prefix = command_prefix.replace(r'\#', '#').replace('$(pound)', '#') # Use os.path.abspath() to normalize the path resolving '.' and '..' . abs_path = os.path.abspath(os.path.join(root_directory, file_path))
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 21/21 arm64/sve: Lower the maximum allocation for the SVE ptrace regset
In reply to Sasha LevinFrom: Mark Brown <[email protected]>
[ Upstream commit 2813926261e436d33bc74486b51cce60b76edf78 ]
Doug Anderson observed that ChromeOS crashes are being reported which include failing allocations of order 7 during core dumps due to ptrace allocating storage for regsets:
chrome: page allocation failure: order:7,
mode:0x40dc0(GFP_KERNEL|__GFP_COMP|__GFP_ZERO),
nodemask=(null),cpuset=urgent,mems_allowed=0
...
regset_get_alloc+0x1c/0x28
elf_core_dump+0x3d8/0xd8c
do_coredump+0xeb8/0x1378with further investigation showing that this is:
[ 66.957385] DOUG: Allocating 279584 bytes
which is the maximum size of the SVE regset. As Doug observes it is not entirely surprising that such a large allocation of contiguous memory might fail on a long running system.
The SVE regset is currently sized to hold SVE registers with a VQ of SVE_VQ_MAX which is 512, substantially more than the architectural maximum of 16 which we might see even in a system emulating the limits of the architecture. Since we don't expose the size we tell the regset core externally let's define ARCH_SVE_VQ_MAX with the actual architectural maximum and use that for the regset, we'll still overallocate most of the time but much less so which will be helpful even if the core is fixed to not require contiguous allocations.
Specify ARCH_SVE_VQ_MAX in terms of the maximum value that can be written into ZCR_ELx.LEN (where this is set in the hardware). For consistency update the maximum SME vector length to be specified in the same style while we are at it.
We could also teach the ptrace core about runtime discoverable regset sizes but that would be a more invasive change and this is being observed in practical systems.
--- arch/arm64/include/asm/fpsimd.h | 12 ++++++------ arch/arm64/kernel/ptrace.c | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-)
arch/arm64/include/asm/fpsimd.h +6 -6
@@ -36,13 +36,13 @@* When we defined the maximum SVE vector length we defined the ABI so * that the maximum vector length included all the reserved for future * expansion bits in ZCR rather than those just currently defined by -* the architecture. While SME follows a similar pattern the fact that -* it includes a square matrix means that any allocations that attempt -* to cover the maximum potential vector length (such as happen with -* the regset used for ptrace) end up being extremely large. Define -* the much lower actual limit for use in such situations. +* the architecture. Using this length to allocate worst size buffers +* results in excessively large allocations, and this effect is even +* more pronounced for SME due to ZA. Define more suitable VLs for +* these situations. */ -#define SME_VQ_MAX 16 +#define ARCH_SVE_VQ_MAX ((ZCR_ELx_LEN_MASK >> ZCR_ELx_LEN_SHIFT) + 1) +#define SME_VQ_MAX ((SMCR_ELx_LEN_MASK >> SMCR_ELx_LEN_SHIFT) + 1)struct task_struct ;
arch/arm64/kernel/ptrace.c +2 -1
@@ -1499,7 +1499,8 @@ static const struct user_regset aarch64_regsets[] = { #ifdef CONFIG_ARM64_SVE [REGSET_SVE ] = {/* Scalable Vector Extension */ .core_note_type =NT_ARM_SVE , - .n =DIV_ROUND_UP (SVE_PT_SIZE (SVE_VQ_MAX ,SVE_PT_REGS_SVE ), + .n =DIV_ROUND_UP (SVE_PT_SIZE (ARCH_SVE_VQ_MAX , +SVE_PT_REGS_SVE ),SVE_VQ_BYTES ), .size =SVE_VQ_BYTES , .align = SVE_VQ_BYTES,
Signature · 1 line
2.43.0
Re: [PATCH AUTOSEL 6.6 06/21] arm64: jump_label: use constraints "Si" instead of "i"
In reply to Sasha LevinQuoted 3 lines · Sasha Levin
From: Fangrui Song <[email protected]>
[ Upstream commit
f9daab0ad01cf9d165dbbbf106ca4e61d06e7fe8]
Please drop this; same story as wit the v6.7 backport:
https://lore.kernel.org/lkml/ZeCpOPDi18OBEclz@FVFF77S0Q05N/
Mark.
Quoted 64 lines
The generic constraint "i" seems to be copied from x86 or arm (and with a redundant generic operand modifier "c"). It works with -fno-PIE but not with -fPIE/-fPIC in GCC's aarch64 port.
The machine constraint "S", which denotes a symbol or label reference with a constant offset, supports PIC and has been available in GCC since 2012 and in Clang since 7.0. However, Clang before 19 does not support "S" on a symbol with a constant offset [1] (e.g.
static_key_false(&nf_hooks_needed[pf][hook])ininclude/linux/netfilter.h), so we use "i" as a fallback.Suggested-by Ard Biesheuvel <[email protected]>Signed-off-by Fangrui Song <[email protected]>Acked-by Mark Rutland <[email protected]>Signed-off-by Will Deacon <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- arch/arm64/include/asm/jump_label.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)arch/arm64/include/asm/jump_label.h +8
-4@@ -15,6 +15,10 @@#define JUMP_LABEL_NOP_SIZE AARCH64_INSN_SIZE +/* +* Prefer the constraint "S" to support PIC with GCC. Clang before 19 does not +* support "S" on a symbol with a constant offset, so we use "i" as a fallback. +*/ static __always_inline bool arch_static_branch(struct static_key * const key,const bool branch) {@@ -23,9 +27,9 @@ static __always_inline bool arch_static_branch(struct static_key * const key," .pushsection __jump_table, \"aw\" \n\t" " .align 3 \n\t" " .long 1b - ., %l[l_yes] - . \n\t" - " .quad %c0 - . \n\t" +" .quad (%[key] - .) + %[bit0] \n\t" " .popsection \n\t" - : : "i"(&((char *)key)[branch]) : : l_yes); + : : [key]"Si"(key), [bit0]"i"(branch) : : l_yes);return false; l_yes:@@ -40,9 +44,9 @@ static __always_inline bool arch_static_branch_jump(struct static_key * const ke" .pushsection __jump_table, \"aw\" \n\t" " .align 3 \n\t" " .long 1b - ., %l[l_yes] - . \n\t" - " .quad %c0 - . \n\t" +" .quad (%[key] - .) + %[bit0] \n\t" " .popsection \n\t" - : : "i"(&((char *)key)[branch]) : : l_yes); + : : [key]"Si"(key), [bit0]"i"(branch) : : l_yes);return false; l_yes:Signature · 1 line
2.43.0
Re: [PATCH AUTOSEL 6.6 21/21] arm64/sve: Lower the maximum allocation for the SVE ptrace regset
In reply to Sasha LevinHi,
Quoted 49 lines · Sasha Levin
From: Mark Brown <[email protected]>
[ Upstream commit
2813926261e436d33bc74486b51cce60b76edf78]Doug Anderson observed that ChromeOS crashes are being reported which include failing allocations of order 7 during core dumps due to ptrace allocating storage for regsets:
chrome: page allocation failure: order:7,
mode:0x40dc0(GFP_KERNEL|__GFP_COMP|__GFP_ZERO), nodemask=(null),cpuset=urgent,mems_allowed=0 ... regset_get_alloc+0x1c/0x28 elf_core_dump+0x3d8/0xd8c do_coredump+0xeb8/0x1378with further investigation showing that this is:
[ 66.957385] DOUG: Allocating 279584 byteswhich is the maximum size of the SVE regset. As Doug observes it is not entirely surprising that such a large allocation of contiguous memory might fail on a long running system.
The SVE regset is currently sized to hold SVE registers with a VQ of
SVE_VQ_MAXwhich is 512, substantially more than the architectural maximum of 16 which we might see even in a system emulating the limits of the architecture. Since we don't expose the size we tell the regset core externally let's defineARCH_SVE_VQ_MAXwith the actual architectural maximum and use that for the regset, we'll still overallocate most of the time but much less so which will be helpful even if the core is fixed to not require contiguous allocations.Specify
ARCH_SVE_VQ_MAXin terms of the maximum value that can be written into ZCR_ELx.LEN (where this is set in the hardware). For consistency update the maximum SME vector length to be specified in the same style while we are at it.We could also teach the ptrace core about runtime discoverable regset sizes but that would be a more invasive change and this is being observed in practical systems.
Reported-by Doug Anderson <[email protected]>Signed-off-by Mark Brown <[email protected]>Tested-by Douglas Anderson <[email protected]>Link https://lore.kernel.org/r/20240213-arm64-sve-ptrace-regset-size-v2-1-c7600ca74b9b@kernel.org open hereSigned-off-by Will Deacon <[email protected]>Signed-off-by Sasha Levin <[email protected]>
Quoted 4 lines
--- arch/arm64/include/asm/fpsimd.h | 12 ++++++------ arch/arm64/kernel/ptrace.c | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-)
As I mentioned [1], there's a hidden dependency here and without it the patch doesn't actually do anything useful in kernel 6.6 nor kernel 6.1. Maybe the right answer is to backport this with the hardcoded value of "16" for those older kernels? Maybe Mark has a better suggestion?
[1] https://lore.kernel.org/r/CAD=FV=WSi=9V-Oe5eq0J-Uew45cX9JfgB8me-Nw-iFRfXm59Xg@mail.gmail.com
Mark Brown
maintainerRe: [PATCH AUTOSEL 6.6 21/21] arm64/sve: Lower the maximum allocation for the SVE ptrace regset
Quoted 5 lines · Doug Anderson
As I mentioned [1], there's a hidden dependency here and without it the patch doesn't actually do anything useful in kernel 6.6 nor kernel 6.1. Maybe the right answer is to backport this with the hardcoded value of "16" for those older kernels? Maybe Mark has a better suggestion?
Your suggestion should be fine.
Re: [PATCH AUTOSEL 6.6 21/21] arm64/sve: Lower the maximum allocation for the SVE ptrace regset
Hi,
Quoted 10 lines · Mark Brown
Quoted 5 lines · Doug Anderson
As I mentioned [1], there's a hidden dependency here and without it the patch doesn't actually do anything useful in kernel 6.6 nor kernel 6.1. Maybe the right answer is to backport this with the hardcoded value of "16" for those older kernels? Maybe Mark has a better suggestion?
Your suggestion should be fine.
Crud. Ignore me. The patch is fine as-is for 6.1, 6.6, and 6.7. :(
git tag --contains f171f9e4097d
...shows that the needed patch is actually in 5.19+
Instead of using the above "git tag --contains", I was naively just running:
git grep ZCR_ELx_LEN_SIZE
...and I saw that it still came back 9 on v6.6. ...but that's because it was still set as 9 in the tools directory and I didn't notice.
Sorry for the noise. We could still do the hardcoded solution of defining it as 16 for 5.15 and older if folks want.
-Doug