All of lore.kernel.org
 help / color / mirror / Atom feed
* POSIX error names and codes in PV protocols
@ 2017-01-26 14:40 Oleksandr Andrushchenko
  2017-01-26 15:44 ` Jan Beulich
  0 siblings, 1 reply; 10+ messages in thread
From: Oleksandr Andrushchenko @ 2017-01-26 14:40 UTC (permalink / raw)
  To: xen-devel

Hi, all!

There is some work happening on new PV protocols: sndif [1],

displif [2], PV calls [3] and the common part of those is that

error/status codes must be returned as a part of a response packet.

For that Konrad suggested [1] (and Stefano already used in [3]) POSIX

to be employed here instead of defining protocol specific error codes.

The problem I see here is that POSIX only defines names of the errors,

but not values [4]. So, in order to use POSIX one still needs to define

the values (names must be the same, but values may differ for different 
OSes).

So, the question is what would be the best option to

a) have those numbers defined in OS agnostic way

b) have those defined for all PV protocols

Stefano has already defined the error code values in his work [3],

but for other protocols this should be reimplemented again.


Thank you,

Oleksandr

[1] https://marc.info/?l=xen-devel&m=148528530727366&w=2

[2] https://marc.info/?l=xen-devel&m=148239440624498&w=2

[3] https://marc.info/?l=xen-devel&m=148530334732400&w=2

[4] http://pubs.opengroup.org/onlinepubs/007908799/xsh/errno.h.html


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

* Re: POSIX error names and codes in PV protocols
  2017-01-26 14:40 POSIX error names and codes in PV protocols Oleksandr Andrushchenko
@ 2017-01-26 15:44 ` Jan Beulich
  2017-01-26 17:28   ` Oleksandr Andrushchenko
  0 siblings, 1 reply; 10+ messages in thread
From: Jan Beulich @ 2017-01-26 15:44 UTC (permalink / raw)
  To: Oleksandr Andrushchenko; +Cc: xen-devel

>>> On 26.01.17 at 15:40, <andr2000@gmail.com> wrote:
> There is some work happening on new PV protocols: sndif [1],
> 
> displif [2], PV calls [3] and the common part of those is that
> 
> error/status codes must be returned as a part of a response packet.
> 
> For that Konrad suggested [1] (and Stefano already used in [3]) POSIX
> 
> to be employed here instead of defining protocol specific error codes.
> 
> The problem I see here is that POSIX only defines names of the errors,
> 
> but not values [4]. So, in order to use POSIX one still needs to define
> 
> the values (names must be the same, but values may differ for different 
> OSes).
> 
> So, the question is what would be the best option to
> 
> a) have those numbers defined in OS agnostic way
> 
> b) have those defined for all PV protocols
> 
> Stefano has already defined the error code values in his work [3],
> 
> but for other protocols this should be reimplemented again.

Aren't these simply what public/errno.h provides? Why would any
Xen specific protocol want to define their own, now that we have
this base set?

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

* Re: POSIX error names and codes in PV protocols
  2017-01-26 15:44 ` Jan Beulich
@ 2017-01-26 17:28   ` Oleksandr Andrushchenko
  2017-01-26 17:38     ` Julien Grall
                       ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Oleksandr Andrushchenko @ 2017-01-26 17:28 UTC (permalink / raw)
  To: Jan Beulich, konrad.wilk, Stefano Stabellini; +Cc: xen-devel

On 01/26/2017 05:44 PM, Jan Beulich wrote:
>>>> On 26.01.17 at 15:40, <andr2000@gmail.com> wrote:
>> There is some work happening on new PV protocols: sndif [1],
>>
>> displif [2], PV calls [3] and the common part of those is that
>>
>> error/status codes must be returned as a part of a response packet.
>>
>> For that Konrad suggested [1] (and Stefano already used in [3]) POSIX
>>
>> to be employed here instead of defining protocol specific error codes.
>>
>> The problem I see here is that POSIX only defines names of the errors,
>>
>> but not values [4]. So, in order to use POSIX one still needs to define
>>
>> the values (names must be the same, but values may differ for different
>> OSes).
>>
>> So, the question is what would be the best option to
>>
>> a) have those numbers defined in OS agnostic way
>>
>> b) have those defined for all PV protocols
>>
>> Stefano has already defined the error code values in his work [3],
>>
>> but for other protocols this should be reimplemented again.
> Aren't these simply what public/errno.h provides? Why would any
> Xen specific protocol want to define their own, now that we have
> this base set?
>
> Jan
Indeed, thank you
The problem is that it is not exposed to Linux, but I can see it
in FreeBSD [1] and the helper to convert error codes [2] there as well.
Is there any reason these are not available in Linux?

