On Fri, Jan 05, 2018 at 10:31:05AM +0000, Matt Redfearn wrote: > The current location of ehb() in mipsmtregs.h does not make sense, since > it is not strictly related to multi-threading, and may be used in code > which does not include mipsmtregs.h > arch/mips/include/asm/barrier.h | 13 +++++++++++++ > arch/mips/include/asm/mipsmtregs.h | 8 -------- But ehb isn't really a memory barrier like the other barriers in barrier.h, its an execution hazard barrier, as used when available by the hazard macros in hazards.h, and in fact there is already an _ehb() there. I suspect the intention was that most MIPS arch code using ehb would do so using the appropriate hazard abstractions, which would do the right number of NOPs on hardware without the EHB instruction. Code that is specific to certain arch revisions (like the MIPS MT code and MIPS KVM) can get away with using _ehb/ehb, but should use the abstractions where they exist to make intentions clear. None of the specific hazards in hazards.h really match the case in patch 2, I suppose you could have a new sync_mfc0_hazard() macro, but its so specific and EHB should be guaranteed to exist there, so perhaps _ehb() should just be used instead of ehb() there? (with a comment to describe what operations are being protected from what hazards). Cheers James
Attachment:
signature.asc
Description: PGP signature