Skip to contentSkip to conversation

valgrind: Support for ioctls used by Xen toolstack processes.

PATCH Bart Van Assche 2 participants 3 messages Sep 7, 2012 – Oct 8, 2012 2 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 9 lines · Ian Campbell

One issue is that the hypercalls which are exlusively used by the toolstacks (as opposed to those used by guest operating systems) are not considered a stable ABI, since the hypervisor and the lowlevel tools are considered a matched pair. This covers the sysctl and domctl hypercalls which are a fairly large chunk of the support here. I'm not sure how to solve this without invoking a massive amount of duplication. Right now this targets the Xen unstable interface (which will shortly be released as Xen 4.2), perhaps I can get away with deferring this problem until the first change ;-).

Does this mean the Xen interface is not backwards compatible ? If so, are you sure you want to add support for an unstable API in Valgrind ?

Quoted 9 lines

There are some other wrinkles here I've not been sure how to solve:

Firstly, di_notify_mmap tries to read from the magic proc device:
--20208-- WARNING: Serious error when reading debug info --20208-- When reading debug info from /proc/xen/privcmd:
--20208-- can't read file to inspect ELF header

I've hacked around this with an explicit check for /proc/xen. Hopefully someone can point to the right solution.

The changes for avoiding reading debuginfo from /proc/xen/privcmd look fine to me.

Bart.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw
Quoted 11 lines · Bart Van Assche
Quoted 9 lines · Ian Campbell

One issue is that the hypercalls which are exlusively used by the toolstacks (as opposed to those used by guest operating systems) are not considered a stable ABI, since the hypervisor and the lowlevel tools are considered a matched pair. This covers the sysctl and domctl hypercalls which are a fairly large chunk of the support here. I'm not sure how to solve this without invoking a massive amount of duplication. Right now this targets the Xen unstable interface (which will shortly be released as Xen 4.2), perhaps I can get away with deferring this problem until the first change ;-).

Quoted 1 line

Does this mean the Xen interface is not backwards compatible ?

The hypercall interfaces used by solely by the toolstack are not stable. Xen considers the toolstack and the hypervisor to be a matched pair, the toolstack libraries are where the API stabilises.

Interfaces used by guests are stable, but those aren't terribly interesting from a valgrind PoV (or at least, running valgrind on a complete guest OS is a much bigger/very different project ;-)).

That said the non-stable interfaces are versioned, since there's a version field at a stable location in both the domctl and sysctl argument structs. In practice it is pretty rare for them to change other than adding new sub commands.

Quoted 2 lines

If so, are you sure you want to add support for an unstable API in Valgrind ?

Indeed, this was my concern.

As I say they don't change that often, and they do have a version field in a static place so when they do change it should be possible to fix valgrind to support both variants.

I'm not sure how much work that will be in practice, but I think it won't be too much. By way of some data it looks like the last incompatible change to sysctl was in November 2011 and the one before was April 2010. Likewise domctl was September 2011 and before that April 2010. Currently:

        #define XEN_DOMCTL_INTERFACE_VERSION 0x00000008
    #define XEN_SYSCTL_INTERFACE_VERSION 0x00000009

these interfaces were added with 0x1 in August 2006 so it's something like an update every 10 months or so (and I expect the rate has slowed since they were first added).

I'm willing to do the necessary legwork to keep valgrind up to date.

BTW I've already found a few bugs with this stuff, including a hypervisor issue exposed via the resultant misbehaviour of the toolstack:

        http://lists.xen.org/archives/html/xen-devel/2012-09/msg00336.html
        http://lists.xen.org/archives/html/xen-devel/2012-09/msg00331.html

(nothing major there, but I've actually had this patch sitting around for, /me looks, urk 2 years! So I have run it before and fixed a bunch of stuff then too and other folks have occasionally used the patch too)

Quoted 8 lines
Quoted 8 lines

There are some other wrinkles here I've not been sure how to solve:

Firstly, di_notify_mmap tries to read from the magic proc device:
--20208-- WARNING: Serious error when reading debug info --20208-- When reading debug info from /proc/xen/privcmd:
--20208-- can't read file to inspect ELF header

Quoted 5 lines
Quoted 2 lines

I've hacked around this with an explicit check for /proc/xen. Hopefully someone can point to the right solution.

The changes for avoiding reading debuginfo from /proc/xen/privcmd look fine to me.

Great!

Thanks,
Ian.

#4 lore raw
In reply to a message not in the archive
Quoted 3 lines · Ian Campbell

Under Xen the toolstack is responsible for managing the domains in the system, e.g. creating, destroying, and otherwise manipulating them.

Julien Grall took these patches for a spin, which resulted in the following 4 fixes/improvements. Rather than resend the mega patch I'll followup with the incremental patches.

Ian.