[RFC PATCH 0/4] target/riscv/kvm: QEMU support for KVM Guest Debug on RISC-V

Chao Du posted 4 patches 11 months, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20231221094923.7349-1-duchao@eswincomputing.com
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>, Cornelia Huck <cohuck@redhat.com>, Peter Maydell <peter.maydell@linaro.org>, Marcelo Tosatti <mtosatti@redhat.com>, Huacai Chen <chenhuacai@kernel.org>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Aurelien Jarno <aurelien@aurel32.net>, Jiaxun Yang <jiaxun.yang@flygoat.com>, Aleksandar Rikalo <aleksandar.rikalo@syrmia.com>, Nicholas Piggin <npiggin@gmail.com>, Daniel Henrique Barboza <danielhb413@gmail.com>, "Cédric Le Goater" <clg@kaod.org>, Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <alistair.francis@wdc.com>, Bin Meng <bin.meng@windriver.com>, Weiwei Li <liwei1518@gmail.com>, Liu Zhiwei <zhiwei_liu@linux.alibaba.com>, Halil Pasic <pasic@linux.ibm.com>, Christian Borntraeger <borntraeger@linux.ibm.com>, Thomas Huth <thuth@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, David Hildenbrand <david@redhat.com>, Ilya Leoshkevich <iii@linux.ibm.com>
There is a newer version of this series
accel/kvm/kvm-all.c           |   8 +--
include/sysemu/kvm.h          |   6 +-
linux-headers/asm-riscv/kvm.h |   1 +
target/arm/kvm64.c            |   6 +-
target/i386/kvm/kvm.c         |   6 +-
target/mips/kvm.c             |   6 +-
target/ppc/kvm.c              |   6 +-
target/riscv/kvm/kvm-cpu.c    | 101 ++++++++++++++++++++++++++++++++++
target/s390x/kvm/kvm.c        |   6 +-
9 files changed, 130 insertions(+), 16 deletions(-)
[RFC PATCH 0/4] target/riscv/kvm: QEMU support for KVM Guest Debug on RISC-V
Posted by Chao Du 11 months, 1 week ago
This series implements QEMU KVM Guest Debug on RISC-V. Currently, we can
debug RISC-V KVM guest from the host side, with software breakpoints.

A brief test was done on QEMU RISC-V hypervisor emulator.

A TODO list which will be added later:
1. HW breakpoints support
2. Test cases

This series is based on QEMU 8.2.0-rc4 and is also available at:
https://github.com/Du-Chao/qemu/tree/riscv_gd_sw

This is dependent on KVM side changes:
https://github.com/Du-Chao/linux/tree/riscv_gd_sw

Chao Du (4):
  target/riscv/kvm: add software breakpoints support
  target/riscv/kvm: implement kvm_arch_update_guest_debug()
  target/riscv/kvm: handle the exit with debug reason
  linux-headers: enable KVM GUEST DEBUG for RISC-V

 accel/kvm/kvm-all.c           |   8 +--
 include/sysemu/kvm.h          |   6 +-
 linux-headers/asm-riscv/kvm.h |   1 +
 target/arm/kvm64.c            |   6 +-
 target/i386/kvm/kvm.c         |   6 +-
 target/mips/kvm.c             |   6 +-
 target/ppc/kvm.c              |   6 +-
 target/riscv/kvm/kvm-cpu.c    | 101 ++++++++++++++++++++++++++++++++++
 target/s390x/kvm/kvm.c        |   6 +-
 9 files changed, 130 insertions(+), 16 deletions(-)

--
2.17.1
Re: [RFC PATCH 0/4] target/riscv/kvm: QEMU support for KVM Guest Debug on RISC-V
Posted by Daniel Henrique Barboza 11 months, 1 week ago
Hi,

It seems that we still need the kernel KVM side to be sorted out first [1],
so I believe we should wait a bit until we can review this RFC. Otherwise we
might risk reviewing something that has to be changed later.


[1] https://lore.kernel.org/kvm/20231221095002.7404-1-duchao@eswincomputing.com/


Thanks,

Daniel

