Skip to content

RFC Cache TCG plugin & symbol-resolution API

Mahmoud Mandour qemu-devel 1 version Applied

Status from this message: Queued patches 1-2 to plugins/next, will queue the rest from next

Get series with b4
b4 am [email protected]

Versions newest first

  1. v3 RFC Latest4 patches 3 repliesApplied

Changes in v3 from the cover letter

Precomputed the value of block size shift once and stored in the cache.

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/4plugins/api: expose symbol lookup to pluginsinclude/qemu/qemu-plugin.h plugins/api.c+15 -00 replies
2/4plugins: Added a new cache modelling plugin.contrib/plugins/Makefile contrib/plugins/cache.c+424 -00 replies
3/4plugins/cache: Enabled cache parameterizationcontrib/plugins/cache.c+42 -21 reply
4/4plugins/cache: Added FIFO and LRU eviction policies.contrib/plugins/cache.c+192 -131 reply

Reviews trailers per patch

1 of 4 patches has a Reviewed-by or Acked-by.

PatchAlex Bennée
1/4
2/4
3/4
4/4R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [RFC PATCH v3 0/4] Cache TCG plugin & symbol-resolution API

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
Signature · 1 line
2.25.1