<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div>Isn't the problem actually that we read the section entry wrong?<br>The following (and attached) is the fix I've been using for this.</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;">Oza: it is not a problem as none of the kernel section level translations goes through vtop.</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;">if you look at <br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif;
 background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;">arm_kvtop(struct task_context *tc, ulong kvaddr, physaddr_t *paddr, int verbose)<br>{<br>  <br>    if (!IS_KVADDR(kvaddr))<br>        return FALSE;<br><br>    if (!vt->vmalloc_start) {<br>        *paddr = VTOP(kvaddr);<br>        return TRUE;<br>    }<br><br>    if (!IS_VMALLOC_ADDR(kvaddr)) {<br>        *paddr = VTOP(kvaddr);<br>        if (!verbose)<br>            return TRUE;<br>    }<br><br>    return arm_vtop(kvaddr, (ulong *)vt->kernel_pgd[0],
 paddr, verbose);</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;">it just uses VTOP for any kernel address other than vmalloc.</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;">and vmalloc addresses are not falling in sections.</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;">may in kernel_init part it might be
 called, but it is a problem only if 20th bit set; and while section translation we mask 20th bit.<br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div>Regards,</div><div>Oza.<br></div>  <div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"> <div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"> <div dir="ltr"> <font face="Arial" size="2"> <hr size="1">  <b><span style="font-weight: bold;">From:</span></b> Rabin Vincent <rabin@rab.in><br> <b><span style="font-weight: bold;">To:</span></b> "Discussion list for crash utility usage, maintenance and development" <crash-utility@redhat.com> <br><b><span style="font-weight: bold;">Cc:</span></b> Thomas Fänge <thomas.fange@sonymobile.com> <br> <b><span style="font-weight: bold;">Sent:</span></b> Thursday, 4 October
 2012 2:35 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [Crash-utility] using crash for ARM<br> </font> </div> <br>2012/10/4 Mika Westerberg <<a ymailto="mailto:mika.westerberg@iki.fi" href="mailto:mika.westerberg@iki.fi">mika.westerberg@iki.fi</a>>:<br>> The unity-mapped region is mapped using 1MB pages. However, we actually have<br>> (when using the Linux ARM 2-level translation scheme):<br>><br>> see arch/arm/include/asm/pgtable-2level.h:<br>><br>> #define PMD_SHIFT               21<br>> #define PGDIR_SHIFT             21<br>><br>> #define PTRS_PER_PGD            2048<br>><br>> So we have 2048 entries in a PGD instead of 4096 making a PGD entry an array<br>> of "two pointers".<br>><br>> Anyway as you and Paawan suggested it looks like a bug - we always use the<br>> first entry instead
 of the second given that bit 20 is set in the virtual<br>> address.<br><br>Isn't the problem actually that we read the section entry wrong?<br>The following (and attached) is the fix I've been using for this.<br><br>Rabin<br><br>diff --git a/arm.c b/arm.c<br>index 5930c02..4e7b6dc 100644<br>--- a/arm.c<br>+++ b/arm.c<br>@@ -957,12 +957,14 @@ arm_vtop(ulong vaddr, ulong *pgd, physaddr_t<br>*paddr, int verbose)<br>             MKSTR((ulong)page_middle)), pmd_pte);<br><br>     if ((pmd_pte & PMD_TYPE_MASK) == PMD_TYPE_SECT) {<br>+        ulong sectionbase = pmd_pte & _SECTION_PAGE_MASK;<br>+<br>         if (verbose) {<br>             fprintf(fp, " PAGE: %s  (1MB)\n\n",<br>                 mkstring(buf, VADDR_PRLEN,
 RJUST | LONG_HEX,<br>-                MKSTR(PAGEBASE(pmd_pte))));<br>+                MKSTR(sectionbase)));<br>         }<br>-        *paddr = PAGEBASE(pmd_pte) + (vaddr & ~_SECTION_PAGE_MASK);<br>+        *paddr = sectionbase + (vaddr & ~_SECTION_PAGE_MASK);<br>         return TRUE;<br>     }<br><br>--<br>Crash-utility mailing list<br><a ymailto="mailto:Crash-utility@redhat.com" href="mailto:Crash-utility@redhat.com">Crash-utility@redhat.com</a><br><a href="https://www.redhat.com/mailman/listinfo/crash-utility" target="_blank">https://www.redhat.com/mailman/listinfo/crash-utility</a><br><br> </div> </div>  </div></body></html>