From: Sasha Levin Date: Mon, 29 Jun 2020 16:06:38 +0000 (-0400) Subject: Drop arm64-sve-eliminate-data-races-on-sve_default_vl.patch X-Git-Tag: v5.7.7~4^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ec378d756f43e830d574be3c6527a1c22254bec1;p=thirdparty%2Fkernel%2Fstable-queue.git Drop arm64-sve-eliminate-data-races-on-sve_default_vl.patch Signed-off-by: Sasha Levin --- diff --git a/queue-4.19/arm64-sve-eliminate-data-races-on-sve_default_vl.patch b/queue-4.19/arm64-sve-eliminate-data-races-on-sve_default_vl.patch deleted file mode 100644 index 15c2b2e7981..00000000000 --- a/queue-4.19/arm64-sve-eliminate-data-races-on-sve_default_vl.patch +++ /dev/null @@ -1,120 +0,0 @@ -From 62100a21e88288b36d5722b4c61bd35f25c3e940 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Wed, 10 Jun 2020 18:03:10 +0100 -Subject: arm64/sve: Eliminate data races on sve_default_vl - -From: Dave Martin - -[ Upstream commit 1e570f512cbdc5e9e401ba640d9827985c1bea1e ] - -sve_default_vl can be modified via the /proc/sys/abi/sve_default_vl -sysctl concurrently with use, and modified concurrently by multiple -threads. - -Adding a lock for this seems overkill, and I don't want to think any -more than necessary, so just define wrappers using READ_ONCE()/ -WRITE_ONCE(). - -This will avoid the possibility of torn accesses and repeated loads -and stores. - -There's no evidence yet that this is going wrong in practice: this -is just hygiene. For generic sysctl users, it would be better to -build this kind of thing into the sysctl common code somehow. - -Reported-by: Will Deacon -Signed-off-by: Dave Martin -Link: https://lore.kernel.org/r/1591808590-20210-3-git-send-email-Dave.Martin@arm.com -[will: move set_sve_default_vl() inside #ifdef to squash allnoconfig warning] -Signed-off-by: Will Deacon -Signed-off-by: Sasha Levin ---- - arch/arm64/kernel/fpsimd.c | 25 ++++++++++++++++++------- - 1 file changed, 18 insertions(+), 7 deletions(-) - -diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c -index 14fdbaa6ee3ab..af59b42973141 100644 ---- a/arch/arm64/kernel/fpsimd.c -+++ b/arch/arm64/kernel/fpsimd.c -@@ -22,6 +22,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -124,10 +125,20 @@ struct fpsimd_last_state_struct { - static DEFINE_PER_CPU(struct fpsimd_last_state_struct, fpsimd_last_state); - - /* Default VL for tasks that don't set it explicitly: */ --static int sve_default_vl = -1; -+static int __sve_default_vl = -1; -+ -+static int get_sve_default_vl(void) -+{ -+ return READ_ONCE(__sve_default_vl); -+} - - #ifdef CONFIG_ARM64_SVE - -+static void set_sve_default_vl(int val) -+{ -+ WRITE_ONCE(__sve_default_vl, val); -+} -+ - /* Maximum supported vector length across all CPUs (initially poisoned) */ - int __ro_after_init sve_max_vl = SVE_VL_MIN; - /* Set of available vector lengths, as vq_to_bit(vq): */ -@@ -311,7 +322,7 @@ static int sve_proc_do_default_vl(struct ctl_table *table, int write, - loff_t *ppos) - { - int ret; -- int vl = sve_default_vl; -+ int vl = get_sve_default_vl(); - struct ctl_table tmp_table = { - .data = &vl, - .maxlen = sizeof(vl), -@@ -328,7 +339,7 @@ static int sve_proc_do_default_vl(struct ctl_table *table, int write, - if (!sve_vl_valid(vl)) - return -EINVAL; - -- sve_default_vl = find_supported_vector_length(vl); -+ set_sve_default_vl(find_supported_vector_length(vl)); - return 0; - } - -@@ -772,12 +783,12 @@ void __init sve_setup(void) - * For the default VL, pick the maximum supported value <= 64. - * VL == 64 is guaranteed not to grow the signal frame. - */ -- sve_default_vl = find_supported_vector_length(64); -+ set_sve_default_vl(find_supported_vector_length(64)); - - pr_info("SVE: maximum available vector length %u bytes per vector\n", - sve_max_vl); - pr_info("SVE: default vector length %u bytes per vector\n", -- sve_default_vl); -+ get_sve_default_vl()); - - sve_efi_setup(); - } -@@ -914,13 +925,13 @@ void fpsimd_flush_thread(void) - * vector length configured: no kernel task can become a user - * task without an exec and hence a call to this function. - * By the time the first call to this function is made, all -- * early hardware probing is complete, so sve_default_vl -+ * early hardware probing is complete, so __sve_default_vl - * should be valid. - * If a bug causes this to go wrong, we make some noise and - * try to fudge thread.sve_vl to a safe value here. - */ - vl = current->thread.sve_vl_onexec ? -- current->thread.sve_vl_onexec : sve_default_vl; -+ current->thread.sve_vl_onexec : get_sve_default_vl(); - - if (WARN_ON(!sve_vl_valid(vl))) - vl = SVE_VL_MIN; --- -2.25.1 - diff --git a/queue-4.19/series b/queue-4.19/series index d35cef5a039..7afe836d37a 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -92,7 +92,6 @@ ata-libata-fix-usage-of-page-address-by-page_address.patch drm-amd-display-use-kfree-to-free-rgb_user-in-calcul.patch riscv-atomic-fix-sign-extension-for-rv64i.patch hwrng-ks-sa-fix-runtime-pm-imbalance-on-error.patch -arm64-sve-eliminate-data-races-on-sve_default_vl.patch ibmvnic-harden-device-login-requests.patch net-alx-fix-race-condition-in-alx_remove.patch s390-ptrace-fix-setting-syscall-number.patch diff --git a/queue-5.4/arm64-sve-eliminate-data-races-on-sve_default_vl.patch b/queue-5.4/arm64-sve-eliminate-data-races-on-sve_default_vl.patch deleted file mode 100644 index 797c83e104c..00000000000 --- a/queue-5.4/arm64-sve-eliminate-data-races-on-sve_default_vl.patch +++ /dev/null @@ -1,123 +0,0 @@ -From cd761775af90be0d172b2ecd6608efb9aeac9b91 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Wed, 10 Jun 2020 18:03:10 +0100 -Subject: arm64/sve: Eliminate data races on sve_default_vl - -From: Dave Martin - -[ Upstream commit 1e570f512cbdc5e9e401ba640d9827985c1bea1e ] - -sve_default_vl can be modified via the /proc/sys/abi/sve_default_vl -sysctl concurrently with use, and modified concurrently by multiple -threads. - -Adding a lock for this seems overkill, and I don't want to think any -more than necessary, so just define wrappers using READ_ONCE()/ -WRITE_ONCE(). - -This will avoid the possibility of torn accesses and repeated loads -and stores. - -There's no evidence yet that this is going wrong in practice: this -is just hygiene. For generic sysctl users, it would be better to -build this kind of thing into the sysctl common code somehow. - -Reported-by: Will Deacon -Signed-off-by: Dave Martin -Link: https://lore.kernel.org/r/1591808590-20210-3-git-send-email-Dave.Martin@arm.com -[will: move set_sve_default_vl() inside #ifdef to squash allnoconfig warning] -Signed-off-by: Will Deacon -Signed-off-by: Sasha Levin ---- - arch/arm64/kernel/fpsimd.c | 25 ++++++++++++++++++------- - 1 file changed, 18 insertions(+), 7 deletions(-) - -diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c -index 1765e5284994f..d8895251a2aac 100644 ---- a/arch/arm64/kernel/fpsimd.c -+++ b/arch/arm64/kernel/fpsimd.c -@@ -12,6 +12,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -119,10 +120,20 @@ struct fpsimd_last_state_struct { - static DEFINE_PER_CPU(struct fpsimd_last_state_struct, fpsimd_last_state); - - /* Default VL for tasks that don't set it explicitly: */ --static int sve_default_vl = -1; -+static int __sve_default_vl = -1; -+ -+static int get_sve_default_vl(void) -+{ -+ return READ_ONCE(__sve_default_vl); -+} - - #ifdef CONFIG_ARM64_SVE - -+static void set_sve_default_vl(int val) -+{ -+ WRITE_ONCE(__sve_default_vl, val); -+} -+ - /* Maximum supported vector length across all CPUs (initially poisoned) */ - int __ro_after_init sve_max_vl = SVE_VL_MIN; - int __ro_after_init sve_max_virtualisable_vl = SVE_VL_MIN; -@@ -345,7 +356,7 @@ static int sve_proc_do_default_vl(struct ctl_table *table, int write, - loff_t *ppos) - { - int ret; -- int vl = sve_default_vl; -+ int vl = get_sve_default_vl(); - struct ctl_table tmp_table = { - .data = &vl, - .maxlen = sizeof(vl), -@@ -362,7 +373,7 @@ static int sve_proc_do_default_vl(struct ctl_table *table, int write, - if (!sve_vl_valid(vl)) - return -EINVAL; - -- sve_default_vl = find_supported_vector_length(vl); -+ set_sve_default_vl(find_supported_vector_length(vl)); - return 0; - } - -@@ -869,7 +880,7 @@ void __init sve_setup(void) - * For the default VL, pick the maximum supported value <= 64. - * VL == 64 is guaranteed not to grow the signal frame. - */ -- sve_default_vl = find_supported_vector_length(64); -+ set_sve_default_vl(find_supported_vector_length(64)); - - bitmap_andnot(tmp_map, sve_vq_partial_map, sve_vq_map, - SVE_VQ_MAX); -@@ -890,7 +901,7 @@ void __init sve_setup(void) - pr_info("SVE: maximum available vector length %u bytes per vector\n", - sve_max_vl); - pr_info("SVE: default vector length %u bytes per vector\n", -- sve_default_vl); -+ get_sve_default_vl()); - - /* KVM decides whether to support mismatched systems. Just warn here: */ - if (sve_max_virtualisable_vl < sve_max_vl) -@@ -1030,13 +1041,13 @@ void fpsimd_flush_thread(void) - * vector length configured: no kernel task can become a user - * task without an exec and hence a call to this function. - * By the time the first call to this function is made, all -- * early hardware probing is complete, so sve_default_vl -+ * early hardware probing is complete, so __sve_default_vl - * should be valid. - * If a bug causes this to go wrong, we make some noise and - * try to fudge thread.sve_vl to a safe value here. - */ - vl = current->thread.sve_vl_onexec ? -- current->thread.sve_vl_onexec : sve_default_vl; -+ current->thread.sve_vl_onexec : get_sve_default_vl(); - - if (WARN_ON(!sve_vl_valid(vl))) - vl = SVE_VL_MIN; --- -2.25.1 - diff --git a/queue-5.4/series b/queue-5.4/series index c08476c2f74..3241e3f800e 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -119,7 +119,6 @@ ata-libata-fix-usage-of-page-address-by-page_address.patch drm-amd-display-use-kfree-to-free-rgb_user-in-calcul.patch riscv-atomic-fix-sign-extension-for-rv64i.patch hwrng-ks-sa-fix-runtime-pm-imbalance-on-error.patch -arm64-sve-eliminate-data-races-on-sve_default_vl.patch ibmvnic-harden-device-login-requests.patch net-alx-fix-race-condition-in-alx_remove.patch test_objagg-fix-potential-memory-leak-in-error-handl.patch diff --git a/queue-5.7/arm64-sve-eliminate-data-races-on-sve_default_vl.patch b/queue-5.7/arm64-sve-eliminate-data-races-on-sve_default_vl.patch deleted file mode 100644 index 245a80d5c8a..00000000000 --- a/queue-5.7/arm64-sve-eliminate-data-races-on-sve_default_vl.patch +++ /dev/null @@ -1,123 +0,0 @@ -From 0c0aff41c1abf45a559850c74af03eccbef620e0 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Wed, 10 Jun 2020 18:03:10 +0100 -Subject: arm64/sve: Eliminate data races on sve_default_vl - -From: Dave Martin - -[ Upstream commit 1e570f512cbdc5e9e401ba640d9827985c1bea1e ] - -sve_default_vl can be modified via the /proc/sys/abi/sve_default_vl -sysctl concurrently with use, and modified concurrently by multiple -threads. - -Adding a lock for this seems overkill, and I don't want to think any -more than necessary, so just define wrappers using READ_ONCE()/ -WRITE_ONCE(). - -This will avoid the possibility of torn accesses and repeated loads -and stores. - -There's no evidence yet that this is going wrong in practice: this -is just hygiene. For generic sysctl users, it would be better to -build this kind of thing into the sysctl common code somehow. - -Reported-by: Will Deacon -Signed-off-by: Dave Martin -Link: https://lore.kernel.org/r/1591808590-20210-3-git-send-email-Dave.Martin@arm.com -[will: move set_sve_default_vl() inside #ifdef to squash allnoconfig warning] -Signed-off-by: Will Deacon -Signed-off-by: Sasha Levin ---- - arch/arm64/kernel/fpsimd.c | 25 ++++++++++++++++++------- - 1 file changed, 18 insertions(+), 7 deletions(-) - -diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c -index 94289d1269933..4a77263c183b3 100644 ---- a/arch/arm64/kernel/fpsimd.c -+++ b/arch/arm64/kernel/fpsimd.c -@@ -12,6 +12,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -119,10 +120,20 @@ struct fpsimd_last_state_struct { - static DEFINE_PER_CPU(struct fpsimd_last_state_struct, fpsimd_last_state); - - /* Default VL for tasks that don't set it explicitly: */ --static int sve_default_vl = -1; -+static int __sve_default_vl = -1; -+ -+static int get_sve_default_vl(void) -+{ -+ return READ_ONCE(__sve_default_vl); -+} - - #ifdef CONFIG_ARM64_SVE - -+static void set_sve_default_vl(int val) -+{ -+ WRITE_ONCE(__sve_default_vl, val); -+} -+ - /* Maximum supported vector length across all CPUs (initially poisoned) */ - int __ro_after_init sve_max_vl = SVE_VL_MIN; - int __ro_after_init sve_max_virtualisable_vl = SVE_VL_MIN; -@@ -345,7 +356,7 @@ static int sve_proc_do_default_vl(struct ctl_table *table, int write, - loff_t *ppos) - { - int ret; -- int vl = sve_default_vl; -+ int vl = get_sve_default_vl(); - struct ctl_table tmp_table = { - .data = &vl, - .maxlen = sizeof(vl), -@@ -362,7 +373,7 @@ static int sve_proc_do_default_vl(struct ctl_table *table, int write, - if (!sve_vl_valid(vl)) - return -EINVAL; - -- sve_default_vl = find_supported_vector_length(vl); -+ set_sve_default_vl(find_supported_vector_length(vl)); - return 0; - } - -@@ -869,7 +880,7 @@ void __init sve_setup(void) - * For the default VL, pick the maximum supported value <= 64. - * VL == 64 is guaranteed not to grow the signal frame. - */ -- sve_default_vl = find_supported_vector_length(64); -+ set_sve_default_vl(find_supported_vector_length(64)); - - bitmap_andnot(tmp_map, sve_vq_partial_map, sve_vq_map, - SVE_VQ_MAX); -@@ -890,7 +901,7 @@ void __init sve_setup(void) - pr_info("SVE: maximum available vector length %u bytes per vector\n", - sve_max_vl); - pr_info("SVE: default vector length %u bytes per vector\n", -- sve_default_vl); -+ get_sve_default_vl()); - - /* KVM decides whether to support mismatched systems. Just warn here: */ - if (sve_max_virtualisable_vl < sve_max_vl) -@@ -1030,13 +1041,13 @@ void fpsimd_flush_thread(void) - * vector length configured: no kernel task can become a user - * task without an exec and hence a call to this function. - * By the time the first call to this function is made, all -- * early hardware probing is complete, so sve_default_vl -+ * early hardware probing is complete, so __sve_default_vl - * should be valid. - * If a bug causes this to go wrong, we make some noise and - * try to fudge thread.sve_vl to a safe value here. - */ - vl = current->thread.sve_vl_onexec ? -- current->thread.sve_vl_onexec : sve_default_vl; -+ current->thread.sve_vl_onexec : get_sve_default_vl(); - - if (WARN_ON(!sve_vl_valid(vl))) - vl = SVE_VL_MIN; --- -2.25.1 - diff --git a/queue-5.7/series b/queue-5.7/series index 88b21fa28e2..ce9b454bfaf 100644 --- a/queue-5.7/series +++ b/queue-5.7/series @@ -185,7 +185,6 @@ drm-amd-display-use-kfree-to-free-rgb_user-in-calcul.patch riscv-atomic-fix-sign-extension-for-rv64i.patch bcache-check-and-adjust-logical-block-size-for-backi.patch hwrng-ks-sa-fix-runtime-pm-imbalance-on-error.patch -arm64-sve-eliminate-data-races-on-sve_default_vl.patch ibmvnic-harden-device-login-requests.patch net-alx-fix-race-condition-in-alx_remove.patch test_objagg-fix-potential-memory-leak-in-error-handl.patch