diff mbox series

hpsa: add module parameter to disable irq affinity

Message ID 154387651237.29316.15085846349138308725.stgit@brunhilda (mailing list archive)
State Superseded
Headers show
Series hpsa: add module parameter to disable irq affinity | expand

Commit Message

Don Brace Dec. 3, 2018, 10:35 p.m. UTC
The PCI_IRQ_AFFINITY flag prevents customers from
changing the smp_affinity and smp_affinity_list entries.

- add a module parameter to allow this flag to be turned
  off.

- to turn off PCI_IRQ_AFFINITY:
  flag hpsa_disable_irq_affinity=1

Reviewed-by: David Carroll <david.carroll@microsemi.com>
Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
---
 drivers/scsi/hpsa.c |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

Comments

Hannes Reinecke Dec. 18, 2018, 7:56 a.m. UTC | #1
On 12/3/18 11:35 PM, Don Brace wrote:
> The PCI_IRQ_AFFINITY flag prevents customers from
> changing the smp_affinity and smp_affinity_list entries.
> 
> - add a module parameter to allow this flag to be turned
>    off.
> 
> - to turn off PCI_IRQ_AFFINITY:
>    flag hpsa_disable_irq_affinity=1
> 
> Reviewed-by: David Carroll <david.carroll@microsemi.com>
> Reviewed-by: Scott Teel <scott.teel@microsemi.com>
> Signed-off-by: Don Brace <don.brace@microsemi.com>
> ---
>   drivers/scsi/hpsa.c |   13 ++++++++++---
>   1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
> index c9cccf35e9d7..0aa5aa66151f 100644
> --- a/drivers/scsi/hpsa.c
> +++ b/drivers/scsi/hpsa.c
> @@ -87,6 +87,10 @@ static int hpsa_simple_mode;
>   module_param(hpsa_simple_mode, int, S_IRUGO|S_IWUSR);
>   MODULE_PARM_DESC(hpsa_simple_mode,
>   	"Use 'simple mode' rather than 'performant mode'");
> +static bool hpsa_disable_irq_affinity;
> +module_param(hpsa_disable_irq_affinity, bool, S_IRUGO|S_IWUSR);
> +MODULE_PARM_DESC(hpsa_disable_irq_affinity,
> +	"Turn off managed irq affinity. Allows smp_affinity to be changed.");
>   
>   /* define the PCI info for the cards we can control */
>   static const struct pci_device_id hpsa_pci_device_id[] = {
> @@ -7389,7 +7393,7 @@ static void hpsa_setup_reply_map(struct ctlr_info *h)
>    */
>   static int hpsa_interrupt_mode(struct ctlr_info *h)
>   {
> -	unsigned int flags = PCI_IRQ_LEGACY;
> +	unsigned int flags;
>   	int ret;
>   
>   	/* Some boards advertise MSI but don't really support it */
> @@ -7400,17 +7404,20 @@ static int hpsa_interrupt_mode(struct ctlr_info *h)
>   	case 0x40830E11:
>   		break;
>   	default:
> +		flags = PCI_IRQ_MSIX;
> +		if (!hpsa_disable_irq_affinity)
> +			flags |= PCI_IRQ_AFFINITY;
>   		ret = pci_alloc_irq_vectors(h->pdev, 1, MAX_REPLY_QUEUES,
> -				PCI_IRQ_MSIX | PCI_IRQ_AFFINITY);
> +				flags);
>   		if (ret > 0) {
>   			h->msix_vectors = ret;
>   			return 0;
>   		}
>   
> -		flags |= PCI_IRQ_MSI;
>   		break;
>   	}
>   
> +	flags = PCI_IRQ_LEGACY | PCI_IRQ_MSI;
>   	ret = pci_alloc_irq_vectors(h->pdev, 1, 1, flags);
>   	if (ret < 0)
>   		return ret;
> 
That completely breaks multiqueue.
You sure about this?
What is the intention here?

Cheers,

