Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1320338 > unrolled thread
| Started by | Suganath prabu Subaramani <suganath-prabu.subramani@avagotech.com> |
|---|---|
| First post | 2016-01-28 07:40 +0100 |
| Last post | 2016-02-08 13:40 +0100 |
| Articles | 4 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[mpt3sas driver 06/10] mpt3sas: Added smp_affinity_enable module parameter. Suganath prabu Subaramani <suganath-prabu.subramani@avagotech.com> - 2016-01-28 07:40 +0100
Re: [mpt3sas driver 06/10] mpt3sas: Added smp_affinity_enable module parameter. Tomas Henzl <thenzl@redhat.com> - 2016-02-04 16:10 +0100
Re: [mpt3sas driver 06/10] mpt3sas: Added smp_affinity_enable module parameter. Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com> - 2016-02-08 07:10 +0100
Re: [mpt3sas driver 06/10] mpt3sas: Added smp_affinity_enable module parameter. Tomas Henzl <thenzl@redhat.com> - 2016-02-08 13:40 +0100
| From | Suganath prabu Subaramani <suganath-prabu.subramani@avagotech.com> |
|---|---|
| Date | 2016-01-28 07:40 +0100 |
| Subject | [mpt3sas driver 06/10] mpt3sas: Added smp_affinity_enable module parameter. |
| Message-ID | <qVOpk-7Sk-17@gated-at.bofh.it> |
From: Suganath prabu Subramani <suganath-prabu.subramani@avagotech.com>
Module parameter to enable/disable configuring
affinity hint for msix vector.
SMP affinity feature can be enabled/disabled by setting
module parameter "smp_affinity_enable" to 1/0.
By default this feature is enabled. (smp_affinity_enable = 1 enabled).
Signed-off-by: Suganath prabu Subramani <suganath-prabu.subramani@avagotech.com>
Signed-off-by: Chaitra P B <chaitra.basappa@avagotech.com>
---
drivers/scsi/mpt3sas/mpt3sas_base.c | 34 +++++++++++++++++++++++-----------
1 file changed, 23 insertions(+), 11 deletions(-)
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
index 31838d9a..a1a3b39 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -83,6 +83,10 @@ static int msix_disable = -1;
module_param(msix_disable, int, 0);
MODULE_PARM_DESC(msix_disable, " disable msix routed interrupts (default=0)");
+static int smp_affinity_enable = 1;
+module_param(smp_affinity_enable, int, S_IRUGO);
+MODULE_PARM_DESC(smp_affinity_enable, "SMP affinity feature enable/disbale Default: enable(1)");
+
static int max_msix_vectors = -1;
module_param(max_msix_vectors, int, 0);
MODULE_PARM_DESC(max_msix_vectors,
@@ -1812,8 +1816,10 @@ _base_free_irq(struct MPT3SAS_ADAPTER *ioc)
list_for_each_entry_safe(reply_q, next, &ioc->reply_queue_list, list) {
list_del(&reply_q->list);
- irq_set_affinity_hint(reply_q->vector, NULL);
- free_cpumask_var(reply_q->affinity_hint);
+ if (smp_affinity_enable) {
+ irq_set_affinity_hint(reply_q->vector, NULL);
+ free_cpumask_var(reply_q->affinity_hint);
+ }
synchronize_irq(reply_q->vector);
free_irq(reply_q->vector, reply_q);
kfree(reply_q);
@@ -1844,9 +1850,11 @@ _base_request_irq(struct MPT3SAS_ADAPTER *ioc, u8 index, u32 vector)
reply_q->msix_index = index;
reply_q->vector = vector;
- if (!alloc_cpumask_var(&reply_q->affinity_hint, GFP_KERNEL))
- return -ENOMEM;
- cpumask_clear(reply_q->affinity_hint);
+ if (smp_affinity_enable) {
+ if (!alloc_cpumask_var(&reply_q->affinity_hint, GFP_KERNEL))
+ return -ENOMEM;
+ cpumask_clear(reply_q->affinity_hint);
+ }
atomic_set(&reply_q->busy, 0);
if (ioc->msix_enable)
@@ -1909,16 +1917,17 @@ _base_assign_reply_queues(struct MPT3SAS_ADAPTER *ioc)
for (i = 0 ; i < group ; i++) {
ioc->cpu_msix_table[cpu] = index;
- cpumask_or(reply_q->affinity_hint,
+ if (smp_affinity_enable)
+ cpumask_or(reply_q->affinity_hint,
reply_q->affinity_hint, get_cpu_mask(cpu));
cpu = cpumask_next(cpu, cpu_online_mask);
}
-
- if (irq_set_affinity_hint(reply_q->vector,
+ if (smp_affinity_enable)
+ if (irq_set_affinity_hint(reply_q->vector,
reply_q->affinity_hint))
- dinitprintk(ioc, pr_info(MPT3SAS_FMT
- "error setting affinity hint for irq vector %d\n",
- ioc->name, reply_q->vector));
+ dinitprintk(ioc, pr_info(MPT3SAS_FMT
+ "Err setting affinity hint to irq vector %d\n",
+ ioc->name, reply_q->vector));
index++;
}
}
@@ -1976,6 +1985,9 @@ _base_enable_msix(struct MPT3SAS_ADAPTER *ioc)
} else if (max_msix_vectors == 0)
goto try_ioapic;
+ if (ioc->msix_vector_count < ioc->cpu_count)
+ smp_affinity_enable = 0;
+
entries = kcalloc(ioc->reply_queue_count, sizeof(struct msix_entry),
GFP_KERNEL);
if (!entries) {
--
1.8.3.1
[toc] | [next] | [standalone]
| From | Tomas Henzl <thenzl@redhat.com> |
|---|---|
| Date | 2016-02-04 16:10 +0100 |
| Subject | Re: [mpt3sas driver 06/10] mpt3sas: Added smp_affinity_enable module parameter. |
| Message-ID | <qYtHH-3B3-3@gated-at.bofh.it> |
| In reply to | #1320338 |
On 28.1.2016 07:37, Suganath prabu Subaramani wrote:
> From: Suganath prabu Subramani <suganath-prabu.subramani@avagotech.com>
>
> Module parameter to enable/disable configuring
> affinity hint for msix vector.
> SMP affinity feature can be enabled/disabled by setting
> module parameter "smp_affinity_enable" to 1/0.
> By default this feature is enabled. (smp_affinity_enable = 1 enabled).
>
> Signed-off-by: Suganath prabu Subramani <suganath-prabu.subramani@avagotech.com>
> Signed-off-by: Chaitra P B <chaitra.basappa@avagotech.com>
> ---
> drivers/scsi/mpt3sas/mpt3sas_base.c | 34 +++++++++++++++++++++++-----------
> 1 file changed, 23 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
> index 31838d9a..a1a3b39 100644
> --- a/drivers/scsi/mpt3sas/mpt3sas_base.c
> +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
> @@ -83,6 +83,10 @@ static int msix_disable = -1;
> module_param(msix_disable, int, 0);
> MODULE_PARM_DESC(msix_disable, " disable msix routed interrupts (default=0)");
>
> +static int smp_affinity_enable = 1;
> +module_param(smp_affinity_enable, int, S_IRUGO);
> +MODULE_PARM_DESC(smp_affinity_enable, "SMP affinity feature enable/disbale Default: enable(1)");
> +
> static int max_msix_vectors = -1;
> module_param(max_msix_vectors, int, 0);
> MODULE_PARM_DESC(max_msix_vectors,
> @@ -1812,8 +1816,10 @@ _base_free_irq(struct MPT3SAS_ADAPTER *ioc)
>
> list_for_each_entry_safe(reply_q, next, &ioc->reply_queue_list, list) {
> list_del(&reply_q->list);
> - irq_set_affinity_hint(reply_q->vector, NULL);
> - free_cpumask_var(reply_q->affinity_hint);
> + if (smp_affinity_enable) {
> + irq_set_affinity_hint(reply_q->vector, NULL);
> + free_cpumask_var(reply_q->affinity_hint);
> + }
> synchronize_irq(reply_q->vector);
> free_irq(reply_q->vector, reply_q);
> kfree(reply_q);
> @@ -1844,9 +1850,11 @@ _base_request_irq(struct MPT3SAS_ADAPTER *ioc, u8 index, u32 vector)
> reply_q->msix_index = index;
> reply_q->vector = vector;
>
> - if (!alloc_cpumask_var(&reply_q->affinity_hint, GFP_KERNEL))
> - return -ENOMEM;
> - cpumask_clear(reply_q->affinity_hint);
> + if (smp_affinity_enable) {
> + if (!alloc_cpumask_var(&reply_q->affinity_hint, GFP_KERNEL))
a kfree(reply_q); should go here
> + return -ENOMEM;
> + cpumask_clear(reply_q->affinity_hint);
maybe zalloc_cpumask_var ?
> + }
if (r) {
pr_err(MPT3SAS_FMT "unable to allocate interrupt %d!\n",
reply_q->name, vector);
kfree(reply_q);
and a free_cpumask_var (..) here ?
return -EBUSY;
cheers,
tomash
[toc] | [prev] | [next] | [standalone]
| From | Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com> |
|---|---|
| Date | 2016-02-08 07:10 +0100 |
| Message-ID | <qZNbj-15c-5@gated-at.bofh.it> |
| In reply to | #1326899 |
Hi Tomas,
Initially, we posted this patch with "zalloc_cpumassk_var" and Robert
has suggested to use "alloc_cpumask_var". Please check the below link.
"http://www.gossamer-threads.com/lists/linux/kernel/2068280?do=post_view_threaded#2068280"
We incorporated other review comments for freeing reply_q and
cpumask_var in this patch and sending it soon.
Thanks,
Suganath prabu S
On Thu, Feb 4, 2016 at 8:31 PM, Tomas Henzl <thenzl@redhat.com> wrote:
> On 28.1.2016 07:37, Suganath prabu Subaramani wrote:
>> From: Suganath prabu Subramani <suganath-prabu.subramani@avagotech.com>
>>
>> Module parameter to enable/disable configuring
>> affinity hint for msix vector.
>> SMP affinity feature can be enabled/disabled by setting
>> module parameter "smp_affinity_enable" to 1/0.
>> By default this feature is enabled. (smp_affinity_enable = 1 enabled).
>>
>> Signed-off-by: Suganath prabu Subramani <suganath-prabu.subramani@avagotech.com>
>> Signed-off-by: Chaitra P B <chaitra.basappa@avagotech.com>
>> ---
>> drivers/scsi/mpt3sas/mpt3sas_base.c | 34 +++++++++++++++++++++++-----------
>> 1 file changed, 23 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
>> index 31838d9a..a1a3b39 100644
>> --- a/drivers/scsi/mpt3sas/mpt3sas_base.c
>> +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
>> @@ -83,6 +83,10 @@ static int msix_disable = -1;
>> module_param(msix_disable, int, 0);
>> MODULE_PARM_DESC(msix_disable, " disable msix routed interrupts (default=0)");
>>
>> +static int smp_affinity_enable = 1;
>> +module_param(smp_affinity_enable, int, S_IRUGO);
>> +MODULE_PARM_DESC(smp_affinity_enable, "SMP affinity feature enable/disbale Default: enable(1)");
>> +
>> static int max_msix_vectors = -1;
>> module_param(max_msix_vectors, int, 0);
>> MODULE_PARM_DESC(max_msix_vectors,
>> @@ -1812,8 +1816,10 @@ _base_free_irq(struct MPT3SAS_ADAPTER *ioc)
>>
>> list_for_each_entry_safe(reply_q, next, &ioc->reply_queue_list, list) {
>> list_del(&reply_q->list);
>> - irq_set_affinity_hint(reply_q->vector, NULL);
>> - free_cpumask_var(reply_q->affinity_hint);
>> + if (smp_affinity_enable) {
>> + irq_set_affinity_hint(reply_q->vector, NULL);
>> + free_cpumask_var(reply_q->affinity_hint);
>> + }
>> synchronize_irq(reply_q->vector);
>> free_irq(reply_q->vector, reply_q);
>> kfree(reply_q);
>> @@ -1844,9 +1850,11 @@ _base_request_irq(struct MPT3SAS_ADAPTER *ioc, u8 index, u32 vector)
>> reply_q->msix_index = index;
>> reply_q->vector = vector;
>>
>> - if (!alloc_cpumask_var(&reply_q->affinity_hint, GFP_KERNEL))
>> - return -ENOMEM;
>> - cpumask_clear(reply_q->affinity_hint);
>> + if (smp_affinity_enable) {
>> + if (!alloc_cpumask_var(&reply_q->affinity_hint, GFP_KERNEL))
>
> a kfree(reply_q); should go here
>
>> + return -ENOMEM;
>> + cpumask_clear(reply_q->affinity_hint);
>
> maybe zalloc_cpumask_var ?
>
>> + }
>
> if (r) {
> pr_err(MPT3SAS_FMT "unable to allocate interrupt %d!\n",
> reply_q->name, vector);
> kfree(reply_q);
> and a free_cpumask_var (..) here ?
> return -EBUSY;
>
>
> cheers,
> tomash
>
[toc] | [prev] | [next] | [standalone]
| From | Tomas Henzl <thenzl@redhat.com> |
|---|---|
| Date | 2016-02-08 13:40 +0100 |
| Subject | Re: [mpt3sas driver 06/10] mpt3sas: Added smp_affinity_enable module parameter. |
| Message-ID | <qZTgK-5bG-19@gated-at.bofh.it> |
| In reply to | #1328783 |
On 8.2.2016 07:01, Suganath Prabu Subramani wrote:
> Hi Tomas,
> Initially, we posted this patch with "zalloc_cpumassk_var" and Robert
> has suggested to use "alloc_cpumask_var". Please check the below link.
> "http://www.gossamer-threads.com/lists/linux/kernel/2068280?do=post_view_threaded#2068280"
That thread is about allocating more than KMALLOC_MAX_SIZE with a kmalloc,
it doesn't matter if it is a kzalloc or kmalloc.
If that is an issue in mpt3sas, in your code fails already here when !CONFIG_CPUMASK_OFFSTACK
reply_q = kzalloc(sizeof(struct adapter_reply_queue), GFP_KERNEL);
....
Good news is that the the size allocated in your case is much smaller than what
the lpfc tried at that time, (it used a struct with struct cpumask maskbits;
and multiplied it with nr_cpus) -> this is not your case.
You can use that zalloc_cpumask_var.
--tm
>
> We incorporated other review comments for freeing reply_q and
> cpumask_var in this patch and sending it soon.
>
> Thanks,
> Suganath prabu S
>
> On Thu, Feb 4, 2016 at 8:31 PM, Tomas Henzl <thenzl@redhat.com> wrote:
>> On 28.1.2016 07:37, Suganath prabu Subaramani wrote:
>>> From: Suganath prabu Subramani <suganath-prabu.subramani@avagotech.com>
>>>
>>> Module parameter to enable/disable configuring
>>> affinity hint for msix vector.
>>> SMP affinity feature can be enabled/disabled by setting
>>> module parameter "smp_affinity_enable" to 1/0.
>>> By default this feature is enabled. (smp_affinity_enable = 1 enabled).
>>>
>>> Signed-off-by: Suganath prabu Subramani <suganath-prabu.subramani@avagotech.com>
>>> Signed-off-by: Chaitra P B <chaitra.basappa@avagotech.com>
>>> ---
>>> drivers/scsi/mpt3sas/mpt3sas_base.c | 34 +++++++++++++++++++++++-----------
>>> 1 file changed, 23 insertions(+), 11 deletions(-)
>>>
>>> diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
>>> index 31838d9a..a1a3b39 100644
>>> --- a/drivers/scsi/mpt3sas/mpt3sas_base.c
>>> +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
>>> @@ -83,6 +83,10 @@ static int msix_disable = -1;
>>> module_param(msix_disable, int, 0);
>>> MODULE_PARM_DESC(msix_disable, " disable msix routed interrupts (default=0)");
>>>
>>> +static int smp_affinity_enable = 1;
>>> +module_param(smp_affinity_enable, int, S_IRUGO);
>>> +MODULE_PARM_DESC(smp_affinity_enable, "SMP affinity feature enable/disbale Default: enable(1)");
>>> +
>>> static int max_msix_vectors = -1;
>>> module_param(max_msix_vectors, int, 0);
>>> MODULE_PARM_DESC(max_msix_vectors,
>>> @@ -1812,8 +1816,10 @@ _base_free_irq(struct MPT3SAS_ADAPTER *ioc)
>>>
>>> list_for_each_entry_safe(reply_q, next, &ioc->reply_queue_list, list) {
>>> list_del(&reply_q->list);
>>> - irq_set_affinity_hint(reply_q->vector, NULL);
>>> - free_cpumask_var(reply_q->affinity_hint);
>>> + if (smp_affinity_enable) {
>>> + irq_set_affinity_hint(reply_q->vector, NULL);
>>> + free_cpumask_var(reply_q->affinity_hint);
>>> + }
>>> synchronize_irq(reply_q->vector);
>>> free_irq(reply_q->vector, reply_q);
>>> kfree(reply_q);
>>> @@ -1844,9 +1850,11 @@ _base_request_irq(struct MPT3SAS_ADAPTER *ioc, u8 index, u32 vector)
>>> reply_q->msix_index = index;
>>> reply_q->vector = vector;
>>>
>>> - if (!alloc_cpumask_var(&reply_q->affinity_hint, GFP_KERNEL))
>>> - return -ENOMEM;
>>> - cpumask_clear(reply_q->affinity_hint);
>>> + if (smp_affinity_enable) {
>>> + if (!alloc_cpumask_var(&reply_q->affinity_hint, GFP_KERNEL))
>> a kfree(reply_q); should go here
>>
>>> + return -ENOMEM;
>>> + cpumask_clear(reply_q->affinity_hint);
>> maybe zalloc_cpumask_var ?
>>
>>> + }
>> if (r) {
>> pr_err(MPT3SAS_FMT "unable to allocate interrupt %d!\n",
>> reply_q->name, vector);
>> kfree(reply_q);
>> and a free_cpumask_var (..) here ?
>> return -EBUSY;
>>
>>
>> cheers,
>> tomash
>>
> --
> 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
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web