From fb48f952d4b59f14aa61b63d9c98249281055132 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 28 Oct 2024 07:13:28 +0100 Subject: [PATCH] 6.6-stable patches added patches: rdma-bnxt_re-avoid-creating-fence-mr-for-newer-adapters.patch rdma-bnxt_re-fix-the-offset-for-genp7-adapters-for-user-applications.patch rdma-bnxt_re-fix-unconditional-fence-for-newer-adapters.patch task_work-make-twa_nmi_current-handling-conditional-on-irq_work.patch tracing-probes-fix-to-zero-initialize-a-local-variable.patch --- ...creating-fence-mr-for-newer-adapters.patch | 56 +++++++++++++ ...genp7-adapters-for-user-applications.patch | 41 +++++++++ ...conditional-fence-for-newer-adapters.patch | 83 +++++++++++++++++++ queue-6.6/series | 5 ++ ...ent-handling-conditional-on-irq_work.patch | 72 ++++++++++++++++ ...-to-zero-initialize-a-local-variable.patch | 38 +++++++++ 6 files changed, 295 insertions(+) create mode 100644 queue-6.6/rdma-bnxt_re-avoid-creating-fence-mr-for-newer-adapters.patch create mode 100644 queue-6.6/rdma-bnxt_re-fix-the-offset-for-genp7-adapters-for-user-applications.patch create mode 100644 queue-6.6/rdma-bnxt_re-fix-unconditional-fence-for-newer-adapters.patch create mode 100644 queue-6.6/task_work-make-twa_nmi_current-handling-conditional-on-irq_work.patch create mode 100644 queue-6.6/tracing-probes-fix-to-zero-initialize-a-local-variable.patch diff --git a/queue-6.6/rdma-bnxt_re-avoid-creating-fence-mr-for-newer-adapters.patch b/queue-6.6/rdma-bnxt_re-avoid-creating-fence-mr-for-newer-adapters.patch new file mode 100644 index 00000000000..ca30fc555c5 --- /dev/null +++ b/queue-6.6/rdma-bnxt_re-avoid-creating-fence-mr-for-newer-adapters.patch @@ -0,0 +1,56 @@ +From 282fd66e2ef6e5d72b8fcd77efb2b282d2569464 Mon Sep 17 00:00:00 2001 +From: Kalesh AP +Date: Mon, 22 Jan 2024 20:54:33 -0800 +Subject: RDMA/bnxt_re: Avoid creating fence MR for newer adapters + +From: Kalesh AP + +commit 282fd66e2ef6e5d72b8fcd77efb2b282d2569464 upstream. + +Limit the usage of fence MR to adapters older than Gen P5 products. + +Fixes: 1801d87b3598 ("RDMA/bnxt_re: Support new 5760X P7 devices") +Signed-off-by: Kashyap Desai +Signed-off-by: Bhargava Chenna Marreddy +Signed-off-by: Kalesh AP +Signed-off-by: Selvin Xavier +Link: https://lore.kernel.org/r/1705985677-15551-2-git-send-email-selvin.xavier@broadcom.com +Signed-off-by: Leon Romanovsky +Signed-off-by: Greg Kroah-Hartman +--- + drivers/infiniband/hw/bnxt_re/ib_verbs.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c ++++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c +@@ -400,6 +400,10 @@ static void bnxt_re_create_fence_wqe(str + struct bnxt_re_fence_data *fence = &pd->fence; + struct ib_mr *ib_mr = &fence->mr->ib_mr; + struct bnxt_qplib_swqe *wqe = &fence->bind_wqe; ++ struct bnxt_re_dev *rdev = pd->rdev; ++ ++ if (bnxt_qplib_is_chip_gen_p5_p7(rdev->chip_ctx)) ++ return; + + memset(wqe, 0, sizeof(*wqe)); + wqe->type = BNXT_QPLIB_SWQE_TYPE_BIND_MW; +@@ -454,6 +458,9 @@ static void bnxt_re_destroy_fence_mr(str + struct device *dev = &rdev->en_dev->pdev->dev; + struct bnxt_re_mr *mr = fence->mr; + ++ if (bnxt_qplib_is_chip_gen_p5_p7(rdev->chip_ctx)) ++ return; ++ + if (fence->mw) { + bnxt_re_dealloc_mw(fence->mw); + fence->mw = NULL; +@@ -485,6 +492,9 @@ static int bnxt_re_create_fence_mr(struc + struct ib_mw *mw; + int rc; + ++ if (bnxt_qplib_is_chip_gen_p5_p7(rdev->chip_ctx)) ++ return 0; ++ + dma_addr = dma_map_single(dev, fence->va, BNXT_RE_FENCE_BYTES, + DMA_BIDIRECTIONAL); + rc = dma_mapping_error(dev, dma_addr); diff --git a/queue-6.6/rdma-bnxt_re-fix-the-offset-for-genp7-adapters-for-user-applications.patch b/queue-6.6/rdma-bnxt_re-fix-the-offset-for-genp7-adapters-for-user-applications.patch new file mode 100644 index 00000000000..4311fa2055b --- /dev/null +++ b/queue-6.6/rdma-bnxt_re-fix-the-offset-for-genp7-adapters-for-user-applications.patch @@ -0,0 +1,41 @@ +From 9248f363d0791a548a9c7711365b8be4c70bd375 Mon Sep 17 00:00:00 2001 +From: Selvin Xavier +Date: Tue, 19 Dec 2023 04:11:40 -0800 +Subject: RDMA/bnxt_re: Fix the offset for GenP7 adapters for user applications + +From: Selvin Xavier + +commit 9248f363d0791a548a9c7711365b8be4c70bd375 upstream. + +User Doorbell page indexes start at an offset for GenP7 adapters. +Fix the offset that will be used for user doorbell page indexes. + +Fixes: a62d68581441 ("RDMA/bnxt_re: Update the BAR offsets") +Signed-off-by: Selvin Xavier +Link: https://lore.kernel.org/r/1702987900-5363-1-git-send-email-selvin.xavier@broadcom.com +Signed-off-by: Leon Romanovsky +Signed-off-by: Greg Kroah-Hartman +--- + drivers/infiniband/hw/bnxt_re/main.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +--- a/drivers/infiniband/hw/bnxt_re/main.c ++++ b/drivers/infiniband/hw/bnxt_re/main.c +@@ -107,12 +107,14 @@ static void bnxt_re_set_db_offset(struct + dev_info(rdev_to_dev(rdev), + "Couldn't get DB bar size, Low latency framework is disabled\n"); + /* set register offsets for both UC and WC */ +- if (bnxt_qplib_is_chip_gen_p7(cctx)) ++ if (bnxt_qplib_is_chip_gen_p7(cctx)) { + res->dpi_tbl.ucreg.offset = offset; +- else ++ res->dpi_tbl.wcreg.offset = en_dev->l2_db_size; ++ } else { + res->dpi_tbl.ucreg.offset = res->is_vf ? BNXT_QPLIB_DBR_VF_DB_OFFSET : + BNXT_QPLIB_DBR_PF_DB_OFFSET; +- res->dpi_tbl.wcreg.offset = res->dpi_tbl.ucreg.offset; ++ res->dpi_tbl.wcreg.offset = res->dpi_tbl.ucreg.offset; ++ } + + /* If WC mapping is disabled by L2 driver then en_dev->l2_db_size + * is equal to the DB-Bar actual size. This indicates that L2 diff --git a/queue-6.6/rdma-bnxt_re-fix-unconditional-fence-for-newer-adapters.patch b/queue-6.6/rdma-bnxt_re-fix-unconditional-fence-for-newer-adapters.patch new file mode 100644 index 00000000000..36abb766bc5 --- /dev/null +++ b/queue-6.6/rdma-bnxt_re-fix-unconditional-fence-for-newer-adapters.patch @@ -0,0 +1,83 @@ +From 8eaca6b5997bd8fd7039f2693e4ecf112823c816 Mon Sep 17 00:00:00 2001 +From: Kalesh AP +Date: Mon, 22 Jan 2024 20:54:35 -0800 +Subject: RDMA/bnxt_re: Fix unconditional fence for newer adapters + +From: Kalesh AP + +commit 8eaca6b5997bd8fd7039f2693e4ecf112823c816 upstream. + +Older adapters required an unconditional fence for +non-wire memory operations. Newer adapters doesn't require +this and therefore, disabling the unconditional fence. + +Fixes: 1801d87b3598 ("RDMA/bnxt_re: Support new 5760X P7 devices") +Signed-off-by: Kashyap Desai +Signed-off-by: Kalesh AP +Signed-off-by: Selvin Xavier +Link: https://lore.kernel.org/r/1705985677-15551-4-git-send-email-selvin.xavier@broadcom.com +Signed-off-by: Leon Romanovsky +Signed-off-by: Greg Kroah-Hartman +--- + drivers/infiniband/hw/bnxt_re/ib_verbs.c | 28 ++++++++++++++++------------ + 1 file changed, 16 insertions(+), 12 deletions(-) + +--- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c ++++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c +@@ -2563,11 +2563,6 @@ static int bnxt_re_build_inv_wqe(const s + wqe->type = BNXT_QPLIB_SWQE_TYPE_LOCAL_INV; + wqe->local_inv.inv_l_key = wr->ex.invalidate_rkey; + +- /* Need unconditional fence for local invalidate +- * opcode to work as expected. +- */ +- wqe->flags |= BNXT_QPLIB_SWQE_FLAGS_UC_FENCE; +- + if (wr->send_flags & IB_SEND_SIGNALED) + wqe->flags |= BNXT_QPLIB_SWQE_FLAGS_SIGNAL_COMP; + if (wr->send_flags & IB_SEND_SOLICITED) +@@ -2590,12 +2585,6 @@ static int bnxt_re_build_reg_wqe(const s + wqe->frmr.levels = qplib_frpl->hwq.level; + wqe->type = BNXT_QPLIB_SWQE_TYPE_REG_MR; + +- /* Need unconditional fence for reg_mr +- * opcode to function as expected. +- */ +- +- wqe->flags |= BNXT_QPLIB_SWQE_FLAGS_UC_FENCE; +- + if (wr->wr.send_flags & IB_SEND_SIGNALED) + wqe->flags |= BNXT_QPLIB_SWQE_FLAGS_SIGNAL_COMP; + +@@ -2726,6 +2715,18 @@ bad: + return rc; + } + ++static void bnxt_re_legacy_set_uc_fence(struct bnxt_qplib_swqe *wqe) ++{ ++ /* Need unconditional fence for non-wire memory opcode ++ * to work as expected. ++ */ ++ if (wqe->type == BNXT_QPLIB_SWQE_TYPE_LOCAL_INV || ++ wqe->type == BNXT_QPLIB_SWQE_TYPE_FAST_REG_MR || ++ wqe->type == BNXT_QPLIB_SWQE_TYPE_REG_MR || ++ wqe->type == BNXT_QPLIB_SWQE_TYPE_BIND_MW) ++ wqe->flags |= BNXT_QPLIB_SWQE_FLAGS_UC_FENCE; ++} ++ + int bnxt_re_post_send(struct ib_qp *ib_qp, const struct ib_send_wr *wr, + const struct ib_send_wr **bad_wr) + { +@@ -2805,8 +2806,11 @@ int bnxt_re_post_send(struct ib_qp *ib_q + rc = -EINVAL; + goto bad; + } +- if (!rc) ++ if (!rc) { ++ if (!bnxt_qplib_is_chip_gen_p5_p7(qp->rdev->chip_ctx)) ++ bnxt_re_legacy_set_uc_fence(&wqe); + rc = bnxt_qplib_post_send(&qp->qplib_qp, &wqe); ++ } + bad: + if (rc) { + ibdev_err(&qp->rdev->ibdev, diff --git a/queue-6.6/series b/queue-6.6/series index cec54b8b353..110eb38ff82 100644 --- a/queue-6.6/series +++ b/queue-6.6/series @@ -201,3 +201,8 @@ ata-libata-set-did_time_out-for-commands-that-actually-timed-out.patch asoc-qcom-fix-null-dereference-in-asoc_qcom_lpass_cpu_platform_probe.patch platform-x86-dell-wmi-ignore-suspend-notifications.patch acpi-prm-clean-up-guid-type-in-struct-prm_handler_info.patch +rdma-bnxt_re-fix-the-offset-for-genp7-adapters-for-user-applications.patch +rdma-bnxt_re-avoid-creating-fence-mr-for-newer-adapters.patch +rdma-bnxt_re-fix-unconditional-fence-for-newer-adapters.patch +tracing-probes-fix-to-zero-initialize-a-local-variable.patch +task_work-make-twa_nmi_current-handling-conditional-on-irq_work.patch diff --git a/queue-6.6/task_work-make-twa_nmi_current-handling-conditional-on-irq_work.patch b/queue-6.6/task_work-make-twa_nmi_current-handling-conditional-on-irq_work.patch new file mode 100644 index 00000000000..56a65da982a --- /dev/null +++ b/queue-6.6/task_work-make-twa_nmi_current-handling-conditional-on-irq_work.patch @@ -0,0 +1,72 @@ +From cec6937dd1aae1b38d147bd190cb895d06cf96d0 Mon Sep 17 00:00:00 2001 +From: Linus Torvalds +Date: Mon, 29 Jul 2024 12:05:06 -0700 +Subject: task_work: make TWA_NMI_CURRENT handling conditional on IRQ_WORK + +From: Linus Torvalds + +commit cec6937dd1aae1b38d147bd190cb895d06cf96d0 upstream. + +The TWA_NMI_CURRENT handling very much depends on IRQ_WORK, but that +isn't universally enabled everywhere. + +Maybe the IRQ_WORK infrastructure should just be unconditional - x86 +ends up indirectly enabling it through unconditionally enabling +PERF_EVENTS, for example. But it also gets enabled by having SMP +support, or even if you just have PRINTK enabled. + +But in the meantime TWA_NMI_CURRENT causes tons of build failures on +various odd minimal configs. Which did show up in linux-next, but +despite that nobody bothered to fix it or even inform me until -rc1 was +out. + +Fixes: 466e4d801cd4 ("task_work: Add TWA_NMI_CURRENT as an additional notify mode") +Reported-by: Naresh Kamboju +Reported-by: kernelci.org bot +Reported-by: Guenter Roeck +Cc: Peter Zijlstra +Cc: Sebastian Andrzej Siewior +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman +--- + kernel/task_work.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/kernel/task_work.c ++++ b/kernel/task_work.c +@@ -6,12 +6,14 @@ + + static struct callback_head work_exited; /* all we need is ->next == NULL */ + ++#ifdef CONFIG_IRQ_WORK + static void task_work_set_notify_irq(struct irq_work *entry) + { + test_and_set_tsk_thread_flag(current, TIF_NOTIFY_RESUME); + } + static DEFINE_PER_CPU(struct irq_work, irq_work_NMI_resume) = + IRQ_WORK_INIT_HARD(task_work_set_notify_irq); ++#endif + + /** + * task_work_add - ask the @task to execute @work->func() +@@ -59,6 +61,8 @@ int task_work_add(struct task_struct *ta + if (notify == TWA_NMI_CURRENT) { + if (WARN_ON_ONCE(task != current)) + return -EINVAL; ++ if (!IS_ENABLED(CONFIG_IRQ_WORK)) ++ return -EINVAL; + } else { + /* + * Record the work call stack in order to print it in KASAN +@@ -92,9 +96,11 @@ int task_work_add(struct task_struct *ta + case TWA_SIGNAL_NO_IPI: + __set_notify_signal(task); + break; ++#ifdef CONFIG_IRQ_WORK + case TWA_NMI_CURRENT: + irq_work_queue(this_cpu_ptr(&irq_work_NMI_resume)); + break; ++#endif + default: + WARN_ON_ONCE(1); + break; diff --git a/queue-6.6/tracing-probes-fix-to-zero-initialize-a-local-variable.patch b/queue-6.6/tracing-probes-fix-to-zero-initialize-a-local-variable.patch new file mode 100644 index 00000000000..12f02ba5f34 --- /dev/null +++ b/queue-6.6/tracing-probes-fix-to-zero-initialize-a-local-variable.patch @@ -0,0 +1,38 @@ +From 0add699ad068d26e5b1da9ff28b15461fc4005df Mon Sep 17 00:00:00 2001 +From: "Masami Hiramatsu (Google)" +Date: Wed, 20 Mar 2024 17:10:38 +0900 +Subject: tracing: probes: Fix to zero initialize a local variable + +From: Masami Hiramatsu (Google) + +commit 0add699ad068d26e5b1da9ff28b15461fc4005df upstream. + +Fix to initialize 'val' local variable with zero. +Dan reported that Smatch static code checker reports an error that a local +'val' variable needs to be initialized. Actually, the 'val' is expected to +be initialized by FETCH_OP_ARG in the same loop, but it is not obvious. So +initialize it with zero. + +Link: https://lore.kernel.org/all/171092223833.237219.17304490075697026697.stgit@devnote2/ + +Reported-by: Dan Carpenter +Closes: https://lore.kernel.org/all/b010488e-68aa-407c-add0-3e059254aaa0@moroto.mountain/ +Fixes: 25f00e40ce79 ("tracing/probes: Support $argN in return probe (kprobe and fprobe)") +Reviewed-by: Steven Rostedt (Google) +Signed-off-by: Masami Hiramatsu (Google) +Signed-off-by: Greg Kroah-Hartman +--- + kernel/trace/trace_probe.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/kernel/trace/trace_probe.c ++++ b/kernel/trace/trace_probe.c +@@ -843,7 +843,7 @@ out: + void store_trace_entry_data(void *edata, struct trace_probe *tp, struct pt_regs *regs) + { + struct probe_entry_arg *earg = tp->entry_arg; +- unsigned long val; ++ unsigned long val = 0; + int i; + + if (!earg) -- 2.47.2