From: Greg Kroah-Hartman Date: Mon, 23 Dec 2024 12:51:30 +0000 (+0100) Subject: 6.6-stable patches X-Git-Tag: v6.1.122~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1e7a3eb7ea47112281ff84d852b76287656f5278;p=thirdparty%2Fkernel%2Fstable-queue.git 6.6-stable patches added patches: epoll-add-synchronous-wakeup-support-for-ep_poll_callback.patch io_uring-rw-avoid-punting-to-io-wq-directly.patch io_uring-rw-split-io_read-into-a-helper.patch io_uring-rw-treat-eopnotsupp-for-iocb_nowait-like-eagain.patch net-fec-make-pps-channel-configurable.patch net-fec-refactor-pps-channel-configuration.patch --- diff --git a/queue-6.6/epoll-add-synchronous-wakeup-support-for-ep_poll_callback.patch b/queue-6.6/epoll-add-synchronous-wakeup-support-for-ep_poll_callback.patch new file mode 100644 index 00000000000..172805aa1a0 --- /dev/null +++ b/queue-6.6/epoll-add-synchronous-wakeup-support-for-ep_poll_callback.patch @@ -0,0 +1,55 @@ +From 900bbaae67e980945dec74d36f8afe0de7556d5a Mon Sep 17 00:00:00 2001 +From: Xuewen Yan +Date: Fri, 26 Apr 2024 16:05:48 +0800 +Subject: epoll: Add synchronous wakeup support for ep_poll_callback + +From: Xuewen Yan + +commit 900bbaae67e980945dec74d36f8afe0de7556d5a upstream. + +Now, the epoll only use wake_up() interface to wake up task. +However, sometimes, there are epoll users which want to use +the synchronous wakeup flag to hint the scheduler, such as +Android binder driver. +So add a wake_up_sync() define, and use the wake_up_sync() +when the sync is true in ep_poll_callback(). + +Co-developed-by: Jing Xia +Signed-off-by: Jing Xia +Signed-off-by: Xuewen Yan +Link: https://lore.kernel.org/r/20240426080548.8203-1-xuewen.yan@unisoc.com +Tested-by: Brian Geffon +Reviewed-by: Brian Geffon +Reported-by: Benoit Lize +Signed-off-by: Christian Brauner +Cc: Brian Geffon +Signed-off-by: Greg Kroah-Hartman +--- + fs/eventpoll.c | 5 ++++- + include/linux/wait.h | 1 + + 2 files changed, 5 insertions(+), 1 deletion(-) + +--- a/fs/eventpoll.c ++++ b/fs/eventpoll.c +@@ -1268,7 +1268,10 @@ static int ep_poll_callback(wait_queue_e + break; + } + } +- wake_up(&ep->wq); ++ if (sync) ++ wake_up_sync(&ep->wq); ++ else ++ wake_up(&ep->wq); + } + if (waitqueue_active(&ep->poll_wait)) + pwake++; +--- a/include/linux/wait.h ++++ b/include/linux/wait.h +@@ -225,6 +225,7 @@ void __wake_up_pollfree(struct wait_queu + #define wake_up_all(x) __wake_up(x, TASK_NORMAL, 0, NULL) + #define wake_up_locked(x) __wake_up_locked((x), TASK_NORMAL, 1) + #define wake_up_all_locked(x) __wake_up_locked((x), TASK_NORMAL, 0) ++#define wake_up_sync(x) __wake_up_sync(x, TASK_NORMAL) + + #define wake_up_interruptible(x) __wake_up(x, TASK_INTERRUPTIBLE, 1, NULL) + #define wake_up_interruptible_nr(x, nr) __wake_up(x, TASK_INTERRUPTIBLE, nr, NULL) diff --git a/queue-6.6/io_uring-rw-avoid-punting-to-io-wq-directly.patch b/queue-6.6/io_uring-rw-avoid-punting-to-io-wq-directly.patch new file mode 100644 index 00000000000..1b4f8a1b46e --- /dev/null +++ b/queue-6.6/io_uring-rw-avoid-punting-to-io-wq-directly.patch @@ -0,0 +1,97 @@ +From 20558ae136562a71d0033306cd66c69b630cc700 Mon Sep 17 00:00:00 2001 +From: Pavel Begunkov +Date: Mon, 18 Mar 2024 22:00:28 +0000 +Subject: io_uring/rw: avoid punting to io-wq directly + +From: Pavel Begunkov + +Commit 6e6b8c62120a22acd8cb759304e4cd2e3215d488 upstream. + +kiocb_done() should care to specifically redirecting requests to io-wq. +Remove the hopping to tw to then queue an io-wq, return -EAGAIN and let +the core code io_uring handle offloading. + +Signed-off-by: Pavel Begunkov +Tested-by: Ming Lei +Link: https://lore.kernel.org/r/413564e550fe23744a970e1783dfa566291b0e6f.1710799188.git.asml.silence@gmail.com +Signed-off-by: Jens Axboe +(cherry picked from commit 6e6b8c62120a22acd8cb759304e4cd2e3215d488) +Signed-off-by: Greg Kroah-Hartman +--- + io_uring/io_uring.c | 8 ++++---- + io_uring/io_uring.h | 1 - + io_uring/rw.c | 8 +------- + 3 files changed, 5 insertions(+), 12 deletions(-) + +--- a/io_uring/io_uring.c ++++ b/io_uring/io_uring.c +@@ -492,7 +492,7 @@ static void io_prep_async_link(struct io + } + } + +-void io_queue_iowq(struct io_kiocb *req, struct io_tw_state *ts_dont_use) ++static void io_queue_iowq(struct io_kiocb *req) + { + struct io_kiocb *link = io_prep_linked_timeout(req); + struct io_uring_task *tctx = req->task->io_uring; +@@ -1479,7 +1479,7 @@ void io_req_task_submit(struct io_kiocb + if (unlikely(req->task->flags & PF_EXITING)) + io_req_defer_failed(req, -EFAULT); + else if (req->flags & REQ_F_FORCE_ASYNC) +- io_queue_iowq(req, ts); ++ io_queue_iowq(req); + else + io_queue_sqe(req); + } +@@ -2044,7 +2044,7 @@ static void io_queue_async(struct io_kio + break; + case IO_APOLL_ABORTED: + io_kbuf_recycle(req, 0); +- io_queue_iowq(req, NULL); ++ io_queue_iowq(req); + break; + case IO_APOLL_OK: + break; +@@ -2093,7 +2093,7 @@ static void io_queue_sqe_fallback(struct + if (unlikely(req->ctx->drain_active)) + io_drain_req(req); + else +- io_queue_iowq(req, NULL); ++ io_queue_iowq(req); + } + } + +--- a/io_uring/io_uring.h ++++ b/io_uring/io_uring.h +@@ -63,7 +63,6 @@ struct file *io_file_get_fixed(struct io + void __io_req_task_work_add(struct io_kiocb *req, unsigned flags); + bool io_alloc_async_data(struct io_kiocb *req); + void io_req_task_queue(struct io_kiocb *req); +-void io_queue_iowq(struct io_kiocb *req, struct io_tw_state *ts_dont_use); + void io_req_task_complete(struct io_kiocb *req, struct io_tw_state *ts); + void io_req_task_queue_fail(struct io_kiocb *req, int ret); + void io_req_task_submit(struct io_kiocb *req, struct io_tw_state *ts); +--- a/io_uring/rw.c ++++ b/io_uring/rw.c +@@ -168,12 +168,6 @@ static inline loff_t *io_kiocb_update_po + return NULL; + } + +-static void io_req_task_queue_reissue(struct io_kiocb *req) +-{ +- req->io_task_work.func = io_queue_iowq; +- io_req_task_work_add(req); +-} +- + #ifdef CONFIG_BLOCK + static bool io_resubmit_prep(struct io_kiocb *req) + { +@@ -359,7 +353,7 @@ static int kiocb_done(struct io_kiocb *r + if (req->flags & REQ_F_REISSUE) { + req->flags &= ~REQ_F_REISSUE; + if (io_resubmit_prep(req)) +- io_req_task_queue_reissue(req); ++ return -EAGAIN; + else + io_req_task_queue_fail(req, final_ret); + } diff --git a/queue-6.6/io_uring-rw-split-io_read-into-a-helper.patch b/queue-6.6/io_uring-rw-split-io_read-into-a-helper.patch new file mode 100644 index 00000000000..30280cdef27 --- /dev/null +++ b/queue-6.6/io_uring-rw-split-io_read-into-a-helper.patch @@ -0,0 +1,51 @@ +From 1d342f04ea6252239e8c30a02b55131a4d8d8841 Mon Sep 17 00:00:00 2001 +From: Jens Axboe +Date: Mon, 11 Sep 2023 13:31:56 -0600 +Subject: io_uring/rw: split io_read() into a helper + +From: Jens Axboe + +Commit a08d195b586a217d76b42062f88f375a3eedda4d upstream. + +Add __io_read() which does the grunt of the work, leaving the completion +side to the new io_read(). No functional changes in this patch. + +Reviewed-by: Gabriel Krisman Bertazi +Signed-off-by: Jens Axboe +(cherry picked from commit a08d195b586a217d76b42062f88f375a3eedda4d) +Signed-off-by: Greg Kroah-Hartman +--- + io_uring/rw.c | 15 +++++++++++++-- + 1 file changed, 13 insertions(+), 2 deletions(-) + +--- a/io_uring/rw.c ++++ b/io_uring/rw.c +@@ -712,7 +712,7 @@ static int io_rw_init_file(struct io_kio + return 0; + } + +-int io_read(struct io_kiocb *req, unsigned int issue_flags) ++static int __io_read(struct io_kiocb *req, unsigned int issue_flags) + { + struct io_rw *rw = io_kiocb_to_cmd(req, struct io_rw); + struct io_rw_state __s, *s = &__s; +@@ -857,7 +857,18 @@ done: + /* it's faster to check here then delegate to kfree */ + if (iovec) + kfree(iovec); +- return kiocb_done(req, ret, issue_flags); ++ return ret; ++} ++ ++int io_read(struct io_kiocb *req, unsigned int issue_flags) ++{ ++ int ret; ++ ++ ret = __io_read(req, issue_flags); ++ if (ret >= 0) ++ return kiocb_done(req, ret, issue_flags); ++ ++ return ret; + } + + static bool io_kiocb_start_write(struct io_kiocb *req, struct kiocb *kiocb) diff --git a/queue-6.6/io_uring-rw-treat-eopnotsupp-for-iocb_nowait-like-eagain.patch b/queue-6.6/io_uring-rw-treat-eopnotsupp-for-iocb_nowait-like-eagain.patch new file mode 100644 index 00000000000..bf0da5d55e3 --- /dev/null +++ b/queue-6.6/io_uring-rw-treat-eopnotsupp-for-iocb_nowait-like-eagain.patch @@ -0,0 +1,46 @@ +From 83a4219fda02c0fda93c3def2d85e952161d4651 Mon Sep 17 00:00:00 2001 +From: Jens Axboe +Date: Tue, 10 Sep 2024 08:30:57 -0600 +Subject: io_uring/rw: treat -EOPNOTSUPP for IOCB_NOWAIT like -EAGAIN + +From: Jens Axboe + +Commit c0a9d496e0fece67db777bd48550376cf2960c47 upstream. + +Some file systems, ocfs2 in this case, will return -EOPNOTSUPP for +an IOCB_NOWAIT read/write attempt. While this can be argued to be +correct, the usual return value for something that requires blocking +issue is -EAGAIN. + +A refactoring io_uring commit dropped calling kiocb_done() for +negative return values, which is otherwise where we already do that +transformation. To ensure we catch it in both spots, check it in +__io_read() itself as well. + +Reported-by: Robert Sander +Link: https://fosstodon.org/@gurubert@mastodon.gurubert.de/113112431889638440 +Cc: stable@vger.kernel.org +Fixes: a08d195b586a ("io_uring/rw: split io_read() into a helper") +Signed-off-by: Jens Axboe +Signed-off-by: Greg Kroah-Hartman +--- + io_uring/rw.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +--- a/io_uring/rw.c ++++ b/io_uring/rw.c +@@ -778,6 +778,14 @@ static int __io_read(struct io_kiocb *re + + ret = io_iter_do_read(rw, &s->iter); + ++ /* ++ * Some file systems like to return -EOPNOTSUPP for an IOCB_NOWAIT ++ * issue, even though they should be returning -EAGAIN. To be safe, ++ * retry from blocking context for either. ++ */ ++ if (ret == -EOPNOTSUPP && force_nonblock) ++ ret = -EAGAIN; ++ + if (ret == -EAGAIN || (req->flags & REQ_F_REISSUE)) { + req->flags &= ~REQ_F_REISSUE; + /* if we can poll, just do that */ diff --git a/queue-6.6/net-fec-make-pps-channel-configurable.patch b/queue-6.6/net-fec-make-pps-channel-configurable.patch new file mode 100644 index 00000000000..361a593e3f7 --- /dev/null +++ b/queue-6.6/net-fec-make-pps-channel-configurable.patch @@ -0,0 +1,58 @@ +From 566c2d83887f0570056833102adc5b88e681b0c7 Mon Sep 17 00:00:00 2001 +From: Francesco Dolcini +Date: Fri, 4 Oct 2024 17:24:19 +0200 +Subject: net: fec: make PPS channel configurable +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Francesco Dolcini + +commit 566c2d83887f0570056833102adc5b88e681b0c7 upstream. + +Depending on the SoC where the FEC is integrated into the PPS channel +might be routed to different timer instances. Make this configurable +from the devicetree. + +When the related DT property is not present fallback to the previous +default and use channel 0. + +Reviewed-by: Frank Li +Tested-by: Rafael Beims +Signed-off-by: Francesco Dolcini +Reviewed-by: Csókás, Bence +Signed-off-by: Paolo Abeni +Signed-off-by: Csókás, Bence +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/freescale/fec_ptp.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/drivers/net/ethernet/freescale/fec_ptp.c ++++ b/drivers/net/ethernet/freescale/fec_ptp.c +@@ -523,8 +523,6 @@ static int fec_ptp_enable(struct ptp_clo + unsigned long flags; + int ret = 0; + +- fep->pps_channel = DEFAULT_PPS_CHANNEL; +- + if (rq->type == PTP_CLK_REQ_PPS) { + fep->reload_period = PPS_OUPUT_RELOAD_PERIOD; + +@@ -706,12 +704,16 @@ void fec_ptp_init(struct platform_device + { + struct net_device *ndev = platform_get_drvdata(pdev); + struct fec_enet_private *fep = netdev_priv(ndev); ++ struct device_node *np = fep->pdev->dev.of_node; + int irq; + int ret; + + fep->ptp_caps.owner = THIS_MODULE; + strscpy(fep->ptp_caps.name, "fec ptp", sizeof(fep->ptp_caps.name)); + ++ fep->pps_channel = DEFAULT_PPS_CHANNEL; ++ of_property_read_u32(np, "fsl,pps-channel", &fep->pps_channel); ++ + fep->ptp_caps.max_adj = 250000000; + fep->ptp_caps.n_alarm = 0; + fep->ptp_caps.n_ext_ts = 0; diff --git a/queue-6.6/net-fec-refactor-pps-channel-configuration.patch b/queue-6.6/net-fec-refactor-pps-channel-configuration.patch new file mode 100644 index 00000000000..0d52d644126 --- /dev/null +++ b/queue-6.6/net-fec-refactor-pps-channel-configuration.patch @@ -0,0 +1,60 @@ +From bf8ca67e21671e7a56e31da45360480b28f185f1 Mon Sep 17 00:00:00 2001 +From: Francesco Dolcini +Date: Fri, 4 Oct 2024 17:24:18 +0200 +Subject: net: fec: refactor PPS channel configuration +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Francesco Dolcini + +commit bf8ca67e21671e7a56e31da45360480b28f185f1 upstream. + +Preparation patch to allow for PPS channel configuration, no functional +change intended. + +Signed-off-by: Francesco Dolcini +Reviewed-by: Frank Li +Reviewed-by: Csókás, Bence +Signed-off-by: Paolo Abeni +Signed-off-by: Csókás, Bence +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/freescale/fec_ptp.c | 9 ++++----- + 1 file changed, 4 insertions(+), 5 deletions(-) + +--- a/drivers/net/ethernet/freescale/fec_ptp.c ++++ b/drivers/net/ethernet/freescale/fec_ptp.c +@@ -84,8 +84,7 @@ + #define FEC_CC_MULT (1 << 31) + #define FEC_COUNTER_PERIOD (1 << 31) + #define PPS_OUPUT_RELOAD_PERIOD NSEC_PER_SEC +-#define FEC_CHANNLE_0 0 +-#define DEFAULT_PPS_CHANNEL FEC_CHANNLE_0 ++#define DEFAULT_PPS_CHANNEL 0 + + #define FEC_PTP_MAX_NSEC_PERIOD 4000000000ULL + #define FEC_PTP_MAX_NSEC_COUNTER 0x80000000ULL +@@ -524,8 +523,9 @@ static int fec_ptp_enable(struct ptp_clo + unsigned long flags; + int ret = 0; + ++ fep->pps_channel = DEFAULT_PPS_CHANNEL; ++ + if (rq->type == PTP_CLK_REQ_PPS) { +- fep->pps_channel = DEFAULT_PPS_CHANNEL; + fep->reload_period = PPS_OUPUT_RELOAD_PERIOD; + + ret = fec_ptp_enable_pps(fep, on); +@@ -536,10 +536,9 @@ static int fec_ptp_enable(struct ptp_clo + if (rq->perout.flags) + return -EOPNOTSUPP; + +- if (rq->perout.index != DEFAULT_PPS_CHANNEL) ++ if (rq->perout.index != fep->pps_channel) + return -EOPNOTSUPP; + +- fep->pps_channel = DEFAULT_PPS_CHANNEL; + period.tv_sec = rq->perout.period.sec; + period.tv_nsec = rq->perout.period.nsec; + period_ns = timespec64_to_ns(&period); diff --git a/queue-6.6/series b/queue-6.6/series index ba9acb183d3..ad62a10b37f 100644 --- a/queue-6.6/series +++ b/queue-6.6/series @@ -107,3 +107,9 @@ of-fix-refcount-leakage-for-of-node-returned-by-__of_get_dma_parent.patch ceph-validate-snapdirname-option-length-when-mounting.patch ceph-improve-error-handling-and-short-overflow-read-logic-in-__ceph_sync_read.patch ceph-fix-memory-leaks-in-__ceph_sync_read.patch +epoll-add-synchronous-wakeup-support-for-ep_poll_callback.patch +io_uring-rw-split-io_read-into-a-helper.patch +io_uring-rw-treat-eopnotsupp-for-iocb_nowait-like-eagain.patch +io_uring-rw-avoid-punting-to-io-wq-directly.patch +net-fec-refactor-pps-channel-configuration.patch +net-fec-make-pps-channel-configurable.patch