This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


[Xen-devel] Assigning contiguous memory to a driver domain

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] Assigning contiguous memory to a driver domain
From: Rafal Wojtczuk <rafal@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 14 Sep 2010 11:24:39 +0200
Delivery-date: Tue, 14 Sep 2010 02:28:50 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.20 (2009-12-10)

Could someone guide me in the right direction with the topic of assigning
contiguous memory to a domain.

I have an issue with a PV domain that is assigned a PCI device. Sometimes, the 
driver fails to load
Sep 13 10:36:43 localhost kernel: [  103.651858] iwlagn 0000:00:01.0:
firmware: requesting iwlwifi-4965-2.ucode
Sep 13 10:36:43 localhost kernel: [  103.669105] iwlagn 0000:00:01.0: loaded
firmware version
Sep 13 10:36:43 localhost kernel: [  103.669263] iwlagn 0000:00:01.0: failed
to allocate pci memory

The reason seems to be that the domain does not have enough contiguous
memory, in mfn terms.

Increasing the memory for the domain does not seem to help, unless one
assigns a significant fraction of all system RAM.

I am aware of xen-swiotlb
however these patches do not apply to the kernel being used
(http://qubes-os.org/gitweb/?p=joanna/kernel-dom0.git;a=summary), so I am
looking for something else.

Is it correct that Xen 3.4.3 makes no effort to assign contiguous memory to
a domain ? The arch_setup_meminit function (is it the one responsible for
initial memory allocation ?) does

715     /* allocate guest memory */
716     for ( i = rc = allocsz = 0; (i < dom->total_pages) && !rc; i += allocsz 
717     {
718         allocsz = dom->total_pages - i;
719         if ( allocsz > 1024*1024 )
720             allocsz = 1024*1024;  
721         rc = xc_domain_memory_populate_physmap(
722             dom->guest_xc, dom->guest_domid, allocsz, 0, 0, 
723     }
so, it calls xc_domain_memory_populate_physmap with the fourth parameter
(extent order) being 0, so potentially, there can be literally no contiguous
mfns in the domain ?

In practice, is it safe to assume that the following scenario:
1) boot dom0 with 4G of RAM
2) balolon dom0 down to 1.5G
3) create a PV driver domain (netvm) with, say, 200MB of RAM
will result in netvm having sufficiently contiguous memory ? It seems to
work for me.

Otherwise, does it make sense to add contiguous memory to a domain (via
calling xc_domain_memory_populate_physmap with larger extent_order) just
after domain creation (create the domain paused, and call it before
unpausing it) ? Is there anything else that needs to be done after
calling this function so that the guest is able to use this additional
memory ?

Rafal Wojtczuk

Xen-devel mailing list