Message ID | PAWPR08MB8982D282C63421DE9232C0EB832F2@PAWPR08MB8982.eurprd08.prod.outlook.com |
---|---|
State | New |
Headers | show |
Series | AArch64: Remove zva_128 from memset | expand |
On Tue, Nov 26, 2024 at 3:51 PM Wilco Dijkstra <Wilco.Dijkstra@arm.com> wrote: > > > Remove ZVA 128 support from memset - the new memset no longer > guarantees count >= 256, which can result in underflow and a > crash if ZVA size is 128 ([1]). Since only one CPU uses a ZVA > size of 128 and its memcpy implementation was removed in commit > e162ab2bf1b82c40f29e1925986582fa07568ce8, remove this special > case too. Note the one CPU is a thunderx 1 based on reading the midr_el1. From my point of view this is ok. Reviewed-by: Andrew Pinski <quic_apinski@quicinc.com> Thanks, Andrew Pinski > > Passes regress, OK for commit? > > [1] https://sourceware.org/pipermail/libc-alpha/2024-November/161626.html > > --- > > diff --git a/sysdeps/aarch64/memset.S b/sysdeps/aarch64/memset.S > index b76dde1557ed8fb195c24a13a06f8d0d9ab126fa..8402219b1874b00a10ea460e278edbf54c6140f6 100644 > --- a/sysdeps/aarch64/memset.S > +++ b/sysdeps/aarch64/memset.S > @@ -103,7 +103,7 @@ L(set_long): > mrs zva_val, dczid_el0 > and zva_val, zva_val, 31 > cmp zva_val, 4 /* ZVA size is 64 bytes. */ > - b.ne L(zva_128) > + b.ne L(no_zva) > #endif > stp q0, q0, [dst, 32] > bic dst, dstin, 63 > @@ -136,28 +136,5 @@ L(no_zva_loop): > stp q0, q0, [dstend, -32] > ret > > -#ifndef ZVA64_ONLY > - .p2align 4 > -L(zva_128): > - cmp zva_val, 5 /* ZVA size is 128 bytes. */ > - b.ne L(no_zva) > - > - stp q0, q0, [dst, 32] > - stp q0, q0, [dst, 64] > - stp q0, q0, [dst, 96] > - bic dst, dst, 127 > - sub count, dstend, dst /* Count is now 128 too large. */ > - sub count, count, 128 + 128 /* Adjust count and bias for loop. */ > -1: add dst, dst, 128 > - dc zva, dst > - subs count, count, 128 > - b.hi 1b > - stp q0, q0, [dstend, -128] > - stp q0, q0, [dstend, -96] > - stp q0, q0, [dstend, -64] > - stp q0, q0, [dstend, -32] > - ret > -#endif > - > END (MEMSET) > libc_hidden_builtin_def (MEMSET) > >
diff --git a/sysdeps/aarch64/memset.S b/sysdeps/aarch64/memset.S index b76dde1557ed8fb195c24a13a06f8d0d9ab126fa..8402219b1874b00a10ea460e278edbf54c6140f6 100644 --- a/sysdeps/aarch64/memset.S +++ b/sysdeps/aarch64/memset.S @@ -103,7 +103,7 @@ L(set_long): mrs zva_val, dczid_el0 and zva_val, zva_val, 31 cmp zva_val, 4 /* ZVA size is 64 bytes. */ - b.ne L(zva_128) + b.ne L(no_zva) #endif stp q0, q0, [dst, 32] bic dst, dstin, 63 @@ -136,28 +136,5 @@ L(no_zva_loop): stp q0, q0, [dstend, -32] ret -#ifndef ZVA64_ONLY - .p2align 4 -L(zva_128): - cmp zva_val, 5 /* ZVA size is 128 bytes. */ - b.ne L(no_zva) - - stp q0, q0, [dst, 32] - stp q0, q0, [dst, 64] - stp q0, q0, [dst, 96] - bic dst, dst, 127 - sub count, dstend, dst /* Count is now 128 too large. */ - sub count, count, 128 + 128 /* Adjust count and bias for loop. */ -1: add dst, dst, 128 - dc zva, dst - subs count, count, 128 - b.hi 1b - stp q0, q0, [dstend, -128] - stp q0, q0, [dstend, -96] - stp q0, q0, [dstend, -64] - stp q0, q0, [dstend, -32] - ret -#endif - END (MEMSET) libc_hidden_builtin_def (MEMSET)