Skip to contentSkip to conversation

x86/PVH: correct PVH Dom0 E820 region merge

PATCH In review Jan Beulich 3 participants 4 messages Oct 5 – Oct 6

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/PVH: correct PVH Dom0 E820 region merge

Folding with an immediately successive region can't be done by merely lowering the start of the region. The size of the region needs increasing as well.

Fixes 5427134eae81 ("x86: populate PVHv2 Dom0 physical memory map")
xen/arch/x86/hvm/dom0_build.c +1 -0
@@ -229,6 +229,7 @@ static int __init pvh_add_mem_range(stru
         if ( rs == e && d->arch.e820[i].type == type )
         {
             d->arch.e820[i].addr = s;
+            d->arch.e820[i].size += e - s;
             return 0;
         }
 
Reviewed-by on v1 1/1
#2 lore raw
In reply to Jan Beulich
Quoted 6 lines · Jan Beulich

Folding with an immediately successive region can't be done by merely lowering the start of the region. The size of the region needs increasing as well.

Fixes 5427134eae81 ("x86: populate PVHv2 Dom0 physical memory map")

My bad...

xen/arch/x86/hvm/dom0_build.c static int __init pvh_add_mem_range(stru · line 232

Quoted 8 lines
xen/arch/x86/hvm/dom0_build.c +1 -0
@@ -229,6 +229,7 @@ static int __init pvh_add_mem_range(stru
         if ( rs == e && d->arch.e820[i].type == type )
         {
             d->arch.e820[i].addr = s;
+            d->arch.e820[i].size += e - s;

I think it would be simpler as:

d->arch.e820[i].size = re - s;

Thanks, Roger.

#3 lore raw
Quoted 11 lines · Roger Pau Monné
Quoted 6 lines · Jan Beulich

Folding with an immediately successive region can't be done by merely lowering the start of the region. The size of the region needs increasing as well.

Fixes 5427134eae81 ("x86: populate PVHv2 Dom0 physical memory map")

My bad...

Thanks.

Quoted 11 lines

xen/arch/x86/hvm/dom0_build.c static int __init pvh_add_mem_range(stru · line 232

Quoted 7 lines
xen/arch/x86/hvm/dom0_build.c +1 -0
@@ -229,6 +229,7 @@ static int __init pvh_add_mem_range(stru
         if ( rs == e && d->arch.e820[i].type == type )
         {
             d->arch.e820[i].addr = s;
+            d->arch.e820[i].size += e - s;

I think it would be simpler as:

d->arch.e820[i].size = re - s;

Perhaps, but the way I have it the compiler may figure that it can fold the tail of this path with the next if()'s body.

Jan