Hello community,

here is the log from the commit of package pcp for openSUSE:Leap:15.2 checked 
in at 2020-03-23 07:13:09
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Leap:15.2/pcp (Old)
 and      /work/SRC/openSUSE:Leap:15.2/.pcp.new.3160 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "pcp"

Mon Mar 23 07:13:09 2020 rev:26 rq:786776 version:4.3.1

Changes:
--------
--- /work/SRC/openSUSE:Leap:15.2/pcp/pcp.changes        2020-02-16 
18:26:21.402656315 +0100
+++ /work/SRC/openSUSE:Leap:15.2/.pcp.new.3160/pcp.changes      2020-03-23 
07:13:10.198472458 +0100
@@ -1,0 +2,8 @@
+Wed Feb 26 10:57:30 UTC 2020 - Michal Suchanek <[email protected]>
+
+- hv24x7 support (bsc#1155054 ltc#182081).
+  + 0007-pmdas-perf-Add-cpunumber-option-for-dynamic-perf-eve.patch
+  + 0008-pmdas-perf-Add-support-for-hv_24x7-nest-events-on-mu.patch
+  + 0009-qa-perfevent-Test-hv_24x7-events-on-multinode.patch
+
+-------------------------------------------------------------------

New:
----
  0007-pmdas-perf-Add-cpunumber-option-for-dynamic-perf-eve.patch
  0008-pmdas-perf-Add-support-for-hv_24x7-nest-events-on-mu.patch
  0009-qa-perfevent-Test-hv_24x7-events-on-multinode.patch
  fakefs.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ pcp.spec ++++++
--- /var/tmp/diff_new_pack.dTjVNw/_old  2020-03-23 07:13:11.074472985 +0100
+++ /var/tmp/diff_new_pack.dTjVNw/_new  2020-03-23 07:13:11.078472987 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package pcp
 #
-# Copyright (c) 2019 SUSE LLC
+# Copyright (c) 2020 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -77,7 +77,7 @@
 Release:        0
 %global buildversion 1
 
-Url:            https://pcp.io
+URL:            https://pcp.io
 Source0:        pcp-%{version}.tar.bz2
 %if 0%{?suse_version}
 Source2:        pcp-rpmlintrc
@@ -95,6 +95,12 @@
 Patch6:         0006-pmsnap-control-var-www-srv-www.patch 
 # PATCH-FIX-UPSTREAM, [email protected]
 Patch7:         build-drop-old-config-file-transition-code-from-rpm-.patch
+# PATCH-FIX-UPSTREAM, bsc#1155054
+Patch8:         0007-pmdas-perf-Add-cpunumber-option-for-dynamic-perf-eve.patch
+Patch9:         0008-pmdas-perf-Add-support-for-hv_24x7-nest-events-on-mu.patch
+Patch10:        0009-qa-perfevent-Test-hv_24x7-events-on-multinode.patch
+# part of 0009-qa-perfevent-Test-hv_24x7-events-on-multinode.patch - binary 
patches not supported
+Source1:        fakefs.tar.gz
 
 %if 0%{?fedora} || 0%{?rhel}
 %global disable_selinux 0
@@ -438,7 +444,7 @@
 Summary:        Performance Co-Pilot run-time configuration
 License:        %{license_lgplv21plus}
 Group:          %{lib_gr}
-Url:            https://pcp.io
+URL:            https://pcp.io
 # http://fedoraproject.org/wiki/Packaging:Conflicts "Splitting Packages"
 Conflicts:      pcp-libs < 3.9
 
@@ -453,7 +459,7 @@
 Summary:        Performance Co-Pilot run-time libraries
 License:        %{license_lgplv21plus}
 Group:          %{lib_gr}
-Url:            https://pcp.io
+URL:            https://pcp.io
 Conflicts:      %{lib_pkg_conflict}
 Requires:       pcp-conf >= %{version}-%{release}
 
@@ -465,7 +471,7 @@
 Summary:        Performance Co-Pilot run-time GUI library
 License:        %{license_lgplv21plus}
 Group:          %{lib_gr}
-Url:            https://pcp.io
+URL:            https://pcp.io
 
 %description -n libpcp_gui%{libpcp_gui_sover}
 Performance Co-Pilot (PCP) run-time graphical user interface library
@@ -474,7 +480,7 @@
 Summary:        Performance Co-Pilot run-time MMV library
 License:        %{license_lgplv21plus}
 Group:          %{lib_gr}
-Url:            https://pcp.io
+URL:            https://pcp.io
 
 %description -n libpcp_mmv%{libpcp_mmv_sover}
 Performance Co-Pilot (PCP) run-time Memory Mapped Values library
@@ -483,7 +489,7 @@
 Summary:        Performance Co-Pilot run-time tracing library
 License:        %{license_lgplv21plus}
 Group:          %{lib_gr}
-Url:            https://pcp.io
+URL:            https://pcp.io
 
 %description -n libpcp_trace%{libpcp_trace_sover}
 Performance Co-Pilot (PCP) run-time tracing library
@@ -492,7 +498,7 @@
 Summary:        Performance Co-Pilot run-time import library
 License:        %{license_lgplv21plus}
 Group:          %{lib_gr}
-Url:            https://pcp.io
+URL:            https://pcp.io
 
 %description -n libpcp_import%{libpcp_import_sover}
 Performance Co-Pilot (PCP) run-time import library
@@ -501,7 +507,7 @@
 Summary:        Performance Co-Pilot run-time web library
 License:        %{license_lgplv21plus}
 Group:          %{lib_gr}
-Url:            https://pcp.io
+URL:            https://pcp.io
 
 %description -n libpcp_web%{libpcp_web_sover}
 Performance Co-Pilot (PCP) run-time web library
@@ -515,7 +521,7 @@
 Summary:        Performance Co-Pilot (PCP) development headers
 License:        %{license_gplv2plus} AND %{license_lgplv21plus}
 Group:          %{lib_devel_gr}
-Url:            https://pcp.io
+URL:            https://pcp.io
 Requires:       %{lib_pkg} = %{version}-%{release}
 Conflicts:      %{lib_devel_pkg_conflict}
 %if (0%{?suse_version} > 0)
@@ -533,7 +539,7 @@
 Summary:        Performance Co-Pilot (PCP) development tools and documentation
 License:        %{license_gplv2plus} AND %{license_lgplv21plus}
 Group:          %{lib_devel_gr}
-Url:            https://pcp.io
+URL:            https://pcp.io
 %if !0%{?suse_version}
 Requires:       %{lib_devel_pkg} = %{version}-%{release}
 Requires:       %{lib_pkg} = %{version}-%{release}
@@ -550,7 +556,7 @@
 Summary:        Performance Co-Pilot (PCP) test suite
 License:        %{license_gplv2plus} AND %{license_mit}
 Group:          %{lib_devel_gr}
-Url:            https://pcp.io
+URL:            https://pcp.io
 %if !0%{?suse_version}
 Requires:       %{lib_devel_pkg} = %{version}-%{release}
 Requires:       %{lib_pkg} = %{version}-%{release}
@@ -569,7 +575,7 @@
 Summary:        Performance Co-Pilot (PCP) manager daemon
 License:        %{license_gplv2plus}
 Group:          %{pcp_gr}
-Url:            https://pcp.io
+URL:            https://pcp.io
 %if !0%{?suse_version}
 Requires:       %{lib_pkg} = %{version}-%{release}
 %endif
@@ -591,7 +597,7 @@
 Summary:        Performance Co-Pilot (PCP) web API service
 License:        %{license_gplv2plus}
 Group:          %{pcp_gr}
-Url:            https://pcp.io
+URL:            https://pcp.io
 %if !0%{?suse_version}
 Requires:       %{lib_pkg} = %{version}-%{release}
 %endif
@@ -610,7 +616,7 @@
 Summary:        Performance Co-Pilot (PCP) Perl bindings and documentation
 License:        %{license_gplv2plus}
 Group:          %{lib_devel_gr}
-Url:            https://pcp.io
+URL:            https://pcp.io
 %if 0%{?suse_version}
 %perl_requires
 %endif
@@ -630,7 +636,7 @@
 Summary:        Performance Co-Pilot (PCP) Perl bindings for PCP Memory Mapped 
Values
 License:        %{license_gplv2plus}
 Group:          %{lib_devel_gr}
-Url:            https://pcp.io
+URL:            https://pcp.io
 %if 0%{?suse_version}
 %perl_requires
 %endif
@@ -651,7 +657,7 @@
 Summary:        Performance Co-Pilot Perl bindings for importing external 
archive data
 License:        %{license_gplv2plus}
 Group:          %{lib_devel_gr}
-Url:            https://pcp.io
+URL:            https://pcp.io
 %if 0%{?suse_version}
 %perl_requires
 %endif
@@ -669,7 +675,7 @@
 Summary:        Performance Co-Pilot Perl bindings for processing pmlogsummary 
output
 License:        %{license_gplv2plus}
 Group:          %{lib_devel_gr}
-Url:            https://pcp.io
+URL:            https://pcp.io
 %if 0%{?suse_version}
 %perl_requires
 %endif
@@ -690,7 +696,7 @@
 Summary:        Performance Co-Pilot archive tools for importing sar data
 License:        %{license_lgplv2plus}
 Group:          %{pcp_gr}
-Url:            https://pcp.io
+URL:            https://pcp.io
 %if !0%{?suse_version}
 Requires:       %{lib_pkg} = %{version}-%{release}
 %endif
@@ -708,7 +714,7 @@
 Summary:        Performance Co-Pilot archive tools for importing iostat data
 License:        %{license_lgplv2plus}
 Group:          %{pcp_gr}
-Url:            https://pcp.io
+URL:            https://pcp.io
 %if !0%{?suse_version}
 Requires:       %{lib_pkg} = %{version}-%{release}
 %endif
@@ -727,7 +733,7 @@
 Summary:        Performance Co-Pilot archive tools for importing spreadsheet 
data
 License:        %{license_lgplv2plus}
 Group:          %{pcp_gr}
-Url:            https://pcp.io
+URL:            https://pcp.io
 %if !0%{?suse_version}
 Requires:       %{lib_pkg} = %{version}-%{release}
 %endif
@@ -747,7 +753,7 @@
 Summary:        Performance Co-Pilot archive tools for importing MTRG data
 License:        %{license_lgplv2plus}
 Group:          %{pcp_gr}
-Url:            https://pcp.io
+URL:            https://pcp.io
 %if !0%{?suse_version}
 Requires:       %{lib_pkg} = %{version}-%{release}
 %endif
@@ -764,7 +770,7 @@
 Summary:        Performance Co-Pilot archive tools for importing ganglia data
 License:        %{license_lgplv2plus}
 Group:          %{pcp_gr}
-Url:            https://pcp.io
+URL:            https://pcp.io
 %if !0%{?suse_version}
 Requires:       %{lib_pkg} = %{version}-%{release}
 %endif
@@ -781,7 +787,7 @@
 Summary:        Performance Co-Pilot archive tools for importing collectl data
 License:        %{license_lgplv2plus}
 Group:          %{pcp_gr}
-Url:            https://pcp.io
+URL:            https://pcp.io
 %if !0%{?suse_version}
 Requires:       %{lib_pkg} = %{version}-%{release}
 %endif
@@ -797,7 +803,7 @@
 Summary:        Module for exporting from PCP into a Zabbix agent daemon
 License:        %{license_gplv2plus}
 Group:          %{pcp_gr}
-Url:            https://pcp.io
+URL:            https://pcp.io
 %if !0%{?suse_version}
 Requires:       %{lib_pkg} >= %{version}-%{release}
 %endif
@@ -838,7 +844,7 @@
 Summary:        Performance Co-Pilot tools for exporting PCP metrics to 
Graphite
 License:        %{license_gplv2plus}
 Group:          %{pcp_gr}
-Url:            https://pcp.io
+URL:            https://pcp.io
 %if !0%{?suse_version}
 Requires:       %{lib_pkg} = %{version}-%{release}
 %endif
@@ -985,7 +991,7 @@
 Summary:        Performance Co-Pilot (PCP) metrics for Performance API and 
hardware counters
 License:        %{license_gplv2plus}
 Group:          %{pcp_gr}
-Url:            https://pcp.io
+URL:            https://pcp.io
 %if !0%{?suse_version}
 Requires:       %{lib_pkg} = %{version}-%{release}
 %endif
@@ -1004,7 +1010,7 @@
 Summary:        Performance Co-Pilot (PCP) metrics for hardware counters
 License:        %{license_gplv2plus}
 Group:          %{pcp_gr}
-Url:            https://pcp.io
+URL:            https://pcp.io
 %if !0%{?suse_version}
 Requires:       %{lib_pkg} = %{version}-%{release}
 Requires:       libpfm >= 4.4
@@ -1024,7 +1030,7 @@
 Summary:        Performance Co-Pilot (PCP) metrics for Infiniband HCAs and 
switches
 License:        %{license_gplv2plus}
 Group:          %{pcp_gr}
-Url:            https://pcp.io
+URL:            https://pcp.io
 %if !0%{?suse_version}
 Requires:       %{lib_pkg} = %{version}-%{release}
 Requires:       libibmad >= 1.3.7
@@ -1046,7 +1052,7 @@
 Summary:        Performance Co-Pilot (PCP) metrics for ActiveMQ
 License:        %{license_gplv2plus}
 Group:          %{pcp_gr}
-Url:            https://pcp.io
+URL:            https://pcp.io
 Requires:       perl-PCP-PMDA = %{version}-%{release}
 Requires:       perl(LWP::UserAgent)
 
@@ -1062,7 +1068,7 @@
 Summary:        Performance Co-Pilot (PCP) metrics for BIND servers
 License:        %{license_gplv2plus}
 Group:          %{pcp_gr}
-Url:            https://pcp.io
+URL:            https://pcp.io
 Requires:       perl-PCP-PMDA = %{version}-%{release}
 Requires:       perl(File::Slurp)
 Requires:       perl(LWP::UserAgent)
@@ -1080,7 +1086,7 @@
 Summary:        Performance Co-Pilot (PCP) metrics for Redis
 License:        %{license_gplv2plus}
 Group:          %{pcp_gr}
-Url:            https://pcp.io
+URL:            https://pcp.io
 Requires:       perl-PCP-PMDA = %{version}-%{release}
 
 %description pmda-redis
@@ -2232,7 +2238,7 @@
 Summary:        Performance Co-Pilot (PCP) System and Monitoring Tools
 License:        %{license_gplv2plus}
 Group:          %{pcp_gr}
-Url:            https://pcp.io
+URL:            https://pcp.io
 %if !%{disable_python3}
 Requires:       python3-pcp = %{version}-%{release}
 %endif
@@ -2255,7 +2261,7 @@
 Summary:        Visualization tools for the Performance Co-Pilot toolkit
 License:        %{license_gplv2plus} AND %{license_lgplv2plus}
 Group:          %{pcp_gr}
-Url:            https://pcp.io
+URL:            https://pcp.io
 %if !0%{?suse_version}
 Requires:       %{lib_pkg} = %{version}-%{release}
 %endif
@@ -2277,7 +2283,7 @@
 Summary:        Documentation and tutorial for the Performance Co-Pilot
 License:        %{license_gplv2plus} AND %{license_cc_by}
 Group:          Documentation/Other
-Url:            https://pcp.io
+URL:            https://pcp.io
 # http://fedoraproject.org/wiki/Packaging:Conflicts "Splitting Packages"
 # (all man pages migrated to pcp-doc during great package split of '15)
 Conflicts:      pcp-pmda-pmda < 3.10.5
@@ -2302,7 +2308,7 @@
 Summary:        Selinux policy package
 License:        %{license_gplv2plus} AND %{license_cc_by}
 Group:          Applications/System
-Url:            https://pcp.io
+URL:            https://pcp.io
 BuildRequires:  selinux-policy-devel
 %if 0%{?rhel} == 5
 BuildRequires:  setools
@@ -2320,12 +2326,8 @@
 
 %prep
 %setup -q
-%patch1 -p1
-%patch2 -p1
-%patch3 -p1
-%patch5 -p1
-%patch6 -p1
-%patch7 -p1
+%autopatch -p1
+cp -v %{SOURCE1} qa/perfevent/fakefs.tar.gz
 
 autoconf
 

++++++ 0007-pmdas-perf-Add-cpunumber-option-for-dynamic-perf-eve.patch ++++++
>From 7392ce0cd29e3364989cde2a2342973c7540b72d Mon Sep 17 00:00:00 2001
From: Anju T Sudhakar <[email protected]>
Date: Tue, 15 Oct 2019 15:39:11 +0530
Subject: [PATCH] pmdas/perf: Add cpunumber option for dynamic perf events

Patch-mainline: 5.0.1
Git-commit: 7392ce0cd29e3364989cde2a2342973c7540b72d

For perf events defined under [dynamic] section, perf_event_open() is invoked
for the cpumask specified in /sysfs for that event. If no cpumask is
defined, then by default perf_event_open() is called for all cpus
in the system.

For dynamic events like, hv_24x7 nest events, we need perf-event_open()
to be invoked on a single cpu on each node to get the counter data.

Add support to have the cpu number in the perfevent.conf file for
dynamic events, and to use this as the cpumask for perf_event_open() call.

Eg:
---> perfevent.conf

[dynamic]
cpu.branch-misses 3
cpu.cache-references
software.page-faults
software.context-switches
hv_24x7.PM_PB_CYC 13    chip:1

# pmval perfevent.hwcounters.cpu.branch_misses.value

metric:    perfevent.hwcounters.cpu.branch_misses.value
host:      ####
semantics: cumulative counter (converting to rate)
units:     count (converting to count / sec)
samples:   all

              cpu3
               0.0
               0.0

Signed-off-by: Anju T Sudhakar <[email protected]>
---
 src/pmdas/perfevent/configparser.l  | 19 +++++++++++++--
 src/pmdas/perfevent/perfevent.conf  | 11 +++++++++
 src/pmdas/perfevent/perfinterface.c | 38 ++++++++++++++++++++---------
 3 files changed, 55 insertions(+), 13 deletions(-)

diff --git a/src/pmdas/perfevent/configparser.l 
b/src/pmdas/perfevent/configparser.l
index 29a322480eb1..83ff8c520786 100644
--- a/src/pmdas/perfevent/configparser.l
+++ b/src/pmdas/perfevent/configparser.l
@@ -195,7 +195,7 @@ static void add_pmc_setting_name_dynamic(configuration_t 
*config, char *name)
     }
     newpmcdynamicsetting = calloc(1, sizeof *newpmcdynamicsetting);
     newpmcdynamicsetting->name = strdup(name);
