Skip to contentSkip to conversation

x86/HVM: Fixed the bug which cause the nested hvm guest fail to boot

PATCH In review Liliang 4 participants 6 messages Aug 18, 2014 – Aug 25, 2014

lore
Share & tools
lore

Liliang

author
#0 lore raw

PATCH 1/1 x86/HVM: Fixed the bug which cause the nested hvm guest fail to boot

From: Li Liang <[email protected]>

The function memory_type_changed should not be called in hvm_set_guest_pat. or the cache will be flushed excessively and make the nested guest very slowly, just like blocked.

---
 xen/arch/x86/hvm/hvm.c | 1 -
 1 file changed, 1 deletion(-)
xen/arch/x86/hvm/hvm.c +0 -1
index d40c48e..1a0534b 100644
@@ -257,7 +257,6 @@ int hvm_set_guest_pat(struct vcpu *v, u64 guest_pat)
     if ( !hvm_funcs.set_guest_pat(v, guest_pat) )
         v->arch.hvm_vcpu.pat_cr = guest_pat;
 
-    memory_type_changed(v->domain);
 
     return 1;
 }
Signature · 1 line
1.9.1
#1 lore raw
Quoted 7 lines · Liliang

From: Li Liang <[email protected]>

The function memory_type_changed should not be called in hvm_set_guest_pat. or the cache will be flushed excessively and make the nested guest very slowly, just like blocked.

Whyso? Without it, the caching types are likely wrong, especially after setting pat.

~Andrew

Quoted 16 lines
---
 xen/arch/x86/hvm/hvm.c | 1 -
 1 file changed, 1 deletion(-)
xen/arch/x86/hvm/hvm.c +0 -1
index d40c48e..1a0534b 100644
@@ -257,7 +257,6 @@ int hvm_set_guest_pat(struct vcpu *v, u64 guest_pat)
     if ( !hvm_funcs.set_guest_pat(v, guest_pat) )
         v->arch.hvm_vcpu.pat_cr = guest_pat;
 
-    memory_type_changed(v->domain);
 
     return 1;
 }
#2 lore raw
In reply to Liliang
Quoted 6 lines
Quoted 1 line
Quoted 1 line

Liliang <[email protected]> 08/18/14 1:15 PM >>>

From: Li Liang <[email protected]>

The function memory_type_changed should not be called in hvm_set_guest_pat. or the cache will be flushed excessively and make the nested guest very slowly, just like blocked.

As Andrew already said - blindly removing the call is wrong, it is there for a reason. What you first of all need to explain is why there are so many PAT modifications, as it's perhaps _that_ which needs adjustment (possibly e.g. including some filtering to hide writes that don't change the actual value, if that happens frequently).

Jan

#3 lore raw
Quoted 8 lines
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines

"Jan Beulich" <[email protected]> 08/18/14 3:10 PM >>> Liliang <[email protected]> 08/18/14 1:15 PM >>>

From: Li Liang <[email protected]>

The function memory_type_changed should not be called in hvm_set_guest_pat. or the cache will be flushed excessively and make the nested guest very slowly, just like blocked.

Quoted 5 lines

As Andrew already said - blindly removing the call is wrong, it is there for a reason. What you first of all need to explain is why there are so many PAT modifications, as it's perhaps _that_ which needs adjustment (possibly e.g. including some filtering to hide writes that don't change the actual value, if that happens frequently).

Actually I have to correct myself - I think the call here is indeed not needed, as the PAT contents is being used by the CPU itself when determining the memory type (and does not influence the result of epte_get_entry_emt()). But the patch description needs to better describe the situation, preferably also referencing the commit that needlessly added the call.

Jan

#4 lore raw
In reply to Liliang
Quoted 5 lines · Liliang

From: Li Liang <[email protected]>

The function memory_type_changed should not be called in hvm_set_guest_pat. or the cache will be flushed excessively and make the nested guest very slowly, just like blocked.

The patch subject is wrongly worded, it will cause bogus 'git log --oneline' output. I'm sure there are several bugs which cause nested guests to fail.

Olaf

#5 lore raw
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 25.08.14 at 10:08, <[email protected]> wrote:
Quoted 2 lines · Liliang

From: Li Liang <[email protected]>

Quoted 8 lines
Quoted 2 lines

The function memory_type_changed should not be called in hvm_set_guest_pat. or the cache will be flushed excessively and make the nested guest very

slowly,

Quoted 1 line

just like blocked.

The patch subject is wrongly worded, it will cause bogus 'git log --oneline' output.
I'm sure there are several bugs which cause nested guests to fail.

And as you may have seen I changed the title (for this very reason) before applying.

Jan