Re: [PATCH v2] x86_64: Make the conversion between 4level and 5level paging automatically

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Dave,

At 07/11/2018 03:33 AM, Dave Anderson wrote:

The final phase of support would be making this work:

   static int
   x86_64_task_uses_5level(struct task_context *tc)
   {
           return FALSE;
   }

Have you had a chance to look at how that can be done?


I have no idea to check if 5level paging is used in User-space.

You gave me some methods, and I have try:

  -The MAP_FIXED flag
  -check if the contents of the page directory or p4d is 'flods'

Now, I found a rough way. As We all know, in x86_64_uvtop_level4(),
the user virtual address is either 4-level or 5-level paging. Can we
do like that:

  if (machdep->flags & VM_5LEVEL)
      1) Using 5-level parsing code...
      2) Check if it is success
         If failed, Using 4-level parsing code...
  else
      Always using 4-level parsing code...

  3) go on...

Thanks,
	dou
--------------8<----------------

diff --git a/x86_64.c b/x86_64.c
index 07b6aa9..0e12825 100644
--- a/x86_64.c
+++ b/x86_64.c
@@ -1915,22 +1915,21 @@ x86_64_uvtop_level4(struct task_context *tc, ulong uvaddr, physaddr_t *paddr, in
                goto no_upage;

        /* If the VM is in 5-level page table */
-       if (machdep->flags & VM_5LEVEL && x86_64_task_uses_5level(tc)) {
+       if (machdep->flags & VM_5LEVEL) {
                ulong p4d_pte;
                /*
                 *  p4d = p4d_offset(pgd, address);
                 */
p4d_pte = x86_64_p4d_offset(pgd_pte, uvaddr, verbose, FALSE);
-               if (!(p4d_pte & _PAGE_PRESENT))
-                       goto no_upage;
-               /*
-                *  pud = pud_offset(p4d, address);
-                */
- pud_pte = x86_64_pud_offset(p4d_pte, uvaddr, verbose, FALSE);
+               if (!(p4d_pte & _PAGE_PRESENT)) {
+                       /* pud = pud_offset(pgd, address); */
+ pud_pte = x86_64_pud_offset(pgd_pte, uvaddr, verbose, FALSE);
+               } else {
+                       /* pud = pud_offset(p4d, address); */
+ pud_pte = x86_64_pud_offset(p4d_pte, uvaddr, verbose, FALSE);
+               }
        } else {
-               /*
-                *  pud = pud_offset(pgd, address);
-                */
+               /* pud = pud_offset(pgd, address); */
pud_pte = x86_64_pud_offset(pgd_pte, uvaddr, verbose, FALSE);
        }


--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/crash-utility



[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux