1SPU_CREATE(2) Linux Programmer's Manual SPU_CREATE(2)
2
3
4
6 spu_create - create a new spu context
7
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 neighbor_fd);
14
15 Note: There is no glibc wrapper for this system call; see NOTES.
16
18 The spu_create() system call is used on PowerPC machines that implement
19 the Cell Broadband Engine Architecture in order to access Synergistic
20 Processor Units (SPUs). It creates a new logical context for an SPU in
21 pathname and returns a file descriptor associated with it. pathname
22 must refer to a nonexistent directory in the mount point of the SPU
23 filesystem (spufs). If spu_create() is successful, a directory is cre‐
24 ated at pathname and it is populated with the files described in
25 spufs(7).
26
27 When a context is created, the returned file descriptor can only be
28 passed to spu_run(2), used as the dirfd argument to the *at family of
29 system calls (e.g., openat(2)), or closed; other operations are not de‐
30 fined. A logical SPU context is destroyed (along with all files cre‐
31 ated within the context's pathname directory) once the last reference
32 to the context has gone; this usually occurs when the file descriptor
33 returned by spu_create() is closed.
34
35 The mode argument (minus any bits set in the process's umask(2)) speci‐
36 fies the permissions used for creating the new directory in spufs. See
37 stat(2) for a full list of the possible mode values.
38
39 The neighbor_fd is used only when the SPU_CREATE_AFFINITY_SPU flag is
40 specified; see below.
41
42 The flags argument can be zero or any bitwise OR-ed combination of the
43 following constants:
44
45 SPU_CREATE_EVENTS_ENABLED
46 Rather than using signals for reporting DMA errors, use the
47 event argument to spu_run(2).
48
49 SPU_CREATE_GANG
50 Create an SPU gang instead of a context. (A gang is a group of
51 SPU contexts that are functionally related to each other and
52 which share common scheduling parameters—priority and policy.
53 In the future, gang scheduling may be implemented causing the
54 group to be switched in and out as a single unit.)
55
56 A new directory will be created at the location specified by the
57 pathname argument. This gang may be used to hold other SPU con‐
58 texts, by providing a pathname that is within the gang directory
59 to further calls to spu_create().
60
61 SPU_CREATE_NOSCHED
62 Create a context that is not affected by the SPU scheduler.
63 Once the context is run, it will not be scheduled out until it
64 is destroyed by the creating process.
65
66 Because the context cannot be removed from the SPU, some func‐
67 tionality is disabled for SPU_CREATE_NOSCHED contexts. Only a
68 subset of the files will be available in this context directory
69 in spufs. Additionally, SPU_CREATE_NOSCHED contexts cannot dump
70 a core file when crashing.
71
72 Creating SPU_CREATE_NOSCHED contexts requires the CAP_SYS_NICE
73 capability.
74
75 SPU_CREATE_ISOLATE
76 Create an isolated SPU context. Isolated contexts are protected
77 from some PPE (PowerPC Processing Element) operations, such as
78 access to the SPU local store and the NPC register.
79
80 Creating SPU_CREATE_ISOLATE contexts also requires the SPU_CRE‐
81 ATE_NOSCHED flag.
82
83 SPU_CREATE_AFFINITY_SPU (since Linux 2.6.23)
84 Create a context with affinity to another SPU context. This
85 affinity information is used within the SPU scheduling algo‐
86 rithm. Using this flag requires that a file descriptor refer‐
87 ring to the other SPU context be passed in the neighbor_fd argu‐
88 ment.
89
90 SPU_CREATE_AFFINITY_MEM (since Linux 2.6.23)
91 Create a context with affinity to system memory. This affinity
92 information is used within the SPU scheduling algorithm.
93
95 On success, spu_create() returns a new file descriptor. On error, -1
96 is returned, and errno is set to one of the error codes listed below.
97
99 EACCES The current user does not have write access to the spufs(7)
100 mount point.
101
102 EEXIST An SPU context already exists at the given pathname.
103
104 EFAULT pathname is not a valid string pointer in the calling process's
105 address space.
106
107 EINVAL pathname is not a directory in the spufs(7) mount point, or in‐
108 valid flags have been provided.
109
110 ELOOP Too many symbolic links were found while resolving pathname.
111
112 EMFILE The per-process limit on the number of open file descriptors has
113 been reached.
114
115 ENAMETOOLONG
116 pathname is too long.
117
118 ENFILE The system-wide limit on the total number of open files has been
119 reached.
120
121 ENODEV An isolated context was requested, but the hardware does not
122 support SPU isolation.
123
124 ENOENT Part of pathname could not be resolved.
125
126 ENOMEM The kernel could not allocate all resources required.
127
128 ENOSPC There are not enough SPU resources available to create a new
129 context or the user-specific limit for the number of SPU con‐
130 texts has been reached.
131
132 ENOSYS The functionality is not provided by the current system, because
133 either the hardware does not provide SPUs or the spufs module is
134 not loaded.
135
136 ENOTDIR
137 A part of pathname is not a directory.
138
139 EPERM The SPU_CREATE_NOSCHED flag has been given, but the user does
140 not have the CAP_SYS_NICE capability.
141
143 pathname must point to a location beneath the mount point of spufs. By
144 convention, it gets mounted in /spu.
145
147 The spu_create() system call was added to Linux in kernel 2.6.16.
148
150 This call is Linux-specific and implemented only on the PowerPC archi‐
151 tecture. Programs using this system call are not portable.
152
154 Glibc does not provide a wrapper for this system call; call it using
155 syscall(2). Note however, that spu_create() is meant to be used from
156 libraries that implement a more abstract interface to SPUs, not to be
157 used from regular applications. See ⟨http://www.bsc.es/projects
158 /deepcomputing/linuxoncell/⟩ for the recommended libraries.
159
160 Prior to the addition of the SPU_CREATE_AFFINITY_SPU flag in Linux
161 2.6.23, the spu_create() system call took only three arguments (i.e.,
162 there was no neighbor_fd argument).
163
165 See spu_run(2) for an example of the use of spu_create()
166
168 close(2), spu_run(2), capabilities(7), spufs(7)
169
171 This page is part of release 5.10 of the Linux man-pages project. A
172 description of the project, information about reporting bugs, and the
173 latest version of this page, can be found at
174 https://www.kernel.org/doc/man-pages/.
175
176
177
178Linux 2020-12-21 SPU_CREATE(2)