mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Yeoreum Yun" <yeoreum.yun@arm.com>,
	"Catalin Marinas" <catalin.marinas@arm.com>,
	"Will Deacon" <will@kernel.org>, "Marc Zyngier" <maz@kernel.org>,
	"Mark Brown" <broonie@kernel.org>,
	"Oliver Upton" <oliver.upton@linux.dev>,
	miko.lenczewski@arm.com, "Kevin Brodsky" <kevin.brodsky@arm.com>,
	"Ard Biesheuvel" <ardb@kernel.org>,
	"Suzuki K Poulose" <suzuki.poulose@arm.com>,
	"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	yangyicong@hisilicon.com, scott@os.amperecomputing.com,
	"Joey Gouly" <joey.gouly@arm.com>,
	"Zenghui Yu" <yuzenghui@huawei.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>, shuah <shuah@kernel.org>,
	"Mark Rutland" <mark.rutland@arm.com>
Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev,
	kvm@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: Re: [PATCH v11 9/9] arm64: armv8_deprecated: apply FEAT_LSUI for swpX emulation.
Date: Fri, 07 Nov 2025 12:52:38 +0100	[thread overview]
Message-ID: <9fffb30d-fc9c-4e2e-94d2-c724e81ae3ac@app.fastmail.com> (raw)
In-Reply-To: <20251106094023.1371246-10-yeoreum.yun@arm.com>

On Thu, Nov 6, 2025, at 10:40, Yeoreum Yun wrote:
> apply FEAT_LSUI instruction to emulate deprecated swpX instruction.

Can you explain in the changrelog why you do this?

In particular, is this a performance optimization or is this required
for correctness in some scenario?

I would have expected that there is very little benefit in
changing the swp/swpb emulation here if the existing code
has to remain compiled into the kernel and the overhead of
the trap is so much larger than the uaccess_enable_privileged()
overhead.

> +		curval.var = newval.var = oldval;
> +		newval.raw[idx] = *data;
> +
> +		asm volatile("// __lsui_user_swpb_asm\n"
> +		__LSUI_PREAMBLE
> +		"1: cast	%x2, %x3, %1\n"
> +		"2:\n"
> +		_ASM_EXTABLE_UACCESS_ERR(1b, 2b, %w0)
> +		: "+r" (err), "+Q" (*addr_al), "+r" (curval.var)
> +		: "r" (newval.var)
> +		: "memory");

I see that you fixed the race now. I had written an email about
it earlier when I saw the same mistake you found as well, but
it got stuck in my drafts folder. The new version looks correct
to me, I'm just not sure we need the added complexity.

     Arnd

  reply	other threads:[~2025-11-07 11:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-06  9:40 [PATCH v11 0/9] support FEAT_LSUI Yeoreum Yun
2025-11-06  9:40 ` [PATCH v11 1/9] arm64: cpufeature: add FEAT_LSUI Yeoreum Yun
2025-11-06  9:40 ` [PATCH v11 2/9] KVM: arm64: expose FEAT_LSUI to guest Yeoreum Yun
2025-11-06  9:40 ` [PATCH v11 3/9] KVM: arm64: kselftest: set_id_regs: add test for FEAT_LSUI Yeoreum Yun
2025-11-06  9:40 ` [PATCH v11 4/9] arm64: Kconfig: Detect toolchain support for LSUI Yeoreum Yun
2025-11-06  9:40 ` [PATCH v11 5/9] arm64: futex: refactor futex atomic operation Yeoreum Yun
2025-11-06  9:40 ` [PATCH v11 6/9] arm64: futex: support futex with FEAT_LSUI Yeoreum Yun
2025-11-06  9:40 ` [PATCH v11 7/9] arm64: separate common LSUI definitions into lsui.h Yeoreum Yun
2025-11-06  9:40 ` [PATCH v11 8/9] arm64: armv8_deprecated: convert user_swpX to inline function Yeoreum Yun
2025-11-06  9:40 ` [PATCH v11 9/9] arm64: armv8_deprecated: apply FEAT_LSUI for swpX emulation Yeoreum Yun
2025-11-07 11:52   ` Arnd Bergmann [this message]
2025-11-07 14:19     ` Yeoreum Yun
2025-11-07 14:24       ` Arnd Bergmann
2025-11-07 15:57         ` Yeoreum Yun

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=9fffb30d-fc9c-4e2e-94d2-c724e81ae3ac@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=ardb@kernel.org \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=joey.gouly@arm.com \
    --cc=kevin.brodsky@arm.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=maz@kernel.org \
    --cc=miko.lenczewski@arm.com \
    --cc=oliver.upton@linux.dev \
    --cc=pbonzini@redhat.com \
    --cc=scott@os.amperecomputing.com \
    --cc=shuah@kernel.org \
    --cc=suzuki.poulose@arm.com \
    --cc=will@kernel.org \
    --cc=yangyicong@hisilicon.com \
    --cc=yeoreum.yun@arm.com \
    --cc=yuzenghui@huawei.com \
    /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

all inboxes | Powered by JetHome®