RE: [PATCH] accel/tcg: Expose translation block flags to plugins

2023-12-14 Thread Mikhail Tyutin
Hi Alex, > > Exposing appropriate translation block flag allows plugins to > > handle "memory only" blocks in appropriate way. > > We don't want to expose internal details to the plugin. It shouldn't > need to care. > > Do you have a test case where you missed counting the execution of the > ins

RE: Instruction virtual address in TCG Plugins

2023-11-22 Thread Mikhail Tyutin
> > 1. Memory IO operations force TCG to create special translation blocks to > > process that memory load/store operation. The plugin gets notification for > > this translation block as well, but instrumentation callbacks other than > > memory ones are silently ignored. To make it correct, the plu

[PATCH] accel/tcg: TCG Plugin callback on a vCpu interrupt

2023-11-22 Thread Mikhail Tyutin
TCG Plugin callback to notify plugins when interrupt is triggered for a vCpu. The plugin can optionally use this notification to see reason of aborted instruction execution. Signed-off-by: Mikhail Tyutin --- accel/tcg/cpu-exec.c | 5 + include/qemu/plugin-event.h | 1 + include

[PATCH] accel/tcg: Expose translation block flags to plugins

2023-11-22 Thread Mikhail Tyutin
ned-off-by: Mikhail Tyutin --- include/qemu/qemu-plugin.h | 29 - plugins/api.c| 14 ++ plugins/qemu-plugins.symbols | 1 + 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plug

RE: Instruction virtual address in TCG Plugins

2023-11-21 Thread Mikhail Tyutin
> >> > I suspect it is because of memory mappings by guest OS that changes > >> > virtual addresses for that block. > >> > > >> > I also looked at gen_empty_udata_cb() function and considered to extend > >> > plugin API to pass a program counter > >> > value as additional callback argument. I tho

RE: Instruction virtual address in TCG Plugins

2023-11-14 Thread Mikhail Tyutin
> > What is the right way to get virtual address of either translation block or > > instruction inside of TCG plugin? Does > > plugin API allow that or it needs some extension? > > > > So far I use qemu_plugin_tb_vaddr() inside of my block translation callback > > to get block virtual address and

Instruction virtual address in TCG Plugins

2023-11-13 Thread Mikhail Tyutin
Greetings, What is the right way to get virtual address of either translation block or instruction inside of TCG plugin? Does plugin API allow that or it needs some extension? So far I use qemu_plugin_tb_vaddr() inside of my block translation callback to get block virtual address and then pass

RE: [PATCH] Fix SEGFAULT on getting physical address of MMIO region.

2023-08-09 Thread Mikhail Tyutin
> On 8/2/23 06:08, Mikhail Tyutin wrote: > > The fix is to clear TLB_INVALID_MASK bit in tlb_addr, as it happens in > > other places e.g. > > load_helper(). > > > > Signed-off-by: Dmitriy Solovev > > Signed-off-by: Mikhail Tyutin > > --- > >

RE: [PATCH] Add support of callbacks after instructions to plugin api

2023-08-08 Thread Mikhail Tyutin
> On 8/8/23 06:44, Mikhail Tyutin wrote: > > Initially, we can only call the callback BEFORE instructions. This commit > > adds the ability to insert the callback AFTER instructions. > > > > No callback call for control-flow instructions. > > You're going to

[PATCH] Add support of callbacks after instructions to plugin api

2023-08-08 Thread Mikhail Tyutin
Initially, we can only call the callback BEFORE instructions. This commit adds the ability to insert the callback AFTER instructions. No callback call for control-flow instructions. Signed-off-by: Aleksandr Anenkov Signed-off-by: Mikhail Tyutin --- accel/tcg/plugin-gen.c | 25

[PATCH v3] Fix SEGFAULT on getting physical address of MMIO region.

2023-08-04 Thread Mikhail Tyutin
Apply save_iotlb_data() to io_readx() as well as to io_writex(). This fixes SEGFAULT on qemu_plugin_hwaddr_phys_addr() call plugins for addresses inside of MMIO region. Signed-off-by: Dmitriy Solovev Signed-off-by: Mikhail Tyutin Reviewed-by: Richard Henderson --- v3: - commit wording update

RE: [PATCH v2] Fix SEGFAULT on getting physical address of MMIO region.

2023-08-03 Thread Mikhail Tyutin
> > Apply save_iotlb_data() to io_readx() as well as to io_writex(). > > Could we have a bit more detail in the commit message about > when you can get this segfault? > > In particular, does this happen only if you're using plugins? > I think so. It crashes on specific addresses when plugin cal

[PATCH] Add api to read CPU registers in TCG plugins

2023-08-03 Thread Mikhail Tyutin
From: Aleksandr Anenkov This commit: - adds a plugin API to read the registers of the current CPU - introduces qemu_plugin_reg_ctx structure for faster data gathering of a set of registers without memory reallocation - adds an example plugin showing how to work with this API - fixes for GDB tha

[PATCH v2] Fix SEGFAULT on getting physical address of MMIO region.

2023-08-03 Thread Mikhail Tyutin
Apply save_iotlb_data() to io_readx() as well as to io_writex(). Signed-off-by: Dmitriy Solovev Signed-off-by: Mikhail Tyutin --- accel/tcg/cputlb.c | 36 +--- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/accel/tcg/cputlb.c b/accel/tcg

[PATCH] Fix SEGFAULT on getting physical address of MMIO region.

2023-08-02 Thread Mikhail Tyutin
The fix is to clear TLB_INVALID_MASK bit in tlb_addr, as it happens in other places e.g. load_helper(). Signed-off-by: Dmitriy Solovev Signed-off-by: Mikhail Tyutin --- accel/tcg/cputlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accel/tcg/cputlb.c b/accel/tcg

[PATCH] Fix SEGFAULT on getting physical address of MMIO region.

2023-07-03 Thread Mikhail Tyutin
The fix is to clear TLB_INVALID_MASK bit in tlb_addr, as it happens in other places e.g. load_helper(). Signed-off-by: Dmitriy Solovev Signed-off-by: Mikhail Tyutin --- accel/tcg/cputlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accel/tcg/cputlb.c b/accel/tcg

RE: [PATCH v2] TCG plugin API extension to read guest memory content by an address

2023-03-10 Thread Mikhail Tyutin
> > Do you mean concurrent access to the same memory block by multiple > > threads? > > Yes - although we also see MMU changes updating a mapping for a given > vaddr -> phys address. > > > > > I think , for guest threads/cores if we observe mismatch of memory content > > read by a plugin and ins

[PATCH v2] Fix incorrect register name in disassembler for fmv,fabs,fneg instructions

2023-03-10 Thread Mikhail Tyutin
Fix incorrect register name in RISC-V disassembler for fmv,fabs,fneg instructions Signed-off-by: Mikhail Tyutin Reviewed-by: Alistair Francis --- disas/riscv.c | 19 ++- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/disas/riscv.c b/disas/riscv.c index

RE: [PATCH v2] TCG plugin API extension to read guest memory content by an address

2023-03-06 Thread Mikhail Tyutin
> Not sure what happened with the formatting of this patch, I think there > is an html part getting in the way. I guess line ends were messed up somewhere on my side. Will try to figure out the root cause. > > +qemu_plugin_vcpu_read_phys_mem(vcpuIndex, vaddr, memContent, > > size); > > So t

[PATCH] Fix incorrect register name in RISC-V disassembler for fmv,fabs,fneg instructions

2023-02-27 Thread Mikhail Tyutin
Fix incorrect register name in RISC-V disassembler for fmv,fabs,fneg instructions Signed-off-by: Mikhail Tyutin --- disas/riscv.c | 19 ++- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/disas/riscv.c b/disas/riscv.c index ddda687c13..58ad3df24d 100644 --- a

[PATCH v2] TCG plugin API extension to read guest memory content by an address

2023-02-20 Thread Mikhail Tyutin
ff-by: Mikhail Tyutin Signed-off-by: Aleksey Titov --- contrib/plugins/Makefile | 1 + contrib/plugins/memtrace.c | 76 include/qemu/qemu-plugin.h | 18 - plugins/api.c| 16 plugins/qemu-plugins.symbols | 1 + 5 files changed

RE: TCG asserts on some of translation blocks with plugin memory callback

2023-02-17 Thread Mikhail Tyutin
> I have been testing TCG plugin patch on latest Qemu build but noticed that it > fails with assert on some of the applications. > >ERROR:../accel/tcg/cpu-exec.c:983:cpu_exec_loop: >assertion failed: (cpu->plugin_mem_cbs == ((void *)0)) > It seems that the problem is around tcg_ctx->

TCG asserts on some of translation blocks with plugin memory callback

2023-02-16 Thread Mikhail Tyutin
Hello, I have been testing TCG plugin patch on latest Qemu build but noticed that it fails with assert on some of the applications. ERROR:../accel/tcg/cpu-exec.c:983:cpu_exec_loop: assertion failed: (cpu->plugin_mem_cbs == ((void *)0)) It happens when TCG plugin sets memory callback in

[PATCH] TCG plugin API extension to read guest memory content by an address

2023-02-16 Thread Mikhail Tyutin
and system-level emulation modes. Signed-off-by: Mikhail Tyutin Signed-off-by: Aleksey Titov --- QEMU_PLUGIN_READ_PHYS_MEM_ENABLED define below is to let plugins to check if this API is available in Qemu build. include/qemu/qemu-plugin.h | 18 ++ plugins/api.c

RE: [PATCH] Adding ability to change disassembler syntax in TCG plugins

2023-02-15 Thread Mikhail Tyutin
> On 2/15/23 19:04, Mikhail Tyutin wrote: > >> On 2/15/23 18:17, Mikhail Tyutin wrote: > >>> ping > >>> > >>> patchew link: > >>> https://patchew.org/QEMU/7d17f0cbb5ed4c90bbadd39924290...@yadro.com/ > >>> > >

RE: [PATCH] Adding ability to change disassembler syntax in TCG plugins

2023-02-15 Thread Mikhail Tyutin
> On 2/15/23 18:17, Mikhail Tyutin wrote: > > ping > > > > patchew link: > > https://patchew.org/QEMU/7d17f0cbb5ed4c90bbadd39924290...@yadro.com/ > > > > 10.02.2023 18:24, Mikhail Tyutin wrote: > >> This patch adds new function qemu_plugi

Re: [PATCH] Adding ability to change disassembler syntax in TCG plugins

2023-02-15 Thread Mikhail Tyutin
ping patchew link: https://patchew.org/QEMU/7d17f0cbb5ed4c90bbadd39924290...@yadro.com/ 10.02.2023 18:24, Mikhail Tyutin wrote: This patch adds new function qemu_plugin_insn_disas_with_syntax() that allows TCG plugins to get disassembler string with non-default syntax if it wants to. Signed

[PATCH] Adding ability to change disassembler syntax in TCG plugins

2023-02-10 Thread Mikhail Tyutin
This patch adds new function qemu_plugin_insn_disas_with_syntax() that allows TCG plugins to get disassembler string with non-default syntax if it wants to. Signed-off-by: Mikhail Tyutin --- contrib/plugins/execlog.c| 2 +- disas.c | 4 +++- disas/capstone.c