public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: Andreas Hartmann <andihartmann@01019freenet.de>
Cc: KVM <kvm@vger.kernel.org>
Subject: Re: vfio problem
Date: Fri, 08 Jun 2012 12:17:26 -0600	[thread overview]
Message-ID: <1339179446.26976.120.camel@ul30vt> (raw)
In-Reply-To: <4FD238C3.8000505@01019freenet.de>

On Fri, 2012-06-08 at 19:39 +0200, Andreas Hartmann wrote:
> Andreas Hartmann wrote:
> > Hello Alex,
> > 
> > You can probably say, what this message on host side means:
> > 
> > kernel: [ 3902.124109] vfio_dma_do_map: RLIMIT_MEMLOCK (65536) exceeded
> > 
> > The WLAN card in the VM doesn't work any more. It came up after a few
> > times of restarting the VM (with unbinding / rebinding - procedures).
> > 
> > I'll see if it is reproducible. I had to reboot to get it working again.
> 
> It is reproducible. And id seems not to be a problem of binding /
> unbinding, but the fact of not starting it as root user seems to be the
> problem.
> 
> I never saw these problems with a root VM (and root does have the same
> value for ulimit -l).

Yes, this is expected when running as non-root.  VFIO needs to lock
pages on behalf of the user, so the user needs limits granted to be able
to do that.  Otherwise a VFIO user could lock down all the memory in the
system.

> - Is it possible to run the VM / VFIO in user context?

Yes, this is one of the key design requirements of VFIO.
Pre-requirements are that a privileged entity has sequestered all the
devices as being owned by vfio-pci or pci-stub, the user has permissions
to /dev/vfio/<group#> and /dev/vfio/vfio (the latter is expected to be
safe to leave as 0666), and the user has limits set to lock pages
sufficient for what they need (note that the default of 64k might be
enough for some userspace driver applications).

> - What size should be used for ulimit -l?

It should be about the size of memory assigned to the guest.

Once we have libvirt support, all of this should be relatively
transparent as that will take care of the limits setting.  For now, it's
a bit of a pain running it as a normal user.  If you come up with an
easy way of doing it, please share.  Thanks,

Alex


  reply	other threads:[~2012-06-08 18:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-08 16:58 vfio problem Andreas Hartmann
2012-06-08 17:35 ` Alex Williamson
2012-06-09 13:42   ` Andreas Hartmann
2012-06-09 14:30     ` Alex Williamson
2012-06-09 15:58       ` Andreas Hartmann
2012-06-09 15:32     ` Andreas Hartmann
2012-06-08 17:39 ` Andreas Hartmann
2012-06-08 18:17   ` Alex Williamson [this message]
2012-06-08 19:43     ` Andreas Hartmann
2012-06-09  0:00     ` Andreas Hartmann
2012-06-09 14:09       ` Alex Williamson

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=1339179446.26976.120.camel@ul30vt \
    --to=alex.williamson@redhat.com \
    --cc=andihartmann@01019freenet.de \
    --cc=kvm@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox