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.
Quoted 1 line
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
Quoted 30 lines
Date: Mon, 30 Jun 2008 21:54:36 +0100
From: [email protected]
To: [email protected]
Subject: Re: [Xen-users] Re: [Xen-devel] Xen - Guest memory allocationHere 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: RAMQuoted 2 lines
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_permissionto achieve that. You don't need to changepopulate_physmapto get that working I believe (I'm assuming PV domain here).Quoted 3 lines
I'm just trying for the making Memory pages and NOT I/O pages for all DomUs available from the
my_pciaddress range
usingpopulate_physmap().?. Surely you either mean: RAM outside of
my_pcirange, or IO memory frommy_pcirange.Quoted 3 lines
Quoted 1 line
You do need 'real' memory to be assigned to DomU.
Yeah. That is the reason why I used
maddr_to_page()macro;
Quoted 8 lines
Quoted 3 lines
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
[email protected]
http://lists.xensource.com/xen-devel
A message that is not in the archive (sent off-list or not yet received): [email protected]
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).
Quoted 4 lines
However, you'll
have to teach the domain build tools to recognise the difference between RAM and MMIO (it might be as simple as patchingdirect_remap_pfn_rangein linux kernel to useDOMID_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
Quoted 23 lines
Date: Tue, 1 Jul 2008 10:46:12 +0100
From:
To: [email protected]
Subject: Re: [Xen-users] Re: [Xen-devel] Xen - Guest memory allocationQuoted 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 (lookiomem_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 patchingdirect_remap_pfn_rangein linux kernel to useDOMID_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)
_________________________________________________________________
Windows Live Messenger. Multitasking at its finest.
http://www.microsoft.com/india/windows/windowslive/messenger.aspx
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel