Re: [PATCH v2 04/10] s390/runtime-const: Serialize text patching with text_mutex
From: Heiko Carstens
Date: Wed Oct 28 2026 - 09:46:08 EST
On Wed, Oct 28, 2026 at 01:22:30PM +0100, Ilya Leoshkevich wrote:
> On 10/28/26 12:09, Heiko Carstens wrote:
> > On Wed, Oct 28, 2026 at 11:58:27AM +0100, Ilya Leoshkevich wrote:
> > > > @@ -88,6 +89,7 @@ static inline void __runtime_fixup_mask(void *where, unsigned long val)
> > > > static inline void runtime_const_fixup(void (*fn)(void *, unsigned long),
> > > > unsigned long val, s32 *start, s32 *end)
> > > > {
> > > > + guard(mutex)(&text_mutex);
> > > > while (start < end) {
> > > > fn(*start + (void *)start, val);
> > > > start++;
> > >
> > > Interesting, so clang is able to propagate context even through indirect
> > > calls without explicit annotations?
> >
> > There is no clang context analysis involved here - this is purely lockdep
> > based (with the last patch of this series, which adds lockdep_assert_held()
> > to s390_kernel_write()).
>
> Ah, I see, it's stated right in the first line of the cover letter.
> Did you consider using it though?
Yes I did, but if I add __must_hold(text_mutex) to the inlined
s390_kernel_write(), then clang cannot prove at all call sites that the lock
is actually held - so plenty of additional annotations would be required (if
possible at all), and then I decided to drop that approach and rely only on
lockdep.