<div dir="ltr">Hi,<br><br>We have two Freescale PowerPC boards on which we're trying to enable DEBUG_PAGEALLOC with the hope that we'll see an exception whenever some code tries to modify a page that's been already freed. To test it, we wrote this sample code -<br>
<br>===<br>#define BUF_SIZE    4096<br>void<br>pagealloc_test(void)<br>{<br>    char *buf = kmalloc(BUF_SIZE, GFP_KERNEL);<br><br>    if (!buf) {<br>        printk("%s[%d] - alloc failed!\n", __func__, __LINE__);<br>
        return;<br>    }<br>    printk("%s[%d] - alloc'd\n", __func__, __LINE__);<br>    memset(&buf[0], 0, BUF_SIZE);<br>    printk("%s[%d] - memset'd\n", __func__, __LINE__);<br>    kfree(buf);<br>
    printk("%s[%d] - free'd\n", __func__, __LINE__);<br>    memset(&buf[0], 1, BUF_SIZE);<br>    printk("%s[%d] - memset'd after free!\n", __func__, __LINE__);<br>}<br>===<br><br>Here, the last memset() should generate an exception if PAGEALLOC code correctly unmapped the page during kfree(). However, kernel is happily running after the memset post-free. Any clue? <br>
Also, the 2nd board has Book-E which has a different MMU architecture. Here, I saw that the function __change_page_attr() always returns as the condition v_mapped_by_tlbcam() is true. How do we remove the pte entry from the TLB in this case?  Has anyone tried DEBUG_PAGEALLOC on Book-E?<br>
<br>Please find the board details below - <br>Board 1: CPU - e300c4, kernel 2.6-25<br>====================================<br>CONFIG_6xx=y<br>CONFIG_PPC_FPU=y<br>CONFIG_PPC_STD_MMU=y<br>CONFIG_PPC_STD_MMU_32=y<br>CONFIG_PPC32=y<br>
CONFIG_WORD_SIZE=32<br>CONFIG_PPC_MERGE=y<br>CONFIG_MMU=y<br>CONFIG_IRQ_PER_CPU=y<br>CONFIG_PPC=y<br><br>Board 2: CPU - e500v2, kernel 3.0-34<br>====================================<br># CONFIG_PPC_BOOK3S_32 is not set<br>
CONFIG_PPC_85xx=y<br>CONFIG_E500=y<br># CONFIG_PPC_E500MC is not set<br>CONFIG_FSL_EMB_PERFMON=y<br>CONFIG_BOOKE=y<br>CONFIG_FSL_BOOKE=y<br>CONFIG_PPC_FSL_BOOK3E=y<br># CONFIG_PHYS_64BIT is not set<br>CONFIG_SPE=y<br>CONFIG_PPC_MMU_NOHASH=y<br>
CONFIG_PPC_MMU_NOHASH_32=y<br>CONFIG_PPC_BOOK3E_MMU=y<br># CONFIG_PPC_MM_SLICES is not set<br>CONFIG_SMP=y<br>CONFIG_NR_CPUS=2<br>CONFIG_PPC32=y<br>CONFIG_32BIT=y<br>CONFIG_WORD_SIZE=32<br># CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set<br>
# CONFIG_ARCH_DMA_ADDR_T_64BIT is not set<br>CONFIG_MMU=y<br>CONFIG_NR_IRQS=512<br>CONFIG_PPC=y<br><br>Regards,<br>Partha<br></div>