On 12/21/23 06:49, Chao Du wrote:
> This series implements QEMU KVM Guest Debug on RISC-V. Currently, we can
> debug RISC-V KVM guest from the host side, with software breakpoints.
> 
> A brief test was done on QEMU RISC-V hypervisor emulator.
> 
> A TODO list which will be added later:
> 1. HW breakpoints support
> 2. Test cases
> 
> This series is based on QEMU 8.2.0-rc4 and is also available at:
> https://github.com/Du-Chao/qemu/tree/riscv_gd_sw
> 
> This is dependent on KVM side changes:
> https://github.com/Du-Chao/linux/tree/riscv_gd_sw
> 
> Chao Du (4):
>    target/riscv/kvm: add software breakpoints support
>    target/riscv/kvm: implement kvm_arch_update_guest_debug()
>    target/riscv/kvm: handle the exit with debug reason
>    linux-headers: enable KVM GUEST DEBUG for RISC-V
> 
>   accel/kvm/kvm-all.c           |   8 +--
>   include/sysemu/kvm.h          |   6 +-
>   linux-headers/asm-riscv/kvm.h |   1 +
>   target/arm/kvm64.c            |   6 +-
>   target/i386/kvm/kvm.c         |   6 +-
>   target/mips/kvm.c             |   6 +-
>   target/ppc/kvm.c              |   6 +-
>   target/riscv/kvm/kvm-cpu.c    | 101 ++++++++++++++++++++++++++++++++++
>   target/s390x/kvm/kvm.c        |   6 +-
>   9 files changed, 130 insertions(+), 16 deletions(-)
> 
> --
> 2.17.1
>
Re: [RFC PATCH 0/4] target/riscv/kvm: QEMU support for KVM Guest Debug on RISC-V
Posted by Chao Du 7 months, 3 weeks ago
Hi Daniel and all,

The KVM patches have been reviewd and are in the queue.
https://lore.kernel.org/all/20240402062628.5425-1-duchao@eswincomputing.com/

Could you please review in the QEMU side ?
Then I will rebase this series with your comments.

Some Notes:
1. As the first stage, only the software breakpoints is implemented.
2. A 'corner case' in which the debug exception is not inserted by the
debugger, need to be re-injected to the guest. This is not handled yet
in this series.

Thanks,
Chao


On 2023-12-22 22:16, Daniel Henrique Barboza <dbarboza@ventanamicro.com> wrote:
> 
> Hi,
> 
> It seems that we still need the kernel KVM side to be sorted out first [1],
> so I believe we should wait a bit until we can review this RFC. Otherwise we
> might risk reviewing something that has to be changed later.
> 
> 
> [1] https://lore.kernel.org/kvm/20231221095002.7404-1-duchao@eswincomputing.com/
> 
> 
> Thanks,
> 
> Daniel
> 
> On 12/21/23 06:49, Chao Du wrote:
> > This series implements QEMU KVM Guest Debug on RISC-V. Currently, we can
> > debug RISC-V KVM guest from the host side, with software breakpoints.
> > 
> > A brief test was done on QEMU RISC-V hypervisor emulator.
> > 
> > A TODO list which will be added later:
> > 1. HW breakpoints support
> > 2. Test cases
> > 
> > This series is based on QEMU 8.2.0-rc4 and is also available at:
> > https://github.com/Du-Chao/qemu/tree/riscv_gd_sw
> > 
> > This is dependent on KVM side changes:
> > https://github.com/Du-Chao/linux/tree/riscv_gd_sw
> > 
> > Chao Du (4):
> >    target/riscv/kvm: add software breakpoints support
> >    target/riscv/kvm: implement kvm_arch_update_guest_debug()
> >    target/riscv/kvm: handle the exit with debug reason
> >    linux-headers: enable KVM GUEST DEBUG for RISC-V
> > 
> >   accel/kvm/kvm-all.c           |   8 +--
> >   include/sysemu/kvm.h          |   6 +-
> >   linux-headers/asm-riscv/kvm.h |   1 +
> >   target/arm/kvm64.c            |   6 +-
> >   target/i386/kvm/kvm.c         |   6 +-
> >   target/mips/kvm.c             |   6 +-
> >   target/ppc/kvm.c              |   6 +-
> >   target/riscv/kvm/kvm-cpu.c    | 101 ++++++++++++++++++++++++++++++++++
> >   target/s390x/kvm/kvm.c        |   6 +-
> >   9 files changed, 130 insertions(+), 16 deletions(-)
> > 
> > --
> > 2.17.1
> > 
Re: [RFC PATCH 0/4] target/riscv/kvm: QEMU support for KVM Guest Debug on RISC-V
Posted by Daniel Henrique Barboza 7 months, 2 weeks ago

On 4/9/24 06:43, Chao Du wrote:
> Hi Daniel and all,
> 
> The KVM patches have been reviewd and are in the queue.
> https://lore.kernel.org/all/20240402062628.5425-1-duchao@eswincomputing.com/
> 
> Could you please review in the QEMU side ?
> Then I will rebase this series with your comments.
> 
> Some Notes:
> 1. As the first stage, only the software breakpoints is implemented.
> 2. A 'corner case' in which the debug exception is not inserted by the
> debugger, need to be re-injected to the guest. This is not handled yet
> in this series.

Aside from the comments I made in patch 1 w.r.t checks that (perhaps) can be moved
to kvm-all.c, it looks good to me.

Since you're changing kvm-all.c we'll need Paolo to ack the changes in patch 1, so
feel free to wait for him to take a look before sending v2.


