Message ID | 58E531B9.2040600@linux.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
>>> On 05.04.17 at 20:04, <yu.c.zhang@linux.intel.com> wrote: > --- a/xen/common/memory.c > +++ b/xen/common/memory.c > @@ -288,6 +288,10 @@ int guest_remove_page(struct domain *d, unsigned long gmfn) > put_gfn(d, gmfn); > return 1; > } > + if ( unlikely(p2mt == p2m_ioreq_server) ) > + p2m_change_type_one(d, gmfn, > + p2m_ioreq_server, p2m_ram_rw); > + > #else > mfn = gfn_to_mfn(d, _gfn(gmfn)); > #endif To be honest, this looks more like a quick hack than a proper solution at the first glance. To me it would seem preferable if the count was adjusted at the point the P2M entry is being replaced (i.e. down the call stack from guest_physmap_remove_page()). The closer to the actual changing of the P2M entry, the less likely you miss any call paths (as was already explained by George while suggesting to put the accounting into the leaf most EPT/NPT functions). Jan
diff --git a/xen/common/memory.c b/xen/common/memory.c index 7dbddda..40e5f63 100644 --- a/xen/common/memory.c +++ b/xen/common/memory.c @@ -288,6 +288,10 @@ int guest_remove_page(struct domain *d, unsigned long gmfn) put_gfn(d, gmfn); return 1; } + if ( unlikely(p2mt == p2m_ioreq_server) ) + p2m_change_type_one(d, gmfn, + p2m_ioreq_server, p2m_ram_rw); + #else mfn = gfn_to_mfn(d, _gfn(gmfn));