qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Amos Kong <akong@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: kvm@vger.kernel.org, Marcelo Tosatti <mtosatti@redhat.com>,
	qemu-devel@nongnu.org, blauwirbel@gmail.com,
	yamahata@valinux.co.jp,
	Alex Williamson <alex.williamson@redhat.com>
Subject: Re: [Qemu-devel] About hotplug multifunction
Date: Tue, 13 Sep 2011 08:23:29 -0400 (EDT)	[thread overview]
Message-ID: <1117934480.646073.1315916609192.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com> (raw)
In-Reply-To: <20110912122458.GC12294@redhat.com>

Hi all,

After reading the pci driver code, I found a problem.

There is a list for each slot, (slot->funcs)
it will be inited in acpiphp_glue.c:register_slot() before hotpluging device,
and only one entry(func 0) will be added to it,
no new entry will be added to the list when hotpluging devices to the slot.

When we release the device, there are only _one_ entry in the list(slot->funcs).

acpiphp_glue.c:disable_device()
list_for_each_entry(func, &slot->funcs, sibling) {
    pdev = pci_get_slot(slot->bridge->pci_bus,
                        PCI_DEVFN(slot->device, func->function));
    ...release code...  // those code can only be executed one time (func 0)
    pci_remove_bus_device(pdev);
}

bus.c:pci_bus_add_device() is called for each func device in acpiphp_glue.c:enable_device().
bus.c:pci_remove_bus_device(pdev) is only called for func 0 in acpiphp_glue.c:disable_device().


Resolution: (I've tested it, success)
enumerate all the funcs when disable device.

list_for_each_entry(func, &slot->funcs, sibling) {
    for (i=0; i<8; i++) {
        pdev = pci_get_slot(slot->bridge->pci_bus,
                            PCI_DEVFN(slot->device, i));
        ...release code...
        pci_remove_bus_device(pdev);

    }
}

Thanks,
Amos

  reply	other threads:[~2011-09-13 12:23 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1749303074.590739.1315551830460.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com>
2011-09-09  7:08 ` [Qemu-devel] About hotplug multifunction Amos Kong
2011-09-09  7:32   ` Michael S. Tsirkin
2011-09-09 17:05     ` Alex Williamson
2011-09-09 18:34       ` Marcelo Tosatti
2011-09-11  9:23         ` Michael S. Tsirkin
2011-09-11 15:01           ` Marcelo Tosatti
2011-09-11 18:51             ` Michael S. Tsirkin
2011-09-12 10:21               ` Marcelo Tosatti
2011-09-12 10:56                 ` Marcelo Tosatti
2011-09-12 12:24                   ` Michael S. Tsirkin
2011-09-13 12:23                     ` Amos Kong [this message]
2011-09-13 14:24                       ` Amos Kong
2011-09-09 17:43   ` Isaku Yamahata
2011-09-11  9:05     ` Michael S. Tsirkin
2011-09-13  5:57       ` Isaku Yamahata
2011-09-13  6:52         ` Gleb Natapov
2011-09-13  7:00           ` Isaku Yamahata
2011-09-13 10:00           ` Michael S. Tsirkin
2011-09-13 10:05           ` Michael S. Tsirkin
2011-09-13 10:05             ` Gleb Natapov
2011-11-23  9:06   ` Amos Kong

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=1117934480.646073.1315916609192.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com \
    --to=akong@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=blauwirbel@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=yamahata@valinux.co.jp \
    /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).