Looking into the xen code for days, I still could not figure where the following occurs, How does xen allocates memory to the DomU guests? Where in the code does xen provides the start and end address map for each guest that is created? Ovreall, How does xen creates a memory pool and performs allocation? Any help in this regard would be appreciated, Thank you in advance, Dinesh C _________________________________________________________________ Catch the latest fashion shows, get beauty tips and learn more on fashion and lifestyle. http://video.msn.com/?mkt=en-in _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
AFAIK, In para virtualization, when guest boots, it reads the memory layout from a special page (start info page) instead of from bios. If your guest os is a PV Linux, you can check its source code (e.g. start_kernel(), etc.) Thanks, Weiming On Fri, Jun 6, 2008 at 2:00 PM, dinesh chandrasekaran < dinesh_chan8@hotmail.com> wrote:> Looking into the xen code for days, I still could not figure where the > following occurs, > > How does xen allocates memory to the DomU guests? > > Where in the code does xen provides the start and end address map for each > guest that is created? > > Ovreall, How does xen creates a memory pool and performs allocation? > > Any help in this regard would be appreciated, > Thank you in advance, > Dinesh C > > ------------------------------ > Live.in : Get your yourname@live.in email id today. Powered by Windows > Live Hotmail. Check it out! <http://get.live.com/> > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel > >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
YES. But if I want to add memory of type E820_USABLE to xen memory map during boot up (as per xen/e820.c) where the memory to be added lies behind a PCI device? For ex, If a PCI device reports it has 1GB of memory behind it. And XEN has identified th RAM memory to be 4GB. How can the PCI - 1GB can be added as usable memory to XEN''s memory pool to get a cumulative size of 5GB; thanks, Dinesh C On Fri, Jun 6, 2008 at 3:00 PM, Weiming wrote: AFAIK, In para virtualization, when guest boots, it reads the memory layout from a special page (start info page) instead of from bios. If your guest os is a PV Linux, you can check its source code (e.g. start_kernel(), etc.) Thanks, Weiming On Fri, Jun 6, 2008 at 2:00 PM, dinesh chandrasekaran <dinesh_chan8@hotmail.com> wrote: _________________________________________________________________ No Harvard, No Oxford. We are here. Find out !! http://ss1.richmedia.in/recurl.asp?pid=500 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
I''m not very sure about your problem. Can the Hypervisor address the whole 5GB space? If yes, it can then allocate any of them to guests. Or you can modify the "start info" passed to Guest OS. You can change the page_nr, a machine-PFN translation table to enable the guest to address the memory space that you want. It''s weird. On Fri, Jun 6, 2008 at 2:57 PM, dinesh chandrasekaran < dinesh_chan8@hotmail.com> wrote:> YES. > > But if I want to add memory of type E820_USABLE to xen memory map > during boot up (as per xen/e820.c) where the memory to be added lies behind > a PCI device? > > For ex, > If a PCI device reports it has 1GB of memory behind it. > And XEN has identified th RAM memory to be 4GB. > > How can the PCI - 1GB can be added as usable memory to XEN''s memory pool to > get a cumulative size of 5GB; > > thanks, > Dinesh C > > On Fri, Jun 6, 2008 at 3:00 PM, Weiming wrote: > > AFAIK, In para virtualization, when guest boots, it reads the memory layout > from a special page (start info page) instead of from bios. > If your guest os is a PV Linux, you can check its source code (e.g. > start_kernel(), etc.) > > Thanks, > Weiming > > On Fri, Jun 6, 2008 at 2:00 PM, dinesh chandrasekaran < > dinesh_chan8@hotmail.com> wrote: > > > > ------------------------------ > CoolHotmail : Your crazy personality deserves a unique email identity like > yourname@iamcrazy.in. Choose from this and hundreds other unique email ids > now Try it! <http://www.Coolhotmail.com> > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel > >_______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
dinesh chandrasekaran
2008-Jun-12 19:34 UTC
RE: [Xen-users] Re: [Xen-devel] Xen - Guest memory allocation
Thanks Weiming, But did the same by editing the e820.c. That is, after xen boots up, if I type "xm dmesg" I could find my output which is (000000000fff000000 - 00000000ffffffff (mypci_usable)). I couldn''t find the exact place in xen source where the memory allocation for DomU guests are performed. Now how can I make XEN use the above (mypci_usable) memory range to allocate memory for all its DomU guests. Thanks in advance Dinesh C Date: Fri, 6 Jun 2008 15:12:49 -0400 From: zephyr.zhao@gmail.com To: dinesh_chan8@hotmail.com CC: xen-devel@lists.xensource.com; xen-users@lists.xensource.com Subject: [Xen-users] Re: [Xen-devel] Xen - Guest memory allocation I''m not very sure about your problem. Can the Hypervisor address the whole 5GB space? If yes, it can then allocate any of them to guests. Or you can modify the "start info" passed to Guest OS. You can change the page_nr, a machine-PFN translation table to enable the guest to address the memory space that you want. It''s weird. On Fri, Jun 6, 2008 at 2:57 PM, dinesh chandrasekaran <dinesh_chan8@hotmail.com> wrote: YES. But if I want to add memory of type E820_USABLE to xen memory map during boot up (as per xen/e820.c) where the memory to be added lies behind a PCI device? For ex, If a PCI device reports it has 1GB of memory behind it. And XEN has identified th RAM memory to be 4GB. How can the PCI - 1GB can be added as usable memory to XEN''s memory pool to get a cumulative size of 5GB; thanks, Dinesh C On Fri, Jun 6, 2008 at 3:00 PM, Weiming wrote: AFAIK, In para virtualization, when guest boots, it reads the memory layout from a special page (start info page) instead of from bios. If your guest os is a PV Linux, you can check its source code (e.g. start_kernel(), etc.) Thanks, Weiming On Fri, Jun 6, 2008 at 2:00 PM, dinesh chandrasekaran <dinesh_chan8@hotmail.com> wrote: CoolHotmail : Your crazy personality deserves a unique email identity like yourname@iamcrazy.in. Choose from this and hundreds other unique email ids now Try it! _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel _________________________________________________________________ No Harvard, No Oxford. We are here. Find out !! http://ss1.richmedia.in/recurl.asp?pid=500 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
weiming
2008-Jun-13 02:37 UTC
Re: [Xen-users] Re: [Xen-devel] Xen - Guest memory allocation
Can dom0 address the whole memory space if no other domU running? If so, it can freely allocate memory to other guests. On Thu, Jun 12, 2008 at 3:34 PM, dinesh chandrasekaran < dinesh_chan8@hotmail.com> wrote:> Thanks Weiming, > > But did the same by editing the e820.c. That > is, after xen boots up, if I type "xm dmesg" I could find my output which is > (000000000fff000000 - 00000000ffffffff (mypci_usable)). > > I couldn''t find the exact place in xen source where the memory allocation > for DomU guests are performed. > > Now how can I make XEN use the above (mypci_usable) memory range to > allocate memory for all its DomU guests. > > Thanks in advance > Dinesh C > > > ------------------------------ > Date: Fri, 6 Jun 2008 15:12:49 -0400 > From: zephyr.zhao@gmail.com > To: dinesh_chan8@hotmail.com > CC: xen-devel@lists.xensource.com; xen-users@lists.xensource.com > Subject: [Xen-users] Re: [Xen-devel] Xen - Guest memory allocation > > > I''m not very sure about your problem. Can the Hypervisor address the whole > 5GB space? If yes, it can then allocate any of them to guests. > > Or you can modify the "start info" passed to Guest OS. You can change the > page_nr, a machine-PFN translation table to enable the guest to address the > memory space that you want. It''s weird. > > On Fri, Jun 6, 2008 at 2:57 PM, dinesh chandrasekaran < > dinesh_chan8@hotmail.com> wrote: > > YES. > > But if I want to add memory of type E820_USABLE to xen memory map > during boot up (as per xen/e820.c) where the memory to be added lies behind > a PCI device? > > For ex, > If a PCI device reports it has 1GB of memory behind it. > And XEN has identified th RAM memory to be 4GB. > > How can the PCI - 1GB can be added as usable memory to XEN''s memory pool to > get a cumulative size of 5GB; > > thanks, > Dinesh C > > On Fri, Jun 6, 2008 at 3:00 PM, Weiming wrote: > > AFAIK, In para virtualization, when guest boots, it reads the memory layout > from a special page (start info page) instead of from bios. > If your guest os is a PV Linux, you can check its source code (e.g. > start_kernel(), etc.) > > Thanks, > Weiming > > On Fri, Jun 6, 2008 at 2:00 PM, dinesh chandrasekaran < > dinesh_chan8@hotmail.com> wrote: > > > > ------------------------------ > CoolHotmail : Your crazy personality deserves a unique email identity like > yourname@iamcrazy.in. Choose from this and hundreds other unique email ids > now Try it! <http://www.Coolhotmail.com> > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel > > > > ------------------------------ > CoolHotmail : Your crazy personality deserves a unique email identity like > yourname@iamcrazy.in. Choose from this and hundreds other unique email ids > now Try it! <http://www.Coolhotmail.com> > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel > >_______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
dinesh chandrasekaran
2008-Jun-16 18:37 UTC
RE: [Xen-users] Re: [Xen-devel] Xen - Guest memory allocation
Yes, ofcourse dom0 can see this range. But all the domUs memory has to fall in this restricted memory range (as specified by mypci_usabe)? for example, If I start three virtual machines, say VM1, VM2, VM3 with 64MB memory each, how could I make sure that, the total 192MB for three VMs lie somewhere in mypci_usable range only and not anywhere else. Thanks, Dinesh C Date: Thu, 12 Jun 2008 22:37:17 -0400 From: zephyr.zhao@gmail.com To: dinesh_chan8@hotmail.com Subject: Re: [Xen-users] Re: [Xen-devel] Xen - Guest memory allocation CC: xen-devel@lists.xensource.com; xen-users@lists.xensource.com Can dom0 address the whole memory space if no other domU running? If so, it can freely allocate memory to other guests. On Thu, Jun 12, 2008 at 3:34 PM, dinesh chandrasekaran <dinesh_chan8@hotmail.com> wrote: Thanks Weiming, But did the same by editing the e820.c. That is, after xen boots up, if I type "xm dmesg" I could find my output which is (000000000fff000000 - 00000000ffffffff (mypci_usable)). I couldn''t find the exact place in xen source where the memory allocation for DomU guests are performed. Now how can I make XEN use the above (mypci_usable) memory range to allocate memory for all its DomU guests. Thanks in advance Dinesh C Date: Fri, 6 Jun 2008 15:12:49 -0400 From: zephyr.zhao@gmail.com To: dinesh_chan8@hotmail.com CC: xen-devel@lists.xensource.com; xen-users@lists.xensource.com Subject: [Xen-users] Re: [Xen-devel] Xen - Guest memory allocation I''m not very sure about your problem. Can the Hypervisor address the whole 5GB space? If yes, it can then allocate any of them to guests. Or you can modify the "start info" passed to Guest OS. You can change the page_nr, a machine-PFN translation table to enable the guest to address the memory space that you want. It''s weird. On Fri, Jun 6, 2008 at 2:57 PM, dinesh chandrasekaran <dinesh_chan8@hotmail.com> wrote: YES. But if I want to add memory of type E820_USABLE to xen memory map during boot up (as per xen/e820.c) where the memory to be added lies behind a PCI device? For ex, If a PCI device reports it has 1GB of memory behind it. And XEN has identified th RAM memory to be 4GB. How can the PCI - 1GB can be added as usable memory to XEN''s memory pool to get a cumulative size of 5GB; thanks, Dinesh C On Fri, Jun 6, 2008 at 3:00 PM, Weiming wrote: AFAIK, In para virtualization, when guest boots, it reads the memory layout from a special page (start info page) instead of from bios. If your guest os is a PV Linux, you can check its source code (e.g. start_kernel(), etc.) Thanks, Weiming On Fri, Jun 6, 2008 at 2:00 PM, dinesh chandrasekaran <dinesh_chan8@hotmail.com> wrote: CoolHotmail : Your crazy personality deserves a unique email identity like yourname@iamcrazy.in. Choose from this and hundreds other unique email ids now Try it! _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel CoolHotmail : Your crazy personality deserves a unique email identity like yourname@iamcrazy.in. Choose from this and hundreds other unique email ids now Try it! _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel _________________________________________________________________ Watch hottest Bollywood videos, clips, movie tailors, star interviews, songs and more on MSN videos. http://video.msn.com/?mkt=en-in _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
weiming
2008-Jun-16 19:39 UTC
Re: [Xen-users] Re: [Xen-devel] Xen - Guest memory allocation
by default, dom0 gets all the available memory (usable physical memory - xen hypervisor). Then, when domU starts up, xen will decrease dom0''s allocation via ballooning and allocate them to domU. Do you want to specify the exact physical memory address space used by domU? On Mon, Jun 16, 2008 at 2:37 PM, dinesh chandrasekaran < dinesh_chan8@hotmail.com> wrote:> Yes, ofcourse dom0 can see this range. > > But all the domUs memory has to fall in this restricted memory range (as > specified by mypci_usabe)? > > for example, > If I start three virtual machines, say VM1, VM2, VM3 with 64MB memory each, > > how could I make sure that, the total 192MB for three VMs lie somewhere in > mypci_usable range only and not anywhere else. > > Thanks, > Dinesh C > > ------------------------------ > Date: Thu, 12 Jun 2008 22:37:17 -0400 > From: zephyr.zhao@gmail.com > To: dinesh_chan8@hotmail.com > Subject: Re: [Xen-users] Re: [Xen-devel] Xen - Guest memory allocation > > CC: xen-devel@lists.xensource.com; xen-users@lists.xensource.com > > Can dom0 address the whole memory space if no other domU running? If so, it > can freely allocate memory to other guests. > > On Thu, Jun 12, 2008 at 3:34 PM, dinesh chandrasekaran < > dinesh_chan8@hotmail.com> wrote: > > Thanks Weiming, > > But did the same by editing the e820.c. That > is, after xen boots up, if I type "xm dmesg" I could find my output which is > (000000000fff000000 - 00000000ffffffff (mypci_usable)). > > I couldn''t find the exact place in xen source where the memory allocation > for DomU guests are performed. > > Now how can I make XEN use the above (mypci_usable) memory range to > allocate memory for all its DomU guests. > > Thanks in advance > Dinesh C > > > ------------------------------ > Date: Fri, 6 Jun 2008 15:12:49 -0400 > From: zephyr.zhao@gmail.com > To: dinesh_chan8@hotmail.com > CC: xen-devel@lists.xensource.com; xen-users@lists.xensource.com > Subject: [Xen-users] Re: [Xen-devel] Xen - Guest memory allocation > > > I''m not very sure about your problem. Can the Hypervisor address the whole > 5GB space? If yes, it can then allocate any of them to guests. > > Or you can modify the "start info" passed to Guest OS. You can change the > page_nr, a machine-PFN translation table to enable the guest to address the > memory space that you want. It''s weird. > > On Fri, Jun 6, 2008 at 2:57 PM, dinesh chandrasekaran < > dinesh_chan8@hotmail.com> wrote: > > YES. > > But if I want to add memory of type E820_USABLE to xen memory map > during boot up (as per xen/e820.c) where the memory to be added lies behind > a PCI device? > > For ex, > If a PCI device reports it has 1GB of memory behind it. > And XEN has identified th RAM memory to be 4GB. > > How can the PCI - 1GB can be added as usable memory to XEN''s memory pool to > get a cumulative size of 5GB; > > thanks, > Dinesh C > > On Fri, Jun 6, 2008 at 3:00 PM, Weiming wrote: > > AFAIK, In para virtualization, when guest boots, it reads the memory layout > from a special page (start info page) instead of from bios. > If your guest os is a PV Linux, you can check its source code (e.g. > start_kernel(), etc.) > > Thanks, > Weiming > > On Fri, Jun 6, 2008 at 2:00 PM, dinesh chandrasekaran < > dinesh_chan8@hotmail.com> wrote: > > > > ------------------------------ > CoolHotmail : Your crazy personality deserves a unique email identity like > yourname@iamcrazy.in. Choose from this and hundreds other unique email ids > now Try it! <http://www.Coolhotmail.com> > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel > > > > ------------------------------ > CoolHotmail : Your crazy personality deserves a unique email identity like > yourname@iamcrazy.in. Choose from this and hundreds other unique email ids > now Try it! <http://www.Coolhotmail.com> > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel > > > > ------------------------------ > Skydrive - Get 5GB online space for FREE!. Store and share music, photos > and documents online with ease. Try it now! <http://skydrive.live.com/> > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel > >_______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
dinesh chandrasekaran
2008-Jun-16 21:52 UTC
[Xen-users] Re: [Xen-devel] Xen - Guest memory allocation
>> by default, dom0 gets all the available memory (usable physical memory- xen hypervisor). Then, when domU starts up, xen will decrease dom0''sallocation >> via ballooning and allocate them to domU.Yes weiming you are correct. But ballooning could be disabled.>>Do you want to specify the exact physical memory address space used by domU?Yes absolutly. Could that be done? (Hope by physical address you mean the real/machine/RAM address) If so should I have to edit xen source or Dom0 source. Thanks, Dinesh C Date: Mon, 16 Jun 2008 15:39:13 -0400 From: zephyr.zhao@gmail.com To: dinesh_chan8@hotmail.com Subject: Re: [Xen-users] Re: [Xen-devel] Xen - Guest memory allocation CC: xen-devel@lists.xensource.com; xen-users@lists.xensource.com by default, dom0 gets all the available memory (usable physical memory - xen hypervisor). Then, when domU starts up, xen will decrease dom0''s allocation via ballooning and allocate them to domU. Do you want to specify the exact physical memory address space used by domU? On Mon, Jun 16, 2008 at 2:37 PM, dinesh chandrasekaran <dinesh_chan8@hotmail.com> wrote: Yes, ofcourse dom0 can see this range. But all the domUs memory has to fall in this restricted memory range (as specified by mypci_usabe)? for example, If I start three virtual machines, say VM1, VM2, VM3 with 64MB memory each, how could I make sure that, the total 192MB for three VMs lie somewhere in mypci_usable range only and not anywhere else. Thanks, Dinesh C Date: Thu, 12 Jun 2008 22:37:17 -0400 From: zephyr.zhao@gmail.com To: dinesh_chan8@hotmail.com Subject: Re: [Xen-users] Re: [Xen-devel] Xen - Guest memory allocation CC: xen-devel@lists.xensource.com; xen-users@lists.xensource.com Can dom0 address the whole memory space if no other domU running? If so, it can freely allocate memory to other guests. On Thu, Jun 12, 2008 at 3:34 PM, dinesh chandrasekaran <dinesh_chan8@hotmail.com> wrote: Thanks Weiming, But did the same by editing the e820.c. That is, after xen boots up, if I type ''xm dmesg'' I could find my output which is (000000000fff000000 - 00000000ffffffff (mypci_usable)). I couldn''t find the exact place in xen source where the memory allocation for DomU guests are performed. Now how can I make XEN use the above (mypci_usable) memory range to allocate memory for all its DomU guests. Thanks in advance Dinesh C Date: Fri, 6 Jun 2008 15:12:49 -0400 From: zephyr.zhao@gmail.com To: dinesh_chan8@hotmail.com CC: xen-devel@lists.xensource.com; xen-users@lists.xensource.com Subject: [Xen-users] Re: [Xen-devel] Xen - Guest memory allocation I''m not very sure about your problem. Can the Hypervisor address the whole 5GB space? If yes, it can then allocate any of them to guests. Or you can modify the ''start info'' passed to Guest OS. You can change the page_nr, a machine-PFN translation table to enable the guest to address the memory space that you want. It''s weird. On Fri, Jun 6, 2008 at 2:57 PM, dinesh chandrasekaran <dinesh_chan8@hotmail.com> wrote: YES. But if I want to add memory of type E820_USABLE to xen memory map during boot up (as per xen/e820.c) where the memory to be added lies behind a PCI device? For ex, If a PCI device reports it has 1GB of memory behind it. And XEN has identified th RAM memory to be 4GB. How can the PCI - 1GB can be added as usable memory to XEN''s memory pool to get a cumulative size of 5GB; thanks, Dinesh C On Fri, Jun 6, 2008 at 3:00 PM, Weiming wrote: AFAIK, In para virtualization, when guest boots, it reads the memorylayout from a special page (start info page) instead of from bios. If your guest os is a PV Linux, you can check its source code (e.g. start_kernel(), etc.) Thanks, Weiming On Fri, Jun 6, 2008 at 2:00 PM, dinesh chandrasekaran <dinesh_chan8@hotmail.com> wrote: CoolHotmail : Your crazy personality deserves a unique email identity like yourname@iamcrazy.in. Choose from this and hundreds other unique email ids now Try it! _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel CoolHotmail : Your crazy personality deserves a unique email identity like yourname@iamcrazy.in. Choose from this and hundreds other unique email ids now Try it! _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel Skydrive - Get 5GB online space for FREE!. Store and share music, photos and documents online with ease. Try it now! _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel Placements ? No Problem. Register Here! Try it! _________________________________________________________________ 2000 Placements last year. Are You next ? Find out http://ss1.richmedia.in/recurl.asp?pid=499 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Derek Murray
2008-Jun-16 22:09 UTC
Re: [Xen-users] Re: [Xen-devel] Xen - Guest memory allocation
Hi Dinesh, The pages that are used for a DomU''s memory are allocated when the domain builder (in Dom0) calls xc_domain_populate_physmap(), which executes a hypercall and ultimately calls populate_physmap() in xen/common/memory.c. I''m not terribly familiar with this code, but it looks like it might be possible to hack in a replacement to achieve your desired effect. Regards, Derek Murray. On Mon, Jun 16, 2008 at 10:52 PM, dinesh chandrasekaran <dinesh_chan8@hotmail.com> wrote:> >>> by default, dom0 gets all the available memory (usable physical memory- >>> xen hypervisor). Then, when domU starts up, xen will decrease >>> dom0''sallocation >> via ballooning and allocate them to domU. > > Yes weiming you are correct. But ballooning could be disabled. > >>>Do you want to specify the exact physical memory address space used by >>> domU? > > Yes absolutly. Could that be done? (Hope by physical address you mean the > real/machine/RAM address) > If so should I have to edit xen source or Dom0 source. > > Thanks, > Dinesh C > > > ________________________________ > Date: Mon, 16 Jun 2008 15:39:13 -0400 > From: zephyr.zhao@gmail.com > To: dinesh_chan8@hotmail.com > Subject: Re: [Xen-users] Re: [Xen-devel] Xen - Guest memory allocation > CC: xen-devel@lists.xensource.com; xen-users@lists.xensource.com > > by default, dom0 gets all the available memory (usable physical memory - xen > hypervisor). Then, when domU starts up, xen will decrease dom0''s allocation > via ballooning and allocate them to domU. > > Do you want to specify the exact physical memory address space used by domU? > > On Mon, Jun 16, 2008 at 2:37 PM, dinesh chandrasekaran > <dinesh_chan8@hotmail.com> wrote: > > Yes, ofcourse dom0 can see this range. > > But all the domUs memory has to fall in this restricted memory range (as > specified by mypci_usabe)? > > for example, > If I start three virtual machines, say VM1, VM2, VM3 with 64MB memory each, > how could I make sure that, the total 192MB for three VMs lie somewhere in > mypci_usable range only and not anywhere else. > > Thanks, > Dinesh C > > ________________________________ > Date: Thu, 12 Jun 2008 22:37:17 -0400 > From: zephyr.zhao@gmail.com > To: dinesh_chan8@hotmail.com > Subject: Re: [Xen-users] Re: [Xen-devel] Xen - Guest memory allocation > CC: xen-devel@lists.xensource.com; xen-users@lists.xensource.com > > Can dom0 address the whole memory space if no other domU running? If so, it > can freely allocate memory to other guests. > > On Thu, Jun 12, 2008 at 3:34 PM, dinesh chandrasekaran > <dinesh_chan8@hotmail.com> wrote: > > Thanks Weiming, > > But did the same by editing the e820.c. That is, > after xen boots up, if I type ''xm dmesg'' I could find my output which is > (000000000fff000000 - 00000000ffffffff (mypci_usable)). > > I couldn''t find the exact place in xen source where the memory allocation > for DomU guests are performed. > > Now how can I make XEN use the above (mypci_usable) memory range to allocate > memory for all its DomU guests. > > Thanks in advance > Dinesh C > > > ________________________________ > Date: Fri, 6 Jun 2008 15:12:49 -0400 > From: zephyr.zhao@gmail.com > To: dinesh_chan8@hotmail.com > CC: xen-devel@lists.xensource.com; xen-users@lists.xensource.com > Subject: [Xen-users] Re: [Xen-devel] Xen - Guest memory allocation > > I''m not very sure about your problem. Can the Hypervisor address the whole > 5GB space? If yes, it can then allocate any of them to guests. > > Or you can modify the ''start info'' passed to Guest OS. You can change the > page_nr, a machine-PFN translation table to enable the guest to address the > memory space that you want. It''s weird. > > On Fri, Jun 6, 2008 at 2:57 PM, dinesh chandrasekaran > <dinesh_chan8@hotmail.com> wrote: > > YES. > > But if I want to add memory of type E820_USABLE to xen memory map > during boot up (as per xen/e820.c) where the memory to be added lies behind > a PCI device? > > For ex, > If a PCI device reports it has 1GB of memory behind it. > And XEN has identified th RAM memory to be 4GB. > > How can the PCI - 1GB can be added as usable memory to XEN''s memory pool to > get a cumulative size of 5GB; > > thanks, > Dinesh C > > On Fri, Jun 6, 2008 at 3:00 PM, Weiming wrote: > > AFAIK, In para virtualization, when guest boots, it reads the memorylayout > from a special page (start info page) instead of from bios. > If your guest os is a PV Linux, you can check its source code (e.g. > start_kernel(), etc.) > > Thanks, > Weiming > > On Fri, Jun 6, 2008 at 2:00 PM, dinesh chandrasekaran > <dinesh_chan8@hotmail.com> wrote: > > > > ________________________________ > CoolHotmail : Your crazy personality deserves a unique email identity like > yourname@iamcrazy.in. Choose from this and hundreds other unique email ids > now Try it! > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel > > > > ________________________________ > CoolHotmail : Your crazy personality deserves a unique email identity like > yourname@iamcrazy.in. Choose from this and hundreds other unique email ids > now Try it! > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel > > > > ________________________________ > Skydrive - Get 5GB online space for FREE!. Store and share music, photos and > documents online with ease. Try it now! > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel > > > > ________________________________ > Placements ? No Problem. Register Here! Try it! > > ________________________________ > WL Messenger : Stay connected to friends and family with the New Windows > Live Messenger. Get it now. Try it now! > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel > >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
dinesh chandrasekaran
2008-Jun-20 02:34 UTC
[Xen-users] Re: [Xen-devel] Xen - Guest memory allocation
Thank you Derek, I''m currently work on your idea and its cuming out as expected. Let me confirm, The domain builder inside dom0 calls populate_physmap(), allocates pages for domUs, and computes the following START_INFO_PAGE attributes pt_base, mfn_list and nr_pt_frames. But the source says, all the above attributes are VIRTUAL ADDRESSES and on the contrary the book, ''The defenitive guide for XEN hypervisor'' says they are pseudo-physical addresses. I know these two are different. But I''m still not clear, Could you help me better understand the difference? Dinesh C> Date: Mon, 16 Jun 2008 23:09:31 +0100 > From: Derek.Murray@cl.cam.ac.uk > To: dinesh_chan8@hotmail.com > Subject: Re: [Xen-users] Re: [Xen-devel] Xen - Guest memory allocation > CC: xen-devel@lists.xensource.com; xen-users@lists.xensource.com > > Hi Dinesh, > > The pages that are used for a DomU''s memory are allocated when the > domain builder (in Dom0) calls xc_domain_populate_physmap(), which > executes a hypercall and ultimately calls populate_physmap() in > xen/common/memory.c. > > I''m not terribly familiar with this code, but it looks like it might > be possible to hack in a replacement to achieve your desired effect. > > Regards, > > Derek Murray. > > On Mon, Jun 16, 2008 at 10:52 PM, dinesh chandrasekaran > <dinesh_chan8@hotmail.com> wrote: > > > >>> by default, dom0 gets all the available memory (usable physical memory- > >>> xen hypervisor). Then, when domU starts up, xen will decrease > >>> dom0''sallocation >> via ballooning and allocate them to domU. > > > > Yes weiming you are correct. But ballooning could be disabled. > > > >>>Do you want to specify the exact physical memory address space used by > >>> domU? > > > > Yes absolutly. Could that be done? (Hope by physical address you mean the > > real/machine/RAM address) > > If so should I have to edit xen source or Dom0 source. > > > > Thanks, > > Dinesh C > > > > > > ________________________________ > > Date: Mon, 16 Jun 2008 15:39:13 -0400 > > From: zephyr.zhao@gmail.com > > To: dinesh_chan8@hotmail.com > > Subject: Re: [Xen-users] Re: [Xen-devel] Xen - Guest memory allocation > > CC: xen-devel@lists.xensource.com; xen-users@lists.xensource.com > > > > by default, dom0 gets all the available memory (usable physical memory - xen > > hypervisor). Then, when domU starts up, xen will decrease dom0''s allocation > > via ballooning and allocate them to domU. > > > > Do you want to specify the exact physical memory address space used by domU? > > > > On Mon, Jun 16, 2008 at 2:37 PM, dinesh chandrasekaran > > <dinesh_chan8@hotmail.com> wrote: > > > > Yes, ofcourse dom0 can see this range. > > > > But all the domUs memory has to fall in this restricted memory range (as > > specified by mypci_usabe)? > > > > for example, > > If I start three virtual machines, say VM1, VM2, VM3 with 64MB memory each, > > how could I make sure that, the total 192MB for three VMs lie somewhere in > > mypci_usable range only and not anywhere else. > > > > Thanks, > > Dinesh C > > > > ________________________________ > > Date: Thu, 12 Jun 2008 22:37:17 -0400 > > From: zephyr.zhao@gmail.com > > To: dinesh_chan8@hotmail.com > > Subject: Re: [Xen-users] Re: [Xen-devel] Xen - Guest memory allocation > > CC: xen-devel@lists.xensource.com; xen-users@lists.xensource.com > > > > Can dom0 address the whole memory space if no other domU running? If so, it > > can freely allocate memory to other guests. > > > > On Thu, Jun 12, 2008 at 3:34 PM, dinesh chandrasekaran > > <dinesh_chan8@hotmail.com> wrote: > > > > Thanks Weiming, > > > > But did the same by editing the e820.c. That is, > > after xen boots up, if I type ''xm dmesg'' I could find my output which is > > (000000000fff000000 - 00000000ffffffff (mypci_usable)). > > > > I couldn''t find the exact place in xen source where the memory allocation > > for DomU guests are performed. > > > > Now how can I make XEN use the above (mypci_usable) memory range to allocate > > memory for all its DomU guests. > > > > Thanks in advance > > Dinesh C > > > > > > ________________________________ > > Date: Fri, 6 Jun 2008 15:12:49 -0400 > > From: zephyr.zhao@gmail.com > > To: dinesh_chan8@hotmail.com > > CC: xen-devel@lists.xensource.com; xen-users@lists.xensource.com > > Subject: [Xen-users] Re: [Xen-devel] Xen - Guest memory allocation > > > > I''m not very sure about your problem. Can the Hypervisor address the whole > > 5GB space? If yes, it can then allocate any of them to guests. > > > > Or you can modify the ''start info'' passed to Guest OS. You can change the > > page_nr, a machine-PFN translation table to enable the guest to address the > > memory space that you want. It''s weird. > > > > On Fri, Jun 6, 2008 at 2:57 PM, dinesh chandrasekaran > > <dinesh_chan8@hotmail.com> wrote: > > > > YES. > > > > But if I want to add memory of type E820_USABLE to xen memory map > > during boot up (as per xen/e820.c) where the memory to be added lies behind > > a PCI device? > > > > For ex, > > If a PCI device reports it has 1GB of memory behind it. > > And XEN has identified th RAM memory to be 4GB. > > > > How can the PCI - 1GB can be added as usable memory to XEN''s memory pool to > > get a cumulative size of 5GB; > > > > thanks, > > Dinesh C > > > > On Fri, Jun 6, 2008 at 3:00 PM, Weiming wrote: > > > > AFAIK, In para virtualization, when guest boots, it reads the memorylayout > > from a special page (start info page) instead of from bios. > > If your guest os is a PV Linux, you can check its source code (e.g. > > start_kernel(), etc.) > > > > Thanks, > > Weiming > > > > On Fri, Jun 6, 2008 at 2:00 PM, dinesh chandrasekaran > > <dinesh_chan8@hotmail.com> wrote: > > > > > > > > ________________________________ > > CoolHotmail : Your crazy personality deserves a unique email identity like > > yourname@iamcrazy.in. Choose from this and hundreds other unique email ids > > now Try it! > > _______________________________________________ > > Xen-devel mailing list > > Xen-devel@lists.xensource.com > > http://lists.xensource.com/xen-devel > > > > > > > > ________________________________ > > CoolHotmail : Your crazy personality deserves a unique email identity like > > yourname@iamcrazy.in. Choose from this and hundreds other unique email ids > > now Try it! > > _______________________________________________ > > Xen-devel mailing list > > Xen-devel@lists.xensource.com > > http://lists.xensource.com/xen-devel > > > > > > > > ________________________________ > > Skydrive - Get 5GB online space for FREE!. Store and share music, photos and > > documents online with ease. Try it now! > > _______________________________________________ > > Xen-devel mailing list > > Xen-devel@lists.xensource.com > > http://lists.xensource.com/xen-devel > > > > > > > > ________________________________ > > Placements ? No Problem. Register Here! Try it! > > > > ________________________________ > > WL Messenger : Stay connected to friends and family with the New Windows > > Live Messenger. Get it now. Try it now! > > _______________________________________________ > > Xen-devel mailing list > > Xen-devel@lists.xensource.com > > http://lists.xensource.com/xen-devel > > > > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-develLive.in : Get your yourname@live.in email id today. Powered by Windows Live Hotmail. Check it out! _________________________________________________________________ No Harvard, No Oxford. We are here. Find out !! http://ss1.richmedia.in/recurl.asp?pid=500 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Derek Murray
2008-Jun-20 08:56 UTC
Re: [Xen-users] Re: [Xen-devel] Xen - Guest memory allocation
Hi Dinesh, On Fri, Jun 20, 2008 at 3:34 AM, dinesh chandrasekaran <dinesh_chan8@hotmail.com> wrote:> The domain builder inside dom0 calls populate_physmap(), > allocates pages for domUs, > and computes the following START_INFO_PAGE attributes > pt_base, mfn_list and nr_pt_frames. > > But the source says, all the above attributes are VIRTUAL ADDRESSES > and on the contrary the book, ''The defenitive guide for XEN hypervisor'' says > they are pseudo-physical addresses. > > I know these two are different. But I''m still not clear, > Could you help me better understand the difference?The comment in the xen.h that refers to virtual addresses means that these pt_base and mfn_list contain pointers (in the virtual address space) to the bootstrap page table and list of MFNs (machine frame numbers, corresponding to the real (host) physical addresses). When a paravirtualised domain is created, it is already in protected mode with paging enabled, and the domain builder creates a bootstrap page table for it to use (so that it can address the kernel, modules and other virtualisation-related data structures). I don''t have a copy of that book, but I assume what it means is that the array mfn_list is *indexed* by pseudo-physical frame numbers (i.e. one for each frame of physical memory allocated to the guest, contiguously numbered and starting from zero). Regards, Derek. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Grzegorz Miłoś
2008-Jun-20 09:16 UTC
Re: [Xen-users] Re: [Xen-devel] Xen - Guest memory allocation
> I''m currently work on your idea and its cuming out as > expected. > Let me confirm, > The domain builder inside dom0 calls populate_physmap(), > allocates pages for domUs, > and computes the following START_INFO_PAGE attributes > pt_base, mfn_list and nr_pt_frames. > > But the source says, all the above attributes are VIRTUAL ADDRESSES > and on the contrary the book, ''The defenitive guide for XEN hypervisor'' says > they are pseudo-physical addresses.pt_base is a virtual address in DomU''s virtual address space mfn_list is the list of _machine_ page numbers (not pseudophysical) assigned to the domain nr_pt_frames specifies how many pages have been used up to build the initial page tables for the domain> I know these two are different. But I''m still not clear, > Could you help me better understand the difference?Having read the previous messages, I''m assuming you want to make sure that the machine pages assigned to DomU fall within certain machine range. If that''s really your goal, you''ll have to hack Xen sources rather then Dom0/tools, because it is Xen that assigns pages to DomU (via the populate_physmap call from Derek''s email). In particular: populate_physmap() defined in xen/common/memory.c uses: alloc_domheap_pages() defined in xen/common/page_alloc.c which in turn calls: alloc_heap_pages() in page_alloc.c You will have to review this allocator to make sure that the returned pages satisfy your conditions. Why do you want to restrict DomU to use frames from certain range only? What''s the logic behind that? Thanks Gr(z)egor(z) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
dinesh chandrasekaran
2008-Jun-20 14:14 UTC
RE: [Xen-users] Re: [Xen-devel] Xen - Guest memory allocation
> pt_base is a virtual address in DomU''s virtual address space > mfn_list is the list of _machine_ page numbers (not pseudophysical) > assigned to the domain > nr_pt_frames specifies how many pages have been used up to build the > initial page tables for the domainThanks Milos.> Having read the previous messages, I''m assuming you want to make sure > that the machine pages assigned to DomU fall within certain machine > range. If that''s really your goal, you''ll have to hack Xen sources > rather then Dom0/tools, because it is Xen that assigns pages to DomU > (via the populate_physmap call from Derek''s email).Absolutly. I never tried getting into Dom0/tools. I was working with xen/arch/x86/e820.c and xen/common/memory.c (as specified by Derek);> In particular: > populate_physmap() defined in xen/common/memory.c uses: > alloc_domheap_pages() defined in xen/common/page_alloc.c which in turn calls: > alloc_heap_pages() in page_alloc.c > You will have to review this allocator to make sure that the returned > pages satisfy your conditions.Exactly. And alloc_heap_pages() calls map_alloc(). I tried hardcoding the machine addr_start and size (256MB) and create pages out of it inside populate_physmap(); But yet to make xen and test it. Hope that works (what do you think).> Why do you want to restrict DomU to use frames from certain range > only? What''s the logic behind that?Im trying to allocate memory for domUs from memory behind a PCI device. The machine_addr_start is obtained by probing the device (as I know the vendor and device info) during xen boot-up. Thanks, Dinesh C _________________________________________________________________ 2000 Placements last year. Are You next ? Find out http://ss1.richmedia.in/recurl.asp?pid=499 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Grzegorz Miłoś
2008-Jun-20 17:03 UTC
Re: [Xen-users] Re: [Xen-devel] Xen - Guest memory allocation
>> Why do you want to restrict DomU to use frames from certain range >> only? What''s the logic behind that? > > Im trying to allocate memory for domUs from memory behind a PCI device. The > machine_addr_start is obtained by probing the device (as I know the vendor > and device info) during xen boot-up.That''s what I was suspecting. I think you should give PCI passthrough a go first. PCI passthrough allows a PCI device to be hidden away from Dom0 and exported to a DomU. You achieve the first by passing pciback.hide=(XX:XX.X) option to Dom0 kernel and adding pci = [ ''XX:XX.X′ ] to DomU config file. You''ll also need CONFIG_XEN_PCIDEV_FRONTEND=y and CONFIG_XEN_PCIDEV_BACKEND=y in your DomU and Dom0 kernel configs. Hope this helps Gr(z)egor(z) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
dinesh chandrasekaran
2008-Jun-29 15:08 UTC
[Xen-users] Re: [Xen-devel] Xen - Guest memory allocation
yeah by maddr_pci, I mean the machine address of the memory behind PCI device found by using pci_conf_read(my_pci, PCI_SIZE, PCI-BASE_ADDRESS_0) where PCI_SIZE = 256MB. unsigned long maddr = 0xdf000000;> > maddr_pci = ((maddr + PAGE_SIZE-1) &PAGE_MASK); //// THIS IS WRONGIm sorry.it is,maddr = ((maddr + PAGE_SIZE-1) &PAGE_MASK); Yes, about the I/O pages, my machine uses 36-bit physical addresses, since PCI address are all 32-bit, Im facing difficulties in converting these addresses into pages using maddr_to_page(); So, I have to use a 64-bit PCI device. Thanks Milos, Dinesh C> Date: Sat, 28 Jun 2008 16:50:48 +0100 > From: gm281@cam.ac.uk > To: dinesh_chan8@hotmail.com > Subject: Re: [Xen-users] Re: [Xen-devel] Xen - Guest memory allocation > CC: xen-devel@lists.xensource.com; xen-users@lists.xensource.com; derek.murray@cl.cam.ac.uk > > > Hi, > > > > if I use the following inside the populate_physmap() inside > > xen/common/memory.c, > > > > unsigned long maddr_pci = 0xdf000000; //since I know the machine > > address of the mememory behind my pci device <xm dmesg> > > > > static void populate_physmap(struct memop_args *a) > > { > > /****** > > > > for(i=a->nr_done; i<a->nr_extents; i++) > > { > > /************* > > &nb sp; if(d->is_privilaged) > > > > page = alloc_domheap_pages(d, a->extent_order, a->memflags | > > MEMF_node(node)); > > else > > { > > page = maddr_to_page(maddr_pci); > > This is going to assign DomU IO pages _only_. > > > maddr_pci = ((maddr + PAGE_SIZE-1) &PAGE_MASK); > > What is maddr here? Did you mean maddr_pci? Also, (page_aligned_x + > PAGE_SIZE - 1) & PAGE_MASK = page_aligned_x, in other words you are > stuck on the same page. > > > > > `   ; } > > /*************** > > } > > printk(''a->nr_done: %lx'', a->nr_done); > > } > > > > The printk says ''a->nr_done: 2000'' when ''xm dmesg'' is used (which is correct > > since I allocated 32MB for DomU = 8192 pages = 0x2000) > > > > but exits with the following error: > > > > & n bsp; ''dmesg'' says : Using config file > > ''/home/guest/Guest.conf''. > > Error: (1, ''Internal error'', ''xc_dom_boot_domU_map: > > failed to mmap domU pages 0x200+0x2e3 [xenctl, rc=-1]\n'' > > > > ''xm dmesg'' says: <G><1>mm.c:671:d0 Non-privileged (1) attempt > > to map I/O space 000df1ff > > Dom0 tried map DomU memory in order to load the kernel + other boot > info. This fails because you''ve only allocated IO pages to DomU. > > Cheers > Gr(z)egor(z)Live.in : Get your yourname@live.in email id today. Powered by Windows Live Hotmail. Check it out! _________________________________________________________________ 2000 Placements last year. Are You next ? Find out http://ss1.richmedia.in/recurl.asp?pid=499 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Grzegorz Miłoś
2008-Jun-30 12:52 UTC
Re: [Xen-users] Re: [Xen-devel] Xen - Guest memory allocation
> Yes, about the I/O pages, > my machine uses 36-bit physical addresses, > since PCI address are all 32-bit, Im facing difficulties in converting these > addresses into pages using maddr_to_page();The bit widths are not the (main) problem! I don''t think that patching populate_physmap is the right approach. You do need ''real'' memory to be assigned to DomU. You can then allow DomU to use specific ranges of IO memory using XEN_DOMCTL_iomem_permission. Have a look how tools do it, when assigning a PCI device to a DomU: tools/python/xen/xend/server/pciif.py Cheers Gr(z)egor(z)> > So, I have to use a 64-bit PCI device. > > Thanks Milos, > Dinesh C > > >> Date: Sat, 28 Jun 2008 16:50:48 +0100 >> From: gm281@cam.ac.uk >> To: dinesh_chan8@hotmail.com >> Subject: Re: [Xen-users] Re: [Xen-devel] Xen - Guest memory allocation >> CC: xen-devel@lists.xensource.com; xen-users@lists.xensource.com; >> derek.murray@cl.cam.ac.uk >> >> > Hi, >> > >> > if I use the following inside the populate_physmap() inside >> > xen/common/memory.c, >> > >> > unsigned long maddr_pci = 0xdf000000; //since I know the machine >> > address of the mememory behind my pci device <xm dmesg> >> > >> > static void populate_physmap(struct memop_args *a) >> > { >> > /****** >> > >> > for(i=a->nr_done; i<a->nr_extents; i++) >> > { >> > /************* >> > &nb sp; if(d->is_privilaged) >> > >> > page = alloc_domheap_pages(d, a->extent_order, a->memflags | >> > MEMF_node(node)); >> > else >> > { >> > page = maddr_to_page(maddr_pci); >> >> This is going to assign DomU IO pages _only_. >> >> > maddr_pci = ((maddr + PAGE_SIZE-1) &PAGE_MASK); >> >> What is maddr here? Did you mean maddr_pci? Also, (page_aligned_x + >> PAGE_SIZE - 1) & PAGE_MASK = page_aligned_x, in other words you are >> stuck on the same page. >> >> > >> > `   ; } >> > /*************** >> > } >> > printk(''a->nr_done: %lx'', a->nr_done); >> > } >> > >> > The printk says ''a->nr_done: 2000'' when ''xm dmesg'' is used (which is >> > correct >> > since I allocated 32MB for DomU = 8192 pages = 0x2000) >> > >> > but exits with the following error: >> > >> > & n bsp; ''dmesg'' says : Using config file >> > ''/home/guest/Guest.conf''. >> > Error: (1, ''Internal error'', ''xc_dom_boot_domU_map: >> > failed to mmap domU pages 0x200+0x2e3 [xenctl, rc=-1]\n'' >> > >> > ''xm dmesg'' says: <G><1>mm.c:671:d0 Non-privileged (1) attempt >> > to map I/O space 000df1ff >> >> Dom0 tried map DomU memory in order to load the kernel + other boot >> info. This fails because you''ve only allocated IO pages to DomU. >> >> Cheers >> Gr(z)egor(z) > > ________________________________ > Live.in : Get your yourname@live.in email id today. Powered by Windows Live > Hotmail. Check it out! > > ________________________________ > WL Messenger : Stay connected to friends and family with the New Windows > Live Messenger. Get it now. Try it now! > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel > >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
dinesh chandrasekaran
2008-Jun-30 17:53 UTC
RE: [Xen-users] Re: [Xen-devel] Xen - Guest memory allocation
Thanks MIlos,This was really helpful.> You can then allow> DomU to use specific ranges of IO memory using> XEN_DOMCTL_iomem_permission. Have a look how tools do it, when> assigning a PCI device to a DomU:> tools/python/xen/xend/server/pciif.pyBut let the Dom0 take care of I/O pages for all DomUs (hope this is the default). I''m just trying for the making Memory pages and NOT I/O pages for all DomUs available from the my_pci address range using populate_physmap().> You do need ''real'' memory to be assigned to DomU.Yeah. That is the reason why I used maddr_to_page() macro; I assume that xen uses populate_physmap() to allocate ''real'' memory for all DomUs. Is my assumption wrong? Thanks, Dinesh C> Date: Mon, 30 Jun 2008 13:52:26 +0100 > From: gm281@cam.ac.uk > To: dinesh_chan8@hotmail.com > Subject: Re: [Xen-users] Re: [Xen-devel] Xen - Guest memory allocation > CC: xen-devel@lists.xensource.com; xen-users@lists.xensource.com > > > Yes, about the I/O pages, > > my machine uses 36-bit physical addresses, > > since PCI address are all 32-bit, Im facing difficulties in converting these > > addresses into pages using maddr_to_page(); > > The bit widths are not the (main) problem! > I don''t think that patching populate_physmap is the right approach. > You do need ''real'' memory to be assigned to DomU. You can then allow > DomU to use specific ranges of IO memory using > XEN_DOMCTL_iomem_permission. Have a look how tools do it, when > assigning a PCI device to a DomU: > tools/python/xen/xend/server/pciif.py > > > Cheers > Gr(z)egor(z) > > > > So, I have to use a 64-bit PCI device. > > > > Thanks Milos, > > Dinesh C > > > > > >> Date: Sat, 28 Jun 2008 16:50:48 +0100 > >> From: gm281@cam.ac.uk > >> To: dinesh_chan8@hotmail.com > >> Subject: Re: [Xen-users] Re: [Xen-devel] Xen - Guest memory allocation > >> CC: xen-devel@lists.xensource.com; xen-users@lists.xensource.com; > >> derek.murray@cl.cam.ac.uk > >> > >> > Hi, > >> > > >> > if I use the following inside the populate_physmap() inside > >> > xen/common/memory.c, > >> > > >> > unsigned long maddr_pci = 0xdf000000; //since I know the machine > >> > address of the mememory behind my pci device <xm dmesg> > >> > > >> > static void populate_physmap(struct memop_args *a) > >> > { > >> > /****** > >> > > >> > for(i=a->nr_done; i<a->nr_extents; i++) > >> > { > >> > /************* > >> > &nb sp; if(d->is_privilaged) > >> > > >> > page = alloc_domheap_pages(d, a->extent_order, a->memflags | > >> > MEMF_node(node)); > >> > else > >> > { > >> > page = maddr_to_page(maddr_pci); > >> > >> This is going to assign DomU IO pages _only_. > >> > >> > maddr_pci = ((maddr + PAGE_SIZE-1) &PAGE_MASK); > >> > >> What is maddr here? Did you mean maddr_pci? Also, (page_aligned_x + > >> PAGE_SIZE - 1) & PAGE_MASK = page_aligned_x, in other words you are > >> stuck on the same page. > >> > >> > > >> > `   ; } > >> > /*************** > >> > } > >> > printk(''a->nr_done: %lx'', a->nr_done); > >> > } > >> > > >> > The printk says ''a->nr_done: 2000'' when ''xm dmesg'' is used (which is > >> > correct > >> > since I allocated 32MB for DomU = 8192 pages = 0x2000) > >> > > >> > but exits with the following error: > >> > > >> > & n bsp; ''dmesg'' says : Using config file > >> > ''/home/guest/Guest.conf''. > >> > Error: (1, ''Internal error'', ''xc_dom_boot_domU_map: > >> > failed to mmap domU pages 0x200+0x2e3 [xenctl, rc=-1]\n'' > >> > > >> > ''xm dmesg'' says: <G><1>mm.c:671:d0 Non-privileged (1) attempt > >> > to map I/O space 000df1ff > >> > >> Dom0 tried map DomU memory in order to load the kernel + other boot > >> info. This fails because you''ve only allocated IO pages to DomU. > >> > >> Cheers > >> Gr(z)egor(z) > > > > ________________________________ > > Live.in : Get your yourname@live.in email id today. Powered by Windows Live > > Hotmail. Check it out! > > > > ________________________________ > > WL Messenger : Stay connected to friends and family with the New Windows > > Live Messenger. Get it now. Try it now! > > _______________________________________________ > > Xen-devel mailing list > > Xen-devel@lists.xensource.com > > http://lists.xensource.com/xen-devel > > > >_________________________________________________________________ No Harvard, No Oxford. We are here. Find out !! http://ss1.richmedia.in/recurl.asp?pid=500 _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
dinesh chandrasekaran
2008-Jun-30 21:22 UTC
RE: [Xen-users] Re: [Xen-devel] Xen - Guest memory allocation
Okay. But I want to use ''I/O pages: memory in the memory mapped IO regions obtained by reading the BAR value from the pci device'' as the ''real'' memory for all DomUs since I have 256MB behind that device.>From your reply,I should use populate_physmap() only if that memory is exported as E820_RAM i.e if DomUs are to be restricted to specific range of the RAM. And to use the addresses specified by the PCI BAR, I should use XEN_DOMCTL_iomem_permission. ''MEMORY'' in the memory mapped IO regions obtained by reading the BAR value of the pci device. But, wont this MEMORY be mapped to the actual RAM behind the CPU? How could I completely avoid the RAM behind CPU and use the PCI memory for all DomUs? Putting it simple, during boot-up process, __ __ _____ _____ _ _ _ \ \/ /___ _ __ |___ / |___ / _ _ _ __ ___| |_ __ _| |__ | | ___ \ // _ \ ''_ \ |_ \ |_ \ __| | | | ''_ \/ __| __/ _` | ''_ \| |/ _ \ / \ __/ | | | ___) | ___) |__| |_| | | | \__ \ || (_| | |_) | | __/ /_/\_\___|_| |_| |____(_)____/ \__,_|_| |_|___/\__\__,_|_.__/|_|\___| (XEN)Xen version 3.3-unstable (reddy@(none)) (gcc version 4.1.1 (Gentoo4.1.1-r3)) Sat May 31 00:05:56 Local time zone must be set--see zicmanual page 2008 (XEN) Latest ChangeSet: Fri May 30 19:31:18 2008 +0100 17760:6e688d5a936b (XEN) Command line: (XEN) Video information: (XEN) VGA is text mode 80x25, font 8x16 (XEN) VBE/DDC methods: V2; EDID transfer time: 2 seconds (XEN) Disc information: (XEN) Found 1 MBR signatures (XEN) Found 1 EDD information structures (XEN) Xen-e820 RAM map: (XEN) 0000000000000000 - 0000000000094400 (usable) (XEN) 0000000000094400 - 00000000000a0000 (reserved) (XEN) 00000000000c2000 - 0000000000100000 (reserved) (XEN) 0000000000100000 - 00000000cfe90000 (usable) (XEN) 00000000cfe90000 - 00000000cfea3000 (ACPI data) (XEN) 00000000cfea3000 - 00000000cff00000 (ACPI NVS) (XEN) 00000000cff00000 - 00000000d0000000 (reserved) (XEN) 00000000e0000000 - 00000000f0000000 (reserved) (XEN) 00000000fec00000 - 00000000fec00400 (reserved) (XEN) 00000000fee00000 - 00000000fee01000 (reserved) (XEN) 00000000fff80000 - 0000000100000000 (reserved) (XEN) 0000000100000000 - 0000000230000000 (usable) (XEN) 00000000d0000000 - 00000000dfffffff (PCI_usable) <this is the pci_device''s BAR value> Is this 256MB space from the RAM behind CPU? or is this the address exclusiveley given to the RAM behind PCI? Writing into this address will not require any re-mapping into CPU RAM? Thanks, Dinesh C> Date: Mon, 30 Jun 2008 21:54:36 +0100 > From: gm281@cam.ac.uk > To: dinesh_chan8@hotmail.com > Subject: Re: [Xen-users] Re: [Xen-devel] Xen - Guest memory allocation > > Here is a brief terminology overview, to clear up any naming confusion: > - I/O pages: memory in the memory mapped IO regions (a.k.a. IO memory) > - ''real'' memory: RAM > > > But let the Dom0 take care of I/O pages for all DomUs (hope this is the > > default). > > By default Dom0 is allowed to access any IO memory, and DomUs aren''t > allowed to access any IO memory. In your email from 20th June you > indicated that you want to allow DomUs to access certain IO memory > range. In my previous email I suggested to look at using > XEN_DOMCTL_iomem_permission to achieve that. You don''t need to change > populate_physmap to get that working I believe (I''m assuming PV domain > here). > > > I''m just trying for the making Memory pages and NOT I/O pages for all DomUs > > available from the my_pci address range > > using populate_physmap(). > > ?. Surely you either mean: RAM outside of my_pci range, or IO memory > from my_pci range. > > >> You do need ''real'' memory to be assigned to DomU. > > Yeah. That is the reason why I used maddr_to_page() macro; > > > > I assume that xen uses populate_physmap() to allocate ''real'' memory for all > > DomUs. > > Is my assumption wrong? > > Correct. populate_physmap() allocates RAM. > > Cheers > Gr(z)egor(z)_________________________________________________________________ Catch the latest fashion shows, get beauty tips and learn more on fashion and lifestyle. http://video.msn.com/?mkt=en-in _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
dinesh chandrasekaran
2009-Apr-21 23:29 UTC
RE: [Xen-users] Re: [Xen-devel] Xen - Guest memory allocation
Hi Milos, Now the domU have access to the MMIO region using iomem_permit_access(). It can read and write successfully to this region. But when I tried to allocate the region for booting up a domU, I get the following error Using config file "/home/domU_confs/Linux_VM1.conf". Error: (4, ''Out of memory'', "xc_dom_boot_mem_init: can''t allocate low memory for domain\n") the mem allocation code in /xen/common/memory.c is modified to be, if(d->is_privileged) { page = alloc_domheap_pages(d, a->extent_order, a->memflags); mfn = page_to_mfn(page); } else { mfn = maddr_to_mfn(mem_start); mem_start += PAGE_SIZE; } where mem_start is the MMIO starting address (0x90000000).>However, you''ll > have to teach the domain build tools to recognise the difference > between RAM and MMIO (it might be as simple as patching > direct_remap_pfn_range in linux kernel to use DOMID_IO)By this do you mean that I should modify the Dom0 kernel. Correct me I am wrong (I guess it is the domU kernel). regards, Dinesh C> Date: Tue, 1 Jul 2008 10:46:12 +0100 > From: > To: dinesh_chan8@hotmail.com > Subject: Re: [Xen-users] Re: [Xen-devel] Xen - Guest memory allocation > > > Okay. > > But I want to use ''I/O pages: memory in the memory mapped IO > > regions obtained by reading the BAR value from the pci device'' > > as the ''real'' memory for all DomUs since I have 256MB behind that device. > > The problem you''ll have to face is the ownership model that Xen uses. > By default when RAM is allocated to a domain it is only accessible to > the domain itself + Dom0 (via foreign mapping mechanism). All non-RAM > ranges are allocated to a synthetic domain called dom_io. Any > pagetables that reference this memory are verified against the > permitted iomem range (look iomem_access_permitted()). By default > Dom0''s access is permitted, so you are fine there. However, you''ll > have to teach the domain build tools to recognise the difference > between RAM and MMIO (it might be as simple as patching > direct_remap_pfn_range in linux kernel to use DOMID_IO). Also, another > concern I''d have, is if the CPU will be happy to use MMIO for code and > stack segments. I don''t know enough about that to answer. > > CHeers > Gr(z)egor(z)_________________________________________________________________ Windows Live Messenger. Multitasking at its finest. http://www.microsoft.com/india/windows/windowslive/messenger.aspx _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel