1SPU_CREATE(2)              Linux Programmer's Manual             SPU_CREATE(2)
2
3
4

NAME

6       spu_create - create a new spu context
7

SYNOPSIS

9       #include <sys/types.h>
10       #include <sys/spu.h>
11
12       int spu_create(const char *pathname, int flags, mode_t mode);
13       int spu_create(const char *pathname, int flags, mode_t mode,
14                      int neighbor_fd);
15
16       Note: There is no glibc wrapper for this system call; see NOTES.
17

DESCRIPTION

19       The spu_create() system call is used on PowerPC machines that implement
20       the Cell Broadband Engine Architecture in order to  access  Synergistic
21       Processor Units (SPUs).  It creates a new logical context for an SPU in
22       pathname and returns a file descriptor associated  with  it.   pathname
23       must  refer  to  a  nonexistent directory in the mount point of the SPU
24       filesystem (spufs).  If spu_create() is successful, a directory is cre‐
25       ated  at  pathname  and  it  is  populated  with the files described in
26       spufs(7).
27
28       When a context is created, the returned file  descriptor  can  only  be
29       passed  to  spu_run(2), used as the dirfd argument to the *at family of
30       system calls (e.g., openat(2)), or closed;  other  operations  are  not
31       defined.  A logical SPU context is destroyed (along with all files cre‐
32       ated within the context's pathname directory) once the  last  reference
33       to  the  context has gone; this usually occurs when the file descriptor
34       returned by spu_create() is closed.
35
36       The flags argument can be zero or any bitwise OR-ed combination of  the
37       following constants:
38
39       SPU_CREATE_EVENTS_ENABLED
40              Rather  than  using  signals  for  reporting DMA errors, use the
41              event argument to spu_run(2).
42
43       SPU_CREATE_GANG
44              Create an SPU gang instead of a context.  (A gang is a group  of
45              SPU  contexts  that  are  functionally related to each other and
46              which share common scheduling  parameters—priority  and  policy.
47              In  the  future,  gang scheduling may be implemented causing the
48              group to be switched in and out as a single unit.)
49
50              A new directory will be created at the location specified by the
51              pathname argument.  This gang may be used to hold other SPU con‐
52              texts, by providing a pathname that is within the gang directory
53              to further calls to spu_create().
54
55       SPU_CREATE_NOSCHED
56              Create  a  context  that  is  not affected by the SPU scheduler.
57              Once the context is run, it will not be scheduled out  until  it
58              is destroyed by the creating process.
59
60              Because  the  context cannot be removed from the SPU, some func‐
61              tionality is disabled for SPU_CREATE_NOSCHED contexts.   Only  a
62              subset  of the files will be available in this context directory
63              in spufs.  Additionally, SPU_CREATE_NOSCHED contexts cannot dump
64              a core file when crashing.
65
66              Creating  SPU_CREATE_NOSCHED  contexts requires the CAP_SYS_NICE
67              capability.
68
69       SPU_CREATE_ISOLATE
70              Create an isolated SPU context.  Isolated contexts are protected
71              from  some  PPE (PowerPC Processing Element) operations, such as
72              access to the SPU local store and the NPC register.
73
74              Creating SPU_CREATE_ISOLATE contexts also requires the  SPU_CRE‐
75              ATE_NOSCHED flag.
76
77       SPU_CREATE_AFFINITY_SPU
78              Create  a  context  with  affinity to another SPU context.  This
79              affinity information is used within  the  SPU  scheduling  algo‐
80              rithm.   Using  this flag requires that a file descriptor refer‐
81              ring to the other SPU context be passed in the neighbor_fd argu‐
82              ment.
83
84       SPU_CREATE_AFFINITY_MEM
85              Create  a context with affinity to system memory.  This affinity
86              information is used within the SPU scheduling algorithm.
87
88       The mode argument (minus any bits set in the process's umask(2)) speci‐
89       fies the permissions used for creating the new directory in spufs.  See
90       stat(2) for a full list of the possible mode values.
91

RETURN VALUE

93       On success, spu_create() returns a new file descriptor.  On  error,  -1
94       is returned, and errno is set to one of the error codes listed below.
95

ERRORS

97       EACCES The  current  user  does  not  have write access to the spufs(7)
98              mount point.
99
100       EEXIST An SPU context already exists at the given pathname.
101
102       EFAULT pathname is not a valid string pointer in the calling  process's
103              address space.
104
105       EINVAL pathname  is  not  a  directory  in the spufs(7) mount point, or
106              invalid flags have been provided.
107
108       ELOOP  Too many symbolic links were found while resolving pathname.
109
110       EMFILE The per-process limit on the number of open file descriptors has
111              been reached.
112
113       ENAMETOOLONG
114              pathname is too long.
115
116       ENFILE The system-wide limit on the total number of open files has been
117              reached.
118
119       ENODEV An isolated context was requested, but  the  hardware  does  not
120              support SPU isolation.
121
122       ENOENT Part of pathname could not be resolved.
123
124       ENOMEM The kernel could not allocate all resources required.
125
126       ENOSPC There  are  not  enough  SPU resources available to create a new
127              context or the user-specific limit for the number  of  SPU  con‐
128              texts has been reached.
129
130       ENOSYS The functionality is not provided by the current system, because
131              either the hardware does not provide SPUs or the spufs module is
132              not loaded.
133
134       ENOTDIR
135              A part of pathname is not a directory.
136
137       EPERM  The  SPU_CREATE_NOSCHED  flag  has been given, but the user does
138              not have the CAP_SYS_NICE capability.
139

FILES

141       pathname must point to a location beneath the mount point of spufs.  By
142       convention, it gets mounted in /spu.
143

VERSIONS

145       The spu_create() system call was added to Linux in kernel 2.6.16.
146

CONFORMING TO

148       This  call is Linux-specific and implemented only on the PowerPC archi‐
149       tecture.  Programs using this system call are not portable.
150

NOTES

152       Glibc does not provide a wrapper for this system call;  call  it  using
153       syscall(2).   Note  however, that spu_create() is meant to be used from
154       libraries that implement a more abstract interface to SPUs, not  to  be
155       used   from   regular  applications.   See  ⟨http://www.bsc.es/projects
156       /deepcomputing/linuxoncell/⟩ for the recommended libraries.
157

EXAMPLE

159       See spu_run(2) for an example of the use of spu_create()
160

SEE ALSO

162       close(2), spu_run(2), capabilities(7), spufs(7)
163

COLOPHON

165       This page is part of release 5.02 of the Linux  man-pages  project.   A
166       description  of  the project, information about reporting bugs, and the
167       latest    version    of    this    page,    can     be     found     at
168       https://www.kernel.org/doc/man-pages/.
169
170
171
172Linux                             2017-09-15                     SPU_CREATE(2)
Impressum