Page MenuHomeFreeBSD

powerpc/powerpc64: Enforce natural alignment in memcpy
ClosedPublic

Authored by jhibbits on Mar 5 2020, 2:59 PM.
Tags
None
Referenced Files
F163490471: D23969.id69219.diff
Thu, Jul 23, 5:56 PM
Unknown Object (File)
Mon, Jul 20, 3:24 AM
Unknown Object (File)
Sun, Jul 19, 8:34 PM
Unknown Object (File)
Sun, Jul 19, 3:07 AM
Unknown Object (File)
Sun, Jul 5, 1:02 AM
Unknown Object (File)
Sat, Jul 4, 11:37 PM
Unknown Object (File)
Fri, Jul 3, 11:21 AM
Unknown Object (File)
Tue, Jun 30, 7:28 PM
Subscribers

Details

Summary

POWER architecture CPUs (Book-S) require natural alignment for
cache-inhibited storage accesses. Since we can't know the caching model
for a page ahead of time, always enforce natural alignment in memcpy.
This fixes a SIGBUS in X with acceleration enabled on POWER9.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 29804
Build 27635: arc lint + arc unit

Event Timeline

lib/libc/powerpc64/string/memcpy.S
61

You also need to check if len (r5) is 0 and exit, because .Lcopy_remaining_fix_index_byte doesn't handle this case.

lib/libc/powerpc64/string/memcpy.S
61

Sorry, I missed the cmpdi %r5, 0 above, so forget my previous comment.

I tested this patch with D23958/r358672 reverted. This solution makes optimized memcpy/bcopy code viable again on POWER7. It slows down some cases but it's a gain in overal, I think.

This revision is now accepted and ready to land.Mar 5 2020, 8:09 PM