From: Sheng Yang <sheng@linux.intel.com>
To: kvm@vger.kernel.org
Cc: Casey Leedom <leedom@chelsio.com>
Subject: Re: KVM vs. PCI-E Function Level Reset (FLR) ...
Date: Wed, 14 Jul 2010 08:53:33 +0800 [thread overview]
Message-ID: <201007140853.33360.sheng@linux.intel.com> (raw)
In-Reply-To: <201007131341.01669.leedom@chelsio.com>
On Wednesday 14 July 2010 04:41:01 Casey Leedom wrote:
> I've ground my way through most of the Linux kernel code supporting KVM
> and "Device Assignment" but I haven't been able to untangle the path of
> when/where PCI-E Function Level Resets (FLRs) are applied and what happens
> if the Virtual Machine OS/Driver attempts to perform an FLR on the PCI
> Pass Through Device.
>
> It looks like the Linux KVM kernel support code issues an FLR against an
> Assigned Device when the device is assigned and when it's freed but it's
> not clear when those actions are taken. For instance, if a device is
> assigned to a VM and then the VM reboots itself, is that counted as
> another assignment point? I.e. will KVM issue a new pci_reset_function()
> on the device so it shows up reset in the newly rebooted VM?
The assignment/deassignment happened when guest was created/destroyed. Currently
it wouldn't issue a FLR when guest reset.
> And what happens if the VM OS/Driver attempts to write the PCI Pass
> Through Device's PCI-E FLR bit? I assume that that write (and the
> following polling reads) are trapped by the KVM code but I can't find the
> code which implements the PCI Configuration Space emulation to see if the
> FLR is implemented there. For instance, if I run Linux 2.6.30 in the VM
> and my Device Driver calls pci_reset_function() in its "probe()" function
> will that result in a Device FLR? it doesn't appear to be the case ...
The PCI configuration space emulated is in QEmu rather than KVM. You can check
qemu-kvm/hw/device-assignment.c. We didn't emulate FLR capability now. (OK, some
other device specific reset method may involved, you can check pci_dev_reset())
> Note that it's impossible for a Device Driver to call
> pci_reset_function() under Linux 2.6.31 and later because a call to
> device_lock() was added to pci_dev_reset() in chageset 8e9394ce on Feb 17,
> 2010 by Greg Kroah-Hartman. This means that a call to
> pci_reset_function() in a device driver's "probe()" routine will result in
> an immediate deadlock.
What I saw the code is like this:
static int pci_dev_reset(struct pci_dev *dev, int probe)
{
int rc;
might_sleep();
if (!probe) {
pci_block_user_cfg_access(dev);
/* block PM suspend, driver probe, etc. */
device_lock(&dev->dev);
}
[...]
So seems it's fine with _probe_ set, to use with probe() routine.
--
regards
Yang, Sheng
>
> Thanks for any help and/or insight into these questions!
>
> Casey
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2010-07-14 0:54 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-13 20:41 KVM vs. PCI-E Function Level Reset (FLR) Casey Leedom
2010-07-14 0:53 ` Sheng Yang [this message]
2010-07-14 18:01 ` Casey Leedom
2010-07-15 1:31 ` Sheng Yang
[not found] ` <201007150839.37130.leedom@chelsio.com>
2010-07-15 16:06 ` Casey Leedom
2010-07-16 0:56 ` Sheng Yang
2010-07-16 0:56 ` [Qemu-devel] " Sheng Yang
2010-07-16 17:29 ` Casey Leedom
2010-07-16 17:29 ` [Qemu-devel] " Casey Leedom
[not found] <201007150033.o6F0XUBj024880@stargate.chelsio.com>
2010-07-15 0:55 ` Casey Leedom
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=201007140853.33360.sheng@linux.intel.com \
--to=sheng@linux.intel.com \
--cc=kvm@vger.kernel.org \
--cc=leedom@chelsio.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.