xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* Is this a racing bug in page_make_sharable()?
@ 2012-01-16 14:51 Nai Xia
  0 siblings, 0 replies; 8+ messages in thread
From: Nai Xia @ 2012-01-16 14:51 UTC (permalink / raw)
  To: xen-devel

Hi,

As I understand, the purpose of the code in page_make_sharable()
checking the ref count is to ensure that nobody unexpected is working
on the page, and so we can migrate it to dom_cow, right?

====
   /* Check if the ref count is 2. The first from PGT_allocated, and
    * the second from get_page_and_type at the top of this function */
   if(page->count_info != (PGC_allocated | (2 + expected_refcnt)))
   {
       /* Return type count back to zero */
       put_page_and_type(page);
       spin_unlock(&d->page_alloc_lock);
       return -E2BIG;
   }
====

However, it seems to me that this ref check and the following page
migration is not atomic( although the operations for type_info ref
check seems good) i.e. it's possible that it passed this ref
check but just before it goes to dom_cow, someone else gets this page?
As far as I know, in Linux kernel's similar scenarios, they do ref-freezing
tricks.

And if we don't need to worry about this racing case, then what is
this check trying to ensure?


Thanks,
Nai

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-01-11  2:46 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <4F14345B.4040807@gmail.com>
2012-01-16 14:43 ` Is this a racing bug in page_make_sharable()? Nai Xia
2012-01-17 10:53   ` Tim Deegan
2012-12-27 15:35     ` Nai Xia
2013-01-10 13:00       ` Tim Deegan
2013-01-10 16:36         ` Andres Lagar-Cavilla
2013-01-10 17:25           ` Tim Deegan
2013-01-11  2:46             ` Nai Xia
2012-01-16 14:51 Nai Xia

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).