summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/lttng
diff options
context:
space:
mode:
authorZang Ruochen <zangrc.fnst@cn.fujitsu.com>2019-06-19 15:14:40 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-06-19 22:13:39 +0100
commit1c7546e372236e467a0a49bbc9fc39f7b985922c (patch)
tree50ab6c8d545c57e9b515e7e349d4e64154233919 /meta/recipes-kernel/lttng
parentca0eeb5c3689376f43055e0c4fb316199acc59e3 (diff)
downloadpoky-1c7546e372236e467a0a49bbc9fc39f7b985922c.tar.gz
lttng-ust:upgrade 2.10.3 -> 2.10.4
-Upgrade from lttng-ust_2.10.3.bb to lttng-ust_2.10.4.bb. -lttng-ust/0001-compat-work-around-broken-_SC_NPROCESSORS_CONF-on-MU.patch Removed since this is included in 2.10.4 (From OE-Core rev: dc25e9525495e00940da7716cbba6bca96423acd) Signed-off-by: Zang Ruochen <zangrc.fnst@cn.fujitsu.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-kernel/lttng')
-rw-r--r--meta/recipes-kernel/lttng/lttng-ust/0001-compat-work-around-broken-_SC_NPROCESSORS_CONF-on-MU.patch109
-rw-r--r--meta/recipes-kernel/lttng/lttng-ust_2.10.4.bb (renamed from meta/recipes-kernel/lttng/lttng-ust_2.10.3.bb)5
2 files changed, 2 insertions, 112 deletions
diff --git a/meta/recipes-kernel/lttng/lttng-ust/0001-compat-work-around-broken-_SC_NPROCESSORS_CONF-on-MU.patch b/meta/recipes-kernel/lttng/lttng-ust/0001-compat-work-around-broken-_SC_NPROCESSORS_CONF-on-MU.patch
deleted file mode 100644
index 5c4bd36726..0000000000
--- a/meta/recipes-kernel/lttng/lttng-ust/0001-compat-work-around-broken-_SC_NPROCESSORS_CONF-on-MU.patch
+++ /dev/null
@@ -1,109 +0,0 @@
1From 5de7c318804a7b1edce8562d4891b4c74aac0677 Mon Sep 17 00:00:00 2001
2From: Michael Jeanson <mjeanson@efficios.com>
3Date: Wed, 20 Mar 2019 11:07:35 -0400
4Subject: [PATCH] compat: work around broken _SC_NPROCESSORS_CONF on MUSL libc
5
6On MUSL libc the _SC_NPROCESSORS_CONF sysconf will report the number of
7CPUs allocated to the task based on the affinity mask instead of the
8total number of CPUs configured on the system.
9
10Upstream-Status: Accepted [1] [5de7c318804a7b1edce8562d4891b4c74aac0677]
11[1] https://lists.lttng.org/pipermail/lttng-dev/2019-March/028616.html
12
13Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
14Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
15---
16 libringbuffer/smp.c | 66 +++++++++++++++++++++++++++++++++++++++++++++
17 1 file changed, 66 insertions(+)
18
19diff --git a/libringbuffer/smp.c b/libringbuffer/smp.c
20index 9e7114be..656a75da 100644
21--- a/libringbuffer/smp.c
22+++ b/libringbuffer/smp.c
23@@ -2,6 +2,7 @@
24 * libringbuffer/smp.c
25 *
26 * Copyright (C) 2011-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
27+ * Copyright (C) 2019 Michael Jeanson <mjeanson@efficios.com>
28 *
29 * This library is free software; you can redistribute it and/or
30 * modify it under the terms of the GNU Lesser General Public
31@@ -26,6 +27,7 @@
32
33 int __num_possible_cpus;
34
35+#if (defined(__GLIBC__) || defined( __UCLIBC__))
36 void _get_num_possible_cpus(void)
37 {
38 int result;
39@@ -43,3 +45,67 @@ void _get_num_possible_cpus(void)
40 return;
41 __num_possible_cpus = result;
42 }
43+
44+#else
45+
46+/*
47+ * The MUSL libc implementation of the _SC_NPROCESSORS_CONF sysconf does not
48+ * return the number of configured CPUs in the system but relies on the cpu
49+ * affinity mask of the current task.
50+ *
51+ * So instead we use a strategy similar to GLIBC's, counting the cpu
52+ * directories in "/sys/devices/system/cpu" and fallback on the value from
53+ * sysconf if it fails.
54+ */
55+
56+#include <dirent.h>
57+#include <limits.h>
58+#include <stdlib.h>
59+#include <string.h>
60+#include <sys/types.h>
61+
62+#define __max(a,b) ((a)>(b)?(a):(b))
63+
64+void _get_num_possible_cpus(void)
65+{
66+ int result, count = 0;
67+ DIR *cpudir;
68+ struct dirent *entry;
69+
70+ cpudir = opendir("/sys/devices/system/cpu");
71+ if (cpudir == NULL)
72+ goto end;
73+
74+ /*
75+ * Count the number of directories named "cpu" followed by and
76+ * integer. This is the same strategy as glibc uses.
77+ */
78+ while ((entry = readdir(cpudir))) {
79+ if (entry->d_type == DT_DIR &&
80+ strncmp(entry->d_name, "cpu", 3) == 0) {
81+
82+ char *endptr;
83+ unsigned long cpu_num;
84+
85+ cpu_num = strtoul(entry->d_name + 3, &endptr, 10);
86+ if ((cpu_num < ULONG_MAX) && (endptr != entry->d_name + 3)
87+ && (*endptr == '\0')) {
88+ count++;
89+ }
90+ }
91+ }
92+
93+end:
94+ /*
95+ * Get the sysconf value as a fallback. Keep the highest number.
96+ */
97+ result = __max(sysconf(_SC_NPROCESSORS_CONF), count);
98+
99+ /*
100+ * If both methods failed, don't store the value.
101+ */
102+ if (result < 1)
103+ return;
104+ __num_possible_cpus = result;
105+}
106+#endif
107--
1082.17.1
109
diff --git a/meta/recipes-kernel/lttng/lttng-ust_2.10.3.bb b/meta/recipes-kernel/lttng/lttng-ust_2.10.4.bb
index d546104129..a8eebb223b 100644
--- a/meta/recipes-kernel/lttng/lttng-ust_2.10.3.bb
+++ b/meta/recipes-kernel/lttng/lttng-ust_2.10.4.bb
@@ -27,11 +27,10 @@ PE = "2"
27 27
28SRC_URI = "https://lttng.org/files/lttng-ust/lttng-ust-${PV}.tar.bz2 \ 28SRC_URI = "https://lttng.org/files/lttng-ust/lttng-ust-${PV}.tar.bz2 \
29 file://lttng-ust-doc-examples-disable.patch \ 29 file://lttng-ust-doc-examples-disable.patch \
30 file://0001-compat-work-around-broken-_SC_NPROCESSORS_CONF-on-MU.patch \
31 " 30 "
32 31
33SRC_URI[md5sum] = "ffcfa8c1ba9a52f002d240e936e9afa2" 32SRC_URI[md5sum] = "19916ff0dec23c90f985586a8cbd1fd2"
34SRC_URI[sha256sum] = "9e8420f90d5f963f7aa32bc6d44adc1e491136f687c69ffb7a3075d33b40852b" 33SRC_URI[sha256sum] = "75d5b4bb205c444a343e1297e14cd3a2503fc645a26710531cbd319c72c1a967"
35 34
36CVE_PRODUCT = "ust" 35CVE_PRODUCT = "ust"
37 36