← Documents Documentation/filesystems/spufs/spu_create.rst GitHub 원문 ↗

Linux 6.18.37 · Filesystems / SPUFS

spu_create

논리 SPU context 생성 syscall의 수명·권한·errno 전문 번역입니다.

Source pathDocumentation/filesystems/spufs/spu_create.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약·해설

spu_create.rst:1-131

`spu_create()`는 ppc64 Cell 시스템에서 spufs 아래 논리 SPU context directory와 전용 handle을 만든다. `SPU_RAWIO`는 `CAP_SYS_RAWIO`를 요구하며, 마지막 handle이 닫히면 context가 파괴된다.

Create에서 destroy까지
spufs mount`spu_create()`context directory·fd`spu_run()`마지막 close로 destroy

SPU context의 공개 수명이다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 .. SPDX-License-Identifier: GPL-2.0
2
3 ==========
4 spu_create
5 ==========
6
7 Name
8 ====
9 spu_create - create a new spu context
10
11
12 Synopsis
13 ========
14
15 ::
16
17 #include <sys/types.h>
18 #include <sys/spu.h>
19
20 int spu_create(const char *pathname, int flags, mode_t mode);
21
22 Description
23 ===========
24 The spu_create system call is used on PowerPC machines that implement
25 the Cell Broadband Engine Architecture in order to access Synergistic
26 Processor Units (SPUs). It creates a new logical context for an SPU in
27 pathname and returns a handle to associated with it. pathname must
28 point to a non-existing directory in the mount point of the SPU file
29 system (spufs). When spu_create is successful, a directory gets cre-
30 ated on pathname and it is populated with files.
31
32 The returned file handle can only be passed to spu_run(2) or closed,
33 other operations are not defined on it. When it is closed, all associ-
34 ated directory entries in spufs are removed. When the last file handle
35 pointing either inside of the context directory or to this file
36 descriptor is closed, the logical SPU context is destroyed.
37
38 The parameter flags can be zero or any bitwise or'd combination of the
39 following constants:
40
41 SPU_RAWIO
42 Allow mapping of some of the hardware registers of the SPU into
43 user space. This flag requires the CAP_SYS_RAWIO capability, see
44 capabilities(7).
45
46 The mode parameter specifies the permissions used for creating the new
47 directory in spufs. mode is modified with the user's umask(2) value
48 and then used for both the directory and the files contained in it. The
49 file permissions mask out some more bits of mode because they typically
50 support only read or write access. See stat(2) for a full list of the
51 possible mode values.
52
53
54 Return Value
55 ============
56 spu_create returns a new file descriptor. It may return -1 to indicate
57 an error condition and set errno to one of the error codes listed
58 below.
59
60
61 Errors
62 ======
63 EACCES
64 The current user does not have write access on the spufs mount
65 point.
66
67 EEXIST An SPU context already exists at the given path name.
68
69 EFAULT pathname is not a valid string pointer in the current address
70 space.
71
72 EINVAL pathname is not a directory in the spufs mount point.
73
74 ELOOP Too many symlinks were found while resolving pathname.
75
76 EMFILE The process has reached its maximum open file limit.
77
78 ENAMETOOLONG
79 pathname was too long.
80
81 ENFILE The system has reached the global open file limit.
82
83 ENOENT Part of pathname could not be resolved.
84
85 ENOMEM The kernel could not allocate all resources required.
86
87 ENOSPC There are not enough SPU resources available to create a new
88 context or the user specific limit for the number of SPU con-
89 texts has been reached.
90
91 ENOSYS the functionality is not provided by the current system, because
92 either the hardware does not provide SPUs or the spufs module is
93 not loaded.
94
95 ENOTDIR
96 A part of pathname is not a directory.
97
98
99
100 Notes
101 =====
102 spu_create is meant to be used from libraries that implement a more
103 abstract interface to SPUs, not to be used from regular applications.
104 See http://www.bsc.es/projects/deepcomputing/linuxoncell/ for the rec-
105 ommended libraries.
106
107
108 Files
109 =====
110 pathname must point to a location beneath the mount point of spufs. By
111 convention, it gets mounted in /spu.
112
113
114 Conforming to
115 =============
116 This call is Linux specific and only implemented by the ppc64 architec-
117 ture. Programs using this system call are not portable.
118
119
120 Bugs
121 ====
122 The code does not yet fully implement all features lined out here.
123
124
125 Author
126 ======
127 Arnd Bergmann <[email protected]>
128
129 See Also
130 ========
131 capabilities(7), close(2), spu_run(2), spufs(7)
132

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

