[PATCH] AArch64: Optimize memset
Wilco Dijkstra
Wilco.Dijkstra@arm.com
Thu Nov 21 21:29:14 GMT 2024
Hi Florian,
> The crash is in PID 1, so there is not much data to go by. I can
> probably get a login on such a system running glibc 2.40 and try run the
> glibc testsuite from the current development branch there, but I'm not
> sure if I could make sense of the results.
> One issue I see is that the dczid_el0 masking in
> sysdeps/aarch64/memset.S is inconsistent with
> sysdeps/unix/sysv/linux/aarch64/cpu-features.c: The former use 31, while
> the latter uses 0xf. But that does not make a difference here because
> dczid_el0 is 5.
Basically I'm checking DZP (bit 4) at the same time as the ZVA size, so that's fine.
The value 5 means it is 128 byte ZVA, and that is enough clue to figure it out!
I kept the code for zva_128 pretty much as is. It requires a minimum size of 256
since it doesn't use SUBS count, count, 128+128; b.ls ... before the zva_128 loop.
The new version changes the code in set_long to no longer check count >= 256.
So that means count can underflow in zva_128 and then it will clear an infinite
amount of memory... So it needs a extra check for count > 256 (or maybe larger
since the cost of 128-byte alignment is quite high).
I'll post a patch.
Cheers,
Wilco
More information about the Libc-alpha
mailing list