This RFC series introduces a new cache TCG plugin that models separate L1 data cache and L1 instruction cache and uses one shared cache for all the cores.
It also includes a commit by Alex that adds an API call that resolves the symbol of an insn. The original RFC patch posted by Alex Bennée included incorporating symbol resolution into the cache plugin that caused conflicts, so I dropped the plugin additions from that and introduced them afterwards. v2 -> v3: Precomputed the value of block size shift once and stored in the cache. Removed tag shifting since it's okay to leave the tag in the high-order bits and mask out set index and block offset. Used one hashtable to store InsnData structs and made the structs have separate counters for data misses and instruction misses. Used a boolean to indicate whether an access resulted in a hit or a miss. Inserted an InsnData struct into the hashtable on translation-time and made sure we do so once so that we don't rewrite the struct if an instruction is translated multiple times. Made the output format for most-missing instructions more machine-readable. Removed trace-generation. Freed tokenized strings after argument parsing. Returned null from cache_init() if argument cache config is bad. Used one enum to indicate the chosen eviction policy. Added function pointers for cache update and metadata initialization and destroying. Those pointers are assigned to policy-specific functions. Remade LRU. Assigned a generation number that is incremented on each set access to the currently-accessed block's priority. On miss, evicted the block with the least generation number. Allowed to give multiple "evict" arguments and sticked to the last one. Alex Bennée (1): plugins/api: expose symbol lookup to plugins Mahmoud Mandour (3): plugins: Added a new cache modelling plugin. plugins/cache: Enabled cache parameterization plugins/cache: Added FIFO and LRU eviction policies. contrib/plugins/Makefile | 1 + contrib/plugins/cache.c | 642 +++++++++++++++++++++++++++++++++++++ include/qemu/qemu-plugin.h | 9 + plugins/api.c | 6 + 4 files changed, 658 insertions(+) create mode 100644 contrib/plugins/cache.c -- 2.25.1