Thanks,


Daniel

> 
> Thanks,
> Chao
> 
> 
> On 2023-12-22 22:16, Daniel Henrique Barboza <dbarboza@ventanamicro.com> wrote:
>>
>> Hi,
>>
>> It seems that we still need the kernel KVM side to be sorted out first [1],
>> so I believe we should wait a bit until we can review this RFC. Otherwise we
>> might risk reviewing something that has to be changed later.
>>
>>
>> [1] https://lore.kernel.org/kvm/20231221095002.7404-1-duchao@eswincomputing.com/
>>
>>
>> Thanks,
>>
>> Daniel
>>
>> On 12/21/23 06:49, Chao Du wrote:
>>> This series implements QEMU KVM Guest Debug on RISC-V. Currently, we can
>>> debug RISC-V KVM guest from the host side, with software breakpoints.
>>>
>>> A brief test was done on QEMU RISC-V hypervisor emulator.
>>>
>>> A TODO list which will be added later:
>>> 1. HW breakpoints support
>>> 2. Test cases
>>>
>>> This series is based on QEMU 8.2.0-rc4 and is also available at:
>>> https://github.com/Du-Chao/qemu/tree/riscv_gd_sw
>>>
>>> This is dependent on KVM side changes:
>>> https://github.com/Du-Chao/linux/tree/riscv_gd_sw
>>>
>>> Chao Du (4):
>>>     target/riscv/kvm: add software breakpoints support
>>>     target/riscv/kvm: implement kvm_arch_update_guest_debug()
>>>     target/riscv/kvm: handle the exit with debug reason
>>>     linux-headers: enable KVM GUEST DEBUG for RISC-V
>>>
>>>    accel/kvm/kvm-all.c           |   8 +--
>>>    include/sysemu/kvm.h          |   6 +-
>>>    linux-headers/asm-riscv/kvm.h |   1 +
>>>    target/arm/kvm64.c            |   6 +-
>>>    target/i386/kvm/kvm.c         |   6 +-
>>>    target/mips/kvm.c             |   6 +-
>>>    target/ppc/kvm.c              |   6 +-
>>>    target/riscv/kvm/kvm-cpu.c    | 101 ++++++++++++++++++++++++++++++++++
>>>    target/s390x/kvm/kvm.c        |   6 +-
>>>    9 files changed, 130 insertions(+), 16 deletions(-)
>>>
>>> --
>>> 2.17.1
>>>
Re: [RFC PATCH 0/4] target/riscv/kvm: QEMU support for KVM Guest Debug on RISC-V
Posted by Chao Du 6 months, 1 week ago
Hi Paolo,

As Daniel suggested, could you please take a look at this series ?

Thanks,
Chao

On 2024-04-16 17:25, Daniel Henrique Barboza <dbarboza@ventanamicro.com> wrote:
> 
> On 4/9/24 06:43, Chao Du wrote:
> > Hi Daniel and all,
> > 
> > The KVM patches have been reviewd and are in the queue.
> > https://lore.kernel.org/all/20240402062628.5425-1-duchao@eswincomputing.com/
> > 
> > Could you please review in the QEMU side ?
> > Then I will rebase this series with your comments.
> > 
> > Some Notes:
> > 1. As the first stage, only the software breakpoints is implemented.
> > 2. A 'corner case' in which the debug exception is not inserted by the
> > debugger, need to be re-injected to the guest. This is not handled yet
> > in this series.
> 
> Aside from the comments I made in patch 1 w.r.t checks that (perhaps) can be moved
> to kvm-all.c, it looks good to me.
> 
> Since you're changing kvm-all.c we'll need Paolo to ack the changes in patch 1, so
> feel free to wait for him to take a look before sending v2.
> 
> 
> Thanks,
> 
> 
> Daniel
> 
> > 
> > Thanks,
> > Chao
> > 
> > 
> > On 2023-12-22 22:16, Daniel Henrique Barboza <dbarboza@ventanamicro.com> wrote:
> >>
> >> Hi,
> >>
> >> It seems that we still need the kernel KVM side to be sorted out first [1],
> >> so I believe we should wait a bit until we can review this RFC. Otherwise we
> >> might risk reviewing something that has to be changed later.
> >>
> >>
> >> [1] https://lore.kernel.org/kvm/20231221095002.7404-1-duchao@eswincomputing.com/
> >>
> >>
> >> Thanks,
> >>
> >> Daniel
> >>
> >> On 12/21/23 06:49, Chao Du wrote:
> >>> This series implements QEMU KVM Guest Debug on RISC-V. Currently, we can
> >>> debug RISC-V KVM guest from the host side, with software breakpoints.
> >>>
> >>> A brief test was done on QEMU RISC-V hypervisor emulator.
> >>>
> >>> A TODO list which will be added later:
> >>> 1. HW breakpoints support
> >>> 2. Test cases
> >>>
> >>> This series is based on QEMU 8.2.0-rc4 and is also available at:
> >>> https://github.com/Du-Chao/qemu/tree/riscv_gd_sw
> >>>
> >>> This is dependent on KVM side changes:
> >>> https://github.com/Du-Chao/linux/tree/riscv_gd_sw
> >>>
> >>> Chao Du (4):
> >>>     target/riscv/kvm: add software breakpoints support
> >>>     target/riscv/kvm: implement kvm_arch_update_guest_debug()
> >>>     target/riscv/kvm: handle the exit with debug reason
> >>>     linux-headers: enable KVM GUEST DEBUG for RISC-V
> >>>
> >>>    accel/kvm/kvm-all.c           |   8 +--
> >>>    include/sysemu/kvm.h          |   6 +-
> >>>    linux-headers/asm-riscv/kvm.h |   1 +
> >>>    target/arm/kvm64.c            |   6 +-
> >>>    target/i386/kvm/kvm.c         |   6 +-
> >>>    target/mips/kvm.c             |   6 +-
> >>>    target/ppc/kvm.c              |   6 +-
> >>>    target/riscv/kvm/kvm-cpu.c    | 101 ++++++++++++++++++++++++++++++++++
> >>>    target/s390x/kvm/kvm.c        |   6 +-
> >>>    9 files changed, 130 insertions(+), 16 deletions(-)
> >>>
> >>> --
> >>> 2.17.1
> >>>
Re: [RFC PATCH 0/4] target/riscv/kvm: QEMU support for KVM Guest Debug on RISC-V
Posted by Chao Du 7 months, 2 weeks ago
Gentle ping...

