Open cyjseagull opened 7 years ago
I think the first approach is more reasonable. The reason for the assertion fail is that invalidate should only be called for the cachelines that actually exist in the cache. This is a sanity check for the coherence protocol, and because coherence is complex, don't break it.
I would suggest to add another function in filter cache to do the flush: first lookup the line. If it is in the cache, then do invalidate, otherwise just skip it. In this way you won't break the current coherence protocol, which is a cleaner style.
Another thing is that how many levels you want to flush, just L1 or all caches? I don't remember the semantics of clflush, but you may need to think it over and recursively apply flush to the parent caches if needed.
Thanks for your great advise very much ! I have added "clflush" that calls invalidate function to do the flush in filter cache, and finally, it works well without dead locks and assertions.
Considering that clflush should be done by every level of caches, and I have found that the "invalidate" function of all parent caches has already called "invalidate" function of every child (implemented by "sendInvalidates" function ). So I get the root parent of specified cache line and call "invalidate" function of parent cache to do the clflush, and it seems this method works well so far.
hello:
add a "clflush" function in filter_cache.h, this function call "invalidate" function to invalidate specified cache lines. However, I have encountered "assertion failed error in coherence_ctrls.h" before the simulation has done;
Can you give me some advice about how to implement "clflush" function in zsim? I'll appreciate !
Thank you very much!