linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Govindarajulu Varadarajan <gvaradar@cisco.com>
Cc: Christoph Hellwig <hch@lst.de>,
	benve@cisco.com, bhelgaas@google.com, linux-pci@vger.kernel.org,
	linux-kernel@vger.kernel.org, jlbec@evilplan.org,
	mingo@redhat.com, peterz@infradead.org, okaya@codeaurora.org
Subject: Re: [PATCH V2] PCI: AER: fix deadlock in do_recovery
Date: Tue, 3 Oct 2017 10:09:54 +0200	[thread overview]
Message-ID: <20171003080954.GA19637@lst.de> (raw)
In-Reply-To: <alpine.LNX.2.20.1710021606440.30867@cae-iprp-alln-lb.cisco.com>

On Mon, Oct 02, 2017 at 05:14:09PM -0700, Govindarajulu Varadarajan wrote:
>
> I would avoid increasing the size of pci_dev. The list_head would be empty after
> we call aer_pci_walk_bus(). We already have pci_bus *subordinate to link all the
> 'device's. Making list_head available to others would require a lock. I would
> avoid that.

It does not require a new lock if you clearly document the concurrency
semantics.  And I'd much rather add a hlist_node (which should be enough
if we want to be small) to pci_dev than requiring these additional
memory allocations and boiler plate code in an error recovery situation.

>
>>> +static void aer_pci_walk_bus(struct pci_bus *top,
>>> +			     int (*cb)(struct pci_dev *, void *),
>>> +			     struct aer_broadcast_data *result)
>>> +{
>>> +	HLIST_HEAD(dev_hlist);
>>> +	struct hlist_node *tmp;
>>> +	struct aer_device_list *entry;
>>
>> Do we want to offer this as generic PCIe functionality?  If not we can
>> probably hardcode the callback and callback data to simplify this a lot.
>>
>
> I could not find any other code which aquires device_lock in pci_walk_bus cb
> function. Can you tell me how we can hardcore callback and callback data here?

The word is hardcode.  If you follow the above suggestion we won't
really need the aer_pci_walk_bus helper but could just open code most
of the code.  Or maybe just keep passing the cb for simplicity - it
was just extending on the above idea.

  reply	other threads:[~2017-10-03  8:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-30  5:49 [PATCH V2] PCI: AER: fix deadlock in do_recovery Govindarajulu Varadarajan
2017-09-30 13:31 ` Sinan Kaya
2017-10-03  0:19   ` Govindarajulu Varadarajan
2017-10-01  7:55 ` Christoph Hellwig
2017-10-03  0:14   ` Govindarajulu Varadarajan
2017-10-03  8:09     ` Christoph Hellwig [this message]
2017-10-03 21:15 ` Bjorn Helgaas
2017-10-05 15:05   ` Wei Yang
2017-10-05 18:42     ` Bjorn Helgaas
2017-10-06  1:11       ` Wei Yang

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=20171003080954.GA19637@lst.de \
    --to=hch@lst.de \
    --cc=benve@cisco.com \
    --cc=bhelgaas@google.com \
    --cc=gvaradar@cisco.com \
    --cc=jlbec@evilplan.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=okaya@codeaurora.org \
    --cc=peterz@infradead.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).