From: Sasha Levin Date: Fri, 23 Aug 2024 00:12:54 +0000 (-0400) Subject: Fixes for 5.15 X-Git-Tag: v6.1.107~79 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=61642975701746db4af77d0b108740cf20f6538f;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 5.15 Signed-off-by: Sasha Levin --- diff --git a/queue-5.15/dm-suspend-return-erestartsys-instead-of-eintr.patch b/queue-5.15/dm-suspend-return-erestartsys-instead-of-eintr.patch new file mode 100644 index 00000000000..6e744a35375 --- /dev/null +++ b/queue-5.15/dm-suspend-return-erestartsys-instead-of-eintr.patch @@ -0,0 +1,48 @@ +From 8d41a84b54af9ef5f0586ed015b6260b6838da59 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 13 Aug 2024 12:38:51 +0200 +Subject: dm suspend: return -ERESTARTSYS instead of -EINTR + +From: Mikulas Patocka + +[ Upstream commit 1e1fd567d32fcf7544c6e09e0e5bc6c650da6e23 ] + +This commit changes device mapper, so that it returns -ERESTARTSYS +instead of -EINTR when it is interrupted by a signal (so that the ioctl +can be restarted). + +The manpage signal(7) says that the ioctl function should be restarted if +the signal was handled with SA_RESTART. + +Signed-off-by: Mikulas Patocka +Cc: stable@vger.kernel.org +Signed-off-by: Sasha Levin +--- + drivers/md/dm.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/md/dm.c b/drivers/md/dm.c +index fd9bb8b53219a..8199166ca8620 100644 +--- a/drivers/md/dm.c ++++ b/drivers/md/dm.c +@@ -2255,7 +2255,7 @@ static int dm_wait_for_bios_completion(struct mapped_device *md, unsigned int ta + break; + + if (signal_pending_state(task_state, current)) { +- r = -EINTR; ++ r = -ERESTARTSYS; + break; + } + +@@ -2280,7 +2280,7 @@ static int dm_wait_for_completion(struct mapped_device *md, unsigned int task_st + break; + + if (signal_pending_state(task_state, current)) { +- r = -EINTR; ++ r = -ERESTARTSYS; + break; + } + +-- +2.43.0 + diff --git a/queue-5.15/net-mana-fix-doorbell-out-of-order-violation-and-avo.patch b/queue-5.15/net-mana-fix-doorbell-out-of-order-violation-and-avo.patch new file mode 100644 index 00000000000..5b3d0ff6477 --- /dev/null +++ b/queue-5.15/net-mana-fix-doorbell-out-of-order-violation-and-avo.patch @@ -0,0 +1,98 @@ +From 97de61d38e601d9c0f41ae327cc6ea423a4a6a93 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 9 Aug 2024 08:58:58 -0700 +Subject: net: mana: Fix doorbell out of order violation and avoid unnecessary + doorbell rings + +From: Long Li + +[ Upstream commit 58a63729c957621f1990c3494c702711188ca347 ] + +After napi_complete_done() is called when NAPI is polling in the current +process context, another NAPI may be scheduled and start running in +softirq on another CPU and may ring the doorbell before the current CPU +does. When combined with unnecessary rings when there is no need to arm +the CQ, it triggers error paths in the hardware. + +This patch fixes this by calling napi_complete_done() after doorbell +rings. It limits the number of unnecessary rings when there is +no need to arm. MANA hardware specifies that there must be one doorbell +ring every 8 CQ wraparounds. This driver guarantees one doorbell ring as +soon as the number of consumed CQEs exceeds 4 CQ wraparounds. In practical +workloads, the 4 CQ wraparounds proves to be big enough that it rarely +exceeds this limit before all the napi weight is consumed. + +To implement this, add a per-CQ counter cq->work_done_since_doorbell, +and make sure the CQ is armed as soon as passing 4 wraparounds of the CQ. + +Cc: stable@vger.kernel.org +Fixes: e1b5683ff62e ("net: mana: Move NAPI from EQ to CQ") +Reviewed-by: Haiyang Zhang +Signed-off-by: Long Li +Link: https://patch.msgid.link/1723219138-29887-1-git-send-email-longli@linuxonhyperv.com +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/microsoft/mana/mana.h | 1 + + drivers/net/ethernet/microsoft/mana/mana_en.c | 24 ++++++++++++------- + 2 files changed, 16 insertions(+), 9 deletions(-) + +diff --git a/drivers/net/ethernet/microsoft/mana/mana.h b/drivers/net/ethernet/microsoft/mana/mana.h +index fc98a5ba5ed07..35e937a7079c0 100644 +--- a/drivers/net/ethernet/microsoft/mana/mana.h ++++ b/drivers/net/ethernet/microsoft/mana/mana.h +@@ -252,6 +252,7 @@ struct mana_cq { + /* NAPI data */ + struct napi_struct napi; + int work_done; ++ int work_done_since_doorbell; + int budget; + }; + +diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c +index 6224b7c21e0af..b0963fda4d9fd 100644 +--- a/drivers/net/ethernet/microsoft/mana/mana_en.c ++++ b/drivers/net/ethernet/microsoft/mana/mana_en.c +@@ -1074,7 +1074,6 @@ static void mana_poll_rx_cq(struct mana_cq *cq) + static int mana_cq_handler(void *context, struct gdma_queue *gdma_queue) + { + struct mana_cq *cq = context; +- u8 arm_bit; + int w; + + WARN_ON_ONCE(cq->gdma_cq != gdma_queue); +@@ -1085,16 +1084,23 @@ static int mana_cq_handler(void *context, struct gdma_queue *gdma_queue) + mana_poll_tx_cq(cq); + + w = cq->work_done; +- +- if (w < cq->budget && +- napi_complete_done(&cq->napi, w)) { +- arm_bit = SET_ARM_BIT; +- } else { +- arm_bit = 0; ++ cq->work_done_since_doorbell += w; ++ ++ if (w < cq->budget) { ++ mana_gd_ring_cq(gdma_queue, SET_ARM_BIT); ++ cq->work_done_since_doorbell = 0; ++ napi_complete_done(&cq->napi, w); ++ } else if (cq->work_done_since_doorbell > ++ cq->gdma_cq->queue_size / COMP_ENTRY_SIZE * 4) { ++ /* MANA hardware requires at least one doorbell ring every 8 ++ * wraparounds of CQ even if there is no need to arm the CQ. ++ * This driver rings the doorbell as soon as we have exceeded ++ * 4 wraparounds. ++ */ ++ mana_gd_ring_cq(gdma_queue, 0); ++ cq->work_done_since_doorbell = 0; + } + +- mana_gd_ring_cq(gdma_queue, arm_bit); +- + return w; + } + +-- +2.43.0 + diff --git a/queue-5.15/platform-surface-aggregator-fix-warning-when-control.patch b/queue-5.15/platform-surface-aggregator-fix-warning-when-control.patch new file mode 100644 index 00000000000..95f31c88366 --- /dev/null +++ b/queue-5.15/platform-surface-aggregator-fix-warning-when-control.patch @@ -0,0 +1,65 @@ +From a045b837867dc0ba2a26859b49ea177c772c822e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 11 Aug 2024 14:46:44 +0200 +Subject: platform/surface: aggregator: Fix warning when controller is + destroyed in probe +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Maximilian Luz + +[ Upstream commit bc923d594db21bee0ead128eb4bb78f7e77467a4 ] + +There is a small window in ssam_serial_hub_probe() where the controller +is initialized but has not been started yet. Specifically, between +ssam_controller_init() and ssam_controller_start(). Any failure in this +window, for example caused by a failure of serdev_device_open(), +currently results in an incorrect warning being emitted. + +In particular, any failure in this window results in the controller +being destroyed via ssam_controller_destroy(). This function checks the +state of the controller and, in an attempt to validate that the +controller has been cleanly shut down before we try and deallocate any +resources, emits a warning if that state is not SSAM_CONTROLLER_STOPPED. + +However, since we have only just initialized the controller and have not +yet started it, its state is SSAM_CONTROLLER_INITIALIZED. Note that this +is the only point at which the controller has this state, as it will +change after we start the controller with ssam_controller_start() and +never revert back. Further, at this point no communication has taken +place and the sender and receiver threads have not been started yet (and +we may not even have an open serdev device either). + +Therefore, it is perfectly safe to call ssam_controller_destroy() with a +state of SSAM_CONTROLLER_INITIALIZED. This, however, means that the +warning currently being emitted is incorrect. Fix it by extending the +check. + +Fixes: c167b9c7e3d6 ("platform/surface: Add Surface Aggregator subsystem") +Signed-off-by: Maximilian Luz +Link: https://lore.kernel.org/r/20240811124645.246016-1-luzmaximilian@gmail.com +Reviewed-by: Ilpo Järvinen +Signed-off-by: Ilpo Järvinen +Signed-off-by: Sasha Levin +--- + drivers/platform/surface/aggregator/controller.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/platform/surface/aggregator/controller.c b/drivers/platform/surface/aggregator/controller.c +index 5542b768890c9..cc78687d6874c 100644 +--- a/drivers/platform/surface/aggregator/controller.c ++++ b/drivers/platform/surface/aggregator/controller.c +@@ -1354,7 +1354,8 @@ void ssam_controller_destroy(struct ssam_controller *ctrl) + if (ctrl->state == SSAM_CONTROLLER_UNINITIALIZED) + return; + +- WARN_ON(ctrl->state != SSAM_CONTROLLER_STOPPED); ++ WARN_ON(ctrl->state != SSAM_CONTROLLER_STOPPED && ++ ctrl->state != SSAM_CONTROLLER_INITIALIZED); + + /* + * Note: New events could still have been received after the previous +-- +2.43.0 + diff --git a/queue-5.15/series b/queue-5.15/series index 7b62fc09d02..8f7ee87f538 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -127,3 +127,6 @@ nfsd-make-all-of-the-nfsd-stats-per-network-namespace.patch nfsd-remove-nfsd_stats-make-th_cnt-a-global-counter.patch nfsd-make-svc_stat-per-network-namespace-instead-of-global.patch media-solo6x10-replace-max-a-min-b-c-by-clamp-b-a-c.patch +dm-suspend-return-erestartsys-instead-of-eintr.patch +net-mana-fix-doorbell-out-of-order-violation-and-avo.patch +platform-surface-aggregator-fix-warning-when-control.patch