| 
    
 [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v5 4/4] x86/ioreq server: Reset outstanding p2m_ioreq_server entries when an ioreq server unmaps.
 On 8/16/2016 9:35 PM, George Dunlap wrote: On 12/07/16 10:02, Yu Zhang wrote:This patch resets p2m_ioreq_server entries back to p2m_ram_rw, after an ioreq server has unmapped. The resync is done both asynchronously with the current p2m_change_entry_type_global() interface, and synchronously by iterating the p2m table. The synchronous resetting is necessary because we need to guarantee the p2m table is clean before another ioreq server is mapped. And since the sweeping of p2m table could be time consuming, it is done with hypercall continuation. Asynchronous approach is also taken so that p2m_ioreq_server entries can also be reset when the HVM is scheduled between hypercall continuations. This patch also disallows live migration, when there's still any outstanding p2m_ioreq_server entry left. The core reason is our current implementation of p2m_change_entry_type_global() can not tell the state of p2m_ioreq_server entries(can not decide if an entry is to be emulated or to be resynced). Signed-off-by: Yu Zhang <yu.c.zhang@xxxxxxxxxxxxxxx>Thanks for doing this Yu Zhang! A couple of comments. Thanks a lot for your advice, George. And sorry for the delayed reply(had been in annual leave previously). 
 Well, the atomic_write_ept_entry() is a rather core path, and is only for ept. Although p2m_ioreq_server is not accepted in shadow page table code, I'd still like to support it in AMD SVM - also consistent with the p2m_change_entry_type_global() functionality. :)I am considering p2m_change_type_one(), which has gfn_lock/unlock() inside. And since previously the p2m type changes to/from p2m_ioreq_server are only triggered by hvmop which leads to p2m_change_type_one(), I believe calculating the entry_count here would make sense.Besides, the resolve_misconfig()/do_recalc() still need to decrease the entry_count for p2m_ioreq_server, but since both routines have p2m locked by their caller, so it's also OK.Other places that read entry_count can be protected by read_atomic(&p2m->ioreq.entry_count). Do you think this acceptable? 
 Well, I have doubts about this - resolve_misconfig() is supposed to change p2m table, and should probably be protected by p2m lock. But ept_get_entry() may be triggered by some routine like get_gfn_query_unlocked().Besides, although calling resolve_misconfig() will speed up the p2m type sweeping, it also introduces more cost each time we peek the p2m table. Although really, it seems like having a "p2m_finish_type_change()" function which looked for misconfigured entries and reset them would be a step closer to the right direction, in that it could be re-used in other situations where the type change may not have finished. Thanks. This sounds a good idea. And I'd like to define the interface of this routine 
like this:
 void p2m_finish_type_change(struct domain *d,
                           unsigned long start, unsigned long end,
                           p2m_type_t ot, p2m_type_t nt)
So it can be triggered by hvmop_map_mem_type_to_ioreq_server() with 
hypercall continuation
method. Do you think this OK?In fact, I have worked out a new version of this patch according to my understanding, and if you have no more disagreement on the above issues, I'll send out the new patch soon after some test in XenGT environment. :) Thanks Yu _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel 
 
  | 
  
![]()  | 
            
         Lists.xenproject.org is hosted with RackSpace, monitoring our  |