Skip to contentSkip to conversation

hwdata: bumb to version 0.308

PATCH Superseded Carlos Santos 5 participants 10 messages Jan 23, 2018 – Dec 8, 2018

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hwdata: bumb to version 0.308

The hwdata collection is hosted at GitHub now and provides additional databases, besides pci.ids and usb.ids:

- Individual Address Block (IAB) and Organizationally Unique Identifier (OUI) databases, from IEEE Registration Authority
- PNP ID database (from Microsoft)

Install only pci.ids and usb.ids by default, to keep compatibility with previous versions.

In the future we can make other packages (pciutils, lshw) use the common files instead of installing their own copies, thus saving some storage space.

---
 package/hwdata/Config.in   | 45 ++++++++++++++++++++++++++++++++++++++++++---
 package/hwdata/hwdata.hash |  7 ++++---
 package/hwdata/hwdata.mk   | 20 +++++++++++++-------
 3 files changed, 59 insertions(+), 13 deletions(-)
package/hwdata/Config.in +42 -3
index 8424238e1b..63bb2216da 100644
@@ -1,6 +1,45 @@
 config BR2_PACKAGE_HWDATA
 	bool "hwdata"
 	help
-	  Various hardware identification and configuration data,
-	  such as the pci.ids database, or the XFree86/xorg Cards
-	  database.
+	  Various hardware identification and configuration data
+
+	  - Individual Address Block (IAB) and Organizationally Unique
+	    Identifier (OUI) databases, from IEEE Registration Authority
+	  - PCI ID database
+	  - PNP ID database (from Microsoft)
+	  - USB ID database
+
+	  https://github.com/vcrhonek/hwdata
+
+if BR2_PACKAGE_HWDATA
+
+config BR2_PACKAGE_HWDATA_ANY
+	bool
+
+config BR2_PACKAGE_HWDATA_IAB_OUI_TXT
+	bool "install iab.txt and oui.txt"
+	select BR2_PACKAGE_HWDATA_ANY
+	help
+	  Install iab.txt and oui.txt
+
+config BR2_PACKAGE_HWDATA_PCI_IDS
+	bool "install pci.ids"
+	default y
+	select BR2_PACKAGE_HWDATA_ANY
+	help
+	  Install pci.ids
+
+config BR2_PACKAGE_HWDATA_PNP_IDS
+	bool "install pnp.ids"
+	select BR2_PACKAGE_HWDATA_ANY
+	help
+	  Install pnp.ids
+
+config BR2_PACKAGE_HWDATA_USB_IDS
+	bool "install usb.ids"
+	default y
+	select BR2_PACKAGE_HWDATA_ANY
+	help
+	  Install usb.ids
+
+endif
package/hwdata/hwdata.hash +4 -3
index b3c83ebb74..dba1be31e0 100644
@@ -1,3 +1,4 @@
-# From http://snapshot.debian.org/archive/debian/20141023T043132Z/pool/main/h/hwdata/hwdata_0.267-1.dsc
-sha256	d77f2b3f3d6e278be669141ffa5dac01b64cab02f7b2c744bbabc500a45263f4	hwdata_0.267.orig.tar.gz
-sha256	055d2f168de9333562a04f6a230c43dc19c4975882935d8b2f0ab17f64f57275	hwdata_0.267-1.diff.gz
+# Locally calculated
+sha256 986d919c20a0c7f8b669a63830f6d2f4cb5c4cddcfc944c5e2ae05c2e9e5ec9f  hwdata-v0.308.tar.gz
+sha256 8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643  COPYING
+sha256 21d0406f93e884a050426ebc21931839a45d56bfcbcbfdda7686d583f36f107f  LICENSE
package/hwdata/hwdata.mk +13 -7
index 4ad8d42939..6ebcd0e86e 100644
@@ -4,16 +4,22 @@
 #
 ################################################################################
 
-HWDATA_VERSION = 0.267
-HWDATA_SOURCE = hwdata_$(HWDATA_VERSION).orig.tar.gz
-HWDATA_PATCH = hwdata_$(HWDATA_VERSION)-1.diff.gz
-HWDATA_SITE = http://snapshot.debian.org/archive/debian/20141023T043132Z/pool/main/h/hwdata
-HWDATA_LICENSE = GPL-2.0+ or XFree86 1.0 license
+HWDATA_VERSION = v0.308
+HWDATA_SITE = $(call github,vcrhonek,hwdata,$(HWDATA_VERSION))
+HWDATA_LICENSE = GPL-2.0+, BSD-3-Clause, XFree86 1.0
 HWDATA_LICENSE_FILES = COPYING LICENSE
 
+ifeq ($(BR2_PACKAGE_HWDATA):$(BR2_PACKAGE_HWDATA_ANY),y:)
+$(error No hwdata database selected. Select at least one database)
+endif
+
 define HWDATA_INSTALL_TARGET_CMDS
-	$(INSTALL) -D -m 644 $(@D)/pci.ids $(TARGET_DIR)/usr/share/hwdata/pci.ids
-	$(INSTALL) -D -m 644 $(@D)/usb.ids $(TARGET_DIR)/usr/share/hwdata/usb.ids
+	$(INSTALL) -D -m 644 \
+		$(if $(BR2_PACKAGE_HWDATA_IAB_OUI_TXT),$(@D)/iab.txt $(@D)/oui.txt,) \
+		$(if $(BR2_PACKAGE_HWDATA_PCI_IDS),$(@D)/pci.ids,) \
+		$(if $(BR2_PACKAGE_HWDATA_PNP_IDS),$(@D)/pnp.ids,) \
+		$(if $(BR2_PACKAGE_HWDATA_USB_IDS),$(@D)/usb.ids,) \
+		$(TARGET_DIR)/usr/share/hwdata
 endef
 
 $(eval $(generic-package))
Signature · 1 line
2.14.3
#1 lore raw

PATCH 1/1 pcm-tools: new package

Processor Counter Monitor (PCM) is an application programming interface (API) and a set of tools based on the API to monitor performance and energy metrics of Intel(R) Core(TM), Xeon(R), Atom(TM) and Xeon Phi(TM) processors.

The package pulls a patch from upstream that prevents output truncation.

Two Buildroot-specific changes make it use the pci.ids file provided by the hwdata pacakge and look for executable files at /usr/bin.

---
 package/Config.in                                  |  1 +
 ...-snprintf-outut-size-larger-than-destinat.patch | 40 ++++++++++++++++++++++
 ...0002-Look-for-pci.ids-at-usr-share-hwdata.patch | 34 ++++++++++++++++++
 .../0003-Look-for-pcm-core-at-usr-bin.patch        | 28 +++++++++++++++
 package/pcm-tools/Config.in                        | 33 ++++++++++++++++++
 package/pcm-tools/pcm-tools.hash                   |  3 ++
 package/pcm-tools/pcm-tools.mk                     | 31 +++++++++++++++++
 7 files changed, 170 insertions(+)
 create mode 100644 package/pcm-tools/0001-Appease-GCC-snprintf-outut-size-larger-than-destinat.patch
 create mode 100644 package/pcm-tools/0002-Look-for-pci.ids-at-usr-share-hwdata.patch
 create mode 100644 package/pcm-tools/0003-Look-for-pcm-core-at-usr-bin.patch
 create mode 100644 package/pcm-tools/Config.in
 create mode 100644 package/pcm-tools/pcm-tools.hash
 create mode 100644 package/pcm-tools/pcm-tools.mk
