[BUG][PPC32] Preemption patch for 2.4 Kernels

Gerhard Jaeger g.jaeger at sysgo.com
Thu Oct 7 23:29:12 EST 2004


Hi Robert,

maybe the 2.4 series is somewhat outdatet, but nevertheless used in
several embedded systems and also with your preemption patches.
During some investigations, we found out that the patches found on 
http://www.kernel.org/pub/linux/kernel/people/rml/preempt-kernel/
contain a severe bug, when using the patches on PPC systems. 
The affected function is get_pgd_fast() which is buried in
include/asm-ppc/pgalloc.h

While the original function looks like:
extern __inline__ pgd_t *get_pgd_fast(void)
{
        unsigned long *ret;

        if ((ret = pgd_quicklist) != NULL) {
                pgd_quicklist = (unsigned long *)(*ret);
                ret[0] = 0;
                pgtable_cache_size--;
        } else
                ret = (unsigned long *)get_pgd_slow();
        return (pgd_t *)ret;
}

the patched one is:
extern __inline__ pgd_t *get_pgd_fast(void)
{
        unsigned long *ret;

        preempt_disable();
        if ((ret = pgd_quicklist) != NULL) {
                pgd_quicklist = (unsigned long *)(*ret);
                ret[0] = 0;
                pgtable_cache_size--;
                preempt_enable();
        } else 
                preempt_enable();
                ret = (unsigned long *)get_pgd_slow();
        return (pgd_t *)ret;
}

And exactly the "else" path causes the problems ;) I guess it should be

       } else {
                preempt_enable();
                ret = (unsigned long *)get_pgd_slow();
       }

The attached patch will do it the right way, and you might want to correct
the patches on your web-space.

Best regards,
  Gerhard Jaeger

-- 
Gerhard Jaeger <gjaeger at sysgo.com>            
SYSGO AG                      Embedded and Real-Time Software
www.sysgo.com | www.elinos.com | www.osek.de | www.imerva.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pgalloc.h.diff
Type: text/x-diff
Size: 1474 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20041007/9397d348/attachment.diff>


More information about the Linuxppc-dev mailing list