[PATCH v4 05/14] tools/lib/lockdep: add definition required for IRQ flag tracing

From: Sasha Levin
Date: Tue Aug 04 2020 - 20:10:55 EST


We are going to start building with CONFIG_TRACE_IRQFLAGS defined, so
let's wire up a few dummy variables in our task_struct.

This isn't needed in userspace, but due to some refactoring in
kernel-side lockdep it's easier to just wire it up and enable
CONFIG_TRACE_IRQFLAGS.

Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---
tools/include/linux/lockdep.h | 8 ++++++++
tools/lib/lockdep/lockdep.c | 4 ++--
2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/tools/include/linux/lockdep.h b/tools/include/linux/lockdep.h
index e56997288f2b0..3a9924d6d3ae8 100644
--- a/tools/include/linux/lockdep.h
+++ b/tools/include/linux/lockdep.h
@@ -23,6 +23,8 @@

#include "../../../include/linux/lockdep.h"

+static bool early_boot_irqs_disabled;
+
struct task_struct {
u64 curr_chain_key;
int lockdep_depth;
@@ -31,6 +33,12 @@ struct task_struct {
gfp_t lockdep_reclaim_gfp;
int pid;
int state;
+ int softirqs_enabled, hardirqs_enabled, softirqs_disabled, hardirqs_disabled, irq_events;
+ unsigned long softirq_disable_ip, softirq_enable_ip;
+ unsigned int softirq_disable_event, softirq_enable_event;
+ unsigned long hardirq_disable_ip, hardirq_enable_ip;
+ unsigned int hardirq_disable_event, hardirq_enable_event;
+ int softirq_context, hardirq_context;
char comm[17];
};

diff --git a/tools/lib/lockdep/lockdep.c b/tools/lib/lockdep/lockdep.c
index 348a9d0fb766a..9be12d233477a 100644
--- a/tools/lib/lockdep/lockdep.c
+++ b/tools/lib/lockdep/lockdep.c
@@ -15,10 +15,10 @@ u32 prandom_u32(void)
abort();
}

-void print_irqtrace_events(struct task_struct *curr)
+/*void print_irqtrace_events(struct task_struct *curr)
{
abort();
-}
+}*/

static struct new_utsname *init_utsname(void)
{
--
2.25.1