From: David Gibson <david@gibson.dropbear.id.au>
To: Fabiano Rosas <farosas@linux.ibm.com>
Cc: qemu-devel@nongnu.org, philmd@redhat.com,
Paolo Bonzini <pbonzini@redhat.com>,
Peter Crosthwaite <crosthwaite.peter@gmail.com>,
Richard Henderson <rth@twiddle.net>,
Peter Maydell <peter.maydell@linaro.org>,
Marcelo Tosatti <mtosatti@redhat.com>,
Eduardo Habkost <ehabkost@redhat.com>,
James Hogan <jhogan@kernel.org>,
Aurelien Jarno <aurelien@aurel32.net>,
Aleksandar Markovic <amarkovic@wavecomp.com>,
Christian Borntraeger <borntraeger@de.ibm.com>,
Cornelia Huck <cohuck@redhat.com>,
David Hildenbrand <david@redhat.com>
Subject: Re: [Qemu-devel] [RFC PATCH v2 2/3] kvm-all: Introduce kvm_set_singlestep
Date: Sun, 25 Nov 2018 18:54:03 +1100 [thread overview]
Message-ID: <20181125075403.GC2251@umbus.fritz.box> (raw)
In-Reply-To: <20181121181347.24035-3-farosas@linux.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 5592 bytes --]
On Wed, Nov 21, 2018 at 04:13:46PM -0200, Fabiano Rosas wrote:
> This will be used in a future patch to implement an
> architecture-specific single step mechanism for POWER.
>
> Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
> ---
> accel/kvm/kvm-all.c | 10 ++++++++++
> exec.c | 1 +
> include/sysemu/kvm.h | 4 ++++
> target/arm/kvm.c | 4 ++++
> target/i386/kvm.c | 4 ++++
> target/mips/kvm.c | 4 ++++
> target/ppc/kvm.c | 4 ++++
> target/s390x/kvm.c | 4 ++++
> 8 files changed, 35 insertions(+)
>
> diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
> index 4880a05399..4fb7199a15 100644
> --- a/accel/kvm/kvm-all.c
> +++ b/accel/kvm/kvm-all.c
> @@ -2313,6 +2313,11 @@ int kvm_update_guest_debug(CPUState *cpu, unsigned long reinject_trap)
> return data.err;
> }
>
> +void kvm_set_singlestep(CPUState *cs, int enabled)
> +{
> + kvm_arch_set_singlestep(cs, enabled);
> +}
> +
> int kvm_insert_breakpoint(CPUState *cpu, target_ulong addr,
> target_ulong len, int type)
> {
> @@ -2439,6 +2444,11 @@ int kvm_remove_breakpoint(CPUState *cpu, target_ulong addr,
> void kvm_remove_all_breakpoints(CPUState *cpu)
> {
> }
> +
> +void kvm_set_singlestep(CPUState *cs, int enabled)
> +{
> +}
You could use stubs to avoid having to put this empty implementation
in every arch.
It also seems like it might be a good idea to report an error here,
rather than having set single step silently do nothing on arches which
don't support it yet.
> #endif /* !KVM_CAP_SET_GUEST_DEBUG */
>
> static int kvm_set_signal_mask(CPUState *cpu, const sigset_t *sigset)
> diff --git a/exec.c b/exec.c
> index bb6170dbff..55614822c3 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -1233,6 +1233,7 @@ void cpu_single_step(CPUState *cpu, int enabled)
> if (cpu->singlestep_enabled != enabled) {
> cpu->singlestep_enabled = enabled;
> if (kvm_enabled()) {
> + kvm_set_singlestep(cpu, enabled);
> kvm_update_guest_debug(cpu, 0);
> } else {
> /* must flush all the translated code to avoid inconsistencies */
> diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
> index 97d8d9d0d5..a01a8d58dd 100644
> --- a/include/sysemu/kvm.h
> +++ b/include/sysemu/kvm.h
> @@ -259,6 +259,8 @@ int kvm_remove_breakpoint(CPUState *cpu, target_ulong addr,
> void kvm_remove_all_breakpoints(CPUState *cpu);
> int kvm_update_guest_debug(CPUState *cpu, unsigned long reinject_trap);
>
> +void kvm_set_singlestep(CPUState *cpu, int enabled);
> +
> int kvm_on_sigbus_vcpu(CPUState *cpu, int code, void *addr);
> int kvm_on_sigbus(int code, void *addr);
>
> @@ -431,6 +433,8 @@ void kvm_arch_remove_all_hw_breakpoints(void);
>
> void kvm_arch_update_guest_debug(CPUState *cpu, struct kvm_guest_debug *dbg);
>
> +void kvm_arch_set_singlestep(CPUState *cpu, int enabled);
> +
> bool kvm_arch_stop_on_emulation_error(CPUState *cpu);
>
> int kvm_check_extension(KVMState *s, unsigned int extension);
> diff --git a/target/arm/kvm.c b/target/arm/kvm.c
> index 44dd0ce6ce..dd8e43ab7e 100644
> --- a/target/arm/kvm.c
> +++ b/target/arm/kvm.c
> @@ -670,6 +670,10 @@ int kvm_arch_process_async_events(CPUState *cs)
> return 0;
> }
>
> +void kvm_arch_set_singlestep(CPUState *cs, int enabled)
> +{
> +}
> +
> /* The #ifdef protections are until 32bit headers are imported and can
> * be removed once both 32 and 64 bit reach feature parity.
> */
> diff --git a/target/i386/kvm.c b/target/i386/kvm.c
> index f524e7d929..ba56f2ee1f 100644
> --- a/target/i386/kvm.c
> +++ b/target/i386/kvm.c
> @@ -3521,6 +3521,10 @@ static int kvm_handle_debug(X86CPU *cpu,
> return ret;
> }
>
> +void kvm_arch_set_singlestep(CPUState *cs, int enabled)
> +{
> +}
> +
> void kvm_arch_update_guest_debug(CPUState *cpu, struct kvm_guest_debug *dbg)
> {
> const uint8_t type_code[] = {
> diff --git a/target/mips/kvm.c b/target/mips/kvm.c
> index 8e72850962..8035262131 100644
> --- a/target/mips/kvm.c
> +++ b/target/mips/kvm.c
> @@ -119,6 +119,10 @@ int kvm_arch_remove_sw_breakpoint(CPUState *cs, struct kvm_sw_breakpoint *bp)
> return 0;
> }
>
> +void kvm_arch_set_singlestep(CPUState *cs, int enabled)
> +{
> +}
> +
> static inline int cpu_mips_io_interrupts_pending(MIPSCPU *cpu)
> {
> CPUMIPSState *env = &cpu->env;
> diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
> index f81327d6cd..9d0b4f1f3f 100644
> --- a/target/ppc/kvm.c
> +++ b/target/ppc/kvm.c
> @@ -1551,6 +1551,10 @@ void kvm_arch_remove_all_hw_breakpoints(void)
> nb_hw_breakpoint = nb_hw_watchpoint = 0;
> }
>
> +void kvm_arch_set_singlestep(CPUState *cs, int enabled)
> +{
> +}
> +
> void kvm_arch_update_guest_debug(CPUState *cs, struct kvm_guest_debug *dbg)
> {
> int n;
> diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c
> index 2ebf26adfe..4bde183458 100644
> --- a/target/s390x/kvm.c
> +++ b/target/s390x/kvm.c
> @@ -975,6 +975,10 @@ void kvm_arch_remove_all_hw_breakpoints(void)
> hw_breakpoints = NULL;
> }
>
> +void kvm_arch_set_singlestep(CPUState *cs, int enabled)
> +{
> +}
> +
> void kvm_arch_update_guest_debug(CPUState *cpu, struct kvm_guest_debug *dbg)
> {
> int i;
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2018-11-25 7:55 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-21 18:13 [Qemu-devel] [RFC PATCH v2 0/3] target/ppc: single step for KVM HV Fabiano Rosas
2018-11-21 18:13 ` [Qemu-devel] [RFC PATCH v2 1/3] target/ppc: Add macro definitions for relocated interrupt vectors offsets Fabiano Rosas
2018-11-22 13:22 ` David Gibson
2018-11-22 18:10 ` Fabiano Rosas
2018-11-21 18:13 ` [Qemu-devel] [RFC PATCH v2 2/3] kvm-all: Introduce kvm_set_singlestep Fabiano Rosas
2018-11-21 18:40 ` Philippe Mathieu-Daudé
2018-11-23 8:57 ` Cornelia Huck
2018-11-25 7:54 ` David Gibson [this message]
2018-11-21 18:13 ` [Qemu-devel] [RFC PATCH v2 3/3] target/ppc: support single stepping with KVM HV Fabiano Rosas
2018-11-26 7:41 ` David Gibson
2018-11-30 20:46 ` Fabiano Rosas
2018-12-02 9:13 ` David Gibson
2018-12-10 12:52 ` Fabiano Rosas
2018-12-11 1:20 ` David Gibson
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=20181125075403.GC2251@umbus.fritz.box \
--to=david@gibson.dropbear.id.au \
--cc=amarkovic@wavecomp.com \
--cc=aurelien@aurel32.net \
--cc=borntraeger@de.ibm.com \
--cc=cohuck@redhat.com \
--cc=crosthwaite.peter@gmail.com \
--cc=david@redhat.com \
--cc=ehabkost@redhat.com \
--cc=farosas@linux.ibm.com \
--cc=jhogan@kernel.org \
--cc=mtosatti@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).