-    newpmcdynamicsetting->cpuConfig = 0;
+    newpmcdynamicsetting->cpuConfig = -1;
     newpmcdynamicsetting->scale = 1.0;
     newpmcdynamicsetting->need_perf_scale = 0;
     newpmcdynamicsetting->chip = -1;
@@ -315,7 +315,7 @@ static void set_pmcsetting_derived_scale(configuration_t 
*config,  double scale,
 
 static void set_pmcsetting_cpuconfig(configuration_t *config, int cpuconfig)
 {
-    pmcsetting_t *pmcsetting;
+    pmcsetting_t *pmcsetting, *list;
     pmcSettingLists_t *setting_lists;
 
     if( (NULL == config) || (0 == config->nConfigEntries) )
@@ -340,6 +340,21 @@ static void set_pmcsetting_cpuconfig(configuration_t 
*config, int cpuconfig)
             pmcsetting = pmcsetting->next;
         }
     }
+
+    else if (context_dynamic)
+    {
+        list = config->dynamicpmc->dynamicSettingList;
+        if (NULL == list)
+        {
+          return;
+        }
+        while (list->next)
+        {
+          list = list->next;
+        }
+        pmcsetting = list;
+    }
+
     else
     {
         pmcsetting = 
config->configArr[config->nConfigEntries-1].pmcSettingList;
diff --git a/src/pmdas/perfevent/perfevent.conf 
b/src/pmdas/perfevent/perfevent.conf
index 12d876f2b7d0..c8ca683ae380 100644
--- a/src/pmdas/perfevent/perfevent.conf
+++ b/src/pmdas/perfevent/perfevent.conf
@@ -25,6 +25,17 @@
 # If not specified like above, a user will continue to see the event but
 # will not be able to monitor it.
 #
+# For events, specified under dynamic section, the cpuconfig can also
+# be specified along with the event.
+# For eg:
+# [dynamic]
+# foo.bar [CPU NUMBER]
+#
+# If no cpu number is specified for events under [dynamic], then the cpumask
+# specified in /sys/bus/event_source/devices/ for that event is considered.
+# Suppose if cpumask is also not mentioned in /sys/ then the event is monitored
+# for all cpus in the system.
+#
 #
 # For derived events :
 # [event:derived]
diff --git a/src/pmdas/perfevent/perfinterface.c 
b/src/pmdas/perfevent/perfinterface.c
index 161e3fa102c8..e8b8fe490c84 100644
--- a/src/pmdas/perfevent/perfinterface.c
+++ b/src/pmdas/perfevent/perfinterface.c
@@ -699,20 +699,23 @@ static int perf_setup_dynamic_events(perfdata_t *inst,
     struct pmu_event *event_ptr;
     char eventname[BUF_SIZE];
     pmcsetting_t *ptr;
-    int disable_event;
+    int disable_event, cpusetting;
 
     for (pmu_ptr = pmu_list; pmu_ptr; pmu_ptr = pmu_ptr->next) {
         for (event_ptr = pmu_ptr->ev; event_ptr;
              event_ptr = event_ptr->next) {
             ncpus = 0;
             disable_event = 1;
+           cpusetting = -1;
             /* Setup the event name */
             pmsprintf(eventname, BUF_SIZE, "%s.%s", pmu_ptr->name,
                      event_ptr->name);
             for (ptr = dynamic_setting; ptr; ptr = ptr->next) {
                 if (!strncmp(eventname, ptr->name,
-                             strlen(eventname)))
+                             strlen(eventname))) {
                     disable_event = 0;
+                   cpusetting = ptr->cpuConfig;
+               }
             }
 
             /* Increase the size of event array */
@@ -726,15 +729,28 @@ static int perf_setup_dynamic_events(perfdata_t *inst,
             }
            events = evp;
 
-            setup_cpu_config(pmu_ptr, &ncpus, &cpumask);
-
-            if (ncpus <= 0) { /* Assume default cpu set */
-                cpuarr = archinfo->cpus.index;
-                ncpus = archinfo->cpus.count;
-            } else {
-                cpuarr = cpumask;
-            }
-
+           /*
+            * If dynamic events have a cpuconfig defined in the
+            * perfevent.conf, consider that
+            */
+           if(!(cpusetting < 0)) {
+               if (cpusetting < archinfo->cpus.count) {
+                   cpuarr = &archinfo->cpus.index[cpusetting];
+                   ncpus = 1;
+               }
+           } else {
+               /*
+                * If no cpuconfig specified in perfevent.conf
+                * setup the cpu config for this event
+                */
+               setup_cpu_config(pmu_ptr, &ncpus, &cpumask);
+               if (ncpus <= 0) { /* Assume default cpu set */
+                   cpuarr = archinfo->cpus.index;
+                   ncpus = archinfo->cpus.count;
+               } else {
+                   cpuarr = cpumask;
+               }
+           }
             event_t *curr = events + nevents;
             curr->name = strdup(eventname);
 
-- 
2.23.0

++++++ 0008-pmdas-perf-Add-support-for-hv_24x7-nest-events-on-mu.patch ++++++
>From 2251fbdda3b270fa1b1c5f59c83d1e156ff8ea36 Mon Sep 17 00:00:00 2001
From: Madhavan Srinivasan <[email protected]>
Date: Wed, 16 Oct 2019 16:09:04 +0530
Subject: [PATCH] pmdas/perf: Add support for hv_24x7 nest events on mutlinode
 system

Patch-mainline: 5.0.1
Git-commit: 2251fbdda3b270fa1b1c5f59c83d1e156ff8ea36

For dynamic perf events like hv_24x7 nest event, `chip_id` is also an
event parameter. So for multinode systems, same event can be defined for
different nodes(/chips) in the system.

Add support for hv_24x7 nest events in mutinode systems.

Eg:

---> perfevent.conf
[dynamic]
hv_24x7.PM_PB_CYC 4     chip:0
hv_24x7.PM_PB_CYC 13    chip:1
hv_24x7.PM_MBA0_CLK_CYC 4 chip:0
hv_24x7.PM_MBA0_CLK_CYC 14 chip:1

# pminfo | grep PM_PB_CYC
perfevent.hwcounters.hv_24x7.PM_PB_CYC_chip_1.dutycycle
perfevent.hwcounters.hv_24x7.PM_PB_CYC_chip_1.value
perfevent.hwcounters.hv_24x7.PM_PB_CYC_chip_0.dutycycle
perfevent.hwcounters.hv_24x7.PM_PB_CYC_chip_0.value

# pmval perfevent.hwcounters.hv_24x7.PM_PB_CYC_chip_0.value
metric:    perfevent.hwcounters.hv_24x7.PM_PB_CYC_chip_0.value
host:      ####
semantics: cumulative counter (converting to rate)
units:     count (converting to count / sec)
samples:   all

              cpu4
            7.805E+06

# pmval perfevent.hwcounters.hv_24x7.PM_PB_CYC_chip_1.value

metric:    perfevent.hwcounters.hv_24x7.PM_PB_CYC_chip_1.value
host:      ####
semantics: cumulative counter (converting to rate)
units:     count (converting to count / sec)
samples:   all

             cpu13
            7.805E+06
            7.805E+06

Signed-off-by: Madhavan Srinivasan <[email protected]>
Signed-off-by: Anju T Sudhakar <[email protected]>
---
 src/pmdas/perfevent/parse_events.c | 221 ++++++++++++++++++-----------
 1 file changed, 138 insertions(+), 83 deletions(-)

diff --git a/src/pmdas/perfevent/parse_events.c 
b/src/pmdas/perfevent/parse_events.c
index 1632f09b1f32..27fb37df3fb7 100644
--- a/src/pmdas/perfevent/parse_events.c
+++ b/src/pmdas/perfevent/parse_events.c
@@ -412,89 +412,138 @@ static void cleanup_property_info(struct property_info 
*pi)
  */
 static int parse_event_string(char *buf, struct pmu_event *event,
                               struct pmu *pmu, struct pmcsetting *dynamicpmc,
-                              char *pmu_name)
+                              char *pmu_name, int *new_events)
 {
     struct property_info *pi, *head = NULL, *tmp;
-    char *start, *ptr, *nptr, **endptr, *str, eventname[BUF_SIZE];
+    char *start, *ptr, *nptr, **endptr, *str, eventname[BUF_SIZE], 
ev_str[BUF_SIZE], pmc_str[BUF_SIZE], *tmp_buf_str;
     struct pmcsetting *pmctmp;
+    int i, ret, sub_ev_cnt = 0;
+    struct pmu_event *sub_event = NULL, *ev_tmp= NULL, *ev_head = NULL;
+
+    pmsprintf(ev_str, sizeof(ev_str), "%s.%s", pmu_name, event->name);
+    for (pmctmp = dynamicpmc; pmctmp; pmctmp = pmctmp->next)
+       if (!strncmp(ev_str, pmctmp->name, strlen(ev_str)))
+               sub_ev_cnt++;
+
+    if (sub_ev_cnt > 1)
+       *new_events = sub_ev_cnt;
+
+    for (i = 0; i < (sub_ev_cnt - 1); i++) {
+       ev_tmp = calloc(1, sizeof(*ev_tmp));
+       if (!ev_tmp) {
+               sub_ev_cnt = 0;
+               break;
+       }
+
+       if (!sub_event) {
+               sub_event = ev_tmp;
+               ev_head = sub_event;
+               event->next = ev_head;
+               sub_event->name = strdup(event->name);
+       } else {
+               sub_event->next = ev_tmp;
+               sub_event = sub_event->next;
+               sub_event->name = strdup(event->name);
+       }
+    }
 
-    start = buf;
-
-    while (1) {
-        ptr = strchr(start, '=');
-        if (!ptr)
-            break;
-
-        /* Found a property */
-        *ptr = '\0';
-        ptr++;   /* ptr now points to the value */
-        pi = calloc(1, sizeof(*pi));
-        if (!pi) {
-            cleanup_property_info(head);
-            return -E_PERFEVENT_REALLOC;
-        }
-        pi->next = NULL;
-
-        pi->name = strdup(start);
-        if (!pi->name) {
-            free(pi);
-            cleanup_property_info(head);
-            return -E_PERFEVENT_REALLOC;
-        }
-
-       pmsprintf(eventname, sizeof(eventname), "%s.%s", pmu_name, event->name);
-
-        /* Find next property */
-        start = strchr(ptr, ',');
-        if (!start) {
-            str = buf + strlen(buf) - 1;
-            endptr = &str;
-            nptr = ptr;
-           if ((!strcmp(nptr, "?")) && (!strcmp(pi->name, "chip"))) {
-               for (pmctmp = dynamicpmc; pmctmp; pmctmp = pmctmp->next) {
-                       if (!strncmp(eventname, pmctmp->name, 
strlen(eventname)))
+    ev_head = event;
+
+    for (i=0; i < sub_ev_cnt; i++) {
+        head = NULL;
+        tmp_buf_str = strdup(buf);
+        start = tmp_buf_str;
+
+       while (1) {
+           ptr = strchr(start, '=');
+           if (!ptr)
+               break;
+
+           /* Found a property */
+           *ptr = '\0';
+           ptr++;   /* ptr now points to the value */
+           pi = calloc(1, sizeof(*pi));
+           if (!pi) {
+               cleanup_property_info(head);
+               return -E_PERFEVENT_REALLOC;
+           }
+
+           pi->next = NULL;
+           pi->name = strdup(start);
+           if (!pi->name) {
+              free(pi);
+              cleanup_property_info(head);
+              return -E_PERFEVENT_REALLOC;
+           }
+
+           pmsprintf(eventname, sizeof(eventname), "%s.%s", pmu_name, 
event->name);
+
+           /* Find next property */
+           start = strchr(ptr, ',');
+           if (!start) {
+               str = buf + strlen(buf) - 1;
+               endptr = &str;
+               nptr = ptr;
+               if ((!strcmp(nptr, "?")) && (!strcmp(pi->name, "chip"))) {
+                   for (pmctmp = dynamicpmc; pmctmp; pmctmp = pmctmp->next) {
+                       if (!strncmp(eventname, pmctmp->name, 
strlen(pmctmp->name)))
                        {
-                            pi->value = pmctmp->chip;
+                           pmsprintf(ev_str, sizeof(ev_str), "%s_chip_%d", 
event->name,pmctmp->chip);
+                           event->name = strdup(ev_str);
+                           pmsprintf(pmc_str, sizeof(pmc_str), "%s_chip_%d", 
pmctmp->name,pmctmp->chip);
+                           pmctmp->name = strdup(pmc_str);
+                           pi->value = pmctmp->chip;
+                           break;
                        }
+                   }
+               } else
+                   pi->value = strtoull(nptr, endptr, 16);
+               if (!head) {
+                   head = pi;
+                   pi = pi->next;
+               } else {
+                   tmp->next = pi;
+                   tmp = tmp->next;
                }
-            } else
-               pi->value = strtoull(nptr, endptr, 16);
-            if (!head) {
-                head = pi;
-                pi = pi->next;
-            } else {
-                tmp->next = pi;
-                tmp = tmp->next;
-            }
-            break;
-        } else {
-            /* We found the next property */
-            *start = '\0';
-            str = buf + strlen(buf) - 1;
-            endptr = &str;
-            start++;
-            nptr = ptr;
-           if ((!strcmp(nptr, "?")) && (!strcmp(pi->name, "chip"))) {
-               for (pmctmp = dynamicpmc; pmctmp; pmctmp = pmctmp->next) {
-                       if (!strncmp(eventname, pmctmp->name, 
strlen(eventname)))
+               break;
+           } else {
+               /* We found the next property */
+               *start = '\0';
+               str = buf + strlen(buf) - 1;
+               endptr = &str;
+               start++;
+               nptr = ptr;
+               if ((!strcmp(nptr, "?")) && (!strcmp(pi->name, "chip"))) {
+                   for (pmctmp = dynamicpmc; pmctmp; pmctmp = pmctmp->next) {
+                       if (!strncmp(eventname, pmctmp->name, 
strlen(pmctmp->name)))
                        {
-                            pi->value = pmctmp->chip;
+                           pmsprintf(ev_str, sizeof(ev_str), "%s_chip_%d", 
event->name,pmctmp->chip);
+                           event->name = strdup(ev_str);
+                           pmsprintf(pmc_str, sizeof(pmc_str), "%s_chip_%d", 
pmctmp->name,pmctmp->chip);
+                           pmctmp->name = strdup(pmc_str);
+                           pi->value = pmctmp->chip;
+                           break;
                        }
-               }
-           } else
-               pi->value = strtoul(nptr, endptr, 16);
-        }
-
-        if (!head) {
-            head = pi;
-            tmp = head;
-        } else {
-            tmp->next = pi;
-            tmp = tmp->next;
-        }
+                   }
+               } else
+                   pi->value = strtoul(nptr, endptr, 16);
+           }
+           if (!head) {
+               head = pi;
+               tmp = head;
+           } else {
+               tmp->next = pi;
+               tmp = tmp->next;
+           }
+       }
+       ret = fetch_event_config(head, event, pmu);
+       if (ret)
+           return ret;
+
+       event->pmu = pmu;
+       event = event->next;
     }
-
-    return fetch_event_config(head, event, pmu);
+    return 0;
 }
 
 /*
@@ -509,7 +558,7 @@ static int fetch_events(DIR *events_dir, struct pmu_event 
**events,
     struct dirent *dir;
     struct pmu_event *ev = NULL, *tmp, *head = NULL;
     char event_path[PATH_MAX], *buf;
-    int ret = 0;
+    int ret = 0, sub_events, i;
 
     if (!events_dir)
         return -1;
@@ -551,21 +600,27 @@ static int fetch_events(DIR *events_dir, struct pmu_event 
**events,
             goto free_buf;
         }
 
-        ret = parse_event_string(buf, tmp, pmu, dynamicpmc, pmu_name);
+        ret = parse_event_string(buf, tmp, pmu, dynamicpmc, pmu_name, 
&sub_events);
         if (ret) {
             ret = -E_PERFEVENT_RUNTIME;
             goto free_buf;
         }
 
-        tmp->pmu = pmu;
+       i = 0;
+       do {
+           tmp->pmu = pmu;
+           if (!ev) {
+                ev = tmp;
+                head = ev;
+           } else {
+                ev->next = tmp;
+                ev = ev->next;
+            }
+           tmp = tmp->next;
+           i++;
+       } while(i < sub_events);
 
-        if (!ev) {
-            ev = tmp;
-            head = ev;
-        } else {
-            ev->next = tmp;
-            ev = ev->next;
-        }
+       sub_events = 0;
     }
 
     *events = head;
-- 
2.23.0

++++++ 0009-qa-perfevent-Test-hv_24x7-events-on-multinode.patch ++++++
>From ebe289d9e7a56db41acfb767ebe154c4f885c885 Mon Sep 17 00:00:00 2001
From: Anju T Sudhakar <[email protected]>
Date: Fri, 18 Oct 2019 13:15:16 +0530
Subject: [PATCH] qa/perfevent:Test hv_24x7 events on multinode

Patch-mainline: 5.0.1
Git-commit: ebe289d9e7a56db41acfb767ebe154c4f885c885

Signed-off-by: Anju T Sudhakar <[email protected]>
---
 .../config/test_hv_24x7_events_multinode.txt  |   9 +++++
 qa/perfevent/fakefs.tar.gz                    | Bin 8136 -> 8921 bytes
 qa/perfevent/perf_event_test.c                |  36 ++++++++++++++++++
 3 files changed, 45 insertions(+)
 create mode 100644 qa/perfevent/config/test_hv_24x7_events_multinode.txt

diff --git a/qa/perfevent/config/test_hv_24x7_events_multinode.txt 
b/qa/perfevent/config/test_hv_24x7_events_multinode.txt
new file mode 100644
index 000000000000..b17ce96eb96e
--- /dev/null
+++ b/qa/perfevent/config/test_hv_24x7_events_multinode.txt
@@ -0,0 +1,9 @@
+[pmuname ]
+INSTRUCTIONS_RETIRED cpu
+UNHALTED_REFERENCE_CYCLES cpu_rr
+
+[dynamic]
+pmu1.bar chip:0
+pmu1.bar chip:1
+pmu1.foo chip:0
+pmu1.foo chip:1
diff --git a/qa/perfevent/perf_event_test.c b/qa/perfevent/perf_event_test.c
index 4b054e0d9fed..90c21547c351 100644
--- a/qa/perfevent/perf_event_test.c
+++ b/qa/perfevent/perf_event_test.c
@@ -1091,6 +1091,39 @@ void test_parse_raw_events(void)
     printf("event = %s raw code = 0x%lx\n", pmctmp->name, pmctmp->rawcode);
 }
 
+/*
+ * This is the case where there are no PMUs exposed, it should only
+ * detect the software events.
+ */
+void test_hv_24x7_events_on_multinode_system(void)
+{
+    struct pmu *pmu_list = NULL, *tmp;
+    struct pmu_event *event;
+    int ev_count = 0;
+    const char *configfile = "config/test_hv_24x7_events_multinode.txt";
+    configuration_t *config;
+
+    config = parse_configfile(configfile);
+    assert(config != NULL);
+
+    printf( " ===== %s ==== \n", __FUNCTION__) ;
+
+    setenv("SYSFS_PREFIX", "./fakefs/syspmu_multinode", 1);
+    init_dynamic_events(&pmu_list, config->dynamicpmc->dynamicSettingList);
+    for (tmp = pmu_list; tmp; tmp = tmp->next) {
+       printf("PMU name: %s \n", tmp->name);
+        for (event = tmp->ev; event; event = event->next) {
+           if (strcmp(tmp->name, "pmu1") == 0)
+               assert(strstr(event->name, "chip"));
+           ev_count++;
+           printf(" event name: %s\n", event->name);
+        }
+    }
+
+    printf("%d events found\n", ev_count);
+    /* software events will be initialized in any case */
+    assert(ev_count == (4 + 9));
+}
 int runtest(int n)
 {
     init_mock();
@@ -1200,6 +1233,9 @@ int runtest(int n)
         case 33:
             test_parse_raw_events();
             break;
+       case 34:
+           test_hv_24x7_events_on_multinode_system();
+           break;
         default:
             ret = -1;
     }
-- 
2.23.0


Reply via email to