linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Yeoreum Yun <yeoreum.yun@arm.com>
To: catalin.marinas@arm.com, will@kernel.org, maz@kernel.org,
	broonie@kernel.org, oliver.upton@linux.dev,
	miko.lenczewski@arm.com, kevin.brodsky@arm.com, ardb@kernel.org,
	suzuki.poulose@arm.com, lpieralisi@kernel.org,
	yangyicong@hisilicon.com, scott@os.amperecomputing.com,
	joey.gouly@arm.com, yuzenghui@huawei.com, pbonzini@redhat.com,
	shuah@kernel.org, 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 v10 9/9] arm64: armv8_deprecated: apply FEAT_LSUI for swpX emulation.
Date: Tue, 4 Nov 2025 11:01:22 +0000	[thread overview]
Message-ID: <aQndAnoFClKOSer2@e129823.arm.com> (raw)
In-Reply-To: <20251103163224.818353-10-yeoreum.yun@arm.com>

[...]

> +static __always_inline int
> +__lsui_user_swpb_asm(unsigned int *data, unsigned int addr)
> +{
> +	unsigned char idx;
> +	int err;
> +	unsigned int addr_al;
> +	union {
> +		unsigned int var;
> +		unsigned char raw[4];
> +	} data_al;
> +
> +	idx = addr & (sizeof(unsigned int) - 1);
> +	addr_al = ALIGN_DOWN(addr, sizeof(unsigned int));
> +
> +	if (get_user(data_al.var, (unsigned int *)(unsigned long)addr_al))
> +		return -EFAULT;
> +
> +	data_al.raw[idx] = *data;
> +
> +	err = __lsui_user_swp_asm(&data_al.var, addr_al);

I found that using swpt for swpb can cause a race condition
when each CPU accesses its own dedicated byte memory region in 4 bytes.
So, unless there are any comments,
I’ll rework it with a cast in the next version.

> +	if (!err)
> +		*data = data_al.raw[idx];
> +
> +	return err;
> +}
> +#endif /* CONFIG_AS_HAS_LSUI */

Thanks.

--
Sincerely,
Yeoreum Yun


      reply	other threads:[~2025-11-04 11:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-03 16:32 [PATCH v10 0/9] support FEAT_LSUI Yeoreum Yun
2025-11-03 16:32 ` [PATCH v10 1/9] arm64: cpufeature: add FEAT_LSUI Yeoreum Yun
2025-11-03 16:32 ` [PATCH v10 2/9] KVM: arm64: expose FEAT_LSUI to guest Yeoreum Yun
2025-11-03 16:42   ` Mark Brown
2025-11-03 16:32 ` [PATCH v10 3/9] KVM: arm64: kselftest: set_id_regs: add test for FEAT_LSUI Yeoreum Yun
2025-11-03 16:46   ` Mark Brown
2025-11-04 10:55     ` Yeoreum Yun
2025-11-03 16:32 ` [PATCH v10 4/9] arm64: Kconfig: Detect toolchain support for LSUI Yeoreum Yun
2025-11-03 16:32 ` [PATCH v10 5/9] arm64: futex: refactor futex atomic operation Yeoreum Yun
2025-11-03 16:32 ` [PATCH v10 6/9] arm64: futex: support futex with FEAT_LSUI Yeoreum Yun
2025-11-03 16:32 ` [PATCH v10 7/9] arm64: separate common LSUI definitions into lsui.h Yeoreum Yun
2025-11-03 16:32 ` [PATCH v10 8/9] arm64: armv8_deprecated: convert user_swpX to inline function Yeoreum Yun
2025-11-03 16:32 ` [PATCH v10 9/9] arm64: armv8_deprecated: apply FEAT_LSUI for swpX emulation Yeoreum Yun
2025-11-04 11:01   ` Yeoreum Yun [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=aQndAnoFClKOSer2@e129823.arm.com \
    --to=yeoreum.yun@arm.com \
    --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=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;
as well as URLs for NNTP newsgroup(s).