From: "Chao Du" <duchao@eswincomputing.com>
To: "Paolo Bonzini" <pbonzini@redhat.com>
Cc: "Daniel Henrique Barboza" <dbarboza@ventanamicro.com>,
qemu-devel@nongnu.org, qemu-riscv@nongnu.org,
alistair23@gmail.com, bin.meng@windriver.com,
liweiwei@iscas.ac.cn, zhiwei_liu@linux.alibaba.com,
palmer@dabbelt.com, anup@brainfault.org, atishp@atishpatra.org
Subject: Re: [RFC PATCH 1/4] target/riscv/kvm: add software breakpoints support
Date: Mon, 27 May 2024 10:12:03 +0800 (GMT+08:00) [thread overview]
Message-ID: <1deff797.ed0.18fb7d1ae25.Coremail.duchao@eswincomputing.com> (raw)
In-Reply-To: <CABgObfYA3Er1y3R9v0Huf3w43n7oD83UhkqdRk-oBYzyM6O_ow@mail.gmail.com>
On 2024-05-25 00:11, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> On Tue, Apr 16, 2024 at 11:23 AM Daniel Henrique Barboza
> <dbarboza@ventanamicro.com> wrote:
> > > +int kvm_arch_insert_sw_breakpoint(CPUState *cs, struct kvm_sw_breakpoint *bp,
> > > + vaddr len)
> > > +{
> > > + if (len != 4 && len != 2) {
> > > + return -EINVAL;
> > > + }
> >
> > I wonder if this verification should be moved to kvm_insert_breakpoint(). Is
> > there any known reason why other archs would use 'len' other than 2 or 4? The
> > parent function can throw the EINVAL in this case. Otherwise all callers from
> > all archs will need a similar EINVAL check.
>
> I'm not sure how len is defined in the gdb protocol, but x86 has a
> breakpoint length of 1 and an instruction length that can be any value
> between 1 and 15.
>
> Most architectures could assume that it's always one value, i.e. just
> not care about checking len in kvm_arch_insert_sw_breakpoint.
>
> The patches look good, feel free to take them through the RISC-V tree.
>
> One thing that I was wondering is: could RISC-V just use always
> c.ebreak if C instructions are supported, and ebreak if they're not?
> But if for example that would that mess up the synchronization of the
> disassembly in gdb, it's a good reason to add the len argument as you
> did here.
Yes, you are right. If we insert an ebreak instruction whose length is
different from the original one, then the disassembly in gdb may encounter
some problems.
Thanks for the review, I will rebase this series and send it out.
Chao
>
> Paolo
next prev parent reply other threads:[~2024-05-27 2:14 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-21 9:49 [RFC PATCH 0/4] target/riscv/kvm: QEMU support for KVM Guest Debug on RISC-V Chao Du
2023-12-21 9:49 ` [RFC PATCH 1/4] target/riscv/kvm: add software breakpoints support Chao Du
2024-04-16 9:23 ` Daniel Henrique Barboza
2024-04-18 9:46 ` Chao Du
2024-05-24 16:11 ` Paolo Bonzini
2024-05-27 2:12 ` Chao Du [this message]
2023-12-21 9:49 ` [RFC PATCH 2/4] target/riscv/kvm: implement kvm_arch_update_guest_debug() Chao Du
2023-12-21 9:49 ` [RFC PATCH 3/4] target/riscv/kvm: handle the exit with debug reason Chao Du
2023-12-21 9:49 ` [RFC PATCH 4/4] linux-headers: enable KVM GUEST DEBUG for RISC-V Chao Du
2023-12-22 14:16 ` [RFC PATCH 0/4] target/riscv/kvm: QEMU support for KVM Guest Debug on RISC-V Daniel Henrique Barboza
2024-04-09 9:43 ` Chao Du
2024-04-15 1:47 ` Chao Du
2024-04-16 9:25 ` Daniel Henrique Barboza
2024-05-20 10:22 ` Chao Du
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1deff797.ed0.18fb7d1ae25.Coremail.duchao@eswincomputing.com \
--to=duchao@eswincomputing.com \
--cc=alistair23@gmail.com \
--cc=anup@brainfault.org \
--cc=atishp@atishpatra.org \
--cc=bin.meng@windriver.com \
--cc=dbarboza@ventanamicro.com \
--cc=liweiwei@iscas.ac.cn \
--cc=palmer@dabbelt.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=zhiwei_liu@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.