]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.1-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 12 Aug 2024 12:25:47 +0000 (14:25 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 12 Aug 2024 12:25:47 +0000 (14:25 +0200)
added patches:
drm-bridge-analogix_dp-properly-handle-zero-sized-aux-transactions.patch
drm-dp_mst-skip-csn-if-topology-probing-is-not-done-yet.patch
drm-lima-mark-simple_ondemand-governor-as-softdep.patch
drm-mgag200-bind-i2c-lifetime-to-drm-device.patch
drm-mgag200-set-ddc-timeout-in-milliseconds.patch
mptcp-export-local_address.patch
mptcp-mib-count-mpj-with-backup-flag.patch
mptcp-pm-fix-backup-support-in-signal-endpoints.patch
sched-smt-fix-unbalance-sched_smt_present-dec-inc.patch
sched-smt-introduce-sched_smt_present_inc-dec-helper.patch
selftests-mptcp-join-check-backup-support-in-signal-endp.patch
selftests-mptcp-join-validate-backup-in-mpj.patch

13 files changed:
queue-6.1/drm-bridge-analogix_dp-properly-handle-zero-sized-aux-transactions.patch [new file with mode: 0644]
queue-6.1/drm-dp_mst-skip-csn-if-topology-probing-is-not-done-yet.patch [new file with mode: 0644]
queue-6.1/drm-lima-mark-simple_ondemand-governor-as-softdep.patch [new file with mode: 0644]
queue-6.1/drm-mgag200-bind-i2c-lifetime-to-drm-device.patch [new file with mode: 0644]
queue-6.1/drm-mgag200-set-ddc-timeout-in-milliseconds.patch [new file with mode: 0644]
queue-6.1/mptcp-export-local_address.patch [new file with mode: 0644]
queue-6.1/mptcp-mib-count-mpj-with-backup-flag.patch [new file with mode: 0644]
queue-6.1/mptcp-pm-fix-backup-support-in-signal-endpoints.patch [new file with mode: 0644]
queue-6.1/sched-smt-fix-unbalance-sched_smt_present-dec-inc.patch [new file with mode: 0644]
queue-6.1/sched-smt-introduce-sched_smt_present_inc-dec-helper.patch [new file with mode: 0644]
queue-6.1/selftests-mptcp-join-check-backup-support-in-signal-endp.patch [new file with mode: 0644]
queue-6.1/selftests-mptcp-join-validate-backup-in-mpj.patch [new file with mode: 0644]
queue-6.1/series

diff --git a/queue-6.1/drm-bridge-analogix_dp-properly-handle-zero-sized-aux-transactions.patch b/queue-6.1/drm-bridge-analogix_dp-properly-handle-zero-sized-aux-transactions.patch
new file mode 100644 (file)
index 0000000..776a65f
--- /dev/null
@@ -0,0 +1,58 @@
+From e82290a2e0e8ec5e836ecad1ca025021b3855c2d Mon Sep 17 00:00:00 2001
+From: Lucas Stach <l.stach@pengutronix.de>
+Date: Mon, 18 Mar 2024 21:39:23 +0100
+Subject: drm/bridge: analogix_dp: properly handle zero sized AUX transactions
+
+From: Lucas Stach <l.stach@pengutronix.de>
+
+commit e82290a2e0e8ec5e836ecad1ca025021b3855c2d upstream.
+
+Address only transactions without any data are valid and should not
+be flagged as short transactions. Simply return the message size when
+no transaction errors occured.
+
+CC: stable@vger.kernel.org
+Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
+Reviewed-by: Robert Foss <rfoss@kernel.org>
+Signed-off-by: Robert Foss <rfoss@kernel.org>
+Link: https://patchwork.freedesktop.org/patch/msgid/20240318203925.2837689-1-l.stach@pengutronix.de
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c |    5 +----
+ 1 file changed, 1 insertion(+), 4 deletions(-)
+
+--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c
++++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c
+@@ -1027,7 +1027,6 @@ ssize_t analogix_dp_transfer(struct anal
+       u32 status_reg;
+       u8 *buffer = msg->buffer;
+       unsigned int i;
+-      int num_transferred = 0;
+       int ret;
+       /* Buffer size of AUX CH is 16 bytes */
+@@ -1079,7 +1078,6 @@ ssize_t analogix_dp_transfer(struct anal
+                       reg = buffer[i];
+                       writel(reg, dp->reg_base + ANALOGIX_DP_BUF_DATA_0 +
+                              4 * i);
+-                      num_transferred++;
+               }
+       }
+@@ -1127,7 +1125,6 @@ ssize_t analogix_dp_transfer(struct anal
+                       reg = readl(dp->reg_base + ANALOGIX_DP_BUF_DATA_0 +
+                                   4 * i);
+                       buffer[i] = (unsigned char)reg;
+-                      num_transferred++;
+               }
+       }
+@@ -1144,7 +1141,7 @@ ssize_t analogix_dp_transfer(struct anal
+                (msg->request & ~DP_AUX_I2C_MOT) == DP_AUX_NATIVE_READ)
+               msg->reply = DP_AUX_NATIVE_REPLY_ACK;
+-      return num_transferred > 0 ? num_transferred : -EBUSY;
++      return msg->size;
+ aux_error:
+       /* if aux err happen, reset aux */
diff --git a/queue-6.1/drm-dp_mst-skip-csn-if-topology-probing-is-not-done-yet.patch b/queue-6.1/drm-dp_mst-skip-csn-if-topology-probing-is-not-done-yet.patch
new file mode 100644 (file)
index 0000000..5576b20
--- /dev/null
@@ -0,0 +1,60 @@
+From ddf983488c3e8d30d5c2e2b315ae7d9cd87096ed Mon Sep 17 00:00:00 2001
+From: Wayne Lin <Wayne.Lin@amd.com>
+Date: Wed, 26 Jun 2024 16:48:24 +0800
+Subject: drm/dp_mst: Skip CSN if topology probing is not done yet
+
+From: Wayne Lin <Wayne.Lin@amd.com>
+
+commit ddf983488c3e8d30d5c2e2b315ae7d9cd87096ed upstream.
+
+[Why]
+During resume, observe that we receive CSN event before we start topology
+probing. Handling CSN at this moment based on uncertain topology is
+unnecessary.
+
+[How]
+Add checking condition in drm_dp_mst_handle_up_req() to skip handling CSN
+if the topology is yet to be probed.
+
+Cc: Lyude Paul <lyude@redhat.com>
+Cc: Harry Wentland <hwentlan@amd.com>
+Cc: Jani Nikula <jani.nikula@intel.com>
+Cc: Imre Deak <imre.deak@intel.com>
+Cc: Daniel Vetter <daniel@ffwll.ch>
+Cc: stable@vger.kernel.org
+Signed-off-by: Wayne Lin <Wayne.Lin@amd.com>
+Reviewed-by: Lyude Paul <lyude@redhat.com>
+Signed-off-by: Lyude Paul <lyude@redhat.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20240626084825.878565-3-Wayne.Lin@amd.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/display/drm_dp_mst_topology.c |   11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+--- a/drivers/gpu/drm/display/drm_dp_mst_topology.c
++++ b/drivers/gpu/drm/display/drm_dp_mst_topology.c
+@@ -4024,6 +4024,7 @@ static int drm_dp_mst_handle_up_req(stru
+       if (up_req->msg.req_type == DP_CONNECTION_STATUS_NOTIFY) {
+               const struct drm_dp_connection_status_notify *conn_stat =
+                       &up_req->msg.u.conn_stat;
++              bool handle_csn;
+               drm_dbg_kms(mgr->dev, "Got CSN: pn: %d ldps:%d ddps: %d mcs: %d ip: %d pdt: %d\n",
+                           conn_stat->port_number,
+@@ -4032,6 +4033,16 @@ static int drm_dp_mst_handle_up_req(stru
+                           conn_stat->message_capability_status,
+                           conn_stat->input_port,
+                           conn_stat->peer_device_type);
++
++              mutex_lock(&mgr->probe_lock);
++              handle_csn = mgr->mst_primary->link_address_sent;
++              mutex_unlock(&mgr->probe_lock);
++
++              if (!handle_csn) {
++                      drm_dbg_kms(mgr->dev, "Got CSN before finish topology probing. Skip it.");
++                      kfree(up_req);
++                      goto out;
++              }
+       } else if (up_req->msg.req_type == DP_RESOURCE_STATUS_NOTIFY) {
+               const struct drm_dp_resource_status_notify *res_stat =
+                       &up_req->msg.u.resource_stat;
diff --git a/queue-6.1/drm-lima-mark-simple_ondemand-governor-as-softdep.patch b/queue-6.1/drm-lima-mark-simple_ondemand-governor-as-softdep.patch
new file mode 100644 (file)
index 0000000..aeb612d
--- /dev/null
@@ -0,0 +1,55 @@
+From 0c94f58cef319ad054fd909b3bf4b7d09c03e11c Mon Sep 17 00:00:00 2001
+From: Dragan Simic <dsimic@manjaro.org>
+Date: Mon, 17 Jun 2024 22:22:02 +0200
+Subject: drm/lima: Mark simple_ondemand governor as softdep
+
+From: Dragan Simic <dsimic@manjaro.org>
+
+commit 0c94f58cef319ad054fd909b3bf4b7d09c03e11c upstream.
+
+Lima DRM driver uses devfreq to perform DVFS, while using simple_ondemand
+devfreq governor by default.  This causes driver initialization to fail on
+boot when simple_ondemand governor isn't built into the kernel statically,
+as a result of the missing module dependency and, consequently, the
+required governor module not being included in the initial ramdisk.  Thus,
+let's mark simple_ondemand governor as a softdep for Lima, to have its
+kernel module included in the initial ramdisk.
+
+This is a rather longstanding issue that has forced distributions to build
+devfreq governors statically into their kernels, [1][2] or may have forced
+some users to introduce unnecessary workarounds.
+
+Having simple_ondemand marked as a softdep for Lima may not resolve this
+issue for all Linux distributions.  In particular, it will remain
+unresolved for the distributions whose utilities for the initial ramdisk
+generation do not handle the available softdep information [3] properly
+yet.  However, some Linux distributions already handle softdeps properly
+while generating their initial ramdisks, [4] and this is a prerequisite
+step in the right direction for the distributions that don't handle them
+properly yet.
+
+[1] https://gitlab.manjaro.org/manjaro-arm/packages/core/linux-pinephone/-/blob/6.7-megi/config?ref_type=heads#L5749
+[2] https://gitlab.com/postmarketOS/pmaports/-/blob/7f64e287e7732c9eaa029653e73ca3d4ba1c8598/main/linux-postmarketos-allwinner/config-postmarketos-allwinner.aarch64#L4654
+[3] https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git/commit/?id=49d8e0b59052999de577ab732b719cfbeb89504d
+[4] https://github.com/archlinux/mkinitcpio/commit/97ac4d37aae084a050be512f6d8f4489054668ad
+
+Cc: Philip Muller <philm@manjaro.org>
+Cc: Oliver Smith <ollieparanoid@postmarketos.org>
+Cc: Daniel Smith <danct12@disroot.org>
+Cc: stable@vger.kernel.org
+Fixes: 1996970773a3 ("drm/lima: Add optional devfreq and cooling device support")
+Signed-off-by: Dragan Simic <dsimic@manjaro.org>
+Signed-off-by: Qiang Yu <yuq825@gmail.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/fdaf2e41bb6a0c5118ff9cc21f4f62583208d885.1718655070.git.dsimic@manjaro.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/lima/lima_drv.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/gpu/drm/lima/lima_drv.c
++++ b/drivers/gpu/drm/lima/lima_drv.c
+@@ -489,3 +489,4 @@ module_platform_driver(lima_platform_dri
+ MODULE_AUTHOR("Lima Project Developers");
+ MODULE_DESCRIPTION("Lima DRM Driver");
+ MODULE_LICENSE("GPL v2");
++MODULE_SOFTDEP("pre: governor_simpleondemand");
diff --git a/queue-6.1/drm-mgag200-bind-i2c-lifetime-to-drm-device.patch b/queue-6.1/drm-mgag200-bind-i2c-lifetime-to-drm-device.patch
new file mode 100644 (file)
index 0000000..d435d00
--- /dev/null
@@ -0,0 +1,60 @@
+From eb1ae34e48a09b7a1179c579aed042b032e408f4 Mon Sep 17 00:00:00 2001
+From: Thomas Zimmermann <tzimmermann@suse.de>
+Date: Mon, 13 May 2024 14:51:07 +0200
+Subject: drm/mgag200: Bind I2C lifetime to DRM device
+
+From: Thomas Zimmermann <tzimmermann@suse.de>
+
+commit eb1ae34e48a09b7a1179c579aed042b032e408f4 upstream.
+
+Managed cleanup with devm_add_action_or_reset() will release the I2C
+adapter when the underlying Linux device goes away. But the connector
+still refers to it, so this cleanup leaves behind a stale pointer
+in struct drm_connector.ddc.
+
+Bind the lifetime of the I2C adapter to the connector's lifetime by
+using DRM's managed release. When the DRM device goes away (after
+the Linux device) DRM will first clean up the connector and then
+clean up the I2C adapter.
+
+Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
+Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
+Fixes: b279df242972 ("drm/mgag200: Switch I2C code to managed cleanup")
+Cc: Thomas Zimmermann <tzimmermann@suse.de>
+Cc: Jocelyn Falempe <jfalempe@redhat.com>
+Cc: Dave Airlie <airlied@redhat.com>
+Cc: dri-devel@lists.freedesktop.org
+Cc: <stable@vger.kernel.org> # v6.0+
+Link: https://patchwork.freedesktop.org/patch/msgid/20240513125620.6337-3-tzimmermann@suse.de
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/mgag200/mgag200_i2c.c |    6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+--- a/drivers/gpu/drm/mgag200/mgag200_i2c.c
++++ b/drivers/gpu/drm/mgag200/mgag200_i2c.c
+@@ -31,6 +31,8 @@
+ #include <linux/i2c.h>
+ #include <linux/pci.h>
++#include <drm/drm_managed.h>
++
+ #include "mgag200_drv.h"
+ static int mga_i2c_read_gpio(struct mga_device *mdev)
+@@ -86,7 +88,7 @@ static int mga_gpio_getscl(void *data)
+       return (mga_i2c_read_gpio(mdev) & i2c->clock) ? 1 : 0;
+ }
+-static void mgag200_i2c_release(void *res)
++static void mgag200_i2c_release(struct drm_device *dev, void *res)
+ {
+       struct mga_i2c_chan *i2c = res;
+@@ -126,5 +128,5 @@ int mgag200_i2c_init(struct mga_device *
+       if (ret)
+               return ret;
+-      return devm_add_action_or_reset(dev->dev, mgag200_i2c_release, i2c);
++      return drmm_add_action_or_reset(dev, mgag200_i2c_release, i2c);
+ }
diff --git a/queue-6.1/drm-mgag200-set-ddc-timeout-in-milliseconds.patch b/queue-6.1/drm-mgag200-set-ddc-timeout-in-milliseconds.patch
new file mode 100644 (file)
index 0000000..5e89ede
--- /dev/null
@@ -0,0 +1,41 @@
+From ecde5db1598aecab54cc392282c15114f526f05f Mon Sep 17 00:00:00 2001
+From: Thomas Zimmermann <tzimmermann@suse.de>
+Date: Mon, 13 May 2024 14:51:06 +0200
+Subject: drm/mgag200: Set DDC timeout in milliseconds
+
+From: Thomas Zimmermann <tzimmermann@suse.de>
+
+commit ecde5db1598aecab54cc392282c15114f526f05f upstream.
+
+Compute the i2c timeout in jiffies from a value in milliseconds. The
+original values of 2 jiffies equals 2 milliseconds if HZ has been
+configured to a value of 1000. This corresponds to 2.2 milliseconds
+used by most other DRM drivers. Update mgag200 accordingly.
+
+Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
+Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
+Fixes: 414c45310625 ("mgag200: initial g200se driver (v2)")
+Cc: Dave Airlie <airlied@redhat.com>
+Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
+Cc: Maxime Ripard <mripard@kernel.org>
+Cc: Thomas Zimmermann <tzimmermann@suse.de>
+Cc: Jocelyn Falempe <jfalempe@redhat.com>
+Cc: dri-devel@lists.freedesktop.org
+Cc: <stable@vger.kernel.org> # v3.5+
+Link: https://patchwork.freedesktop.org/patch/msgid/20240513125620.6337-2-tzimmermann@suse.de
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/mgag200/mgag200_i2c.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/gpu/drm/mgag200/mgag200_i2c.c
++++ b/drivers/gpu/drm/mgag200/mgag200_i2c.c
+@@ -115,7 +115,7 @@ int mgag200_i2c_init(struct mga_device *
+       i2c->adapter.algo_data = &i2c->bit;
+       i2c->bit.udelay = 10;
+-      i2c->bit.timeout = 2;
++      i2c->bit.timeout = usecs_to_jiffies(2200);
+       i2c->bit.data = i2c;
+       i2c->bit.setsda         = mga_gpio_setsda;
+       i2c->bit.setscl         = mga_gpio_setscl;
diff --git a/queue-6.1/mptcp-export-local_address.patch b/queue-6.1/mptcp-export-local_address.patch
new file mode 100644 (file)
index 0000000..861ef9b
--- /dev/null
@@ -0,0 +1,108 @@
+From stable+bounces-66067-greg=kroah.com@vger.kernel.org Thu Aug  8 17:36:21 2024
+From: "Matthieu Baerts (NGI0)" <matttbe@kernel.org>
+Date: Thu,  8 Aug 2024 17:35:47 +0200
+Subject: mptcp: export local_address
+To: stable@vger.kernel.org, gregkh@linuxfoundation.org
+Cc: MPTCP Upstream <mptcp@lists.linux.dev>, Geliang Tang <geliang.tang@suse.com>, Matthieu Baerts <matthieu.baerts@tessares.net>, Larysa Zaremba <larysa.zaremba@intel.com>, Jakub Kicinski <kuba@kernel.org>, Matthieu Baerts <matttbe@kernel.org>
+Message-ID: <20240808153546.2315845-3-matttbe@kernel.org>
+
+From: Geliang Tang <geliang.tang@suse.com>
+
+commit dc886bce753cc2cf3c88ec5c7a6880a4e17d65ba upstream.
+
+Rename local_address() with "mptcp_" prefix and export it in protocol.h.
+
+This function will be re-used in the common PM code (pm.c) in the
+following commit.
+
+Signed-off-by: Geliang Tang <geliang.tang@suse.com>
+Reviewed-by: Matthieu Baerts <matthieu.baerts@tessares.net>
+Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
+Reviewed-by: Larysa Zaremba <larysa.zaremba@intel.com>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Stable-dep-of: 6834097fc38c ("mptcp: pm: fix backup support in signal endpoints")
+Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/mptcp/pm_netlink.c |   17 ++++++++---------
+ net/mptcp/protocol.h   |    1 +
+ 2 files changed, 9 insertions(+), 9 deletions(-)
+
+--- a/net/mptcp/pm_netlink.c
++++ b/net/mptcp/pm_netlink.c
+@@ -86,8 +86,7 @@ bool mptcp_addresses_equal(const struct
+       return a->port == b->port;
+ }
+-static void local_address(const struct sock_common *skc,
+-                        struct mptcp_addr_info *addr)
++void mptcp_local_address(const struct sock_common *skc, struct mptcp_addr_info *addr)
+ {
+       addr->family = skc->skc_family;
+       addr->port = htons(skc->skc_num);
+@@ -122,7 +121,7 @@ static bool lookup_subflow_by_saddr(cons
+       list_for_each_entry(subflow, list, node) {
+               skc = (struct sock_common *)mptcp_subflow_tcp_sock(subflow);
+-              local_address(skc, &cur);
++              mptcp_local_address(skc, &cur);
+               if (mptcp_addresses_equal(&cur, saddr, saddr->port))
+                       return true;
+       }
+@@ -274,7 +273,7 @@ bool mptcp_pm_sport_in_anno_list(struct
+       struct mptcp_addr_info saddr;
+       bool ret = false;
+-      local_address((struct sock_common *)sk, &saddr);
++      mptcp_local_address((struct sock_common *)sk, &saddr);
+       spin_lock_bh(&msk->pm.lock);
+       list_for_each_entry(entry, &msk->pm.anno_list, list) {
+@@ -545,7 +544,7 @@ static void mptcp_pm_create_subflow_or_s
+               struct mptcp_addr_info mpc_addr;
+               bool backup = false;
+-              local_address((struct sock_common *)msk->first, &mpc_addr);
++              mptcp_local_address((struct sock_common *)msk->first, &mpc_addr);
+               rcu_read_lock();
+               entry = __lookup_addr(pernet, &mpc_addr, false);
+               if (entry) {
+@@ -753,7 +752,7 @@ int mptcp_pm_nl_mp_prio_send_ack(struct
+               struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
+               struct mptcp_addr_info local, remote;
+-              local_address((struct sock_common *)ssk, &local);
++              mptcp_local_address((struct sock_common *)ssk, &local);
+               if (!mptcp_addresses_equal(&local, addr, addr->port))
+                       continue;
+@@ -1072,8 +1071,8 @@ int mptcp_pm_nl_get_local_id(struct mptc
+       /* The 0 ID mapping is defined by the first subflow, copied into the msk
+        * addr
+        */
+-      local_address((struct sock_common *)msk, &msk_local);
+-      local_address((struct sock_common *)skc, &skc_local);
++      mptcp_local_address((struct sock_common *)msk, &msk_local);
++      mptcp_local_address((struct sock_common *)skc, &skc_local);
+       if (mptcp_addresses_equal(&msk_local, &skc_local, false))
+               return 0;
+@@ -1507,7 +1506,7 @@ static int mptcp_nl_remove_id_zero_addre
+               if (list_empty(&msk->conn_list) || mptcp_pm_is_userspace(msk))
+                       goto next;
+-              local_address((struct sock_common *)msk, &msk_local);
++              mptcp_local_address((struct sock_common *)msk, &msk_local);
+               if (!mptcp_addresses_equal(&msk_local, addr, addr->port))
+                       goto next;
+--- a/net/mptcp/protocol.h
++++ b/net/mptcp/protocol.h
+@@ -618,6 +618,7 @@ void __mptcp_unaccepted_force_close(stru
+ bool mptcp_addresses_equal(const struct mptcp_addr_info *a,
+                          const struct mptcp_addr_info *b, bool use_port);
++void mptcp_local_address(const struct sock_common *skc, struct mptcp_addr_info *addr);
+ /* called with sk socket lock held */
+ int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc,
diff --git a/queue-6.1/mptcp-mib-count-mpj-with-backup-flag.patch b/queue-6.1/mptcp-mib-count-mpj-with-backup-flag.patch
new file mode 100644 (file)
index 0000000..8499110
--- /dev/null
@@ -0,0 +1,86 @@
+From matttbe@kernel.org Thu Aug  8 17:30:32 2024
+From: "Matthieu Baerts (NGI0)" <matttbe@kernel.org>
+Date: Thu,  8 Aug 2024 17:30:05 +0200
+Subject: mptcp: mib: count MPJ with backup flag
+To: stable@vger.kernel.org, gregkh@linuxfoundation.org
+Cc: MPTCP Upstream <mptcp@lists.linux.dev>, "Matthieu Baerts (NGI0)" <matttbe@kernel.org>, Mat Martineau <martineau@kernel.org>, Paolo Abeni <pabeni@redhat.com>
+Message-ID: <20240808153004.2308809-2-matttbe@kernel.org>
+
+From: "Matthieu Baerts (NGI0)" <matttbe@kernel.org>
+
+commit 4dde0d72ccec500c60c798e036b852e013d6e124 upstream.
+
+Without such counters, it is difficult to easily debug issues with MPJ
+not having the backup flags on production servers.
+
+This is not strictly a fix, but it eases to validate the following
+patches without requiring to take packet traces, to query ongoing
+connections with Netlink with admin permissions, or to guess by looking
+at the behaviour of the packet scheduler. Also, the modification is self
+contained, isolated, well controlled, and the increments are done just
+after others, there from the beginning. It looks then safe, and helpful
+to backport this.
+
+Fixes: 4596a2c1b7f5 ("mptcp: allow creating non-backup subflows")
+Cc: stable@vger.kernel.org
+Reviewed-by: Mat Martineau <martineau@kernel.org>
+Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
+Signed-off-by: Paolo Abeni <pabeni@redhat.com>
+[ Conflicts in subflow.c because the context has changed in
+  commit b3ea6b272d79 ("mptcp: consolidate initial ack seq generation")
+  which is not in this version. This commit is unrelated to this
+  modification. ]
+Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/mptcp/mib.c     |    2 ++
+ net/mptcp/mib.h     |    2 ++
+ net/mptcp/subflow.c |    6 ++++++
+ 3 files changed, 10 insertions(+)
+
+--- a/net/mptcp/mib.c
++++ b/net/mptcp/mib.c
+@@ -19,7 +19,9 @@ static const struct snmp_mib mptcp_snmp_
+       SNMP_MIB_ITEM("MPTCPRetrans", MPTCP_MIB_RETRANSSEGS),
+       SNMP_MIB_ITEM("MPJoinNoTokenFound", MPTCP_MIB_JOINNOTOKEN),
+       SNMP_MIB_ITEM("MPJoinSynRx", MPTCP_MIB_JOINSYNRX),
++      SNMP_MIB_ITEM("MPJoinSynBackupRx", MPTCP_MIB_JOINSYNBACKUPRX),
+       SNMP_MIB_ITEM("MPJoinSynAckRx", MPTCP_MIB_JOINSYNACKRX),
++      SNMP_MIB_ITEM("MPJoinSynAckBackupRx", MPTCP_MIB_JOINSYNACKBACKUPRX),
+       SNMP_MIB_ITEM("MPJoinSynAckHMacFailure", MPTCP_MIB_JOINSYNACKMAC),
+       SNMP_MIB_ITEM("MPJoinAckRx", MPTCP_MIB_JOINACKRX),
+       SNMP_MIB_ITEM("MPJoinAckHMacFailure", MPTCP_MIB_JOINACKMAC),
+--- a/net/mptcp/mib.h
++++ b/net/mptcp/mib.h
+@@ -12,7 +12,9 @@ enum linux_mptcp_mib_field {
+       MPTCP_MIB_RETRANSSEGS,          /* Segments retransmitted at the MPTCP-level */
+       MPTCP_MIB_JOINNOTOKEN,          /* Received MP_JOIN but the token was not found */
+       MPTCP_MIB_JOINSYNRX,            /* Received a SYN + MP_JOIN */
++      MPTCP_MIB_JOINSYNBACKUPRX,      /* Received a SYN + MP_JOIN + backup flag */
+       MPTCP_MIB_JOINSYNACKRX,         /* Received a SYN/ACK + MP_JOIN */
++      MPTCP_MIB_JOINSYNACKBACKUPRX,   /* Received a SYN/ACK + MP_JOIN + backup flag */
+       MPTCP_MIB_JOINSYNACKMAC,        /* HMAC was wrong on SYN/ACK + MP_JOIN */
+       MPTCP_MIB_JOINACKRX,            /* Received an ACK + MP_JOIN */
+       MPTCP_MIB_JOINACKMAC,           /* HMAC was wrong on ACK + MP_JOIN */
+--- a/net/mptcp/subflow.c
++++ b/net/mptcp/subflow.c
+@@ -165,6 +165,9 @@ static int subflow_check_req(struct requ
+                       return 0;
+       } else if (opt_mp_join) {
+               SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINSYNRX);
++
++              if (mp_opt.backup)
++                      SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINSYNBACKUPRX);
+       }
+       if (opt_mp_capable && listener->request_mptcp) {
+@@ -469,6 +472,9 @@ static void subflow_finish_connect(struc
+               subflow->mp_join = 1;
+               MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNACKRX);
++              if (subflow->backup)
++                      MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNACKBACKUPRX);
++
+               if (subflow_use_different_dport(mptcp_sk(parent), sk)) {
+                       pr_debug("synack inet_dport=%d %d",
+                                ntohs(inet_sk(sk)->inet_dport),
diff --git a/queue-6.1/mptcp-pm-fix-backup-support-in-signal-endpoints.patch b/queue-6.1/mptcp-pm-fix-backup-support-in-signal-endpoints.patch
new file mode 100644 (file)
index 0000000..9c24296
--- /dev/null
@@ -0,0 +1,159 @@
+From stable+bounces-66068-greg=kroah.com@vger.kernel.org Thu Aug  8 17:36:21 2024
+From: "Matthieu Baerts (NGI0)" <matttbe@kernel.org>
+Date: Thu,  8 Aug 2024 17:35:48 +0200
+Subject: mptcp: pm: fix backup support in signal endpoints
+To: stable@vger.kernel.org, gregkh@linuxfoundation.org
+Cc: MPTCP Upstream <mptcp@lists.linux.dev>, "Matthieu Baerts (NGI0)" <matttbe@kernel.org>, Mat Martineau <martineau@kernel.org>, Paolo Abeni <pabeni@redhat.com>
+Message-ID: <20240808153546.2315845-4-matttbe@kernel.org>
+
+From: "Matthieu Baerts (NGI0)" <matttbe@kernel.org>
+
+commit 6834097fc38c5416701c793da94558cea49c0a1f upstream.
+
+There was a support for signal endpoints, but only when the endpoint's
+flag was changed during a connection. If an endpoint with the signal and
+backup was already present, the MP_JOIN reply was not containing the
+backup flag as expected.
+
+That's confusing to have this inconsistent behaviour. On the other hand,
+the infrastructure to set the backup flag in the SYN + ACK + MP_JOIN was
+already there, it was just never set before. Now when requesting the
+local ID from the path-manager, the backup status is also requested.
+
+Note that when the userspace PM is used, the backup flag can be set if
+the local address was already used before with a backup flag, e.g. if
+the address was announced with the 'backup' flag, or a subflow was
+created with the 'backup' flag.
+
+Fixes: 4596a2c1b7f5 ("mptcp: allow creating non-backup subflows")
+Cc: stable@vger.kernel.org
+Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/507
+Reviewed-by: Mat Martineau <martineau@kernel.org>
+Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
+Signed-off-by: Paolo Abeni <pabeni@redhat.com>
+[ Conflicts in pm_userspace.c because the context has changed in commit
+  1e07938e29c5 ("net: mptcp: rename netlink handlers to
+  mptcp_pm_nl_<blah>_{doit,dumpit}") which is not in this version. This
+  commit is unrelated to this modification.
+  Conflicts in protocol.h because the context has changed in commit
+  9ae7846c4b6b ("mptcp: dump addrs in userspace pm list") which is not
+  in this version. This commit is unrelated to this modification.
+  Conflicts in pm.c because the context has changed in commit
+  f40be0db0b76 ("mptcp: unify pm get_flags_and_ifindex_by_id") which is
+  not in this version. This commit is unrelated to this modification. ]
+Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/mptcp/pm.c           |   12 ++++++++++++
+ net/mptcp/pm_netlink.c   |   18 ++++++++++++++++++
+ net/mptcp/pm_userspace.c |   18 ++++++++++++++++++
+ net/mptcp/protocol.h     |    3 +++
+ net/mptcp/subflow.c      |    3 +++
+ 5 files changed, 54 insertions(+)
+
+--- a/net/mptcp/pm.c
++++ b/net/mptcp/pm.c
+@@ -416,6 +416,18 @@ int mptcp_pm_get_local_id(struct mptcp_s
+       return mptcp_pm_nl_get_local_id(msk, skc);
+ }
++bool mptcp_pm_is_backup(struct mptcp_sock *msk, struct sock_common *skc)
++{
++      struct mptcp_addr_info skc_local;
++
++      mptcp_local_address((struct sock_common *)skc, &skc_local);
++
++      if (mptcp_pm_is_userspace(msk))
++              return mptcp_userspace_pm_is_backup(msk, &skc_local);
++
++      return mptcp_pm_nl_is_backup(msk, &skc_local);
++}
++
+ void mptcp_pm_subflow_chk_stale(const struct mptcp_sock *msk, struct sock *ssk)
+ {
+       struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk);
+--- a/net/mptcp/pm_netlink.c
++++ b/net/mptcp/pm_netlink.c
+@@ -1110,6 +1110,24 @@ int mptcp_pm_nl_get_local_id(struct mptc
+       return ret;
+ }
++bool mptcp_pm_nl_is_backup(struct mptcp_sock *msk, struct mptcp_addr_info *skc)
++{
++      struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk);
++      struct mptcp_pm_addr_entry *entry;
++      bool backup = false;
++
++      rcu_read_lock();
++      list_for_each_entry_rcu(entry, &pernet->local_addr_list, list) {
++              if (mptcp_addresses_equal(&entry->addr, skc, entry->addr.port)) {
++                      backup = !!(entry->flags & MPTCP_PM_ADDR_FLAG_BACKUP);
++                      break;
++              }
++      }
++      rcu_read_unlock();
++
++      return backup;
++}
++
+ #define MPTCP_PM_CMD_GRP_OFFSET       0
+ #define MPTCP_PM_EV_GRP_OFFSET        1
+--- a/net/mptcp/pm_userspace.c
++++ b/net/mptcp/pm_userspace.c
+@@ -159,6 +159,24 @@ int mptcp_userspace_pm_get_local_id(stru
+       return mptcp_userspace_pm_append_new_local_addr(msk, &new_entry, true);
+ }
++bool mptcp_userspace_pm_is_backup(struct mptcp_sock *msk,
++                                struct mptcp_addr_info *skc)
++{
++      struct mptcp_pm_addr_entry *entry;
++      bool backup = false;
++
++      spin_lock_bh(&msk->pm.lock);
++      list_for_each_entry(entry, &msk->pm.userspace_pm_local_addr_list, list) {
++              if (mptcp_addresses_equal(&entry->addr, skc, false)) {
++                      backup = !!(entry->flags & MPTCP_PM_ADDR_FLAG_BACKUP);
++                      break;
++              }
++      }
++      spin_unlock_bh(&msk->pm.lock);
++
++      return backup;
++}
++
+ int mptcp_nl_cmd_announce(struct sk_buff *skb, struct genl_info *info)
+ {
+       struct nlattr *token = info->attrs[MPTCP_PM_ATTR_TOKEN];
+--- a/net/mptcp/protocol.h
++++ b/net/mptcp/protocol.h
+@@ -913,6 +913,9 @@ bool mptcp_pm_rm_addr_signal(struct mptc
+                            struct mptcp_rm_list *rm_list);
+ int mptcp_pm_get_local_id(struct mptcp_sock *msk, struct sock_common *skc);
+ int mptcp_userspace_pm_get_local_id(struct mptcp_sock *msk, struct mptcp_addr_info *skc);
++bool mptcp_pm_is_backup(struct mptcp_sock *msk, struct sock_common *skc);
++bool mptcp_pm_nl_is_backup(struct mptcp_sock *msk, struct mptcp_addr_info *skc);
++bool mptcp_userspace_pm_is_backup(struct mptcp_sock *msk, struct mptcp_addr_info *skc);
+ static inline u8 subflow_get_local_id(const struct mptcp_subflow_context *subflow)
+ {
+--- a/net/mptcp/subflow.c
++++ b/net/mptcp/subflow.c
+@@ -99,6 +99,7 @@ static struct mptcp_sock *subflow_token_
+               return NULL;
+       }
+       subflow_req->local_id = local_id;
++      subflow_req->request_bkup = mptcp_pm_is_backup(msk, (struct sock_common *)req);
+       return msk;
+ }
+@@ -513,6 +514,8 @@ static int subflow_chk_local_id(struct s
+               return err;
+       subflow_set_local_id(subflow, err);
++      subflow->request_bkup = mptcp_pm_is_backup(msk, (struct sock_common *)sk);
++
+       return 0;
+ }
diff --git a/queue-6.1/sched-smt-fix-unbalance-sched_smt_present-dec-inc.patch b/queue-6.1/sched-smt-fix-unbalance-sched_smt_present-dec-inc.patch
new file mode 100644 (file)
index 0000000..0deb3a1
--- /dev/null
@@ -0,0 +1,52 @@
+From e22f910a26cc2a3ac9c66b8e935ef2a7dd881117 Mon Sep 17 00:00:00 2001
+From: Yang Yingliang <yangyingliang@huawei.com>
+Date: Wed, 3 Jul 2024 11:16:08 +0800
+Subject: sched/smt: Fix unbalance sched_smt_present dec/inc
+
+From: Yang Yingliang <yangyingliang@huawei.com>
+
+commit e22f910a26cc2a3ac9c66b8e935ef2a7dd881117 upstream.
+
+I got the following warn report while doing stress test:
+
+jump label: negative count!
+WARNING: CPU: 3 PID: 38 at kernel/jump_label.c:263 static_key_slow_try_dec+0x9d/0xb0
+Call Trace:
+ <TASK>
+ __static_key_slow_dec_cpuslocked+0x16/0x70
+ sched_cpu_deactivate+0x26e/0x2a0
+ cpuhp_invoke_callback+0x3ad/0x10d0
+ cpuhp_thread_fun+0x3f5/0x680
+ smpboot_thread_fn+0x56d/0x8d0
+ kthread+0x309/0x400
+ ret_from_fork+0x41/0x70
+ ret_from_fork_asm+0x1b/0x30
+ </TASK>
+
+Because when cpuset_cpu_inactive() fails in sched_cpu_deactivate(),
+the cpu offline failed, but sched_smt_present is decremented before
+calling sched_cpu_deactivate(), it leads to unbalanced dec/inc, so
+fix it by incrementing sched_smt_present in the error path.
+
+Fixes: c5511d03ec09 ("sched/smt: Make sched_smt_present track topology")
+Cc: stable@kernel.org
+Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
+Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
+Reviewed-by: Chen Yu <yu.c.chen@intel.com>
+Reviewed-by: Tim Chen <tim.c.chen@linux.intel.com>
+Link: https://lore.kernel.org/r/20240703031610.587047-3-yangyingliang@huaweicloud.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ kernel/sched/core.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/kernel/sched/core.c
++++ b/kernel/sched/core.c
+@@ -9513,6 +9513,7 @@ int sched_cpu_deactivate(unsigned int cp
+       sched_update_numa(cpu, false);
+       ret = cpuset_cpu_inactive(cpu);
+       if (ret) {
++              sched_smt_present_inc(cpu);
+               balance_push_set(cpu, false);
+               set_cpu_active(cpu, true);
+               sched_update_numa(cpu, true);
diff --git a/queue-6.1/sched-smt-introduce-sched_smt_present_inc-dec-helper.patch b/queue-6.1/sched-smt-introduce-sched_smt_present_inc-dec-helper.patch
new file mode 100644 (file)
index 0000000..415b4bc
--- /dev/null
@@ -0,0 +1,77 @@
+From 31b164e2e4af84d08d2498083676e7eeaa102493 Mon Sep 17 00:00:00 2001
+From: Yang Yingliang <yangyingliang@huawei.com>
+Date: Wed, 3 Jul 2024 11:16:07 +0800
+Subject: sched/smt: Introduce sched_smt_present_inc/dec() helper
+
+From: Yang Yingliang <yangyingliang@huawei.com>
+
+commit 31b164e2e4af84d08d2498083676e7eeaa102493 upstream.
+
+Introduce sched_smt_present_inc/dec() helper, so it can be called
+in normal or error path simply. No functional changed.
+
+Cc: stable@kernel.org
+Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
+Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
+Link: https://lore.kernel.org/r/20240703031610.587047-2-yangyingliang@huaweicloud.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ kernel/sched/core.c |   26 +++++++++++++++++++-------
+ 1 file changed, 19 insertions(+), 7 deletions(-)
+
+--- a/kernel/sched/core.c
++++ b/kernel/sched/core.c
+@@ -9398,6 +9398,22 @@ static int cpuset_cpu_inactive(unsigned
+       return 0;
+ }
++static inline void sched_smt_present_inc(int cpu)
++{
++#ifdef CONFIG_SCHED_SMT
++      if (cpumask_weight(cpu_smt_mask(cpu)) == 2)
++              static_branch_inc_cpuslocked(&sched_smt_present);
++#endif
++}
++
++static inline void sched_smt_present_dec(int cpu)
++{
++#ifdef CONFIG_SCHED_SMT
++      if (cpumask_weight(cpu_smt_mask(cpu)) == 2)
++              static_branch_dec_cpuslocked(&sched_smt_present);
++#endif
++}
++
+ int sched_cpu_activate(unsigned int cpu)
+ {
+       struct rq *rq = cpu_rq(cpu);
+@@ -9409,13 +9425,10 @@ int sched_cpu_activate(unsigned int cpu)
+        */
+       balance_push_set(cpu, false);
+-#ifdef CONFIG_SCHED_SMT
+       /*
+        * When going up, increment the number of cores with SMT present.
+        */
+-      if (cpumask_weight(cpu_smt_mask(cpu)) == 2)
+-              static_branch_inc_cpuslocked(&sched_smt_present);
+-#endif
++      sched_smt_present_inc(cpu);
+       set_cpu_active(cpu, true);
+       if (sched_smp_initialized) {
+@@ -9485,13 +9498,12 @@ int sched_cpu_deactivate(unsigned int cp
+       }
+       rq_unlock_irqrestore(rq, &rf);
+-#ifdef CONFIG_SCHED_SMT
+       /*
+        * When going down, decrement the number of cores with SMT present.
+        */
+-      if (cpumask_weight(cpu_smt_mask(cpu)) == 2)
+-              static_branch_dec_cpuslocked(&sched_smt_present);
++      sched_smt_present_dec(cpu);
++#ifdef CONFIG_SCHED_SMT
+       sched_core_cpu_deactivate(cpu);
+ #endif
diff --git a/queue-6.1/selftests-mptcp-join-check-backup-support-in-signal-endp.patch b/queue-6.1/selftests-mptcp-join-check-backup-support-in-signal-endp.patch
new file mode 100644 (file)
index 0000000..46d39a0
--- /dev/null
@@ -0,0 +1,110 @@
+From stable+bounces-66070-greg=kroah.com@vger.kernel.org Thu Aug  8 17:38:49 2024
+From: "Matthieu Baerts (NGI0)" <matttbe@kernel.org>
+Date: Thu,  8 Aug 2024 17:38:30 +0200
+Subject: selftests: mptcp: join: check backup support in signal endp
+To: stable@vger.kernel.org, gregkh@linuxfoundation.org
+Cc: MPTCP Upstream <mptcp@lists.linux.dev>, "Matthieu Baerts (NGI0)" <matttbe@kernel.org>, Mat Martineau <martineau@kernel.org>, Paolo Abeni <pabeni@redhat.com>
+Message-ID: <20240808153829.2319257-2-matttbe@kernel.org>
+
+From: "Matthieu Baerts (NGI0)" <matttbe@kernel.org>
+
+commit f833470c27832136d4416d8fc55d658082af0989 upstream.
+
+Before the previous commit, 'signal' endpoints with the 'backup' flag
+were ignored when sending the MP_JOIN.
+
+The MPTCP Join selftest has then been modified to validate this case:
+the "single address, backup" test, is now validating the MP_JOIN with a
+backup flag as it is what we expect it to do with such name. The
+previous version has been kept, but renamed to "single address, switch
+to backup" to avoid confusions.
+
+The "single address with port, backup" test is also now validating the
+MPJ with a backup flag, which makes more sense than checking the switch
+to backup with an MP_PRIO.
+
+The "mpc backup both sides" test is now validating that the backup flag
+is also set in MP_JOIN from and to the addresses used in the initial
+subflow, using the special ID 0.
+
+The 'Fixes' tag here below is the same as the one from the previous
+commit: this patch here is not fixing anything wrong in the selftests,
+but it validates the previous fix for an issue introduced by this commit
+ID.
+
+Fixes: 4596a2c1b7f5 ("mptcp: allow creating non-backup subflows")
+Cc: stable@vger.kernel.org
+Reviewed-by: Mat Martineau <martineau@kernel.org>
+Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
+Signed-off-by: Paolo Abeni <pabeni@redhat.com>
+[ Conflicts in mptcp_join.sh because 'run_tests' helper has been
+  modified in multiple commits that are not in this version, e.g. commit
+  e571fb09c893 ("selftests: mptcp: add speed env var"). Adaptations
+  have been made to use the old way, similar to what is done around. ]
+Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ tools/testing/selftests/net/mptcp/mptcp_join.sh |   33 +++++++++++++++++++-----
+ 1 file changed, 27 insertions(+), 6 deletions(-)
+
+--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
++++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
+@@ -2666,6 +2666,18 @@ backup_tests()
+       if reset "single address, backup" &&
+          continue_if mptcp_lib_kallsyms_has "subflow_rebuild_header$"; then
+               pm_nl_set_limits $ns1 0 1
++              pm_nl_add_endpoint $ns1 10.0.2.1 flags signal,backup
++              pm_nl_set_limits $ns2 1 1
++              run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow nobackup
++              chk_join_nr 1 1 1
++              chk_add_nr 1 1
++              chk_prio_nr 1 0 0 1
++      fi
++
++      # single address, switch to backup
++      if reset "single address, switch to backup" &&
++         continue_if mptcp_lib_kallsyms_has "subflow_rebuild_header$"; then
++              pm_nl_set_limits $ns1 0 1
+               pm_nl_add_endpoint $ns1 10.0.2.1 flags signal
+               pm_nl_set_limits $ns2 1 1
+               run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow backup
+@@ -2678,12 +2690,12 @@ backup_tests()
+       if reset "single address with port, backup" &&
+          continue_if mptcp_lib_kallsyms_has "subflow_rebuild_header$"; then
+               pm_nl_set_limits $ns1 0 1
+-              pm_nl_add_endpoint $ns1 10.0.2.1 flags signal port 10100
++              pm_nl_add_endpoint $ns1 10.0.2.1 flags signal,backup port 10100
+               pm_nl_set_limits $ns2 1 1
+-              run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow backup
++              run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow nobackup
+               chk_join_nr 1 1 1
+               chk_add_nr 1 1
+-              chk_prio_nr 1 1 0 0
++              chk_prio_nr 1 0 0 1
+       fi
+       if reset "mpc backup" &&
+@@ -2696,11 +2708,20 @@ backup_tests()
+       if reset "mpc backup both sides" &&
+          continue_if mptcp_lib_kallsyms_doesnt_have "T mptcp_subflow_send_ack$"; then
+-              pm_nl_add_endpoint $ns1 10.0.1.1 flags subflow,backup
++              pm_nl_set_limits $ns1 0 2
++              pm_nl_set_limits $ns2 1 2
++              pm_nl_add_endpoint $ns1 10.0.1.1 flags signal,backup
+               pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow,backup
++
++              # 10.0.2.2 (non-backup) -> 10.0.1.1 (backup)
++              pm_nl_add_endpoint $ns2 10.0.2.2 flags subflow
++              # 10.0.1.2 (backup) -> 10.0.2.1 (non-backup)
++              pm_nl_add_endpoint $ns1 10.0.2.1 flags signal
++              ip -net "$ns2" route add 10.0.2.1 via 10.0.1.1 dev ns2eth1 # force this path
++
+               run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow
+-              chk_join_nr 0 0 0
+-              chk_prio_nr 1 1 0 0
++              chk_join_nr 2 2 2
++              chk_prio_nr 1 1 1 1
+       fi
+       if reset "mpc switch to backup" &&
diff --git a/queue-6.1/selftests-mptcp-join-validate-backup-in-mpj.patch b/queue-6.1/selftests-mptcp-join-validate-backup-in-mpj.patch
new file mode 100644 (file)
index 0000000..e9abee0
--- /dev/null
@@ -0,0 +1,176 @@
+From stable+bounces-66069-greg=kroah.com@vger.kernel.org Thu Aug  8 17:37:57 2024
+From: "Matthieu Baerts (NGI0)" <matttbe@kernel.org>
+Date: Thu,  8 Aug 2024 17:36:58 +0200
+Subject: selftests: mptcp: join: validate backup in MPJ
+To: stable@vger.kernel.org, gregkh@linuxfoundation.org
+Cc: MPTCP Upstream <mptcp@lists.linux.dev>, "Matthieu Baerts (NGI0)" <matttbe@kernel.org>, Mat Martineau <martineau@kernel.org>, Paolo Abeni <pabeni@redhat.com>
+Message-ID: <20240808153657.2317378-2-matttbe@kernel.org>
+
+From: "Matthieu Baerts (NGI0)" <matttbe@kernel.org>
+
+commit 935ff5bb8a1cfcdf8e60c8f5c794d0bbbc234437 upstream.
+
+A peer can notify the other one that a subflow has to be treated as
+"backup" by two different ways: either by sending a dedicated MP_PRIO
+notification, or by setting the backup flag in the MP_JOIN handshake.
+
+The selftests were previously monitoring the former, but not the latter.
+This is what is now done here by looking at these new MIB counters when
+validating the 'backup' cases:
+
+  MPTcpExtMPJoinSynBackupRx
+  MPTcpExtMPJoinSynAckBackupRx
+
+The 'Fixes' tag here below is the same as the one from the previous
+commit: this patch here is not fixing anything wrong in the selftests,
+but it will help to validate a new fix for an issue introduced by this
+commit ID.
+
+Fixes: 4596a2c1b7f5 ("mptcp: allow creating non-backup subflows")
+Cc: stable@vger.kernel.org
+Reviewed-by: Mat Martineau <martineau@kernel.org>
+Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
+Signed-off-by: Paolo Abeni <pabeni@redhat.com>
+[ Conflicts in mptcp_join.sh because the check are done has changed,
+  e.g. in commit 03668c65d153 ("selftests: mptcp: join: rework detailed
+  report"), or commit 985de45923e2 ("selftests: mptcp: centralize stats
+  dumping"), etc. Adaptations have been made to use the old way, similar
+  to what is done just above. ]
+Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ tools/testing/selftests/net/mptcp/mptcp_join.sh |   46 ++++++++++++++++++------
+ 1 file changed, 36 insertions(+), 10 deletions(-)
+
+--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
++++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
+@@ -1800,6 +1800,8 @@ chk_prio_nr()
+ {
+       local mp_prio_nr_tx=$1
+       local mp_prio_nr_rx=$2
++      local mpj_syn=$3
++      local mpj_syn_ack=$4
+       local count
+       local dump_stats
+@@ -1827,6 +1829,30 @@ chk_prio_nr()
+               echo "[ ok ]"
+       fi
++      printf "%-${nr_blank}s %s" " " "bkp syn"
++      count=$(get_counter ${ns1} "MPTcpExtMPJoinSynBackupRx")
++      if [ -z "$count" ]; then
++              echo -n "[skip]"
++      elif [ "$count" != "$mpj_syn" ]; then
++              echo "[fail] got $count JOIN[s] syn with Backup expected $mpj_syn"
++              fail_test
++              dump_stats=1
++      else
++              echo -n "[ ok ]"
++      fi
++
++      echo -n " - synack   "
++      count=$(get_counter ${ns2} "MPTcpExtMPJoinSynAckBackupRx")
++      if [ -z "$count" ]; then
++              echo "[skip]"
++      elif [ "$count" != "$mpj_syn_ack" ]; then
++              echo "[fail] got $count JOIN[s] synack with Backup expected $mpj_syn_ack"
++              fail_test
++              dump_stats=1
++      else
++              echo "[ ok ]"
++      fi
++
+       [ "${dump_stats}" = 1 ] && dump_stats
+ }
+@@ -2633,7 +2659,7 @@ backup_tests()
+               pm_nl_add_endpoint $ns2 10.0.3.2 flags subflow,backup
+               run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow nobackup
+               chk_join_nr 1 1 1
+-              chk_prio_nr 0 1
++              chk_prio_nr 0 1 1 0
+       fi
+       # single address, backup
+@@ -2645,7 +2671,7 @@ backup_tests()
+               run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow backup
+               chk_join_nr 1 1 1
+               chk_add_nr 1 1
+-              chk_prio_nr 1 1
++              chk_prio_nr 1 1 0 0
+       fi
+       # single address with port, backup
+@@ -2657,7 +2683,7 @@ backup_tests()
+               run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow backup
+               chk_join_nr 1 1 1
+               chk_add_nr 1 1
+-              chk_prio_nr 1 1
++              chk_prio_nr 1 1 0 0
+       fi
+       if reset "mpc backup" &&
+@@ -2665,7 +2691,7 @@ backup_tests()
+               pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow,backup
+               run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow
+               chk_join_nr 0 0 0
+-              chk_prio_nr 0 1
++              chk_prio_nr 0 1 0 0
+       fi
+       if reset "mpc backup both sides" &&
+@@ -2674,7 +2700,7 @@ backup_tests()
+               pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow,backup
+               run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow
+               chk_join_nr 0 0 0
+-              chk_prio_nr 1 1
++              chk_prio_nr 1 1 0 0
+       fi
+       if reset "mpc switch to backup" &&
+@@ -2682,7 +2708,7 @@ backup_tests()
+               pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow
+               run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow backup
+               chk_join_nr 0 0 0
+-              chk_prio_nr 0 1
++              chk_prio_nr 0 1 0 0
+       fi
+       if reset "mpc switch to backup both sides" &&
+@@ -2691,7 +2717,7 @@ backup_tests()
+               pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow
+               run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow backup
+               chk_join_nr 0 0 0
+-              chk_prio_nr 1 1
++              chk_prio_nr 1 1 0 0
+       fi
+ }
+@@ -3022,7 +3048,7 @@ fullmesh_tests()
+               pm_nl_set_limits $ns2 4 4
+               run_tests $ns1 $ns2 10.0.1.1 0 0 1 slow backup,fullmesh
+               chk_join_nr 2 2 2
+-              chk_prio_nr 0 1
++              chk_prio_nr 0 1 1 0
+               chk_rm_nr 0 1
+       fi
+@@ -3034,7 +3060,7 @@ fullmesh_tests()
+               pm_nl_add_endpoint $ns2 10.0.2.2 flags subflow,backup,fullmesh
+               run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow nobackup,nofullmesh
+               chk_join_nr 2 2 2
+-              chk_prio_nr 0 1
++              chk_prio_nr 0 1 1 0
+               chk_rm_nr 0 1
+       fi
+ }
+@@ -3140,7 +3166,7 @@ userspace_tests()
+               pm_nl_add_endpoint $ns2 10.0.3.2 flags subflow
+               run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow backup
+               chk_join_nr 1 1 0
+-              chk_prio_nr 0 0
++              chk_prio_nr 0 0 0 0
+       fi
+       # userspace pm type prevents rm_addr
index 1d20de11589f35edaa8b4a955fd853b6cc311154..d1b4dba443c052adec15bf6fb2bf1516fdbbe20a 100644 (file)
@@ -119,3 +119,15 @@ padata-fix-possible-divide-by-0-panic-in-padata_mt_helper.patch
 smb3-fix-setting-securityflags-when-encryption-is-required.patch
 btrfs-avoid-using-fixed-char-array-size-for-tree-names.patch
 x86-mtrr-check-if-fixed-mtrrs-exist-before-saving-them.patch
+sched-smt-introduce-sched_smt_present_inc-dec-helper.patch
+sched-smt-fix-unbalance-sched_smt_present-dec-inc.patch
+drm-bridge-analogix_dp-properly-handle-zero-sized-aux-transactions.patch
+drm-dp_mst-skip-csn-if-topology-probing-is-not-done-yet.patch
+drm-lima-mark-simple_ondemand-governor-as-softdep.patch
+drm-mgag200-set-ddc-timeout-in-milliseconds.patch
+drm-mgag200-bind-i2c-lifetime-to-drm-device.patch
+mptcp-mib-count-mpj-with-backup-flag.patch
+mptcp-export-local_address.patch
+mptcp-pm-fix-backup-support-in-signal-endpoints.patch
+selftests-mptcp-join-validate-backup-in-mpj.patch
+selftests-mptcp-join-check-backup-support-in-signal-endp.patch