xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* Page Table Entry Modifications
@ 2015-09-22 19:35 Gohar Irfan
  2015-09-23  8:35 ` Andrew Cooper
  0 siblings, 1 reply; 7+ messages in thread
From: Gohar Irfan @ 2015-09-22 19:35 UTC (permalink / raw)
  To: xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 485 bytes --]

Hi All,

I want to know if, in the case of HVM (shadow page tables), we can change
the machine frame number pointed to by a page table entry?
An overly simplified example would be: let's say I have page number 10 that
is pointing to machine frame number 10, but I would like it to point to
machine frame number 1? Can this be achieved inside the "sh_page_fault"
function inside "xen/arch/x86/mm/shadow/multi.c" as this seems like a
relevant place for this modification to me.

Thanks!

[-- Attachment #1.2: Type: text/html, Size: 591 bytes --]

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

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

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

* Re: Page Table Entry Modifications
  2015-09-22 19:35 Page Table Entry Modifications Gohar Irfan
@ 2015-09-23  8:35 ` Andrew Cooper
  2015-09-23  8:42   ` Gohar Irfan
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Cooper @ 2015-09-23  8:35 UTC (permalink / raw)
  To: Gohar Irfan, xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 797 bytes --]

On 22/09/15 20:35, Gohar Irfan wrote:
> Hi All,
>
> I want to know if, in the case of HVM (shadow page tables), we can 
> change the machine frame number pointed to by a page table entry?

Yes - Xen is able to change the mfn in a pte.

> An overly simplified example would be: let's say I have page number 10 
> that is pointing to machine frame number 10, but I would like it to 
> point to machine frame number 1?

Yes - that is in theory possible.

> Can this be achieved inside the "sh_page_fault" function inside 
> "xen/arch/x86/mm/shadow/multi.c" as this seems like a relevant place 
> for this modification to me.

What are you trying to achieve?  Modifications such as what you request 
are possible, but you are exceedingly likely to end up with memory 
corruption as a result.

~Andrew

[-- Attachment #1.2: Type: text/html, Size: 1826 bytes --]

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

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

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

* Re: Page Table Entry Modifications
  2015-09-23  8:35 ` Andrew Cooper
@ 2015-09-23  8:42   ` Gohar Irfan
  2015-09-27  7:26     ` Gohar Irfan
  2015-09-27 14:57     ` Meng Xu
  0 siblings, 2 replies; 7+ messages in thread
From: Gohar Irfan @ 2015-09-23  8:42 UTC (permalink / raw)
  To: Andrew Cooper, xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 1083 bytes --]

It is for a project, I'm trying to experiment with a couple of things.

Could you please guide me how this could be achieved? Some relevant chunks
of code, perhaps?

Thanks!

On Wed, Sep 23, 2015 at 1:35 PM Andrew Cooper <andrew.cooper3@citrix.com>
wrote:

> On 22/09/15 20:35, Gohar Irfan wrote:
>
> Hi All,
>
> I want to know if, in the case of HVM (shadow page tables), we can change
> the machine frame number pointed to by a page table entry?
>
>
> Yes - Xen is able to change the mfn in a pte.
>
>
> An overly simplified example would be: let's say I have page number 10
> that is pointing to machine frame number 10, but I would like it to point
> to machine frame number 1?
>
>
> Yes - that is in theory possible.
>
>
> Can this be achieved inside the "sh_page_fault" function inside
> "xen/arch/x86/mm/shadow/multi.c" as this seems like a relevant place for
> this modification to me.
>
>
> What are you trying to achieve?  Modifications such as what you request
> are possible, but you are exceedingly likely to end up with memory
> corruption as a result.
>
>
> ~Andrew
>

[-- Attachment #1.2: Type: text/html, Size: 2203 bytes --]

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

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

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

* Re: Page Table Entry Modifications
  2015-09-23  8:42   ` Gohar Irfan
