Skip to content

Commit fa4b36a

Browse files
author
Mrunal Patel
authored
Merge pull request #942 from paravmellanox/master
Add definitions for RDMA controller/cgroup of Linux kernel 4.11
2 parents 7a8c2c8 + 2e241f7 commit fa4b36a

File tree

6 files changed

+98
-1
lines changed

6 files changed

+98
-1
lines changed

config-linux.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ In addition to any devices configured with this setting, the runtime MUST also s
169169
## <a name="configLinuxControlGroups" />Control groups
170170

171171
Also known as cgroups, they are used to restrict resource usage for a container and handle device access.
172-
cgroups provide controls (through controllers) to restrict cpu, memory, IO, pids and network for the container.
172+
cgroups provide controls (through controllers) to restrict cpu, memory, IO, pids, network and RDMA resources for the container.
173173
For more information, see the [kernel cgroups documentation][cgroup-v1].
174174

175175
### <a name="configLinuxCgroupsPath" />Cgroups Path
@@ -455,6 +455,36 @@ The following parameters can be specified to set up the controller:
455455
}
456456
```
457457

458+
### <a name="configLinuxRDMA" />RDMA
459+
460+
**`rdma`** (object, OPTIONAL) represents the cgroup subsystem `rdma`.
461+
For more information, see the kernel cgroups documentation about [rdma][cgroup-v1-rdma].
462+
463+
The name of the device to limit is the entry key.
464+
Entry values are objects with the following properties:
465+
466+
* **`hcaHandles`** *(uint32, OPTIONAL)* - specifies the maximum number of hca_handles in the cgroup
467+
* **`hcaObjects`** *(uint32, OPTIONAL)* - specifies the maximum number of hca_objects in the cgroup
468+
469+
You MUST specify at least one of the `hcaHandles` or `hcaObjects` in a given entry, and MAY specify both.
470+
471+
#### Example
472+
473+
```json
474+
"rdma": {
475+
"mlx5_1": {
476+
"hcaHandles": 3,
477+
"hcaObjects": 10000
478+
},
479+
"mlx4_0": {
480+
"hcaObjects": 1000
481+
},
482+
"rxe3": {
483+
"hcaObjects": 10000
484+
}
485+
}
486+
```
487+
458488
## <a name="configLinuxIntelRdt" />IntelRdt
459489

460490
**`intelRdt`** (object, OPTIONAL) represents the [Intel Resource Director Technology][intel-rdt-cat-kernel-interface].
@@ -647,6 +677,7 @@ The following parameters can be specified to set up seccomp:
647677
[cgroup-v1-net-cls]: https://www.kernel.org/doc/Documentation/cgroup-v1/net_cls.txt
648678
[cgroup-v1-net-prio]: https://www.kernel.org/doc/Documentation/cgroup-v1/net_prio.txt
649679
[cgroup-v1-pids]: https://www.kernel.org/doc/Documentation/cgroup-v1/pids.txt
680+
[cgroup-v1-rdma]: https://www.kernel.org/doc/Documentation/cgroup-v1/rdma.txt
650681
[cgroup-v2]: https://www.kernel.org/doc/Documentation/cgroup-v2.txt
651682
[devices]: https://www.kernel.org/doc/Documentation/admin-guide/devices.txt
652683
[devpts]: https://www.kernel.org/doc/Documentation/filesystems/devpts.txt

schema/config-linux.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,12 @@
175175
}
176176
}
177177
}
178+
},
179+
"rdma": {
180+
"type": "object",
181+
"additionalProperties": {
182+
"$ref": "defs-linux.json#/definitions/Rdma"
183+
}
178184
}
179185
}
180186
},

schema/defs-linux.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,17 @@
240240
"priority"
241241
]
242242
},
243+
"Rdma": {
244+
"type": "object",
245+
"properties": {
246+
"hcaHandles": {
247+
"$ref": "defs.json#/definitions/uint32"
248+
},
249+
"hcaObjects": {
250+
"$ref": "defs.json#/definitions/uint32"
251+
}
252+
}
253+
},
243254
"NamespaceType": {
244255
"type": "string",
245256
"enum": [
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"ociVersion": "1.0.0",
3+
"root": {
4+
"path": "rootfs"
5+
},
6+
"linux": {
7+
"resources": {
8+
"rdma": {
9+
"mlx5_1": {
10+
"hcaHandles": "not a uint32"
11+
}
12+
}
13+
}
14+
}
15+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"ociVersion": "1.0.0",
3+
"root": {
4+
"path": "rootfs"
5+
},
6+
"linux": {
7+
"resources": {
8+
"rdma": {
9+
"mlx5_1": {
10+
"hcaHandles": 3,
11+
"hcaObjects": 10000
12+
},
13+
"mlx4_0": {
14+
"hcaObjects": 1000
15+
},
16+
"rxe3": {
17+
"hcaObjects": 10000
18+
}
19+
}
20+
}
21+
}
22+
}

specs-go/config.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,14 @@ type LinuxNetwork struct {
320320
Priorities []LinuxInterfacePriority `json:"priorities,omitempty"`
321321
}
322322

323+
// LinuxRdma for Linux cgroup 'rdma' resource management (Linux 4.11)
324+
type LinuxRdma struct {
325+
// Maximum number of HCA handles that can be opened. Default is "no limit".
326+
HcaHandles *uint32 `json:"hcaHandles,omitempty"`
327+
// Maximum number of HCA objects that can be created. Default is "no limit".
328+
HcaObjects *uint32 `json:"hcaObjects,omitempty"`
329+
}
330+
323331
// LinuxResources has container runtime resource constraints
324332
type LinuxResources struct {
325333
// Devices configures the device whitelist.
@@ -336,6 +344,10 @@ type LinuxResources struct {
336344
HugepageLimits []LinuxHugepageLimit `json:"hugepageLimits,omitempty"`
337345
// Network restriction configuration
338346
Network *LinuxNetwork `json:"network,omitempty"`
347+
// Rdma resource restriction configuration.
348+
// Limits are a set of key value pairs that define RDMA resource limits,
349+
// where the key is device name and value is resource limits.
350+
Rdma map[string]LinuxRdma `json:"rdma,omitempty"`
339351
}
340352

341353
// LinuxDevice represents the mknod information for a Linux special device file

0 commit comments

Comments
 (0)