qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] i386: Catch all non-present ptes in cpu_get_phys_page_debug
@ 2008-06-08 14:32 Jan Kiszka
  2008-07-01  6:43 ` [Qemu-devel] [RESEND][PATCH] " Jan Kiszka
  0 siblings, 1 reply; 7+ messages in thread
From: Jan Kiszka @ 2008-06-08 14:32 UTC (permalink / raw)
  To: qemu-devel

[ Caused some hair pulling here, until I realized that some supposedly
corrupted page was not the bug I'm looking for, but a bug in the debug
code. ]

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
---
 target-i386/helper.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Index: b/target-i386/helper.c
===================================================================
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -1174,6 +1174,8 @@ target_phys_addr_t cpu_get_phys_page_deb
             page_size = 4096;
             pte = ldq_phys(pte_addr);
         }
+        if (!(pte & PG_PRESENT_MASK))
+            return -1;
     } else {
         uint32_t pde;
 
@@ -1193,10 +1195,10 @@ target_phys_addr_t cpu_get_phys_page_deb
                 /* page directory entry */
                 pte_addr = ((pde & ~0xfff) + ((addr >> 10) & 0xffc)) & env->a20_mask;
                 pte = ldl_phys(pte_addr);
-                if (!(pte & PG_PRESENT_MASK))
-                    return -1;
                 page_size = 4096;
             }
+            if (!(pte & PG_PRESENT_MASK))
+                return -1;
         }
         pte = pte & env->a20_mask;
     }

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Qemu-devel] [RESEND][PATCH] i386: Catch all non-present ptes in cpu_get_phys_page_debug
  2008-06-08 14:32 [Qemu-devel] [PATCH] i386: Catch all non-present ptes in cpu_get_phys_page_debug Jan Kiszka
@ 2008-07-01  6:43 ` Jan Kiszka
  2008-07-13 12:43   ` [Qemu-devel] [RESEND #2][PATCH] " Jan Kiszka
  0 siblings, 1 reply; 7+ messages in thread
From: Jan Kiszka @ 2008-07-01  6:43 UTC (permalink / raw)
  To: qemu-devel

It helps debugging guests when yet unmapped pages are correctly reported
as, well, unmapped.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
---
 target-i386/helper.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Index: b/target-i386/helper.c
===================================================================
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -1192,6 +1192,8 @@ target_phys_addr_t cpu_get_phys_page_deb
             page_size = 4096;
             pte = ldq_phys(pte_addr);
         }
+        if (!(pte & PG_PRESENT_MASK))
+            return -1;
     } else {
         uint32_t pde;
 
@@ -1211,10 +1213,10 @@ target_phys_addr_t cpu_get_phys_page_deb
                 /* page directory entry */
                 pte_addr = ((pde & ~0xfff) + ((addr >> 10) & 0xffc)) & env->a20_mask;
                 pte = ldl_phys(pte_addr);
-                if (!(pte & PG_PRESENT_MASK))
-                    return -1;
                 page_size = 4096;
             }
+            if (!(pte & PG_PRESENT_MASK))
+                return -1;
         }
         pte = pte & env->a20_mask;
     }

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Qemu-devel] [RESEND #2][PATCH] i386: Catch all non-present ptes in cpu_get_phys_page_debug
  2008-07-01  6:43 ` [Qemu-devel] [RESEND][PATCH] " Jan Kiszka
@ 2008-07-13 12:43   ` Jan Kiszka
  2008-08-18  7:09     ` [Qemu-devel] [RESEND #3][PATCH] " Jan Kiszka
  0 siblings, 1 reply; 7+ messages in thread
From: Jan Kiszka @ 2008-07-13 12:43 UTC (permalink / raw)
  To: qemu-devel

It helps debugging guests when yet unmapped pages are correctly reported
as, well, unmapped.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
---
 target-i386/helper.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Index: b/target-i386/helper.c
===================================================================
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -1192,6 +1192,8 @@ target_phys_addr_t cpu_get_phys_page_deb
             page_size = 4096;
             pte = ldq_phys(pte_addr);
         }
+        if (!(pte & PG_PRESENT_MASK))
+            return -1;
     } else {
         uint32_t pde;
 
@@ -1211,10 +1213,10 @@ target_phys_addr_t cpu_get_phys_page_deb
                 /* page directory entry */
                 pte_addr = ((pde & ~0xfff) + ((addr >> 10) & 0xffc)) & env->a20_mask;
                 pte = ldl_phys(pte_addr);
-                if (!(pte & PG_PRESENT_MASK))
-                    return -1;
                 page_size = 4096;
             }
+            if (!(pte & PG_PRESENT_MASK))
+                return -1;
         }
         pte = pte & env->a20_mask;
     }

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Qemu-devel] [RESEND #3][PATCH] i386: Catch all non-present ptes in cpu_get_phys_page_debug
  2008-07-13 12:43   ` [Qemu-devel] [RESEND #2][PATCH] " Jan Kiszka
@ 2008-08-18  7:09     ` Jan Kiszka
  2008-08-18 13:58       ` Anthony Liguori
  0 siblings, 1 reply; 7+ messages in thread
From: Jan Kiszka @ 2008-08-18  7:09 UTC (permalink / raw)
  To: qemu-devel

It helps debugging guests when yet unmapped pages are correctly reported
as, well, unmapped.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
---
 target-i386/helper.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Index: b/target-i386/helper.c
===================================================================
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -1192,6 +1192,8 @@ target_phys_addr_t cpu_get_phys_page_deb
             page_size = 4096;
             pte = ldq_phys(pte_addr);
         }
+        if (!(pte & PG_PRESENT_MASK))
+            return -1;
     } else {
         uint32_t pde;
 
@@ -1211,10 +1213,10 @@ target_phys_addr_t cpu_get_phys_page_deb
                 /* page directory entry */
                 pte_addr = ((pde & ~0xfff) + ((addr >> 10) & 0xffc)) & env->a20_mask;
                 pte = ldl_phys(pte_addr);
-                if (!(pte & PG_PRESENT_MASK))
-                    return -1;
                 page_size = 4096;
             }
+            if (!(pte & PG_PRESENT_MASK))
+                return -1;
         }
         pte = pte & env->a20_mask;
     }

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [RESEND #3][PATCH] i386: Catch all non-present ptes in cpu_get_phys_page_debug
  2008-08-18  7:09     ` [Qemu-devel] [RESEND #3][PATCH] " Jan Kiszka
@ 2008-08-18 13:58       ` Anthony Liguori
  2008-08-18 15:50         ` [Qemu-devel] " Jan Kiszka
  0 siblings, 1 reply; 7+ messages in thread
From: Anthony Liguori @ 2008-08-18 13:58 UTC (permalink / raw)
  To: qemu-devel

Jan Kiszka wrote:
> It helps debugging guests when yet unmapped pages are correctly reported
> as, well, unmapped.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
> ---
>  target-i386/helper.c |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> Index: b/target-i386/helper.c
> ===================================================================
> --- a/target-i386/helper.c
> +++ b/target-i386/helper.c
> @@ -1192,6 +1192,8 @@ target_phys_addr_t cpu_get_phys_page_deb
>              page_size = 4096;
>              pte = ldq_phys(pte_addr);
>          }
> +        if (!(pte & PG_PRESENT_MASK))
> +            return -1;
>      } else {
>          uint32_t pde;
>  
> @@ -1211,10 +1213,10 @@ target_phys_addr_t cpu_get_phys_page_deb
>                  /* page directory entry */
>                  pte_addr = ((pde & ~0xfff) + ((addr >> 10) & 0xffc)) & env->a20_mask;
>                  pte = ldl_phys(pte_addr);
> -                if (!(pte & PG_PRESENT_MASK))
> -                    return -1;
>                  page_size = 4096;
>              }
> +            if (!(pte & PG_PRESENT_MASK))
> +                return -1;
>          }
>   

This looks redundant.  In the PSE=1 case, the check for pde & 
PG_PRESENT_MASK takes care of it.  In the PSE=0 clause, there is already 
a check for pte & PG_PRESENT_MASK.

The first chunk looks like a genuine fix though.

Regards,

Anthony Liguori

>          pte = pte & env->a20_mask;
>      }
>
>
>   

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Qemu-devel] Re: [RESEND #3][PATCH] i386: Catch all non-present ptes in cpu_get_phys_page_debug
  2008-08-18 13:58       ` Anthony Liguori
@ 2008-08-18 15:50         ` Jan Kiszka
  2008-08-18 18:00           ` Anthony Liguori
  0 siblings, 1 reply; 7+ messages in thread
From: Jan Kiszka @ 2008-08-18 15:50 UTC (permalink / raw)
  To: qemu-devel

Anthony Liguori wrote:
> Jan Kiszka wrote:
>> It helps debugging guests when yet unmapped pages are correctly reported
>> as, well, unmapped.
>>
>> Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
>> ---
>>  target-i386/helper.c |    6 ++++--
>>  1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> Index: b/target-i386/helper.c
>> ===================================================================
>> --- a/target-i386/helper.c
>> +++ b/target-i386/helper.c
>> @@ -1192,6 +1192,8 @@ target_phys_addr_t cpu_get_phys_page_deb
>>              page_size = 4096;
>>              pte = ldq_phys(pte_addr);
>>          }
>> +        if (!(pte & PG_PRESENT_MASK))
>> +            return -1;
>>      } else {
>>          uint32_t pde;
>>  
>> @@ -1211,10 +1213,10 @@ target_phys_addr_t cpu_get_phys_page_deb
>>                  /* page directory entry */
>>                  pte_addr = ((pde & ~0xfff) + ((addr >> 10) & 0xffc))
>> & env->a20_mask;
>>                  pte = ldl_phys(pte_addr);
>> -                if (!(pte & PG_PRESENT_MASK))
>> -                    return -1;
>>                  page_size = 4096;
>>              }
>> +            if (!(pte & PG_PRESENT_MASK))
>> +                return -1;
>>          }
>>   
> 
> This looks redundant.  In the PSE=1 case, the check for pde &
> PG_PRESENT_MASK takes care of it.  In the PSE=0 clause, there is already
> a check for pte & PG_PRESENT_MASK.

True.

> 
> The first chunk looks like a genuine fix though.

Here is the stripped-down version:

-----------

It helps debugging guests when yet unmapped pages are correctly reported
as, well, unmapped.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
---
 target-i386/helper.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Index: b/target-i386/helper.c
===================================================================
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -1192,6 +1192,8 @@ target_phys_addr_t cpu_get_phys_page_deb
             page_size = 4096;
             pte = ldq_phys(pte_addr);
         }
+        if (!(pte & PG_PRESENT_MASK))
+            return -1;
     } else {
         uint32_t pde;
 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] Re: [RESEND #3][PATCH] i386: Catch all non-present ptes in cpu_get_phys_page_debug
  2008-08-18 15:50         ` [Qemu-devel] " Jan Kiszka
@ 2008-08-18 18:00           ` Anthony Liguori
  0 siblings, 0 replies; 7+ messages in thread
From: Anthony Liguori @ 2008-08-18 18:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: Jan Kiszka

Jan Kiszka wrote:
> It helps debugging guests when yet unmapped pages are correctly reported
> as, well, unmapped.
>   

Applied.  Thanks.

Regards,

Anthony Liguori

> Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
> ---
>  target-i386/helper.c |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> Index: b/target-i386/helper.c
> ===================================================================
> --- a/target-i386/helper.c
> +++ b/target-i386/helper.c
> @@ -1192,6 +1192,8 @@ target_phys_addr_t cpu_get_phys_page_deb
>              page_size = 4096;
>              pte = ldq_phys(pte_addr);
>          }
> +        if (!(pte & PG_PRESENT_MASK))
> +            return -1;
>      } else {
>          uint32_t pde;
>  
>
>
>   

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-08-18 18:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-08 14:32 [Qemu-devel] [PATCH] i386: Catch all non-present ptes in cpu_get_phys_page_debug Jan Kiszka
2008-07-01  6:43 ` [Qemu-devel] [RESEND][PATCH] " Jan Kiszka
2008-07-13 12:43   ` [Qemu-devel] [RESEND #2][PATCH] " Jan Kiszka
2008-08-18  7:09     ` [Qemu-devel] [RESEND #3][PATCH] " Jan Kiszka
2008-08-18 13:58       ` Anthony Liguori
2008-08-18 15:50         ` [Qemu-devel] " Jan Kiszka
2008-08-18 18:00           ` Anthony Liguori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).