Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Will Deacon <will@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
	Shuah Khan <shuah@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-kselftest@vger.kernel.org
Subject: Re: [PATCH v2] kselftest/arm64: Exit streaming mode after collecting signal context
Date: Thu, 20 Jul 2023 12:35:02 +0100	[thread overview]
Message-ID: <037425cc-bf17-4dfd-8bdc-c1c10b153ebb@sirena.org.uk> (raw)
In-Reply-To: <20230720103113.GA11034@willie-the-truck>


[-- Attachment #1.1: Type: text/plain, Size: 1165 bytes --]

On Thu, Jul 20, 2023 at 11:31:13AM +0100, Will Deacon wrote:
> On Wed, Jul 12, 2023 at 12:02:30PM +0100, Mark Brown wrote:

> > +	/*
> > +	 * This is a memset() but we don't want the compiler to
> > +	 * optimise it into either instructions or a library call
> > +	 * which might be incompatible with streaming mode.
> > +	 */
> > +	for (i = 0; i < td->live_sz; i++) {
> > +		asm volatile("nop"
> > +			     : "+m" (*dest_uc)
> > +			     :
> > +			     : "memory");

> I don't think it's save to use "+m" here, since the compiler can assume
> that the address is used exactly once in the asm. If a post-indexed
> addressing mode is generated, then you can end up with register corruption.

> Stepping back, why not use either barrier() or OPTIMIZER_HIDE_VAR()
> instead?

That should work.  I was mostly just open coding OPTIMIZER_HIDE_VAR()
and noticed that memory constraints were a thing.

> The most robust fix would be to write all of the streaming mode code in
> asm, but I can appreciate that's a tonne of work for a testcase.

It's probably more proportionate to add a dependency on toolchain
support for SME, but that'd mean we hardly ever run the tests.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

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

      reply	other threads:[~2023-07-20 11:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-12 11:02 [PATCH v2] kselftest/arm64: Exit streaming mode after collecting signal context Mark Brown
2023-07-20 10:31 ` Will Deacon
2023-07-20 11:35   ` Mark Brown [this message]

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=037425cc-bf17-4dfd-8bdc-c1c10b153ebb@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox