kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Exposing host debug capabilities to userspace
@ 2014-11-20 16:55 Alex Bennée
  2014-11-21 10:08 ` Christoffer Dall
       [not found] ` <87egssn91o.fsf@zen.linaro.local.i-did-not-set--mail-host-address--so-tickle-me>
  0 siblings, 2 replies; 26+ messages in thread
From: Alex Bennée @ 2014-11-20 16:55 UTC (permalink / raw)
  To: Will Deacon, Marc Zyngier, Christoffer Dall, Peter Maydell,
	Paolo Bonzini
  Cc: kvmarm, KVM devel mailing list

Hi,

I've almost finished the ARMv8 guest debug support but I have one
problem left to solve. userspace needs to know how many hardware debug
registers are available for GDB to use. This information is available
from the ID_AA64DFR0_EL1 register. Currently I abuse GET_ONE_REG to
fetch it's value however semantically this is poor as it's API is for
getting guest state not host state and they could theoretically have
different values.

So far the options I've examined are:

* KVM ioctl GET_ONE_REG(ID_AA64DFR0_EL1)

As explained above, abusing a guest state API for host configuration.

* ptrace(PTRACE_GETREGSET, NT_ARM_HW_WATCH)

This is used by GDB to access the host details in debug-monitors.
However the ptrace API really wants you to attach to a process before
calling PTRACE_GETREGSET. Currently I've tried attaching to the
thread_id of the vCPU but this fails with EPERM, I suspect because
attaching to your own threads likely upsets the kernel.

* KVM ioctl KVM_GET_DEBUGREGS

This is currently x86 only and looks like it's more aimed at debug
registers than capability stuff. Also I'm not sure what the state of
this ioctl is compared to KVM_SET_GUEST_DEBUG. Do these APIs overlap or
is one an older deprecated x86 only API?

* Export the information via sysfs

I suppose the correct canonical non-subsystem specific way to make this
information available it to expose the data in some sort of sysfs node?
However I don't see any existing sysfs structure for the CPU.

* Expand /proc/cpuinfo

I suspect adding extra text to be badly parsed by userspace is just
horrid and unacceptable behaviour ;-)

* Add another KVM ioctl?

This would have the downside of being specific to KVM and of course
proliferating the API space again.

I'm open to any suggestions and look forward to your valued feedback ;-)

-- 
Alex Bennée

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2014-11-26 12:24 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-20 16:55 Exposing host debug capabilities to userspace Alex Bennée
2014-11-21 10:08 ` Christoffer Dall
2014-11-21 10:29   ` Alex Bennée
2014-11-21 11:23   ` Alex Bennée
     [not found] ` <87egssn91o.fsf@zen.linaro.local.i-did-not-set--mail-host-address--so-tickle-me>
2014-11-24 11:21   ` Peter Maydell
2014-11-24 12:20     ` Christoffer Dall
2014-11-24 11:35   ` Alex Bennée
2014-11-24 12:26     ` Alexander Graf
2014-11-24 12:32       ` Peter Maydell
2014-11-24 12:41         ` Alexander Graf
2014-11-24 12:44           ` Peter Maydell
2014-11-24 12:51             ` Alexander Graf
2014-11-24 12:53               ` Christoffer Dall
2014-11-24 12:56                 ` Alexander Graf
2014-11-24 13:10                   ` Christoffer Dall
2014-11-24 14:07                     ` Alexander Graf
2014-11-24 14:52                       ` Christoffer Dall
2014-11-25 16:44                         ` Paolo Bonzini
2014-11-24 12:53           ` Alex Bennée
2014-11-24 12:54             ` Christoffer Dall
2014-11-24 13:59     ` Alex Bennée
2014-11-25 16:21       ` Paolo Bonzini
2014-11-25 16:35         ` Alexander Graf
2014-11-25 16:50           ` Paolo Bonzini
2014-11-26 12:11             ` Alex Bennée
2014-11-26 12:23             ` Peter Maydell

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).