# Re: \[PATCH 07/19\] LoongArch: Add process management

- From: Huacai Chen \<hidden\>
- Date: 2021-08-12 11:17:43 
- List: linux-arch
- Page: https://ratatoskr.run/linux-arch/2021/08/13337202
- Thread: https://ratatoskr.run/linux-arch/2021/07/13337006/t/2.md

```text
Hi, Peter and Arnd,

On Tue, Jul 6, 2021 at 7:09 PM Peter Zijlstra [ref] wrote:
>
> On Tue, Jul 06, 2021 at 12:16:37PM +0200, Arnd Bergmann wrote:
> > On Tue, Jul 6, 2021 at 6:18 AM Huacai Chen [ref] wrote:
> >
> > > +void arch_cpu_idle(void)
> > > +{
> > > +       local_irq_enable();
> > > +       __arch_cpu_idle();
> > > +}
> >
> > This looks racy: What happens if an interrupt is pending and hits before
> > entering __arch_cpu_idle()?
>
> They fix it up in their interrupt handler by moving the IP over the
> actual IDLE instruction..
>
> Still the above is broken in that local_irq_enable() will have all sorts
> of tracing, but RCU is disabled at this point, so it is still very much
> broken.
This is a sad story, the idle instruction cannot execute with irq
disabled, we can only copy ugly code from MIPS.

Huacai
```