Besides this fact,
Konrad, Stefano, are you ok that we say in the protocol file that
these are the error codes used?
As error codes are unsigned ints, what should be used in packets?
uint16_t or uint32_t?

Thank you,
Oleksandr

[1] https://github.com/freebsd/freebsd/blob/master/sys/xen/interface/errno.h
[2] https://github.com/freebsd/freebsd/blob/master/sys/xen/error.h


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

* Re: POSIX error names and codes in PV protocols
  2017-01-26 17:28   ` Oleksandr Andrushchenko
@ 2017-01-26 17:38     ` Julien Grall
  2017-01-26 17:38     ` Roger Pau Monné
  2017-01-27  8:01     ` Jan Beulich
  2 siblings, 0 replies; 10+ messages in thread
From: Julien Grall @ 2017-01-26 17:38 UTC (permalink / raw)
  To: Oleksandr Andrushchenko, Jan Beulich, konrad.wilk, Stefano Stabellini
  Cc: xen-devel

Hi,

On 26/01/2017 17:28, Oleksandr Andrushchenko wrote:
> On 01/26/2017 05:44 PM, Jan Beulich wrote:
>>>>> On 26.01.17 at 15:40, <andr2000@gmail.com> wrote:
>>> There is some work happening on new PV protocols: sndif [1],
>>>
>>> displif [2], PV calls [3] and the common part of those is that
>>>
>>> error/status codes must be returned as a part of a response packet.
>>>
>>> For that Konrad suggested [1] (and Stefano already used in [3]) POSIX
>>>
>>> to be employed here instead of defining protocol specific error codes.
>>>
>>> The problem I see here is that POSIX only defines names of the errors,
>>>
>>> but not values [4]. So, in order to use POSIX one still needs to define
>>>
>>> the values (names must be the same, but values may differ for different
>>> OSes).
>>>
>>> So, the question is what would be the best option to
>>>
>>> a) have those numbers defined in OS agnostic way
>>>
>>> b) have those defined for all PV protocols
>>>
>>> Stefano has already defined the error code values in his work [3],
>>>
>>> but for other protocols this should be reimplemented again.
>> Aren't these simply what public/errno.h provides? Why would any
>> Xen specific protocol want to define their own, now that we have
>> this base set?
>>
>> Jan
> Indeed, thank you
> The problem is that it is not exposed to Linux, but I can see it
> in FreeBSD [1] and the helper to convert error codes [2] there as well.
> Is there any reason these are not available in Linux?

This is because Linux and Xen are using the exact same error codes. The 
one in FreeBSD differs a bit, hence the helper to convert errors.

Strictly speaking Linux should have a converter, but it is not necessary 
today.

Cheers,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

* Re: POSIX error names and codes in PV protocols
  2017-01-26 17:28   ` Oleksandr Andrushchenko
  2017-01-26 17:38     ` Julien Grall
@ 2017-01-26 17:38     ` Roger Pau Monné
  2017-01-26 18:14       ` Oleksandr Andrushchenko
  2017-01-27  8:01     ` Jan Beulich
  2 siblings, 1 reply; 10+ messages in thread
From: Roger Pau Monné @ 2017-01-26 17:38 UTC (permalink / raw)
  To: Oleksandr Andrushchenko; +Cc: xen-devel, Stefano Stabellini, Jan Beulich

On Thu, Jan 26, 2017 at 07:28:44PM +0200, Oleksandr Andrushchenko wrote:
> On 01/26/2017 05:44 PM, Jan Beulich wrote:
> > > > > On 26.01.17 at 15:40, <andr2000@gmail.com> wrote:
> > > There is some work happening on new PV protocols: sndif [1],
> > > 
> > > displif [2], PV calls [3] and the common part of those is that
> > > 
> > > error/status codes must be returned as a part of a response packet.
> > > 
> > > For that Konrad suggested [1] (and Stefano already used in [3]) POSIX
> > > 
> > > to be employed here instead of defining protocol specific error codes.
> > > 
> > > The problem I see here is that POSIX only defines names of the errors,
> > > 
> > > but not values [4]. So, in order to use POSIX one still needs to define
> > > 
> > > the values (names must be the same, but values may differ for different
> > > OSes).
> > > 
> > > So, the question is what would be the best option to
> > > 
> > > a) have those numbers defined in OS agnostic way
> > > 
> > > b) have those defined for all PV protocols
> > > 
> > > Stefano has already defined the error code values in his work [3],
> > > 
> > > but for other protocols this should be reimplemented again.
> > Aren't these simply what public/errno.h provides? Why would any
> > Xen specific protocol want to define their own, now that we have
> > this base set?
> > 
> > Jan
> Indeed, thank you
> The problem is that it is not exposed to Linux, but I can see it
> in FreeBSD [1] and the helper to convert error codes [2] there as well.
> Is there any reason these are not available in Linux?

Xen error codes are Linux error codes, so I guess there's basically no need to
use them on Linux (although it would be good, just so that people is aware that
Xen and Linux are in different theoretical spaces, which happen to match in
Linux's case).

Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

* Re: POSIX error names and codes in PV protocols
  2017-01-26 17:38     ` Roger Pau Monné
