From 95d891e9ae88560cac439675b11038de4999cb8d Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 25 Mar 2022 14:24:08 +0100 Subject: [PATCH] 5.4-stable patches added patches: crypto-qat-disable-registration-of-algorithms.patch rcu-don-t-deboost-before-reporting-expedited-quiescent-state.patch --- ...t-disable-registration-of-algorithms.patch | 45 +++++++++++++ ...-reporting-expedited-quiescent-state.patch | 64 +++++++++++++++++++ queue-5.4/series | 2 + 3 files changed, 111 insertions(+) create mode 100644 queue-5.4/crypto-qat-disable-registration-of-algorithms.patch create mode 100644 queue-5.4/rcu-don-t-deboost-before-reporting-expedited-quiescent-state.patch diff --git a/queue-5.4/crypto-qat-disable-registration-of-algorithms.patch b/queue-5.4/crypto-qat-disable-registration-of-algorithms.patch new file mode 100644 index 00000000000..cd0ca168752 --- /dev/null +++ b/queue-5.4/crypto-qat-disable-registration-of-algorithms.patch @@ -0,0 +1,45 @@ +From 8893d27ffcaf6ec6267038a177cb87bcde4dd3de Mon Sep 17 00:00:00 2001 +From: Giovanni Cabiddu +Date: Fri, 4 Mar 2022 17:54:47 +0000 +Subject: crypto: qat - disable registration of algorithms + +From: Giovanni Cabiddu + +commit 8893d27ffcaf6ec6267038a177cb87bcde4dd3de upstream. + +The implementations of aead and skcipher in the QAT driver do not +support properly requests with the CRYPTO_TFM_REQ_MAY_BACKLOG flag set. +If the HW queue is full, the driver returns -EBUSY but does not enqueue +the request. +This can result in applications like dm-crypt waiting indefinitely for a +completion of a request that was never submitted to the hardware. + +To avoid this problem, disable the registration of all crypto algorithms +in the QAT driver by setting the number of crypto instances to 0 at +configuration time. + +Cc: stable@vger.kernel.org +Signed-off-by: Giovanni Cabiddu +Signed-off-by: Herbert Xu +Signed-off-by: Greg Kroah-Hartman +--- + drivers/crypto/qat/qat_common/qat_crypto.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +--- a/drivers/crypto/qat/qat_common/qat_crypto.c ++++ b/drivers/crypto/qat/qat_common/qat_crypto.c +@@ -170,6 +170,14 @@ int qat_crypto_dev_config(struct adf_acc + goto err; + if (adf_cfg_section_add(accel_dev, "Accelerator0")) + goto err; ++ ++ /* Temporarily set the number of crypto instances to zero to avoid ++ * registering the crypto algorithms. ++ * This will be removed when the algorithms will support the ++ * CRYPTO_TFM_REQ_MAY_BACKLOG flag ++ */ ++ instances = 0; ++ + for (i = 0; i < instances; i++) { + val = i; + snprintf(key, sizeof(key), ADF_CY "%d" ADF_RING_BANK_NUM, i); diff --git a/queue-5.4/rcu-don-t-deboost-before-reporting-expedited-quiescent-state.patch b/queue-5.4/rcu-don-t-deboost-before-reporting-expedited-quiescent-state.patch new file mode 100644 index 00000000000..da0440c9a6a --- /dev/null +++ b/queue-5.4/rcu-don-t-deboost-before-reporting-expedited-quiescent-state.patch @@ -0,0 +1,64 @@ +From 10c535787436d62ea28156a4b91365fd89b5a432 Mon Sep 17 00:00:00 2001 +From: "Paul E. McKenney" +Date: Fri, 21 Jan 2022 12:40:08 -0800 +Subject: rcu: Don't deboost before reporting expedited quiescent state + +From: Paul E. McKenney + +commit 10c535787436d62ea28156a4b91365fd89b5a432 upstream. + +Currently rcu_preempt_deferred_qs_irqrestore() releases rnp->boost_mtx +before reporting the expedited quiescent state. Under heavy real-time +load, this can result in this function being preempted before the +quiescent state is reported, which can in turn prevent the expedited grace +period from completing. Tim Murray reports that the resulting expedited +grace periods can take hundreds of milliseconds and even more than one +second, when they should normally complete in less than a millisecond. + +This was fine given that there were no particular response-time +constraints for synchronize_rcu_expedited(), as it was designed +for throughput rather than latency. However, some users now need +sub-100-millisecond response-time constratints. + +This patch therefore follows Neeraj's suggestion (seconded by Tim and +by Uladzislau Rezki) of simply reversing the two operations. + +Reported-by: Tim Murray +Reported-by: Joel Fernandes +Reported-by: Neeraj Upadhyay +Reviewed-by: Neeraj Upadhyay +Reviewed-by: Uladzislau Rezki (Sony) +Tested-by: Tim Murray +Cc: Todd Kjos +Cc: Sandeep Patil +Cc: # 5.4.x +Signed-off-by: Paul E. McKenney +Signed-off-by: Greg Kroah-Hartman +--- + kernel/rcu/tree_plugin.h | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +--- a/kernel/rcu/tree_plugin.h ++++ b/kernel/rcu/tree_plugin.h +@@ -523,16 +523,17 @@ rcu_preempt_deferred_qs_irqrestore(struc + raw_spin_unlock_irqrestore_rcu_node(rnp, flags); + } + +- /* Unboost if we were boosted. */ +- if (IS_ENABLED(CONFIG_RCU_BOOST) && drop_boost_mutex) +- rt_mutex_futex_unlock(&rnp->boost_mtx); +- + /* + * If this was the last task on the expedited lists, + * then we need to report up the rcu_node hierarchy. + */ + if (!empty_exp && empty_exp_now) + rcu_report_exp_rnp(rnp, true); ++ ++ /* Unboost if we were boosted. */ ++ if (IS_ENABLED(CONFIG_RCU_BOOST) && drop_boost_mutex) ++ rt_mutex_futex_unlock(&rnp->boost_mtx); ++ + } else { + local_irq_restore(flags); + } diff --git a/queue-5.4/series b/queue-5.4/series index fc886a3a061..3b19c731c74 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -22,3 +22,5 @@ netfilter-nf_tables-initialize-registers-in-nft_do_chain.patch acpi-x86-work-around-broken-xsdt-on-advantech-dac-bj01-board.patch acpi-battery-add-device-hid-and-quirk-for-microsoft-surface-go-3.patch acpi-video-force-backlight-native-for-clevo-nl5xru-and-nl5xnu.patch +crypto-qat-disable-registration-of-algorithms.patch +rcu-don-t-deboost-before-reporting-expedited-quiescent-state.patch -- 2.47.3