Re: PPC RT Patch..

john cooper
2005-02-24T14:01:08Z

Frank Rowand wrote:
> john cooper wrote:
>> ... There is also a bug fix
>> contained for tlb_gather_mmu() which was causing debug
>> assertions to be generated in a path which attempted to
>> sleep with a non-zero preempt count.
>
>
> Manish Lachwani mentioned to me that he faced the same issue
> with the MIPS RT support and that when he discussed
> it with Ingo that the solution was for include/asm-ppc/tlb.h
> to include/asm-generic/tlb-simple.h when PREEMPT_RT is turned on.
> The patch does this for the #ifdef CONFIG_PPC_STD_MMU case,
> but not for the #else case. I don't know which case is used
> for the Ampro board.

It appeared to me a generic issue though I believe a number
of solutions are possible. asm-generic/tlb.h:tlb_gather_mmu()
expands to linux/percpu.h:get_cpu_var() which does a
preempt_disable() and __get_cpu_var(). This caused the debug
assertion to kick when __page_cache_release() and to a lesser
extent activate_page() attempted to block on a mutex (though
other paths may well exist). My approach was to replace the
outer layer preempt_disable/enable calls with a mutex-spinlock.

The fix was fairly easy once it was known from where the
gratuitous call to preempt_disable() existed. I cobbled
together a logging mechanism which detected the problem. As it
wasn't very general I removed it from the patch. I didn't see
an alternate means of diagnosing such a scenario so I'll likely
address generalizing the code.

-john

--
john.cooper@timesys.com