@ 2017-01-26 18:14       ` Oleksandr Andrushchenko
  2017-01-26 18:16         ` Roger Pau Monné
  0 siblings, 1 reply; 10+ messages in thread
From: Oleksandr Andrushchenko @ 2017-01-26 18:14 UTC (permalink / raw)
  To: Roger Pau Monné; +Cc: xen-devel, Stefano Stabellini, Jan Beulich

On 01/26/2017 07:38 PM, Roger Pau Monné wrote:
> On Thu, Jan 26, 2017 at 07:28:44PM +0200, Oleksandr Andrushchenko wrote:
>> On 01/26/2017 05:44 PM, Jan Beulich wrote:
>>>>>> On 26.01.17 at 15:40, <andr2000@gmail.com> wrote:
>>>> There is some work happening on new PV protocols: sndif [1],
>>>>
>>>> displif [2], PV calls [3] and the common part of those is that
>>>>
>>>> error/status codes must be returned as a part of a response packet.
>>>>
>>>> For that Konrad suggested [1] (and Stefano already used in [3]) POSIX
>>>>
>>>> to be employed here instead of defining protocol specific error codes.
>>>>
>>>> The problem I see here is that POSIX only defines names of the errors,
>>>>
>>>> but not values [4]. So, in order to use POSIX one still needs to define
>>>>
>>>> the values (names must be the same, but values may differ for different
>>>> OSes).
>>>>
>>>> So, the question is what would be the best option to
>>>>
>>>> a) have those numbers defined in OS agnostic way
>>>>
>>>> b) have those defined for all PV protocols
>>>>
>>>> Stefano has already defined the error code values in his work [3],
>>>>
>>>> but for other protocols this should be reimplemented again.
>>> Aren't these simply what public/errno.h provides? Why would any
>>> Xen specific protocol want to define their own, now that we have
>>> this base set?
>>>
>>> Jan
>> Indeed, thank you
>> The problem is that it is not exposed to Linux, but I can see it
>> in FreeBSD [1] and the helper to convert error codes [2] there as well.
>> Is there any reason these are not available in Linux?
> Xen error codes are Linux error codes, so I guess there's basically no need to
> use them on Linux (although it would be good, just so that people is aware that
> Xen and Linux are in different theoretical spaces, which happen to match in
> Linux's case).
>
> Roger.
Thank you for clarifications.
Does it mean that I can state in PV protocols that XEN_E??? error codes are
used and still use Linux error codes directly in Linux front/back w/o 
complains
from the community because of no conversion? :)


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

