aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2021-11-29 18:58:06 +0100
committerRichard Henderson <richard.henderson@linaro.org>2021-11-29 18:58:06 +0100
commita0fd8a5492240379a07c0b39c8dae3b8341b458f (patch)
tree99a4c40fec8ee26ec60b62baae3f60906662db21
parent095c7737fbb8f25f7458290e4b5e5aa198f10a60 (diff)
parentd5615bbf9103f01911df683cc3e4e85c49a92593 (diff)
Merge tag 'pull-for-6.2-291121-1' of https://github.com/stsquad/qemu into staging
TCG, plugin and build fixes: - introduce CF_NOIRQ to avoid watchpoint race - fix avocado plugin test - fix linker issue with weird paths - band-aid for gdbstub race - updates for MAINTAINERS - fix some compiler warning in example plugin # gpg: Signature made Mon 29 Nov 2021 04:16:22 PM CET # gpg: using RSA key 6685AE99E75167BCAFC8DF35FBD0DB095A9E2A44 # gpg: Good signature from "Alex Bennée (Master Work Key) <alex.bennee@linaro.org>" [full] * tag 'pull-for-6.2-291121-1' of https://github.com/stsquad/qemu: tests/plugin/syscall.c: fix compiler warnings MAINTAINERS: Add section for Aarch64 GitLab custom runner MAINTAINERS: Remove me as a reviewer for the build and test/avocado gdbstub: handle a potentially racing TaskState plugins/meson.build: fix linker issue with weird paths tests/avocado: fix tcg_plugin mem access count test accel/tcg: suppress IRQ check for special TBs accel/tcg: introduce CF_NOIRQ Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
-rw-r--r--MAINTAINERS10
-rw-r--r--accel/tcg/cpu-exec.c9
-rw-r--r--accel/tcg/translate-all.c4
-rw-r--r--gdbstub.c2
-rw-r--r--include/exec/exec-all.h1
-rw-r--r--include/exec/gen-icount.h21
-rw-r--r--plugins/meson.build4
-rw-r--r--softmmu/physmem.c4
-rw-r--r--tests/avocado/tcg_plugins.py2
-rw-r--r--tests/plugin/syscall.c8
10 files changed, 46 insertions, 19 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index d3879aa3c1..006a2293ba 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3469,7 +3469,7 @@ M: Alex Bennée <alex.bennee@linaro.org>
M: Philippe Mathieu-Daudé <f4bug@amsat.org>
M: Thomas Huth <thuth@redhat.com>
R: Wainer dos Santos Moschetta <wainersm@redhat.com>
-R: Willian Rampazzo <willianr@redhat.com>
+R: Beraldo Leal <bleal@redhat.com>
S: Maintained
F: .github/lockdown.yml
F: .gitlab-ci.yml
@@ -3507,10 +3507,16 @@ W: https://trello.com/b/6Qi1pxVn/avocado-qemu
R: Cleber Rosa <crosa@redhat.com>
R: Philippe Mathieu-Daudé <philmd@redhat.com>
R: Wainer dos Santos Moschetta <wainersm@redhat.com>
-R: Willian Rampazzo <willianr@redhat.com>
+R: Beraldo Leal <bleal@redhat.com>
S: Odd Fixes
F: tests/avocado/
+GitLab custom runner (Works On Arm Sponsored)
+M: Alex Bennée <alex.bennee@linaro.org>
+M: Philippe Mathieu-Daudé <f4bug@amsat.org>
+S: Maintained
+F: .gitlab-ci.d/custom-runners/ubuntu-20.04-aarch64.yml
+
Documentation
-------------
Build system architecture
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index 2d14d02f6c..409ec8c38c 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -721,6 +721,15 @@ static inline bool need_replay_interrupt(int interrupt_request)
static inline bool cpu_handle_interrupt(CPUState *cpu,
TranslationBlock **last_tb)
{
+ /*
+ * If we have requested custom cflags with CF_NOIRQ we should
+ * skip checking here. Any pending interrupts will get picked up
+ * by the next TB we execute under normal cflags.
+ */
+ if (cpu->cflags_next_tb != -1 && cpu->cflags_next_tb & CF_NOIRQ) {
+ return false;
+ }
+
/* Clear the interrupt flag now since we're processing
* cpu->interrupt_request and cpu->exit_request.
* Ensure zeroing happens before reading cpu->exit_request or
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
index bd0bb81d08..bd71db59a9 100644
--- a/accel/tcg/translate-all.c
+++ b/accel/tcg/translate-all.c
@@ -1738,7 +1738,7 @@ tb_invalidate_phys_page_range__locked(struct page_collection *pages,
if (current_tb_modified) {
page_collection_unlock(pages);
/* Force execution of one insn next time. */
- cpu->cflags_next_tb = 1 | curr_cflags(cpu);
+ cpu->cflags_next_tb = 1 | CF_NOIRQ | curr_cflags(cpu);
mmap_unlock();
cpu_loop_exit_noexc(cpu);
}
@@ -1906,7 +1906,7 @@ static bool tb_invalidate_phys_page(tb_page_addr_t addr, uintptr_t pc)
#ifdef TARGET_HAS_PRECISE_SMC
if (current_tb_modified) {
/* Force execution of one insn next time. */
- cpu->cflags_next_tb = 1 | curr_cflags(cpu);
+ cpu->cflags_next_tb = 1 | CF_NOIRQ | curr_cflags(cpu);
return true;
}
#endif
diff --git a/gdbstub.c b/gdbstub.c
index 23baaef40e..141d7bc4ec 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -94,7 +94,7 @@ static inline int cpu_gdb_index(CPUState *cpu)
{
#if defined(CONFIG_USER_ONLY)
TaskState *ts = (TaskState *) cpu->opaque;
- return ts->ts_tid;
+ return ts ? ts->ts_tid : -1;
#else
return cpu->cpu_index + 1;
#endif
diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
index 6bb2a0f7ec..35d8e93976 100644
--- a/include/exec/exec-all.h
+++ b/include/exec/exec-all.h
@@ -503,6 +503,7 @@ struct TranslationBlock {
#define CF_USE_ICOUNT 0x00020000
#define CF_INVALID 0x00040000 /* TB is stale. Set with @jmp_lock held */
#define CF_PARALLEL 0x00080000 /* Generate code for a parallel context */
+#define CF_NOIRQ 0x00100000 /* Generate an uninterruptible TB */
#define CF_CLUSTER_MASK 0xff000000 /* Top 8 bits are cluster ID */
#define CF_CLUSTER_SHIFT 24
diff --git a/include/exec/gen-icount.h b/include/exec/gen-icount.h
index 610cba58fe..c57204ddad 100644
--- a/include/exec/gen-icount.h
+++ b/include/exec/gen-icount.h
@@ -21,7 +21,6 @@ static inline void gen_tb_start(const TranslationBlock *tb)
{
TCGv_i32 count;
- tcg_ctx->exitreq_label = gen_new_label();
if (tb_cflags(tb) & CF_USE_ICOUNT) {
count = tcg_temp_local_new_i32();
} else {
@@ -42,7 +41,19 @@ static inline void gen_tb_start(const TranslationBlock *tb)
icount_start_insn = tcg_last_op();
}
- tcg_gen_brcondi_i32(TCG_COND_LT, count, 0, tcg_ctx->exitreq_label);
+ /*
+ * Emit the check against icount_decr.u32 to see if we should exit
+ * unless we suppress the check with CF_NOIRQ. If we are using
+ * icount and have suppressed interruption the higher level code
+ * should have ensured we don't run more instructions than the
+ * budget.
+ */
+ if (tb_cflags(tb) & CF_NOIRQ) {
+ tcg_ctx->exitreq_label = NULL;
+ } else {
+ tcg_ctx->exitreq_label = gen_new_label();
+ tcg_gen_brcondi_i32(TCG_COND_LT, count, 0, tcg_ctx->exitreq_label);
+ }
if (tb_cflags(tb) & CF_USE_ICOUNT) {
tcg_gen_st16_i32(count, cpu_env,
@@ -74,8 +85,10 @@ static inline void gen_tb_end(const TranslationBlock *tb, int num_insns)
tcgv_i32_arg(tcg_constant_i32(num_insns)));
}
- gen_set_label(tcg_ctx->exitreq_label);
- tcg_gen_exit_tb(tb, TB_EXIT_REQUESTED);
+ if (tcg_ctx->exitreq_label) {
+ gen_set_label(tcg_ctx->exitreq_label);
+ tcg_gen_exit_tb(tb, TB_EXIT_REQUESTED);
+ }
}
#endif
diff --git a/plugins/meson.build b/plugins/meson.build
index aeb386ebae..b3de57853b 100644
--- a/plugins/meson.build
+++ b/plugins/meson.build
@@ -2,9 +2,9 @@ plugin_ldflags = []
# Modules need more symbols than just those in plugins/qemu-plugins.symbols
if not enable_modules
if 'CONFIG_HAS_LD_DYNAMIC_LIST' in config_host
- plugin_ldflags = ['-Wl,--dynamic-list=' + (meson.project_build_root() / 'qemu-plugins-ld.symbols')]
+ plugin_ldflags = ['-Wl,--dynamic-list=qemu-plugins-ld.symbols']
elif 'CONFIG_HAS_LD_EXPORTED_SYMBOLS_LIST' in config_host
- plugin_ldflags = ['-Wl,-exported_symbols_list,' + (meson.project_build_root() / 'qemu-plugins-ld64.symbols')]
+ plugin_ldflags = ['-Wl,-exported_symbols_list,qemu-plugins-ld64.symbols']
endif
endif
diff --git a/softmmu/physmem.c b/softmmu/physmem.c
index 314f8b439c..3524c04c2a 100644
--- a/softmmu/physmem.c
+++ b/softmmu/physmem.c
@@ -912,7 +912,7 @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len,
*/
if (!cpu->can_do_io) {
/* Force execution of one insn next time. */
- cpu->cflags_next_tb = 1 | CF_LAST_IO | curr_cflags(cpu);
+ cpu->cflags_next_tb = 1 | CF_LAST_IO | CF_NOIRQ | curr_cflags(cpu);
cpu_loop_exit_restore(cpu, ra);
}
/*
@@ -946,7 +946,7 @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len,
cpu_loop_exit(cpu);
} else {
/* Force execution of one insn next time. */
- cpu->cflags_next_tb = 1 | CF_LAST_IO | curr_cflags(cpu);
+ cpu->cflags_next_tb = 1 | CF_LAST_IO | CF_NOIRQ | curr_cflags(cpu);
mmap_unlock();
cpu_loop_exit_noexc(cpu);
}
diff --git a/tests/avocado/tcg_plugins.py b/tests/avocado/tcg_plugins.py
index 9ca1515c3b..642d2e49e3 100644
--- a/tests/avocado/tcg_plugins.py
+++ b/tests/avocado/tcg_plugins.py
@@ -131,7 +131,7 @@ class PluginKernelNormal(PluginKernelBase):
suffix=".log")
self.run_vm(kernel_path, kernel_command_line,
- "tests/plugin/libmem.so,arg=both", plugin_log.name,
+ "tests/plugin/libmem.so,inline=true,callback=true", plugin_log.name,
console_pattern,
args=('-icount', 'shift=1'))
diff --git a/tests/plugin/syscall.c b/tests/plugin/syscall.c
index 484b48de49..96040c578f 100644
--- a/tests/plugin/syscall.c
+++ b/tests/plugin/syscall.c
@@ -70,19 +70,17 @@ static void vcpu_syscall_ret(qemu_plugin_id_t id, unsigned int vcpu_idx,
}
g_mutex_unlock(&lock);
} else {
- g_autofree gchar *out;
- out = g_strdup_printf("syscall #%" PRIi64 " returned -> %" PRIi64 "\n",
- num, ret);
+ g_autofree gchar *out = g_strdup_printf(
+ "syscall #%" PRIi64 " returned -> %" PRIi64 "\n", num, ret);
qemu_plugin_outs(out);
}
}
static void print_entry(gpointer val, gpointer user_data)
{
- g_autofree gchar *out;
SyscallStats *entry = (SyscallStats *) val;
int64_t syscall_num = entry->num;
- out = g_strdup_printf(
+ g_autofree gchar *out = g_strdup_printf(
"%-13" PRIi64 "%-6" PRIi64 " %" PRIi64 "\n",
syscall_num, entry->calls, entry->errors);
qemu_plugin_outs(out);