Re: [PATCH v6 1/1] MIPS: Fix idle VS timer enqueue
From: Marco Crivellari
Date: Thu Mar 20 2025 - 04:45:33 EST
Hi,
yesterday I made this changes:
@@ -128,7 +128,11 @@ LEAF(__r4k_wait)
*/
wait
/* End of idle interrupt region. */
-1:
+SYM_INNER_LABEL(__r4k_wait_exit, SYM_L_LOCAL)
+ /* Check idle interrupt region size. */
+ .ifne __r4k_wait_exit - __r4k_wait - 36
+ .error "Idle interrupt region size mismatch: expected 36 bytes."
+ .endif
jr ra
nop
.set pop
@@ -139,7 +143,7 @@ LEAF(__r4k_wait)
.set push
.set noat
MFC0 k0, CP0_EPC
- PTR_LA k1, 1b
+ PTR_LA k1, __r4k_wait_exit
/* 36 byte idle interrupt region. */
ori k0, 0x1f
PTR_ADDIU k0, 5
Would it be ok to have the check done in this way?
Thanks
On Wed, Mar 19, 2025 at 11:09 PM Thomas Bogendoerfer
<tsbogend@xxxxxxxxxxxxxxxx> wrote:
>
> On Wed, Mar 19, 2025 at 03:43:13PM +0100, Frederic Weisbecker wrote:
> > > > .set MIPS_ISA_ARCH_LEVEL_RAW
> > > > + /*
> > > > + * If an interrupt lands here, between enabling interrupts above and
> > > > + * going idle on the next instruction, we must *NOT* go idle since the
> > > > + * interrupt could have set TIF_NEED_RESCHED or caused a timer to need
> > > > + * resched. Fall through -- see rollback_handler below -- and have
> > > > + * the idle loop take care of things.
> > > > + */
> > > > wait
> > > > - /* end of rollback region (the region size must be power of two) */
> > > > + /* End of idle interrupt region. */
> > > > 1:
> > >
> > > please give this label a name for example __r4k_wait_exit and do a
> > > runtime check that it really has 36 bytes offset to __r4k_wait
> >
> > Where would be the best place for that?
> >
> > arch/mips/kernel/setup.c:setup_arch() maybe?
>
> scratch runtime check, a compile check is what I wanted to write...
>
> something like
>
> .if ((__r4k_wait_exit - __r4k_wait) != 36)
> .err
> .endif
>
> Thomas.
>
> --
> Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
> good idea. [ RFC1925, 2.3 ]
--
Marco Crivellari
L3 Support Engineer, Technology & Product
marco.crivellari@xxxxxxxx