On 8/17/22 06:08, Ilya Leoshkevich wrote:
+static void cpu_tb_jmp_cache_remove(TranslationBlock *tb)
+{
+    CPUState *cpu;
+    uint32_t h;
+
+    /* remove the TB from the hash list */
+    if (TARGET_TB_PCREL) {
+        /* Any TB may be at any virtual address */
+        CPU_FOREACH(cpu) {
+            cpu_tb_jmp_cache_clear(cpu);
+        }

This comment is not currently true for user-only. Although there's an outstanding bug report about our failure to manage virtual aliasing in user-only...

+            PAGE_FOR_EACH_TB(p, tb, n) {
+                cpu_tb_jmp_cache_remove(tb);
+            }

You wouldn't want to call cpu_tb_jmp_cache_clear() 99 times for the 99 tb's on 
the page.

For user-only, I think mprotect is rare enough that just clearing the whole cache once is sufficient.


r~

Reply via email to