import bcc-0.19.0-5.el8

This commit is contained in:
CentOS Sources 2022-03-29 13:21:38 -04:00 committed by Stepan Oksanichenko
parent 64f2ce4ad7
commit eb0ae4fd8e
5 changed files with 248 additions and 1 deletions

View File

@ -0,0 +1,46 @@
From bb121e49b1a05e86c88274a89f5229b4ec6939c6 Mon Sep 17 00:00:00 2001
From: Yonghong Song <yhs@fb.com>
Date: Tue, 25 May 2021 19:58:00 -0700
Subject: [PATCH 2/2] Fix a llvm compilation error
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Current llvm trunk (https://github.com/llvm/llvm-project)
will cause the following compilation errors:
/home/yhs/work/bcc/src/cc/bcc_debug.cc: In member function void ebpf::SourceDebugger::dump():
/home/yhs/work/bcc/src/cc/bcc_debug.cc:135:75: error: no matching function for call to
llvm::MCContext::MCContext(llvm::Triple&, std::unique_ptr<llvm::MCAsmInfo>::pointer,
std::unique_ptr<llvm::MCRegisterInfo>::pointer, llvm::MCObjectFileInfo*,
std::unique_ptr<llvm::MCSubtargetInfo>::pointer, std::nullptr_t)
MCContext Ctx(TheTriple, MAI.get(), MRI.get(), &MOFI, STI.get(), nullptr);
^
......
This is because upstream patch https://reviews.llvm.org/D101921
refactored MCObjectFileInfo initialization and changed MCContext
constructor signature.
This patch fixed the issue by following the new code patterns
in https://reviews.llvm.org/D101921.
---
src/cc/bcc_debug.cc | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/cc/bcc_debug.cc b/src/cc/bcc_debug.cc
index 775c9141..97d6d95b 100644
--- a/src/cc/bcc_debug.cc
+++ b/src/cc/bcc_debug.cc
@@ -132,7 +132,8 @@ void SourceDebugger::dump() {
T->createMCSubtargetInfo(TripleStr, "", ""));
MCObjectFileInfo MOFI;
#if LLVM_MAJOR_VERSION >= 13
- MCContext Ctx(TheTriple, MAI.get(), MRI.get(), &MOFI, STI.get(), nullptr);
+ MCContext Ctx(TheTriple, MAI.get(), MRI.get(), STI.get(), nullptr);
+ Ctx.setObjectFileInfo(&MOFI);
MOFI.initMCObjectFileInfo(Ctx, false, false);
#else
MCContext Ctx(MAI.get(), MRI.get(), &MOFI, nullptr);
--
2.31.1

View File

@ -0,0 +1,110 @@
From c610314e8f8265317bf54ef518df48809834feba Mon Sep 17 00:00:00 2001
From: Jerome Marchand <jmarchan@redhat.com>
Date: Thu, 14 Oct 2021 12:01:01 +0200
Subject: [PATCH] Handle renaming of task_struct_>state field on RHEL 9
There has been some cleanup of task_struct's state field and to catch
any place that has been missed in the conversion, it has been renamed
__state.
---
tools/cpudist.py | 2 +-
tools/offcputime.py | 4 ++--
tools/offwaketime.py | 4 ++--
tools/runqlat.py | 4 ++--
tools/runqslower.py | 4 ++--
5 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/tools/cpudist.py b/tools/cpudist.py
index eb04f590..ba36ba76 100755
--- a/tools/cpudist.py
+++ b/tools/cpudist.py
@@ -101,7 +101,7 @@ int sched_switch(struct pt_regs *ctx, struct task_struct *prev)
u32 tgid = pid_tgid >> 32, pid = pid_tgid;
#ifdef ONCPU
- if (prev->state == TASK_RUNNING) {
+ if (prev->__state == TASK_RUNNING) {
#else
if (1) {
#endif
diff --git a/tools/offcputime.py b/tools/offcputime.py
index 128c6496..b93e78d2 100755
--- a/tools/offcputime.py
+++ b/tools/offcputime.py
@@ -205,10 +205,10 @@ thread_context = ""
thread_context = "all threads"
thread_filter = '1'
if args.state == 0:
- state_filter = 'prev->state == 0'
+ state_filter = 'prev->__state == 0'
elif args.state:
# these states are sometimes bitmask checked
- state_filter = 'prev->state & %d' % args.state
+ state_filter = 'prev->__state & %d' % args.state
else:
state_filter = '1'
bpf_text = bpf_text.replace('THREAD_FILTER', thread_filter)
diff --git a/tools/offwaketime.py b/tools/offwaketime.py
index 753eee97..722c0381 100755
--- a/tools/offwaketime.py
+++ b/tools/offwaketime.py
@@ -254,10 +254,10 @@ int oncpu(struct pt_regs *ctx, struct task_struct *p) {
else:
thread_filter = '1'
if args.state == 0:
- state_filter = 'p->state == 0'
+ state_filter = 'p->__state == 0'
elif args.state:
# these states are sometimes bitmask checked
- state_filter = 'p->state & %d' % args.state
+ state_filter = 'p->__state & %d' % args.state
else:
state_filter = '1'
bpf_text = bpf_text.replace('THREAD_FILTER', thread_filter)
diff --git a/tools/runqlat.py b/tools/runqlat.py
index b13ff2d1..8e443c3c 100755
--- a/tools/runqlat.py
+++ b/tools/runqlat.py
@@ -116,7 +116,7 @@ int trace_run(struct pt_regs *ctx, struct task_struct *prev)
u32 pid, tgid;
// ivcsw: treat like an enqueue event and store timestamp
- if (prev->state == TASK_RUNNING) {
+ if (prev->__state == TASK_RUNNING) {
tgid = prev->tgid;
pid = prev->pid;
if (!(FILTER || pid == 0)) {
@@ -170,7 +170,7 @@ RAW_TRACEPOINT_PROBE(sched_switch)
u32 pid, tgid;
// ivcsw: treat like an enqueue event and store timestamp
- if (prev->state == TASK_RUNNING) {
+ if (prev->__state == TASK_RUNNING) {
tgid = prev->tgid;
pid = prev->pid;
if (!(FILTER || pid == 0)) {
diff --git a/tools/runqslower.py b/tools/runqslower.py
index 6df98d9f..ba71e5d3 100755
--- a/tools/runqslower.py
+++ b/tools/runqslower.py
@@ -112,7 +112,7 @@ int trace_run(struct pt_regs *ctx, struct task_struct *prev)
u32 pid, tgid;
// ivcsw: treat like an enqueue event and store timestamp
- if (prev->state == TASK_RUNNING) {
+ if (prev->__state == TASK_RUNNING) {
tgid = prev->tgid;
pid = prev->pid;
u64 ts = bpf_ktime_get_ns();
@@ -178,7 +178,7 @@ RAW_TRACEPOINT_PROBE(sched_switch)
long state;
// ivcsw: treat like an enqueue event and store timestamp
- bpf_probe_read_kernel(&state, sizeof(long), (const void *)&prev->state);
+ bpf_probe_read_kernel(&state, sizeof(long), (const void *)&prev->__state);
if (state == TASK_RUNNING) {
bpf_probe_read_kernel(&tgid, sizeof(prev->tgid), &prev->tgid);
bpf_probe_read_kernel(&pid, sizeof(prev->pid), &prev->pid);
--
2.31.1

View File

@ -0,0 +1,41 @@
From da1f8b4b8389e463e323885e402f96b3bc6ceb35 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 14 Jun 2021 12:49:43 -0700
Subject: [PATCH] Remove APInt/APSInt toString() std::string variants
clang 13+ has removed this in favour of a pair of llvm::toString
() helpers inside StringExtras.h to improve compile speed by avoiding
hits on <string> header
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
src/cc/json_map_decl_visitor.cc | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/cc/json_map_decl_visitor.cc b/src/cc/json_map_decl_visitor.cc
index eff4d067..53896199 100644
--- a/src/cc/json_map_decl_visitor.cc
+++ b/src/cc/json_map_decl_visitor.cc
@@ -20,6 +20,7 @@
#include <clang/AST/ASTContext.h>
#include <clang/AST/RecordLayout.h>
#include <clang/AST/RecursiveASTVisitor.h>
+#include <llvm/ADT/StringExtras.h>
#include "common.h"
#include "table_desc.h"
@@ -79,7 +80,11 @@ void BMapDeclVisitor::genJSONForField(FieldDecl *F) {
result_ += "[";
TraverseDecl(F);
if (const ConstantArrayType *T = dyn_cast<ConstantArrayType>(F->getType()))
+#if LLVM_MAJOR_VERSION >= 13
+ result_ += ", [" + toString(T->getSize(), 10, false) + "]";
+#else
result_ += ", [" + T->getSize().toString(10, false) + "]";
+#endif
if (F->isBitField())
result_ += ", " + to_string(F->getBitWidthValue(C));
result_ += "], ";
--
2.31.1

View File

@ -0,0 +1,42 @@
From d74c96d9423652d4467339ee24bb6db2e5df21cb Mon Sep 17 00:00:00 2001
From: Yonghong Song <yhs@fb.com>
Date: Wed, 5 May 2021 19:11:13 -0700
Subject: [PATCH 1/2] fix llvm compilation errors
MCContext and InitMCObjectFileInfo name/signatures
are changed due to upstream patch
https://reviews.llvm.org/D101462
Adjust related codes in bcc_debug.cc properly to resolve
the compilation error for llvm13.
Signed-off-by: Yonghong Song <yhs@fb.com>
---
src/cc/bcc_debug.cc | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/cc/bcc_debug.cc b/src/cc/bcc_debug.cc
index 371b6ad3..775c9141 100644
--- a/src/cc/bcc_debug.cc
+++ b/src/cc/bcc_debug.cc
@@ -128,11 +128,16 @@ void SourceDebugger::dump() {
return;
}
+ std::unique_ptr<MCSubtargetInfo> STI(
+ T->createMCSubtargetInfo(TripleStr, "", ""));
MCObjectFileInfo MOFI;
+#if LLVM_MAJOR_VERSION >= 13
+ MCContext Ctx(TheTriple, MAI.get(), MRI.get(), &MOFI, STI.get(), nullptr);
+ MOFI.initMCObjectFileInfo(Ctx, false, false);
+#else
MCContext Ctx(MAI.get(), MRI.get(), &MOFI, nullptr);
MOFI.InitMCObjectFileInfo(TheTriple, false, Ctx, false);
- std::unique_ptr<MCSubtargetInfo> STI(
- T->createMCSubtargetInfo(TripleStr, "", ""));
+#endif
std::unique_ptr<MCInstrInfo> MCII(T->createMCInstrInfo());
MCInstPrinter *IP = T->createMCInstPrinter(TheTriple, 0, *MAI, *MCII, *MRI);
--
2.31.1

View File

@ -9,7 +9,7 @@
Name: bcc Name: bcc
Version: 0.19.0 Version: 0.19.0
Release: 4%{?dist} Release: 5%{?dist}
Summary: BPF Compiler Collection (BCC) Summary: BPF Compiler Collection (BCC)
License: ASL 2.0 License: ASL 2.0
URL: https://github.com/iovisor/bcc URL: https://github.com/iovisor/bcc
@ -17,6 +17,10 @@ Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
Patch0: %{name}-%{version}-Manpages-remove-unstable-statement.patch Patch0: %{name}-%{version}-Manpages-remove-unstable-statement.patch
Patch1: %{name}-%{version}-Fix-BPF-src_file-foo.patch Patch1: %{name}-%{version}-Fix-BPF-src_file-foo.patch
Patch2: %{name}-%{version}-Define-missing-BPF_-macros.patch Patch2: %{name}-%{version}-Define-missing-BPF_-macros.patch
Patch3: %{name}-%{version}-fix-llvm-compilation-errors.patch
Patch4: %{name}-%{version}-Fix-a-llvm-compilation-error.patch
Patch5: %{name}-%{version}-Remove-APInt-APSInt-toString-std-string-variants.patch
Patch6: %{name}-%{version}-Handle-renaming-of-task_struct_-state-field-on-RHEL-.patch
# Arches will be included as upstream support is added and dependencies are # Arches will be included as upstream support is added and dependencies are
# satisfied in the respective arches # satisfied in the respective arches
@ -213,6 +217,10 @@ done
%changelog %changelog
* Tue Nov 23 2021 Jerome Marchand <jmarchan@redhat.com> - 0.19.0-5
- Handle the renaming of task_struct_>state field
- Rebuild for LLVM 13
* Fri Jul 02 2021 Jerome Marchand <jmarchan@redhat.com> - 0.19.0-4 * Fri Jul 02 2021 Jerome Marchand <jmarchan@redhat.com> - 0.19.0-4
- Build bcc from standard sources - Build bcc from standard sources
- Don't require bcc-tools by default - Don't require bcc-tools by default