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

Re: [Xen-devel] Re: Making pages writable again in paging_log_dirty mode


  • To: "Tim Deegan" <Tim.Deegan@xxxxxxxxxx>
  • From: "Mike Sun" <msun@xxxxxxxxxx>
  • Date: Sat, 3 Jan 2009 20:43:14 -0500
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
  • Delivery-date: Sat, 03 Jan 2009 17:43:58 -0800
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references:x-google-sender-auth; b=LFrv7NXYsDrnu0Cqt6sSEiK1L9FB9ZDZU07BTlzBRjSgDuO0OBg2iL291LBpCc7ccn 8broWDmNW8bcifchAeZFiEtz3RYGZ/lRsNtiANBsDJA85L+vDXbecUmcGKzms0jjQxQ1 ecUXgHG01FE4dOXGhWG7BwalnvzbUAY/Slapc=
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

> That's the opposite problem.  The shadow code needs to remove all the
> writeable mappings of a page (because the guest is using it as a
> pagetable) and finds that after removing all writeable shadow PTEs that
> map the page, the typecount has not reached zero.  So:
>  - there is some other special reason for the frame to have a
>   typecount.  Or,
>  - somehow you've removed a writeable shadow entry without decrementing
>   the type count. That shouldn't be a problem because we know that
>   actions by dom0 (p2m changes, for example) cause writeable shadow
>   PTEs to be torn down (via shadow_put_page_from_l1e) correctly.  Or,
>  - you've accidentally called get_page_and_type() once too often,
>   creating two typecounts for only one shadow PTE.

Thanks Tim.  It make sense that I may accidentally calling
get_page_and_type() once too often. I modified the condition in which
I manually call an extra get_page_and_type() when trying to make PTEs
writable from dom0, but now I get this error condition:

(XEN) sh error: sh_remove_shadows(): can't find all shadows of mfn
02673 (shadow_flags=00000008)

I think I'm accounting for the page type refcounts correctly... but
I'm probably wrong.  Here's the code that's trying to add writable
mappings back:

            SHADOW_FOREACH_L1E(sl1mfn, sl1e, 0, done_l1,
            {
                flags_l1 = shadow_l1e_get_flags(*sl1e);
                if ((flags_l1 & _PAGE_PRESENT) && !(flags_l1 & _PAGE_RW))
                {
                    mfn = shadow_l1e_get_mfn(*sl1e);
                    pfn = mfn_to_gfn(v->domain, mfn);
                    log_dirty_lock(v->domain);
                    if (mfn_valid(mfn) && VALID_M2P(pfn) &&
                        sh_mfn_is_dirty(v->domain, mfn))
                    {
                        /* hack: because of the external mapping condition
                         * ref count not incremented when this is called from
                         * hypercall originating from dom0, need to do it
                         * manually
                         */
                        struct page_info *page = mfn_to_page(mfn);
                        if (((page->u.inuse.type_info & PGT_type_mask)
                                == PGT_writable_page)
                            && ((page->u.inuse.type_info & PGT_count_mask) == 0)
                            && get_page_type(page, PGT_writable_page))
                        {
                            shadow_l1e_t rw_sl1e =
                                shadow_l1e_add_flags(*sl1e, _PAGE_RW);
                            shadow_set_l1e(v, sl1e, rw_sl1e, sl1mfn);
                            cow.made_rw_count++;
                        }
                    }
                    log_dirty_unlock(v->domain);
                }
            });

Any ideas?

Thanks,
Mike

_______________________________________________
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®.