`spu_create()` 호출과 수명

1-51

`spu_create(const char *pathname, int flags, mode_t mode)`는 Cell Broadband Engine Architecture를 구현한 PowerPC에서 Synergistic Processor Unit(SPU)에 접근할 논리 context를 만든다. `pathname`은 spufs mountpoint 아래 아직 존재하지 않는 directory를 가리켜야 한다.

성공하면 해당 경로에 미리 정해진 파일로 채운 context directory가 생기고, 연결된 file descriptor를 반환한다. 이 handle에는 `spu_run(2)` 또는 `close`만 정의되어 있다. handle을 닫으면 관련 spufs directory entry가 제거되고, context directory 내부나 이 descriptor를 가리키는 마지막 handle까지 닫히면 논리 context가 파괴된다.

`flags`는 0 또는 상수의 bitwise OR이다. `SPU_RAWIO`는 일부 SPU hardware register를 user space에 map하도록 허용하며 `CAP_SYS_RAWIO` capability가 필요하다. `mode`는 새 directory와 내부 파일 권한의 기반이며 사용자 `umask(2)`가 적용된다. 각 파일이 read 또는 write 일부만 지원하므로 모순되는 permission bit는 추가로 제거된다.

SPU context 수명
spufs 아래 존재하지 않는 `pathname` 선택`spu_create(pathname, flags, mode)`context directory와 predefined file 생성반환 fd를 `spu_run()` 또는 `close()`에 사용마지막 내부·context handle close 시 논리 SPU context 파괴

경로 생성부터 마지막 reference 종료까지다.

.. SPDX-License-Identifier: GPL-2.0

==========
spu_create
==========

Name
====
       spu_create - create a new spu context


Synopsis
========

       ::

         #include <sys/types.h>
         #include <sys/spu.h>

         int spu_create(const char *pathname, int flags, mode_t mode);

Description
===========
       The  spu_create  system call is used on PowerPC machines that implement
       the Cell Broadband Engine Architecture in order to  access  Synergistic
       Processor  Units (SPUs). It creates a new logical context for an SPU in
       pathname and returns a handle to associated  with  it.   pathname  must
       point  to  a  non-existing directory in the mount point of the SPU file
       system (spufs).  When spu_create is successful, a directory  gets  cre-
       ated on pathname and it is populated with files.

       The  returned  file  handle can only be passed to spu_run(2) or closed,
       other operations are not defined on it. When it is closed, all  associ-
       ated  directory entries in spufs are removed. When the last file handle
       pointing either inside  of  the  context  directory  or  to  this  file
       descriptor is closed, the logical SPU context is destroyed.

       The  parameter flags can be zero or any bitwise or'd combination of the
       following constants:

       SPU_RAWIO
              Allow mapping of some of the hardware registers of the SPU  into
              user space. This flag requires the CAP_SYS_RAWIO capability, see
              capabilities(7).

       The mode parameter specifies the permissions used for creating the  new
       directory  in  spufs.   mode is modified with the user's umask(2) value
       and then used for both the directory and the files contained in it. The
       file permissions mask out some more bits of mode because they typically
       support only read or write access. See stat(2) for a full list  of  the
       possible mode values.

반환값과 오류

52-98

성공하면 새 file descriptor를 반환한다. 실패하면 `-1`을 반환하고 `errno`를 설정한다.

