qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <dahi@linux.vnet.ibm.com>
To: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>,
	Jens Freimann <jfrei@linux.vnet.ibm.com>,
	Alexander Graf <agraf@suse.de>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 4/4] s390x/kvm: hw debugging support via guest PER facility
Date: Wed, 4 Jun 2014 10:31:35 +0200	[thread overview]
Message-ID: <20140604103135.080d2269@thinkpad-w530> (raw)
In-Reply-To: <53884B77.8020206@de.ibm.com>

> On 30/05/14 11:01, Alexander Graf wrote:
> > 
> > On 30.05.14 10:57, Christian Borntraeger wrote:
> >> On 30/05/14 10:32, Alexander Graf wrote:
> >>
> >>>> +    case KVM_HW_BP:
> >>>> +        if (find_hw_breakpoint(arch_info->addr, -1, arch_info->type)) {
> >>>> +            ret = EXCP_DEBUG;
> >>>> +        }
> >>>> +        break;
> >>>> +    case KVM_SINGLESTEP:
> >>>> +        if (cs->singlestep_enabled) {
> >>>> +            ret = EXCP_DEBUG;
> >>>> +        }
> >>>> +        break;
> >>>> +    default:
> >>>> +        ret = -ENOSYS;
> >>>> +    }
> >>>> +
> >>>> +    return ret;
> >>> What happens to the diag 501 now? Are we safe to just drop it?
> >> There can only be a small number of HW breakpoints (basically only one from-to range on s390).
> >> So gdb can (and will) use both (hbreak vs. break)
> > 
> > Ah, let me explain what I'm referring to here. On x86 (and PPC, though the patches are still missing), we use a generic "breakpoint" instruction for sw breakpoints. The specific breakpoint interrupt generated by that instruction traps into KVM which forwards it to QEMU.
> > 
> > If QEMU now detects that it didn't put the breakpoint into place, it assumes that it's the guest that wanted the breakpoint to happen, so it deflects a breakpoint interrupt into the guest.
> > 
> > My question here is whether we need something similar on s390x. With DIAG, I think we're safe, as the guest can't expect that one to do anything useful, but if we want to switch to a 2-byte breakpoint instruction instead, it might make sense to implement the deflection mechanism.
> 
> Oh, I though "What happens to the diag 501 now? Are we safe to just drop it?" was a question if we can get rid of the code.
> Regarding deflection, yes if guest and host hardware breakpoints (PER) we need to handle that (The host kernel is doing that in filter_guest_per_event)
> With software breakpoints: yes diag501 is safe to use. When we change the instruction later on then we have to see if we need deflection (could be).
> 
> Christian

Hi Alex,

I am already working on a solution for 2 byte software breakpoints.
The solution will most likely look like what we have on x86: A generic
breakpoint instruction (e.g. invalid opcode 0x0001) that is filtered in
QEMU. We'll need kernel support to allow invalid instructions to be
intercepted and handled in QEMU. I already have a prototype running.

David

  parent reply	other threads:[~2014-06-04  8:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-12 12:15 [Qemu-devel] [PATCH 0/4] (internal review) s390x/kvm: guest debugging support Jens Freimann
2014-05-12 12:15 ` [Qemu-devel] [PATCH 1/4] linux-headers: update Jens Freimann
2014-05-12 12:15 ` [Qemu-devel] [PATCH 2/4] s390x: remove duplicate definitions of DIAG 501 Jens Freimann
2014-05-12 12:15 ` [Qemu-devel] [PATCH 3/4] s390x/kvm: software breakpoint support Jens Freimann
2014-05-12 12:15 ` [Qemu-devel] [PATCH 4/4] s390x/kvm: hw debugging support via guest PER facility Jens Freimann
     [not found]   ` <53884206.8090502@suse.de>
     [not found]     ` <538847E4.5020101@de.ibm.com>
     [not found]       ` <538848D9.7010907@suse.de>
     [not found]         ` <53884B77.8020206@de.ibm.com>
2014-06-04  8:31           ` David Hildenbrand [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-05-12 12:58 [Qemu-devel] [PATCH 0/4] s390x/kvm: guest debugging support Jens Freimann
2014-05-12 12:58 ` [Qemu-devel] [PATCH 4/4] s390x/kvm: hw debugging support via guest PER facility Jens Freimann

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=20140604103135.080d2269@thinkpad-w530 \
    --to=dahi@linux.vnet.ibm.com \
    --cc=agraf@suse.de \
    --cc=borntraeger@de.ibm.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=jfrei@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    /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).