On 3/11/2017 12:03 AM, Jan Beulich wrote:
On 08.03.17 at 16:33, <yu.c.zh...@linux.intel.com> wrote:
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -954,6 +954,26 @@ int p2m_change_type_one(struct domain *d, unsigned long
gfn,
p2m->default_access)
: -EBUSY;
+ if ( !rc )
+ {
+ switch ( nt )
+ {
+ case p2m_ram_rw:
+ if ( ot == p2m_ioreq_server )
+ {
+ p2m->ioreq.entry_count--;
+ ASSERT(p2m->ioreq.entry_count >= 0);
+ }
+ break;
+ case p2m_ioreq_server:
+ if ( ot == p2m_ram_rw )
+ p2m->ioreq.entry_count++;
I don't think the conditional is needed here. If anything it should be
an ASSERT() imo, as other transitions to p2m_ioreq_server should
not be allowed.
Thanks, Jan. I'll use ASSERT.
But there's a wider understanding issue I'm having here: What is
an "entry" here? Commonly I would assume this to refer to an
individual (4k) page, but it looks like you really mean table entry,
i.e. possibly representing a 2M or 1G page.
Well, it should be an entry pointing to a 4K page(only).
For p2m_ioreq_server, we shall not meet huge page. Because they are
changed from p2m_ram_rw pages
in set_mem_type() -> p2m_change_type_one(), which calls p2m_set_entry()
with PAGE_ORDER_4K specified.
Thanks
Yu
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel