1 From 55b007fcc580559e12d72c53ae39ba0136488b24 Mon Sep 17 00:00:00 2001
2 From: Jackie Huang <jackie.huang@windriver.com>
3 Date: Wed, 6 Dec 2023 17:28:44 +0800
4 Subject: [PATCH 10/12] isolcpu: handle devPath when it doesn't exist
6 The /dev/cpu/<cpunum>/cpuid doesn't exist and is not supported
7 for Arm architecture, so check its existence before passing
11 PASS: build-pkgs on x86-64 host
12 PASS: build-image on x86-64 host
13 PASS: build-pkgs on arm64 host
14 PASS: build-image on arm64 host
15 PASS: Deploy AIO-SX on x86-64 target
16 PASS: Deploy AIO-SX on arm64 target
17 PASS: Deploy AIO-DX on arm64 targets
18 PASS: Deploy std (2+2+2) on arm64 targets
23 Change-Id: I0f4905139365e6dc071994c46672816ae22b294d
24 Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
26 .../isolcpus-device-plugin/files/isolcpu.go | 20 ++++++++++++-------
27 1 file changed, 13 insertions(+), 7 deletions(-)
29 diff --git a/kubernetes/plugins/isolcpus-device-plugin/files/isolcpu.go b/kubernetes/plugins/isolcpus-device-plugin/files/isolcpu.go
30 index 1ef784df..0ebab58b 100644
31 --- a/kubernetes/plugins/isolcpus-device-plugin/files/isolcpu.go
32 +++ b/kubernetes/plugins/isolcpus-device-plugin/files/isolcpu.go
33 @@ -27,6 +27,7 @@ import (
34 "isolcpu_plugin/kubernetes/pkg/kubelet/cm/cpuset"
35 "github.com/pkg/errors"
41 @@ -111,13 +112,18 @@ func (dp *devicePlugin) scan() (dpapi.DeviceTree, error) {
42 cpustr := strconv.Itoa(cpu)
43 numaNode, _ := dp.getCPUNode(cpu)
44 devPath := path.Join("/dev/cpu", cpustr, "cpuid")
45 - debug.Printf("Adding %s to isolcpus", devPath)
46 - var nodes []pluginapi.DeviceSpec
47 - nodes = append(nodes, pluginapi.DeviceSpec{
49 - ContainerPath: devPath,
52 + var nodes []pluginapi.DeviceSpec
53 + if _, err := os.Stat(devPath); os.IsNotExist(err) {
54 + debug.Printf("Dev path %s doesn't exist", devPath)
56 + debug.Printf("Adding %s to isolcpus", devPath)
57 + nodes = append(nodes, pluginapi.DeviceSpec{
59 + ContainerPath: devPath,
64 devTree.AddDevice(deviceType, cpustr, dpapi.DeviceInfo{
65 State: pluginapi.Healthy, Nodes: nodes, NumaNode: numaNode,