Hannes
Don Brace Dec. 18, 2018, 5:57 p.m. UTC | #2
-----Original Message-----
From: Hannes Reinecke [mailto:hare@suse.de] 
Sent: Tuesday, December 18, 2018 1:57 AM
To: Don Brace <don.brace@microsemi.com>; Kevin Barnett - C33748 <Kevin.Barnett@microchip.com>; Scott Teel - C33730 <Scott.Teel@microchip.com>; Justin Lindley - C33718 <Justin.Lindley@microchip.com>; Scott Benesh - C33703 <Scott.Benesh@microchip.com>; bader.alisaleh@microchip.com; Gerry Morong - C33720 <Gerry.Morong@microchip.com>; Mahesh Rajashekhara - I30583 <Mahesh.Rajashekhara@microchip.com>; hch@infradead.org; jejb@linux.vnet.ibm.com; joseph.szczypek@hpe.com; POSWALD@suse.com; shunyong.yang@hxt-semitech.com
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH] hpsa: add module parameter to disable irq affinity

EXTERNAL EMAIL


On 12/3/18 11:35 PM, Don Brace wrote:
> The PCI_IRQ_AFFINITY flag prevents customers from changing the 
> smp_affinity and smp_affinity_list entries.
>
> - add a module parameter to allow this flag to be turned
>    off.
>
> - to turn off PCI_IRQ_AFFINITY:
>    flag hpsa_disable_irq_affinity=1
>
> Reviewed-by: David Carroll <david.carroll@microsemi.com>
> Reviewed-by: Scott Teel <scott.teel@microsemi.com>
> Signed-off-by: Don Brace <don.brace@microsemi.com>
> ---
>   drivers/scsi/hpsa.c |   13 ++++++++++---
>   1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index 
> c9cccf35e9d7..0aa5aa66151f 100644
> --- a/drivers/scsi/hpsa.c
> +++ b/drivers/scsi/hpsa.c
> @@ -87,6 +87,10 @@ static int hpsa_simple_mode;
>   module_param(hpsa_simple_mode, int, S_IRUGO|S_IWUSR);
>   MODULE_PARM_DESC(hpsa_simple_mode,
>       "Use 'simple mode' rather than 'performant mode'");
> +static bool hpsa_disable_irq_affinity; 
> +module_param(hpsa_disable_irq_affinity, bool, S_IRUGO|S_IWUSR); 
> +MODULE_PARM_DESC(hpsa_disable_irq_affinity,
> +     "Turn off managed irq affinity. Allows smp_affinity to be 
> +changed.");
>
>   /* define the PCI info for the cards we can control */
>   static const struct pci_device_id hpsa_pci_device_id[] = { @@ 
> -7389,7 +7393,7 @@ static void hpsa_setup_reply_map(struct ctlr_info *h)
>    */
>   static int hpsa_interrupt_mode(struct ctlr_info *h)
>   {
> -     unsigned int flags = PCI_IRQ_LEGACY;
> +     unsigned int flags;
>       int ret;
>
>       /* Some boards advertise MSI but don't really support it */ @@ 
> -7400,17 +7404,20 @@ static int hpsa_interrupt_mode(struct ctlr_info *h)
>       case 0x40830E11:
>               break;
>       default:
> +             flags = PCI_IRQ_MSIX;
> +             if (!hpsa_disable_irq_affinity)
> +                     flags |= PCI_IRQ_AFFINITY;
>               ret = pci_alloc_irq_vectors(h->pdev, 1, MAX_REPLY_QUEUES,
> -                             PCI_IRQ_MSIX | PCI_IRQ_AFFINITY);
> +                             flags);
>               if (ret > 0) {
>                       h->msix_vectors = ret;
>                       return 0;
>               }
>
> -             flags |= PCI_IRQ_MSI;
>               break;
>       }
>
> +     flags = PCI_IRQ_LEGACY | PCI_IRQ_MSI;
>       ret = pci_alloc_irq_vectors(h->pdev, 1, 1, flags);
>       if (ret < 0)
>               return ret;
>
That completely breaks multiqueue.
You sure about this?
What is the intention here?

Cheers,

Hannes

This patch is a result of some customers complaining that they cannot
alter the smp_affinity* entries for hpsa because the vectors are managed.

The message is: write error: Input/output error

I added the module parameter to allow them to turn off the affinity flag
so they can set the mask to whatever they want, but leaves the default
behavior in-place.

Is there a better method?

--
Dr. Hannes Reinecke                Teamlead Storage & Networking
hare@suse.de                                   +49 911 74053 688
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)
Don Brace Jan. 8, 2019, 9:16 p.m. UTC | #3
-----Original Message-----
From: Don Brace - C33706 
Sent: Tuesday, December 18, 2018 11:57 AM
To: Hannes Reinecke <hare@suse.de>; Don Brace <don.brace@microsemi.com>; Kevin Barnett - C33748 <Kevin.Barnett@microchip.com>; Scott Teel - C33730 <Scott.Teel@microchip.com>; Justin Lindley - C33718 <Justin.Lindley@microchip.com>; Scott Benesh - C33703 <Scott.Benesh@microchip.com>; bader.alisaleh@microchip.com; Gerry Morong - C33720 <Gerry.Morong@microchip.com>; Mahesh Rajashekhara - I30583 <Mahesh.Rajashekhara@microchip.com>; hch@infradead.org; jejb@linux.vnet.ibm.com; joseph.szczypek@hpe.com; POSWALD@suse.com; shunyong.yang@hxt-semitech.com
Cc: linux-scsi@vger.kernel.org
Subject: RE: [PATCH] hpsa: add module parameter to disable irq affinity

