linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Jon Derrick <jonathan.derrick@intel.com>
Cc: keith.busch@intel.com, linux-pci@vger.kernel.org
Subject: Re: [PATCH] PCI/AER: Move the error info struct into the root port container
Date: Tue, 27 Sep 2016 15:45:10 -0500	[thread overview]
Message-ID: <20160927204510.GA20252@localhost> (raw)
In-Reply-To: <1473871135-29088-1-git-send-email-jonathan.derrick@intel.com>

On Wed, Sep 14, 2016 at 10:38:55AM -0600, Jon Derrick wrote:
> AER injecting tests with many devices and nosourceid are resulting in
> soft lockups, mostly due to the config reads (which have been helped
> by recent aer capability position caching patches), but also due to a
> superfluous kmalloc/kfree pair executed for each p_device.
> 
> When a device emits an error notification, it's not unreasonable to
> assume that it may emit another error notification soon. Instead of
> kmallocing and kfreeing the aer_err_info struct for each p_device during
> an aer_isr pass, move the struct into the aer root port container and
> kill the allocation.
> 
> The current code suggests the aer_err_info struct could be huge, but is
> actually only about 70 bytes. Whereas the aer_rpc root port container is
> over 900 bytes. Because of the already large size of the root port
> container, moving the struct into it should not adversely impact access
> to the root port container.
> 
> Suggested-by: Bjorn Helgaas <helgaas@kernel.org>
> Signed-off-by: Jon Derrick <jonathan.derrick@intel.com>

Applied to pci/aer for v4.9, thanks, Jon!

> ---
>  drivers/pci/pcie/aer/aerdrv.h      |  1 +
>  drivers/pci/pcie/aer/aerdrv_core.c | 13 ++-----------
>  2 files changed, 3 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/pci/pcie/aer/aerdrv.h b/drivers/pci/pcie/aer/aerdrv.h
> index f15ca8d..d51e4a5 100644
> --- a/drivers/pci/pcie/aer/aerdrv.h
> +++ b/drivers/pci/pcie/aer/aerdrv.h
> @@ -60,6 +60,7 @@ struct aer_rpc {
>  	struct pcie_device *rpd;	/* Root Port device */
>  	struct work_struct dpc_handler;
>  	struct aer_err_source e_sources[AER_ERROR_SOURCES_MAX];
> +	struct aer_err_info e_info;
>  	unsigned short prod_idx;	/* Error Producer Index */
>  	unsigned short cons_idx;	/* Error Consumer Index */
>  	int isr;
> diff --git a/drivers/pci/pcie/aer/aerdrv_core.c b/drivers/pci/pcie/aer/aerdrv_core.c
> index 8262527..9fd18a0 100644
> --- a/drivers/pci/pcie/aer/aerdrv_core.c
> +++ b/drivers/pci/pcie/aer/aerdrv_core.c
> @@ -711,15 +711,8 @@ static inline void aer_process_err_devices(struct pcie_device *p_device,
>  static void aer_isr_one_error(struct pcie_device *p_device,
>  		struct aer_err_source *e_src)
>  {
> -	struct aer_err_info *e_info;
> -
> -	/* struct aer_err_info might be big, so we allocate it with slab */
> -	e_info = kmalloc(sizeof(struct aer_err_info), GFP_KERNEL);
> -	if (!e_info) {
> -		dev_printk(KERN_DEBUG, &p_device->port->dev,
> -			"Can't allocate mem when processing AER errors\n");
> -		return;
> -	}
> +	struct aer_rpc *rpc = get_service_data(p_device);
> +	struct aer_err_info *e_info = &rpc->e_info;
>  
>  	/*
>  	 * There is a possibility that both correctable error and
> @@ -758,8 +751,6 @@ static void aer_isr_one_error(struct pcie_device *p_device,
>  		if (find_source_device(p_device->port, e_info))
>  			aer_process_err_devices(p_device, e_info);
>  	}
> -
> -	kfree(e_info);
>  }
>  
>  /**
> -- 
> 1.8.3.1
> 

      reply	other threads:[~2016-09-27 20:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-14 16:38 [PATCH] PCI/AER: Move the error info struct into the root port container Jon Derrick
2016-09-27 20:45 ` 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=20160927204510.GA20252@localhost \
    --to=helgaas@kernel.org \
    --cc=jonathan.derrick@intel.com \
    --cc=keith.busch@intel.com \
    --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 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).