kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gunnar Eggen <geggen54@gmail.com>
To: alex.williamson@redhat.com, kvm@vger.kernel.org,
	pbonzini@redhat.com, jeyu@kernel.org
Subject: KVM/VFIO passthrough not working when TRIM_UNUSED_KSYMS is enabled
Date: Sat, 4 Jul 2020 23:03:57 +0200	[thread overview]
Message-ID: <13e90f87-9062-a7e4-99c0-5c6f5c16cad2@gmail.com> (raw)

Hi,

It's a bit unclear what subsystem is to blame for this problem, so I'm 
sending this to both KVM, VFIO and Module support.

The problem is that trimming unused symbols in the kernel breaks VFIO 
passthrough on x86/amd64 at least. If the option TRIM_UNUSED_KSYMS is 
enabled you will see the following error when trying to start a VM in 
QEmu with any pcie device passed via VFIO:

qemu-system-x86_64: -device vfio-pci,host=04:00.0: Failed to add group 
25 to KVM VFIO device: Invalid argument

The error will not stop the VM from launching, but it will break things 
in mysterious ways when e.g. installing graphics drivers.
No external modules is involved in this, so I would guess that there is 
some dependency that the trimming is missing in some way.

With the introduction of UNUSED_KSYMS_WHITELIST in the latest kernels, 
and some talk about making trimming symbols the default in the future, 
it would be great if we could get this fixed or at least identify the 
problematic symbols so that they could be whitelisted if needed.

Steps to reproduce:

1 - Have a kernel where TRIM_UNUSED_KSYMS is enabled
2 - Start a VM in QEmu/KVM with a pcie device passed through via vfio-pci

This is a common issue that keeps popping up on user forums related to 
vfio passthrough, so it should be fairly simple to reproduce.

Let me know if you want more details or perhaps my kernel config or 
trimmed system map to test with.

Best regards,
Gunnar


             reply	other threads:[~2020-07-04 21:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-04 21:03 Gunnar Eggen [this message]
2020-07-05  5:44 ` KVM/VFIO passthrough not working when TRIM_UNUSED_KSYMS is enabled Paolo Bonzini
2020-07-05  8:58   ` Gunnar Eggen

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=13e90f87-9062-a7e4-99c0-5c6f5c16cad2@gmail.com \
    --to=geggen54@gmail.com \
    --cc=alex.williamson@redhat.com \
    --cc=jeyu@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.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 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).