i386/monitor: Fix page table walking issue for LA57 enabled guest
PATCH 1/1 i386/monitor: Fix page table walking issue for LA57 enabled guest
Don't skip next leve page table for pdpe/pde when the PG_PRESENT_MASK is set.
This fixs the issue that no mapping information was collected from "info mem" for guest with LA57 enabled.
--- target/i386/monitor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
target/i386/monitor.c +2 -2
@@ -489,7 +489,7 @@ static void mem_info_la57(Monitor *mon, CPUArchState *env)cpu_physical_memory_read (pdp_addr + l2 *8 , &pdpe,8 ); pdpe =le64_to_cpu (pdpe); end = (l0 <<48 ) + (l1 <<39 ) + (l2 <<30 ); -if (pdpe &PG_PRESENT_MASK ) { +if (!(pdpe &PG_PRESENT_MASK )) { prot =0 ;mem_print (mon, env, &start, &last_prot, end, prot);continue ;
@@ -508,7 +508,7 @@ static void mem_info_la57(Monitor *mon, CPUArchState *env)cpu_physical_memory_read (pd_addr + l3 *8 , &pde,8 ); pde =le64_to_cpu (pde); end = (l0 <<48 ) + (l1 <<39 ) + (l2 <<30 ) + (l3 <<21 ); -if (pde &PG_PRESENT_MASK ) { +if (!(pde &PG_PRESENT_MASK )) { prot =0 ;mem_print (mon, env, &start, &last_prot, end, prot);continue ;
base-commit: 6d940eff4734bcb40b1a25f62d7cec5a396f994a
Signature · 1 line
2.27.0
Quoted 14 lines
-----Original Message-----
From: Qemu-devel <qemu-devel- [email protected]> On Behalf Of Yuan Yao
Sent: Thursday, June 9, 2022 4:35 PM
To: Paolo Bonzini <[email protected]>; Philippe Mathieu-Daudé <[email protected]>; Dr. David Alan Gilbert <[email protected]>; Zhong, Yang <[email protected]>; Connor Kuehl <[email protected]>
Cc: [email protected]; Yao, Yuan <[email protected]>; Yamahata, Isaku <[email protected]>
Subject: [PATCH 1/1] i386/monitor: Fix page table walking issue for LA57 enabled guest
Quoted 1 line
Don't skip next leve page table for pdpe/pde when the
PG_PRESENT_MASK
S/leve/level
Quoted 6 lines
is set.
This fixs the issue that no mapping information was collected from "info mem" for guest with LA57 enabled.
Signed-off-by Yuan Yao <[email protected]>
LGTM.
It should same with the excp_helper.c/mmu_translate() la57 implementation.
Add Eric and Markus for double check.
Thanks
Chen
Quoted 33 lines
--- target/i386/monitor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)target/i386/monitor.c index renamed from target/i386/monitor.c +0
-0
8e4b4d600c..3339550bbe100644target/i386/monitor.c +1
-1@@ -489,7 +489,7 @@ static void mem_info_la57(Monitor *mon, CPUArchState *env) cpu_physical_memory_read(pdp_addr + l2 * 8, &pdpe, 8); pdpe =le64_to_cpu (pdpe); end = (l0 <<48 ) + (l1 <<39 ) + (l2 <<30 ); -if (pdpe &PG_PRESENT_MASK ) { +if (!(pdpe &PG_PRESENT_MASK )) { prot =0 ;mem_print (mon, env, &start, &last_prot, end, prot);continue;target/i386/monitor.c +1
-1@@ -508,7 +508,7 @@ static void mem_info_la57(Monitor *mon, CPUArchState *env) cpu_physical_memory_read(pd_addr + l3 * 8, &pde, 8); pde =le64_to_cpu (pde); end = (l0 <<48 ) + (l1 <<39 ) + (l2 <<30 ) + (l3 <<21 ); -if (pde &PG_PRESENT_MASK ) { +if (!(pde &PG_PRESENT_MASK )) { prot =0 ;mem_print (mon, env, &start, &last_prot, end, prot);continue;base-commit:
6d940eff4734bcb40b1a25f62d7cec5a396f994a--
2.27.0
Quoted 23 lines
-----Original Message-----
From: Zhang, Chen <[email protected]>
Sent: Friday, June 24, 2022 10:04
To: Yao, Yuan <[email protected]>; Paolo Bonzini <[email protected]>; Philippe Mathieu-Daudé <[email protected]>; Dr. David Alan Gilbert <[email protected]>; Zhong, Yang <[email protected]>; Connor Kuehl <[email protected]>; Eric Blake <[email protected]>; Markus Armbruster <[email protected]>
Cc: [email protected]; Yao, Yuan <[email protected]>; Yamahata, Isaku <[email protected]>
Subject: RE: [PATCH 1/1] i386/monitor: Fix page table walking issue for LA57 enabled guestQuoted 12 lines
-----Original Message-----
From: Qemu-devel <qemu-devel- [email protected]> On Behalf Of Yuan Yao
Sent: Thursday, June 9, 2022 4:35 PM
To: Paolo Bonzini <[email protected]>; Philippe Mathieu-Daudé <[email protected]>; Dr. David Alan Gilbert <[email protected]>; Zhong, Yang <[email protected]>; Connor Kuehl <[email protected]>
Cc: [email protected]; Yao, Yuan <[email protected]>; Yamahata, Isaku <[email protected]>
Subject: [PATCH 1/1] i386/monitor: Fix page table walking issue for LA57 enabled guest
Quoted 3 lines
Quoted 1 line
Don't skip next leve page table for pdpe/pde when the
PG_PRESENT_MASKS/leve/level
Sorry for the typo.
Quoted 6 lines
Quoted 6 lines
is set.
This fixs the issue that no mapping information was collected from "info mem" for guest with LA57 enabled.
Quoted 7 lines
Quoted 1 line
Signed-off-by Yuan Yao <[email protected]>LGTM.
It should same with the excp_helper.c/mmu_translate() la57 implementation.Reviewed-by Zhang Chen <[email protected]>Add Eric and Markus for double check.
Thanks for your comments.
Quoted 37 lines
Thanks
ChenQuoted 33 lines
--- target/i386/monitor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)target/i386/monitor.c index renamed from target/i386/monitor.c +0
-0
8e4b4d600c..3339550bbe100644target/i386/monitor.c +1
-1@@ -489,7 +489,7 @@ static void mem_info_la57(Monitor *mon, CPUArchState *env) cpu_physical_memory_read(pdp_addr + l2 * 8, &pdpe, 8); pdpe =le64_to_cpu (pdpe); end = (l0 <<48 ) + (l1 <<39 ) + (l2 <<30 ); -if (pdpe &PG_PRESENT_MASK ) { +if (!(pdpe &PG_PRESENT_MASK )) { prot =0 ;mem_print (mon, env, &start, &last_prot, end, prot);continue;target/i386/monitor.c +1
-1@@ -508,7 +508,7 @@ static void mem_info_la57(Monitor *mon, CPUArchState *env) cpu_physical_memory_read(pd_addr + l3 * 8, &pde, 8); pde =le64_to_cpu (pde); end = (l0 <<48 ) + (l1 <<39 ) + (l2 <<30 ) + (l3 <<21 ); -if (pde &PG_PRESENT_MASK ) { +if (!(pde &PG_PRESENT_MASK )) { prot =0 ;mem_print (mon, env, &start, &last_prot, end, prot);continue;base-commit:
6d940eff4734bcb40b1a25f62d7cec5a396f994a--
2.27.0
Quoted 1 line · Yuan Yao
Don't skip next leve page table for pdpe/pde when the
level
Quoted 3 lines
PG_PRESENT_MASKis set.This fixs the issue that no mapping information was
fixes
Quoted 3 lines
collected from "info mem" for guest with LA57 enabled.
Signed-off-by Yuan Yao <[email protected]>
Should we add
?
Quoted 27 lines
--- target/i386/monitor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)target/i386/monitor.c +2
-2@@ -489,7 +489,7 @@ static void mem_info_la57(Monitor *mon, CPUArchState *env)cpu_physical_memory_read (pdp_addr + l2 *8 , &pdpe,8 ); pdpe =le64_to_cpu (pdpe); end = (l0 <<48 ) + (l1 <<39 ) + (l2 <<30 ); -if (pdpe &PG_PRESENT_MASK ) { +if (!(pdpe &PG_PRESENT_MASK )) { prot =0 ;mem_print (mon, env, &start, &last_prot, end, prot);continue ;@@ -508,7 +508,7 @@ static void mem_info_la57(Monitor *mon, CPUArchState *env)cpu_physical_memory_read (pd_addr + l3 *8 , &pde,8 ); pde =le64_to_cpu (pde); end = (l0 <<48 ) + (l1 <<39 ) + (l2 <<30 ) + (l3 <<21 ); -if (pde &PG_PRESENT_MASK ) { +if (!(pde &PG_PRESENT_MASK )) { prot =0 ;mem_print (mon, env, &start, &last_prot, end, prot);continue ;
Quoted 1 line
base-commit:
6d940eff4734bcb40b1a25f62d7cec5a396f994a
The commit message talks about not skipping something when the flag is set. However, the patch *flips* the sense of conditions, which means were *also* changing behavior when the flag is unset. How?
Quoted 9 lines
-----Original Message-----
From: Markus Armbruster <[email protected]>
Sent: Friday, June 24, 2022 13:35
To: Yao, Yuan <[email protected]>
Cc: Paolo Bonzini <[email protected]>; Philippe Mathieu-Daudé <[email protected]>; Dr. David Alan Gilbert <[email protected]>; Zhong, Yang <[email protected]>; Connor Kuehl <[email protected]>; [email protected]; Yamahata, Isaku <[email protected]>
Subject: Re: [PATCH 1/1] i386/monitor: Fix page table walking issue for LA57 enabled guest
Quoted 5 lines
Quoted 1 line · Yuan Yao
Don't skip next leve page table for pdpe/pde when the
level
Sorry for my typo.
Quoted 7 lines
Quoted 4 lines
PG_PRESENT_MASKis set.This fixs the issue that no mapping information was
fixes
Quoted 7 lines
Quoted 3 lines
collected from "info mem" for guest with LA57 enabled.
Signed-off-by Yuan Yao <[email protected]>Should we add
Fixes 6c7c3c21f95dd9af8a0691c0dd29b07247984122
Yes, I will add this next time, thanks.
Quoted 30 lines
?
Quoted 27 lines
--- target/i386/monitor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)target/i386/monitor.c +2
-2@@ -489,7 +489,7 @@ static void mem_info_la57(Monitor *mon, CPUArchState *env)cpu_physical_memory_read (pdp_addr + l2 *8 , &pdpe,8 ); pdpe =le64_to_cpu (pdpe); end = (l0 <<48 ) + (l1 <<39 ) + (l2 <<30 ); -if (pdpe &PG_PRESENT_MASK ) { +if (!(pdpe &PG_PRESENT_MASK )) { prot =0 ;mem_print (mon, env, &start, &last_prot, end, prot);continue ;@@ -508,7 +508,7 @@ static void mem_info_la57(Monitor *mon, CPUArchState *env)cpu_physical_memory_read (pd_addr + l3 *8 , &pde,8 ); pde =le64_to_cpu (pde); end = (l0 <<48 ) + (l1 <<39 ) + (l2 <<30 ) + (l3 <<21 ); -if (pde &PG_PRESENT_MASK ) { +if (!(pde &PG_PRESENT_MASK )) { prot =0 ;mem_print (mon, env, &start, &last_prot, end, prot);continue ;
Quoted 5 lines
Quoted 1 line
base-commit:
6d940eff4734bcb40b1a25f62d7cec5a396f994aThe commit message talks about not skipping something when the flag is set. However, the patch *flips* the sense of conditions, which means were *also* changing behavior when the flag is unset. How?
Yes, this also changes the behavior when the flag is unset, because the original code does wrong for both set and unset , flips the checking condition bring all of them to right behavior. I think I can add these to the commit message in v2.