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

Arnd Bergmann arnd at arndb.de
Tue Oct 2 21:09:09 EST 2007


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.

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