All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rafal Wojtczuk <rafal@invisiblethingslab.com>
To: xen-devel@lists.xensource.com
Subject: Assigning contiguous memory to a driver domain
Date: Tue, 14 Sep 2010 11:24:39 +0200	[thread overview]
Message-ID: <20100914092439.GA1000@email> (raw)

Hello,

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 228.61.2.24
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
(http://groups.google.com/group/linux.kernel/browse_thread/thread/2840cb59bec23594),
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, &dom->p2m_host[i]);
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 ?

Regards,
Rafal Wojtczuk

             reply	other threads:[~2010-09-14  9:24 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-14  9:24 Rafal Wojtczuk [this message]
2010-09-14  9:36 ` Assigning contiguous memory to a driver domain Jan Beulich
2010-09-15  9:08   ` Rafal Wojtczuk
2010-09-15  9:39     ` Rafal Wojtczuk
2010-09-15  9:50       ` Jan Beulich
2010-09-15 10:42         ` Joanna Rutkowska
2010-09-15 10:59           ` Jan Beulich
2010-09-15 11:07             ` Joanna Rutkowska
2010-09-15 11:50               ` Jan Beulich
2010-09-15 11:58                 ` Goswin von Brederlow
2010-09-15 12:06                   ` Rafal Wojtczuk
2010-09-15 13:49                     ` Jan Beulich
2010-09-15 14:44                       ` Rafal Wojtczuk
2010-09-15 15:29                         ` Jan Beulich
2010-09-20 19:48                           ` Konrad Rzeszutek Wilk
2010-09-20 20:27                             ` Jeremy Fitzhardinge
2010-09-20 21:41                               ` Konrad Rzeszutek Wilk
2010-09-20 21:55                                 ` Jeremy Fitzhardinge
2010-09-20 23:42                                   ` Dan Magenheimer
2010-09-21  0:45                                     ` Jeremy Fitzhardinge
2010-09-21  8:04                                       ` Tim Deegan
2010-09-21 11:28                             ` Joanna Rutkowska
2010-09-21 14:34                               ` Konrad Rzeszutek Wilk
2010-09-15 19:25                     ` Goswin von Brederlow

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100914092439.GA1000@email \
    --to=rafal@invisiblethingslab.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.