All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: linux-arm-kernel@lists.infradead.org
Cc: mark.rutland@arm.com, elver@google.com, paulmck@kernel.org,
	peterz@infradead.org, catalin.marinas@arm.com,
	james.morse@arm.com, will@kernel.org, dvyukov@google.com
Subject: [PATCH 08/11] arm64: ptrace: prepare for EL1 irq/rcu tracking
Date: Thu, 26 Nov 2020 12:35:59 +0000	[thread overview]
Message-ID: <20201126123602.23454-9-mark.rutland@arm.com> (raw)
In-Reply-To: <20201126123602.23454-1-mark.rutland@arm.com>

Exceptions from EL1 may be taken when RCU isn't watching (e.g. in idle
sequences), or when the lockdep hardirqs transiently out-of-sync with
the hardware state (e.g. in the middle of local_irq_enable()). To
correctly handle these cases, we'll need to save/restore this state
across some exceptions taken from EL1.

A series of subsequent patches will update EL1 exception handlers to
handle this. In preparation for this, and to avoid dependencies between
those patches, this patch adds two new fields to struct pt_regs so that
exception handlers can track this state.

Note that this is placed in pt_regs as some entry/exit sequences such as
el1_irq are invoked from assembly, which makes it very difficult to add
a separate structure as with the irqentry_state used by x86. We can
separate this once more of the exception logic is moved to C. While the
fields only need to be bool, they are both made u64 to keep pt_regs
16-bite aligned.

There should be no functional change as a result of this patch.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: James Morse <james.morse@arm.com>
Cc: Will Deacon <will@kernel.org>
---
 arch/arm64/include/asm/ptrace.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm64/include/asm/ptrace.h b/arch/arm64/include/asm/ptrace.h
index 997cf8c8cd52..b4a841d9511d 100644
--- a/arch/arm64/include/asm/ptrace.h
+++ b/arch/arm64/include/asm/ptrace.h
@@ -193,6 +193,13 @@ struct pt_regs {
 	/* Only valid when ARM64_HAS_IRQ_PRIO_MASKING is enabled. */
 	u64 pmr_save;
 	u64 stackframe[2];
+
+	/*
+	 * Only valid for some EL1 exceptions.
+	 * TODO: move this out of pt_regs.
+	 */
+	u64 lockdep_hardirqs;
+	u64 exit_rcu;
 };
 
 static inline bool in_syscall(struct pt_regs const *regs)
-- 
2.11.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2020-11-26 12:39 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-26 12:35 [PATCH 00/11] arm64: entry lockdep/rcu/tracing fixes Mark Rutland
2020-11-26 12:35 ` [PATCH 01/11] arm64: syscall: exit userspace before unmasking exceptions Mark Rutland
2020-11-26 12:35 ` [PATCH 02/11] arm64: mark idle code as noinstr Mark Rutland
2020-11-26 12:35 ` [PATCH 03/11] arm64: entry: mark entry " Mark Rutland
2020-11-26 12:35 ` [PATCH 04/11] arm64: entry: move enter_from_user_mode to entry-common.c Mark Rutland
2020-11-26 12:35 ` [PATCH 05/11] arm64: entry: prepare ret_to_user for function call Mark Rutland
2020-11-26 12:35 ` [PATCH 06/11] arm64: entry: move el1 irq/nmi logic to C Mark Rutland
2020-11-26 12:35 ` [PATCH 07/11] arm64: entry: fix non-NMI user<->kernel transitions Mark Rutland
2020-11-30 11:22   ` Will Deacon
2020-11-26 12:35 ` Mark Rutland [this message]
2020-11-30 11:01   ` [PATCH 08/11] arm64: ptrace: prepare for EL1 irq/rcu tracking Will Deacon
2020-11-26 12:36 ` [PATCH 09/11] arm64: entry: fix non-NMI kernel<->kernel transitions Mark Rutland
2020-11-30 11:22   ` Will Deacon
2020-11-26 12:36 ` [PATCH 10/11] arm64: entry: fix NMI {user, kernel}->kernel transitions Mark Rutland
2020-11-26 18:41   ` [PATCH 10/11] arm64: entry: fix NMI {user,kernel}->kernel transitions Mark Rutland
2020-11-26 21:00     ` Will Deacon
2020-11-26 12:36 ` [PATCH 11/11] arm64: entry: fix EL1 debug transitions Mark Rutland
2020-11-30 11:23 ` [PATCH 00/11] arm64: entry lockdep/rcu/tracing fixes Will Deacon
2020-11-30 12:03 ` Marco Elver
2020-11-30 12:38   ` Mark Rutland
     [not found]     ` <20201130133245.GA1307615@elver.google.com>
2020-11-30 16:54       ` Mark Rutland

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201126123602.23454-9-mark.rutland@arm.com \
    --to=mark.rutland@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=dvyukov@google.com \
    --cc=elver@google.com \
    --cc=james.morse@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.