All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Keir Fraser <keir@xen.org>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>,
	Ian Campbell <Ian.Campbell@eu.citrix.com>,
	xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH RFC] make error codes a formal part of the ABI
Date: Tue, 13 Jan 2015 16:40:11 +0000	[thread overview]
Message-ID: <54B54A6B.7040206@citrix.com> (raw)
In-Reply-To: <54B5540A02000078000547D4@mail.emea.novell.com>

On 13/01/15 16:21, Jan Beulich wrote:
> Now that we have two cases where patches against hvmloader got
> submitted needing to include the hypervisor's errno.h (for the host's
> system header not necessarily reflecting the correct numbers), take
> this as a strong sign that we need to make the error return values part
> of the hypervisor ABI (which de-fact they've always been).
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> ---
> There's on small block commented with TBD left in the public header.
> This is the main reason for the submission being RFC. While we don't
> currently use these error codes, I'm not sure if we should leave all
> or some of them out for the time being.

I would suggest that we drop any error codes not in use.  We can always
add them back in in the future if they are needed.

I would also suggest that we note the heritage, being taken from Linux
2.$mumble, which will act as a guide for introducing new codes in the
future.

Finally, I would suggest that we assign the Xen meaning (e.g. EACCES =
bad tool interface) rather than Linux meanings.

>
> --- a/xen/include/asm-arm/page.h
> +++ b/xen/include/asm-arm/page.h
> @@ -2,7 +2,6 @@
>  #define __ARM_PAGE_H__
>  
>  #include <xen/config.h>
> -#include <xen/errno.h>
>  #include <public/xen.h>
>  #include <asm/processor.h>
>  
> @@ -83,6 +82,7 @@
>  
>  #ifndef __ASSEMBLY__
>  
> +#include <xen/errno.h>
>  #include <xen/types.h>
>  #include <xen/lib.h>
>  
> --- a/xen/include/asm-x86/multicall.h
> +++ b/xen/include/asm-x86/multicall.h
> @@ -24,7 +24,7 @@
>              "    callq *%%rax; "                             \
>              "1:  movq  %%rax,%c4(%0)\n"                      \
>              ".section .fixup,\"ax\"\n"                       \
> -            "2:  movq  $-"STR(ENOSYS)",%%rax\n"              \
> +            "2:  movq  %5,%%rax\n"                           \
>              "    jmp   1b\n"                                 \
>              ".previous\n"                                    \
>              :                                                \
> @@ -32,7 +32,8 @@
>                "i" (offsetof(__typeof__(*_call), op)),        \
>                "i" (offsetof(__typeof__(*_call), args)),      \
>                "i" (sizeof(*(_call)->args)),                  \
> -              "i" (offsetof(__typeof__(*_call), result))     \
> +              "i" (offsetof(__typeof__(*_call), result)),    \
> +              "i" (-ENOSYS)                                  \
>                /* all the caller-saves registers */           \
>              : "rax", "rcx", "rdx", "rsi", "rdi",             \
>                "r8",  "r9",  "r10", "r11" );                  \
> @@ -54,7 +55,7 @@
>              "    callq *%%rax; "                             \
>              "1:  movl  %%eax,%c4(%0)\n"                      \
>              ".section .fixup,\"ax\"\n"                       \
> -            "2:  movl  $-"STR(ENOSYS)",%%eax\n"              \
> +            "2:  movl  %5,%%eax\n"                           \
>              "    jmp   1b\n"                                 \
>              ".previous\n"                                    \
>              :                                                \
> @@ -62,7 +63,8 @@
>                "i" (offsetof(__typeof__(*_call), op)),        \
>                "i" (offsetof(__typeof__(*_call), args)),      \
>                "i" (sizeof(*(_call)->args)),                  \
> -              "i" (offsetof(__typeof__(*_call), result))     \
> +              "i" (offsetof(__typeof__(*_call), result)),    \
> +              "i" (-ENOSYS)                                  \
>                /* all the caller-saves registers */           \
>              : "rax", "rcx", "rdx", "rsi", "rdi",             \
>                "r8",  "r9",  "r10", "r11" )                   \
> --- /dev/null
> +++ b/xen/include/public/errno.h
> @@ -0,0 +1,94 @@
> +#ifndef __XEN_PUBLIC_ERRNO_H__
> +
> +#ifndef __ASSEMBLY__
> +
> +#define XEN_ERRNO(name, value) XEN_##name = value,
> +enum xen_errno {
> +
> +#else /* !__ASSEMBLY__ */
> +
> +#define XEN_ERRNO(name, value) .equ XEN_##name, value
> +
> +#endif /* __ASSEMBLY__ */
> +
> +/* ` enum neg_errnoval {  [ -Efoo for each Efoo in the list below ]  } */
> +/* ` enum errnoval { */
> +
> +#endif /* __XEN_PUBLIC_ERRNO_H__ */
> +
> +#ifdef XEN_ERRNO
> +
> +XEN_ERRNO(EPERM,	 1)	/* Operation not permitted */
> +XEN_ERRNO(ENOENT,	 2)	/* No such file or directory */
> +XEN_ERRNO(ESRCH,	 3)	/* No such process */
> +#ifdef __XEN__
> +XEN_ERRNO(EINTR,	 4)	/* Interrupted system call */
> +#endif

Why is EINTR (and ERESTART lower) hidden from non-xen consumers but
still in the public api?  Would it not be better to keep these in
xen/errno.h rather than public/errno.h ?

~Andrew

  parent reply	other threads:[~2015-01-13 16:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-13 16:21 [PATCH RFC] make error codes a formal part of the ABI Jan Beulich
2015-01-13 16:35 ` Ian Campbell
2015-01-13 16:57   ` Ian Jackson
2015-01-13 17:10     ` Ian Campbell
2015-01-13 17:14     ` Jan Beulich
2015-01-14  8:46   ` Jan Beulich
2015-01-14 10:28     ` Ian Campbell
2015-01-14 10:52       ` Julien Grall
2015-01-14 11:24         ` Ian Campbell
2015-01-14 11:37           ` Andrew Cooper
2015-01-14 11:18       ` Jan Beulich
2015-01-14 11:27         ` Ian Campbell
2015-01-13 16:40 ` Andrew Cooper [this message]
2015-01-14  8:54   ` Jan Beulich

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=54B54A6B.7040206@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=Ian.Campbell@eu.citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=JBeulich@suse.com \
    --cc=keir@xen.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.