Hi Rowan, > This patch adds functionality to enforce the requested QEMU_PLUGIN_CB_ > flags level passed when registering a callback function using the > plugins API. Each time a callback is about to be invoked, a thread-local > variable will be updated with the level that callback requested. Then, > called API functions (in particular, the register read and write API) > will call qemu_plugin_get_cb_flags() to check the level is at least the > level they require.
IIUC this patch also forbids using qemu_plugin_read_register in several callbacks that are not called from translated blocks, such as VCPU reset and init. And you do remove one of those from a plugin in patch 8 of this series, stating that this usage was not intended. However, it should be safe at least for a subset of those callbacks and I believe there are very valid use-cases for allowing such usage. For example, we are currently working on a plugin API exposing traps. In those callbacks, users may want to peek at some registers such as "ecause" and "tval" (on RISC-V). We certainly will want to do so for the use-case we are pushing that API for. We could add a QEMU_PLUGIN_CB flag parameter to the respective registration functions. But since they are not run from translated blocks but _outside_ that context, I feel they would just clutter the API without introducing any real benefit. That is, if there is no valid safety or correctness concern that I'm not aware of. Sorry for bringing this up this late. Regards, Julian
