mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3 0/5] arm64: vdso: Implement __vdso_futex_robust_try_unlock()
@ 2026-05-29 16:33 André Almeida
  2026-05-29 16:33 ` [PATCH v3 1/5] arm64: vdso: Prepare for robust futex unlock support André Almeida
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: André Almeida @ 2026-05-29 16:33 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Thomas Gleixner, Mark Rutland,
	Mathieu Desnoyers, Sebastian Andrzej Siewior,
	Carlos O'Donell, Peter Zijlstra, Florian Weimer, Rich Felker,
	Torvald Riegel, Darren Hart, Ingo Molnar, Davidlohr Bueso,
	Arnd Bergmann, Liam R . Howlett, Uros Bizjak,
	Thomas Weißschuh
  Cc: linux-arm-kernel, linux-kernel, linux-arch, kernel-dev, LKML,
	André Almeida

Hi folks,

This is my take on implementing the new vDSO for unlocking a robust futex in
arm64. If you don't know what's that, Thomas wrote a good summary,
including the motivation for this work and the x86 implementation:

   https://lore.kernel.org/lkml/878qb89g7b.ffs@tglx/

This patchset depends on this series:

   https://lore.kernel.org/lkml/20260402151131.876492985@kernel.org/

The only part that I didn't figure out about this implementation is
something that I have removed from patch 01:

        /*
         * Avoid dereferencing current->mm if not returning from interrupt.
         * current->rseq.event is going to be used subsequently, so bringing the
         * cache line in is not a big deal.
         */
        if (!current->rseq.event.user_irq)
                return;

On arm64 _it seems_ that user_irq is never true. I had to remove this if
to make the code reach __futex_fixup_robust_unlock() and make the test work.

On x86, this is the callstack that sets user_irq to true:

	rseq_note_user_irq_entry
	irqentry_enter_from_user_mode
	exc_debug_user
	noist_exc_debug
	asm_exc_debug

So I'm not sure if there's something missing on arm64 and it should also hit 
irqentry_enter_from_user_mode(), or if we should look into other flag to check
if the task is returing from interrupt.

* Testing

This patchset works fine with the tests proposed at
https://lore.kernel.org/lkml/20260330120118.012924430@kernel.org/

In the series there's also a patch to adapt Sebastian's test to arm64, and it
worked:
https://lore.kernel.org/lkml/20260404093939.7XgeW_54@linutronix.de/

I also used gdb to manually check if the address is cleared when the kernel
interrupts the critical section.

Changes in v3:
 - Change asm to always use x2 to store *pop
 - Fix clang asm errors
 - Moved 32 bit entry point to vdso32/ and use littlearm asm
 - Adapted Sebastians test for arm
v2: https://patch.msgid.link/20260424-tonyk-robust_arm-v2-0-db4e46f752cf@igalia.com

Changes in v2:
 - s/CONFIG_COMPAT/CONFIG_COMPAT_VDSO (Thomas Weißschuh)
 - Fixed linker not finding the symbols (Thomas Weißschuh)
v1: https://patch.msgid.link/20260417-tonyk-robust_arm-v1-0-03aa64e2ff1a@igalia.com

---
André Almeida (5):
      arm64: vdso: Prepare for robust futex unlock support
      arm64: vdso: Implement __vdso_futex_robust_try_unlock()
      selftests: futex: Add support for aarch64 in robust_list_critical
      arm64: vdso32: Bring vdso32-offsets.h back
      arm64: vdso32: Implement __vdso_futex_robust_try_unlock()

 arch/arm64/Kconfig                                 |  1 +
 arch/arm64/Makefile                                |  2 +-
 arch/arm64/include/asm/futex_robust.h              | 20 +++++
 arch/arm64/include/asm/vdso.h                      |  3 +
 arch/arm64/kernel/vdso.c                           | 34 ++++++++
 arch/arm64/kernel/vdso/Makefile                    |  9 ++-
 arch/arm64/kernel/vdso/vdso.lds.S                  |  5 ++
 arch/arm64/kernel/vdso/vfutex.c                    | 34 ++++++++
 arch/arm64/kernel/vdso32/Makefile                  | 10 ++-
 arch/arm64/kernel/vdso32/vdso.lds.S                |  5 ++
 arch/arm64/kernel/vdso32/vfutex.c                  | 33 ++++++++
 arch/x86/entry/vdso/vma.c                          |  4 +-
 include/linux/futex.h                              | 13 +--
 include/vdso/futex.h                               |  1 +
 .../futex/functional/robust_list_critical.c        | 92 ++++++++++++++++++++--
 15 files changed, 245 insertions(+), 21 deletions(-)
---
base-commit: 78333d5371a5fe6f3eaec5e6e4c16d22fe386cbe
change-id: 20260416-tonyk-robust_arm-54ff77d2c4e4

Best regards,
--  
André Almeida <andrealmeid@igalia.com>


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2026-06-02  8:30 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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®