public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@efficios•com>
To: "André Almeida" <andrealmeid@igalia•com>,
	"Catalin Marinas" <catalin.marinas@arm•com>,
	"Will Deacon" <will@kernel•org>,
	"Thomas Gleixner" <tglx@kernel•org>,
	"Mark Rutland" <mark.rutland@arm•com>,
	"Sebastian Andrzej Siewior" <bigeasy@linutronix•de>,
	"Carlos O'Donell" <carlos@redhat•com>,
	"Peter Zijlstra" <peterz@infradead•org>,
	"Florian Weimer" <fweimer@redhat•com>,
	"Rich Felker" <dalias@aerifal•cx>,
	"Torvald Riegel" <triegel@redhat•com>,
	"Darren Hart" <dvhart@infradead•org>,
	"Ingo Molnar" <mingo@kernel•org>,
	"Davidlohr Bueso" <dave@stgolabs•net>,
	"Arnd Bergmann" <arnd@arndb•de>,
	"Liam R . Howlett" <Liam.Howlett@oracle•com>,
	"Uros Bizjak" <ubizjak@gmail•com>,
	"Thomas Weißschuh" <linux@weissschuh•net>
Cc: linux-arm-kernel@lists•infradead.org,
	linux-kernel@vger•kernel.org, linux-arch@vger•kernel.org,
	kernel-dev@igalia•com
Subject: Re: [PATCH v3 2/5] arm64: vdso: Implement __vdso_futex_robust_try_unlock()
Date: Fri, 29 May 2026 13:47:28 -0400	[thread overview]
Message-ID: <844b56fe-b5d4-42b2-ae8e-ce07980d0f50@efficios.com> (raw)
In-Reply-To: <20260529-tonyk-robust_arm-v3-2-a6f02684d4fe@igalia.com>

On 2026-05-29 12:33, André Almeida wrote:
> Based on the x86 implementation, implement the vDSO function for unlocking
> a robust futex correctly.
> 
> Commit xxxxxxxxxxxx ("x86/vdso: Implement __vdso_futex_robust_try_unlock()") has
> the full explanation about why this mechanism is needed.
> 
> The unlock assembly sequence for arm64 is:
> 
> 	__vdso_futex_robust_list64_try_unlock:
> 	retry:
> 		ldxr	w8, [x0] // Load the value from *futex
> 		cmp	w1, w8   // Compare with TID
> 		b.ne	__vdso_futex_list64_try_unlock_cs_end
> 		stlxr	w9, wzr, [x0] // Try to zero *futex

So it looks like stlxr can be successful, and the process is killed
right here. This is not within the start/end critical section, so the
fixup is missed ? Or am I missing something ?

> 		cbnz	w9, retry
> 	__vdso_futex_list64_try_unlock_cs_start:
> 		str	xzr, [x2] // After zeroing *futex, zero *op_pending
> 	__vdso_futex_list64_try_unlock_cs_end>:
> 
> The decision regarding if the pointer should be cleared or not lies on checking
> the condition flag zero:
> 
> 	return (regs->user_regs.pstate & PSR_Z_BIT) ?
> 		(void __user *) regs->user_regs.regs[2] : NULL;
> 
> If it's not zero, that means that the comparassion worked and the kernel should

comparison

> clear op_pending (if userspace didn't managed to) stored at x2.
Thanks,

Mathieu

-- 
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com


  parent reply	other threads:[~2026-05-29 17:47 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-29 16:33 [PATCH v3 0/5] arm64: vdso: Implement __vdso_futex_robust_try_unlock() André Almeida
2026-05-29 16:33 ` [PATCH v3 1/5] arm64: vdso: Prepare for robust futex unlock support André Almeida
2026-05-29 17:16   ` Thomas Weißschuh
2026-06-01 16:17     ` André Almeida
2026-05-29 16:33 ` [PATCH v3 2/5] arm64: vdso: Implement __vdso_futex_robust_try_unlock() André Almeida
2026-05-29 17:18   ` Thomas Weißschuh
2026-05-29 17:47   ` Mathieu Desnoyers [this message]
2026-06-01 16:22     ` André Almeida
2026-05-29 16:33 ` [PATCH v3 3/5] selftests: futex: Add support for aarch64 in robust_list_critical André Almeida
2026-05-29 16:33 ` [PATCH v3 4/5] arm64: vdso32: Bring vdso32-offsets.h back André Almeida
2026-05-29 16:33 ` [PATCH v3 5/5] arm64: vdso32: Implement __vdso_futex_robust_try_unlock() André Almeida
2026-05-29 19:15   ` Mathieu Desnoyers
2026-06-02  8:30   ` Thomas Weißschuh

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=844b56fe-b5d4-42b2-ae8e-ce07980d0f50@efficios.com \
    --to=mathieu.desnoyers@efficios$(echo .)com \
    --cc=Liam.Howlett@oracle$(echo .)com \
    --cc=andrealmeid@igalia$(echo .)com \
    --cc=arnd@arndb$(echo .)de \
    --cc=bigeasy@linutronix$(echo .)de \
    --cc=carlos@redhat$(echo .)com \
    --cc=catalin.marinas@arm$(echo .)com \
    --cc=dalias@aerifal$(echo .)cx \
    --cc=dave@stgolabs$(echo .)net \
    --cc=dvhart@infradead$(echo .)org \
    --cc=fweimer@redhat$(echo .)com \
    --cc=kernel-dev@igalia$(echo .)com \
    --cc=linux-arch@vger$(echo .)kernel.org \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linux@weissschuh$(echo .)net \
    --cc=mark.rutland@arm$(echo .)com \
    --cc=mingo@kernel$(echo .)org \
    --cc=peterz@infradead$(echo .)org \
    --cc=tglx@kernel$(echo .)org \
    --cc=triegel@redhat$(echo .)com \
    --cc=ubizjak@gmail$(echo .)com \
    --cc=will@kernel$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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