Re: [Crash-utility] [PATCH] x86_64: vtop supports 1G huge pages
> -Original Message- > From: Li RongQing > > Crash utility currently does not supporting virtual to physical > address translation for 1G huge pages on x86_64, This patch tries > to address this issue by providing address translation > support for huge pages in 'vtop' command. Good catch! I think it would be better to add the same behavior also to x86_64_kvtop(). Could you do it? Thanks, Kazu > > Without this patch: > crash> vtop 7f6e4000 > VIRTUAL PHYSICAL > vtop: seek error: physical address: 3f53f000f000 type: "page table" > crash> > > With this patch: > crash> vtop 7f6e4000 > VIRTUAL PHYSICAL > 7f6e4000 1d4000 > >PGD: 1fdb6cc7f0 => 8001e715f067 >PUD: 1e715fdc8 => 801d48e7 > PAGE: 1d4000 (1GB) > > PTE PHYSICAL FLAGS > 801d48e7 1d4000 (PRESENT|RW|USER|ACCESSED|DIRTY|PSE|NX) > > VMA START END FLAGS FILE > 99869b7791f8 7f6e4000 7f6ec000 c4400fb > /var/lib/libvirt/qemu/hugetlbfs/qemu_back_mem._objects_ram-node0.WjBfNa > > PAGE PHYSICAL MAPPING INDEX CNT FLAGS > d90cf500 1d4000 9968369786500 7 17c000801c > referenced,uptodate,dirty,head > crash> > > Signed-off-by: Li RongQing > Signed-off-by: Chu Kaiping > --- > defs.h | 1 + > x86_64.c | 13 + > 2 files changed, 14 insertions(+) > > diff --git a/defs.h b/defs.h > index aba58ff..e73778b 100644 > --- a/defs.h > +++ b/defs.h > @@ -5996,6 +5996,7 @@ struct machine_specific { > #define VM_FLAGS (VM_ORIG|VM_2_6_11|VM_XEN|VM_XEN_RHEL4|VM_5LEVEL) > > #define _2MB_PAGE_MASK (~((MEGABYTES(2))-1)) > +#define _1GB_PAGE_MASK (~((GIGABYTES(1))-1)) > > #endif > > diff --git a/x86_64.c b/x86_64.c > index 4f1a6d7..98bb685 100644 > --- a/x86_64.c > +++ b/x86_64.c > @@ -2020,6 +2020,19 @@ x86_64_uvtop_level4(struct task_context *tc, ulong > uvaddr, physaddr_t *paddr, in > if (!(pud_pte & _PAGE_PRESENT)) > goto no_upage; > > + if (pud_pte & _PAGE_PSE) { > + if (verbose) { > + fprintf(fp, " PAGE: %lx (1GB)\n\n", > +PAGEBASE(pud_pte) & PHYSICAL_PAGE_MASK); > + x86_64_translate_pte(pud_pte, 0, 0); > + } > + > + physpage = (PAGEBASE(pud_pte) & PHYSICAL_PAGE_MASK) + > +(uvaddr & ~_1GB_PAGE_MASK); > + *paddr = physpage; > + return TRUE; > + } > + > /* > * pmd = pmd_offset(pud, address); >*/ > -- > 2.16.2 > > -- > Crash-utility mailing list > Crash-utility@redhat.com > https://www.redhat.com/mailman/listinfo/crash-utility -- Crash-utility mailing list Crash-utility@redhat.com https://www.redhat.com/mailman/listinfo/crash-utility
[Crash-utility] [PATCH] x86_64: vtop supports 1G huge pages
From: Li RongQing Crash utility currently does not supporting virtual to physical address translation for 1G huge pages on x86_64, This patch tries to address this issue by providing address translation support for huge pages in 'vtop' command. Without this patch: crash> vtop 7f6e4000 VIRTUAL PHYSICAL vtop: seek error: physical address: 3f53f000f000 type: "page table" crash> With this patch: crash> vtop 7f6e4000 VIRTUAL PHYSICAL 7f6e4000 1d4000 PGD: 1fdb6cc7f0 => 8001e715f067 PUD: 1e715fdc8 => 801d48e7 PAGE: 1d4000 (1GB) PTE PHYSICAL FLAGS 801d48e7 1d4000 (PRESENT|RW|USER|ACCESSED|DIRTY|PSE|NX) VMA START END FLAGS FILE 99869b7791f8 7f6e4000 7f6ec000 c4400fb /var/lib/libvirt/qemu/hugetlbfs/qemu_back_mem._objects_ram-node0.WjBfNa PAGE PHYSICAL MAPPING INDEX CNT FLAGS d90cf500 1d4000 9968369786500 7 17c000801c referenced,uptodate,dirty,head crash> Signed-off-by: Li RongQing Signed-off-by: Chu Kaiping --- defs.h | 1 + x86_64.c | 13 + 2 files changed, 14 insertions(+) diff --git a/defs.h b/defs.h index aba58ff..e73778b 100644 --- a/defs.h +++ b/defs.h @@ -5996,6 +5996,7 @@ struct machine_specific { #define VM_FLAGS (VM_ORIG|VM_2_6_11|VM_XEN|VM_XEN_RHEL4|VM_5LEVEL) #define _2MB_PAGE_MASK (~((MEGABYTES(2))-1)) +#define _1GB_PAGE_MASK (~((GIGABYTES(1))-1)) #endif diff --git a/x86_64.c b/x86_64.c index 4f1a6d7..98bb685 100644 --- a/x86_64.c +++ b/x86_64.c @@ -2020,6 +2020,19 @@ x86_64_uvtop_level4(struct task_context *tc, ulong uvaddr, physaddr_t *paddr, in if (!(pud_pte & _PAGE_PRESENT)) goto no_upage; + if (pud_pte & _PAGE_PSE) { + if (verbose) { + fprintf(fp, " PAGE: %lx (1GB)\n\n", + PAGEBASE(pud_pte) & PHYSICAL_PAGE_MASK); + x86_64_translate_pte(pud_pte, 0, 0); + } + + physpage = (PAGEBASE(pud_pte) & PHYSICAL_PAGE_MASK) + + (uvaddr & ~_1GB_PAGE_MASK); + *paddr = physpage; + return TRUE; + } + /* * pmd = pmd_offset(pud, address); */ -- 2.16.2 -- Crash-utility mailing list Crash-utility@redhat.com https://www.redhat.com/mailman/listinfo/crash-utility
[Crash-utility] [PATCH] x86_64: vtop supports 1G huge pages
From: Li RongQing Crash utility currently does not supporting virtual to physical address translation for 1G huge pages on x86_64, This patch tries to address this issue by providing address translation support for huge pages in 'vtop' command. Without this patch: crash> vtop 7f6e4000 VIRTUAL PHYSICAL vtop: seek error: physical address: 3f53f000f000 type: "page table" crash> With this patch: crash> vtop 7f6e4000 VIRTUAL PHYSICAL 7f6e4000 1d4000 PGD: 1fdb6cc7f0 => 8001e715f067 PUD: 1e715fdc8 => 801d48e7 PAGE: 1d4000 (1GB) PTE PHYSICAL FLAGS 801d48e7 1d4000 (PRESENT|RW|USER|ACCESSED|DIRTY|PSE|NX) VMA START END FLAGS FILE 99869b7791f8 7f6e4000 7f6ec000 c4400fb /var/lib/libvirt/qemu/hugetlbfs/qemu_back_mem._objects_ram-node0.WjBfNa PAGE PHYSICAL MAPPING INDEX CNT FLAGS d90cf500 1d4000 9968369786500 7 17c000801c referenced,uptodate,dirty,head crash> Signed-off-by: Li RongQing Signed-off-by: Chu Kaiping --- defs.h | 1 + x86_64.c | 13 + 2 files changed, 14 insertions(+) diff --git a/defs.h b/defs.h index aba58ff..e73778b 100644 --- a/defs.h +++ b/defs.h @@ -5996,6 +5996,7 @@ struct machine_specific { #define VM_FLAGS (VM_ORIG|VM_2_6_11|VM_XEN|VM_XEN_RHEL4|VM_5LEVEL) #define _2MB_PAGE_MASK (~((MEGABYTES(2))-1)) +#define _1GB_PAGE_MASK (~((GIGABYTES(1))-1)) #endif diff --git a/x86_64.c b/x86_64.c index 4f1a6d7..98bb685 100644 --- a/x86_64.c +++ b/x86_64.c @@ -2020,6 +2020,19 @@ x86_64_uvtop_level4(struct task_context *tc, ulong uvaddr, physaddr_t *paddr, in if (!(pud_pte & _PAGE_PRESENT)) goto no_upage; + if (pud_pte & _PAGE_PSE) { + if (verbose) { + fprintf(fp, " PAGE: %lx (1GB)\n\n", + PAGEBASE(pud_pte) & PHYSICAL_PAGE_MASK); + x86_64_translate_pte(pud_pte, 0, 0); + } + + physpage = (PAGEBASE(pud_pte) & PHYSICAL_PAGE_MASK) + + (uvaddr & ~_1GB_PAGE_MASK); + *paddr = physpage; + return TRUE; + } + /* * pmd = pmd_offset(pud, address); */ -- 2.16.2 -- Crash-utility mailing list Crash-utility@redhat.com https://www.redhat.com/mailman/listinfo/crash-utility