From: Sasha Levin Date: Mon, 29 Nov 2021 00:41:01 +0000 (-0500) Subject: Fixes for 4.19 X-Git-Tag: v5.15.6~48 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bb94d3a3631b83e1ef06921be7f2eaa3fbf50580;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 4.19 Signed-off-by: Sasha Levin --- diff --git a/queue-4.19/arm-dts-bcm5301x-add-interrupt-properties-to-gpio-no.patch b/queue-4.19/arm-dts-bcm5301x-add-interrupt-properties-to-gpio-no.patch new file mode 100644 index 00000000000..afd9b910e93 --- /dev/null +++ b/queue-4.19/arm-dts-bcm5301x-add-interrupt-properties-to-gpio-no.patch @@ -0,0 +1,36 @@ +From 6a2d57c8544dd58c2be49f12fc34d98ddc80cd5a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 28 Oct 2021 09:46:53 -0700 +Subject: ARM: dts: BCM5301X: Add interrupt properties to GPIO node + +From: Florian Fainelli + +[ Upstream commit 40f7342f0587639e5ad625adaa15efdd3cffb18f ] + +The GPIO controller is also an interrupt controller provider and is +currently missing the appropriate 'interrupt-controller' and +'#interrupt-cells' properties to denote that. + +Fixes: fb026d3de33b ("ARM: BCM5301X: Add Broadcom's bus-axi to the DTS file") +Signed-off-by: Florian Fainelli +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/bcm5301x.dtsi | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/arch/arm/boot/dts/bcm5301x.dtsi b/arch/arm/boot/dts/bcm5301x.dtsi +index bb8b15e42fe93..6edc4bd1e7eaf 100644 +--- a/arch/arm/boot/dts/bcm5301x.dtsi ++++ b/arch/arm/boot/dts/bcm5301x.dtsi +@@ -239,6 +239,8 @@ chipcommon: chipcommon@0 { + + gpio-controller; + #gpio-cells = <2>; ++ interrupt-controller; ++ #interrupt-cells = <2>; + }; + + pcie0: pcie@12000 { +-- +2.33.0 + diff --git a/queue-4.19/arm-dts-bcm5301x-fix-i2c-controller-interrupt.patch b/queue-4.19/arm-dts-bcm5301x-fix-i2c-controller-interrupt.patch new file mode 100644 index 00000000000..5b5a67f17a4 --- /dev/null +++ b/queue-4.19/arm-dts-bcm5301x-fix-i2c-controller-interrupt.patch @@ -0,0 +1,38 @@ +From 0d7b9eec91aba2b635fb77aa31b8f06d0c33554a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 27 Oct 2021 12:37:29 -0700 +Subject: ARM: dts: BCM5301X: Fix I2C controller interrupt + +From: Florian Fainelli + +[ Upstream commit 754c4050a00e802e122690112fc2c3a6abafa7e2 ] + +The I2C interrupt controller line is off by 32 because the datasheet +describes interrupt inputs into the GIC which are for Shared Peripheral +Interrupts and are starting at offset 32. The ARM GIC binding expects +the SPI interrupts to be numbered from 0 relative to the SPI base. + +Fixes: bb097e3e0045 ("ARM: dts: BCM5301X: Add I2C support to the DT") +Tested-by: Christian Lamparter +Signed-off-by: Florian Fainelli +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/bcm5301x.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/bcm5301x.dtsi b/arch/arm/boot/dts/bcm5301x.dtsi +index fa3422c4caec1..bb8b15e42fe93 100644 +--- a/arch/arm/boot/dts/bcm5301x.dtsi ++++ b/arch/arm/boot/dts/bcm5301x.dtsi +@@ -384,7 +384,7 @@ usb3_dmp: syscon@18105000 { + i2c0: i2c@18009000 { + compatible = "brcm,iproc-i2c"; + reg = <0x18009000 0x50>; +- interrupts = ; ++ interrupts = ; + #address-cells = <1>; + #size-cells = <0>; + clock-frequency = <100000>; +-- +2.33.0 + diff --git a/queue-4.19/arm-socfpga-fix-crash-with-config_fortiry_source.patch b/queue-4.19/arm-socfpga-fix-crash-with-config_fortiry_source.patch new file mode 100644 index 00000000000..5a6c54ba1e8 --- /dev/null +++ b/queue-4.19/arm-socfpga-fix-crash-with-config_fortiry_source.patch @@ -0,0 +1,81 @@ +From 190d9a52c33a3034f5ce310d711df24f500ef65f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 18 Nov 2021 15:25:08 +0100 +Subject: ARM: socfpga: Fix crash with CONFIG_FORTIRY_SOURCE + +From: Takashi Iwai + +[ Upstream commit 187bea472600dcc8d2eb714335053264dd437172 ] + +When CONFIG_FORTIFY_SOURCE is set, memcpy() checks the potential +buffer overflow and panics. The code in sofcpga bootstrapping +contains the memcpy() calls are mistakenly translated as the shorter +size, hence it triggers a panic as if it were overflowing. + +This patch changes the secondary_trampoline and *_end definitions +to arrays for avoiding the false-positive crash above. + +Fixes: 9c4566a117a6 ("ARM: socfpga: Enable SMP for socfpga") +Suggested-by: Kees Cook +Buglink: https://bugzilla.suse.com/show_bug.cgi?id=1192473 +Link: https://lore.kernel.org/r/20211117193244.31162-1-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Dinh Nguyen +Signed-off-by: Sasha Levin +--- + arch/arm/mach-socfpga/core.h | 2 +- + arch/arm/mach-socfpga/platsmp.c | 8 ++++---- + 2 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/arch/arm/mach-socfpga/core.h b/arch/arm/mach-socfpga/core.h +index 65e1817d8afe6..692a287a8712d 100644 +--- a/arch/arm/mach-socfpga/core.h ++++ b/arch/arm/mach-socfpga/core.h +@@ -48,7 +48,7 @@ extern void __iomem *sdr_ctl_base_addr; + u32 socfpga_sdram_self_refresh(u32 sdr_base); + extern unsigned int socfpga_sdram_self_refresh_sz; + +-extern char secondary_trampoline, secondary_trampoline_end; ++extern char secondary_trampoline[], secondary_trampoline_end[]; + + extern unsigned long socfpga_cpu1start_addr; + +diff --git a/arch/arm/mach-socfpga/platsmp.c b/arch/arm/mach-socfpga/platsmp.c +index 0ee76772b5074..a272999ce04b9 100644 +--- a/arch/arm/mach-socfpga/platsmp.c ++++ b/arch/arm/mach-socfpga/platsmp.c +@@ -31,14 +31,14 @@ + + static int socfpga_boot_secondary(unsigned int cpu, struct task_struct *idle) + { +- int trampoline_size = &secondary_trampoline_end - &secondary_trampoline; ++ int trampoline_size = secondary_trampoline_end - secondary_trampoline; + + if (socfpga_cpu1start_addr) { + /* This will put CPU #1 into reset. */ + writel(RSTMGR_MPUMODRST_CPU1, + rst_manager_base_addr + SOCFPGA_RSTMGR_MODMPURST); + +- memcpy(phys_to_virt(0), &secondary_trampoline, trampoline_size); ++ memcpy(phys_to_virt(0), secondary_trampoline, trampoline_size); + + writel(__pa_symbol(secondary_startup), + sys_manager_base_addr + (socfpga_cpu1start_addr & 0x000000ff)); +@@ -56,12 +56,12 @@ static int socfpga_boot_secondary(unsigned int cpu, struct task_struct *idle) + + static int socfpga_a10_boot_secondary(unsigned int cpu, struct task_struct *idle) + { +- int trampoline_size = &secondary_trampoline_end - &secondary_trampoline; ++ int trampoline_size = secondary_trampoline_end - secondary_trampoline; + + if (socfpga_cpu1start_addr) { + writel(RSTMGR_MPUMODRST_CPU1, rst_manager_base_addr + + SOCFPGA_A10_RSTMGR_MODMPURST); +- memcpy(phys_to_virt(0), &secondary_trampoline, trampoline_size); ++ memcpy(phys_to_virt(0), secondary_trampoline, trampoline_size); + + writel(__pa_symbol(secondary_startup), + sys_manager_base_addr + (socfpga_cpu1start_addr & 0x00000fff)); +-- +2.33.0 + diff --git a/queue-4.19/asoc-qdsp6-q6routing-conditionally-reset-frontend-mi.patch b/queue-4.19/asoc-qdsp6-q6routing-conditionally-reset-frontend-mi.patch new file mode 100644 index 00000000000..f644ec35420 --- /dev/null +++ b/queue-4.19/asoc-qdsp6-q6routing-conditionally-reset-frontend-mi.patch @@ -0,0 +1,55 @@ +From 9f1b7a9824a207f344e8f76d731fb1f54843535b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 16 Nov 2021 11:47:18 +0000 +Subject: ASoC: qdsp6: q6routing: Conditionally reset FrontEnd Mixer + +From: Srinivas Kandagatla + +[ Upstream commit 861afeac7990587588d057b2c0b3222331c3da29 ] + +Stream IDs are reused across multiple BackEnd mixers, do not reset the +stream mixers if they are not already set for that particular FrontEnd. + +Ex: +amixer cset iface=MIXER,name='SLIMBUS_0_RX Audio Mixer MultiMedia1' 1 + +would set the MultiMedia1 steam for SLIMBUS_0_RX, however doing below +command will reset previously setup MultiMedia1 stream, because both of them +are using MultiMedia1 PCM stream. + +amixer cset iface=MIXER,name='SLIMBUS_2_RX Audio Mixer MultiMedia1' 0 + +reset the FrontEnd Mixers conditionally to fix this issue. + +This is more noticeable in desktop setup, where in alsactl tries to restore +the alsa state and overwriting the previous mixer settings. + +Fixes: e3a33673e845 ("ASoC: qdsp6: q6routing: Add q6routing driver") +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20211116114721.12517-3-srinivas.kandagatla@linaro.org +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/qcom/qdsp6/q6routing.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/sound/soc/qcom/qdsp6/q6routing.c b/sound/soc/qcom/qdsp6/q6routing.c +index 44eee18c658ae..7d2c5de380317 100644 +--- a/sound/soc/qcom/qdsp6/q6routing.c ++++ b/sound/soc/qcom/qdsp6/q6routing.c +@@ -443,7 +443,11 @@ static int msm_routing_put_audio_mixer(struct snd_kcontrol *kcontrol, + session->port_id = be_id; + snd_soc_dapm_mixer_update_power(dapm, kcontrol, 1, update); + } else { +- session->port_id = -1; ++ if (session->port_id == be_id) { ++ session->port_id = -1; ++ return 0; ++ } ++ + snd_soc_dapm_mixer_update_power(dapm, kcontrol, 0, update); + } + +-- +2.33.0 + diff --git a/queue-4.19/asoc-topology-add-missing-rwsem-around-snd_ctl_remov.patch b/queue-4.19/asoc-topology-add-missing-rwsem-around-snd_ctl_remov.patch new file mode 100644 index 00000000000..4c4a2a98997 --- /dev/null +++ b/queue-4.19/asoc-topology-add-missing-rwsem-around-snd_ctl_remov.patch @@ -0,0 +1,53 @@ +From 0040cb5e3e97cc88a88e4f2875126a9f0eaa94b3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 16 Nov 2021 08:18:12 +0100 +Subject: ASoC: topology: Add missing rwsem around snd_ctl_remove() calls + +From: Takashi Iwai + +[ Upstream commit 7e567b5ae06315ef2d70666b149962e2bb4b97af ] + +snd_ctl_remove() has to be called with card->controls_rwsem held (when +called after the card instantiation). This patch add the missing +rwsem calls around it. + +Fixes: 8a9782346dcc ("ASoC: topology: Add topology core") +Signed-off-by: Takashi Iwai +Link: https://lore.kernel.org/r/20211116071812.18109-1-tiwai@suse.de +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/soc-topology.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c +index 2c6598e07dde3..ccf6dd9411975 100644 +--- a/sound/soc/soc-topology.c ++++ b/sound/soc/soc-topology.c +@@ -2565,6 +2565,7 @@ EXPORT_SYMBOL_GPL(snd_soc_tplg_widget_remove_all); + /* remove dynamic controls from the component driver */ + int snd_soc_tplg_component_remove(struct snd_soc_component *comp, u32 index) + { ++ struct snd_card *card = comp->card->snd_card; + struct snd_soc_dobj *dobj, *next_dobj; + int pass = SOC_TPLG_PASS_END; + +@@ -2572,6 +2573,7 @@ int snd_soc_tplg_component_remove(struct snd_soc_component *comp, u32 index) + while (pass >= SOC_TPLG_PASS_START) { + + /* remove mixer controls */ ++ down_write(&card->controls_rwsem); + list_for_each_entry_safe(dobj, next_dobj, &comp->dobj_list, + list) { + +@@ -2605,6 +2607,7 @@ int snd_soc_tplg_component_remove(struct snd_soc_component *comp, u32 index) + break; + } + } ++ up_write(&card->controls_rwsem); + pass--; + } + +-- +2.33.0 + diff --git a/queue-4.19/drm-vc4-fix-error-code-in-vc4_create_object.patch b/queue-4.19/drm-vc4-fix-error-code-in-vc4_create_object.patch new file mode 100644 index 00000000000..67c83116005 --- /dev/null +++ b/queue-4.19/drm-vc4-fix-error-code-in-vc4_create_object.patch @@ -0,0 +1,38 @@ +From 0e93a9ad9a0f8eb22762156b8b9027ea932736bc Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 18 Nov 2021 14:14:16 +0300 +Subject: drm/vc4: fix error code in vc4_create_object() + +From: Dan Carpenter + +[ Upstream commit 96c5f82ef0a145d3e56e5b26f2bf6dcd2ffeae1c ] + +The ->gem_create_object() functions are supposed to return NULL if there +is an error. None of the callers expect error pointers so returing one +will lead to an Oops. See drm_gem_vram_create(), for example. + +Fixes: c826a6e10644 ("drm/vc4: Add a BO cache.") +Signed-off-by: Dan Carpenter +Signed-off-by: Maxime Ripard +Link: https://patchwork.freedesktop.org/patch/msgid/20211118111416.GC1147@kili +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/vc4/vc4_bo.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c +index 8dcce7182bb7c..1e28ff9815997 100644 +--- a/drivers/gpu/drm/vc4/vc4_bo.c ++++ b/drivers/gpu/drm/vc4/vc4_bo.c +@@ -417,7 +417,7 @@ struct drm_gem_object *vc4_create_object(struct drm_device *dev, size_t size) + + bo = kzalloc(sizeof(*bo), GFP_KERNEL); + if (!bo) +- return ERR_PTR(-ENOMEM); ++ return NULL; + + bo->madv = VC4_MADV_WILLNEED; + refcount_set(&bo->usecnt, 0); +-- +2.33.0 + diff --git a/queue-4.19/firmware-arm_scmi-pm-propagate-return-value-to-calle.patch b/queue-4.19/firmware-arm_scmi-pm-propagate-return-value-to-calle.patch new file mode 100644 index 00000000000..de119b44fb3 --- /dev/null +++ b/queue-4.19/firmware-arm_scmi-pm-propagate-return-value-to-calle.patch @@ -0,0 +1,39 @@ +From 728e96c235aad3b3c54d6b4f44d5af4410e28e84 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 16 Nov 2021 14:42:27 +0800 +Subject: firmware: arm_scmi: pm: Propagate return value to caller + +From: Peng Fan + +[ Upstream commit 1446fc6c678e8d8b31606a4b877abe205f344b38 ] + +of_genpd_add_provider_onecell may return error, so let's propagate +its return value to caller + +Link: https://lore.kernel.org/r/20211116064227.20571-1-peng.fan@oss.nxp.com +Fixes: 898216c97ed2 ("firmware: arm_scmi: add device power domain support using genpd") +Signed-off-by: Peng Fan +Signed-off-by: Sudeep Holla +Signed-off-by: Sasha Levin +--- + drivers/firmware/arm_scmi/scmi_pm_domain.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/drivers/firmware/arm_scmi/scmi_pm_domain.c b/drivers/firmware/arm_scmi/scmi_pm_domain.c +index 041f8152272bf..177874adccf0d 100644 +--- a/drivers/firmware/arm_scmi/scmi_pm_domain.c ++++ b/drivers/firmware/arm_scmi/scmi_pm_domain.c +@@ -106,9 +106,7 @@ static int scmi_pm_domain_probe(struct scmi_device *sdev) + scmi_pd_data->domains = domains; + scmi_pd_data->num_domains = num_domains; + +- of_genpd_add_provider_onecell(np, scmi_pd_data); +- +- return 0; ++ return of_genpd_add_provider_onecell(np, scmi_pd_data); + } + + static const struct scmi_device_id scmi_id_table[] = { +-- +2.33.0 + diff --git a/queue-4.19/ipv6-fix-typos-in-__ip6_finish_output.patch b/queue-4.19/ipv6-fix-typos-in-__ip6_finish_output.patch new file mode 100644 index 00000000000..4c0ae6377b7 --- /dev/null +++ b/queue-4.19/ipv6-fix-typos-in-__ip6_finish_output.patch @@ -0,0 +1,45 @@ +From c78c143d2c134e4df57dedea4df8e5626c2e99e0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 18 Nov 2021 17:37:58 -0800 +Subject: ipv6: fix typos in __ip6_finish_output() + +From: Eric Dumazet + +[ Upstream commit 19d36c5f294879949c9d6f57cb61d39cc4c48553 ] + +We deal with IPv6 packets, so we need to use IP6CB(skb)->flags and +IP6SKB_REROUTED, instead of IPCB(skb)->flags and IPSKB_REROUTED + +Found by code inspection, please double check that fixing this bug +does not surface other bugs. + +Fixes: 09ee9dba9611 ("ipv6: Reinject IPv6 packets if IPsec policy matches after SNAT") +Signed-off-by: Eric Dumazet +Cc: Tobias Brunner +Cc: Steffen Klassert +Cc: David Ahern +Reviewed-by: David Ahern +Tested-by: Tobias Brunner +Acked-by: Tobias Brunner +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + net/ipv6/ip6_output.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c +index fc36f3b0dceb3..251ec12517e93 100644 +--- a/net/ipv6/ip6_output.c ++++ b/net/ipv6/ip6_output.c +@@ -175,7 +175,7 @@ static int ip6_finish_output(struct net *net, struct sock *sk, struct sk_buff *s + #if defined(CONFIG_NETFILTER) && defined(CONFIG_XFRM) + /* Policy lookup after SNAT yielded a new policy */ + if (skb_dst(skb)->xfrm) { +- IPCB(skb)->flags |= IPSKB_REROUTED; ++ IP6CB(skb)->flags |= IP6SKB_REROUTED; + return dst_output(net, sk, skb); + } + #endif +-- +2.33.0 + diff --git a/queue-4.19/mips-use-3-level-pgtable-for-64kb-page-size-on-mips_.patch b/queue-4.19/mips-use-3-level-pgtable-for-64kb-page-size-on-mips_.patch new file mode 100644 index 00000000000..1a89d26b8a9 --- /dev/null +++ b/queue-4.19/mips-use-3-level-pgtable-for-64kb-page-size-on-mips_.patch @@ -0,0 +1,39 @@ +From b3cfe83373ef63e8f5c7729a8b8edec4de9771bf Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 25 Nov 2021 18:59:48 +0800 +Subject: MIPS: use 3-level pgtable for 64KB page size on MIPS_VA_BITS_48 + +From: Huang Pei + +[ Upstream commit 41ce097f714401e6ad8f3f5eb30d7f91b0b5e495 ] + +It hangup when booting Loongson 3A1000 with BOTH +CONFIG_PAGE_SIZE_64KB and CONFIG_MIPS_VA_BITS_48, that it turn +out to use 2-level pgtable instead of 3-level. 64KB page size +with 2-level pgtable only cover 42 bits VA, use 3-level pgtable +to cover all 48 bits VA(55 bits) + +Fixes: 1e321fa917fb ("MIPS64: Support of at least 48 bits of SEGBITS) +Signed-off-by: Huang Pei +Signed-off-by: Thomas Bogendoerfer +Signed-off-by: Sasha Levin +--- + arch/mips/Kconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig +index e513528be3ad7..8a227a80f6bd5 100644 +--- a/arch/mips/Kconfig ++++ b/arch/mips/Kconfig +@@ -2991,7 +2991,7 @@ config HAVE_LATENCYTOP_SUPPORT + config PGTABLE_LEVELS + int + default 4 if PAGE_SIZE_4KB && MIPS_VA_BITS_48 +- default 3 if 64BIT && !PAGE_SIZE_64KB ++ default 3 if 64BIT && (!PAGE_SIZE_64KB || MIPS_VA_BITS_48) + default 2 + + config MIPS_AUTO_PFN_OFFSET +-- +2.33.0 + diff --git a/queue-4.19/net-hns3-fix-vf-rss-failed-problem-after-pf-enable-m.patch b/queue-4.19/net-hns3-fix-vf-rss-failed-problem-after-pf-enable-m.patch new file mode 100644 index 00000000000..ce72dfdf644 --- /dev/null +++ b/queue-4.19/net-hns3-fix-vf-rss-failed-problem-after-pf-enable-m.patch @@ -0,0 +1,49 @@ +From 1d64495e194b658e856057858d7bd1c118994fc3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 26 Nov 2021 20:03:15 +0800 +Subject: net: hns3: fix VF RSS failed problem after PF enable multi-TCs + +From: Guangbin Huang + +[ Upstream commit 8d2ad993aa05c0768f00c886c9d369cd97a337ac ] + +When PF is set to multi-TCs and configured mapping relationship between +priorities and TCs, the hardware will active these settings for this PF +and its VFs. + +In this case when VF just uses one TC and its rx packets contain priority, +and if the priority is not mapped to TC0, as other TCs of VF is not valid, +hardware always put this kind of packets to the queue 0. It cause this kind +of packets of VF can not be used RSS function. + +To fix this problem, set tc mode of all unused TCs of VF to the setting of +TC0, then rx packet with priority which map to unused TC will be direct to +TC0. + +Fixes: e2cb1dec9779 ("net: hns3: Add HNS3 VF HCL(Hardware Compatibility Layer) Support") +Signed-off-by: Guangbin Huang +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +index fd5375b5991bb..a257bf635bc24 100644 +--- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c ++++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +@@ -451,9 +451,9 @@ static int hclgevf_set_rss_tc_mode(struct hclgevf_dev *hdev, u16 rss_size) + roundup_size = ilog2(roundup_size); + + for (i = 0; i < HCLGEVF_MAX_TC_NUM; i++) { +- tc_valid[i] = !!(hdev->hw_tc_map & BIT(i)); ++ tc_valid[i] = 1; + tc_size[i] = roundup_size; +- tc_offset[i] = rss_size * i; ++ tc_offset[i] = (hdev->hw_tc_map & BIT(i)) ? rss_size * i : 0; + } + + hclgevf_cmd_setup_basic_desc(&desc, HCLGEVF_OPC_RSS_TC_MODE, false); +-- +2.33.0 + diff --git a/queue-4.19/net-ieee802154-handle-iftypes-as-u32.patch b/queue-4.19/net-ieee802154-handle-iftypes-as-u32.patch new file mode 100644 index 00000000000..10bc68f3294 --- /dev/null +++ b/queue-4.19/net-ieee802154-handle-iftypes-as-u32.patch @@ -0,0 +1,56 @@ +From dce75fb398a70e1697d971646d3582fb8030c3af Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 11 Nov 2021 22:09:16 -0500 +Subject: net: ieee802154: handle iftypes as u32 + +From: Alexander Aring + +[ Upstream commit 451dc48c806a7ce9fbec5e7a24ccf4b2c936e834 ] + +This patch fixes an issue that an u32 netlink value is handled as a +signed enum value which doesn't fit into the range of u32 netlink type. +If it's handled as -1 value some BIT() evaluation ends in a +shift-out-of-bounds issue. To solve the issue we set the to u32 max which +is s32 "-1" value to keep backwards compatibility and let the followed enum +values start counting at 0. This brings the compiler to never handle the +enum as signed and a check if the value is above NL802154_IFTYPE_MAX should +filter -1 out. + +Fixes: f3ea5e44231a ("ieee802154: add new interface command") +Signed-off-by: Alexander Aring +Link: https://lore.kernel.org/r/20211112030916.685793-1-aahringo@redhat.com +Signed-off-by: Stefan Schmidt +Signed-off-by: Sasha Levin +--- + include/net/nl802154.h | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/include/net/nl802154.h b/include/net/nl802154.h +index ddcee128f5d9a..145acb8f25095 100644 +--- a/include/net/nl802154.h ++++ b/include/net/nl802154.h +@@ -19,6 +19,8 @@ + * + */ + ++#include ++ + #define NL802154_GENL_NAME "nl802154" + + enum nl802154_commands { +@@ -150,10 +152,9 @@ enum nl802154_attrs { + }; + + enum nl802154_iftype { +- /* for backwards compatibility TODO */ +- NL802154_IFTYPE_UNSPEC = -1, ++ NL802154_IFTYPE_UNSPEC = (~(__u32)0), + +- NL802154_IFTYPE_NODE, ++ NL802154_IFTYPE_NODE = 0, + NL802154_IFTYPE_MONITOR, + NL802154_IFTYPE_COORD, + +-- +2.33.0 + diff --git a/queue-4.19/net-smc-don-t-call-clcsock-shutdown-twice-when-smc-s.patch b/queue-4.19/net-smc-don-t-call-clcsock-shutdown-twice-when-smc-s.patch new file mode 100644 index 00000000000..2fd52b4bb3b --- /dev/null +++ b/queue-4.19/net-smc-don-t-call-clcsock-shutdown-twice-when-smc-s.patch @@ -0,0 +1,67 @@ +From 2eeee34f576dfd61b076adc4c95fa610848f16cf Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 26 Nov 2021 10:41:35 +0800 +Subject: net/smc: Don't call clcsock shutdown twice when smc shutdown + +From: Tony Lu + +[ Upstream commit bacb6c1e47691cda4a95056c21b5487fb7199fcc ] + +When applications call shutdown() with SHUT_RDWR in userspace, +smc_close_active() calls kernel_sock_shutdown(), and it is called +twice in smc_shutdown(). + +This fixes this by checking sk_state before do clcsock shutdown, and +avoids missing the application's call of smc_shutdown(). + +Link: https://lore.kernel.org/linux-s390/1f67548e-cbf6-0dce-82b5-10288a4583bd@linux.ibm.com/ +Fixes: 606a63c9783a ("net/smc: Ensure the active closing peer first closes clcsock") +Signed-off-by: Tony Lu +Reviewed-by: Wen Gu +Acked-by: Karsten Graul +Link: https://lore.kernel.org/r/20211126024134.45693-1-tonylu@linux.alibaba.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + net/smc/af_smc.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c +index 9aab4ab8161bd..4c904ab29e0e6 100644 +--- a/net/smc/af_smc.c ++++ b/net/smc/af_smc.c +@@ -1589,8 +1589,10 @@ static __poll_t smc_poll(struct file *file, struct socket *sock, + static int smc_shutdown(struct socket *sock, int how) + { + struct sock *sk = sock->sk; ++ bool do_shutdown = true; + struct smc_sock *smc; + int rc = -EINVAL; ++ int old_state; + int rc1 = 0; + + smc = smc_sk(sk); +@@ -1617,7 +1619,11 @@ static int smc_shutdown(struct socket *sock, int how) + } + switch (how) { + case SHUT_RDWR: /* shutdown in both directions */ ++ old_state = sk->sk_state; + rc = smc_close_active(smc); ++ if (old_state == SMC_ACTIVE && ++ sk->sk_state == SMC_PEERCLOSEWAIT1) ++ do_shutdown = false; + break; + case SHUT_WR: + rc = smc_close_shutdown_write(smc); +@@ -1627,7 +1633,7 @@ static int smc_shutdown(struct socket *sock, int how) + /* nothing more to do because peer is not involved */ + break; + } +- if (smc->clcsock) ++ if (do_shutdown && smc->clcsock) + rc1 = kernel_sock_shutdown(smc->clcsock, how); + /* map sock_shutdown_cmd constants to sk_shutdown value range */ + sk->sk_shutdown |= how + 1; +-- +2.33.0 + diff --git a/queue-4.19/net-smc-ensure-the-active-closing-peer-first-closes-.patch b/queue-4.19/net-smc-ensure-the-active-closing-peer-first-closes-.patch new file mode 100644 index 00000000000..121bc7ff300 --- /dev/null +++ b/queue-4.19/net-smc-ensure-the-active-closing-peer-first-closes-.patch @@ -0,0 +1,77 @@ +From e72911998ff7d43f80d8f4b819bab7de4700ccbf Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 23 Nov 2021 16:25:18 +0800 +Subject: net/smc: Ensure the active closing peer first closes clcsock + +From: Tony Lu + +[ Upstream commit 606a63c9783a32a45bd2ef0eee393711d75b3284 ] + +The side that actively closed socket, it's clcsock doesn't enter +TIME_WAIT state, but the passive side does it. It should show the same +behavior as TCP sockets. + +Consider this, when client actively closes the socket, the clcsock in +server enters TIME_WAIT state, which means the address is occupied and +won't be reused before TIME_WAIT dismissing. If we restarted server, the +service would be unavailable for a long time. + +To solve this issue, shutdown the clcsock in [A], perform the TCP active +close progress first, before the passive closed side closing it. So that +the actively closed side enters TIME_WAIT, not the passive one. + +Client | Server +close() // client actively close | + smc_release() | + smc_close_active() // PEERCLOSEWAIT1 | + smc_close_final() // abort or closed = 1| + smc_cdc_get_slot_and_msg_send() | + [A] | + |smc_cdc_msg_recv_action() // ACTIVE + | queue_work(smc_close_wq, &conn->close_work) + | smc_close_passive_work() // PROCESSABORT or APPCLOSEWAIT1 + | smc_close_passive_abort_received() // only in abort + | + |close() // server recv zero, close + | smc_release() // PROCESSABORT or APPCLOSEWAIT1 + | smc_close_active() + | smc_close_abort() or smc_close_final() // CLOSED + | smc_cdc_get_slot_and_msg_send() // abort or closed = 1 +smc_cdc_msg_recv_action() | smc_clcsock_release() + queue_work(smc_close_wq, &conn->close_work) | sock_release(tcp) // actively close clc, enter TIME_WAIT + smc_close_passive_work() // PEERCLOSEWAIT1 | smc_conn_free() + smc_close_passive_abort_received() // CLOSED| + smc_conn_free() | + smc_clcsock_release() | + sock_release(tcp) // passive close clc | + +Link: https://www.spinics.net/lists/netdev/msg780407.html +Fixes: b38d732477e4 ("smc: socket closing and linkgroup cleanup") +Signed-off-by: Tony Lu +Reviewed-by: Wen Gu +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + net/smc/smc_close.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/net/smc/smc_close.c b/net/smc/smc_close.c +index ea2b87f294696..e25c023582f9e 100644 +--- a/net/smc/smc_close.c ++++ b/net/smc/smc_close.c +@@ -202,6 +202,12 @@ int smc_close_active(struct smc_sock *smc) + if (rc) + break; + sk->sk_state = SMC_PEERCLOSEWAIT1; ++ ++ /* actively shutdown clcsock before peer close it, ++ * prevent peer from entering TIME_WAIT state. ++ */ ++ if (smc->clcsock && smc->clcsock->sk) ++ rc = kernel_sock_shutdown(smc->clcsock, SHUT_RDWR); + } else { + /* peer event has changed the state */ + goto again; +-- +2.33.0 + diff --git a/queue-4.19/netfilter-ipvs-fix-reuse-connection-if-rs-weight-is-.patch b/queue-4.19/netfilter-ipvs-fix-reuse-connection-if-rs-weight-is-.patch new file mode 100644 index 00000000000..841a7ade307 --- /dev/null +++ b/queue-4.19/netfilter-ipvs-fix-reuse-connection-if-rs-weight-is-.patch @@ -0,0 +1,78 @@ +From 91bfe4bad55a50ca8655aac6359a73cdc6e2c309 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 4 Nov 2021 03:10:29 +0100 +Subject: netfilter: ipvs: Fix reuse connection if RS weight is 0 + +From: yangxingwu + +[ Upstream commit c95c07836fa4c1767ed11d8eca0769c652760e32 ] + +We are changing expire_nodest_conn to work even for reused connections when +conn_reuse_mode=0, just as what was done with commit dc7b3eb900aa ("ipvs: +Fix reuse connection if real server is dead"). + +For controlled and persistent connections, the new connection will get the +needed real server depending on the rules in ip_vs_check_template(). + +Fixes: d752c3645717 ("ipvs: allow rescheduling of new connections when port reuse is detected") +Co-developed-by: Chuanqi Liu +Signed-off-by: Chuanqi Liu +Signed-off-by: yangxingwu +Acked-by: Simon Horman +Acked-by: Julian Anastasov +Signed-off-by: Pablo Neira Ayuso +Signed-off-by: Sasha Levin +--- + Documentation/networking/ipvs-sysctl.txt | 3 +-- + net/netfilter/ipvs/ip_vs_core.c | 8 ++++---- + 2 files changed, 5 insertions(+), 6 deletions(-) + +diff --git a/Documentation/networking/ipvs-sysctl.txt b/Documentation/networking/ipvs-sysctl.txt +index 056898685d408..fc531c29a2e83 100644 +--- a/Documentation/networking/ipvs-sysctl.txt ++++ b/Documentation/networking/ipvs-sysctl.txt +@@ -30,8 +30,7 @@ conn_reuse_mode - INTEGER + + 0: disable any special handling on port reuse. The new + connection will be delivered to the same real server that was +- servicing the previous connection. This will effectively +- disable expire_nodest_conn. ++ servicing the previous connection. + + bit 1: enable rescheduling of new connections when it is safe. + That is, whenever expire_nodest_conn and for TCP sockets, when +diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c +index acaeeaf814415..f20b08db9fe91 100644 +--- a/net/netfilter/ipvs/ip_vs_core.c ++++ b/net/netfilter/ipvs/ip_vs_core.c +@@ -1850,7 +1850,6 @@ ip_vs_in(struct netns_ipvs *ipvs, unsigned int hooknum, struct sk_buff *skb, int + struct ip_vs_proto_data *pd; + struct ip_vs_conn *cp; + int ret, pkts; +- int conn_reuse_mode; + struct sock *sk; + + /* Already marked as IPVS request or reply? */ +@@ -1926,15 +1925,16 @@ ip_vs_in(struct netns_ipvs *ipvs, unsigned int hooknum, struct sk_buff *skb, int + */ + cp = pp->conn_in_get(ipvs, af, skb, &iph); + +- conn_reuse_mode = sysctl_conn_reuse_mode(ipvs); +- if (conn_reuse_mode && !iph.fragoffs && is_new_conn(skb, &iph) && cp) { ++ if (!iph.fragoffs && is_new_conn(skb, &iph) && cp) { ++ int conn_reuse_mode = sysctl_conn_reuse_mode(ipvs); + bool old_ct = false, resched = false; + + if (unlikely(sysctl_expire_nodest_conn(ipvs)) && cp->dest && + unlikely(!atomic_read(&cp->dest->weight))) { + resched = true; + old_ct = ip_vs_conn_uses_old_conntrack(cp, skb); +- } else if (is_new_conn_expected(cp, conn_reuse_mode)) { ++ } else if (conn_reuse_mode && ++ is_new_conn_expected(cp, conn_reuse_mode)) { + old_ct = ip_vs_conn_uses_old_conntrack(cp, skb); + if (!atomic_read(&cp->n_control)) { + resched = true; +-- +2.33.0 + diff --git a/queue-4.19/nfsv42-don-t-fail-clone-unless-the-op_clone-operatio.patch b/queue-4.19/nfsv42-don-t-fail-clone-unless-the-op_clone-operatio.patch new file mode 100644 index 00000000000..521474764c9 --- /dev/null +++ b/queue-4.19/nfsv42-don-t-fail-clone-unless-the-op_clone-operatio.patch @@ -0,0 +1,38 @@ +From ee6ddc17720dbde76ef155a3703ee40bedd5827f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 16 Nov 2021 09:55:01 -0500 +Subject: NFSv42: Don't fail clone() unless the OP_CLONE operation failed + +From: Trond Myklebust + +[ Upstream commit d3c45824ad65aebf765fcf51366d317a29538820 ] + +The failure to retrieve post-op attributes has no bearing on whether or +not the clone operation itself was successful. We must therefore ignore +the return value of decode_getfattr() when looking at the success or +failure of nfs4_xdr_dec_clone(). + +Fixes: 36022770de6c ("nfs42: add CLONE xdr functions") +Signed-off-by: Trond Myklebust +Signed-off-by: Sasha Levin +--- + fs/nfs/nfs42xdr.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/fs/nfs/nfs42xdr.c b/fs/nfs/nfs42xdr.c +index ec9803088f6b8..eee011de3f58b 100644 +--- a/fs/nfs/nfs42xdr.c ++++ b/fs/nfs/nfs42xdr.c +@@ -707,8 +707,7 @@ static int nfs4_xdr_dec_clone(struct rpc_rqst *rqstp, + status = decode_clone(xdr); + if (status) + goto out; +- status = decode_getfattr(xdr, res->dst_fattr, res->server); +- ++ decode_getfattr(xdr, res->dst_fattr, res->server); + out: + res->rpc_status = status; + return status; +-- +2.33.0 + diff --git a/queue-4.19/pm-hibernate-use-correct-mode-for-swsusp_close.patch b/queue-4.19/pm-hibernate-use-correct-mode-for-swsusp_close.patch new file mode 100644 index 00000000000..818c1b46985 --- /dev/null +++ b/queue-4.19/pm-hibernate-use-correct-mode-for-swsusp_close.patch @@ -0,0 +1,62 @@ +From 40bf803510789a713f66e89a33d0402f957cb316 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 23 Nov 2021 20:18:43 +0100 +Subject: PM: hibernate: use correct mode for swsusp_close() + +From: Thomas Zeitlhofer + +[ Upstream commit cefcf24b4d351daf70ecd945324e200d3736821e ] + +Commit 39fbef4b0f77 ("PM: hibernate: Get block device exclusively in +swsusp_check()") changed the opening mode of the block device to +(FMODE_READ | FMODE_EXCL). + +In the corresponding calls to swsusp_close(), the mode is still just +FMODE_READ which triggers the warning in blkdev_flush_mapping() on +resume from hibernate. + +So, use the mode (FMODE_READ | FMODE_EXCL) also when closing the +device. + +Fixes: 39fbef4b0f77 ("PM: hibernate: Get block device exclusively in swsusp_check()") +Signed-off-by: Thomas Zeitlhofer +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Sasha Levin +--- + kernel/power/hibernate.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c +index 28db51274ed0e..6670a44ec5d45 100644 +--- a/kernel/power/hibernate.c ++++ b/kernel/power/hibernate.c +@@ -677,7 +677,7 @@ static int load_image_and_restore(void) + goto Unlock; + + error = swsusp_read(&flags); +- swsusp_close(FMODE_READ); ++ swsusp_close(FMODE_READ | FMODE_EXCL); + if (!error) + hibernation_restore(flags & SF_PLATFORM_MODE); + +@@ -874,7 +874,7 @@ static int software_resume(void) + /* The snapshot device should not be opened while we're running */ + if (!atomic_add_unless(&snapshot_device_available, -1, 0)) { + error = -EBUSY; +- swsusp_close(FMODE_READ); ++ swsusp_close(FMODE_READ | FMODE_EXCL); + goto Unlock; + } + +@@ -910,7 +910,7 @@ static int software_resume(void) + pm_pr_dbg("Hibernation image not present or could not be loaded.\n"); + return error; + Close_Finish: +- swsusp_close(FMODE_READ); ++ swsusp_close(FMODE_READ | FMODE_EXCL); + goto Finish; + } + +-- +2.33.0 + diff --git a/queue-4.19/scsi-mpt3sas-fix-kernel-panic-during-drive-powercycl.patch b/queue-4.19/scsi-mpt3sas-fix-kernel-panic-during-drive-powercycl.patch new file mode 100644 index 00000000000..723d2a25f9d --- /dev/null +++ b/queue-4.19/scsi-mpt3sas-fix-kernel-panic-during-drive-powercycl.patch @@ -0,0 +1,42 @@ +From 59b5445659eac928698684f637b38802566c980b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 17 Nov 2021 16:19:09 +0530 +Subject: scsi: mpt3sas: Fix kernel panic during drive powercycle test + +From: Sreekanth Reddy + +[ Upstream commit 0ee4ba13e09c9d9c1cb6abb59da8295d9952328b ] + +While looping over shost's sdev list it is possible that one +of the drives is getting removed and its sas_target object is +freed but its sdev object remains intact. + +Consequently, a kernel panic can occur while the driver is trying to access +the sas_address field of sas_target object without also checking the +sas_target object for NULL. + +Link: https://lore.kernel.org/r/20211117104909.2069-1-sreekanth.reddy@broadcom.com +Fixes: f92363d12359 ("[SCSI] mpt3sas: add new driver supporting 12GB SAS") +Signed-off-by: Sreekanth Reddy +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/mpt3sas/mpt3sas_scsih.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c +index add699b01836f..d899f216245e5 100644 +--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c ++++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c +@@ -3364,7 +3364,7 @@ _scsih_ublock_io_device(struct MPT3SAS_ADAPTER *ioc, u64 sas_address) + + shost_for_each_device(sdev, ioc->shost) { + sas_device_priv_data = sdev->hostdata; +- if (!sas_device_priv_data) ++ if (!sas_device_priv_data || !sas_device_priv_data->sas_target) + continue; + if (sas_device_priv_data->sas_target->sas_address + != sas_address) +-- +2.33.0 + diff --git a/queue-4.19/series b/queue-4.19/series index 2f56cab18b3..26170c8bbbb 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -34,3 +34,21 @@ pinctrl-armada-37xx-add-missing-pin-pcie1-wakeup.patch pinctrl-armada-37xx-correct-pwm-pins-definitions.patch arm64-dts-marvell-armada-37xx-declare-pcie-reset-pin.patch arm64-dts-marvell-armada-37xx-set-pcie_reset_pin-to-gpio-function.patch +netfilter-ipvs-fix-reuse-connection-if-rs-weight-is-.patch +arm-dts-bcm5301x-fix-i2c-controller-interrupt.patch +arm-dts-bcm5301x-add-interrupt-properties-to-gpio-no.patch +asoc-qdsp6-q6routing-conditionally-reset-frontend-mi.patch +asoc-topology-add-missing-rwsem-around-snd_ctl_remov.patch +net-ieee802154-handle-iftypes-as-u32.patch +firmware-arm_scmi-pm-propagate-return-value-to-calle.patch +nfsv42-don-t-fail-clone-unless-the-op_clone-operatio.patch +arm-socfpga-fix-crash-with-config_fortiry_source.patch +scsi-mpt3sas-fix-kernel-panic-during-drive-powercycl.patch +drm-vc4-fix-error-code-in-vc4_create_object.patch +ipv6-fix-typos-in-__ip6_finish_output.patch +net-smc-ensure-the-active-closing-peer-first-closes-.patch +pm-hibernate-use-correct-mode-for-swsusp_close.patch +tcp_cubic-fix-spurious-hystart-ack-train-detections-.patch +mips-use-3-level-pgtable-for-64kb-page-size-on-mips_.patch +net-smc-don-t-call-clcsock-shutdown-twice-when-smc-s.patch +net-hns3-fix-vf-rss-failed-problem-after-pf-enable-m.patch diff --git a/queue-4.19/tcp_cubic-fix-spurious-hystart-ack-train-detections-.patch b/queue-4.19/tcp_cubic-fix-spurious-hystart-ack-train-detections-.patch new file mode 100644 index 00000000000..18e4b8f6fa6 --- /dev/null +++ b/queue-4.19/tcp_cubic-fix-spurious-hystart-ack-train-detections-.patch @@ -0,0 +1,88 @@ +From c2de817ed9636874b2d5b2eae9220237e0f79537 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 23 Nov 2021 12:25:35 -0800 +Subject: tcp_cubic: fix spurious Hystart ACK train detections for + not-cwnd-limited flows + +From: Eric Dumazet + +[ Upstream commit 4e1fddc98d2585ddd4792b5e44433dcee7ece001 ] + +While testing BIG TCP patch series, I was expecting that TCP_RR workloads +with 80KB requests/answers would send one 80KB TSO packet, +then being received as a single GRO packet. + +It turns out this was not happening, and the root cause was that +cubic Hystart ACK train was triggering after a few (2 or 3) rounds of RPC. + +Hystart was wrongly setting CWND/SSTHRESH to 30, while my RPC +needed a budget of ~20 segments. + +Ideally these TCP_RR flows should not exit slow start. + +Cubic Hystart should reset itself at each round, instead of assuming +every TCP flow is a bulk one. + +Note that even after this patch, Hystart can still trigger, depending +on scheduling artifacts, but at a higher CWND/SSTHRESH threshold, +keeping optimal TSO packet sizes. + +Tested: + +ip link set dev eth0 gro_ipv6_max_size 131072 gso_ipv6_max_size 131072 +nstat -n; netperf -H ... -t TCP_RR -l 5 -- -r 80000,80000 -K cubic; nstat|egrep "Ip6InReceives|Hystart|Ip6OutRequests" + +Before: + + 8605 +Ip6InReceives 87541 0.0 +Ip6OutRequests 129496 0.0 +TcpExtTCPHystartTrainDetect 1 0.0 +TcpExtTCPHystartTrainCwnd 30 0.0 + +After: + + 8760 +Ip6InReceives 88514 0.0 +Ip6OutRequests 87975 0.0 + +Fixes: ae27e98a5152 ("[TCP] CUBIC v2.3") +Co-developed-by: Neal Cardwell +Signed-off-by: Neal Cardwell +Signed-off-by: Eric Dumazet +Cc: Stephen Hemminger +Cc: Yuchung Cheng +Cc: Soheil Hassas Yeganeh +Link: https://lore.kernel.org/r/20211123202535.1843771-1-eric.dumazet@gmail.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + net/ipv4/tcp_cubic.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/net/ipv4/tcp_cubic.c b/net/ipv4/tcp_cubic.c +index 8b5ba0a5cd386..93530bd332470 100644 +--- a/net/ipv4/tcp_cubic.c ++++ b/net/ipv4/tcp_cubic.c +@@ -340,8 +340,6 @@ static void bictcp_cong_avoid(struct sock *sk, u32 ack, u32 acked) + return; + + if (tcp_in_slow_start(tp)) { +- if (hystart && after(ack, ca->end_seq)) +- bictcp_hystart_reset(sk); + acked = tcp_slow_start(tp, acked); + if (!acked) + return; +@@ -383,6 +381,9 @@ static void hystart_update(struct sock *sk, u32 delay) + if (ca->found & hystart_detect) + return; + ++ if (after(tp->snd_una, ca->end_seq)) ++ bictcp_hystart_reset(sk); ++ + if (hystart_detect & HYSTART_ACK_TRAIN) { + u32 now = bictcp_clock(); + +-- +2.33.0 +