-----Original Message-----
From: Hannes Reinecke [mailto:hare@suse.de]
Sent: Tuesday, December 18, 2018 1:57 AM
To: Don Brace <don.brace@microsemi.com>; Kevin Barnett - C33748 <Kevin.Barnett@microchip.com>; Scott Teel - C33730 <Scott.Teel@microchip.com>; Justin Lindley - C33718 <Justin.Lindley@microchip.com>; Scott Benesh - C33703 <Scott.Benesh@microchip.com>; bader.alisaleh@microchip.com; Gerry Morong - C33720 <Gerry.Morong@microchip.com>; Mahesh Rajashekhara - I30583 <Mahesh.Rajashekhara@microchip.com>; hch@infradead.org; jejb@linux.vnet.ibm.com; joseph.szczypek@hpe.com; POSWALD@suse.com; shunyong.yang@hxt-semitech.com
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH] hpsa: add module parameter to disable irq affinity

EXTERNAL EMAIL


On 12/3/18 11:35 PM, Don Brace wrote:
> The PCI_IRQ_AFFINITY flag prevents customers from changing the 
> smp_affinity and smp_affinity_list entries.
>
> - add a module parameter to allow this flag to be turned
>    off.
>
> - to turn off PCI_IRQ_AFFINITY:
>    flag hpsa_disable_irq_affinity=1
>
> Reviewed-by: David Carroll <david.carroll@microsemi.com>
> Reviewed-by: Scott Teel <scott.teel@microsemi.com>
> Signed-off-by: Don Brace <don.brace@microsemi.com>
> ---
>   drivers/scsi/hpsa.c |   13 ++++++++++---
>   1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index 
> c9cccf35e9d7..0aa5aa66151f 100644
> --- a/drivers/scsi/hpsa.c
> +++ b/drivers/scsi/hpsa.c
> @@ -87,6 +87,10 @@ static int hpsa_simple_mode;
>   module_param(hpsa_simple_mode, int, S_IRUGO|S_IWUSR);
>   MODULE_PARM_DESC(hpsa_simple_mode,
>       "Use 'simple mode' rather than 'performant mode'");
> +static bool hpsa_disable_irq_affinity; 
> +module_param(hpsa_disable_irq_affinity, bool, S_IRUGO|S_IWUSR); 
> +MODULE_PARM_DESC(hpsa_disable_irq_affinity,
> +     "Turn off managed irq affinity. Allows smp_affinity to be 
> +changed.");
>
>   /* define the PCI info for the cards we can control */
>   static const struct pci_device_id hpsa_pci_device_id[] = { @@
> -7389,7 +7393,7 @@ static void hpsa_setup_reply_map(struct ctlr_info *h)
>    */
>   static int hpsa_interrupt_mode(struct ctlr_info *h)
>   {
> -     unsigned int flags = PCI_IRQ_LEGACY;
> +     unsigned int flags;
>       int ret;
>
>       /* Some boards advertise MSI but don't really support it */ @@
> -7400,17 +7404,20 @@ static int hpsa_interrupt_mode(struct ctlr_info *h)
>       case 0x40830E11:
>               break;
>       default:
> +             flags = PCI_IRQ_MSIX;
> +             if (!hpsa_disable_irq_affinity)
> +                     flags |= PCI_IRQ_AFFINITY;
>               ret = pci_alloc_irq_vectors(h->pdev, 1, MAX_REPLY_QUEUES,
> -                             PCI_IRQ_MSIX | PCI_IRQ_AFFINITY);
> +                             flags);
>               if (ret > 0) {
>                       h->msix_vectors = ret;
>                       return 0;
>               }
>
> -             flags |= PCI_IRQ_MSI;
>               break;
>       }
>
> +     flags = PCI_IRQ_LEGACY | PCI_IRQ_MSI;
>       ret = pci_alloc_irq_vectors(h->pdev, 1, 1, flags);
>       if (ret < 0)
>               return ret;
>
That completely breaks multiqueue.
You sure about this?
What is the intention here?

Cheers,

Hannes


--
Dr. Hannes Reinecke                Teamlead Storage & Networking
hare@suse.de                                   +49 911 74053 688
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)

