[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] Re: xenpaing: one way to avoid paging out the page, when the corresponding mfn is in use.



On Tue, Nov 01, Hongkaixing wrote:

>    Recently many advanced memory mechanisms are introduced into Xen.
>    One problem we found is the conflict between p2m query and setting.
>    For example, backend drivers always map domUâs page to its own
>    space, during the mapping procedure, situations as follow may
>    happen, when mfn is obtained by gfn_to_mfn(), this mfn is likely to
>    be paged out.
> 
> first case:
>    grant mapping                      xenpaing
>   mfn = gfn_to_mfn();
>                        <-----------  p2m_paging_nominate()
>          |                                         |
>      Check type ok                     paged out;
>          |
>      try to map
> What we want is: 
> When the page (mfn) is accessed by gfn_to_mfn(), this page should
> never be paged out until the mapping action is end. 

The query+map and query+change opterations on p2m entries should be done
under some lock. I have recently updated the p2m_mem_paging* functions
to do their modifications with the p2m_lock held.

Furthermore the change below checks wether something mapped a page
between nominate and evict:

http://xenbits.xen.org/hg/xen-unstable.hg/rev/eda18b27de6e

While this certainly does not fix all possible races, it slightly
reduces the window.


A more complete approach to add locking around p2m modifcations was
recently started by Andres Lagar-Cavilla:

http://lists.xensource.com/archives/html/xen-devel/2011-10/msg01946.html

Olaf

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.