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 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
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 file system (spufs). If spu_create() is successful, a directory is
25 created 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
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
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 path name.
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 process has reached its maximum open files limit.
111
112 ENAMETOOLONG
113 pathname is too long.
114
115 ENFILE The system has reached the global open files limit.
116
117 ENODEV An isolated context was requested, but the hardware does not
118 support SPU isolation.
119
120 ENOENT Part of pathname could not be resolved.
121
122 ENOMEM The kernel could not allocate all resources required.
123
124 ENOSPC There are not enough SPU resources available to create a new
125 context or the user-specific limit for the number of SPU con‐
126 texts has been reached.
127
128 ENOSYS The functionality is not provided by the current system, because
129 either the hardware does not provide SPUs or the spufs module is
130 not loaded.
131
132 ENOTDIR
133 A part of pathname is not a directory.
134
135 EPERM The SPU_CREATE_NOSCHED flag has been given, but the user does
136 not have the CAP_SYS_NICE capability.
137
139 pathname must point to a location beneath the mount point of spufs. By
140 convention, it gets mounted in /spu.
141
143 The spu_create() system call was added to Linux in kernel 2.6.16.
144
146 This call is Linux-specific and implemented only on the PowerPC archi‐
147 tecture. Programs using this system call are not portable.
148
150 Glibc does not provide a wrapper for this system call; call it using
151 syscall(2). Note however, that spu_create() is meant to be used from
152 libraries that implement a more abstract interface to SPUs, not to be
153 used from regular applications. See ⟨http://www.bsc.es/projects
154 /deepcomputing/linuxoncell/⟩ for the recommended libraries.
155
157 See spu_run(2) for an example of the use of spu_create()
158
160 close(2), spu_run(2), capabilities(7), spufs(7)
161
163 This page is part of release 3.53 of the Linux man-pages project. A
164 description of the project, and information about reporting bugs, can
165 be found at http://www.kernel.org/doc/man-pages/.
166
167
168
169Linux 2012-08-05 SPU_CREATE(2)