From: dinesh chandrasekaran Subject: RE: Re: [Xen-devel] Xen - Guest memory allocation Date: Mon, 30 Jun 2008 23:23:17 +0530 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1242698838==" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-users-bounces@lists.xensource.com Errors-To: xen-users-bounces@lists.xensource.com To: =?iso-8859-2?Q?Grzegorz_Mi=B3o=B6?= , xen developers community , xen users community List-Id: xen-devel@lists.xenproject.org --===============1242698838== Content-Type: multipart/alternative; boundary="_416ecfb7-4b0a-4220-85ed-58fa042d8f0e_" --_416ecfb7-4b0a-4220-85ed-58fa042d8f0e_ Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable Thanks MIlos,This was really helpful.=20 =20 > You can then allow> DomU to use specific ranges of IO memory using> XEN_D= OMCTL_iomem_permission. Have a look how tools do it, when> assigning a PCI = device to a DomU:> tools/python/xen/xend/server/pciif.py But let the Dom0 take care of I/O pages for all DomUs (hope this is the def= ault). I'm just trying for the making Memory pages and NOT I/O pages for all DomUs= available from the my_pci address range=20 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 al= l 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 >=20 > > 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(); >=20 > 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 >=20 >=20 > 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 =3D 0xdf000000; //since I know the machine > >> > address of the mememory behind my pci device > >> > > >> > static void populate_physmap(struct memop_args *a) > >> > { > >> > /****** > >> > > >> > for(i=3Da->nr_done; inr_extents; i++) > >> > { > >> > /************* > >> > &nb sp; if(d->is_privilaged) > >> > > >> > page =3D alloc_domheap_pages(d, a->extent_order, a->memflags | > >> > MEMF_node(node)); > >> > else > >> > { > >> > page =3D maddr_to_page(maddr_pci); > >> > >> This is going to assign DomU IO pages _only_. > >> > >> > maddr_pci =3D ((maddr + PAGE_SIZE-1) &PAGE_MASK); > >> > >> What is maddr here? Did you mean maddr_pci? Also, (page_aligned_x + > >> PAGE_SIZE - 1) & PAGE_MASK =3D 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 =3D 8192 pages =3D 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=3D-1]\n' > >> > > >> > 'xm dmesg' says: <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 Window= s > > 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=3D500= --_416ecfb7-4b0a-4220-85ed-58fa042d8f0e_ Content-Type: text/html; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable Thanks MIlos,This was really helpful.
 &= nbsp;           &nbs= p;            &= nbsp;  
> You can then= allow
> DomU to use specific ranges of IO memory using
> XEN_DOMCT= L_iomem_permission. Have a look how tools do it, when
> assigning a PCI= device to a DomU:
> tools/python/xen/xend/server/pciif.py

But let the Dom0 take care of I/O pages for all DomUs (hope this is the de= fault).
I'm just trying for the making > 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 w= rong?

Thanks,
Dinesh C

> Date: Mon, 30 Jun 2008 13:52:2= 6 +0100
> From: gm281@cam.ac.uk
> To: dinesh_chan8@hotmail.com<= br>> Subject: Re: [Xen-users] Re: [Xen-devel] Xen - Guest memory allocat= ion
> CC: xen-devel@lists.xensource.com; xen-users@lists.xensource.co= m
>
> > Yes, about the I/O pages,
> > my machine u= ses 36-bit physical addresses,
> > since PCI address are all 32-bi= t, Im facing difficulties in converting these
> > addresses into p= ages using maddr_to_page();
>
> The bit widths are not the (ma= in) problem!
> I don't think that patching populate_physmap is the ri= ght approach.
> You do need 'real' memory to be assigned to DomU. You= can then allow
> DomU to use specific ranges of IO memory using
&= gt; XEN_DOMCTL_iomem_permission. Have a look how tools do it, when
> = assigning a PCI device to a DomU:
> tools/python/xen/xend/server/pcii= f.py
>
>
> Cheers
> Gr(z)egor(z)
> >
= > > So, I have to use a 64-bit PCI device.
> >
> > = Thanks Milos,
> > Dinesh C
> >
> >
> >&= gt; Date: Sat, 28 Jun 2008 16:50:48 +0100
> >> From: gm281@cam.= ac.uk
> >> To: dinesh_chan8@hotmail.com
> >> Subjec= t: Re: [Xen-users] Re: [Xen-devel] Xen - Guest memory allocation
> &g= t;> 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/memo= ry.c,
> >> >
> >> > unsigned long maddr_pci = =3D 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=3Da->nr_done; i<a->nr_extents; i++)
&= gt; >> > {
> >> > /*************
> >> &= gt; &nb sp; if(d->is_privilaged)
> >> >
> >&= gt; > page =3D alloc_domheap_pages(d, a->extent_order, a->memflags= |
> >> > MEMF_node(node));
> >> > else
&g= t; >> > {
> >> > page =3D maddr_to_page(maddr_pci);=
> >>
> >> This is going to assign DomU IO pages _o= nly_.
> >>
> >> > maddr_pci =3D ((maddr + PAGE_S= IZE-1) &PAGE_MASK);
> >>
> >> What is maddr her= e? Did you mean maddr_pci? Also, (page_aligned_x +
> >> PAGE_SI= ZE - 1) & PAGE_MASK =3D page_aligned_x, in other words you are
> = >> stuck on the same page.
> >>
> >> >
= > >> > ` &nbsp ; }
> >> > /***************> >> > }
> >> > printk('a->nr_done: %lx', a= ->nr_done);
> >> > }
> >> >
> >&g= t; > The printk says 'a->nr_done: 2000' when 'xm dmesg' is used (whic= h is
> >> > correct
> >> > since I allocated = 32MB for DomU =3D 8192 pages =3D 0x2000)
> >> >
> >= > > but exits with the following error:
> >> >
>= >> > & n bsp; 'dmesg' says : Using config file
> >&g= t; > '/home/guest/Guest.conf'.
> >> > Error: (1, 'Interna= l error', 'xc_dom_boot_domU_map:
> >> > failed to mmap domU = pages 0x200+0x2e3 [xenctl, rc=3D-1]\n'
> >> >
> >&g= t; > 'xm dmesg' says: <G><1>mm.c:671:d0 Non-privileged (1) a= ttempt
> >> > to map I/O space 000df1ff
> >>
= > >> Dom0 tried map DomU memory in order to load the kernel + othe= r boot
> >> info. This fails because you've only allocated IO p= ages to DomU.
> >>
> >> Cheers
> >> Gr(= z)egor(z)
> >
> > ________________________________
>= ; > Live.in : Get your yourname@live.in email id today. Powered by Windo= ws Live
> > Hotmail. Check it out!
> >
> > _____= ___________________________
> > WL Messenger : Stay connected to f= riends and family with the New Windows
> > Live Messenger. Get it = now. Try it now!
> > _____________________________________________= __
> > Xen-devel mailing list
> > Xen-devel@lists.xensour= ce.com
> > http://lists.xensource.com/xen-devel
> >
&g= t; >


CoolHotmail : Your crazy personality deserves a uniq= ue email identity like yourname@iamcrazy.in. Choose from this and hundreds = other unique email ids now Try it! = --_416ecfb7-4b0a-4220-85ed-58fa042d8f0e_-- --===============1242698838== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users --===============1242698838==--