linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: D Scott Phillips <scott@os.amperecomputing.com>
Cc: linux-arm-kernel@lists.infradead.org,
	Marc Zyngier <maz@kernel.org>, Will Deacon <will@kernel.org>,
	Darren Hart <darren@os.amperecomputing.com>,
	patches@amperecomputing.com
Subject: Re: [PATCH v5] arm64: errata: Fix exec handling in erratum 1418040 workaround
Date: Tue, 21 Dec 2021 11:30:47 +0000	[thread overview]
Message-ID: <YcG65wEpg+MG67Tt@arm.com> (raw)
In-Reply-To: <20211220234114.3926-1-scott@os.amperecomputing.com>

On Mon, Dec 20, 2021 at 03:41:14PM -0800, D Scott Phillips wrote:
> The erratum 1418040 workaround enables CNTVCT_EL1 access trapping in EL0
> when executing compat threads. The workaround is applied when switching
> between tasks, but the need for the workaround could also change at an
> exec(), when a non-compat task execs a compat binary or vice versa. Apply
> the workaround in arch_setup_new_exec().
> 
> This leaves a small window of time between SET_PERSONALITY and
> arch_setup_new_exec where preemption could occur and confuse the old
> workaround logic that compares TIF_32BIT between prev and next. Instead, we
> can just read cntkctl to make sure it's in the state that the next task
> needs. I measured cntkctl read time to be about the same as a mov from a
> general-purpose register on N1. Update the workaround logic to examine the
> current value of cntkctl instead of the previous task's compat state.

The patch looks fine to me but I was wondering what the cost of writing
CNTKCTL_EL1 is, compared to a read. If it turns out to be negligible, we
can simplify this patch further ;).

-- 
Catalin

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

  reply	other threads:[~2021-12-21 11:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-20 23:41 [PATCH v5] arm64: errata: Fix exec handling in erratum 1418040 workaround D Scott Phillips
2021-12-21 11:30 ` Catalin Marinas [this message]
2021-12-21 20:10   ` D Scott Phillips
2021-12-22 11:03     ` Catalin Marinas
2021-12-22 12:44       ` Marc Zyngier
2021-12-22 15:23 ` Catalin Marinas
2021-12-22 15:25 ` Catalin Marinas
2021-12-22 16:12   ` D Scott Phillips
2021-12-23 11:43     ` Catalin Marinas
2021-12-23 18:22       ` D Scott Phillips

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=YcG65wEpg+MG67Tt@arm.com \
    --to=catalin.marinas@arm.com \
    --cc=darren@os.amperecomputing.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=maz@kernel.org \
    --cc=patches@amperecomputing.com \
    --cc=scott@os.amperecomputing.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).