在 2020年06月12日 00:00, crash-utility-request(a)redhat.com 写道:
Looks good to me, thank you Li RongQing. Please wait for another
ack.
The v2 looks good to me.
Acked-by: Lianbo Jiang <lijiang(a)redhat.com>
Acked-by: Kazuhito Hagio <k-hagio-ab(a)nec.com>
If someone can comment or create a patch for Xen, please let us know.
I cannot test it, but I think we can integrate it with this patch if any.
Anyway, this is a draft patch, but not sure if the patch happens to work
on the Xen. I don't have the Xen environment to confirm it.
If Xen engineers would like to verify the draft patch, that would be nice.
Thanks.
Lianbo
diff --git a/x86_64.c b/x86_64.c
index fc05e8af5695..90361a7c39c8 100644
--- a/x86_64.c
+++ b/x86_64.c
@@ -2087,6 +2087,7 @@ x86_64_uvtop_level4_xen_wpt(struct task_context *tc, ulong uvaddr,
physaddr_t *p
{
ulong pgd_pte;
ulong pud_pte;
+ ulong pseudo_pud_pte;
ulong pmd_pte;
ulong pseudo_pmd_pte;
ulong pte;
@@ -2110,6 +2111,38 @@ x86_64_uvtop_level4_xen_wpt(struct task_context *tc, ulong uvaddr,
physaddr_t *p
if (!(pud_pte & _PAGE_PRESENT))
goto no_upage;
+ if (pud_pte & _PAGE_PSE) {
+ if (verbose)
+ fprintf(fp, " PAGE: %lx (1GB) [machine]\n",
+ PAGEBASE(pud_pte) & PHYSICAL_PAGE_MASK);
+
+ pseudo_pud_pte = xen_m2p(PAGEBASE(pud_pte));
+
+ if (pseudo_pud_pte == XEN_MACHADDR_NOT_FOUND) {
+ if (verbose)
+ fprintf(fp, " PAGE: page not available\n");
+ *paddr = PADDR_NOT_AVAILABLE;
+ return FALSE;
+ }
+
+ pseudo_pud_pte |= PAGEOFFSET(pud_pte);
+
+ if (verbose) {
+ fprintf(fp, " PAGE: %s (1GB)\n\n",
+ mkstring(buf, VADDR_PRLEN, RJUST|LONG_HEX,
+ MKSTR(PAGEBASE(pseudo_pud_pte) &
+ PHYSICAL_PAGE_MASK)));
+
+ x86_64_translate_pte(pseudo_pud_pte, 0, 0);
+ }
+
+ physpage = (PAGEBASE(pseudo_pud_pte) & PHYSICAL_PAGE_MASK) +
+ (uvaddr & ~_1GB_PAGE_MASK);
+
+ *paddr = physpage;
+ return TRUE;
+ }
+
/*
* pmd = pmd_offset(pud, address);
*/
@@ -2504,8 +2537,9 @@ no_kpage:
static int
x86_64_kvtop_xen_wpt(struct task_context *tc, ulong kvaddr, physaddr_t *paddr, int
verbose)
{
- ulong *pgd;
+ ulong *pgd;
ulong pud_pte;
+ ulong pseudo_pud_pte;
ulong pmd_pte;
ulong pseudo_pmd_pte;
ulong pte;
@@ -2524,6 +2558,36 @@ x86_64_kvtop_xen_wpt(struct task_context *tc, ulong kvaddr,
physaddr_t *paddr, i
if (!(pud_pte & _PAGE_PRESENT))
goto no_kpage;
+ if (pud_pte & _PAGE_PSE) {
+ if (verbose)
+ fprintf(fp, " PAGE: %lx (1GB) [machine]\n",
+ PAGEBASE(pud_pte) & PHYSICAL_PAGE_MASK);
+
+ pseudo_pud_pte = xen_m2p(PAGEBASE(pud_pte));
+
+ if (pseudo_pud_pte == XEN_MACHADDR_NOT_FOUND) {
+ if (verbose)
+ fprintf(fp, " PAGE: page not available\n");
+ *paddr = PADDR_NOT_AVAILABLE;
+ return FALSE;
+ }
+
+ pseudo_pud_pte |= PAGEOFFSET(pud_pte);
+ if (verbose) {
+ fprintf(fp, " PAGE: %s (1GB)\n\n",
+ mkstring(buf, VADDR_PRLEN, RJUST|LONG_HEX,
+ MKSTR(PAGEBASE(pseudo_pud_pte) &
+ PHYSICAL_PAGE_MASK)));
+
+ x86_64_translate_pte(pseudo_pud_pte, 0, 0);
+ }
+ physpage = (PAGEBASE(pseudo_pud_pte) & PHYSICAL_PAGE_MASK) +
+ (kvaddr & ~_1GB_PAGE_MASK);
+
+ *paddr = physpage;
+ return TRUE;
+ }
+
/*
* pmd = pmd_offset(pgd, addr);
*/