All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Keith Busch <keith.busch@intel.com>
Cc: Linux PCI <linux-pci@vger.kernel.org>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Stephen Rothwell <sfr@canb.auug.org.au>
Subject: Re: [PATCH] PCI: Fix bus error reset when CONFIG_SYSFS not set
Date: Wed, 26 Sep 2018 14:24:19 -0500	[thread overview]
Message-ID: <20180926192419.GB28024@bhelgaas-glaptop.roam.corp.google.com> (raw)
In-Reply-To: <20180926152326.14821-1-keith.busch@intel.com>

On Wed, Sep 26, 2018 at 09:23:26AM -0600, Keith Busch wrote:
> The pci slot component is not compiled if the kernel config does not
> set CONFIG_SYSFS, but a previous commit used a lock symbol from there
> without considering when it isn't defined.
> 
> This patch fixes that by moving the mutex definition to a context outside
> CONFIG_SYSFS. This also made it obvious the implementation missed going
> to the fallback when there were no bus slots, so this is also fixed.
> 
> Fixes: 131b0ca2c7b263fd ("PCI/ERR: Use slot reset if available")
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Signed-off-by: Keith Busch <keith.busch@intel.com>

Folded into 131b0ca2c7b263fd ("PCI/ERR: Use slot reset if available")
since it hasn't been merged upstream yet, thanks!  This on pci/hotplug,
headed for v4.20.

> ---
>  drivers/pci/pci.c  | 24 ++++++++++++++----------
>  drivers/pci/slot.c |  1 -
>  2 files changed, 14 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 2b4117011313..f6104a551b60 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -35,6 +35,8 @@
>  #include <linux/aer.h>
>  #include "pci.h"
>  
> +DEFINE_MUTEX(pci_slot_mutex);
> +
>  const char *pci_power_names[] = {
>  	"error", "D0", "D1", "D2", "D3hot", "D3cold", "unknown",
>  };
> @@ -5201,21 +5203,23 @@ static int pci_bus_reset(struct pci_bus *bus, int probe)
>  int pci_bus_error_reset(struct pci_dev *bridge)
>  {
>  	struct pci_bus *bus = bridge->subordinate;
> +	struct pci_slot *slot;
>  
>  	if (!bus)
>  		return -ENOTTY;
>  
>  	mutex_lock(&pci_slot_mutex);
> -	if (!list_empty(&bus->slots)) {
> -		struct pci_slot *slot;
> -
> -		list_for_each_entry(slot, &bus->slots, list)
> -			if (pci_probe_reset_slot(slot))
> -				goto bus_reset;
> -		list_for_each_entry(slot, &bus->slots, list)
> -			if (pci_slot_reset(slot, 0))
> -				goto bus_reset;
> -	}
> +	if (list_empty(&bus->slots))
> +		goto bus_reset;
> +
> +	list_for_each_entry(slot, &bus->slots, list)
> +		if (pci_probe_reset_slot(slot))
> +			goto bus_reset;
> +
> +	list_for_each_entry(slot, &bus->slots, list)
> +		if (pci_slot_reset(slot, 0))
> +			goto bus_reset;
> +
>  	mutex_unlock(&pci_slot_mutex);
>  	return 0;
>  bus_reset:
> diff --git a/drivers/pci/slot.c b/drivers/pci/slot.c
> index 3da03fcc6fbf..c46d5e1ff536 100644
> --- a/drivers/pci/slot.c
> +++ b/drivers/pci/slot.c
> @@ -14,7 +14,6 @@
>  
>  struct kset *pci_slots_kset;
>  EXPORT_SYMBOL_GPL(pci_slots_kset);
> -DEFINE_MUTEX(pci_slot_mutex);
>  
>  static ssize_t pci_slot_attr_show(struct kobject *kobj,
>  					struct attribute *attr, char *buf)
> -- 
> 2.14.4
> 

      reply	other threads:[~2018-09-26 19:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-26 15:23 [PATCH] PCI: Fix bus error reset when CONFIG_SYSFS not set Keith Busch
2018-09-26 19:24 ` Bjorn Helgaas [this message]

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=20180926192419.GB28024@bhelgaas-glaptop.roam.corp.google.com \
    --to=helgaas@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=keith.busch@intel.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    /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.