This is an archive of the discontinued LLVM Phabricator instance.

[compiler-rt] [builtins] Align addresses to cache lines in __clear_cache for aarch64
ClosedPublic

Authored by mstorsjo on Jan 17 2018, 12:55 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

mstorsjo created this revision.Jan 17 2018, 12:55 PM
Herald added subscribers: Restricted Project, kristof.beyls, dberris and 2 others. · View Herald TranscriptJan 17 2018, 12:55 PM

I guess this comes down to the interpretation of (begin, end] when you can only clear a cache line at a time. I think that this makes sense as it matches the powerpc64 below, Linux also follows this approach. I'm not sure how this is done on BSD and Darwin.

Linux links:

I guess this comes down to the interpretation of (begin, end] when you can only clear a cache line at a time. I think that this makes sense as it matches the powerpc64 below, Linux also follows this approach. I'm not sure how this is done on BSD and Darwin.

It also matches libgcc: https://github.com/gcc-mirror/gcc/blob/master/libgcc/config/aarch64/sync-cache.c

I'm not sure at what granularity memory protection can be set (if it can be more granular than the cache line size) - in that case, we shouldn't align the start but instead align after each (= the first) increment instead. But seeing as nobody else does that, including libgcc that operates in user mode, I think this should be fine.

@peter.smith Would you care to approve this one, when there don't seem to be anybody else interested in it?

peter.smith accepted this revision.Jan 24 2018, 2:11 AM

Yes I'm happy to approve.

This revision is now accepted and ready to land.Jan 24 2018, 2:11 AM
This revision was automatically updated to reflect the committed changes.
mstorsjo added a subscriber: hans.Jan 24 2018, 2:17 AM

@hans - I think this is a pretty simple/straightforward bugfix that might be worthy of backporting to 6.0.

hans added a comment.Jan 24 2018, 7:57 AM

@hans - I think this is a pretty simple/straightforward bugfix that might be worthy of backporting to 6.0.

Merged in r323338.