Skip to contentSkip to conversation

Xen - Guest memory allocation

Xen-users dinesh chandrasekaran 1 participant 1 message Jul 8, 2008

lore
Share & tools
lore
#0 lore raw

Thank you Milos.

In /xen/arch/x86/mm.c I modified the following snippet./* First 1MB of RAM is historically marked as I/O : for ( i = 0; i < 0x100; i++ ) share_xen_page_with_guest(mfn_to_page(i), dom_io, XENSHARE_writable); /* Any areas not specified as RAM by the e820 map are considered I/O. */ for ( i = 0, pfn = 0; pfn < max_page; i++ ) { while ( (i < e820.nr_map) && (e820.map[i].type != E820_RAM) && (e820.map[i].type != E820_UNUSABLE) && (e820.map[i].type != E820_MY_PCI))

Then this region will not be marked I/O and I can thereby use populate_physmap() instead of iomem_access_permitted().Regions other than E820_RAM, E820_UNUSABLE, E820_MY_PCI will thus belong to DOMID_IO and will require I/O permissions to be mapped by DomUs.Is this perspective fine?

Thanks,
Dinesh C

Quoted 23 lines

Date: Tue, 1 Jul 2008 10:46:12 +0100
From: [email protected]
To: [email protected]
Subject: Re: [Xen-users] Re: [Xen-devel] Xen - Guest memory allocation

Quoted 4 lines

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.

Quoted 2 lines

CHeers
Gr(z)egor(z)

Take the quiz. Crack your personality type. Get individualized suggestions for email ids that suit your personality.Log on to www.coolhotmail.com/personality.html Try it now!
_________________________________________________________________
Wish to Marry Now? Click Here to Register FREE
http://www.shaadi.com/registration/user/index.php?ptnr=mhottag

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel