[PATCH] arm: add support for TIF_NOTIFY_SIGNAL

Russell King - ARM Linux admin linux at armlinux.org.uk
Thu Oct 29 13:01:10 EDT 2020


On Thu, Oct 29, 2020 at 10:35:54AM -0600, Jens Axboe wrote:
> On 10/29/20 10:29 AM, Russell King - ARM Linux admin wrote:
> > On Thu, Oct 29, 2020 at 10:11:07AM -0600, Jens Axboe wrote:
> >> Wire up TIF_NOTIFY_SIGNAL handling for arm.
> >>
> >> Cc: linux-arm-kernel at lists.infradead.org
> >> Signed-off-by: Jens Axboe <axboe at kernel.dk>
> >> ---
> >>
> >> 5.11 has support queued up for TIF_NOTIFY_SIGNAL, see this posting
> >> for details:
> >>
> >> https://lore.kernel.org/io-uring/20201026203230.386348-1-axboe@kernel.dk/
> >>
> >> As part of that work, I'm adding TIF_NOTIFY_SIGNAL support to all archs,
> >> as that will enable a set of cleanups once all of them support it.
> >>
> >> This needs a bit of asm help, immediate doesn't like anything outside
> >> of 1 byte, it seems. Any clues?
> > 
> > Correct - immediates take an 8 bit value shifted by an even number of
> > bits.
> > 
> > I'm tempted to suggest that we simplify things by making TIF bits 0..15
> > invoke do_work_pending() no matter what - which will require a comment
> > in thread_info.h that all those bits will have that effect. The
> > resulting assembly would be:
> > 
> >  	ldr	r1, [tsk, #TI_FLAGS]		@ re-check for syscall tracing
> > -	tst	r1, #_TIF_SYSCALL_WORK | _TIF_WORK_MASK
> > +	movs	r1, r1, lsl #16
> > 
> > which avoids the additional load caused by "ldr r2, =..."
> > 
> > It's not like we're desperate for bits here.
> 
> So renumber TIF bits that don't need to worry about do_work_pending() >
> 15 then? I agree, there's plenty of bits available, so seems reasonable
> to me. But probably more work in terms of other bits being tested with
> tstcurrently - at least when I looked, I could not find any of them I
> could successfully remap from < 8 to > 8.
> 
> Any chance I can talk you into hacking that up?

I don't believe that there's any need to do any renumbering.

_TIF_WORK_MASK covers bits 0-3. _TIF_SYSCALL_WORK covers bits 4-7.
Then we have 17, 18, and 20 which are not used to trigger the
do_work_pending().

So, I think it's just a case of changing what you're doing in the
assembly to my suggestion, and adding a comment to thread_info.h
noting that bits 0-15 will trigger a call into do_work_pending()
when returning to userspace.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!



More information about the linux-arm-kernel mailing list