On 2024-04-09 17:43, Chao Du <duchao@eswincomputing.com> wrote:
> 
> Hi Daniel and all,
> 
> The KVM patches have been reviewd and are in the queue.
> https://lore.kernel.org/all/20240402062628.5425-1-duchao@eswincomputing.com/
> 
> Could you please review in the QEMU side ?
> Then I will rebase this series with your comments.
> 
> Some Notes:
> 1. As the first stage, only the software breakpoints is implemented.
> 2. A 'corner case' in which the debug exception is not inserted by the
> debugger, need to be re-injected to the guest. This is not handled yet
> in this series.
> 
> Thanks,
> Chao
> 
> 
> On 2023-12-22 22:16, Daniel Henrique Barboza <dbarboza@ventanamicro.com> wrote:
> > 
> > Hi,
> > 
> > It seems that we still need the kernel KVM side to be sorted out first [1],
> > so I believe we should wait a bit until we can review this RFC. Otherwise we
> > might risk reviewing something that has to be changed later.
> > 
> > 
> > [1] https://lore.kernel.org/kvm/20231221095002.7404-1-duchao@eswincomputing.com/
> > 
> > 
> > Thanks,
> > 
> > Daniel
> > 
> > On 12/21/23 06:49, Chao Du wrote:
> > > This series implements QEMU KVM Guest Debug on RISC-V. Currently, we can
> > > debug RISC-V KVM guest from the host side, with software breakpoints.
> > > 
> > > A brief test was done on QEMU RISC-V hypervisor emulator.
> > > 
> > > A TODO list which will be added later:
> > > 1. HW breakpoints support
> > > 2. Test cases
> > > 
> > > This series is based on QEMU 8.2.0-rc4 and is also available at:
> > > https://github.com/Du-Chao/qemu/tree/riscv_gd_sw
> > > 
> > > This is dependent on KVM side changes:
> > > https://github.com/Du-Chao/linux/tree/riscv_gd_sw
> > > 
> > > Chao Du (4):
> > >    target/riscv/kvm: add software breakpoints support
> > >    target/riscv/kvm: implement kvm_arch_update_guest_debug()
> > >    target/riscv/kvm: handle the exit with debug reason
> > >    linux-headers: enable KVM GUEST DEBUG for RISC-V
> > > 
> > >   accel/kvm/kvm-all.c           |   8 +--
> > >   include/sysemu/kvm.h          |   6 +-
> > >   linux-headers/asm-riscv/kvm.h |   1 +
> > >   target/arm/kvm64.c            |   6 +-
> > >   target/i386/kvm/kvm.c         |   6 +-
> > >   target/mips/kvm.c             |   6 +-
> > >   target/ppc/kvm.c              |   6 +-
> > >   target/riscv/kvm/kvm-cpu.c    | 101 ++++++++++++++++++++++++++++++++++
> > >   target/s390x/kvm/kvm.c        |   6 +-
> > >   9 files changed, 130 insertions(+), 16 deletions(-)
> > > 
> > > --
> > > 2.17.1
> > >