`spu_create()` 오류
errno조건
EACCES현재 사용자가 spufs mountpoint에 쓸 권한이 없음
EEXIST지정 경로에 SPU context가 이미 존재
EFAULT`pathname`이 현재 address space의 유효한 문자열 포인터가 아님
EINVAL`pathname`이 spufs mountpoint 안의 directory가 아님
ELOOP경로 해석 중 symbolic link가 너무 많음
EMFILEprocess별 open file 한도 도달
ENAMETOOLONG`pathname`이 너무 김
ENFILEsystem 전체 open file 한도 도달
ENOENT`pathname` 일부를 해석할 수 없음
ENOMEMkernel이 필요한 resource를 모두 할당하지 못함
ENOSPCSPU resource 부족 또는 사용자별 context 한도 도달
ENOSYSSPU hardware가 없거나 spufs module이 load되지 않음
ENOTDIR`pathname` 일부가 directory가 아님

원문의 errno와 발생 조건을 보존한다.



Return Value
============
       spu_create  returns a new file descriptor. It may return -1 to indicate
       an error condition and set errno to  one  of  the  error  codes  listed
       below.


Errors
======
       EACCES
              The  current  user does not have write access on the spufs mount
              point.

       EEXIST An SPU context already exists at the given path name.

       EFAULT pathname is not a valid string pointer in  the  current  address
              space.

       EINVAL pathname is not a directory in the spufs mount point.

       ELOOP  Too many symlinks were found while resolving pathname.

       EMFILE The process has reached its maximum open file limit.

       ENAMETOOLONG
              pathname was too long.

       ENFILE The system has reached the global open file limit.

       ENOENT Part of pathname could not be resolved.

       ENOMEM The kernel could not allocate all resources required.

       ENOSPC There  are  not  enough  SPU resources available to create a new
              context or the user specific limit for the number  of  SPU  con-
              texts has been reached.

       ENOSYS the functionality is not provided by the current system, because
              either the hardware does not provide SPUs or the spufs module is
              not loaded.

       ENOTDIR
              A part of pathname is not a directory.

사용 범위·파일 위치·이식성

99-123

`spu_create()`는 일반 application이 직접 호출하기보다 SPU를 더 추상적으로 제공하는 library에서 사용하도록 설계됐다. 문서는 권장 library 정보로 Linux on Cell 프로젝트 URL을 제시한다.

`pathname`은 spufs mountpoint 아래여야 하며 관례상 spufs는 `/spu`에 mount한다. 이 syscall은 Linux 전용이고 ppc64 architecture에서만 구현되므로 이를 사용하는 program은 이식성이 없다.

Bugs 절은 문서에 열거된 기능을 code가 아직 모두 구현하지 않았다고 밝힌다.

`spu_create()` 적용 범위
항목제약
권장 호출자SPU 추상화 library
경로spufs mountpoint 아래, 관례상 `/spu`
Architectureppc64
표준Linux-specific, 비이식적
구현 상태문서 기능 일부 미구현 가능

호출자가 알아야 할 환경 제약이다.


Notes
=====
       spu_create  is  meant  to  be used from libraries that implement a more
       abstract interface to SPUs, not to be used from  regular  applications.
       See  http://www.bsc.es/projects/deepcomputing/linuxoncell/ for the rec-
       ommended libraries.


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


Conforming to
=============
       This call is Linux specific and only implemented by the ppc64 architec-
       ture. Programs using this system call are not portable.


Bugs
====
       The code does not yet fully implement all features lined out here.

저자와 관련 문서

124-131

저자는 Arnd Bergmann이다. 관련 manual page는 `capabilities(7)`, `close(2)`, `spu_run(2)`, `spufs(7)`이며, capability·수명·실행·파일 시스템 interface를 함께 확인해야 한다.


Author
======
       Arnd Bergmann <[email protected]>

See Also
========
       capabilities(7), close(2), spu_run(2), spufs(7)