1spu_create(2)                 System Calls Manual                spu_create(2)
2
3
4

NAME

6       spu_create - create a new spu context
7

LIBRARY

9       Standard C library (libc, -lc)
10

SYNOPSIS

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

DESCRIPTION

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

RETURN VALUE

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

ERRORS

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

FILES

148       pathname must point to a location beneath the mount point of spufs.  By
149       convention, it gets mounted in /spu.
150

STANDARDS

152       Linux on PowerPC.
153

HISTORY

155       Linux 2.6.16.
156
157       Prior  to  the  addition  of  the SPU_CREATE_AFFINITY_SPU flag in Linux
158       2.6.23, the spu_create() system call took only three  arguments  (i.e.,
159       there was no neighbor_fd argument).
160

NOTES

162       spu_create()  is  meant to be used from libraries that implement a more
163       abstract interface to SPUs, not to be used from  regular  applications.
164       See   ⟨http://www.bsc.es/projects/deepcomputing/linuxoncell/⟩  for  the
165       recommended libraries.
166

EXAMPLES

168       See spu_run(2) for an example of the use of spu_create()
169

SEE ALSO

171       close(2), spu_run(2), capabilities(7), spufs(7)
172
173
174
175Linux man-pages 6.05              2023-03-30                     spu_create(2)
Impressum