From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH RFC] make error codes a formal part of the ABI Date: Wed, 14 Jan 2015 11:37:09 +0000 Message-ID: <54B654E5.8010508@citrix.com> References: <54B5540A02000078000547D4@mail.emea.novell.com> <1421166952.19103.148.camel@eu.citrix.com> <54B63AE60200007800054A1E@mail.emea.novell.com> <1421231291.19103.192.camel@eu.citrix.com> <54B64A79.3010805@linaro.org> <1421234663.19103.218.camel@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YBMGA-0002tv-QN for xen-devel@lists.xenproject.org; Wed, 14 Jan 2015 11:37:14 +0000 In-Reply-To: <1421234663.19103.218.camel@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell , Julien Grall Cc: Keir Fraser , Stefano Stabellini , Tim Deegan , Ian Jackson , Jan Beulich , xen-devel , =?UTF-8?B?Um9nZXIgUGF1IE1vbm7DqQ==?= List-Id: xen-devel@lists.xenproject.org On 14/01/15 11:24, Ian Campbell wrote: > On Wed, 2015-01-14 at 10:52 +0000, Julien Grall wrote: >> Hi Ian, >> >> On 14/01/2015 10:28, Ian Campbell wrote: >>>>> (I suppose someone needs to patch libxc et al to actually use this) >>>> The primary consumer, as said in the description, is meant to be >>>> hvmloader. But yes, other tools parts may also want to follow >>>> that. >>> /me wonders how libxc has been getting away with out this until now, >>> especially on non-Linux platforms. >> On FreeBSD, we translate the XEN errno to the guest one in the privcmd >> drivers. > Ah, I looked in tools/libxc/*bsd* but didn't think to look in the kernel > itself. > >> See >> http://xenbits.xen.org/gitweb/?p=people/royger/freebsd.git;a=patch;h=f09eeed01bc884b37e978f6ec6e3e7a86778ef4b > OK, so essentially the requirement is that libxc should see the guest's > own ERRNO numbers and changing libxc to use xen's numbers would just be > wrong. > > Which is good, because making that change would be a nightmare! It is not so simple. Currently, the hypercall ioctl overloads errno from both the kernel and Xen. This makes it impossible for libxc to programmaticly distinguish an kernel error from a Xen error (e.g. where did an EFAULT come from). Ideally, the correct solution would be for the ioctl to return -1/errno for a kernel failure alone, and then have the top level stub inspect args[0] for the Xen error. This would require libxc to know about both the local errnos and Xen errnos. ~Andrew