[Cbe-oss-dev] [PATCH] spufs: Return EOPNOTSUPP if affinity isn't supported

Kazunori Asayama asayama at sm.sony.co.jp
Wed Oct 3 00:28:08 EST 2007


Arnd Bergmann <arnd at arndb.de> wrote:
> On Tuesday 02 October 2007, Kazunori Asayama wrote:
> > The libspe2 spec says that the library returns a specific errno
> > ENOTSUP when the platform doesn't support affinity, however there is
> > no way to know this error reason by the userspace because the current
> > SPUFS implementation doesn't distinguish this case from other generic
> > errors and returns EINVAL. This patch changes the spu_create system
> > call's behavior so that it returns EOPNOTSUPP in this case.
> > 
> > Essentially, ENOTSUP should be returned here (EOPNOTSUPP means
> > "Operation not supported on socket"), however I use EOPNOTSUPP instead
> > of ENOTSUP because 1) there is no definition of ENOTSUP in the Linux
> > kernel, 2) EOPNOTSUPP has the same value as ENOTSUP and they are not
> > distinct on the Linux userspace (see the man page of 'errno') and 3)
> > other drivers (ATA, USB, etc) also use EOPNOTSUPP for similar
> > purposes.
> > 
> > Signed-off-by: Kazunori Asayama <asayama at sm.sony.co.jp>
> 
> I'm not too fond of this change. We shouldn't change the kernel interface
> in an inconsistant way just to match the libspe documentation.
> As you mentioned, EOPNOTSUPP means something different in the kernel, so
> I think we should really not use that.
> 

If a program can't distinguish this error as a special case from other
errors, there is no way to know if the platform supports affinity or
not by the program on runtime. That means it is impossible to create a
program which utilizes affinity feature only when it is available.

I think that if we can't get knowledge about affinity support via
spu_create's errno:

  a. another way to know whether the platform supports affinity or
     not, should be provided, for example, via the spe_cpu_info_get API.

or:

  b. spu_create shouldn't return error even if the platform doesn't
     support affinity, as you say.

> Ideally, the kernel should not error out when the user asks for affinity,
> because that breaks running those applications e.g. on the PS3. The
> affinity as seen by the kernel is only a hint anyway, so it is certainly
> not an error to specify it. Even when there is no vicinity information
> for relative placement of the SPEs, the kernel can still make use of
> the hint for moving contexts to the same NUMA node or do optimizations
> regarding memory management.
> 
> 	Arnd <><



More information about the cbe-oss-dev mailing list