Commit ac95136a authored by Sumit.Saxena@avagotech.com's avatar Sumit.Saxena@avagotech.com Committed by Christoph Hellwig

megaraid_sas : Add module parameter to disable IRQ-CPU affinity hint

Resending the patch. Addressed the review comments from Tomas Henzl.

For certain deployment, we may need to disable irq cpu affinity hint.
This module parameter provides option for use to disable irq cpu affinity hint
and allow irqbalancer to handle the rest.
Signed-off-by: default avatarSumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: default avatarKashyap Desai <kashyap.desai@avagotech.com>
Reviewed-by: default avatarTomas Henzl <thenzl@redhat.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent a5fd2858
...@@ -89,6 +89,10 @@ module_param(resetwaittime, int, S_IRUGO); ...@@ -89,6 +89,10 @@ module_param(resetwaittime, int, S_IRUGO);
MODULE_PARM_DESC(resetwaittime, "Wait time in seconds after I/O timeout " MODULE_PARM_DESC(resetwaittime, "Wait time in seconds after I/O timeout "
"before resetting adapter. Default: 180"); "before resetting adapter. Default: 180");
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)");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_VERSION(MEGASAS_VERSION); MODULE_VERSION(MEGASAS_VERSION);
MODULE_AUTHOR("megaraidlinux@lsi.com"); MODULE_AUTHOR("megaraidlinux@lsi.com");
...@@ -5162,8 +5166,9 @@ static int megasas_probe_one(struct pci_dev *pdev, ...@@ -5162,8 +5166,9 @@ static int megasas_probe_one(struct pci_dev *pdev,
printk(KERN_DEBUG "megasas: Failed to " printk(KERN_DEBUG "megasas: Failed to "
"register IRQ for vector %d.\n", i); "register IRQ for vector %d.\n", i);
for (j = 0; j < i; j++) { for (j = 0; j < i; j++) {
irq_set_affinity_hint( if (smp_affinity_enable)
instance->msixentry[j].vector, NULL); irq_set_affinity_hint(
instance->msixentry[j].vector, NULL);
free_irq( free_irq(
instance->msixentry[j].vector, instance->msixentry[j].vector,
&instance->irq_context[j]); &instance->irq_context[j]);
...@@ -5172,11 +5177,14 @@ static int megasas_probe_one(struct pci_dev *pdev, ...@@ -5172,11 +5177,14 @@ static int megasas_probe_one(struct pci_dev *pdev,
instance->msix_vectors = 0; instance->msix_vectors = 0;
goto retry_irq_register; goto retry_irq_register;
} }
if (irq_set_affinity_hint(instance->msixentry[i].vector, if (smp_affinity_enable) {
get_cpu_mask(cpu))) if (irq_set_affinity_hint(instance->msixentry[i].vector,
dev_err(&instance->pdev->dev, "Error setting" get_cpu_mask(cpu)))
"affinity hint for cpu %d\n", cpu); dev_err(&instance->pdev->dev,
cpu = cpumask_next(cpu, cpu_online_mask); "Error setting affinity hint "
"for cpu %d\n", cpu);
cpu = cpumask_next(cpu, cpu_online_mask);
}
} }
} else { } else {
instance->irq_context[0].instance = instance; instance->irq_context[0].instance = instance;
...@@ -5235,8 +5243,9 @@ static int megasas_probe_one(struct pci_dev *pdev, ...@@ -5235,8 +5243,9 @@ static int megasas_probe_one(struct pci_dev *pdev,
instance->instancet->disable_intr(instance); instance->instancet->disable_intr(instance);
if (instance->msix_vectors) if (instance->msix_vectors)
for (i = 0; i < instance->msix_vectors; i++) { for (i = 0; i < instance->msix_vectors; i++) {
irq_set_affinity_hint( if (smp_affinity_enable)
instance->msixentry[i].vector, NULL); irq_set_affinity_hint(
instance->msixentry[i].vector, NULL);
free_irq(instance->msixentry[i].vector, free_irq(instance->msixentry[i].vector,
&instance->irq_context[i]); &instance->irq_context[i]);
} }
...@@ -5399,8 +5408,9 @@ megasas_suspend(struct pci_dev *pdev, pm_message_t state) ...@@ -5399,8 +5408,9 @@ megasas_suspend(struct pci_dev *pdev, pm_message_t state)
if (instance->msix_vectors) if (instance->msix_vectors)
for (i = 0; i < instance->msix_vectors; i++) { for (i = 0; i < instance->msix_vectors; i++) {
irq_set_affinity_hint( if (smp_affinity_enable)
instance->msixentry[i].vector, NULL); irq_set_affinity_hint(
instance->msixentry[i].vector, NULL);
free_irq(instance->msixentry[i].vector, free_irq(instance->msixentry[i].vector,
&instance->irq_context[i]); &instance->irq_context[i]);
} }
...@@ -5509,8 +5519,9 @@ megasas_resume(struct pci_dev *pdev) ...@@ -5509,8 +5519,9 @@ megasas_resume(struct pci_dev *pdev)
printk(KERN_DEBUG "megasas: Failed to " printk(KERN_DEBUG "megasas: Failed to "
"register IRQ for vector %d.\n", i); "register IRQ for vector %d.\n", i);
for (j = 0; j < i; j++) { for (j = 0; j < i; j++) {
irq_set_affinity_hint( if (smp_affinity_enable)
instance->msixentry[j].vector, NULL); irq_set_affinity_hint(
instance->msixentry[j].vector, NULL);
free_irq( free_irq(
instance->msixentry[j].vector, instance->msixentry[j].vector,
&instance->irq_context[j]); &instance->irq_context[j]);
...@@ -5518,11 +5529,14 @@ megasas_resume(struct pci_dev *pdev) ...@@ -5518,11 +5529,14 @@ megasas_resume(struct pci_dev *pdev)
goto fail_irq; goto fail_irq;
} }
if (irq_set_affinity_hint(instance->msixentry[i].vector, if (smp_affinity_enable) {
get_cpu_mask(cpu))) if (irq_set_affinity_hint(instance->msixentry[i].vector,
dev_err(&instance->pdev->dev, "Error setting" get_cpu_mask(cpu)))
"affinity hint for cpu %d\n", cpu); dev_err(&instance->pdev->dev, "Error "
cpu = cpumask_next(cpu, cpu_online_mask); "setting affinity hint for cpu "
"%d\n", cpu);
cpu = cpumask_next(cpu, cpu_online_mask);
}
} }
} else { } else {
instance->irq_context[0].instance = instance; instance->irq_context[0].instance = instance;
...@@ -5640,8 +5654,9 @@ static void megasas_detach_one(struct pci_dev *pdev) ...@@ -5640,8 +5654,9 @@ static void megasas_detach_one(struct pci_dev *pdev)
if (instance->msix_vectors) if (instance->msix_vectors)
for (i = 0; i < instance->msix_vectors; i++) { for (i = 0; i < instance->msix_vectors; i++) {
irq_set_affinity_hint( if (smp_affinity_enable)
instance->msixentry[i].vector, NULL); irq_set_affinity_hint(
instance->msixentry[i].vector, NULL);
free_irq(instance->msixentry[i].vector, free_irq(instance->msixentry[i].vector,
&instance->irq_context[i]); &instance->irq_context[i]);
} }
...@@ -5729,8 +5744,9 @@ static void megasas_shutdown(struct pci_dev *pdev) ...@@ -5729,8 +5744,9 @@ static void megasas_shutdown(struct pci_dev *pdev)
instance->instancet->disable_intr(instance); instance->instancet->disable_intr(instance);
if (instance->msix_vectors) if (instance->msix_vectors)
for (i = 0; i < instance->msix_vectors; i++) { for (i = 0; i < instance->msix_vectors; i++) {
irq_set_affinity_hint( if (smp_affinity_enable)
instance->msixentry[i].vector, NULL); irq_set_affinity_hint(
instance->msixentry[i].vector, NULL);
free_irq(instance->msixentry[i].vector, free_irq(instance->msixentry[i].vector,
&instance->irq_context[i]); &instance->irq_context[i]);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment