All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: jbarnes@virtuousgeek.org, linux-pci@vger.kernel.org
Subject: pci_reset_function() being called from "bind" or "unbind"
Date: Wed, 4 Jan 2012 13:43:08 -0500	[thread overview]
Message-ID: <20120104184307.GA30359@phenom.dumpdata.com> (raw)


I am looking at implementing the FLR functionality in the xen-pciback driver and
found a mutex issue I am not entirely sure how to resolve.

In essence I am trying to call pci_reset_function() when a PCI device is
"attached" (using "bind") to the xen-pciback driver.

This means that when a user does:

 echo "0000:01.07.0" > /sys/bus/pci/drivers/pciback/bind

we end up calling:
  driver_bind:
    device_lock(dev);
    pcistub_probe:
       pcistub_seize:
         pcistub_init_device:
           .. pci_enable_device()
           --> want also to do pci_reset_function(), which calls
                 pci_dev_reset(dev, 0):
			if (!0) {
				device_lock(dev) <==== DEADLOCK

           .. pci_disable_device()

So looking at the code I saw __pci_reset_function which I thought
would do the same as pci_reset_function but without locking.
However, it is actually the opposite - it is with the locking.

My thought is that one way to resolve this is by wrapping
pci_probe_reset_function with a EXPORT_SYMBOL_GPL and use that
instead. Or perhaps have a new function called
"pci_reset_function_locked" ?

Thoughts?

             reply	other threads:[~2012-01-04 18:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-04 18:43 Konrad Rzeszutek Wilk [this message]
2012-01-04 19:04 ` pci_reset_function() being called from "bind" or "unbind" Konrad Rzeszutek Wilk

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=20120104184307.GA30359@phenom.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=jbarnes@virtuousgeek.org \
    --cc=linux-pci@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 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.