* Re: POSIX error names and codes in PV protocols
  2017-01-26 18:14       ` Oleksandr Andrushchenko
@ 2017-01-26 18:16         ` Roger Pau Monné
  2017-01-26 18:40           ` Oleksandr Andrushchenko
  0 siblings, 1 reply; 10+ messages in thread
From: Roger Pau Monné @ 2017-01-26 18:16 UTC (permalink / raw)
  To: Oleksandr Andrushchenko; +Cc: xen-devel, Stefano Stabellini, Jan Beulich

On Thu, Jan 26, 2017 at 08:14:10PM +0200, Oleksandr Andrushchenko wrote:
> On 01/26/2017 07:38 PM, Roger Pau Monné wrote:
> > On Thu, Jan 26, 2017 at 07:28:44PM +0200, Oleksandr Andrushchenko wrote:
> > > On 01/26/2017 05:44 PM, Jan Beulich wrote:
> > > > > > > On 26.01.17 at 15:40, <andr2000@gmail.com> wrote:
> > > > > There is some work happening on new PV protocols: sndif [1],
> > > > > 
> > > > > displif [2], PV calls [3] and the common part of those is that
> > > > > 
> > > > > error/status codes must be returned as a part of a response packet.
> > > > > 
> > > > > For that Konrad suggested [1] (and Stefano already used in [3]) POSIX
> > > > > 
> > > > > to be employed here instead of defining protocol specific error codes.
> > > > > 
> > > > > The problem I see here is that POSIX only defines names of the errors,
> > > > > 
> > > > > but not values [4]. So, in order to use POSIX one still needs to define
> > > > > 
> > > > > the values (names must be the same, but values may differ for different
> > > > > OSes).
> > > > > 
> > > > > So, the question is what would be the best option to
> > > > > 
> > > > > a) have those numbers defined in OS agnostic way
> > > > > 
> > > > > b) have those defined for all PV protocols
> > > > > 
> > > > > Stefano has already defined the error code values in his work [3],
> > > > > 
> > > > > but for other protocols this should be reimplemented again.
> > > > Aren't these simply what public/errno.h provides? Why would any
> > > > Xen specific protocol want to define their own, now that we have
> > > > this base set?
> > > > 
> > > > Jan
> > > Indeed, thank you
> > > The problem is that it is not exposed to Linux, but I can see it
> > > in FreeBSD [1] and the helper to convert error codes [2] there as well.
> > > Is there any reason these are not available in Linux?
> > Xen error codes are Linux error codes, so I guess there's basically no need to
> > use them on Linux (although it would be good, just so that people is aware that
> > Xen and Linux are in different theoretical spaces, which happen to match in
> > Linux's case).
> > 
> > Roger.
> Thank you for clarifications.
> Does it mean that I can state in PV protocols that XEN_E??? error codes are
> used and still use Linux error codes directly in Linux front/back w/o
> complains
> from the community because of no conversion? :)

I guess if it's inside of the Linux kernel that's fine (although that's a
question for the Linux maintainers). If it runs in user-space you certainly
need to use the XEN_E error codes.

Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

* Re: POSIX error names and codes in PV protocols
  2017-01-26 18:16         ` Roger Pau Monné
@ 2017-01-26 18:40           ` Oleksandr Andrushchenko
  0 siblings, 0 replies; 10+ messages in thread
From: Oleksandr Andrushchenko @ 2017-01-26 18:40 UTC (permalink / raw)
  To: Roger Pau Monné; +Cc: xen-devel, Stefano Stabellini, Jan Beulich



On 01/26/2017 08:16 PM, Roger Pau Monné wrote:
> On Thu, Jan 26, 2017 at 08:14:10PM +0200, Oleksandr Andrushchenko wrote:
>> On 01/26/2017 07:38 PM, Roger Pau Monné wrote:
>>> On Thu, Jan 26, 2017 at 07:28:44PM +0200, Oleksandr Andrushchenko wrote:
>>>> On 01/26/2017 05:44 PM, Jan Beulich wrote:
>>>>>>>> On 26.01.17 at 15:40, <andr2000@gmail.com> wrote:
>>>>>> There is some work happening on new PV protocols: sndif [1],
>>>>>>
>>>>>> displif [2], PV calls [3] and the common part of those is that
>>>>>>
>>>>>> error/status codes must be returned as a part of a response packet.
>>>>>>
>>>>>> For that Konrad suggested [1] (and Stefano already used in [3]) POSIX
>>>>>>
>>>>>> to be employed here instead of defining protocol specific error codes.
>>>>>>
>>>>>> The problem I see here is that POSIX only defines names of the errors,
>>>>>>
>>>>>> but not values [4]. So, in order to use POSIX one still needs to define
>>>>>>
>>>>>> the values (names must be the same, but values may differ for different
>>>>>> OSes).
>>>>>>
>>>>>> So, the question is what would be the best option to
>>>>>>
>>>>>> a) have those numbers defined in OS agnostic way
>>>>>>
>>>>>> b) have those defined for all PV protocols
>>>>>>
>>>>>> Stefano has already defined the error code values in his work [3],
>>>>>>
>>>>>> but for other protocols this should be reimplemented again.
>>>>> Aren't these simply what public/errno.h provides? Why would any
>>>>> Xen specific protocol want to define their own, now that we have
>>>>> this base set?
>>>>>
>>>>> Jan
>>>> Indeed, thank you
>>>> The problem is that it is not exposed to Linux, but I can see it
>>>> in FreeBSD [1] and the helper to convert error codes [2] there as well.
>>>> Is there any reason these are not available in Linux?
>>> Xen error codes are Linux error codes, so I guess there's basically no need to
>>> use them on Linux (although it would be good, just so that people is aware that
>>> Xen and Linux are in different theoretical spaces, which happen to match in
>>> Linux's case).
>>>
>>> Roger.
>> Thank you for clarifications.
>> Does it mean that I can state in PV protocols that XEN_E??? error codes are
>> used and still use Linux error codes directly in Linux front/back w/o
>> complains
>> from the community because of no conversion? :)
> I guess if it's inside of the Linux kernel that's fine (although that's a
> question for the Linux maintainers). If it runs in user-space you certainly
> need to use the XEN_E error codes.
clear
> Roger.
Thank you

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

* Re: POSIX error names and codes in PV protocols
  2017-01-26 17:28   ` Oleksandr Andrushchenko
  2017-01-26 17:38     ` Julien Grall
  2017-01-26 17:38     ` Roger Pau Monné