package/Config.in +1 -0
index ca2a4107b1..3b359348b2 100644
@@ -113,6 +113,7 @@ menu "Debugging, profiling and benchmark"
 	source "package/nmon/Config.in"
 	source "package/oprofile/Config.in"
 	source "package/pax-utils/Config.in"
+	source "package/pcm-tools/Config.in"
 	source "package/pv/Config.in"
 	source "package/racehound/Config.in"
 	source "package/ramsmp/Config.in"
package/pcm-tools/0001-Appease-GCC-snprintf-outut-size-larger-than-destinat.patch new file +40 -0
new file mode 100644
index 0000000000..5d77ebfcb6
@@ -0,0 +1,40 @@
+From d07d6602ac2d4c90f7e448bdc5b780e8aa9faf7c Mon Sep 17 00:00:00 2001
+From: Carlos Santos <[email protected]>
+Date: Sun, 21 Jan 2018 23:44:46 -0200
+Subject: [PATCH 1/3] Appease GCC: snprintf outut size larger than destination
+ size
+
+GCC ignores that PCI function numbers range from 0 to 7, generations are
+up to 4 (5, by 2019 Q2) and link speeds are up to 16x. So it warns that
+snprintf output may be truncated in build_pci_header (in pcm-iio.cpp).
+
+Solve this by increasing the buffer sizes, since the additional three
+bytes are harmless. We could satisfy GCC by masking p.bdf.funcno and
+p.link_speed to 0x07, thus limitting the output to one decimal digit,
+and p.link_width to 0x1f (two decimal digits). This approach, however,
+would hide invalid arguments, preventing the user from noticing the
+error.
+
+Signed-off-by: Carlos Santos <[email protected]>
+---
+ pcm-iio.cpp | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/pcm-iio.cpp b/pcm-iio.cpp
+index f336bf3..1904296 100644
+--- a/pcm-iio.cpp
++++ b/pcm-iio.cpp
+@@ -153,8 +153,8 @@ vector<struct data> prepare_data(const vector<uint64_t> &values, const vector<st
+ string build_pci_header(const PCIDB & pciDB, uint32_t column_width, struct pci p, int part = -1, uint32_t level = 0)
+ {
+     string s = "|";
+-    char bdf_buf[8];
+-    char speed_buf[9];
++    char bdf_buf[10];
++    char speed_buf[10];
+     char vid_did_buf[10];
+     char device_name_buf[128];
+ 
+-- 
+2.14.3
+
package/pcm-tools/0002-Look-for-pci.ids-at-usr-share-hwdata.patch new file +34 -0
new file mode 100644
index 0000000000..4c04589867
@@ -0,0 +1,34 @@
+From 9213e92ec5aaee0e319b94f9501458e44e7873ba Mon Sep 17 00:00:00 2001
+From: Carlos Santos <[email protected]>
+Date: Tue, 23 Jan 2018 08:27:49 -0200
+Subject: [PATCH 2/3] Look for pci.ids at /usr/share/hwdata
+
+For Buildroot, on which pci.ids is provided by the "hwdata" package.
+
+Signed-off-by: Carlos Santos <[email protected]>
+---
+ lspci.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/lspci.h b/lspci.h
+index 29312a7..1d922fc 100644
+--- a/lspci.h
++++ b/lspci.h
+@@ -179,12 +179,12 @@ void print_pci(struct pci p, const PCIDB & pciDB)
+ 
+ void load_PCIDB(PCIDB & pciDB)
+ {
+-    std::ifstream in("pci.ids");
++    std::ifstream in("/usr/share/hwdata/pci.ids");
+     std::string line, item;
+ 
+     if (!in.is_open())
+     {
+-        std::cerr << "pci.ids file is not available. Download it from https://raw.githubusercontent.com/pciutils/pciids/master/pci.ids " << endl;
++        std::cerr << "/usr/share/hwdata/pci.ids file is not available. Ensure that the \"hwdata\" package is properly installed." << endl;
+         return;
+     }
+ 
+-- 
+2.14.3
+
package/pcm-tools/0003-Look-for-pcm-core-at-usr-bin.patch new file +28 -0
new file mode 100644
index 0000000000..92dc06c197
@@ -0,0 +1,28 @@
+From bef36c901e7f2cca3c21ee057b75f73065830774 Mon Sep 17 00:00:00 2001
+From: Carlos Santos <[email protected]>
+Date: Tue, 23 Jan 2018 10:56:55 -0200
+Subject: [PATCH 3/3] Look for pcm-core at /usr/bin
+
+For Buildroot, on which pcm-core.x ins installed as /usr/bin/pcm-core.
+
+Signed-off-by: Carlos Santos <[email protected]>
+---
+ pmu-query.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/pmu-query.py b/pmu-query.py
+index 4c596c7..71aa1b1 100755
+--- a/pmu-query.py
++++ b/pmu-query.py
+@@ -43,7 +43,7 @@ if filename == None:
+     elif platform.system() == 'Windows':
+         p = subprocess.Popen(['pcm-core.exe -c'],stdout=subprocess.PIPE,shell=True)
+     else:
+-        p = subprocess.Popen(['./pcm-core.x -c'],stdout=subprocess.PIPE,shell=True)
++        p = subprocess.Popen(['/usr/bin/pcm-core -c'],stdout=subprocess.PIPE,shell=True)
+ 
+     (output, err) = p.communicate()
+     p_status = p.wait()
+-- 
+2.14.3
+
package/pcm-tools/Config.in new file +33 -0
new file mode 100644
index 0000000000..a59c41c3e6
@@ -0,0 +1,33 @@
+config BR2_PACKAGE_PCM_TOOLS
+	bool "pcm-tools"
+	depends on BR2_i386 || BR2_x86_64
+	select BR2_PACKAGE_HWDATA
+	select BR2_PACKAGE_HWDATA_PCI_IDS
+	help
+	  Processor Counter Monitor (PCM) is an application programming
+	  interface (API) and a set of tools based on the API to monitor
+	  performance and energy metrics of Intel(R) Core(TM), Xeon(R),
+	  Atom(TM) and Xeon Phi(TM) processors.
+
+	  Requires a kernel with X86_MSR enabled.
+
+	  https://github.com/opcm/pcm
+
+if BR2_PACKAGE_PCM_TOOLS
+
+# The pmu-query script is not compatible with Python 3
+config BR2_PACKAGE_PCM_TOOLS_PMU_QUERY_REQS
+	bool
+	default y
+	depends on BR2_PACKAGE_PYTHON && BR2_PACKAGE_PYTHON_SSL && BR2_PACKAGE_PYTHON_HASHLIB # urllib2
+	depends on BR2_PACKAGE_CA_CERTIFICATES # https
+
+config BR2_PACKAGE_PCM_TOOLS_PMU_QUERY
+	bool "install the pmu-query script"
+	default y
+	depends on BR2_PACKAGE_PCM_TOOLS_PMU_QUERY_REQS
+
+comment "pmu-query needs Python 2.x w/ ssl + hashlib modules, ca-certificates"
+	depends on !BR2_PACKAGE_PCM_TOOLS_PMU_QUERY_REQS
+
+endif
package/pcm-tools/pcm-tools.hash new file +3 -0
new file mode 100644
index 0000000000..7646dfddee
@@ -0,0 +1,3 @@
+# Locally calculated
+sha256 772c7b6310ba9c89931ff6108cc71fa0cbe20540ab6a53503f5f61594c9f661d pcm-tools-201710.tar.gz
+sha256 fac73f62c4d665c82622862a2be2b89713e0f480c93e593af2d8ef29a13d814b LICENSE
package/pcm-tools/pcm-tools.mk new file +31 -0
new file mode 100644
index 0000000000..53c73621c9
@@ -0,0 +1,31 @@
+################################################################################
+#
+# pcm-tools
+#
+################################################################################
+
+PCM_TOOLS_VERSION = 201710
+PCM_TOOLS_SITE = $(call github,opcm,pcm,$(PCM_TOOLS_VERSION))
+PCM_TOOLS_LICENSE = BSD-3-Clause
+PCM_TOOLS_LICENSE_FILES = LICENSE
+
+PCM_TOOLS_EXE_FILES = \
+	pcm-core pcm-iio pcm-lspci pcm-memory pcm-msr pcm-numa \
+	pcm-pcie pcm-power pcm-sensor pcm-tsx pcm
+
+define PCM_TOOLS_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) \
+		UNAME=Linux HOST=_LINUX CC="$(TARGET_CC)"
+endef
+
+define PCM_TOOLS_INSTALL_TARGET_CMDS
+	$(Q) set -x -e; \
+	for f in $(PCM_TOOLS_EXE_FILES); do \
+		$(INSTALL) -D -m 755 $(@D)/$$f.x $(TARGET_DIR)/usr/bin/$$f; \
+	done;
+	if test "$(BR2_PACKAGE_PCM_TOOLS_PMU_QUERY)" = "y"; then \
+		$(INSTALL) -D -m 755 $(@D)/pmu-query.py $(TARGET_DIR)/usr/bin/pmu-query; \
+	fi
+endef
+
+$(eval $(generic-package))
Signature · 1 line
2.14.3
#2 lore raw

PATCH 1/1 pcm-tools: new package

Hi Carlos,

Le 23/01/2018 ? 15:03, Carlos Santos a ?crit?:

Quoted 11 lines

Processor Counter Monitor (PCM) is an application programming interface (API) and a set of tools based on the API to monitor performance and energy metrics of Intel(R) Core(TM), Xeon(R), Atom(TM) and Xeon Phi(TM) processors.

The package pulls a patch from upstream that prevents output truncation.

Two Buildroot-specific changes make it use the pci.ids file provided by the hwdata pacakge and look for executable files at /usr/bin.

Quoted 12 lines
---
 package/Config.in                                  |  1 +
 ...-snprintf-outut-size-larger-than-destinat.patch | 40 ++++++++++++++++++++++
 ...0002-Look-for-pci.ids-at-usr-share-hwdata.patch | 34 ++++++++++++++++++
 .../0003-Look-for-pcm-core-at-usr-bin.patch        | 28 +++++++++++++++
 package/pcm-tools/Config.in                        | 33 ++++++++++++++++++
 package/pcm-tools/pcm-tools.hash                   |  3 ++
 package/pcm-tools/pcm-tools.mk                     | 31 +++++++++++++++++
 7 files changed, 170 insertions(+)
 create mode 100644 package/pcm-tools/0001-Appease-GCC-snprintf-outut-size-larger-than-destinat.patch
 create mode 100644 package/pcm-tools/0002-Look-for-pci.ids-at-usr-share-hwdata.patch
 create mode 100644 package/pcm-tools/0003-Look-for-pcm-core-at-usr-bin.patch

Patches should be generated with git format-patch -N.

./utils/check-package package/pcm-tools/* package/pcm-tools/0001-Appease-GCC-snprintf-outut-size-larger-than-destinat.patch:4:
generate your patches with 'git format-patch -N' package/pcm-tools/0002-Look-for-pci.ids-at-usr-share-hwdata.patch:4: generate your patches with 'git format-patch -N' package/pcm-tools/0003-Look-for-pcm-core-at-usr-bin.patch:4: generate your patches with 'git format-patch -N'

Quoted 120 lines
 create mode 100644 package/pcm-tools/Config.in
 create mode 100644 package/pcm-tools/pcm-tools.hash
 create mode 100644 package/pcm-tools/pcm-tools.mk
package/Config.in +1 -0
index ca2a4107b1..3b359348b2 100644
@@ -113,6 +113,7 @@ menu "Debugging, profiling and benchmark"
 	source "package/nmon/Config.in"
 	source "package/oprofile/Config.in"
 	source "package/pax-utils/Config.in"
+	source "package/pcm-tools/Config.in"
 	source "package/pv/Config.in"
 	source "package/racehound/Config.in"
 	source "package/ramsmp/Config.in"
package/pcm-tools/0001-Appease-GCC-snprintf-outut-size-larger-than-destinat.patch new file +40 -0
new file mode 100644
index 0000000000..5d77ebfcb6
@@ -0,0 +1,40 @@
+From d07d6602ac2d4c90f7e448bdc5b780e8aa9faf7c Mon Sep 17 00:00:00 2001
+From: Carlos Santos <[email protected]>
+Date: Sun, 21 Jan 2018 23:44:46 -0200
+Subject: [PATCH 1/3] Appease GCC: snprintf outut size larger than destination
+ size
+
+GCC ignores that PCI function numbers range from 0 to 7, generations are
+up to 4 (5, by 2019 Q2) and link speeds are up to 16x. So it warns that
+snprintf output may be truncated in build_pci_header (in pcm-iio.cpp).
+
+Solve this by increasing the buffer sizes, since the additional three
+bytes are harmless. We could satisfy GCC by masking p.bdf.funcno and
+p.link_speed to 0x07, thus limitting the output to one decimal digit,
+and p.link_width to 0x1f (two decimal digits). This approach, however,
+would hide invalid arguments, preventing the user from noticing the
+error.
+
+Signed-off-by: Carlos Santos <[email protected]>
+---
+ pcm-iio.cpp | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/pcm-iio.cpp b/pcm-iio.cpp
+index f336bf3..1904296 100644
+--- a/pcm-iio.cpp
++++ b/pcm-iio.cpp
+@@ -153,8 +153,8 @@ vector<struct data> prepare_data(const vector<uint64_t> &values, const vector<st
+ string build_pci_header(const PCIDB & pciDB, uint32_t column_width, struct pci p, int part = -1, uint32_t level = 0)
+ {
+     string s = "|";
+-    char bdf_buf[8];
+-    char speed_buf[9];
++    char bdf_buf[10];
++    char speed_buf[10];
+     char vid_did_buf[10];
+     char device_name_buf[128];
+ 
+-- 
+2.14.3
+
package/pcm-tools/0002-Look-for-pci.ids-at-usr-share-hwdata.patch new file +34 -0
new file mode 100644
index 0000000000..4c04589867
@@ -0,0 +1,34 @@
+From 9213e92ec5aaee0e319b94f9501458e44e7873ba Mon Sep 17 00:00:00 2001
+From: Carlos Santos <[email protected]>
+Date: Tue, 23 Jan 2018 08:27:49 -0200
+Subject: [PATCH 2/3] Look for pci.ids at /usr/share/hwdata
+
+For Buildroot, on which pci.ids is provided by the "hwdata" package.
+
+Signed-off-by: Carlos Santos <[email protected]>
+---
+ lspci.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/lspci.h b/lspci.h
+index 29312a7..1d922fc 100644
+--- a/lspci.h
++++ b/lspci.h
+@@ -179,12 +179,12 @@ void print_pci(struct pci p, const PCIDB & pciDB)
+ 
+ void load_PCIDB(PCIDB & pciDB)
+ {
+-    std::ifstream in("pci.ids");
++    std::ifstream in("/usr/share/hwdata/pci.ids");
+     std::string line, item;
+ 
+     if (!in.is_open())
+     {
+-        std::cerr << "pci.ids file is not available. Download it from https://raw.githubusercontent.com/pciutils/pciids/master/pci.ids " << endl;
++        std::cerr << "/usr/share/hwdata/pci.ids file is not available. Ensure that the \"hwdata\" package is properly installed." << endl;
+         return;
+     }
+ 
+-- 
+2.14.3
+
package/pcm-tools/0003-Look-for-pcm-core-at-usr-bin.patch new file +12 -0
new file mode 100644
index 0000000000..92dc06c197
@@ -0,0 +1,28 @@
+From bef36c901e7f2cca3c21ee057b75f73065830774 Mon Sep 17 00:00:00 2001
+From: Carlos Santos <[email protected]>
+Date: Tue, 23 Jan 2018 10:56:55 -0200
+Subject: [PATCH 3/3] Look for pcm-core at /usr/bin
+
+For Buildroot, on which pcm-core.x ins installed as /usr/bin/pcm-core.
+
+Signed-off-by: Carlos Santos <[email protected]>
+---
+ pmu-query.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+

package/pcm-tools/0003-Look-for-pcm-core-at-usr-bin.patch line 22

Quoted 10 lines
package/pcm-tools/0003-Look-for-pcm-core-at-usr-bin.patch new file +10 -0
+diff --git a/pmu-query.py b/pmu-query.py
+index 4c596c7..71aa1b1 100755
+--- a/pmu-query.py
++++ b/pmu-query.py
+@@ -43,7 +43,7 @@ if filename == None:
+     elif platform.system() == 'Windows':
+         p = subprocess.Popen(['pcm-core.exe -c'],stdout=subprocess.PIPE,shell=True)
+     else:
+-        p = subprocess.Popen(['./pcm-core.x -c'],stdout=subprocess.PIPE,shell=True)
++        p = subprocess.Popen(['/usr/bin/pcm-core -c'],stdout=subprocess.PIPE,shell=True)

Maybe you can just remove "./" instead of hard-code the binary path.

Quoted 29 lines
package/pcm-tools/0003-Look-for-pcm-core-at-usr-bin.patch new file +6 -0
+ 
+     (output, err) = p.communicate()
+     p_status = p.wait()
+-- 
+2.14.3
+
package/pcm-tools/Config.in new file +17 -0
new file mode 100644
index 0000000000..a59c41c3e6
@@ -0,0 +1,33 @@
+config BR2_PACKAGE_PCM_TOOLS
+	bool "pcm-tools"
+	depends on BR2_i386 || BR2_x86_64
+	select BR2_PACKAGE_HWDATA
+	select BR2_PACKAGE_HWDATA_PCI_IDS> +	help
+	  Processor Counter Monitor (PCM) is an application programming
+	  interface (API) and a set of tools based on the API to monitor
+	  performance and energy metrics of Intel(R) Core(TM), Xeon(R),
+	  Atom(TM) and Xeon Phi(TM) processors.
+
+	  Requires a kernel with X86_MSR enabled.
+
+	  https://github.com/opcm/pcm
+
+if BR2_PACKAGE_PCM_TOOLS
+
+# The pmu-query script is not compatible with Python 3

package/pcm-tools/Config.in line 27

Quoted 10 lines
package/pcm-tools/Config.in new file +10 -0
+config BR2_PACKAGE_PCM_TOOLS_PMU_QUERY_REQS
+	bool
+	default y
+	depends on BR2_PACKAGE_PYTHON && BR2_PACKAGE_PYTHON_SSL && BR2_PACKAGE_PYTHON_HASHLIB # urllib2
+	depends on BR2_PACKAGE_CA_CERTIFICATES # https> +
+config BR2_PACKAGE_PCM_TOOLS_PMU_QUERY
+	bool "install the pmu-query script"
+	default y
+	depends on BR2_PACKAGE_PCM_TOOLS_PMU_QUERY_REQS
+

BR2_PACKAGE_CA_CERTIFICATES, BR2_PACKAGE_PYTHON_SSL and BR2_PACKAGE_PYTHON_HASHLIB should be selected here instead.

Quoted 37 lines
package/pcm-tools/Config.in new file +4 -0
+comment "pmu-query needs Python 2.x w/ ssl + hashlib modules, ca-certificates"
+	depends on !BR2_PACKAGE_PCM_TOOLS_PMU_QUERY_REQS
+
+endif
package/pcm-tools/pcm-tools.hash new file +3 -0
new file mode 100644
index 0000000000..7646dfddee
@@ -0,0 +1,3 @@
+# Locally calculated
+sha256 772c7b6310ba9c89931ff6108cc71fa0cbe20540ab6a53503f5f61594c9f661d pcm-tools-201710.tar.gz
+sha256 fac73f62c4d665c82622862a2be2b89713e0f480c93e593af2d8ef29a13d814b LICENSE
package/pcm-tools/pcm-tools.mk new file +18 -0
new file mode 100644
index 0000000000..53c73621c9
@@ -0,0 +1,31 @@
+################################################################################
+#
+# pcm-tools
+#
+################################################################################
+
+PCM_TOOLS_VERSION = 201710
+PCM_TOOLS_SITE = $(call github,opcm,pcm,$(PCM_TOOLS_VERSION))
+PCM_TOOLS_LICENSE = BSD-3-Clause
+PCM_TOOLS_LICENSE_FILES = LICENSE
+
+PCM_TOOLS_EXE_FILES = \
+	pcm-core pcm-iio pcm-lspci pcm-memory pcm-msr pcm-numa \
+	pcm-pcie pcm-power pcm-sensor pcm-tsx pcm
+
+define PCM_TOOLS_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) \
+		UNAME=Linux HOST=_LINUX CC="$(TARGET_CC)"

package/pcm-tools/pcm-tools.mk line 28

Quoted 10 lines
package/pcm-tools/pcm-tools.mk new file +10 -0
+endef
+
+define PCM_TOOLS_INSTALL_TARGET_CMDS
+	$(Q) set -x -e; \
+	for f in $(PCM_TOOLS_EXE_FILES); do \
+		$(INSTALL) -D -m 755 $(@D)/$$f.x $(TARGET_DIR)/usr/bin/$$f; \
+	done;> +	if test "$(BR2_PACKAGE_PCM_TOOLS_PMU_QUERY)" = "y"; then \
+		$(INSTALL) -D -m 755 $(@D)/pmu-query.py $(TARGET_DIR)/usr/bin/pmu-query; \
+	fi
+endef

This can be done by another define BR2_PACKAGE_PCM_TOOLS_INSTALL_PMU_QUERY

ifeq ($(BR2_PACKAGE_PCM_TOOLS_PMU_QUERY),y)
define BR2_PACKAGE_PCM_TOOLS_INSTALL_PMU_QUERY

    $(INSTALL) -D -m 755 $(@D)/pmu-query.py $(TARGET_DIR)/usr/bin/pmu-query;

endef
endif

then

define PCM_TOOLS_INSTALL_TARGET_CMDS

        ...
	$(BR2_PACKAGE_PCM_TOOLS_INSTALL_PMU_QUERY)

endef

Best regards,
Romain

Quoted 3 lines
package/pcm-tools/pcm-tools.mk new file +2 -0
+
+$(eval $(generic-package))
#3 lore raw

PATCH 1/1 pcm-tools: new package

In reply to Carlos Santos

Hello,

Here are some additional comments, on top of the ones made by Romain.

Quoted 14 lines · Carlos Santos
package/pcm-tools/0001-Appease-GCC-snprintf-outut-size-larger-than-destinat.patch new file +8 -0
new file mode 100644
index 0000000000..5d77ebfcb6
@@ -0,0 +1,40 @@
+From d07d6602ac2d4c90f7e448bdc5b780e8aa9faf7c Mon Sep 17 00:00:00 2001
+From: Carlos Santos <[email protected]>
+Date: Sun, 21 Jan 2018 23:44:46 -0200
+Subject: [PATCH 1/3] Appease GCC: snprintf outut size larger than destination
+ size
+
+GCC ignores that PCI function numbers range from 0 to 7, generations are
+up to 4 (5, by 2019 Q2) and link speeds are up to 16x. So it warns that

package/pcm-tools/0001-Appease-GCC-snprintf-outut-size-larger-than-destinat.patch line 18

Quoted 10 lines
package/pcm-tools/0001-Appease-GCC-snprintf-outut-size-larger-than-destinat.patch new file +10 -0
+snprintf output may be truncated in build_pci_header (in pcm-iio.cpp).
+
+Solve this by increasing the buffer sizes, since the additional three
+bytes are harmless. We could satisfy GCC by masking p.bdf.funcno and
+p.link_speed to 0x07, thus limitting the output to one decimal digit,
+and p.link_width to 0x1f (two decimal digits). This approach, however,
+would hide invalid arguments, preventing the user from noticing the
+error.
+
+Signed-off-by: Carlos Santos <[email protected]>

Have the patches been submitted upstream ?

package/pcm-tools/0002-Look-for-pci.ids-at-usr-share-hwdata.patch line 6

Quoted 12 lines
package/pcm-tools/0002-Look-for-pci.ids-at-usr-share-hwdata.patch new file +6 -0
new file mode 100644
index 0000000000..4c04589867
@@ -0,0 +1,34 @@
+From 9213e92ec5aaee0e319b94f9501458e44e7873ba Mon Sep 17 00:00:00 2001
+From: Carlos Santos <[email protected]>
+Date: Tue, 23 Jan 2018 08:27:49 -0200
+Subject: [PATCH 2/3] Look for pci.ids at /usr/share/hwdata
+
+For Buildroot, on which pci.ids is provided by the "hwdata" package.

It's not really nice to have Buildroot specific patches. Can you find a solution that is acceptable upstream ? Config option perhaps ?

Quoted 18 lines
package/pcm-tools/0003-Look-for-pcm-core-at-usr-bin.patch new file +12 -0
new file mode 100644
index 0000000000..92dc06c197
@@ -0,0 +1,28 @@
+From bef36c901e7f2cca3c21ee057b75f73065830774 Mon Sep 17 00:00:00 2001
+From: Carlos Santos <[email protected]>
+Date: Tue, 23 Jan 2018 10:56:55 -0200
+Subject: [PATCH 3/3] Look for pcm-core at /usr/bin
+
+For Buildroot, on which pcm-core.x ins installed as /usr/bin/pcm-core.
+
+Signed-off-by: Carlos Santos <[email protected]>
+---
+ pmu-query.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+

package/pcm-tools/0003-Look-for-pcm-core-at-usr-bin.patch line 22

Quoted 10 lines
package/pcm-tools/0003-Look-for-pcm-core-at-usr-bin.patch new file +10 -0
+diff --git a/pmu-query.py b/pmu-query.py
+index 4c596c7..71aa1b1 100755
+--- a/pmu-query.py
++++ b/pmu-query.py
+@@ -43,7 +43,7 @@ if filename == None:
+     elif platform.system() == 'Windows':
+         p = subprocess.Popen(['pcm-core.exe -c'],stdout=subprocess.PIPE,shell=True)
+     else:
+-        p = subprocess.Popen(['./pcm-core.x -c'],stdout=subprocess.PIPE,shell=True)
++        p = subprocess.Popen(['/usr/bin/pcm-core -c'],stdout=subprocess.PIPE,shell=True)

Same here, can we find an upstreamable solution, ideally ?

package/pcm-tools/0003-Look-for-pcm-core-at-usr-bin.patch

Quoted 8 lines
package/pcm-tools/0003-Look-for-pcm-core-at-usr-bin.patch new file +8 -0
+if BR2_PACKAGE_PCM_TOOLS
+
+# The pmu-query script is not compatible with Python 3
+config BR2_PACKAGE_PCM_TOOLS_PMU_QUERY_REQS
+	bool
+	default y
+	depends on BR2_PACKAGE_PYTHON && BR2_PACKAGE_PYTHON_SSL && BR2_PACKAGE_PYTHON_HASHLIB # urllib2
+	depends on BR2_PACKAGE_CA_CERTIFICATES # https

There's really no need for a separate BR2_PACKAGE_PCM_TOOLS_PMU_QUERY_REQS option, just put the selects/depends on inside BR2_PACKAGE_PCM_TOOLS_PMU_QUERY.

As Romain said, only "depends on BR2_PACKAGE_PYTHON" should remain a "depends on", everything else should be a "select".

package/pcm-tools/0003-Look-for-pcm-core-at-usr-bin.patch

Quoted 8 lines
package/pcm-tools/0003-Look-for-pcm-core-at-usr-bin.patch new file +8 -0
+
+config BR2_PACKAGE_PCM_TOOLS_PMU_QUERY
+	bool "install the pmu-query script"
+	default y
+	depends on BR2_PACKAGE_PCM_TOOLS_PMU_QUERY_REQS
+
+comment "pmu-query needs Python 2.x w/ ssl + hashlib modules, ca-certificates"
+	depends on !BR2_PACKAGE_PCM_TOOLS_PMU_QUERY_REQS

Which simplifies that quite a lot.

package/pcm-tools/0003-Look-for-pcm-core-at-usr-bin.patch

Quoted 12 lines
package/pcm-tools/0003-Look-for-pcm-core-at-usr-bin.patch new file +12 -0
+PCM_TOOLS_VERSION = 201710
+PCM_TOOLS_SITE = $(call github,opcm,pcm,$(PCM_TOOLS_VERSION))
+PCM_TOOLS_LICENSE = BSD-3-Clause
+PCM_TOOLS_LICENSE_FILES = LICENSE
+
+PCM_TOOLS_EXE_FILES = \
+	pcm-core pcm-iio pcm-lspci pcm-memory pcm-msr pcm-numa \
+	pcm-pcie pcm-power pcm-sensor pcm-tsx pcm
+
+define PCM_TOOLS_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) \
+		UNAME=Linux HOST=_LINUX CC="$(TARGET_CC)"

TARGET_CONFIGURE_OPTS already contains CC="$(TARGET_CC)"

package/pcm-tools/0003-Look-for-pcm-core-at-usr-bin.patch

Quoted 9 lines
package/pcm-tools/0003-Look-for-pcm-core-at-usr-bin.patch new file +9 -0
+define PCM_TOOLS_INSTALL_TARGET_CMDS
+	$(Q) set -x -e; \
+	for f in $(PCM_TOOLS_EXE_FILES); do \
+		$(INSTALL) -D -m 755 $(@D)/$$f.x $(TARGET_DIR)/usr/bin/$$f; \
+	done;
+	if test "$(BR2_PACKAGE_PCM_TOOLS_PMU_QUERY)" = "y"; then \
+		$(INSTALL) -D -m 755 $(@D)/pmu-query.py $(TARGET_DIR)/usr/bin/pmu-query; \
+	fi
+endef

That's not a very Buildroot-ish way of doing this. Here is a more Buildroot-ish solution:

ifeq ($(BR2_PACKAGE_PCM_TOOLS_PMU_QUERY),y)
define PCM_TOOLS_INSTALL_PMU_QUERY

	$(INSTALL) -D -m 755 $(@D)/pmu-query.py $(TARGET_DIR)/usr/bin/pmu-query

endef
endif

define PCM_TOOLS_INSTALL_TARGET_CMDS

	$(foreach f,$(PCM_TOOLS_EXE_FILES),\
		$(INSTALL) -D -m 755 $(@D)/$(f).x $(TARGET_DIR)/usr/bin/$(f)
	)
	$(PCM_TOOLS_INSTALL_PMU_QUERY)

endef

Could you rework your patch to take into Romain's comments and the above comments ?

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
#4 lore raw

PATCH 1/1 pcm-tools: new package

Quoted 33 lines

From: "Thomas Petazzoni" <[email protected]>
To: "Carlos Santos" <[email protected]>
Cc: "buildroot" <[email protected]>
Sent: Sunday, April 1, 2018 11:16:54 AM
Subject: Re: [Buildroot] [PATCH] pcm-tools: new package

Hello,

Here are some additional comments, on top of the ones made by Romain.

Quoted 21 lines · Carlos Santos

diff --git a/package/pcm-tools/0001-Appease-GCC-snprintf-outut-size-larger-than-destinat.patch b/package/pcm-tools/0001-Appease-GCC-snprintf-outut-size-larger-than-destinat.patch new file mode 100644
index 0000000000..5d77ebfcb6
--- /dev/null
+++
b/package/pcm-tools/0001-Appease-GCC-snprintf-outut-size-larger-than-destinat.patch

package/pcm-tools/0001-Appease-GCC-snprintf-outut-size-larger-than-destinat.patch new file +12 -0
@@ -0,0 +1,40 @@
+From d07d6602ac2d4c90f7e448bdc5b780e8aa9faf7c Mon Sep 17 00:00:00 2001
+From: Carlos Santos <[email protected]>
+Date: Sun, 21 Jan 2018 23:44:46 -0200
+Subject: [PATCH 1/3] Appease GCC: snprintf outut size larger than destination
+ size
+
+GCC ignores that PCI function numbers range from 0 to 7, generations are
+up to 4 (5, by 2019 Q2) and link speeds are up to 16x. So it warns that
+snprintf output may be truncated in build_pci_header (in pcm-iio.cpp).
+
+Solve this by increasing the buffer sizes, since the additional three
+bytes are harmless. We could satisfy GCC by masking p.bdf.funcno and
Quoted 8 lines

package/pcm-tools/0001-Appease-GCC-snprintf-outut-size-larger-than-destinat.patch line 18

Quoted 6 lines
package/pcm-tools/0001-Appease-GCC-snprintf-outut-size-larger-than-destinat.patch new file +6 -0
+p.link_speed to 0x07, thus limitting the output to one decimal digit,
+and p.link_width to 0x1f (two decimal digits). This approach, however,
+would hide invalid arguments, preventing the user from noticing the
+error.
+
+Signed-off-by: Carlos Santos <[email protected]>

Have the patches been submitted upstream ?

The first patch was already accepted upstream.

Quoted 8 lines
Quoted 8 lines
package/pcm-tools/0002-Look-for-pci.ids-at-usr-share-hwdata.patch new file +1 -0
new file mode 100644
index 0000000000..4c04589867
@@ -0,0 +1,34 @@
+From 9213e92ec5aaee0e319b94f9501458e44e7873ba Mon Sep 17 00:00:00 2001
Quoted 8 lines

package/pcm-tools/0002-Look-for-pci.ids-at-usr-share-hwdata.patch line 6

Quoted 5 lines
package/pcm-tools/0002-Look-for-pci.ids-at-usr-share-hwdata.patch new file +5 -0
+From: Carlos Santos <[email protected]>
+Date: Tue, 23 Jan 2018 08:27:49 -0200
+Subject: [PATCH 2/3] Look for pci.ids at /usr/share/hwdata
+
+For Buildroot, on which pci.ids is provided by the "hwdata" package.

It's not really nice to have Buildroot specific patches. Can you find a solution that is acceptable upstream ? Config option perhaps ?

They are necessary to deal with specific path where files are installed in Buildroot builds. Anyway, I will try to find a way to make them more generic.

Quoted 49 lines
Quoted 22 lines
package/pcm-tools/0003-Look-for-pcm-core-at-usr-bin.patch new file +15 -0
new file mode 100644
index 0000000000..92dc06c197
@@ -0,0 +1,28 @@
+From bef36c901e7f2cca3c21ee057b75f73065830774 Mon Sep 17 00:00:00 2001
+From: Carlos Santos <[email protected]>
+Date: Tue, 23 Jan 2018 10:56:55 -0200
+Subject: [PATCH 3/3] Look for pcm-core at /usr/bin
+
+For Buildroot, on which pcm-core.x ins installed as /usr/bin/pcm-core.
+
+Signed-off-by: Carlos Santos <[email protected]>
+---
+ pmu-query.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/pmu-query.py b/pmu-query.py
+index 4c596c7..71aa1b1 100755
+--- a/pmu-query.py

package/pcm-tools/0003-Look-for-pcm-core-at-usr-bin.patch

Quoted 10 lines
package/pcm-tools/0003-Look-for-pcm-core-at-usr-bin.patch new file +7 -3
++++ b/pmu-query.py
+@@ -43,7 +43,7 @@ if filename == None:
+     elif platform.system() == 'Windows':
+         p = subprocess.Popen(['pcm-core.exe
-c'],stdout=subprocess.PIPE,shell=True)
+     else:
+-        p = subprocess.Popen(['./pcm-core.x
-c'],stdout=subprocess.PIPE,shell=True)
++        p = subprocess.Popen(['/usr/bin/pcm-core
-c'],stdout=subprocess.PIPE,shell=True)

Same here, can we find an upstreamable solution, ideally ?

package/pcm-tools/0003-Look-for-pcm-core-at-usr-bin.patch

Quoted 9 lines
package/pcm-tools/0003-Look-for-pcm-core-at-usr-bin.patch new file +7 -0
+if BR2_PACKAGE_PCM_TOOLS
+
+# The pmu-query script is not compatible with Python 3
+config BR2_PACKAGE_PCM_TOOLS_PMU_QUERY_REQS
+	bool
+	default y
+	depends on BR2_PACKAGE_PYTHON && BR2_PACKAGE_PYTHON_SSL &&

BR2_PACKAGE_PYTHON_HASHLIB # urllib2

package/pcm-tools/0003-Look-for-pcm-core-at-usr-bin.patch new file +1 -0
+	depends on BR2_PACKAGE_CA_CERTIFICATES # https

There's really no need for a separate BR2_PACKAGE_PCM_TOOLS_PMU_QUERY_REQS option, just put the selects/depends on inside BR2_PACKAGE_PCM_TOOLS_PMU_QUERY.

Quoted 2 lines

As Romain said, only "depends on BR2_PACKAGE_PYTHON" should remain a "depends on", everything else should be a "select".

OK

Quoted 47 lines

package/pcm-tools/0003-Look-for-pcm-core-at-usr-bin.patch

Quoted 8 lines
package/pcm-tools/0003-Look-for-pcm-core-at-usr-bin.patch new file +8 -0
+
+config BR2_PACKAGE_PCM_TOOLS_PMU_QUERY
+	bool "install the pmu-query script"
+	default y
+	depends on BR2_PACKAGE_PCM_TOOLS_PMU_QUERY_REQS
+
+comment "pmu-query needs Python 2.x w/ ssl + hashlib modules, ca-certificates"
+	depends on !BR2_PACKAGE_PCM_TOOLS_PMU_QUERY_REQS

Which simplifies that quite a lot.

package/pcm-tools/0003-Look-for-pcm-core-at-usr-bin.patch

Quoted 12 lines
package/pcm-tools/0003-Look-for-pcm-core-at-usr-bin.patch new file +12 -0
+PCM_TOOLS_VERSION = 201710
+PCM_TOOLS_SITE = $(call github,opcm,pcm,$(PCM_TOOLS_VERSION))
+PCM_TOOLS_LICENSE = BSD-3-Clause
+PCM_TOOLS_LICENSE_FILES = LICENSE
+
+PCM_TOOLS_EXE_FILES = \
+	pcm-core pcm-iio pcm-lspci pcm-memory pcm-msr pcm-numa \
+	pcm-pcie pcm-power pcm-sensor pcm-tsx pcm
+
+define PCM_TOOLS_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) \
+		UNAME=Linux HOST=_LINUX CC="$(TARGET_CC)"

TARGET_CONFIGURE_OPTS already contains CC="$(TARGET_CC)"

package/pcm-tools/0003-Look-for-pcm-core-at-usr-bin.patch

Quoted 9 lines
package/pcm-tools/0003-Look-for-pcm-core-at-usr-bin.patch new file +9 -0
+define PCM_TOOLS_INSTALL_TARGET_CMDS
+	$(Q) set -x -e; \
+	for f in $(PCM_TOOLS_EXE_FILES); do \
+		$(INSTALL) -D -m 755 $(@D)/$$f.x $(TARGET_DIR)/usr/bin/$$f; \
+	done;
+	if test "$(BR2_PACKAGE_PCM_TOOLS_PMU_QUERY)" = "y"; then \
+		$(INSTALL) -D -m 755 $(@D)/pmu-query.py $(TARGET_DIR)/usr/bin/pmu-query; \
+	fi
+endef

That's not a very Buildroot-ish way of doing this. Here is a more Buildroot-ish solution:

ifeq ($(BR2_PACKAGE_PCM_TOOLS_PMU_QUERY),y)
define PCM_TOOLS_INSTALL_PMU_QUERY

	$(INSTALL) -D -m 755 $(@D)/pmu-query.py $(TARGET_DIR)/usr/bin/pmu-query

endef
endif

define PCM_TOOLS_INSTALL_TARGET_CMDS

Quoted 8 lines
	$(foreach f,$(PCM_TOOLS_EXE_FILES),\
		$(INSTALL) -D -m 755 $(@D)/$(f).x $(TARGET_DIR)/usr/bin/$(f)
	)
	$(PCM_TOOLS_INSTALL_PMU_QUERY)

endef

Could you rework your patch to take into Romain's comments and the above comments ?

I will submit an updated version of the series. Thanks for your review.

Signature · 4 lines
Carlos Santos (Casantos) - DATACOM, P&D
?The greatest triumph that modern PR can offer is the transcendent 
success of having your words and actions judged by your reputation, 
rather than the other way about.? ? Christopher Hitchens
#6 lore raw

PATCH 1/1 pcm-tools: new package

Hello Carlos,

Quoted 1 line · Carlos Santos

Superseded-by: https://patchwork.ozlabs.org/patch/1009149/

I am wondering: is this Superseded-by really understood by patchwork to make a patch as Superseded? I don't see Superseded-by used in the patchwork code base.

I see that the patch was marked as Superseded in patchwork, was it done manually by you, or automatically thanks to this e-mail ?

If it was done manually by you, then I think it's not really useful to send this Superseded-by e-mail: we see in patchwork the latest version anyway, which is what is important.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#7 lore raw

PATCH 1/1 pcm-tools: new package

----- Original Message -----

Quoted 10 lines

From: "Thomas Petazzoni" <[email protected]>
To: "Carlos Santos" <[email protected]>
Cc: "buildroot" <[email protected]>, "Romain Naour" <[email protected]>
Sent: Sexta-feira, 7 de dezembro de 2018 9:15:59
Subject: Re: [Buildroot] [PATCH] pcm-tools: new package

Hello Carlos,

On Thu, 6 Dec 2018 23:32:15 -0200 (BRST), Carlos Santos wrote:

Quoted 8 lines
Quoted 1 line

Superseded-by: https://patchwork.ozlabs.org/patch/1009149/

I am wondering: is this Superseded-by really understood by patchwork to make a patch as Superseded? I don't see Superseded-by used in the patchwork code base.

I see that the patch was marked as Superseded in patchwork, was it done manually by you, or automatically thanks to this e-mail ?

Manually by me.

Quoted 3 lines

If it was done manually by you, then I think it's not really useful to send this Superseded-by e-mail: we see in patchwork the latest version anyway, which is what is important.

I use them to leave a track of my patches, since patchwork does not help much (smells like 1980, in fact, even tough it was written much later).

Signature · 1 line
Carlos Santos (Casantos) - DATACOM, P&D
#8 lore raw

PATCH v2 1/1 pcm-tools: new package

In reply to Carlos Santos

Processor Counter Monitor (PCM) is an application programming interface (API) and a set of tools based on the API to monitor performance and energy metrics of Intel(R) Core(TM), Xeon(R), Atom(TM) and Xeon Phi(TM) processors.

This package contains a patch on the pmu-query.py script to look for the pcm-core program at the default path. It's not nice to have a Buildroot specific patch but let's use one while we look for a solution that is acceptable upstream.

---
Supersedes: https://patchwork.ozlabs.org/patch/864801/
CC: Romain Naour <[email protected]>
CC: Thomas Petazzoni <[email protected]>
---
Changes v1->v2
- Update to version 201812
- Do not build the test daemon
- Drop the patch on the test daemon, that we don't build
- Drop a patch already applied upstream
- Update the pmu-query.py patch
- Make the changes suggested by Romain Naour and Thomas Petazzoni

---
 package/Config.in                             |  1 +
 ...ook-for-pcm-core-at-the-default-path.patch | 46 +++++++++++++++++++
 package/pcm-tools/Config.in                   | 30 ++++++++++++
 package/pcm-tools/pcm-tools.hash              |  3 ++
 package/pcm-tools/pcm-tools.mk                | 35 ++++++++++++++
 5 files changed, 115 insertions(+)
 create mode 100644 package/pcm-tools/0001-Look-for-pcm-core-at-the-default-path.patch
 create mode 100644 package/pcm-tools/Config.in
 create mode 100644 package/pcm-tools/pcm-tools.hash
 create mode 100644 package/pcm-tools/pcm-tools.mk
package/Config.in +1 -0
index fd9ef0737a..9c22439885 100644
@@ -115,6 +115,7 @@ menu "Debugging, profiling and benchmark"
 	source "package/nmon/Config.in"
 	source "package/oprofile/Config.in"
 	source "package/pax-utils/Config.in"
+	source "package/pcm-tools/Config.in"
 	source "package/pv/Config.in"
 	source "package/racehound/Config.in"
 	source "package/ramsmp/Config.in"
package/pcm-tools/0001-Look-for-pcm-core-at-the-default-path.patch new file +46 -0

46 lines not on this page · raw message

package/pcm-tools/Config.in new file +30 -0
new file mode 100644
index 0000000000..2be6a1667a
@@ -0,0 +1,30 @@
+config BR2_PACKAGE_PCM_TOOLS
+	bool "pcm-tools"
+	depends on BR2_i386 || BR2_x86_64
+	select BR2_PACKAGE_HWDATA
+	select BR2_PACKAGE_HWDATA_PCI_IDS
+	help
+	  Processor Counter Monitor (PCM) is an application programming
+	  interface (API) and a set of tools based on the API to monitor
+	  performance and energy metrics of Intel(R) Core(TM), Xeon(R),
+	  Atom(TM) and Xeon Phi(TM) processors.
+
+	  Requires a kernel with X86_MSR enabled.
+
+	  https://github.com/opcm/pcm
+
+if BR2_PACKAGE_PCM_TOOLS
+
+# The pmu-query script is not compatible with Python 3
+config BR2_PACKAGE_PCM_TOOLS_PMU_QUERY
+	bool "install the pmu-query script"
+	default y
+	depends on BR2_PACKAGE_PYTHON
+	select BR2_PACKAGE_CA_CERTIFICATES # https
+	select BR2_PACKAGE_PYTHON_HASHLIB # urllib2
+	select BR2_PACKAGE_PYTHON_SSL # urllib2
+
+comment "pmu-query needs Python 2.x"
+	depends on !BR2_PACKAGE_PYTHON
+
+endif
package/pcm-tools/pcm-tools.hash new file +3 -0
new file mode 100644
index 0000000000..77f1482462
@@ -0,0 +1,3 @@
+# Locally calculated
+sha256 798eb1bc5d9c34fa107de21b2100e8d4326cb45b613bc35baa1e1efb1dd13b04  pcm-tools-201812.tar.gz
+sha256 fac73f62c4d665c82622862a2be2b89713e0f480c93e593af2d8ef29a13d814b  LICENSE
package/pcm-tools/pcm-tools.mk new file +35 -0
new file mode 100644
index 0000000000..c0d6d8bc52
@@ -0,0 +1,35 @@
+################################################################################
+#
+# pcm-tools
+#
+################################################################################
+
+PCM_TOOLS_VERSION = 201812
+PCM_TOOLS_SITE = $(call github,opcm,pcm,$(PCM_TOOLS_VERSION))
+PCM_TOOLS_LICENSE = BSD-3-Clause
+PCM_TOOLS_LICENSE_FILES = LICENSE
+
+PCM_TOOLS_EXE_FILES = \
+	pcm-core pcm-iio pcm-lspci pcm-memory pcm-msr pcm-numa \
+	pcm-pcicfg pcm-pcie pcm-power pcm-sensor pcm-tsx pcm
+
+define PCM_TOOLS_BUILD_CMDS
+	touch $(@D)/daemon-binaries
+	$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) \
+		UNAME=Linux HOST=_LINUX
+endef
+
+ifeq ($(BR2_PACKAGE_PCM_TOOLS_PMU_QUERY),y)
+define PCM_TOOLS_INSTALL_PMU_QUERY
+	$(INSTALL) -D -m 755 $(@D)/pmu-query.py $(TARGET_DIR)/usr/bin/pmu-query
+endef
+endif
+
+define PCM_TOOLS_INSTALL_TARGET_CMDS
+	$(foreach f,$(PCM_TOOLS_EXE_FILES),\
+		$(INSTALL) -D -m 755 $(@D)/$(f).x $(TARGET_DIR)/usr/bin/$(f)
+	)
+	$(PCM_TOOLS_INSTALL_PMU_QUERY)
+endef
+
+$(eval $(generic-package))
Signature · 1 line
2.19.2
#9 lore raw

PATCH v2 1/1 pcm-tools: new package

Quoted 26 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Carlos" == Carlos Santos <[email protected]> writes:

Processor Counter Monitor (PCM) is an application programming interface (API) and a set of tools based on the API to monitor performance and energy metrics of Intel(R) Core(TM), Xeon(R), Atom(TM) and Xeon Phi(TM) processors.

This package contains a patch on the pmu-query.py script to look for the pcm-core program at the default path. It's not nice to have a Buildroot specific patch but let's use one while we look for a solution that is acceptable upstream.

---
Supersedes: https://patchwork.ozlabs.org/patch/864801/
CC: Romain Naour <[email protected]>
CC: Thomas Petazzoni <[email protected]>
---
Changes v1->v2
- Update to version 201812
- Do not build the test daemon
- Drop the patch on the test daemon, that we don't build
- Drop a patch already applied upstream
- Update the pmu-query.py patch
- Make the changes suggested by Romain Naour and Thomas Petazzoni

package/pcm-tools/Config.in line 5

Quoted 5 lines
package/pcm-tools/Config.in new file +5 -0
+config BR2_PACKAGE_PCM_TOOLS
+	bool "pcm-tools"
+	depends on BR2_i386 || BR2_x86_64
+	select BR2_PACKAGE_HWDATA
+	select BR2_PACKAGE_HWDATA_PCI_IDS

It is written in C++, so I've added the BR2_INSTALL_LIBSTDCPP dependency and a comment.

package/pcm-tools/Config.in line 12

Quoted 7 lines
package/pcm-tools/Config.in new file +7 -0
+	help
+	  Processor Counter Monitor (PCM) is an application programming
+	  interface (API) and a set of tools based on the API to monitor
+	  performance and energy metrics of Intel(R) Core(TM), Xeon(R),
+	  Atom(TM) and Xeon Phi(TM) processors.
+
+	  Requires a kernel with X86_MSR enabled.

It makes more sense to just forcible enable it in linux.mk if pcm-tools is enabled, similar to how we do it for other packages.

Committed with these 2 fixes, thanks.

Signature · 1 line
Bye, Peter Korsgaard