@ 2015-09-27  7:26     ` Gohar Irfan
  2015-09-27 14:57     ` Meng Xu
  1 sibling, 0 replies; 7+ messages in thread
From: Gohar Irfan @ 2015-09-27  7:26 UTC (permalink / raw)
  To: Andrew Cooper, xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 1299 bytes --]

Could someone please help me with this? It's really important and urgent.

Thanks a lot!

On Wed, Sep 23, 2015 at 1:42 PM Gohar Irfan <goharirfan94@gmail.com> wrote:

> It is for a project, I'm trying to experiment with a couple of things.
>
> Could you please guide me how this could be achieved? Some relevant chunks
> of code, perhaps?
>
> Thanks!
>
> On Wed, Sep 23, 2015 at 1:35 PM Andrew Cooper <andrew.cooper3@citrix.com>
> wrote:
>
>> On 22/09/15 20:35, Gohar Irfan wrote:
>>
>> Hi All,
>>
>> I want to know if, in the case of HVM (shadow page tables), we can change
>> the machine frame number pointed to by a page table entry?
>>
>>
>> Yes - Xen is able to change the mfn in a pte.
>>
>>
>> An overly simplified example would be: let's say I have page number 10
>> that is pointing to machine frame number 10, but I would like it to point
>> to machine frame number 1?
>>
>>
>> Yes - that is in theory possible.
>>
>>
>> Can this be achieved inside the "sh_page_fault" function inside
>> "xen/arch/x86/mm/shadow/multi.c" as this seems like a relevant place for
>> this modification to me.
>>
>>
>> What are you trying to achieve?  Modifications such as what you request
>> are possible, but you are exceedingly likely to end up with memory
>> corruption as a result.
>>
>>
>> ~Andrew
>>
>