@ 2017-01-27  8:01     ` Jan Beulich
  2017-01-27  8:03       ` Oleksandr Andrushchenko
  2 siblings, 1 reply; 10+ messages in thread
From: Jan Beulich @ 2017-01-27  8:01 UTC (permalink / raw)
  To: Oleksandr Andrushchenko; +Cc: xen-devel, Stefano Stabellini

>>> On 26.01.17 at 18:28, <andr2000@gmail.com> wrote:
> The problem is that it is not exposed to Linux, but I can see it
> in FreeBSD [1] and the helper to convert error codes [2] there as well.
> Is there any reason these are not available in Linux?

Well, the header should eventually get added there (but see also
Julien's reply as to why no-one may have cared so far).

> Besides this fact,
> Konrad, Stefano, are you ok that we say in the protocol file that
> these are the error codes used?
> As error codes are unsigned ints, what should be used in packets?
> uint16_t or uint32_t?

Conventionally error codes are signed ints, and the width you
need should be mostly dictated by other structure size constraints
(i.e. if you have ample of space, int32_t may be more efficient to
access, but if you have space restrictions, then int16_t should be
fine as it can represent quite a bit larger a range than error codes
will cover in the foreseeable future).

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

* Re: POSIX error names and codes in PV protocols
  2017-01-27  8:01     ` Jan Beulich
@ 2017-01-27  8:03       ` Oleksandr Andrushchenko
  0 siblings, 0 replies; 10+ messages in thread
From: Oleksandr Andrushchenko @ 2017-01-27  8:03 UTC (permalink / raw)
  To: Jan Beulich; +Cc: xen-devel, Stefano Stabellini

On 01/27/2017 10:01 AM, Jan Beulich wrote:
>>>> On 26.01.17 at 18:28, <andr2000@gmail.com> wrote:
>> The problem is that it is not exposed to Linux, but I can see it
>> in FreeBSD [1] and the helper to convert error codes [2] there as well.
>> Is there any reason these are not available in Linux?
> Well, the header should eventually get added there (but see also
> Julien's reply as to why no-one may have cared so far).
>
>> Besides this fact,
>> Konrad, Stefano, are you ok that we say in the protocol file that
>> these are the error codes used?
>> As error codes are unsigned ints, what should be used in packets?
>> uint16_t or uint32_t?
> Conventionally error codes are signed ints, and the width you
> need should be mostly dictated by other structure size constraints
> (i.e. if you have ample of space, int32_t may be more efficient to
> access, but if you have space restrictions, then int16_t should be
> fine as it can represent quite a bit larger a range than error codes
> will cover in the foreseeable future).
yes, what I put in sndif now is:
/*
  * STATUS RETURN CODES.
  *
  * Status return code is zero on success and -XEN_EXX on failure.
  */
...
  * status - int32_t, response status, zero on success and -XEN_EXX on 
failure
...
> Jan
>


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

end of thread, other threads:[~2017-01-27  8:03 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-26 14:40 POSIX error names and codes in PV protocols Oleksandr Andrushchenko
2017-01-26 15:44 ` Jan Beulich
2017-01-26 17:28   ` Oleksandr Andrushchenko
2017-01-26 17:38     ` Julien Grall
2017-01-26 17:38     ` Roger Pau Monné
2017-01-26 18:14       ` Oleksandr Andrushchenko
2017-01-26 18:16         ` Roger Pau Monné
2017-01-26 18:40           ` Oleksandr Andrushchenko
2017-01-27  8:01     ` Jan Beulich
2017-01-27  8:03       ` Oleksandr Andrushchenko

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.