Any more thoughts on these commants?

This patch is a result of some customers complaining that they cannot alter the smp_affinity* entries for hpsa because the vectors are managed.

The message is: write error: Input/output error

I added the module parameter to allow them to turn off the affinity flag so they can set the mask to whatever they want, but leaves the default behavior in-place.

Is there a better method?

Thanks,
Don
Hannes Reinecke Jan. 9, 2019, 12:05 p.m. UTC | #4
On 1/8/19 10:16 PM, Don.Brace@microchip.com wrote:
> On 12/3/18 11:35 PM, Don Brace wrote:
>> The PCI_IRQ_AFFINITY flag prevents customers from changing the
>> smp_affinity and smp_affinity_list entries.
>>
>> - add a module parameter to allow this flag to be turned
>>     off.
>>
>> - to turn off PCI_IRQ_AFFINITY:
>>     flag hpsa_disable_irq_affinity=1
>>
>> Reviewed-by: David Carroll <david.carroll@microsemi.com>
>> Reviewed-by: Scott Teel <scott.teel@microsemi.com>
>> Signed-off-by: Don Brace <don.brace@microsemi.com>
>> ---
>>    drivers/scsi/hpsa.c |   13 ++++++++++---
>>    1 file changed, 10 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index
>> c9cccf35e9d7..0aa5aa66151f 100644
>> --- a/drivers/scsi/hpsa.c
>> +++ b/drivers/scsi/hpsa.c
>> @@ -87,6 +87,10 @@ static int hpsa_simple_mode;
>>    module_param(hpsa_simple_mode, int, S_IRUGO|S_IWUSR);
>>    MODULE_PARM_DESC(hpsa_simple_mode,
>>        "Use 'simple mode' rather than 'performant mode'");
>> +static bool hpsa_disable_irq_affinity;
>> +module_param(hpsa_disable_irq_affinity, bool, S_IRUGO|S_IWUSR);
>> +MODULE_PARM_DESC(hpsa_disable_irq_affinity,
>> +     "Turn off managed irq affinity. Allows smp_affinity to be
>> +changed.");
>>
>>    /* define the PCI info for the cards we can control */
>>    static const struct pci_device_id hpsa_pci_device_id[] = { @@
>> -7389,7 +7393,7 @@ static void hpsa_setup_reply_map(struct ctlr_info *h)
>>     */
>>    static int hpsa_interrupt_mode(struct ctlr_info *h)
>>    {
>> -     unsigned int flags = PCI_IRQ_LEGACY;
>> +     unsigned int flags;
>>        int ret;
>>
>>        /* Some boards advertise MSI but don't really support it */ @@
>> -7400,17 +7404,20 @@ static int hpsa_interrupt_mode(struct ctlr_info *h)
>>        case 0x40830E11:
>>                break;
>>        default:
>> +             flags = PCI_IRQ_MSIX;
>> +             if (!hpsa_disable_irq_affinity)
>> +                     flags |= PCI_IRQ_AFFINITY;
>>                ret = pci_alloc_irq_vectors(h->pdev, 1, MAX_REPLY_QUEUES,
>> -                             PCI_IRQ_MSIX | PCI_IRQ_AFFINITY);
>> +                             flags);
>>                if (ret > 0) {
>>                        h->msix_vectors = ret;
>>                        return 0;
>>                }
>>
>> -             flags |= PCI_IRQ_MSI;
>>                break;
>>        }
>>
>> +     flags = PCI_IRQ_LEGACY | PCI_IRQ_MSI;
>>        ret = pci_alloc_irq_vectors(h->pdev, 1, 1, flags);
>>        if (ret < 0)
>>                return ret;
>>
> That completely breaks multiqueue.
> You sure about this?
> What is the intention here?
> 

> Any more thoughts on these comments?
> 
> This patch is a result of some customers complaining that they cannot alter the smp_affinity* entries
> for hpsa because the vectors are managed.
> 
> The message is: write error: Input/output error
> 
> I added the module parameter to allow them to turn off the affinity flag so they can set the mask to
> whatever they want, but leaves the default behavior in-place.
> 
> Is there a better method?
>
Shouldn't we rather figure out what is triggering the I/O error?
Have you checked that we're not running into the issue discussed in the 
thread 'scsi: hpsa: fix selection of reply queue' ?

Cheers,

Hannes
Don Brace Jan. 9, 2019, 8:06 p.m. UTC | #5
-----Original Message-----
Subject: Re: [PATCH] hpsa: add module parameter to disable irq affinity

On 1/8/19 10:16 PM, Don.Brace@microchip.com wrote:
> On 12/3/18 11:35 PM, Don Brace wrote:
>> The PCI_IRQ_AFFINITY flag prevents customers from changing the 
>> smp_affinity and smp_affinity_list entries.
>>
>> - add a module parameter to allow this flag to be turned
>>     off.
>>
>> - to turn off PCI_IRQ_AFFINITY:
>>     flag hpsa_disable_irq_affinity=1
>>
>> Reviewed-by: David Carroll <david.carroll@microsemi.com>
>> Reviewed-by: Scott Teel <scott.teel@microsemi.com>
>> Signed-off-by: Don Brace <don.brace@microsemi.com>
>> ---
>>    drivers/scsi/hpsa.c |   13 ++++++++++---
>>    1 file changed, 10 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index 
>> c9cccf35e9d7..0aa5aa66151f 100644
>> --- a/drivers/scsi/hpsa.c
>> +++ b/drivers/scsi/hpsa.c
>> @@ -87,6 +87,10 @@ static int hpsa_simple_mode;
>>    module_param(hpsa_simple_mode, int, S_IRUGO|S_IWUSR);
>>    MODULE_PARM_DESC(hpsa_simple_mode,
>>        "Use 'simple mode' rather than 'performant mode'");
>> +static bool hpsa_disable_irq_affinity; 
>> +module_param(hpsa_disable_irq_affinity, bool, S_IRUGO|S_IWUSR); 
>> +MODULE_PARM_DESC(hpsa_disable_irq_affinity,
>> +     "Turn off managed irq affinity. Allows smp_affinity to be 
>> +changed.");
>>
> 
> Is there a better method?
>
Shouldn't we rather figure out what is triggering the I/O error?
Have you checked that we're not running into the issue discussed in the thread 'scsi: hpsa: fix selection of reply queue' ?

Cheers,

Hannes
Ming Lei Jan. 10, 2019, 3:12 a.m. UTC | #6
On Tue, Dec 4, 2018 at 6:36 AM Don Brace <don.brace@microsemi.com> wrote:
>
> The PCI_IRQ_AFFINITY flag prevents customers from
> changing the smp_affinity and smp_affinity_list entries.
>
> - add a module parameter to allow this flag to be turned
>   off.
>
> - to turn off PCI_IRQ_AFFINITY:
>   flag hpsa_disable_irq_affinity=1
>
> Reviewed-by: David Carroll <david.carroll@microsemi.com>
> Reviewed-by: Scott Teel <scott.teel@microsemi.com>
> Signed-off-by: Don Brace <don.brace@microsemi.com>
> ---
>  drivers/scsi/hpsa.c |   13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
> index c9cccf35e9d7..0aa5aa66151f 100644
> --- a/drivers/scsi/hpsa.c
> +++ b/drivers/scsi/hpsa.c
> @@ -87,6 +87,10 @@ static int hpsa_simple_mode;
>  module_param(hpsa_simple_mode, int, S_IRUGO|S_IWUSR);
>  MODULE_PARM_DESC(hpsa_simple_mode,
>         "Use 'simple mode' rather than 'performant mode'");
> +static bool hpsa_disable_irq_affinity;
> +module_param(hpsa_disable_irq_affinity, bool, S_IRUGO|S_IWUSR);
> +MODULE_PARM_DESC(hpsa_disable_irq_affinity,
> +       "Turn off managed irq affinity. Allows smp_affinity to be changed.");
>
>  /* define the PCI info for the cards we can control */
>  static const struct pci_device_id hpsa_pci_device_id[] = {
> @@ -7389,7 +7393,7 @@ static void hpsa_setup_reply_map(struct ctlr_info *h)
>   */
>  static int hpsa_interrupt_mode(struct ctlr_info *h)
>  {
> -       unsigned int flags = PCI_IRQ_LEGACY;
> +       unsigned int flags;
>         int ret;
>
>         /* Some boards advertise MSI but don't really support it */
> @@ -7400,17 +7404,20 @@ static int hpsa_interrupt_mode(struct ctlr_info *h)
>         case 0x40830E11:
>                 break;
>         default:
> +               flags = PCI_IRQ_MSIX;
> +               if (!hpsa_disable_irq_affinity)
> +                       flags |= PCI_IRQ_AFFINITY;
>                 ret = pci_alloc_irq_vectors(h->pdev, 1, MAX_REPLY_QUEUES,
> -                               PCI_IRQ_MSIX | PCI_IRQ_AFFINITY);
> +                               flags);
>                 if (ret > 0) {
>                         h->msix_vectors = ret;
>                         return 0;
>                 }
>
> -               flags |= PCI_IRQ_MSI;
>                 break;
>         }
>
> +       flags = PCI_IRQ_LEGACY | PCI_IRQ_MSI;
>         ret = pci_alloc_irq_vectors(h->pdev, 1, 1, flags);
>         if (ret < 0)
>                 return ret;
>

This way may break blk-mq's queue mapping, especially might cause
issue in case of
CPU hotplug.


Thanks,
Ming Lei
Ming Lei Jan. 10, 2019, 3:19 a.m. UTC | #7
On Thu, Jan 10, 2019 at 5:05 AM <Don.Brace@microchip.com> wrote:
>
> -----Original Message-----
> Subject: Re: [PATCH] hpsa: add module parameter to disable irq affinity
>
> On 1/8/19 10:16 PM, Don.Brace@microchip.com wrote:
> > On 12/3/18 11:35 PM, Don Brace wrote:
> >> The PCI_IRQ_AFFINITY flag prevents customers from changing the
> >> smp_affinity and smp_affinity_list entries.
> >>
> >> - add a module parameter to allow this flag to be turned
> >>     off.
> >>
> >> - to turn off PCI_IRQ_AFFINITY:
> >>     flag hpsa_disable_irq_affinity=1
> >>
> >> Reviewed-by: David Carroll <david.carroll@microsemi.com>
> >> Reviewed-by: Scott Teel <scott.teel@microsemi.com>
> >> Signed-off-by: Don Brace <don.brace@microsemi.com>
> >> ---
> >>    drivers/scsi/hpsa.c |   13 ++++++++++---
> >>    1 file changed, 10 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index
> >> c9cccf35e9d7..0aa5aa66151f 100644
> >> --- a/drivers/scsi/hpsa.c
> >> +++ b/drivers/scsi/hpsa.c
> >> @@ -87,6 +87,10 @@ static int hpsa_simple_mode;
> >>    module_param(hpsa_simple_mode, int, S_IRUGO|S_IWUSR);
> >>    MODULE_PARM_DESC(hpsa_simple_mode,
> >>        "Use 'simple mode' rather than 'performant mode'");
> >> +static bool hpsa_disable_irq_affinity;
> >> +module_param(hpsa_disable_irq_affinity, bool, S_IRUGO|S_IWUSR);
> >> +MODULE_PARM_DESC(hpsa_disable_irq_affinity,
> >> +     "Turn off managed irq affinity. Allows smp_affinity to be
> >> +changed.");
> >>
> >
> > Is there a better method?
> >
> Shouldn't we rather figure out what is triggering the I/O error?
> Have you checked that we're not running into the issue discussed in the thread 'scsi: hpsa: fix selection of reply queue' ?
>
> Cheers,
>
> Hannes
> --
> Dr. Hannes Reinecke                Teamlead Storage & Networking
> hare@suse.de                                   +49 911 74053 688
> 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)
> ---
> The issue is that in kernel/irq/proc.c function write_irq_affinity there is a check to see if the
> affinity can be changed. This fails with -EIO because interrupts are managed.

That is expected behavior for managed IRQ.

> There are customers who want to be able to change affinity for application performance reasons.

Could you give examples in which customized affinity may improve
application performance.

> Note that there are other drivers which also unset the PCI_IRQ_AFFINITY flag for similar reasons.

Any SCSI drivers which unset  PCI_IRQ_AFFINITY may break blk-mq.

Thanks,
Ming Lei
diff mbox series

Patch

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index c9cccf35e9d7..0aa5aa66151f 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -87,6 +87,10 @@  static int hpsa_simple_mode;
 module_param(hpsa_simple_mode, int, S_IRUGO|S_IWUSR);
 MODULE_PARM_DESC(hpsa_simple_mode,
 	"Use 'simple mode' rather than 'performant mode'");
+static bool hpsa_disable_irq_affinity;
+module_param(hpsa_disable_irq_affinity, bool, S_IRUGO|S_IWUSR);
+MODULE_PARM_DESC(hpsa_disable_irq_affinity,
+	"Turn off managed irq affinity. Allows smp_affinity to be changed.");
 
 /* define the PCI info for the cards we can control */
 static const struct pci_device_id hpsa_pci_device_id[] = {
@@ -7389,7 +7393,7 @@  static void hpsa_setup_reply_map(struct ctlr_info *h)
  */
 static int hpsa_interrupt_mode(struct ctlr_info *h)
 {
-	unsigned int flags = PCI_IRQ_LEGACY;
+	unsigned int flags;
 	int ret;
 
 	/* Some boards advertise MSI but don't really support it */
@@ -7400,17 +7404,20 @@  static int hpsa_interrupt_mode(struct ctlr_info *h)
 	case 0x40830E11:
 		break;
 	default:
+		flags = PCI_IRQ_MSIX;
+		if (!hpsa_disable_irq_affinity)
+			flags |= PCI_IRQ_AFFINITY;
 		ret = pci_alloc_irq_vectors(h->pdev, 1, MAX_REPLY_QUEUES,
-				PCI_IRQ_MSIX | PCI_IRQ_AFFINITY);
+				flags);
 		if (ret > 0) {
 			h->msix_vectors = ret;
 			return 0;
 		}
 
-		flags |= PCI_IRQ_MSI;
 		break;
 	}
 
+	flags = PCI_IRQ_LEGACY | PCI_IRQ_MSI;
 	ret = pci_alloc_irq_vectors(h->pdev, 1, 1, flags);
 	if (ret < 0)
 		return ret;