Skip to contentSkip to conversation

Sharing machine pages among domains

DISCUSSION Haifeng He 3 participants 6 messages Nov 21, 2007

lore
Share & tools
lore

Haifeng He

author
#0 lore raw

Hi,

I have another question about memory sharing among domains(domUs). I know that grant table can be used for memory sharing. But my question is if it is possible to setup memory sharing before domain starts. For example, suppose I have 2 domUs: A and B. Before A and B are booted, is it possible to map certain physical pages of A and B into the same machine pages? Any comment?

(btw, an unrelated question, if I do printk in Xen HVM, what's an easy way to read that message?)

Thanks

Haifeng

#1 lore raw
Quoted 7 lines · Haifeng He

Hi,

I have another question about memory sharing among domains(domUs). I know that grant table can be used for memory sharing. But my question is if it is possible to setup memory sharing before domain starts. For example, suppose I have 2 domUs: A and B. Before A and B are booted, is it possible to map certain physical pages of A and B into the same machine pages? Any comment?

yes, this is possible. quite a number of pages get 'shared' that way, e.g. the console and xenstore mfns. see e.g. the definition of the start_info struct in the xen headers and see e.g. the domain builder code (tools/libxc/xc_(linux|*)_build.c) on how this is set up from dom0. you might just need to add a few lines to get what you want.

regards,
daniel

Signature · 5 lines
Daniel Stodden
LRR     -      Lehrstuhl für Rechnertechnik und Rechnerorganisation
Institut für Informatik der TU München             D-85748 Garching
http://www.lrr.in.tum.de/~stodden         mailto:[email protected]
PGP Fingerprint: F5A4 1575 4C56 E26A 0B33  3D80 457E 82AE B0D8 735B
author
#2 lore raw
Quoted 11 lines · Daniel Stodden
Quoted 3 lines · Haifeng He

Hi,

I have another question about memory sharing among domains(domUs). I know

that

Quoted 1 line

grant table can be used for memory sharing. But my question is if it is

possible

Quoted 3 lines

to setup memory sharing before domain starts. For example, suppose I have 2 domUs: A and B. Before A and B are booted, is it possible to map certain physical pages of A and B into the same machine pages? Any

Quoted 8 lines

comment?

yes, this is possible. quite a number of pages get 'shared' that way, e.g. the console and xenstore mfns. see e.g. the definition of the start_info struct in the xen headers and see e.g. the domain builder code (tools/libxc/xc_(linux|*)_build.c) on how this is set up from dom0. you might just need to add a few lines to get what you want.

Thank you for your reply. I checked the above code.
If I understand correctly, the page sharing of console and xenstore is between dom0 and domU instead of between domUs. Secondly,
the mapping is one to one, i.e., one mfn page allocated to domU is mapped to dom0. However, what I am looking for is, probably one to many mapping. That is, one mfn page can be mapped into physical page in multiple domUs and shared by them. Any idea?

Thanks

Haifeng

Quoted 12 lines

regards,
daniel

--
Daniel Stodden
LRR - Lehrstuhl für Rechnertechnik und Rechnerorganisation
Institut für Informatik der TU München D-85748 Garching
http://www.lrr.in.tum.de/~stodden mailto:[email protected]
PGP Fingerprint: F5A4 1575 4C56 E26A 0B33 3D80 457E 82AE B0D8 735B

#3 lore raw
Quoted 7 lines · Haifeng He

Thank you for your reply. I checked the above code.
If I understand correctly, the page sharing of console and xenstore is between dom0 and domU instead of between domUs. Secondly,
the mapping is one to one, i.e., one mfn page allocated to domU is mapped to dom0. However, what I am looking for is, probably one to many mapping. That is, one mfn page can be mapped into physical page in multiple domUs and shared by them. Any idea?

This isn't currently possible.

-- Keir

author
#4 lore raw
Quoted 10 lines · Keir Fraser
Quoted 7 lines · Haifeng He

Thank you for your reply. I checked the above code.
If I understand correctly, the page sharing of console and xenstore is between dom0 and domU instead of between domUs. Secondly,
the mapping is one to one, i.e., one mfn page allocated to domU is mapped to dom0. However, what I am looking for is, probably one to many mapping. That is, one mfn page can be mapped into physical page in multiple domUs and shared by them. Any idea?

Quoted 2 lines

This isn't currently possible.

But is there a way to do it by modifying the Xen source? For example, during domain creation, is it possible to let Xen assign certain mfn pages to particular
physical pages in the new domain?

( I have been trying to figure out how Xen assign mfn pages to new domain but still
not very successful. The code looks quite complicated.)

Thanks

Haifeng

Quoted 4 lines

-- Keir

#5 lore raw
In reply to Haifeng He
Quoted 2 lines · Haifeng He

(btw, an unrelated question, if I do printk in Xen HVM, what's an easy way to read that message?)

Write bytes to I/O port 0xe9 and lines of output will appear on Xen's emergency console (e.g., serial line) if you set guest_loglvl=all.

-- Keir