1 |
From 1ec2f2c05b2ab845d068bff29bd32dbfc6a6ad4c Mon Sep 17 00:00:00 2001 |
2 |
From: Mark Rutland <mark.rutland@arm.com> |
3 |
Date: Mon, 30 Nov 2020 11:59:47 +0000 |
4 |
Subject: [PATCH 130/150] arm64: ptrace: prepare for EL1 irq/rcu tracking |
5 |
|
6 |
Exceptions from EL1 may be taken when RCU isn't watching (e.g. in idle |
7 |
sequences), or when the lockdep hardirqs transiently out-of-sync with |
8 |
the hardware state (e.g. in the middle of local_irq_enable()). To |
9 |
correctly handle these cases, we'll need to save/restore this state |
10 |
across some exceptions taken from EL1. |
11 |
|
12 |
A series of subsequent patches will update EL1 exception handlers to |
13 |
handle this. In preparation for this, and to avoid dependencies between |
14 |
those patches, this patch adds two new fields to struct pt_regs so that |
15 |
exception handlers can track this state. |
16 |
|
17 |
Note that this is placed in pt_regs as some entry/exit sequences such as |
18 |
el1_irq are invoked from assembly, which makes it very difficult to add |
19 |
a separate structure as with the irqentry_state used by x86. We can |
20 |
separate this once more of the exception logic is moved to C. While the |
21 |
fields only need to be bool, they are both made u64 to keep pt_regs |
22 |
16-byte aligned. |
23 |
|
24 |
There should be no functional change as a result of this patch. |
25 |
|
26 |
Signed-off-by: Mark Rutland <mark.rutland@arm.com> |
27 |
Cc: Catalin Marinas <catalin.marinas@arm.com> |
28 |
Cc: James Morse <james.morse@arm.com> |
29 |
Cc: Will Deacon <will@kernel.org> |
30 |
Link: https://lore.kernel.org/r/20201130115950.22492-9-mark.rutland@arm.com |
31 |
Signed-off-by: Will Deacon <will@kernel.org> |
32 |
--- |
33 |
arch/arm64/include/asm/ptrace.h | 4 ++++ |
34 |
1 file changed, 4 insertions(+) |
35 |
|
36 |
diff --git a/arch/arm64/include/asm/ptrace.h b/arch/arm64/include/asm/ptrace.h |
37 |
index 997cf8c8cd52..28c85b87b8cd 100644 |
38 |
--- a/arch/arm64/include/asm/ptrace.h |
39 |
+++ b/arch/arm64/include/asm/ptrace.h |
40 |
@@ -193,6 +193,10 @@ struct pt_regs { |
41 |
/* Only valid when ARM64_HAS_IRQ_PRIO_MASKING is enabled. */ |
42 |
u64 pmr_save; |
43 |
u64 stackframe[2]; |
44 |
+ |
45 |
+ /* Only valid for some EL1 exceptions. */ |
46 |
+ u64 lockdep_hardirqs; |
47 |
+ u64 exit_rcu; |
48 |
}; |
49 |
|
50 |
static inline bool in_syscall(struct pt_regs const *regs) |
51 |
-- |
52 |
2.29.2 |
53 |
|