x86/p2m: fixed p2m_change_type_range() start / end check
PATCH v2 1/1 x86/p2m: fixed p2m_change_type_range() start / end check
p2m_change_type_range() handles end > max_mapped_pfn, but not start > max_mapped_pfn. Check the latter just after grabbing the lock and bail if true.
---
Changes since V1:
- Added ASSERT()s.
- Wrapped the new condition in an unlikely().
--- xen/arch/x86/mm/p2m.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
xen/arch/x86/mm/p2m.c +11 -0
@@ -978,8 +978,19 @@ void p2m_change_type_range(struct domain *d,p2m_lock (p2m); p2m->defer_nested_flush =1 ; +ASSERT (start < end); + +if (unlikely (start > p2m->max_mapped_pfn) ) + { +ASSERT (!p2m_is_hostp2m (p2m)); +p2m_unlock (p2m); +return ; + } +if (unlikely (end > p2m->max_mapped_pfn) ) { +ASSERT (end == ~0UL || !p2m_is_hostp2m (p2m)); +if ( !gfn ) { p2m->change_entry_type_global (p2m, ot, nt);
Signature · 7 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 30 lines · Razvan Cojocaru
p2m_change_type_range()handles end >max_mapped_pfn, but not start >max_mapped_pfn. Check the latter just after grabbing the lock and bail if true.Signed-off-by Razvan Cojocaru <[email protected]>Suggested-by George Dunlap <[email protected]>---
Changes since V1:
- Added ASSERT()s.
- Wrapped the new condition in anunlikely().--- xen/arch/x86/mm/p2m.c | 11 +++++++++++ 1 file changed, 11 insertions(+)xen/arch/x86/mm/p2m.c +6
-0@@ -978,8 +978,19 @@ void p2m_change_type_range(struct domain *d,p2m_lock (p2m); p2m->defer_nested_flush =1 ; +ASSERT (start < end); + +if (unlikely (start > p2m->max_mapped_pfn) ) + { +ASSERT (!p2m_is_hostp2m (p2m)); +p2m_unlock (p2m);
xen/arch/x86/mm/p2m.c void p2m_change_type_range(struct domain *d, · line 996
Quoted 10 lines
xen/arch/x86/mm/p2m.c +5
-0+return ; + } +if (unlikely (end > p2m->max_mapped_pfn) ) { +ASSERT (end == ~0UL || !p2m_is_hostp2m (p2m)); +if ( !gfn ) { p2m->change_entry_type_global (p2m, ot, nt);
I think I've addressed George's comments on the altp2m VGA logdirty issue and I'm ready to send the current version of the patch, however it depends on this one.
Is the above patch uncontroversial enough to find its way into staging soon (in which case I should probably wait until it's in to send out the other patch), or should I perhaps create a series of two patches and send that out? Or is it maybe customary to proceed somehow else in a situation like this?
Thank you,
Razvan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 47 lines
Quoted 1 line
Quoted 1 line · On 23.04.18 at 09:23, <[email protected]> wrote:
Quoted 30 lines · Razvan Cojocaru
p2m_change_type_range()handles end >max_mapped_pfn, but not start >max_mapped_pfn. Check the latter just after grabbing the lock and bail if true.Signed-off-by Razvan Cojocaru <[email protected]>Suggested-by George Dunlap <[email protected]>---
Changes since V1:
- Added ASSERT()s.
- Wrapped the new condition in anunlikely().--- xen/arch/x86/mm/p2m.c | 11 +++++++++++ 1 file changed, 11 insertions(+)xen/arch/x86/mm/p2m.c +6
-0@@ -978,8 +978,19 @@ void p2m_change_type_range(struct domain *d,p2m_lock (p2m); p2m->defer_nested_flush =1 ; +ASSERT (start < end); + +if (unlikely (start > p2m->max_mapped_pfn) ) + { +ASSERT (!p2m_is_hostp2m (p2m)); +p2m_unlock (p2m);xen/arch/x86/mm/p2m.c void p2m_change_type_range(struct domain *d, · line 996
Quoted 10 lines
xen/arch/x86/mm/p2m.c +5
-0+return ; + } +if (unlikely (end > p2m->max_mapped_pfn) ) { +ASSERT (end == ~0UL || !p2m_is_hostp2m (p2m)); +if ( !gfn ) { p2m->change_entry_type_global (p2m, ot, nt);I think I've addressed George's comments on the altp2m VGA logdirty issue and I'm ready to send the current version of the patch, however it depends on this one.
Quoted 4 lines
Is the above patch uncontroversial enough to find its way into staging soon (in which case I should probably wait until it's in to send out the other patch), or should I perhaps create a series of two patches and send that out?
Well, you'll need George's ack and (for the tree being frozen) you'd need to justify why this is important to fix for 4.11 (to convince Jürgen to give a release ack).
Quoted 1 line
Or is it maybe customary to proceed somehow else in a situation like this?
A series is one way. Adding a post-commit-message note to clarify the dependency (textual and/or functional) is another.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 6 lines · Razvan Cojocaru
p2m_change_type_range()handles end >max_mapped_pfn, but not start >max_mapped_pfn. Check the latter just after grabbing the lock and bail if true.Signed-off-by Razvan Cojocaru <[email protected]>Suggested-by George Dunlap <[email protected]>
Sorry, I meant to reply to this earlier but I haven't been able to make the time.
On reflection, I think this is the wrong approach actually. First, my assertion was incorrect: the p2m_altp2m_propagate_change() is gated on p2m->max_remapped_gfn, not max_mapped_gfn (nb the 're'). So setting max_mapped_gfn shouldn't cause 'unnecessary' propagations.
Secondly, we do actually need to keep the logdirty ranges of all the p2ms in sync, even if they're past the max_remapped_gfn. Otherwise we could have the following situation:
* altp2m created, max_remapped_gfn 0x1000
* screen resized, logdirty range [0x2000-0x3000]; change dropped
* guest accesses 0x4000, max_remapped_gfn set to 0x4000
* change_p2m_type happens, and the 0x2000-0x3000 range is not marked logrdirty #
So while it would be an improvement to make the assertion more explicit, I don't (anymore) think it would actually be an improvement to discard changes that are above max_mapped_gfn. (And thus your original patch, which copied max_mapped_gfn into the altp2ms, was probably closer to the right approach).
Sorry for the confusion -- we obviously need a bit more thought about how altp2m and logdirty interact.
-George
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 25 lines · George Dunlap
Quoted 6 lines · Razvan Cojocaru
p2m_change_type_range()handles end >max_mapped_pfn, but not start >max_mapped_pfn. Check the latter just after grabbing the lock and bail if true.Signed-off-by Razvan Cojocaru <[email protected]>Suggested-by George Dunlap <[email protected]>Sorry, I meant to reply to this earlier but I haven't been able to make the time.
On reflection, I think this is the wrong approach actually. First, my assertion was incorrect: the
p2m_altp2m_propagate_change()is gated onp2m->max_remapped_gfn, notmax_mapped_gfn(nb the 're'). So settingmax_mapped_gfnshouldn't cause 'unnecessary' propagations.Secondly, we do actually need to keep the logdirty ranges of all the p2ms in sync, even if they're past the
max_remapped_gfn. Otherwise we could have the following situation:
* altp2m created,max_remapped_gfn0x1000
* screen resized, logdirty range [0x2000-0x3000]; change dropped
* guest accesses0x4000,max_remapped_gfnset to0x4000
*change_p2m_typehappens, and the 0x2000-0x3000 range is not marked logrdirty #
Quoted 8 lines
So while it would be an improvement to make the assertion more explicit, I don't (anymore) think it would actually be an improvement to discard changes that are above
max_mapped_gfn. (And thus your original patch, which copiedmax_mapped_gfninto the altp2ms, was probably closer to the right approach).Sorry for the confusion -- we obviously need a bit more thought about how altp2m and logdirty interact.
Thanks for the reply! Fair enough.
FWIW, the attached patch works well for me, resizes and all (but it could very well be just luck).
Thanks,
Razvan
xen/arch/x86/mm/p2m-ept.c +46 -6
@@ -17,6 +17,7 @@#include <xen/domain_page.h> #include <xen/sched.h> +#include <asm/altp2m.h> #include <asm/current.h> #include <asm/paging.h> #include <asm/types.h>
@@ -656,6 +657,9 @@ bool_t ept_handle_misconfig(uint64_t gpa)bool_t spurious;int rc; +if (altp2m_active (curr->domain) ) + p2m =p2m_get_altp2m (curr); +p2m_lock (p2m); spurious = curr->arch.hvm_vmx.ept_spurious_misconfig;
@@ -1209,32 +1213,60 @@ static void ept_tlb_flush(struct p2m_domain *p2m)static void ept_enable_pml (struct p2m_domain *p2m) { +unsigned int i; +struct domain *d = p2m->domain; +/* Domain must have been paused */ -ASSERT (atomic_read (&p2m->domain->pause_count)); +ASSERT (atomic_read (&d->pause_count));/* * No need to return whether vmx_domain_enable_pml has succeeded, as * ept_p2m_type_to_flags will do the check, and write protection will be * used if PML is not enabled. */ -if (vmx_domain_enable_pml (p2m->domain) ) +if (vmx_domain_enable_pml (d) )return ;/* Enable EPT A/D bit for PML */ p2m->ept.ad =1 ; -vmx_domain_update_eptp (p2m->domain); + +if (altp2m_active (d) ) +for ( i =0 ; i <MAX_ALTP2M ; i++ ) + { +if ( d->arch.altp2m_eptp[i] ==mfn_x (INVALID_MFN ) ) +continue ; + + p2m = d->arch.altp2m_p2m[i]; + p2m->ept.ad =1 ; + } + +vmx_domain_update_eptp (d); }static void ept_disable_pml (struct p2m_domain *p2m) { +unsigned int i; +struct domain *d = p2m->domain; +/* Domain must have been paused */ -ASSERT (atomic_read (&p2m->domain->pause_count)); +ASSERT (atomic_read (&d->pause_count)); -vmx_domain_disable_pml (p2m->domain); +vmx_domain_disable_pml (d);/* Disable EPT A/D bit */ p2m->ept.ad =0 ; -vmx_domain_update_eptp (p2m->domain); + +if (altp2m_active (d) ) +for ( i =0 ; i <MAX_ALTP2M ; i++ ) + { +if ( d->arch.altp2m_eptp[i] ==mfn_x (INVALID_MFN ) ) +continue ; + + p2m = d->arch.altp2m_p2m[i]; + p2m->ept.ad =0 ; + } + +vmx_domain_update_eptp (d); }static void ept_flush_pml_buffers (struct p2m_domain *p2m)
@@ -1375,8 +1407,16 @@ void setup_ept_dump(void)void p2m_init_altp2m_ept (struct domain *d,unsigned int i) {struct p2m_domain *p2m = d->arch.altp2m_p2m[i]; +struct p2m_domain *hostp2m =p2m_get_hostp2m (d);struct ept_data *ept; + p2m->max_mapped_pfn = hostp2m->max_mapped_pfn; + p2m->default_access = hostp2m->default_access; + p2m->domain = hostp2m->domain; + p2m->logdirty_ranges = hostp2m->logdirty_ranges; + p2m->global_logdirty = hostp2m->global_logdirty; + p2m->ept.ad = hostp2m->ept.ad; + p2m->min_remapped_gfn =gfn_x (INVALID_GFN ); p2m->max_remapped_gfn =0 ; ept = &p2m->ept;
xen/arch/x86/mm/p2m.c +40 -9
88 lines not on this page · raw message
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 32 lines · Razvan Cojocaru
Quoted 31 lines · George Dunlap
Quoted 6 lines · Razvan Cojocaru
p2m_change_type_range()handles end >max_mapped_pfn, but not start >max_mapped_pfn. Check the latter just after grabbing the lock and bail if true.Signed-off-by Razvan Cojocaru <[email protected]>Suggested-by George Dunlap <[email protected]>Sorry, I meant to reply to this earlier but I haven't been able to make the time.
On reflection, I think this is the wrong approach actually. First, my assertion was incorrect: the
p2m_altp2m_propagate_change()is gated onp2m->max_remapped_gfn, notmax_mapped_gfn(nb the 're'). So settingmax_mapped_gfnshouldn't cause 'unnecessary' propagations.Secondly, we do actually need to keep the logdirty ranges of all the p2ms in sync, even if they're past the
max_remapped_gfn. Otherwise we could have the following situation:
* altp2m created,max_remapped_gfn0x1000
* screen resized, logdirty range [0x2000-0x3000]; change dropped
* guest accesses0x4000,max_remapped_gfnset to0x4000
*change_p2m_typehappens, and the 0x2000-0x3000 range is not marked logrdirty #So while it would be an improvement to make the assertion more explicit, I don't (anymore) think it would actually be an improvement to discard changes that are above
max_mapped_gfn. (And thus your original patch, which copiedmax_mapped_gfninto the altp2ms, was probably closer to the right approach).
Quoted 7 lines
Quoted 2 lines
Sorry for the confusion -- we obviously need a bit more thought about how altp2m and logdirty interact.
Thanks for the reply! Fair enough.
FWIW, the attached patch works well for me, resizes and all (but it could very well be just luck).
I think we really want some sort of analysis of all the ways the two features might interact, and some justification as to why a solution is complete.
You're not aiming to get a patch like this into 4.11 though, are you?
-George
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 38 lines · George Dunlap
Quoted 37 lines · Razvan Cojocaru
Quoted 25 lines · George Dunlap
Quoted 6 lines · Razvan Cojocaru
p2m_change_type_range()handles end >max_mapped_pfn, but not start >max_mapped_pfn. Check the latter just after grabbing the lock and bail if true.Signed-off-by Razvan Cojocaru <[email protected]>Suggested-by George Dunlap <[email protected]>Sorry, I meant to reply to this earlier but I haven't been able to make the time.
On reflection, I think this is the wrong approach actually. First, my assertion was incorrect: the
p2m_altp2m_propagate_change()is gated onp2m->max_remapped_gfn, notmax_mapped_gfn(nb the 're'). So settingmax_mapped_gfnshouldn't cause 'unnecessary' propagations.Secondly, we do actually need to keep the logdirty ranges of all the p2ms in sync, even if they're past the
max_remapped_gfn. Otherwise we could have the following situation:
* altp2m created,max_remapped_gfn0x1000
* screen resized, logdirty range [0x2000-0x3000]; change dropped
* guest accesses0x4000,max_remapped_gfnset to0x4000
*change_p2m_typehappens, and the 0x2000-0x3000 range is not marked logrdirty #Quoted 8 lines
So while it would be an improvement to make the assertion more explicit, I don't (anymore) think it would actually be an improvement to discard changes that are above
max_mapped_gfn. (And thus your original patch, which copiedmax_mapped_gfninto the altp2ms, was probably closer to the right approach).Sorry for the confusion -- we obviously need a bit more thought about how altp2m and logdirty interact.
Thanks for the reply! Fair enough.
Quoted 8 lines
Quoted 2 lines
FWIW, the attached patch works well for me, resizes and all (but it could very well be just luck).
I think we really want some sort of analysis of all the ways the two features might interact, and some justification as to why a solution is complete.
You're not aiming to get a patch like this into 4.11 though, are you?
No (although it would have been nice if possible). A good solution to the problem is the goal here, 4.11 or not. Nobody wants a rushed hack.
Thanks for all the help so far, and please let me know if you have any suggestions I should try out.
Thanks,
Razvan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 46 lines · Razvan Cojocaru
Quoted 45 lines · George Dunlap
Quoted 32 lines · Razvan Cojocaru
Quoted 31 lines · George Dunlap
Quoted 6 lines · Razvan Cojocaru
p2m_change_type_range()handles end >max_mapped_pfn, but not start >max_mapped_pfn. Check the latter just after grabbing the lock and bail if true.Signed-off-by Razvan Cojocaru <[email protected]>Suggested-by George Dunlap <[email protected]>Sorry, I meant to reply to this earlier but I haven't been able to make the time.
On reflection, I think this is the wrong approach actually. First, my assertion was incorrect: the
p2m_altp2m_propagate_change()is gated onp2m->max_remapped_gfn, notmax_mapped_gfn(nb the 're'). So settingmax_mapped_gfnshouldn't cause 'unnecessary' propagations.Secondly, we do actually need to keep the logdirty ranges of all the p2ms in sync, even if they're past the
max_remapped_gfn. Otherwise we could have the following situation:
* altp2m created,max_remapped_gfn0x1000
* screen resized, logdirty range [0x2000-0x3000]; change dropped
* guest accesses0x4000,max_remapped_gfnset to0x4000
*change_p2m_typehappens, and the 0x2000-0x3000 range is not marked logrdirty #So while it would be an improvement to make the assertion more explicit, I don't (anymore) think it would actually be an improvement to discard changes that are above
max_mapped_gfn. (And thus your original patch, which copiedmax_mapped_gfninto the altp2ms, was probably closer to the right approach).Quoted 7 lines
Quoted 2 lines
Sorry for the confusion -- we obviously need a bit more thought about how altp2m and logdirty interact.
Thanks for the reply! Fair enough.
FWIW, the attached patch works well for me, resizes and all (but it could very well be just luck).
I think we really want some sort of analysis of all the ways the two features might interact, and some justification as to why a solution is complete.
Quoted 7 lines
Quoted 1 line
You're not aiming to get a patch like this into 4.11 though, are you?
No (although it would have been nice if possible). A good solution to the problem is the goal here, 4.11 or not. Nobody wants a rushed hack.
Thanks for all the help so far, and please let me know if you have any suggestions I should try out.
George, would this be a better time to try to thoroughly fix this? It's clearly a major obstacle in being able to use altp2m. I've done more tests since we've last discussed this on xen-devel, and I did see a frozen rectangle of pixels quite a while after booting (during "normal" Windows operation), so the patch I've attached last time does indeed seem to be incomplete somewhere. But I haven't managed to reproduce it since, so it's still quite unclear what corner case I've hit.
I was wondering if you have any suggestions on how to proceed in fixing this for good upstream (I certainly don't have your expertise in the p2m code).
Thanks!
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 63 lines · Razvan Cojocaru
Quoted 46 lines · Razvan Cojocaru
Quoted 45 lines · George Dunlap
Quoted 32 lines · Razvan Cojocaru
Quoted 31 lines · George Dunlap
Quoted 6 lines · Razvan Cojocaru
p2m_change_type_range()handles end >max_mapped_pfn, but not start >max_mapped_pfn. Check the latter just after grabbing the lock and bail if true.Signed-off-by Razvan Cojocaru <[email protected]>Suggested-by George Dunlap <[email protected]>Sorry, I meant to reply to this earlier but I haven't been able to make the time.
On reflection, I think this is the wrong approach actually. First, my assertion was incorrect: the
p2m_altp2m_propagate_change()is gated onp2m->max_remapped_gfn, notmax_mapped_gfn(nb the 're'). So settingmax_mapped_gfnshouldn't cause 'unnecessary' propagations.Secondly, we do actually need to keep the logdirty ranges of all the p2ms in sync, even if they're past the
max_remapped_gfn. Otherwise we could have the following situation:
* altp2m created,max_remapped_gfn0x1000
* screen resized, logdirty range [0x2000-0x3000]; change dropped
* guest accesses0x4000,max_remapped_gfnset to0x4000
*change_p2m_typehappens, and the 0x2000-0x3000 range is not marked logrdirty #So while it would be an improvement to make the assertion more explicit, I don't (anymore) think it would actually be an improvement to discard changes that are above
max_mapped_gfn. (And thus your original patch, which copiedmax_mapped_gfninto the altp2ms, was probably closer to the right approach).Quoted 7 lines
Quoted 2 lines
Sorry for the confusion -- we obviously need a bit more thought about how altp2m and logdirty interact.
Thanks for the reply! Fair enough.
FWIW, the attached patch works well for me, resizes and all (but it could very well be just luck).
I think we really want some sort of analysis of all the ways the two features might interact, and some justification as to why a solution is complete.
Quoted 7 lines
Quoted 1 line
You're not aiming to get a patch like this into 4.11 though, are you?
No (although it would have been nice if possible). A good solution to the problem is the goal here, 4.11 or not. Nobody wants a rushed hack.
Thanks for all the help so far, and please let me know if you have any suggestions I should try out.
George, would this be a better time to try to thoroughly fix this? It's clearly a major obstacle in being able to use altp2m. I've done more tests since we've last discussed this on xen-devel, and I did see a frozen rectangle of pixels quite a while after booting (during "normal" Windows operation), so the patch I've attached last time does indeed seem to be incomplete somewhere. But I haven't managed to reproduce it since, so it's still quite unclear what corner case I've hit.
Quoted 5 lines
I was wondering if you have any suggestions on how to proceed in fixing this for good upstream (I certainly don't have your expertise in the p2m code).
Thanks!
Yes, let me see if I can carve out some time to take a look at this.
-George
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 25 lines · George Dunlap
Quoted 6 lines · Razvan Cojocaru
p2m_change_type_range()handles end >max_mapped_pfn, but not start >max_mapped_pfn. Check the latter just after grabbing the lock and bail if true.Signed-off-by Razvan Cojocaru <[email protected]>Suggested-by George Dunlap <[email protected]>Sorry, I meant to reply to this earlier but I haven't been able to make the time.
On reflection, I think this is the wrong approach actually. First, my assertion was incorrect: the
p2m_altp2m_propagate_change()is gated onp2m->max_remapped_gfn, notmax_mapped_gfn(nb the 're'). So settingmax_mapped_gfnshouldn't cause 'unnecessary' propagations.Secondly, we do actually need to keep the logdirty ranges of all the p2ms in sync, even if they're past the
max_remapped_gfn. Otherwise we could have the following situation:
* altp2m created,max_remapped_gfn0x1000
* screen resized, logdirty range [0x2000-0x3000]; change dropped
* guest accesses0x4000,max_remapped_gfnset to0x4000
*change_p2m_typehappens, and the 0x2000-0x3000 range is not marked logrdirty #
Quoted 8 lines
So while it would be an improvement to make the assertion more explicit, I don't (anymore) think it would actually be an improvement to discard changes that are above
max_mapped_gfn. (And thus your original patch, which copiedmax_mapped_gfninto the altp2ms, was probably closer to the right approach).Sorry for the confusion -- we obviously need a bit more thought about how altp2m and logdirty interact.
Re-reading this, again the simple solution to me implies having all this bookkeeping information in a struct, and have all p2ms share a poninter to it. That way, even code that uses the wrong p2m still updates the correct logdirty data.
That would also simplify all the copying of supposed-to-be-kept-in-sync data on switches.
But of course you're the maintainer (and more to the point the most knowledgeable about the code), so I'm quite probably missing something.
Thanks,
Razvan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 35 lines · Razvan Cojocaru
Quoted 25 lines · George Dunlap
Quoted 6 lines · Razvan Cojocaru
p2m_change_type_range()handles end >max_mapped_pfn, but not start >max_mapped_pfn. Check the latter just after grabbing the lock and bail if true.Signed-off-by Razvan Cojocaru <[email protected]>Suggested-by George Dunlap <[email protected]>Sorry, I meant to reply to this earlier but I haven't been able to make the time.
On reflection, I think this is the wrong approach actually. First, my assertion was incorrect: the
p2m_altp2m_propagate_change()is gated onp2m->max_remapped_gfn, notmax_mapped_gfn(nb the 're'). So settingmax_mapped_gfnshouldn't cause 'unnecessary' propagations.Secondly, we do actually need to keep the logdirty ranges of all the p2ms in sync, even if they're past the
max_remapped_gfn. Otherwise we could have the following situation:
* altp2m created,max_remapped_gfn0x1000
* screen resized, logdirty range [0x2000-0x3000]; change dropped
* guest accesses0x4000,max_remapped_gfnset to0x4000
*change_p2m_typehappens, and the 0x2000-0x3000 range is not marked logrdirty #Quoted 8 lines
So while it would be an improvement to make the assertion more explicit, I don't (anymore) think it would actually be an improvement to discard changes that are above
max_mapped_gfn. (And thus your original patch, which copiedmax_mapped_gfninto the altp2ms, was probably closer to the right approach).Sorry for the confusion -- we obviously need a bit more thought about how altp2m and logdirty interact.
Quoted 7 lines
Re-reading this, again the simple solution to me implies having all this bookkeeping information in a struct, and have all p2ms share a poninter to it. That way, even code that uses the wrong p2m still updates the correct logdirty data.
That would also simplify all the copying of supposed-to-be-kept-in-sync data on switches.
No, obviously having everything in a single place makes more sense. There's just the little issue of locking. :-) But we should be able to sort something out. It would be nice if we could do something like have the data covered by the hostp2m lock, so that guests not using the altp2m functionality wouldn't need to do any extra locking. But I'd have to wrap my head around the p2m locking discipline again to know whether that would work or not.
-George
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel