在 2020年06月15日 22:18, HAGIO KAZUHITO(萩尾 一仁) 写道:
> -----Original Message-----
>> 在 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.
>
> Thank you for your draft patch!
> If there is no response to the Xen patch until tomorrow morning, I think
> to apply only Li's patch separately for now.
>
OK, sounds good.
> And one more thing, as we discussed internally, we'd like to introduce a
> title line to crash's commit log for --oneline readability and add helpful
> information more if available. On the other hand, I also would like to
> maintain the crash changelog [0] and its format for searchability.
>
Indeed, it makes reading and searching more convenient.
Thanks.
Lianbo
> [0]
https://crash-utility.github.io/crash.changelog.html
>
> So, for Li's patch, I'll merge it with something like:
>
> [commit log]
> x86_64: Add support for 1GB huge pages to "vtop" command
>
> Add support for 1GB huge page to "vtop" command on x86_64. Without
> this patch, the command with a user virtual address corresponding to
> a 1GB huge page fails with the error message "vtop: seek error:
> physical address: <address> type: "page table"".
>
> crash> vtop 7f6e40000000
> VIRTUAL PHYSICAL
> vtop: seek error: physical address: 3f53f000f000 type: "page table"
>
> [crash.changelog]
> - Add support for 1GB huge page to "vtop" command on x86_64.
Without
> this patch, the command with a user virtual address corresponding to
> a 1GB huge page fails with the error message "vtop: seek error:
> physical address: <address> type: "page
table"".
> (lirongqing(a)baidu.com, chukaiping(a)foxmail.com)
>
> If you have any problems, please let me know.
>
> Thanks,
> Kazu
>
>>
>> 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);
>> */
>