All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Thumshirn <jthumshirn@suse.de>
To: rajinikanth.pandurangan@pmcs.com
Cc: jbottomley@parallels.com, linux-scsi@vger.kernel.org,
	aacraid@pmc-sierra.com, harry.yang@pmcs.com,
	mahesh.rajashekhara@pmcs.com, rich.bono@pmcs.com,
	achim.leubner@pmcs.com, murthy.bhat@pmcs.com
Subject: Re: [Patch V2 6/9] [SCSI] aacraid: Reset irq affinity hints before releasing irq
Date: Tue, 16 Jun 2015 13:40:17 +0200	[thread overview]
Message-ID: <20150616114017.GD2883@c203.arch.suse.de> (raw)
In-Reply-To: <1433986951-9033-8-git-send-email-rajinikanth.pandurangan@pmcs.com>

On Wed, Jun 10, 2015 at 06:42:28PM -0700, rajinikanth.pandurangan@pmcs.com wrote:
> From: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
> 
> Description:
>         Reset irq affinity hints before releasing IRQ
>         Removed duplicate code of IRQ acquire/release
> 
> Signed-off-by: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
> ---
>  drivers/scsi/aacraid/aacraid.h |   2 +
>  drivers/scsi/aacraid/commsup.c | 113 ++++++++++++++++++++++++++++++-----------
>  drivers/scsi/aacraid/src.c     |  48 ++---------------
>  3 files changed, 88 insertions(+), 75 deletions(-)
> 
> diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
> index e54f597..7b95227 100644
> --- a/drivers/scsi/aacraid/aacraid.h
> +++ b/drivers/scsi/aacraid/aacraid.h
> @@ -2110,6 +2110,8 @@ static inline unsigned int cap_to_cyls(sector_t capacity, unsigned divisor)
>  #define AAC_OWNER_ERROR_HANDLER	0x103
>  #define AAC_OWNER_FIRMWARE	0x106
>  
> +int aac_acquire_irq(struct aac_dev *dev);
> +void aac_free_irq(struct aac_dev *dev);
>  const char *aac_driverinfo(struct Scsi_Host *);
>  struct fib *aac_fib_alloc(struct aac_dev *dev);
>  int aac_fib_setup(struct aac_dev *dev);
> diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
> index 4da5749..a1f90fe 100644
> --- a/drivers/scsi/aacraid/commsup.c
> +++ b/drivers/scsi/aacraid/commsup.c
> @@ -1270,13 +1270,12 @@ retry_next:
>  static int _aac_reset_adapter(struct aac_dev *aac, int forced)
>  {
>  	int index, quirks;
> -	int retval, i;
> +	int retval;
>  	struct Scsi_Host *host;
>  	struct scsi_device *dev;
>  	struct scsi_cmnd *command;
>  	struct scsi_cmnd *command_list;
>  	int jafo = 0;
> -	int cpu;
>  
>  	/*
>  	 * Assumptions:
> @@ -1339,35 +1338,7 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced)
>  	aac->comm_phys = 0;
>  	kfree(aac->queues);
>  	aac->queues = NULL;
> -	cpu = cpumask_first(cpu_online_mask);
> -	if (aac->pdev->device == PMC_DEVICE_S6 ||
> -	    aac->pdev->device == PMC_DEVICE_S7 ||
> -	    aac->pdev->device == PMC_DEVICE_S8 ||
> -	    aac->pdev->device == PMC_DEVICE_S9) {
> -		if (aac->max_msix > 1) {
> -			for (i = 0; i < aac->max_msix; i++) {
> -				if (irq_set_affinity_hint(
> -				    aac->msixentry[i].vector,
> -				    NULL)) {
> -					printk(KERN_ERR "%s%d: Failed to reset IRQ affinity for cpu %d\n",
> -						aac->name,
> -						aac->id,
> -						cpu);
> -				}
> -				cpu = cpumask_next(cpu,
> -						cpu_online_mask);
> -				free_irq(aac->msixentry[i].vector,
> -					 &(aac->aac_msix[i]));
> -			}
> -			pci_disable_msix(aac->pdev);
> -		} else {
> -			free_irq(aac->pdev->irq, &(aac->aac_msix[0]));
> -		}
> -	} else {
> -		free_irq(aac->pdev->irq, aac);
> -	}
> -	if (aac->msi)
> -		pci_disable_msi(aac->pdev);
> +	aac_free_irq(aac);
>  	kfree(aac->fsa_dev);
>  	aac->fsa_dev = NULL;
>  	quirks = aac_get_driver_ident(index)->quirks;
> @@ -1978,3 +1949,83 @@ int aac_command_thread(void *data)
>  	dev->aif_thread = 0;
>  	return 0;
>  }
> +
> +int aac_acquire_irq(struct aac_dev *dev)
> +{
> +	int i;
> +	int j;
> +	int ret = 0;
> +	int cpu;
> +
> +	cpu = cpumask_first(cpu_online_mask);
> +	if (!dev->sync_mode && dev->msi_enabled && dev->max_msix > 1) {
> +		for (i = 0; i < dev->max_msix; i++) {
> +			dev->aac_msix[i].vector_no = i;
> +			dev->aac_msix[i].dev = dev;
> +			if (request_irq(dev->msixentry[i].vector,
> +					dev->a_ops.adapter_intr,
> +					0, "aacraid", &(dev->aac_msix[i]))) {
> +				printk(KERN_ERR "%s%d: Failed to register IRQ for vector %d.\n",
> +						dev->name, dev->id, i);
> +				for (j = 0 ; j < i ; j++)
> +					free_irq(dev->msixentry[j].vector,
> +						 &(dev->aac_msix[j]));
> +				pci_disable_msix(dev->pdev);
> +				ret = -1;
> +			}
> +			if (irq_set_affinity_hint(dev->msixentry[i].vector,
> +							get_cpu_mask(cpu))) {
> +				printk(KERN_ERR "%s%d: Failed to set IRQ affinity for cpu %d\n",
> +					    dev->name, dev->id, cpu);
> +			}
> +			cpu = cpumask_next(cpu, cpu_online_mask);
> +		}
> +	} else {
> +		dev->aac_msix[0].vector_no = 0;
> +		dev->aac_msix[0].dev = dev;
> +
> +		if (request_irq(dev->pdev->irq, dev->a_ops.adapter_intr,
> +			IRQF_SHARED, "aacraid",
> +			&(dev->aac_msix[0])) < 0) {
> +			if (dev->msi)
> +				pci_disable_msi(dev->pdev);
> +			printk(KERN_ERR "%s%d: Interrupt unavailable.\n",
> +					dev->name, dev->id);
> +			ret = -1;
> +		}
> +	}
> +	return ret;
> +}
> +
> +void aac_free_irq(struct aac_dev *dev)
> +{
> +	int i;
> +	int cpu;
> +
> +	cpu = cpumask_first(cpu_online_mask);
> +	if (dev->pdev->device == PMC_DEVICE_S6 ||
> +	    dev->pdev->device == PMC_DEVICE_S7 ||
> +	    dev->pdev->device == PMC_DEVICE_S8 ||
> +	    dev->pdev->device == PMC_DEVICE_S9) {
> +		if (dev->max_msix > 1) {
> +			for (i = 0; i < dev->max_msix; i++) {
> +				if (irq_set_affinity_hint(
> +					dev->msixentry[i].vector, NULL)) {
> +					printk(KERN_ERR "%s%d: Failed to reset IRQ affinity for cpu %d\n",
> +					    dev->name, dev->id, cpu);
> +				}
> +				cpu = cpumask_next(cpu, cpu_online_mask);
> +				free_irq(dev->msixentry[i].vector,
> +						&(dev->aac_msix[i]));
> +			}
> +		} else {
> +			free_irq(dev->pdev->irq, &(dev->aac_msix[0]));
> +		}
> +	} else {
> +		free_irq(dev->pdev->irq, dev);
> +	}
> +	if (dev->msi)
> +		pci_disable_msi(dev->pdev);
> +	else if (dev->max_msix > 1)
> +		pci_disable_msix(dev->pdev);
> +}
> diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c
> index 1409a0b..2aa34ea 100644
> --- a/drivers/scsi/aacraid/src.c
> +++ b/drivers/scsi/aacraid/src.c
> @@ -798,9 +798,7 @@ int aac_srcv_init(struct aac_dev *dev)
>  	unsigned long status;
>  	int restart = 0;
>  	int instance = dev->id;
> -	int i, j;
>  	const char *name = dev->name;
> -	int cpu;
>  
>  	dev->a_ops.adapter_ioremap = aac_srcv_ioremap;
>  	dev->a_ops.adapter_comm = aac_src_select_comm;
> @@ -918,48 +916,10 @@ int aac_srcv_init(struct aac_dev *dev)
>  		goto error_iounmap;
>  	if (dev->msi_enabled)
>  		aac_src_access_devreg(dev, AAC_ENABLE_MSIX);
> -	if (!dev->sync_mode && dev->msi_enabled && dev->max_msix > 1) {
> -		cpu = cpumask_first(cpu_online_mask);
> -		for (i = 0; i < dev->max_msix; i++) {
> -			dev->aac_msix[i].vector_no = i;
> -			dev->aac_msix[i].dev = dev;
> -
> -			if (request_irq(dev->msixentry[i].vector,
> -					dev->a_ops.adapter_intr,
> -					0,
> -					"aacraid",
> -					&(dev->aac_msix[i]))) {
> -				printk(KERN_ERR "%s%d: Failed to register IRQ for vector %d.\n",
> -						name, instance, i);
> -				for (j = 0 ; j < i ; j++)
> -					free_irq(dev->msixentry[j].vector,
> -						 &(dev->aac_msix[j]));
> -				pci_disable_msix(dev->pdev);
> -				goto error_iounmap;
> -			}
> -			if (irq_set_affinity_hint(
> -			   dev->msixentry[i].vector,
> -			   get_cpu_mask(cpu))) {
> -				printk(KERN_ERR "%s%d: Failed to set IRQ affinity for cpu %d\n",
> -						name, instance, cpu);
> -			}
> -			cpu = cpumask_next(cpu, cpu_online_mask);
> -		}
> -	} else {
> -		dev->aac_msix[0].vector_no = 0;
> -		dev->aac_msix[0].dev = dev;
> -
> -		if (request_irq(dev->pdev->irq, dev->a_ops.adapter_intr,
> -				IRQF_SHARED,
> -				"aacraid",
> -				&(dev->aac_msix[0])) < 0) {
> -			if (dev->msi)
> -				pci_disable_msi(dev->pdev);
> -			printk(KERN_ERR "%s%d: Interrupt unavailable.\n",
> -					name, instance);
> -			goto error_iounmap;
> -		}
> -	}
> +
> +	if (aac_acquire_irq(dev))
> +		goto error_iounmap;
> +
>  	dev->dbg_base = dev->base_start;
>  	dev->dbg_base_mapped = dev->base;
>  	dev->dbg_size = dev->base_size;
> -- 
> 1.9.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>

-- 
Johannes Thumshirn                                       Storage
jthumshirn@suse.de                             +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2015-06-16 11:40 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-11  1:42 [Patch V2 0/9] [SCSI] aacraid: Patchset for aacraid driver version 41010 rajinikanth.pandurangan
2015-06-11  1:42 ` rajinikanth.pandurangan
2015-06-11  1:42 ` [Patch V2 1/9] [SCSI] aacraid: Fix for logical device name and UID not exposed to the OS rajinikanth.pandurangan
2015-06-16 11:27   ` Johannes Thumshirn
2015-06-24  5:40   ` Mahesh Rajashekhara
2015-06-25 15:21   ` Tomas Henzl
2015-06-11  1:42 ` [Patch V2 2/9] [SCSI] aacraid: Add Power Management support rajinikanth.pandurangan
2015-06-24  5:40   ` Mahesh Rajashekhara
2015-06-25 15:42   ` Tomas Henzl
2015-06-25 16:54     ` Rajinikanth Pandurangan
2015-06-25 17:52       ` Tomas Henzl
2015-06-11  1:42 ` [Patch V2 3/9] [SCSI] aacraid: Enable MSI interrupt for series-6 controller rajinikanth.pandurangan
2015-06-16 11:33   ` Johannes Thumshirn
2015-06-24  5:40   ` Mahesh Rajashekhara
2015-06-25 16:01   ` Tomas Henzl
2015-06-11  1:42 ` [Patch V2 4/9] [SCSI] aacraid: Enable 64-bit write to controller register rajinikanth.pandurangan
2015-06-11 10:01   ` Johannes Thumshirn
2015-06-11 18:08     ` Rajinikanth Pandurangan
2015-06-24  5:41   ` Mahesh Rajashekhara
2015-06-25 16:03   ` Tomas Henzl
2015-06-11  1:42 ` [Patch V2 5/9] [SCSI] aacraid: Tune response path if IsFastPath bit set rajinikanth.pandurangan
2015-06-18 17:30   ` Rajinikanth Pandurangan
2015-06-24  5:41   ` Mahesh Rajashekhara
2015-06-25 18:05   ` Tomas Henzl
2015-06-11  1:42 ` [Patch V2 6/9] [SCSI] aacraid: Reset irq affinity hints before releasing irq rajinikanth.pandurangan
2015-06-16 11:40   ` Johannes Thumshirn [this message]
2015-06-24  5:41   ` Mahesh Rajashekhara
2015-06-11  1:42 ` [Patch V2 7/9] [SCSI] aacraid: Unblock IOCTLs to controller once system resumed from suspend rajinikanth.pandurangan
2015-06-16 11:41   ` Johannes Thumshirn
2015-06-24  5:41   ` Mahesh Rajashekhara
2015-06-11  1:42 ` [Patch V2 8/9] [SCSI] aacraid: Send commit-config to controller firmware rajinikanth.pandurangan
2015-06-24  5:42   ` Mahesh Rajashekhara
2015-06-11  1:42 ` [Patch V2 9/9] [SCSI] aacraid: Update driver version rajinikanth.pandurangan
2015-06-16 11:43   ` Johannes Thumshirn
2015-06-24  5:42   ` Mahesh Rajashekhara

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=20150616114017.GD2883@c203.arch.suse.de \
    --to=jthumshirn@suse.de \
    --cc=aacraid@pmc-sierra.com \
    --cc=achim.leubner@pmcs.com \
    --cc=harry.yang@pmcs.com \
    --cc=jbottomley@parallels.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mahesh.rajashekhara@pmcs.com \
    --cc=murthy.bhat@pmcs.com \
    --cc=rajinikanth.pandurangan@pmcs.com \
    --cc=rich.bono@pmcs.com \
    /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.