The patch deduplicates all the code with a set of common macros.
I don't know what to do with pre-existing comments, they interfere with current macro use.
There will be further changes to slightly optimize this code.
Differential D17257
amd64: macroify copyin/copyout and provide erms variants mjg on Sep 20 2018, 10:39 AM. Authored by Tags None Referenced Files
Subscribers
Details
The patch deduplicates all the code with a set of common macros. I don't know what to do with pre-existing comments, they interfere with current macro use. There will be further changes to slightly optimize this code. compared assembly before and after. booted no smap, no erms + no smap, erms + smap, erms boxes.
Diff Detail
Event TimelineComment Actions Now that I uploaded the patch I see a bug for the case I did not boot: SMAP without erms - it can exit with smap disabled. Will update the patch later, but feedback on approach taken is appreciated. Comment Actions I have a global opinion about this that would also handle the comments issue. When I worked on PTI patch, I initially used C preprocessor for the macros, but it quickly came out of control. Comments were the minor problem. Much bigger issue is the inability to edit the asm without much pain due to backslashes, and most important, the high distance between code fragment in the macro and its use in the actual code. So I ended up switching to the asm macros instead. WIth asm macros, you can write single macro parametrized by ERMS/SMAP and whatever additional tunables. Then tunable would conditionally disable part of the code. Benefits are that you write normal asm, readers see normal asm, and the tuning when some feature is disabled in the instantiation, is easy to read. Look at amd64/include/asmacros.h for examples.
Comment Actions rework the patch to use arm macros I don't see how to produce necessary function names. All concatenation examples I found use passed values, none select a part of the name based on a value. Thus the somewhat ugly repetition of name and params.
|