Hello community,

here is the log from the commit of package powerpc-utils for openSUSE:Factory 
checked in at 2018-10-01 09:07:04
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/powerpc-utils (Old)
 and      /work/SRC/openSUSE:Factory/.powerpc-utils.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "powerpc-utils"

Mon Oct  1 09:07:04 2018 rev:93 rq:637690 version:1.3.5

Changes:
--------
--- /work/SRC/openSUSE:Factory/powerpc-utils/powerpc-utils.changes      
2018-08-10 09:44:56.613803624 +0200
+++ /work/SRC/openSUSE:Factory/.powerpc-utils.new/powerpc-utils.changes 
2018-10-01 09:07:07.739804537 +0200
@@ -1,0 +2,8 @@
+Mon Sep 24 09:35:18 UTC 2018 - jloe...@suse.com
+
+- limit number of CPUs for frequency calculation (bsc#1109046)
+
+- added patches:
+  * powerpc-utils.bug-1109046_cpu-Limit-number-of-CPUs-for-frequency-calc.patch
+
+-------------------------------------------------------------------

New:
----
  powerpc-utils.bug-1109046_cpu-Limit-number-of-CPUs-for-frequency-calc.patch

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

Other differences:
------------------
++++++ powerpc-utils.spec ++++++
--- /var/tmp/diff_new_pack.nMXULo/_old  2018-10-01 09:07:08.419803955 +0200
+++ /var/tmp/diff_new_pack.nMXULo/_new  2018-10-01 09:07:08.423803951 +0200
@@ -33,6 +33,7 @@
 Patch5:         lsslot-Split-dynamic-memory-v1-parsing-into-separate.patch
 Patch6:         lsslot-Add-ibm-dynamic-memory-v2-parsing-capability.patch
 Patch7:         bootlist-Display-logical-name-using-bootlist-o-option.patch
+Patch8:         
powerpc-utils.bug-1109046_cpu-Limit-number-of-CPUs-for-frequency-calc.patch
 BuildRequires:  autoconf
 BuildRequires:  automake
 BuildRequires:  librtas-devel
@@ -65,6 +66,7 @@
 %patch5 -p1
 %patch6 -p1
 %patch7 -p1
+%patch8 -p1
 
 %build
 autoreconf -fvi

++++++ 
powerpc-utils.bug-1109046_cpu-Limit-number-of-CPUs-for-frequency-calc.patch 
++++++
>From fac783d18d61af232b957af259a15ed231f6869b Mon Sep 17 00:00:00 2001
From: Juliet Kim <juli...@linux.vnet.ibm.com>
Date: Thu, 13 Sep 2018 15:57:42 -0400
Subject: [PATCH] ppc64_cpu: Limit number of CPUs for frequency calculation

The patch limits the number of threads used for CPU frequency calculation
to the minimum of either the actual number of CPUs in the system or
CPU_SETSIZE(currently 1024). In other words, if the number of CPUs in the
system is less than CPU_SETSIZE, a thread is created for each of the CPUs,
otherwise only CPU_SETSIZE threads are created. This is being done because
sched_setaffinity() will only work on CPU_SETSIZE CPUs, anything over the
limit is not supported.

Signed-off-by: Juliet Kim <juli...@linux.vnet.ibm.com>
Signed-off-by: Tyrel Datwyler <tyr...@linux.vnet.ibm.com>
---
 src/ppc64_cpu.c | 43 +++++++++++++++++++++++++------------------
 1 file changed, 25 insertions(+), 18 deletions(-)

diff --git a/src/ppc64_cpu.c b/src/ppc64_cpu.c
index 34654b4..6d02235 100644
--- a/src/ppc64_cpu.c
+++ b/src/ppc64_cpu.c
@@ -35,6 +35,7 @@
 #include <sys/ptrace.h>
 #include <sys/wait.h>
 #include <sys/resource.h>
+#include <sys/param.h>
 
 #ifdef WITH_LIBRTAS
 #include <librtas.h>
@@ -849,7 +850,7 @@ static int do_run_mode(char *run_mode)
 
 #ifdef HAVE_LINUX_PERF_EVENT_H
 
-static int setup_counters(struct cpu_freq *cpu_freqs)
+static int setup_counters(struct cpu_freq *cpu_freqs, int max_thread)
 {
        int i;
        struct perf_event_attr attr;
@@ -863,7 +864,7 @@ static int setup_counters(struct cpu_freq *cpu_freqs)
        /* Record how long the event ran for */
        attr.read_format |= PERF_FORMAT_TOTAL_TIME_RUNNING;
 
-       for (i = 0; i < threads_in_system; i++) {
+       for (i = 0; i < max_thread; i++) {
                if (!cpu_online(i)) {
                        cpu_freqs[i].offline = 1;
                        continue;
@@ -886,11 +887,11 @@ static int setup_counters(struct cpu_freq *cpu_freqs)
        return 0;
 }
 
-static void start_counters(struct cpu_freq *cpu_freqs)
+static void start_counters(struct cpu_freq *cpu_freqs, int max_thread)
 {
        int i;
 
-       for (i = 0; i < threads_in_system; i++) {
+       for (i = 0; i < max_thread; i++) {
                if (cpu_freqs[i].offline)
                        continue;
 
@@ -898,11 +899,11 @@ static void start_counters(struct cpu_freq *cpu_freqs)
        }
 }
 
-static void stop_counters(struct cpu_freq *cpu_freqs)
+static void stop_counters(struct cpu_freq *cpu_freqs, int max_thread)
 {
        int i;
 
-       for (i = 0; i < threads_in_system; i++) {
+       for (i = 0; i < max_thread; i++) {
                if (cpu_freqs[i].offline)
                        continue;
 
@@ -915,12 +916,12 @@ struct read_format {
        uint64_t time_running;
 };
 
-static void read_counters(struct cpu_freq *cpu_freqs)
+static void read_counters(struct cpu_freq *cpu_freqs, int max_thread)
 {
        int i;
        struct read_format vals;
 
-       for (i = 0; i < threads_in_system; i++) {
+       for (i = 0; i < max_thread; i++) {
                size_t res;
 
                if (cpu_freqs[i].offline)
@@ -941,11 +942,11 @@ static void read_counters(struct cpu_freq *cpu_freqs)
        }
 }
 
-static void check_threads(struct cpu_freq *cpu_freqs)
+static void check_threads(struct cpu_freq *cpu_freqs, int max_thread)
 {
        int i;
 
-       for (i = 0; i < threads_in_system; i++) {
+       for (i = 0; i < max_thread; i++) {
                if (cpu_freqs[i].offline)
                        continue;
 
@@ -1074,21 +1075,27 @@ static int do_cpu_frequency(int sleep_time)
        double sum = 0;
        unsigned long count = 0;
        struct cpu_freq *cpu_freqs;
+       int max_thread;
 
        setrlimit_open_files();
 
-       cpu_freqs = calloc(threads_in_system, sizeof(*cpu_freqs));
+       max_thread = MIN(threads_in_system, CPU_SETSIZE);
+       if (max_thread < threads_in_system)
+               printf("ppc64_cpu currently supports up to %d CPUs\n",
+                       CPU_SETSIZE);
+
+       cpu_freqs = calloc(max_thread, sizeof(*cpu_freqs));
        if (!cpu_freqs)
                return -ENOMEM;
 
-       rc = setup_counters(cpu_freqs);
+       rc = setup_counters(cpu_freqs, max_thread);
        if (rc) {
                free(cpu_freqs);
                return rc;
        }
 
        /* Start a soak thread on each CPU */
-       for (i = 0; i < threads_in_system; i++) {
+       for (i = 0; i < max_thread; i++) {
                if (cpu_freqs[i].offline)
                        continue;
 
@@ -1103,15 +1110,15 @@ static int do_cpu_frequency(int sleep_time)
        /* Wait for soak threads to start */
        usleep(1000000);
 
-       start_counters(cpu_freqs);
+       start_counters(cpu_freqs, max_thread);
        /* Count for specified timeout in seconds */
        usleep(sleep_time * 1000000);
 
-       stop_counters(cpu_freqs);
-       check_threads(cpu_freqs);
-       read_counters(cpu_freqs);
+       stop_counters(cpu_freqs, max_thread);
+       check_threads(cpu_freqs, max_thread);
+       read_counters(cpu_freqs, max_thread);
 
-       for (i = 0; i < threads_in_system; i++) {
+       for (i = 0; i < max_thread; i++) {
                double frequency;
 
                if (cpu_freqs[i].offline)
-- 
2.16.4


Reply via email to