upg btrfs groff curl

This commit is contained in:
joborun linux 2023-09-13 18:54:19 +03:00
parent c50c84b5f8
commit 3001259d93
9 changed files with 225 additions and 17 deletions

View file

@ -0,0 +1,150 @@
From 03f41ac508d2c47fdfef08f0fd27ab154f7dcfd8 Mon Sep 17 00:00:00 2001
From: David Sterba <dsterba@suse.com>
Date: Tue, 12 Sep 2023 23:32:38 +0200
Subject: [PATCH] btrfs-progs: detect PCLMUL CPU support for accelerated crc32c
The accelerated crc32c needs to check for two CPU features, the crc32c
instructions is in SSE 4.2 and 'pclmulqdq' is a separate. There's still
old hardware used that does not have the PCLMUL instructions. Detect it
and make it the condition.
The pclmul is not supported on old compilers so also add a
configure-time detection and leave the SSE 4.2 only implementation as
the accelerated one if possible.
Issue: #676
Signed-off-by: David Sterba <dsterba@suse.com>
---
common/cpu-utils.c | 5 +++++
common/cpu-utils.h | 1 +
config/ax_gcc_builtin.m4 | 1 +
configure.ac | 1 +
crypto/crc32c.c | 9 +++------
crypto/hash-speedtest.c | 2 +-
crypto/hash-vectest.c | 2 +-
7 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/common/cpu-utils.c b/common/cpu-utils.c
index 3527a3cb01..568e3af55a 100644
--- a/common/cpu-utils.c
+++ b/common/cpu-utils.c
@@ -54,6 +54,7 @@ void cpu_print_flags(void) {
FLAG(SSE2);
FLAG(SSSE3);
FLAG(SSE41);
+ FLAG(PCLMUL);
FLAG(SSE42);
FLAG(SHA);
FLAG(AVX);
@@ -76,6 +77,10 @@ void cpu_detect_flags(void)
__cpu_flags |= CPU_FLAG_SSSE3;
if (__builtin_cpu_supports("sse4.1"))
__cpu_flags |= CPU_FLAG_SSE41;
+#if HAVE___BUILTIN_CPU_SUPPORTS__PCLMUL
+ if (__builtin_cpu_supports("pclmul"))
+ __cpu_flags |= CPU_FLAG_PCLMUL;
+#endif
if (__builtin_cpu_supports("sse4.2"))
__cpu_flags |= CPU_FLAG_SSE42;
if (__builtin_cpu_supports("avx"))
diff --git a/common/cpu-utils.h b/common/cpu-utils.h
index e4a8641b05..014788f422 100644
--- a/common/cpu-utils.h
+++ b/common/cpu-utils.h
@@ -33,6 +33,7 @@ enum cpu_feature {
ENUM_CPU_BIT(CPU_FLAG_SSE2),
ENUM_CPU_BIT(CPU_FLAG_SSSE3),
ENUM_CPU_BIT(CPU_FLAG_SSE41),
+ ENUM_CPU_BIT(CPU_FLAG_PCLMUL),
ENUM_CPU_BIT(CPU_FLAG_SSE42),
ENUM_CPU_BIT(CPU_FLAG_SHA),
ENUM_CPU_BIT(CPU_FLAG_AVX),
diff --git a/config/ax_gcc_builtin.m4 b/config/ax_gcc_builtin.m4
index c89f89ec3d..224e824c1d 100644
--- a/config/ax_gcc_builtin.m4
+++ b/config/ax_gcc_builtin.m4
@@ -124,6 +124,7 @@ AC_DEFUN([AX_GCC_BUILTIN], [
[__builtin_cpu_init], [$1()],
[__builtin_cpu_is], [$1("intel")],
[__builtin_cpu_supports], [$1("sse")],
+ [__builtin_cpu_supports__pclmul], [__builtin_cpu_supports("pclmul")],
[__builtin_ctz], [$1(0)],
[__builtin_ctzl], [$1(0)],
[__builtin_ctzll], [$1(0)],
diff --git a/configure.ac b/configure.ac
index 1ef5f83cfe..1850048bbb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -86,6 +86,7 @@ AC_SUBST([HAVE_GLIBC])
AX_GCC_BUILTIN([__builtin_add_overflow])
AX_GCC_BUILTIN([__builtin_sub_overflow])
AX_GCC_BUILTIN([__builtin_mul_overflow])
+AX_GCC_BUILTIN([__builtin_cpu_supports__pclmul])
AC_CHECK_HEADERS([linux/perf_event.h])
AC_CHECK_HEADERS([linux/hw_breakpoint.h])
diff --git a/crypto/crc32c.c b/crypto/crc32c.c
index 23cbb1a63d..0d540ef658 100644
--- a/crypto/crc32c.c
+++ b/crypto/crc32c.c
@@ -25,7 +25,7 @@ static unsigned int crc32c_pcl(uint32_t crc, unsigned char const *data, uint32_t
return crc_pcl(data, len, crc);
}
-#else
+#endif
/*
* Based on a posting to lkml by Austin Zhang <austin.zhang@intel.com>
@@ -86,8 +86,6 @@ static uint32_t crc32c_intel(uint32_t crc, unsigned char const *data, uint32_t l
return crc;
}
-#endif
-
void crc32c_init_accel(void)
{
/*
@@ -96,14 +94,13 @@ void crc32c_init_accel(void)
*/
if (0) {
#ifdef __GLIBC__
- } else if (cpu_has_feature(CPU_FLAG_SSE42)) {
+ } else if (cpu_has_feature(CPU_FLAG_PCLMUL)) {
/* printf("CRC32C: pcl\n"); */
crc_function = crc32c_pcl;
-#else
+#endif
} else if (cpu_has_feature(CPU_FLAG_SSE42)) {
/* printf("CRC32c: intel\n"); */
crc_function = crc32c_intel;
-#endif
} else {
/* printf("CRC32c: fallback\n"); */
crc_function = __crc32c_le;
diff --git a/crypto/hash-speedtest.c b/crypto/hash-speedtest.c
index 2b02f6ae7f..88f9c9b17b 100644
--- a/crypto/hash-speedtest.c
+++ b/crypto/hash-speedtest.c
@@ -190,7 +190,7 @@ int main(int argc, char **argv) {
{ .name = "CRC32C-ref", .digest = hash_crc32c, .digest_size = 4,
.cpu_flag = CPU_FLAG_NONE },
{ .name = "CRC32C-NI", .digest = hash_crc32c, .digest_size = 4,
- .cpu_flag = CPU_FLAG_SSE42 },
+ .cpu_flag = CPU_FLAG_PCLMUL },
{ .name = "XXHASH", .digest = hash_xxhash, .digest_size = 8 },
{ .name = "SHA256-ref", .digest = hash_sha256, .digest_size = 32,
.cpu_flag = CPU_FLAG_NONE, .backend = CRYPTOPROVIDER_BUILTIN + 1 },
diff --git a/crypto/hash-vectest.c b/crypto/hash-vectest.c
index 2a00c02981..07a830fb59 100644
--- a/crypto/hash-vectest.c
+++ b/crypto/hash-vectest.c
@@ -442,7 +442,7 @@ static const struct hash_testspec test_spec[] = {
.digest_size = 4,
.testvec = crc32c_tv,
.count = ARRAY_SIZE(crc32c_tv),
- .cpu_flag = CPU_FLAG_SSE42,
+ .cpu_flag = CPU_FLAG_PCLMUL,
.hash = hash_crc32c
}, {
.name = "XXHASH",

View file

@ -0,0 +1,39 @@
From 839b2d587da9d691c2f2e7cdb5301eed23781d1d Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Tue, 5 Sep 2023 10:37:09 -0700
Subject: [PATCH] btrfs-progs: crypto: fix readonly relocation of the jumptable
Without this, the btrfs programs fail to link when build with -Wl,-z,relro,
due to the jumptable containing relocations.
Pull-request: #675
Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
Signed-off-by: David Sterba <dsterba@suse.com>
---
crypto/crc32c-pcl-intel-asm_64.S | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/crypto/crc32c-pcl-intel-asm_64.S b/crypto/crc32c-pcl-intel-asm_64.S
index 102566e51..5fab0e09f 100644
--- a/crypto/crc32c-pcl-intel-asm_64.S
+++ b/crypto/crc32c-pcl-intel-asm_64.S
@@ -321,10 +321,10 @@ LABEL less_than_ %j # less_than_j: Length should be in
.size crc_pcl, .-crc_pcl
###SYM_FUNC_END(crc_pcl)
-.section .rodata, "a", @progbits
################################################################
## jump table Table is 129 entries x 2 bytes each
################################################################
+.data
.align 4
jump_table:
i=0
@@ -340,6 +340,7 @@ JMPTBL_ENTRY %i
## PCLMULQDQ tables
## Table is 128 entries x 2 words (8 bytes) each
################################################################
+.section .rodata, "a", @progbits
.align 8
K_table:
.long 0x493c7d27, 0x00000001

View file

@ -7,7 +7,7 @@
pkgname=btrfs-progs
pkgver=6.5
pkgrel=01
pkgrel=02
pkgdesc='Btrfs filesystem utilities w/o systemd'
makedepends=('git' 'asciidoc' 'xmlto' 'python' 'python-setuptools' 'e2fsprogs' 'reiserfsprogs' 'python-sphinx')
depends=('glibc' 'util-linux-libs' 'lzo' 'zlib' 'zstd' 'libgcrypt')
@ -21,6 +21,8 @@ provides=('btrfs-progs-unstable')
#options=(!staticlibs debug) ## uncomment this to have the debug pkg produced
options=(!staticlibs)
source=("https://www.kernel.org/pub/linux/kernel/people/kdave/btrfs-progs/btrfs-progs-v$pkgver.tar."{xz,sign}
"https://github.com/kdave/btrfs-progs/commit/839b2d587da9d691c2f2e7cdb5301eed23781d1d.patch"
"https://github.com/kdave/btrfs-progs/commit/03f41ac508d2c47fdfef08f0fd27ab154f7dcfd8.patch"
'initcpio-install-btrfs'
'initcpio-hook-btrfs')
install=btrfs-progs.install
@ -72,7 +74,10 @@ validpgpkeys=('F2B41200C54EFB30380C1756C565D5F9D76D583B')
sha256sums=(8f507a0cdf6a8b372d862dbe4943fe84c66dcb2088e3cfde2cfb3b176eac1c1c # btrfs-progs-v6.5.tar.xz
72e3f8f001d494ae9beb4db8289b862da71c7c6e0bee0924a8e2dcab6680ce74 # btrfs-progs-v6.5.tar.sign
846db4fb24c23b570aab42924830222a6670f92505d1b7570e5c175301b59d00 # 839b2d587da9d691c2f2e7cdb5301eed23781d1d.patch
426a81d82e7f5af6fd8e4f672fbbda850643a8fb6781f05ee6b2fcccb007efc9 # 03f41ac508d2c47fdfef08f0fd27ab154f7dcfd8.patch
bbe60b35d1b1e2efc1308a8f54f1fdc6808240a81c5f5b4d75321b7ee86e41f4 # initcpio-install-btrfs
35efeee8590d6d60c711ae9cdc918e4841ab61d10cb02359e65e36ebff95ffc5) # initcpio-hook-btrfs
## bced6995619aacec49b14a501b7c9e851e8bf2103184da643bff9874d6b28e17 btrfs-progs-6.5-01-x86_64.pkg.tar.lz
## ef69c0b20a3aa65d778db517208099854477340ea89a471a2db1ac41cdfd955a btrfs-progs-6.5-02-x86_64.pkg.tar.lz

View file

@ -4,7 +4,7 @@
pkgname=btrfs-progs
pkgver=6.5
pkgrel=1
pkgrel=2
pkgdesc='Btrfs filesystem utilities'
arch=('x86_64')
makedepends=('git' 'asciidoc' 'xmlto' 'systemd' 'python' 'python-setuptools' 'e2fsprogs' 'reiserfsprogs' 'python-sphinx')
@ -19,6 +19,8 @@ provides=('btrfs-progs-unstable')
license=('GPL2')
validpgpkeys=('F2B41200C54EFB30380C1756C565D5F9D76D583B')
source=("https://www.kernel.org/pub/linux/kernel/people/kdave/btrfs-progs/btrfs-progs-v$pkgver.tar."{sign,xz}
https://github.com/kdave/btrfs-progs/commit/839b2d587da9d691c2f2e7cdb5301eed23781d1d.patch
https://github.com/kdave/btrfs-progs/commit/03f41ac508d2c47fdfef08f0fd27ab154f7dcfd8.patch
'initcpio-install-btrfs'
'initcpio-hook-btrfs'
'btrfs-scrub@.service'
@ -75,3 +77,11 @@ package() {
}
# vim:set ts=2 sw=2 ft=sh et:
sha256sums=('SKIP'
'8f507a0cdf6a8b372d862dbe4943fe84c66dcb2088e3cfde2cfb3b176eac1c1c'
'846db4fb24c23b570aab42924830222a6670f92505d1b7570e5c175301b59d00'
'426a81d82e7f5af6fd8e4f672fbbda850643a8fb6781f05ee6b2fcccb007efc9'
'bbe60b35d1b1e2efc1308a8f54f1fdc6808240a81c5f5b4d75321b7ee86e41f4'
'35efeee8590d6d60c711ae9cdc918e4841ab61d10cb02359e65e36ebff95ffc5'
'eaa7af92d28bfa8940bb551560fd7be777f9f175292eaa72b5f6ef00fb240252'
'9a0b6cc23f7bd97b83b6c38dd2b4e4373fead8bd3ccfb82a47c72971e9d6f8ad')

View file

@ -1,6 +1,6 @@
real 0m42.561s
user 0m39.857s
sys 0m3.066s
real 0m57.023s
user 0m51.954s
sys 0m5.615s

View file

@ -7,8 +7,8 @@
pkgbase=curl
pkgname=(curl libcurl-compat libcurl-gnutls)
_tag='51ca9c12f959b7e97c1e67d0bebb33aa0d1f28b2' # git rev-parse v${_tag_name}
_tag_name='8_2_1'
_tag='8c537ee308eca91d0a240315b24025048ae54e61' # git rev-parse v${_tag_name}
_tag_name='8_3_0'
pkgver="${_tag_name//_/.}"
pkgrel=01
pkgdesc='command line tool and library for transferring data with URLs - w/o ipv6 & zstd'
@ -184,7 +184,8 @@ validpgpkeys=('27EDEAF22F3ABCEB50DB9A125CC908FDB71E12C2') # Daniel Stenberg
sha256sums=(SKIP)
## fc3607344c33dc79bcb6e4ca2c834be79958225a196a6acd9479dae4d8d8ee02 curl-8.2.1-01-x86_64.pkg.tar.lz
## 8771cff3a886c27358c1650946bd9c7a9fea4410992ccabada052030a82bbbec libcurl-compat-8.2.1-01-x86_64.pkg.tar.lz
## 57b3a264c6f634896dabd622cca6c1233a2268ac11f4a55a416dc0cd0bbeb73e libcurl-gnutls-8.2.1-01-x86_64.pkg.tar.lz
## f79fc9758652a19180ad6adc2b2bc94ccaa5403d90b7f9da0ddb4d10e6cb88da curl-8.3.0-01-x86_64.pkg.tar.lz
## c733628675c75c5233cd3a25cdcb2777292159790315d46b3235a2f234dff297 libcurl-compat-8.3.0-01-x86_64.pkg.tar.lz
## 2cdbd82eb6094bae1e2194ca07fc75fdb09571adafcfd11d6b3aab3bde6d8423 libcurl-gnutls-8.3.0-01-x86_64.pkg.tar.lz

View file

@ -6,8 +6,8 @@
pkgbase=curl
pkgname=(curl libcurl-compat libcurl-gnutls)
_tag='51ca9c12f959b7e97c1e67d0bebb33aa0d1f28b2' # git rev-parse v${_tag_name}
_tag_name='8_2_1'
_tag='8c537ee308eca91d0a240315b24025048ae54e61' # git rev-parse v${_tag_name}
_tag_name='8_3_0'
pkgver="${_tag_name//_/.}"
pkgrel=1
pkgdesc='command line tool and library for transferring data with URLs'

View file

@ -7,7 +7,7 @@
pkgname=groff
pkgver=1.23.0
pkgrel=04
pkgrel=05
pkgdesc='GNU troff text-formatting system'
url='https://www.gnu.org/software/groff/groff.html'
groups=( jobbot )
@ -74,5 +74,4 @@ sha256sums=(6b9757f592b7518b4902eb6af7e54570bdccba37a871fddb2d30ae3863511c13 #
489bb32bbd1c7bced33bf187611219527914ae46ce05238fe80dc11c4b1bb909 # display-utc-times.patch
cbcfe19bc1271b91e2c3bb8864813118863a3d8d10e6ca341f82c0ca5dc37dff) # site.tmac
## 27aed052864aab603587ce4924c8a76841663bf2ab5be0d95fa9641e9b479e41 groff-1.23.0-04-x86_64.pkg.tar.lz
## 38dc02cfe44f976db07f406be11d491239d83c0854d49d0e5b6048e61f3e9f44 groff-1.23.0-05-x86_64.pkg.tar.lz

View file

@ -2,7 +2,7 @@
pkgname=groff
pkgver=1.23.0
pkgrel=4
pkgrel=5
pkgdesc='GNU troff text-formatting system'
arch=('x86_64')
url='https://www.gnu.org/software/groff/groff.html'
@ -59,3 +59,7 @@ package() {
cat "$srcdir"/site.tmac >> \
"$pkgdir"/usr/share/groff/site-tmac/mdoc.local
}
sha256sums=('6b9757f592b7518b4902eb6af7e54570bdccba37a871fddb2d30ae3863511c13'
'SKIP'
'489bb32bbd1c7bced33bf187611219527914ae46ce05238fe80dc11c4b1bb909'
'94f28b32775bcfebf1a50231a2df9791a194d571c1651b465d4875bdea181f96')