[PATCH v8 5/5] arm64: futex: support futex with FEAT_LSUI

Yeoreum Yun yeoreum.yun at arm.com
Wed Sep 17 07:07:05 PDT 2025


Hi Mark,

[...]

> > > 		FIELD_MODIFY(GENMASK_U64(31, 0), &oval64, oldval);
> > > 		FIELD_MODIFY(GENMASK_U64(31, 0), &nval64, newval);
> > > 	} else {
> > > 		FIELD_MODIFY(GENMASK_U64(63, 32), &oval64, oldval);
> > > 		FIELD_MODIFY(GENMASK_U64(63, 32), &nval64, newval);
> > > 	}
> > > 	orig64 = oval64;
> > >
> > > 	if (__lsui_cmpxchg64(uaddr_al, &oval64, nval64))
> > > 		return -EFAULT;
> > >
> > > 	if (oval64 != orig64)
> > > 		return -EAGAIN;
> > >
> > > 	*oval = oldval;
> > > 	return 0;
> > > }
> >
> > Hmm I think this wouldn'b cover the case below when big-endianess used.
> >
> > struct {
> >   u32 others 0x55667788;
> >   u32 futex = 0x11223344;
> > };
> >
> > In this case, memory layout would be:
> >
> >   55 66 77 88 11 22 33 44
> >
> > So, the value of fetched oval64 is 0x5566778811223344;
>
> Ok, so the entire struct is aligned to 8 bytes, and the 'futex' field is
> 4 bytes after that (and not itself aligned to 8 bytes). In that case:
[...]

Sorry and thanks for explation. I've misread the condition as

  if (IS_ALIGNED(uaddr, sizeof(64) && IS_ENABLED(CONFIG_CPU_LITTLE_ENDIAN)

Again. sorry for my bad eyes :\


[...]

--
Sincerely,
Yeoreum Yun



More information about the linux-arm-kernel mailing list