Ian Campbell
2012-Sep-07 10:21 UTC
Re: [Valgrind-developers] [PATCH] valgrind: Support for ioctls used by Xen toolstack processes.
On Fri, 2012-09-07 at 10:23 +0100, Bart Van Assche wrote:> On 09/04/12 18:20, Ian Campbell wrote: > > 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 ?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.> 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)> > > 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.Great! Thanks, Ian.