Skip to contentSkip to conversation

Add sysfs based cpuinfo structure

PATCH Greg KH 2 participants 2 messages Aug 2, 2017 2 messages not in the archive

lore
Share & tools
lore

Greg KH

author
#2 lore raw
In reply to a message not in the archive
Quoted 27 lines · Felix Schnizlein

Create a new sysfs attribute group called 'info' for each online cpu. The cleaned up cpuinfo shows up in a sysfs subdirectory here: /sys/devices/system/cpu/cpu#/info.

Define preprocessor macros (CPUINFO_DEFINE_* and CPUINFO_ATTR) to make defining new sysfs attributes for cpuinfo more easy.

Add basic documentation for the info sysfs tree.

---
 Documentation/ABI/testing/sysfs-devices-system-cpu | 17 ++++++++
 arch/Kconfig                                       |  3 ++
 drivers/base/Makefile                              |  1 +
 drivers/base/cpuinfo.c                             | 48 ++++++++++++++++++++++
 include/linux/cpuhotplug.h                         |  1 +
 include/linux/cpuinfo.h                            | 43 +++++++++++++++++++
 6 files changed, 113 insertions(+)
 create mode 100644 drivers/base/cpuinfo.c
 create mode 100644 include/linux/cpuinfo.h
Documentation/ABI/testing/sysfs-devices-system-cpu +0 -0
index f3d5817..fbaf165 100644

Documentation/ABI/testing/sysfs-devices-system-cpu Contact: Linux kernel mailing list <[email protected]> · line 382

Quoted 10 lines
Documentation/ABI/testing/sysfs-devices-system-cpu +7 -0
@@ -373,3 +373,20 @@ Contact:	Linux kernel mailing list <[email protected]>
 Description:	information about CPUs heterogeneity.
 
 		cpu_capacity: capacity of cpu#.
+
+What:		/sys/devices/system/cpu/cpu#/info/
+Date:		June 2017
+Contact:	Linux kernel mailing list <[email protected]>
+Description:	Various information about the online cpu. Which attributes are
+		available depends on the architecture, kernel configuration and
+                cpu model.

tabs?

Documentation/ABI/testing/sysfs-devices-system-cpu Contact: Linux kernel mailing list <[email protected]> · line 392

Quoted 10 lines
Documentation/ABI/testing/sysfs-devices-system-cpu +10 -0
+
+What:		/sys/devices/system/cpu/cpu#/info/
+		/sys/devices/system/cpu/cpu#/info/vendor_id
+		/sys/devices/system/cpu/cpu#/info/cpu_family
+		/sys/devices/system/cpu/cpu#/info/model
+		/sys/devices/system/cpu/cpu#/info/model_name
+		/sys/devices/system/cpu/cpu#/info/stepping
+		/sys/devices/system/cpu/cpu#/info/flags
+		/sys/devices/system/cpu/cpu#/info/bugs
+		/sys/devices/system/cpu/cpu#/info/bogomips

Can you guarantee that all arches will be able to provide these?

thanks,

greg k-h

#3 lore raw
Quoted 30 lines · Greg KH
Quoted 29 lines · Felix Schnizlein

Create a new sysfs attribute group called 'info' for each online cpu. The cleaned up cpuinfo shows up in a sysfs subdirectory here: /sys/devices/system/cpu/cpu#/info.

Define preprocessor macros (CPUINFO_DEFINE_* and CPUINFO_ATTR) to make defining new sysfs attributes for cpuinfo more easy.

Add basic documentation for the info sysfs tree.

---
 Documentation/ABI/testing/sysfs-devices-system-cpu | 17 ++++++++
 arch/Kconfig                                       |  3 ++
 drivers/base/Makefile                              |  1 +
 drivers/base/cpuinfo.c                             | 48 ++++++++++++++++++++++
 include/linux/cpuhotplug.h                         |  1 +
 include/linux/cpuinfo.h                            | 43 +++++++++++++++++++
 6 files changed, 113 insertions(+)
 create mode 100644 drivers/base/cpuinfo.c
 create mode 100644 include/linux/cpuinfo.h
Documentation/ABI/testing/sysfs-devices-system-cpu +0 -0
index f3d5817..fbaf165 100644
@@ -373,3 +373,20 @@ Contact:	Linux kernel mailing list <[email protected]>
 Description:	information about CPUs heterogeneity.
 
Quoted 10 lines

Documentation/ABI/testing/sysfs-devices-system-cpu Contact: Linux kernel mailing list <[email protected]> · line 382

Quoted 8 lines
Documentation/ABI/testing/sysfs-devices-system-cpu +7 -0
 		cpu_capacity: capacity of cpu#.
+
+What:		/sys/devices/system/cpu/cpu#/info/
+Date:		June 2017
+Contact:	Linux kernel mailing list <[email protected]>
+Description:	Various information about the online cpu. Which attributes are
+		available depends on the architecture, kernel configuration and
+                cpu model.

tabs?

Oh.. it seems I missed this line. I will fix this!

Quoted 13 lines

Documentation/ABI/testing/sysfs-devices-system-cpu Contact: Linux kernel mailing list <[email protected]> · line 392

Quoted 11 lines
Documentation/ABI/testing/sysfs-devices-system-cpu +10 -0
+
+What:		/sys/devices/system/cpu/cpu#/info/
+		/sys/devices/system/cpu/cpu#/info/vendor_id
+		/sys/devices/system/cpu/cpu#/info/cpu_family
+		/sys/devices/system/cpu/cpu#/info/model
+		/sys/devices/system/cpu/cpu#/info/model_name
+		/sys/devices/system/cpu/cpu#/info/stepping
+		/sys/devices/system/cpu/cpu#/info/flags
+		/sys/devices/system/cpu/cpu#/info/bugs
+		/sys/devices/system/cpu/cpu#/info/bogomips

Can you guarantee that all arches will be able to provide these?

Of course, I can not. I move it too the x86 section in the second patch. It seems messed up the last rebase.

Sorry for the noise and stupid mistakes...

And thank you for the feedback and your patience!

Felix

Quoted 5 lines

thanks,

greg k-h