Gentoo Archives: gentoo-commits

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-admin/collectd/, app-admin/collectd/files/
Date: Sat, 30 Sep 2017 15:15:49
Message-Id: 1506784531.2fe0d1872cde13f04c9edcfd900415e788e4e960.whissi@gentoo
1 commit: 2fe0d1872cde13f04c9edcfd900415e788e4e960
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Sat Sep 30 14:32:02 2017 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Sat Sep 30 15:15:31 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2fe0d187
7
8 app-admin/collectd: Fix turbostat plugin build issue with >=linux-4.12
9
10 Package-Manager: Portage-2.3.10, Repoman-2.3.3
11
12 app-admin/collectd/collectd-5.7.2.ebuild | 1 +
13 .../collectd/files/collectd-5.7.2-issue-2443.patch | 160 +++++++++++++++++++++
14 2 files changed, 161 insertions(+)
15
16 diff --git a/app-admin/collectd/collectd-5.7.2.ebuild b/app-admin/collectd/collectd-5.7.2.ebuild
17 index f062bc9c363..199a7948bb2 100644
18 --- a/app-admin/collectd/collectd-5.7.2.ebuild
19 +++ b/app-admin/collectd/collectd-5.7.2.ebuild
20 @@ -156,6 +156,7 @@ REQUIRED_USE="
21
22 PATCHES=(
23 "${FILESDIR}"/${PN}-5.6.0-gentoo.patch
24 + "${FILESDIR}"/${PN}-5.7.2-issue-2443.patch
25 )
26
27 # @FUNCTION: collectd_plugin_kernel_linux
28
29 diff --git a/app-admin/collectd/files/collectd-5.7.2-issue-2443.patch b/app-admin/collectd/files/collectd-5.7.2-issue-2443.patch
30 new file mode 100644
31 index 00000000000..19410c139b0
32 --- /dev/null
33 +++ b/app-admin/collectd/files/collectd-5.7.2-issue-2443.patch
34 @@ -0,0 +1,160 @@
35 +turbostat: import msr-index header from linux to allow building against
36 + >=linux-4.12
37 +
38 +Backport of https://github.com/collectd/collectd/pull/2446
39 +
40 +--- a/configure.ac
41 ++++ b/configure.ac
42 +@@ -805,28 +805,6 @@ AC_CACHE_CHECK([whether clock_boottime and clock_monotonic are supported],
43 +
44 +
45 + # For the turbostat plugin
46 +-have_asm_msrindex_h="no"
47 +-AC_CHECK_HEADERS(asm/msr-index.h, [have_asm_msrindex_h="yes"])
48 +-
49 +-if test "x$have_asm_msrindex_h" = "xyes"
50 +-then
51 +- AC_CACHE_CHECK([whether asm/msr-index.h has MSR_PKG_C10_RESIDENCY],
52 +- [c_cv_have_usable_asm_msrindex_h],
53 +- AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
54 +-[[[
55 +-#include<asm/msr-index.h>
56 +-]]],
57 +-[[[
58 +-int y = MSR_PKG_C10_RESIDENCY;
59 +-return(y);
60 +-]]]
61 +- )],
62 +- [c_cv_have_usable_asm_msrindex_h="yes"],
63 +- [c_cv_have_usable_asm_msrindex_h="no"],
64 +- )
65 +- )
66 +-fi
67 +-
68 + have_cpuid_h="no"
69 + AC_CHECK_HEADERS(cpuid.h, [have_cpuid_h="yes"])
70 +
71 +@@ -6108,7 +6086,7 @@ then
72 + then
73 + plugin_ipvs="yes"
74 + fi
75 +- if test "x$c_cv_have_usable_asm_msrindex_h" = "xyes" && test "x$have_cpuid_h" = "xyes"
76 ++ if test "x$have_cpuid_h" = "xyes"
77 + then
78 + plugin_turbostat="yes"
79 + fi
80 +--- a/src/Makefile.am
81 ++++ b/src/Makefile.am
82 +@@ -1212,7 +1212,9 @@ endif
83 +
84 + if BUILD_PLUGIN_TURBOSTAT
85 + pkglib_LTLIBRARIES += turbostat.la
86 +-turbostat_la_SOURCES = turbostat.c
87 ++turbostat_la_SOURCES = \
88 ++ turbostat.c \
89 ++ msr-index.h
90 + turbostat_la_LDFLAGS = $(PLUGIN_LDFLAGS)
91 + endif
92 +
93 +--- /dev/null
94 ++++ b/src/msr-index.h
95 +@@ -0,0 +1,88 @@
96 ++/*
97 ++ * Partial header file imported from the linux kernel
98 ++ * (arch/x86/include/asm/msr-index.h)
99 ++ * as it is not provided by the kernel sources anymore
100 ++ *
101 ++ * Only the minimal blocks of macro have been included
102 ++ * ----
103 ++ * This program is free software; you can redistribute it and/or modify it
104 ++ * under the terms and conditions of the GNU General Public License,
105 ++ * version 2, as published by the Free Software Foundation.
106 ++ *
107 ++ * This program is distributed in the hope it will be useful, but WITHOUT
108 ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
109 ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
110 ++ * more details.
111 ++ *
112 ++ * You should have received a copy of the GNU General Public License along with
113 ++ * this program; if not, write to the Free Software Foundation, Inc.,
114 ++ * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
115 ++ * ----
116 ++ */
117 ++
118 ++#ifndef _ASM_X86_MSR_INDEX_H
119 ++#define _ASM_X86_MSR_INDEX_H
120 ++
121 ++/*
122 ++ * CPU model specific register (MSR) numbers.
123 ++ *
124 ++ * Do not add new entries to this file unless the definitions are shared
125 ++ * between multiple compilation units.
126 ++ */
127 ++
128 ++/* Intel MSRs. Some also available on other CPUs */
129 ++
130 ++/* C-state Residency Counters */
131 ++#define MSR_PKG_C3_RESIDENCY 0x000003f8
132 ++#define MSR_PKG_C6_RESIDENCY 0x000003f9
133 ++#define MSR_ATOM_PKG_C6_RESIDENCY 0x000003fa
134 ++#define MSR_PKG_C7_RESIDENCY 0x000003fa
135 ++#define MSR_CORE_C3_RESIDENCY 0x000003fc
136 ++#define MSR_CORE_C6_RESIDENCY 0x000003fd
137 ++#define MSR_CORE_C7_RESIDENCY 0x000003fe
138 ++#define MSR_KNL_CORE_C6_RESIDENCY 0x000003ff
139 ++#define MSR_PKG_C2_RESIDENCY 0x0000060d
140 ++#define MSR_PKG_C8_RESIDENCY 0x00000630
141 ++#define MSR_PKG_C9_RESIDENCY 0x00000631
142 ++#define MSR_PKG_C10_RESIDENCY 0x00000632
143 ++
144 ++/* Run Time Average Power Limiting (RAPL) Interface */
145 ++
146 ++#define MSR_RAPL_POWER_UNIT 0x00000606
147 ++
148 ++#define MSR_PKG_POWER_LIMIT 0x00000610
149 ++#define MSR_PKG_ENERGY_STATUS 0x00000611
150 ++#define MSR_PKG_PERF_STATUS 0x00000613
151 ++#define MSR_PKG_POWER_INFO 0x00000614
152 ++
153 ++#define MSR_DRAM_POWER_LIMIT 0x00000618
154 ++#define MSR_DRAM_ENERGY_STATUS 0x00000619
155 ++#define MSR_DRAM_PERF_STATUS 0x0000061b
156 ++#define MSR_DRAM_POWER_INFO 0x0000061c
157 ++
158 ++#define MSR_PP0_POWER_LIMIT 0x00000638
159 ++#define MSR_PP0_ENERGY_STATUS 0x00000639
160 ++#define MSR_PP0_POLICY 0x0000063a
161 ++#define MSR_PP0_PERF_STATUS 0x0000063b
162 ++
163 ++#define MSR_PP1_POWER_LIMIT 0x00000640
164 ++#define MSR_PP1_ENERGY_STATUS 0x00000641
165 ++#define MSR_PP1_POLICY 0x00000642
166 ++
167 ++
168 ++
169 ++/* Intel defined MSRs. */
170 ++#define MSR_IA32_TSC 0x00000010
171 ++#define MSR_SMI_COUNT 0x00000034
172 ++
173 ++#define MSR_IA32_MPERF 0x000000e7
174 ++#define MSR_IA32_APERF 0x000000e8
175 ++
176 ++#define MSR_IA32_THERM_STATUS 0x0000019c
177 ++
178 ++#define MSR_IA32_TEMPERATURE_TARGET 0x000001a2
179 ++
180 ++#define MSR_IA32_PACKAGE_THERM_STATUS 0x000001b1
181 ++
182 ++
183 ++#endif /* _ASM_X86_MSR_INDEX_H */
184 +--- a/src/turbostat.c
185 ++++ b/src/turbostat.c
186 +@@ -41,7 +41,7 @@
187 + #include "plugin.h"
188 + #include "utils_time.h"
189 +
190 +-#include <asm/msr-index.h>
191 ++#include "msr-index.h"
192 + #include <cpuid.h>
193 + #ifdef HAVE_SYS_CAPABILITY_H
194 + #include <sys/capability.h>