xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: sepanta s <sapanta992@gmail.com>
To: Tamas K Lengyel <tamas@tklengyel.com>
Cc: George Dunlap <dunlapg@umich.edu>,
	Razvan Cojocaru <rcojocaru@bitdefender.com>,
	"xen-devel@lists.xen.org" <Xen-devel@lists.xen.org>
Subject: Re: monitor access to pages with a specific p2m_type_t
Date: Tue, 2 Aug 2016 10:49:04 +0430	[thread overview]
Message-ID: <CABaiLQ-sKvbQHrO7yK-yuNPQH-=YyrYszdOX2NG21VMvWe9pHA@mail.gmail.com> (raw)
In-Reply-To: <CABaiLQ_je9K3rVxY1gEUr54_avu0hq2jGhVGFUE-LotCH8JVKw@mail.gmail.com>


[-- Attachment #1.1.1: Type: text/plain, Size: 4051 bytes --]

On Sat, Jul 23, 2016 at 3:49 PM, sepanta s <sapanta992@gmail.com> wrote:

>
>>> Hi,
>>> Is there any sample code which I can undestand how to capture the events
>>> on the gfns which have p2m_ram_shared enabled ?
>>> I couldn't find any ... .
>>> I would be grateful if any help , as there is not any documents through
>>> net to use :(
>>>
>>>
>> Should I just set the ring_page as the pages which are shared and mark
>>> them read-only, then capture the write events?
>>>
>>
>> Not sure what ring_page you are talking about, but if you mark the pages
>> read-only with mem_access you will get notifications for events that lead
>> to unsharing with p2m_ram_shared type pages as well.
>>
>
> There was a function in mem-sharing.c which is intended to announce the
> failed unshared pages. It is "mem_sharing_notify_enomem" .
> I added "mem_sharing_notify_unshare" as a new function and call it in
> also XEN_DOMCTL_VM_EVENT_OP_UNSHARING and "HVM_PARAM_USHARING_RING_PFN".
> I also added the required codes in /xen/common/vm_event.c and
> /tools/libxc/xc_vm_event so as
> I have added a new event for the unsharing actions of a page.
> Then, I wrote a sample code line xen-access and create a ring for the
> pages of a domain and listen to unshared events of it.
>
>>
>>> BTW, I added a function called mem_sharing_notify_unshare to
>>> mem_sharing.c and added it to __mem_sharing_unshare_page at this part:
>>>
>>> *if ( p2m_change_type_one(d, gfn, p2m_ram_shared, p2m_ram_rw) )*
>>> *{*
>>> *gdprintk(XENLOG_ERR, "Could not change p2m type d %hu gfn %lx.\n", *
>>> *d->domain_id, gfn);*
>>> *BUG();*
>>> *}else {*
>>>
>>>
>>> * mem_sharing_notify_unshare(d,gfn.0);*
>>> *}*
>>>
>>>
>> IMHO this duplicates a lot of what mem_access does already, I don't think
>> there is a need for a separate notification on another ring.
>>
>>
> You are right, xen-access should work but I couldn't change its code and
> couldn't get the mem-access events.
>  I just added the above function to be sure that unsharing a page happens
> and works fine. Because I couldn't get the access requests on shared-pages
> of a vm.
> In xen-access, Instead of setting all the pages' default access to rx , I
> just call xc_set_mem_access for the pages with p2m_ram_shared and assign rx
> as the default access but there is no requests on this ring.
>
>>
>
> So by having a vm event channel listening to unsharing event, I can see
>>> the notification in xen-access . To do so, I
>>> have used vm_event_enable which uses HVM_PARAM_SHARING_RING_PFN .
>>> But, when I used memshrtool to share all the pages of two vms - my vm1
>>> and its clone vm2 .
>>> About 900 MB of the ram is shared but there are a lot of unshared events
>>> happening.
>>>
>>
>> Yes, I would say that's expected.
>>
>
>>
>>> When I do the sharing one more time, there is not any pages unshared as
>>> the total number of shared pages stay the same.
>>>
>>
>> Well, if you let the domain run for a while after sharing, then you do
>> the sharing like that again you are likely going to crash the VM.
>>
>>
>>> Seems no unsharing is done as the number of shared pages are the same.
>>> Does any page fault triggers when a write operation is done on a shared
>>> page among two vms ?
>>>
>>
>> I would guess the the VM crashed and that's why you don't see any more
>> unsharing at that point.
>>
> Yes it was crashed as I checked it.
> The scenario of sharing is I use:
> I pause the origin VM and then run memshrtool on origin VM and clone VM.
> After sharing all the pages between these two VMs,Clone VM seems to be
> inaccessible. The clone seems to work as the attached photo shows, its cpu
> time increases and it exceeds the dom0 cpu time but when I use gvncviewer
> to see the GUI of the Clone VM, the mouse or keyboard don't work. (origin
> VM is ubunut-64-1 and clone VM is ubuntu-64-clone-1). Is there anything I
> have missed in sharing between two VMs?
>
> [image: Inline image 2]
>

Can someone help please ? still have problem with the machine .
is it because sharing is not based on content?

[-- Attachment #1.1.2: Type: text/html, Size: 9722 bytes --]

[-- Attachment #1.2: Screenshot from 2016-07-23 15_19_05.png --]
[-- Type: image/png, Size: 18631 bytes --]

[-- Attachment #2: Type: text/plain, Size: 127 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2016-08-02  6:19 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-22 11:38 monitor access to pages with a specific p2m_type_t sepanta s
2016-06-24 11:05 ` George Dunlap
2016-06-24 11:20   ` Razvan Cojocaru
2016-06-24 15:40     ` Tamas K Lengyel
2016-06-26 12:45       ` sepanta s
2016-07-10 12:20         ` sepanta s
2016-07-11 12:25           ` sepanta s
2016-07-12 18:26             ` Tamas K Lengyel
2016-07-23 11:19               ` sepanta s
2016-08-02  6:19                 ` sepanta s [this message]
2016-08-02 15:53                   ` Tamas K Lengyel
2016-08-05 11:35                     ` sepanta s
2016-08-05 18:15                       ` Tamas K Lengyel
2016-08-05 18:26                         ` sepanta s

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CABaiLQ-sKvbQHrO7yK-yuNPQH-=YyrYszdOX2NG21VMvWe9pHA@mail.gmail.com' \
    --to=sapanta992@gmail.com \
    --cc=Xen-devel@lists.xen.org \
    --cc=dunlapg@umich.edu \
    --cc=rcojocaru@bitdefender.com \
    --cc=tamas@tklengyel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).