mirror of
https://github.com/intel/intel-device-plugins-for-kubernetes.git
synced 2025-06-03 03:59:37 +00:00
gpu_plugin: skip drm control node
DRM control node is deprecated and removed by latest kernel. This will skip possible drm control node found on host. v2: Fix lint error v3: Fix regex string Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
This commit is contained in:
parent
6f3543884f
commit
ec632e0b38
@ -36,6 +36,7 @@ const (
|
|||||||
sysfsDrmDirectory = "/sys/class/drm"
|
sysfsDrmDirectory = "/sys/class/drm"
|
||||||
devfsDriDirectory = "/dev/dri"
|
devfsDriDirectory = "/dev/dri"
|
||||||
gpuDeviceRE = `^card[0-9]+$`
|
gpuDeviceRE = `^card[0-9]+$`
|
||||||
|
controlDeviceRE = `^controlD[0-9]+$`
|
||||||
vendorString = "0x8086"
|
vendorString = "0x8086"
|
||||||
|
|
||||||
// Device plugin settings.
|
// Device plugin settings.
|
||||||
@ -58,6 +59,7 @@ func newDeviceManager() *deviceManager {
|
|||||||
// Discovers all GPU devices available on the local node by walking `/sys/class/drm` directory.
|
// Discovers all GPU devices available on the local node by walking `/sys/class/drm` directory.
|
||||||
func (dm *deviceManager) discoverGPUs(sysfsDrmDir string, devfsDriDir string) error {
|
func (dm *deviceManager) discoverGPUs(sysfsDrmDir string, devfsDriDir string) error {
|
||||||
reg := regexp.MustCompile(gpuDeviceRE)
|
reg := regexp.MustCompile(gpuDeviceRE)
|
||||||
|
ctlReg := regexp.MustCompile(controlDeviceRE)
|
||||||
files, err := ioutil.ReadDir(sysfsDrmDir)
|
files, err := ioutil.ReadDir(sysfsDrmDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Can't read sysfs folder: %v", err)
|
return fmt.Errorf("Can't read sysfs folder: %v", err)
|
||||||
@ -79,6 +81,10 @@ func (dm *deviceManager) discoverGPUs(sysfsDrmDir string, devfsDriDir string) er
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, drmFile := range drmFiles {
|
for _, drmFile := range drmFiles {
|
||||||
|
if ctlReg.MatchString(drmFile.Name()) {
|
||||||
|
//Skipping possible drm control node
|
||||||
|
continue
|
||||||
|
}
|
||||||
devPath := path.Join(devfsDriDir, drmFile.Name())
|
devPath := path.Join(devfsDriDir, drmFile.Name())
|
||||||
if _, err := os.Stat(devPath); err != nil {
|
if _, err := os.Stat(devPath); err != nil {
|
||||||
continue
|
continue
|
||||||
|
Loading…
Reference in New Issue
Block a user