提交 8058a169 编写于 作者: S Sumit.Saxena@lsi.com 提交者: James Bottomley

[SCSI] megaraid_sas: Performance boost fixes

Host lock is added back around queuecommand. Host lock removal can create race
conditon between ISR path(when RAID map update interrupt is raised) and IO
build path of driver, since IO build path is making use of RAID map, and in
case of RAID map update interrupt, old RAID map copy is memset to zero, which
some IOs may be referencing in build IO path.  Changes done for performance
boost- 1) Added code to set SMP IRQ affinity per CPU.  2) Pass MSI-x index,
while issuing sysPD IO.
Signed-off-by: NKashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: NSumit Saxena <sumit.saxena@lsi.com>
Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
上级 46de63e2
...@@ -4249,7 +4249,7 @@ megasas_set_dma_mask(struct pci_dev *pdev) ...@@ -4249,7 +4249,7 @@ megasas_set_dma_mask(struct pci_dev *pdev)
static int megasas_probe_one(struct pci_dev *pdev, static int megasas_probe_one(struct pci_dev *pdev,
const struct pci_device_id *id) const struct pci_device_id *id)
{ {
int rval, pos, i, j; int rval, pos, i, j, cpu;
struct Scsi_Host *host; struct Scsi_Host *host;
struct megasas_instance *instance; struct megasas_instance *instance;
u16 control = 0; u16 control = 0;
...@@ -4422,7 +4422,8 @@ static int megasas_probe_one(struct pci_dev *pdev, ...@@ -4422,7 +4422,8 @@ static int megasas_probe_one(struct pci_dev *pdev,
* Register IRQ * Register IRQ
*/ */
if (instance->msix_vectors) { if (instance->msix_vectors) {
for (i = 0 ; i < instance->msix_vectors; i++) { cpu = cpumask_first(cpu_online_mask);
for (i = 0; i < instance->msix_vectors; i++) {
instance->irq_context[i].instance = instance; instance->irq_context[i].instance = instance;
instance->irq_context[i].MSIxIndex = i; instance->irq_context[i].MSIxIndex = i;
if (request_irq(instance->msixentry[i].vector, if (request_irq(instance->msixentry[i].vector,
...@@ -4431,14 +4432,22 @@ static int megasas_probe_one(struct pci_dev *pdev, ...@@ -4431,14 +4432,22 @@ static int megasas_probe_one(struct pci_dev *pdev,
&instance->irq_context[i])) { &instance->irq_context[i])) {
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(
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]);
}
/* Retry irq register for IO_APIC */ /* Retry irq register for IO_APIC */
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,
get_cpu_mask(cpu)))
dev_err(&instance->pdev->dev, "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;
...@@ -4492,9 +4501,12 @@ static int megasas_probe_one(struct pci_dev *pdev, ...@@ -4492,9 +4501,12 @@ 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(
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]);
}
else else
free_irq(instance->pdev->irq, &instance->irq_context[0]); free_irq(instance->pdev->irq, &instance->irq_context[0]);
fail_irq: fail_irq:
...@@ -4648,9 +4660,12 @@ megasas_suspend(struct pci_dev *pdev, pm_message_t state) ...@@ -4648,9 +4660,12 @@ megasas_suspend(struct pci_dev *pdev, pm_message_t state)
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(
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]);
}
else else
free_irq(instance->pdev->irq, &instance->irq_context[0]); free_irq(instance->pdev->irq, &instance->irq_context[0]);
if (instance->msix_vectors) if (instance->msix_vectors)
...@@ -4671,7 +4686,7 @@ megasas_suspend(struct pci_dev *pdev, pm_message_t state) ...@@ -4671,7 +4686,7 @@ megasas_suspend(struct pci_dev *pdev, pm_message_t state)
static int static int
megasas_resume(struct pci_dev *pdev) megasas_resume(struct pci_dev *pdev)
{ {
int rval, i, j; int rval, i, j, cpu;
struct Scsi_Host *host; struct Scsi_Host *host;
struct megasas_instance *instance; struct megasas_instance *instance;
...@@ -4743,6 +4758,7 @@ megasas_resume(struct pci_dev *pdev) ...@@ -4743,6 +4758,7 @@ megasas_resume(struct pci_dev *pdev)
* Register IRQ * Register IRQ
*/ */
if (instance->msix_vectors) { if (instance->msix_vectors) {
cpu = cpumask_first(cpu_online_mask);
for (i = 0 ; i < instance->msix_vectors; i++) { for (i = 0 ; i < instance->msix_vectors; i++) {
instance->irq_context[i].instance = instance; instance->irq_context[i].instance = instance;
instance->irq_context[i].MSIxIndex = i; instance->irq_context[i].MSIxIndex = i;
...@@ -4752,12 +4768,21 @@ megasas_resume(struct pci_dev *pdev) ...@@ -4752,12 +4768,21 @@ megasas_resume(struct pci_dev *pdev)
&instance->irq_context[i])) { &instance->irq_context[i])) {
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(
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]);
}
goto fail_irq; goto fail_irq;
} }
if (irq_set_affinity_hint(instance->msixentry[i].vector,
get_cpu_mask(cpu)))
dev_err(&instance->pdev->dev, "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;
...@@ -4856,9 +4881,12 @@ static void megasas_detach_one(struct pci_dev *pdev) ...@@ -4856,9 +4881,12 @@ static void megasas_detach_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(
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]);
}
else else
free_irq(instance->pdev->irq, &instance->irq_context[0]); free_irq(instance->pdev->irq, &instance->irq_context[0]);
if (instance->msix_vectors) if (instance->msix_vectors)
...@@ -4913,9 +4941,12 @@ static void megasas_shutdown(struct pci_dev *pdev) ...@@ -4913,9 +4941,12 @@ static void megasas_shutdown(struct pci_dev *pdev)
megasas_shutdown_controller(instance, MR_DCMD_CTRL_SHUTDOWN); megasas_shutdown_controller(instance, MR_DCMD_CTRL_SHUTDOWN);
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(
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]);
}
else else
free_irq(instance->pdev->irq, &instance->irq_context[0]); free_irq(instance->pdev->irq, &instance->irq_context[0]);
if (instance->msix_vectors) if (instance->msix_vectors)
......
...@@ -1614,6 +1614,8 @@ megasas_build_dcdb_fusion(struct megasas_instance *instance, ...@@ -1614,6 +1614,8 @@ megasas_build_dcdb_fusion(struct megasas_instance *instance,
MEGASAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT); MEGASAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT);
cmd->request_desc->SCSIIO.DevHandle = cmd->request_desc->SCSIIO.DevHandle =
local_map_ptr->raidMap.devHndlInfo[device_id].curDevHdl; local_map_ptr->raidMap.devHndlInfo[device_id].curDevHdl;
cmd->request_desc->SCSIIO.MSIxIndex =
instance->msix_vectors ? smp_processor_id() % instance->msix_vectors : 0;
/* /*
* If the command is for the tape device, set the * If the command is for the tape device, set the
* FP timeout to the os layer timeout value. * FP timeout to the os layer timeout value.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册