qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Henning Schild <henning.schild@siemens.com>
To: libvir-list@redhat.com, libvirt-users@redhat.com,
	qemu-devel@nongnu.org, qemu-discuss@nongnu.org
Cc: Henning Schild <henning.schild@siemens.com>
Subject: [Qemu-devel] pci-assign fails with read error on config-space file
Date: Fri, 28 Oct 2016 13:28:19 +0200	[thread overview]
Message-ID: <20161028132819.6d6ee449@md1em3qc> (raw)

Hey,

i am running an unusual setup where i assign pci devices behind the
back of libvirt. I have two options to do that:
1. a wrapper script for qemu that takes care of suid-root and appends
arguments for pci-assign
2. virsh qemu-monitor-command ... 'device_add pci-assign...'

I know i should probably not be doing this, it is a workaround to
introduce fine-grained pci-assignment in an openstack setup, where
vendor and device id are not enough to pick the right device for a vm.

In both cases qemu will crash with the following output:

> qemu: hardware error: pci read failed, ret = 0 errno = 22

followed by the usual machine state dump. With strace i found it to be
a failing read on the config space file of my device.
/sys/bus/pci/devices/0000:xx:xx.x/config
A few reads out of that file succeeded, as well as accesses on vendor
etc.

Manually launching a qemu with the pci-assign works without a problem,
so i "blame" libvirt and the cgroup environment the qemu ends up in.
So i put a bash into the exact same cgroup setup - next to a running
qemu, expecting a dd or hexdump on the config-space file to fail. But
from that bash i can read the file without a problem.

Has anyone seen that problem before? Right now i do not know what i
am missing, maybe qemu is hitting some limits configured for the
cgroups or whatever. I can not use pci-assign from libvirt, but if i
did would it configure cgroups in a different way or relax some limits?

What would be a good next step to debug that? Right now i am looking at
kernel event traces, but the machine is pretty big and so is the trace.

That assignment used to work and i do not know how it broke, i have
tried combinations of several kernels, versions of libvirt and qemu.
(kernel 3.18 and 4.4, libvirt 1.3.2 and 2.0.0, and qemu 2.2.1 and 2.7)
All combinations show the same problem, even the ones that work on
other machines. So when it comes to software versions the problem could
well be caused by a software update of another component, that i
got with the package manager and did not compile myself. It is a debian
8.6 with all recent updates installed. My guess would be that systemd
could have an influence on cgroups or limits causing such a problem.

regards,
Henning

             reply	other threads:[~2016-10-28 11:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-28 11:28 Henning Schild [this message]
2016-10-28 15:22 ` [Qemu-devel] pci-assign fails with read error on config-space file Laszlo Ersek
2016-11-02  9:40   ` Henning Schild
2016-10-28 15:25 ` [Qemu-devel] [libvirt-users] " Laine Stump
2016-10-28 17:08   ` Alex Williamson
2016-11-02 10:34   ` Henning Schild
2016-11-02  9:54 ` [Qemu-devel] " Daniel P. Berrange
2016-11-02 11:45   ` Henning Schild

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=20161028132819.6d6ee449@md1em3qc \
    --to=henning.schild@siemens.com \
    --cc=libvir-list@redhat.com \
    --cc=libvirt-users@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-discuss@nongnu.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;
as well as URLs for NNTP newsgroup(s).