[-- Attachment #1.2: Type: text/html, Size: 2658 bytes --]

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

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

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

* Re: Page Table Entry Modifications
  2015-09-23  8:42   ` Gohar Irfan
  2015-09-27  7:26     ` Gohar Irfan
@ 2015-09-27 14:57     ` Meng Xu
  2015-09-27 16:04       ` Gohar Irfan
  1 sibling, 1 reply; 7+ messages in thread
From: Meng Xu @ 2015-09-27 14:57 UTC (permalink / raw)
  To: Gohar Irfan; +Cc: Andrew Cooper, xen-devel@lists.xen.org

2015-09-23 4:42 GMT-04:00 Gohar Irfan <goharirfan94@gmail.com>:
>
> It is for a project, I'm trying to experiment with a couple of things.

Well, this is too general... Everything can be a project. People tries
to know what exact things you want to achieve so that they can figure
out if you are heading the correct direction.

Meng

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

* Re: Page Table Entry Modifications
  2015-09-27 14:57     ` Meng Xu
@ 2015-09-27 16:04       ` Gohar Irfan
  2015-09-28 19:09         ` Gohar Irfan
  0 siblings, 1 reply; 7+ messages in thread
From: Gohar Irfan @ 2015-09-27 16:04 UTC (permalink / raw)
  To: Meng Xu; +Cc: Andrew Cooper, xen-devel@lists.xen.org


[-- Attachment #1.1: Type: text/plain, Size: 1479 bytes --]

This might not seem useful or anything, but this is a part of an experiment
so I will describe what I'm trying to do:

Divide the memory into two equal halves and call them A and B.
Let's say region A has 10 pages, from page numbers 1 to 10. Region B has 10
pages from page numbers 11 to 20 (hypothetical, of course.)
When a page from region B (page number 11 to 20) is being accessed, say
page 15, then swap the contents of page 15 with the contents of one of the
pages from region A, say page 5.
To achieve this, I need some help. In the default scenario, page 15 points
to frame X and page 5 points to frame Y. I want to make page 15 point to
frame Y and page 5 to frame X of the memory.

I want to run this experiment and find the degradation in performance for a
project.
If some portion of this seems vague, I can explain. But I urgently need
help on how to achieve this.

My understanding is that it can be done in the page fault handler of shadow
page tables. I have mentioned the relevant file and function earlier in
this thread.

Thanks a lot!

On Sun, Sep 27, 2015 at 7:57 PM Meng Xu <xumengpanda@gmail.com> wrote:

> 2015-09-23 4:42 GMT-04:00 Gohar Irfan <goharirfan94@gmail.com>:
> >
> > It is for a project, I'm trying to experiment with a couple of things.
>
> Well, this is too general... Everything can be a project. People tries
> to know what exact things you want to achieve so that they can figure
> out if you are heading the correct direction.
>
> Meng
>

[-- Attachment #1.2: Type: text/html, Size: 1912 bytes --]

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

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

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

* Re: Page Table Entry Modifications
  2015-09-27 16:04       ` Gohar Irfan
@ 2015-09-28 19:09         ` Gohar Irfan
  0 siblings, 0 replies; 7+ messages in thread
From: Gohar Irfan @ 2015-09-28 19:09 UTC (permalink / raw)
  To: Meng Xu; +Cc: Andrew Cooper, xen-devel@lists.xen.org


[-- Attachment #1.1: Type: text/plain, Size: 2043 bytes --]

A clarification:
I also want to COPY the contents of the frames, so there will be no memory
corruption. In essence, only the frame numbers will be changed.

My other question, which is sort of a follow up to this, may be relevant:

"Given two GMFN in shadow paging (HVM) is there a way to swap their
contents? Let's say I have GMFN x and GMFN y, I want to put the contents of
x in y and the contents of y in x. "

Thanks a lot!

On Sun, Sep 27, 2015 at 9:04 PM Gohar Irfan <goharirfan94@gmail.com> wrote:

> This might not seem useful or anything, but this is a part of an
> experiment so I will describe what I'm trying to do:
>
> Divide the memory into two equal halves and call them A and B.
> Let's say region A has 10 pages, from page numbers 1 to 10. Region B has
> 10 pages from page numbers 11 to 20 (hypothetical, of course.)
> When a page from region B (page number 11 to 20) is being accessed, say
> page 15, then swap the contents of page 15 with the contents of one of the
> pages from region A, say page 5.
> To achieve this, I need some help. In the default scenario, page 15 points
> to frame X and page 5 points to frame Y. I want to make page 15 point to
> frame Y and page 5 to frame X of the memory.
>
> I want to run this experiment and find the degradation in performance for
> a project.
> If some portion of this seems vague, I can explain. But I urgently need
> help on how to achieve this.
>
> My understanding is that it can be done in the page fault handler of
> shadow page tables. I have mentioned the relevant file and function earlier
> in this thread.
>
> Thanks a lot!
>
> On Sun, Sep 27, 2015 at 7:57 PM Meng Xu <xumengpanda@gmail.com> wrote:
>
>> 2015-09-23 4:42 GMT-04:00 Gohar Irfan <goharirfan94@gmail.com>:
>> >
>> > It is for a project, I'm trying to experiment with a couple of things.
>>
>> Well, this is too general... Everything can be a project. People tries
>> to know what exact things you want to achieve so that they can figure
>> out if you are heading the correct direction.
>>
>> Meng
>>
>

[-- Attachment #1.2: Type: text/html, Size: 2760 bytes --]

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

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

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

end of thread, other threads:[~2015-09-28 19:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-22 19:35 Page Table Entry Modifications Gohar Irfan
2015-09-23  8:35 ` Andrew Cooper
2015-09-23  8:42   ` Gohar Irfan
2015-09-27  7:26     ` Gohar Irfan
2015-09-27 14:57     ` Meng Xu
2015-09-27 16:04       ` Gohar Irfan
2015-09-28 19:09         ` Gohar Irfan

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).