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/spu.h>          /* Definition of SPU_* constants */
10       #include <sys/syscall.h>      /* Definition of SYS_* constants */
11       #include <unistd.h>
12
13       int syscall(SYS_spu_create, const char *pathname, unsigned int flags,
14                   mode_t mode, int neighbor_fd);
15
16       Note: glibc provides no wrapper for spu_create(), necessitating the use
17       of syscall(2).
18

DESCRIPTION

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

RETURN VALUE

97       On success, spu_create() returns a new file descriptor.  On failure, -1
98       is returned, and errno is set to indicate the error.
99

ERRORS

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

FILES

145       pathname must point to a location beneath the mount point of spufs.  By
146       convention, it gets mounted in /spu.
147

VERSIONS

149       The spu_create() system call was added to Linux in kernel 2.6.16.
150

CONFORMING TO

152       This  call is Linux-specific and implemented only on the PowerPC archi‐
153       tecture.  Programs using this system call are not portable.
154

NOTES

156       spu_create() is meant to be used from libraries that implement  a  more
157       abstract  interface  to SPUs, not to be used from regular applications.
158       See  ⟨http://www.bsc.es/projects/deepcomputing/linuxoncell/⟩  for   the
159       recommended libraries.
160
161       Prior  to  the  addition  of  the SPU_CREATE_AFFINITY_SPU flag in Linux
162       2.6.23, the spu_create() system call took only three  arguments  (i.e.,
163       there was no neighbor_fd argument).
164

EXAMPLES

166       See spu_run(2) for an example of the use of spu_create()
167

SEE ALSO

169       close(2), spu_run(2), capabilities(7), spufs(7)
170

COLOPHON

172       This  page  is  part of release 5.12 of the Linux man-pages project.  A
173       description of the project, information about reporting bugs,  and  the
174       latest     version     of     this    page,    can    be    found    at
175       https://www.kernel.org/doc/man-pages/.
176
177
178
179Linux                             2021-03-22                     SPU_CREATE(2)
Impressum