* [PATCH] qla2xxx: Resolved a performance issue in interrupt handler
@ 2009-06-09 18:42 Anirban Chakraborty
2009-06-09 19:32 ` James Bottomley
0 siblings, 1 reply; 24+ messages in thread
From: Anirban Chakraborty @ 2009-06-09 18:42 UTC (permalink / raw)
To: linux-scsi; +Cc: douglas.w.styner, James.Bottomley
Reverted back a change from spin_lock to spin_lock_irq* that was causing
the cycle times to go up.
The patch is based on scsi-misc-2.6.
Reported-and-checked-by: Douglas W. Styner <douglas.w.styner@intel.com>
Signed-off-by: Anirban Chakraborty <anirban.chakraborty@qlogic.com>
---
drivers/scsi/qla2xxx/qla_isr.c | 30 ++++++++++++++++++------------
1 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index c8d0a17..bc92feb 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -37,6 +37,7 @@ qla2100_intr_handler(int irq, void *dev_id)
uint16_t hccr;
uint16_t mb[4];
struct rsp_que *rsp;
+ unsigned long flags;
rsp = (struct rsp_que *) dev_id;
if (!rsp) {
@@ -49,7 +50,7 @@ qla2100_intr_handler(int irq, void *dev_id)
reg = &ha->iobase->isp;
status = 0;
- spin_lock(&ha->hardware_lock);
+ spin_lock_irqsave(&ha->hardware_lock, flags);
vha = pci_get_drvdata(ha->pdev);
for (iter = 50; iter--; ) {
hccr = RD_REG_WORD(®->hccr);
@@ -101,7 +102,7 @@ qla2100_intr_handler(int irq, void *dev_id)
RD_REG_WORD(®->hccr);
}
}
- spin_unlock(&ha->hardware_lock);
+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags) &&
(status & MBX_INTERRUPT) && ha->flags.mbox_int) {
@@ -133,6 +134,7 @@ qla2300_intr_handler(int irq, void *dev_id)
uint16_t mb[4];
struct rsp_que *rsp;
struct qla_hw_data *ha;
+ unsigned long flags;
rsp = (struct rsp_que *) dev_id;
if (!rsp) {
@@ -145,7 +147,7 @@ qla2300_intr_handler(int irq, void *dev_id)
reg = &ha->iobase->isp;
status = 0;
- spin_lock(&ha->hardware_lock);
+ spin_lock_irqsave(&ha->hardware_lock, flags);
vha = pci_get_drvdata(ha->pdev);
for (iter = 50; iter--; ) {
stat = RD_REG_DWORD(®->u.isp2300.host_status);
@@ -216,7 +218,7 @@ qla2300_intr_handler(int irq, void *dev_id)
WRT_REG_WORD(®->hccr, HCCR_CLR_RISC_INT);
RD_REG_WORD_RELAXED(®->hccr);
}
- spin_unlock(&ha->hardware_lock);
+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags) &&
(status & MBX_INTERRUPT) && ha->flags.mbox_int) {
@@ -1626,6 +1628,7 @@ qla24xx_intr_handler(int irq, void *dev_id)
uint32_t hccr;
uint16_t mb[4];
struct rsp_que *rsp;
+ unsigned long flags;
rsp = (struct rsp_que *) dev_id;
if (!rsp) {
@@ -1638,7 +1641,7 @@ qla24xx_intr_handler(int irq, void *dev_id)
reg = &ha->iobase->isp24;
status = 0;
- spin_lock(&ha->hardware_lock);
+ spin_lock_irqsave(&ha->hardware_lock, flags);
vha = pci_get_drvdata(ha->pdev);
for (iter = 50; iter--; ) {
stat = RD_REG_DWORD(®->host_status);
@@ -1688,7 +1691,7 @@ qla24xx_intr_handler(int irq, void *dev_id)
WRT_REG_DWORD(®->hccr, HCCRX_CLR_RISC_INT);
RD_REG_DWORD_RELAXED(®->hccr);
}
- spin_unlock(&ha->hardware_lock);
+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags) &&
(status & MBX_INTERRUPT) && ha->flags.mbox_int) {
@@ -1706,6 +1709,7 @@ qla24xx_msix_rsp_q(int irq, void *dev_id)
struct rsp_que *rsp;
struct device_reg_24xx __iomem *reg;
struct scsi_qla_host *vha;
+ unsigned long flags;
rsp = (struct rsp_que *) dev_id;
if (!rsp) {
@@ -1716,13 +1720,13 @@ qla24xx_msix_rsp_q(int irq, void *dev_id)
ha = rsp->hw;
reg = &ha->iobase->isp24;
- spin_lock_irq(&ha->hardware_lock);
+ spin_lock_irqsave(&ha->hardware_lock, flags);
vha = qla25xx_get_host(rsp);
qla24xx_process_response_queue(vha, rsp);
WRT_REG_DWORD(®->hccr, HCCRX_CLR_RISC_INT);
- spin_unlock_irq(&ha->hardware_lock);
+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
return IRQ_HANDLED;
}
@@ -1757,6 +1761,7 @@ qla24xx_msix_default(int irq, void *dev_id)
uint32_t stat;
uint32_t hccr;
uint16_t mb[4];
+ unsigned long flags;
rsp = (struct rsp_que *) dev_id;
if (!rsp) {
@@ -1768,7 +1773,7 @@ qla24xx_msix_default(int irq, void *dev_id)
reg = &ha->iobase->isp24;
status = 0;
- spin_lock_irq(&ha->hardware_lock);
+ spin_lock_irqsave(&ha->hardware_lock, flags);
vha = pci_get_drvdata(ha->pdev);
do {
stat = RD_REG_DWORD(®->host_status);
@@ -1817,7 +1822,7 @@ qla24xx_msix_default(int irq, void *dev_id)
}
WRT_REG_DWORD(®->hccr, HCCRX_CLR_RISC_INT);
} while (0);
- spin_unlock_irq(&ha->hardware_lock);
+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags) &&
(status & MBX_INTERRUPT) && ha->flags.mbox_int) {
@@ -1940,6 +1945,7 @@ int
qla2x00_request_irqs(struct qla_hw_data *ha, struct rsp_que *rsp)
{
int ret;
+ unsigned long flags;
device_reg_t __iomem *reg = ha->iobase;
/* If possible, enable MSI-X. */
@@ -2007,7 +2013,7 @@ clear_risc_ints:
*/
if (IS_QLA81XX(ha))
goto fail;
- spin_lock_irq(&ha->hardware_lock);
+ spin_lock_irqsave(&ha->hardware_lock, flags);
if (IS_FWI2_CAPABLE(ha)) {
WRT_REG_DWORD(®->isp24.hccr, HCCRX_CLR_HOST_INT);
WRT_REG_DWORD(®->isp24.hccr, HCCRX_CLR_RISC_INT);
@@ -2016,7 +2022,7 @@ clear_risc_ints:
WRT_REG_WORD(®->isp.hccr, HCCR_CLR_RISC_INT);
WRT_REG_WORD(®->isp.hccr, HCCR_CLR_HOST_INT);
}
- spin_unlock_irq(&ha->hardware_lock);
+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
fail:
return ret;
--
1.5.5
^ permalink raw reply related [flat|nested] 24+ messages in thread* Re: [PATCH] qla2xxx: Resolved a performance issue in interrupt handler
2009-06-09 18:42 [PATCH] qla2xxx: Resolved a performance issue in interrupt handler Anirban Chakraborty
@ 2009-06-09 19:32 ` James Bottomley
2009-06-09 20:34 ` Anirban Chakraborty
0 siblings, 1 reply; 24+ messages in thread
From: James Bottomley @ 2009-06-09 19:32 UTC (permalink / raw)
To: Anirban Chakraborty; +Cc: linux-scsi, douglas.w.styner
On Tue, 2009-06-09 at 11:42 -0700, Anirban Chakraborty wrote:
> Reverted back a change from spin_lock to spin_lock_irq* that was causing
> the cycle times to go up.
> The patch is based on scsi-misc-2.6.
Some more explanation of this would be greatly appreciated. The cause
looks to be that holding off interrupts in the isr could potentially
reduce latency (caused by taking a different interrupt while holding the
hardware lock) and increase the chance of coalescing (by holding off
interrupts). However, if that's the case, possibly using an
IRQF_DISABLED isr rather than going back to spin_lock_irqsave() would be
a better fix?
> Reported-and-checked-by: Douglas W. Styner <douglas.w.styner@intel.com>
> Signed-off-by: Anirban Chakraborty <anirban.chakraborty@qlogic.com>
> ---
> drivers/scsi/qla2xxx/qla_isr.c | 30 ++++++++++++++++++------------
> 1 files changed, 18 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
> index c8d0a17..bc92feb 100644
> --- a/drivers/scsi/qla2xxx/qla_isr.c
> +++ b/drivers/scsi/qla2xxx/qla_isr.c
> @@ -37,6 +37,7 @@ qla2100_intr_handler(int irq, void *dev_id)
> uint16_t hccr;
> uint16_t mb[4];
> struct rsp_que *rsp;
> + unsigned long flags;
>
> rsp = (struct rsp_que *) dev_id;
> if (!rsp) {
> @@ -49,7 +50,7 @@ qla2100_intr_handler(int irq, void *dev_id)
> reg = &ha->iobase->isp;
> status = 0;
>
> - spin_lock(&ha->hardware_lock);
> + spin_lock_irqsave(&ha->hardware_lock, flags);
> vha = pci_get_drvdata(ha->pdev);
> for (iter = 50; iter--; ) {
> hccr = RD_REG_WORD(®->hccr);
> @@ -101,7 +102,7 @@ qla2100_intr_handler(int irq, void *dev_id)
> RD_REG_WORD(®->hccr);
> }
> }
> - spin_unlock(&ha->hardware_lock);
> + spin_unlock_irqrestore(&ha->hardware_lock, flags);
>
> if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags) &&
> (status & MBX_INTERRUPT) && ha->flags.mbox_int) {
> @@ -133,6 +134,7 @@ qla2300_intr_handler(int irq, void *dev_id)
> uint16_t mb[4];
> struct rsp_que *rsp;
> struct qla_hw_data *ha;
> + unsigned long flags;
>
> rsp = (struct rsp_que *) dev_id;
> if (!rsp) {
> @@ -145,7 +147,7 @@ qla2300_intr_handler(int irq, void *dev_id)
> reg = &ha->iobase->isp;
> status = 0;
>
> - spin_lock(&ha->hardware_lock);
> + spin_lock_irqsave(&ha->hardware_lock, flags);
> vha = pci_get_drvdata(ha->pdev);
> for (iter = 50; iter--; ) {
> stat = RD_REG_DWORD(®->u.isp2300.host_status);
> @@ -216,7 +218,7 @@ qla2300_intr_handler(int irq, void *dev_id)
> WRT_REG_WORD(®->hccr, HCCR_CLR_RISC_INT);
> RD_REG_WORD_RELAXED(®->hccr);
> }
> - spin_unlock(&ha->hardware_lock);
> + spin_unlock_irqrestore(&ha->hardware_lock, flags);
>
> if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags) &&
> (status & MBX_INTERRUPT) && ha->flags.mbox_int) {
> @@ -1626,6 +1628,7 @@ qla24xx_intr_handler(int irq, void *dev_id)
> uint32_t hccr;
> uint16_t mb[4];
> struct rsp_que *rsp;
> + unsigned long flags;
>
> rsp = (struct rsp_que *) dev_id;
> if (!rsp) {
> @@ -1638,7 +1641,7 @@ qla24xx_intr_handler(int irq, void *dev_id)
> reg = &ha->iobase->isp24;
> status = 0;
>
> - spin_lock(&ha->hardware_lock);
> + spin_lock_irqsave(&ha->hardware_lock, flags);
> vha = pci_get_drvdata(ha->pdev);
> for (iter = 50; iter--; ) {
> stat = RD_REG_DWORD(®->host_status);
> @@ -1688,7 +1691,7 @@ qla24xx_intr_handler(int irq, void *dev_id)
> WRT_REG_DWORD(®->hccr, HCCRX_CLR_RISC_INT);
> RD_REG_DWORD_RELAXED(®->hccr);
> }
> - spin_unlock(&ha->hardware_lock);
> + spin_unlock_irqrestore(&ha->hardware_lock, flags);
>
> if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags) &&
> (status & MBX_INTERRUPT) && ha->flags.mbox_int) {
> @@ -1706,6 +1709,7 @@ qla24xx_msix_rsp_q(int irq, void *dev_id)
> struct rsp_que *rsp;
> struct device_reg_24xx __iomem *reg;
> struct scsi_qla_host *vha;
> + unsigned long flags;
>
> rsp = (struct rsp_que *) dev_id;
> if (!rsp) {
> @@ -1716,13 +1720,13 @@ qla24xx_msix_rsp_q(int irq, void *dev_id)
> ha = rsp->hw;
> reg = &ha->iobase->isp24;
>
> - spin_lock_irq(&ha->hardware_lock);
> + spin_lock_irqsave(&ha->hardware_lock, flags);
This doesn't make a lot of sense. I can see in the ordinary isr above,
you were using spin_lock not spin_lock_irq, so you were going into the
spin with other interrupts enabled. However, in the MSIX case, the net
effect of the code (since we enter with interrupts enabled) is nil plus
the small latency saving and restoring the flags.
I'm assuming Intel did the tests on a MSIX system, so I have a hard time
understanding how this could in any way fix their problem.
James
^ permalink raw reply [flat|nested] 24+ messages in thread* Re: [PATCH] qla2xxx: Resolved a performance issue in interrupt handler
2009-06-09 19:32 ` James Bottomley
@ 2009-06-09 20:34 ` Anirban Chakraborty
2009-06-09 20:40 ` James Bottomley
0 siblings, 1 reply; 24+ messages in thread
From: Anirban Chakraborty @ 2009-06-09 20:34 UTC (permalink / raw)
To: James Bottomley; +Cc: linux-scsi@vger.kernel.org, douglas.w.styner@intel.com
On Jun 9, 2009, at 12:32 PM, James Bottomley wrote:
> On Tue, 2009-06-09 at 11:42 -0700, Anirban Chakraborty wrote:
>> Reverted back a change from spin_lock to spin_lock_irq* that was
>> causing
>> the cycle times to go up.
>> The patch is based on scsi-misc-2.6.
>
> Some more explanation of this would be greatly appreciated. The cause
> looks to be that holding off interrupts in the isr could potentially
> reduce latency (caused by taking a different interrupt while holding
> the
> hardware lock) and increase the chance of coalescing (by holding off
> interrupts). However, if that's the case, possibly using an
> IRQF_DISABLED isr rather than going back to spin_lock_irqsave()
> would be
> a better fix?
The primary cause is, as you mentioned, the contention for the
hardware lock in the isr.
I'll check it with IRQF_DISABLED too. However, I was wondering if
there is any additional savings if we use IRQF_DISABLED vs. using the
spin_lock_irqsave. In the former case, probably we'd enter the isr
with interrupts disabled and in the latter case it would be done upon
entering the isr.
>
>
>> Reported-and-checked-by: Douglas W. Styner <douglas.w.styner@intel.com
>> >
>> Signed-off-by: Anirban Chakraborty <anirban.chakraborty@qlogic.com>
>> ---
>> drivers/scsi/qla2xxx/qla_isr.c | 30 ++++++++++++++++++------------
>> 1 files changed, 18 insertions(+), 12 deletions(-)
>>
>> diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/
>> qla_isr.c
>> index c8d0a17..bc92feb 100644
>> --- a/drivers/scsi/qla2xxx/qla_isr.c
>> +++ b/drivers/scsi/qla2xxx/qla_isr.c
>> @@ -37,6 +37,7 @@ qla2100_intr_handler(int irq, void *dev_id)
>> uint16_t hccr;
>> uint16_t mb[4];
>> struct rsp_que *rsp;
>> + unsigned long flags;
>>
>> rsp = (struct rsp_que *) dev_id;
>> if (!rsp) {
>> @@ -49,7 +50,7 @@ qla2100_intr_handler(int irq, void *dev_id)
>> reg = &ha->iobase->isp;
>> status = 0;
>>
>> - spin_lock(&ha->hardware_lock);
>> + spin_lock_irqsave(&ha->hardware_lock, flags);
>> vha = pci_get_drvdata(ha->pdev);
>> for (iter = 50; iter--; ) {
>> hccr = RD_REG_WORD(®->hccr);
>> @@ -101,7 +102,7 @@ qla2100_intr_handler(int irq, void *dev_id)
>> RD_REG_WORD(®->hccr);
>> }
>> }
>> - spin_unlock(&ha->hardware_lock);
>> + spin_unlock_irqrestore(&ha->hardware_lock, flags);
>>
>> if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags) &&
>> (status & MBX_INTERRUPT) && ha->flags.mbox_int) {
>> @@ -133,6 +134,7 @@ qla2300_intr_handler(int irq, void *dev_id)
>> uint16_t mb[4];
>> struct rsp_que *rsp;
>> struct qla_hw_data *ha;
>> + unsigned long flags;
>>
>> rsp = (struct rsp_que *) dev_id;
>> if (!rsp) {
>> @@ -145,7 +147,7 @@ qla2300_intr_handler(int irq, void *dev_id)
>> reg = &ha->iobase->isp;
>> status = 0;
>>
>> - spin_lock(&ha->hardware_lock);
>> + spin_lock_irqsave(&ha->hardware_lock, flags);
>> vha = pci_get_drvdata(ha->pdev);
>> for (iter = 50; iter--; ) {
>> stat = RD_REG_DWORD(®->u.isp2300.host_status);
>> @@ -216,7 +218,7 @@ qla2300_intr_handler(int irq, void *dev_id)
>> WRT_REG_WORD(®->hccr, HCCR_CLR_RISC_INT);
>> RD_REG_WORD_RELAXED(®->hccr);
>> }
>> - spin_unlock(&ha->hardware_lock);
>> + spin_unlock_irqrestore(&ha->hardware_lock, flags);
>>
>> if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags) &&
>> (status & MBX_INTERRUPT) && ha->flags.mbox_int) {
>> @@ -1626,6 +1628,7 @@ qla24xx_intr_handler(int irq, void *dev_id)
>> uint32_t hccr;
>> uint16_t mb[4];
>> struct rsp_que *rsp;
>> + unsigned long flags;
>>
>> rsp = (struct rsp_que *) dev_id;
>> if (!rsp) {
>> @@ -1638,7 +1641,7 @@ qla24xx_intr_handler(int irq, void *dev_id)
>> reg = &ha->iobase->isp24;
>> status = 0;
>>
>> - spin_lock(&ha->hardware_lock);
>> + spin_lock_irqsave(&ha->hardware_lock, flags);
>> vha = pci_get_drvdata(ha->pdev);
>> for (iter = 50; iter--; ) {
>> stat = RD_REG_DWORD(®->host_status);
>> @@ -1688,7 +1691,7 @@ qla24xx_intr_handler(int irq, void *dev_id)
>> WRT_REG_DWORD(®->hccr, HCCRX_CLR_RISC_INT);
>> RD_REG_DWORD_RELAXED(®->hccr);
>> }
>> - spin_unlock(&ha->hardware_lock);
>> + spin_unlock_irqrestore(&ha->hardware_lock, flags);
>>
>> if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags) &&
>> (status & MBX_INTERRUPT) && ha->flags.mbox_int) {
>> @@ -1706,6 +1709,7 @@ qla24xx_msix_rsp_q(int irq, void *dev_id)
>> struct rsp_que *rsp;
>> struct device_reg_24xx __iomem *reg;
>> struct scsi_qla_host *vha;
>> + unsigned long flags;
>>
>> rsp = (struct rsp_que *) dev_id;
>> if (!rsp) {
>> @@ -1716,13 +1720,13 @@ qla24xx_msix_rsp_q(int irq, void *dev_id)
>> ha = rsp->hw;
>> reg = &ha->iobase->isp24;
>>
>> - spin_lock_irq(&ha->hardware_lock);
>> + spin_lock_irqsave(&ha->hardware_lock, flags);
>
> This doesn't make a lot of sense. I can see in the ordinary isr
> above,
> you were using spin_lock not spin_lock_irq, so you were going into the
> spin with other interrupts enabled. However, in the MSIX case, the
> net
> effect of the code (since we enter with interrupts enabled) is nil
> plus
> the small latency saving and restoring the flags.
>
> I'm assuming Intel did the tests on a MSIX system, so I have a hard
> time
> understanding how this could in any way fix their problem.
>
> James
>
They did their tests on a system with MSI enabled, for which the
qla24xx_intr_handler gets invoked. So, the qla24xx_msix_rsp_q never
got tested in that case. However, I do agree that spin_lock_irqsave is
not needed in the MSI-X case as you mentioned that the interrupts are
already disabled here.
Thanks,
-Anirban
^ permalink raw reply [flat|nested] 24+ messages in thread* Re: [PATCH] qla2xxx: Resolved a performance issue in interrupt handler
2009-06-09 20:34 ` Anirban Chakraborty
@ 2009-06-09 20:40 ` James Bottomley
2009-06-09 21:28 ` Giridhar Malavali
2009-06-09 21:40 ` Anirban Chakraborty
0 siblings, 2 replies; 24+ messages in thread
From: James Bottomley @ 2009-06-09 20:40 UTC (permalink / raw)
To: Anirban Chakraborty
Cc: linux-scsi@vger.kernel.org, douglas.w.styner@intel.com
On Tue, 2009-06-09 at 13:34 -0700, Anirban Chakraborty wrote:
> On Jun 9, 2009, at 12:32 PM, James Bottomley wrote:
>
> > On Tue, 2009-06-09 at 11:42 -0700, Anirban Chakraborty wrote:
> >> Reverted back a change from spin_lock to spin_lock_irq* that was
> >> causing
> >> the cycle times to go up.
> >> The patch is based on scsi-misc-2.6.
> >
> > Some more explanation of this would be greatly appreciated. The cause
> > looks to be that holding off interrupts in the isr could potentially
> > reduce latency (caused by taking a different interrupt while holding
> > the
> > hardware lock) and increase the chance of coalescing (by holding off
> > interrupts). However, if that's the case, possibly using an
> > IRQF_DISABLED isr rather than going back to spin_lock_irqsave()
> > would be
> > a better fix?
> The primary cause is, as you mentioned, the contention for the
> hardware lock in the isr.
> I'll check it with IRQF_DISABLED too. However, I was wondering if
> there is any additional savings if we use IRQF_DISABLED vs. using the
> spin_lock_irqsave. In the former case, probably we'd enter the isr
> with interrupts disabled and in the latter case it would be done upon
> entering the isr.
It depends what the root cause is ... if it's really latency introduced
by other interrupts, then IRQF_DISABLED might be the better course. If
it's purely interrupt problems in the spin locked critical sections,
then spin_lock_irq might be the better solution ... what would be useful
is to have the test rig at intel which turned up the problem see what
happens to the results for each case.
James
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] qla2xxx: Resolved a performance issue in interrupt handler
2009-06-09 20:40 ` James Bottomley
@ 2009-06-09 21:28 ` Giridhar Malavali
2009-06-09 21:41 ` Matthew Wilcox
2009-06-09 21:46 ` James Bottomley
2009-06-09 21:40 ` Anirban Chakraborty
1 sibling, 2 replies; 24+ messages in thread
From: Giridhar Malavali @ 2009-06-09 21:28 UTC (permalink / raw)
To: Anirban Chakraborty; +Cc: linux-scsi, douglas.w.styner, James Bottomley
On Jun 9, 2009, at 1:40 PM, James Bottomley wrote:
> On Tue, 2009-06-09 at 13:34 -0700, Anirban Chakraborty wrote:
>> On Jun 9, 2009, at 12:32 PM, James Bottomley wrote:
>>
>>> On Tue, 2009-06-09 at 11:42 -0700, Anirban Chakraborty wrote:
>>>> Reverted back a change from spin_lock to spin_lock_irq* that was
>>>> causing
>>>> the cycle times to go up.
>>>> The patch is based on scsi-misc-2.6.
>>>
>>> Some more explanation of this would be greatly appreciated. The
>>> cause
>>> looks to be that holding off interrupts in the isr could potentially
>>> reduce latency (caused by taking a different interrupt while holding
>>> the
>>> hardware lock) and increase the chance of coalescing (by holding off
>>> interrupts). However, if that's the case, possibly using an
>>> IRQF_DISABLED isr rather than going back to spin_lock_irqsave()
>>> would be
>>> a better fix?
>> The primary cause is, as you mentioned, the contention for the
>> hardware lock in the isr.
>> I'll check it with IRQF_DISABLED too. However, I was wondering if
>> there is any additional savings if we use IRQF_DISABLED vs. using the
>> spin_lock_irqsave. In the former case, probably we'd enter the isr
>> with interrupts disabled and in the latter case it would be done upon
>> entering the isr.
>
> It depends what the root cause is ... if it's really latency
> introduced
> by other interrupts, then IRQF_DISABLED might be the better course.
> If
> it's purely interrupt problems in the spin locked critical sections,
> then spin_lock_irq might be the better solution ... what would be
> useful
> is to have the test rig at intel which turned up the problem see what
> happens to the results for each case.
>
> James
>
>
Earlier, I have seen that when IRQ's are shared across multiple
controllers and if the first one to register (among shared
controllers) does not disable the IRQ with IRQF_DISABLED flag,then
irrespective of the IRQ registration from other controllers, the IRQ
will be enabled by default. With this behavior and qla2xxx sharing the
IRQ, just disabling the IRQ may not be sufficient.
Giridhar.M.B
> --
> 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
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] qla2xxx: Resolved a performance issue in interrupt handler
2009-06-09 21:28 ` Giridhar Malavali
@ 2009-06-09 21:41 ` Matthew Wilcox
2009-06-09 21:46 ` James Bottomley
1 sibling, 0 replies; 24+ messages in thread
From: Matthew Wilcox @ 2009-06-09 21:41 UTC (permalink / raw)
To: Giridhar Malavali
Cc: Anirban Chakraborty, linux-scsi, douglas.w.styner,
James Bottomley, Peter Zijlstra
On Tue, Jun 09, 2009 at 02:28:01PM -0700, Giridhar Malavali wrote:
> On Jun 9, 2009, at 1:40 PM, James Bottomley wrote:
>> It depends what the root cause is ... if it's really latency
>> introduced
>> by other interrupts, then IRQF_DISABLED might be the better course.
>> If
>> it's purely interrupt problems in the spin locked critical sections,
>> then spin_lock_irq might be the better solution ... what would be
>> useful
>> is to have the test rig at intel which turned up the problem see what
>> happens to the results for each case.
>
> Earlier, I have seen that when IRQ's are shared across multiple
> controllers and if the first one to register (among shared controllers)
> does not disable the IRQ with IRQF_DISABLED flag,then irrespective of the
> IRQ registration from other controllers, the IRQ will be enabled by
> default. With this behavior and qla2xxx sharing the IRQ, just disabling
> the IRQ may not be sufficient.
But MSI interrupts are never shared. Also, almost every driver *should*
be using IRQF_DISABLED these days (there was a proposal to eliminate
IRQF_DISABLED and force every driver to explicitly re-enable interrupts
if it needed them on back in March).
--
Matthew Wilcox Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours. We can't possibly take such
a retrograde step."
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] qla2xxx: Resolved a performance issue in interrupt handler
2009-06-09 21:28 ` Giridhar Malavali
2009-06-09 21:41 ` Matthew Wilcox
@ 2009-06-09 21:46 ` James Bottomley
1 sibling, 0 replies; 24+ messages in thread
From: James Bottomley @ 2009-06-09 21:46 UTC (permalink / raw)
To: Giridhar Malavali; +Cc: Anirban Chakraborty, linux-scsi, douglas.w.styner
On Tue, 2009-06-09 at 14:28 -0700, Giridhar Malavali wrote:
> On Jun 9, 2009, at 1:40 PM, James Bottomley wrote:
>
> > On Tue, 2009-06-09 at 13:34 -0700, Anirban Chakraborty wrote:
> >> On Jun 9, 2009, at 12:32 PM, James Bottomley wrote:
> >>
> >>> On Tue, 2009-06-09 at 11:42 -0700, Anirban Chakraborty wrote:
> >>>> Reverted back a change from spin_lock to spin_lock_irq* that was
> >>>> causing
> >>>> the cycle times to go up.
> >>>> The patch is based on scsi-misc-2.6.
> >>>
> >>> Some more explanation of this would be greatly appreciated. The
> >>> cause
> >>> looks to be that holding off interrupts in the isr could potentially
> >>> reduce latency (caused by taking a different interrupt while holding
> >>> the
> >>> hardware lock) and increase the chance of coalescing (by holding off
> >>> interrupts). However, if that's the case, possibly using an
> >>> IRQF_DISABLED isr rather than going back to spin_lock_irqsave()
> >>> would be
> >>> a better fix?
> >> The primary cause is, as you mentioned, the contention for the
> >> hardware lock in the isr.
> >> I'll check it with IRQF_DISABLED too. However, I was wondering if
> >> there is any additional savings if we use IRQF_DISABLED vs. using the
> >> spin_lock_irqsave. In the former case, probably we'd enter the isr
> >> with interrupts disabled and in the latter case it would be done upon
> >> entering the isr.
> >
> > It depends what the root cause is ... if it's really latency
> > introduced
> > by other interrupts, then IRQF_DISABLED might be the better course.
> > If
> > it's purely interrupt problems in the spin locked critical sections,
> > then spin_lock_irq might be the better solution ... what would be
> > useful
> > is to have the test rig at intel which turned up the problem see what
> > happens to the results for each case.
> >
> > James
> >
> >
> Earlier, I have seen that when IRQ's are shared across multiple
> controllers and if the first one to register (among shared
> controllers) does not disable the IRQ with IRQF_DISABLED flag,then
> irrespective of the IRQ registration from other controllers, the IRQ
> will be enabled by default. With this behavior and qla2xxx sharing the
> IRQ, just disabling the IRQ may not be sufficient.
Well, they're MSI interrupts, so unshared. However, an equivalent trick
is just to do local_irq_disable() at the top of the interrupt routine.
There was a thread about making IRQF_DISABLED the default, which is what
made me think about it.
Anyway, I think the point is it would be interesting to see if we can
improve performance by holding off interrupts for all of the qla isr ...
if this is validated, we can move on to implementation discussions.
James
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] qla2xxx: Resolved a performance issue in interrupt handler
2009-06-09 20:40 ` James Bottomley
2009-06-09 21:28 ` Giridhar Malavali
@ 2009-06-09 21:40 ` Anirban Chakraborty
2009-06-09 21:43 ` Matthew Wilcox
[not found] ` <D7C42C27E6CB1E4D8CBDF2F81EA92A26035402EBA0@azsmsx501.amr.corp.intel.com>
1 sibling, 2 replies; 24+ messages in thread
From: Anirban Chakraborty @ 2009-06-09 21:40 UTC (permalink / raw)
To: James Bottomley
Cc: Anirban Chakraborty, linux-scsi@vger.kernel.org,
douglas.w.styner@intel.com
On Tue, 9 Jun 2009, James Bottomley wrote:
> On Tue, 2009-06-09 at 13:34 -0700, Anirban Chakraborty wrote:
> > On Jun 9, 2009, at 12:32 PM, James Bottomley wrote:
> >
> > > On Tue, 2009-06-09 at 11:42 -0700, Anirban Chakraborty wrote:
> > >> Reverted back a change from spin_lock to spin_lock_irq* that was
> > >> causing
> > >> the cycle times to go up.
> > >> The patch is based on scsi-misc-2.6.
> > >
> > > Some more explanation of this would be greatly appreciated. The cause
> > > looks to be that holding off interrupts in the isr could potentially
> > > reduce latency (caused by taking a different interrupt while holding
> > > the
> > > hardware lock) and increase the chance of coalescing (by holding off
> > > interrupts). However, if that's the case, possibly using an
> > > IRQF_DISABLED isr rather than going back to spin_lock_irqsave()
> > > would be
> > > a better fix?
> > The primary cause is, as you mentioned, the contention for the
> > hardware lock in the isr.
> > I'll check it with IRQF_DISABLED too. However, I was wondering if
> > there is any additional savings if we use IRQF_DISABLED vs. using the
> > spin_lock_irqsave. In the former case, probably we'd enter the isr
> > with interrupts disabled and in the latter case it would be done upon
> > entering the isr.
>
> It depends what the root cause is ... if it's really latency introduced
> by other interrupts, then IRQF_DISABLED might be the better course. If
> it's purely interrupt problems in the spin locked critical sections,
> then spin_lock_irq might be the better solution ... what would be useful
> is to have the test rig at intel which turned up the problem see what
> happens to the results for each case.
>
> James
I have attached the patch with IRQF_DISABLED. In my setup, I didn't find any
significant difference in performance numbers between IRQF_DISABLED and
spin_lock_irqsave. It would be interesting to see the numbers from Douglas's
rig.
Doug, could you please run it once more with this patch and let us know the
numbers vs. the one you already tested with spin_lock_irqsave earlier.
Thanks much,
Anirban
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index c8d0a17..d07bd97 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -1991,7 +1991,7 @@ skip_msix:
skip_msi:
ret = request_irq(ha->pdev->irq, ha->isp_ops->intr_handler,
- IRQF_SHARED, QLA2XXX_DRIVER_NAME, rsp);
+ IRQF_DISABLED, QLA2XXX_DRIVER_NAME, rsp);
if (ret) {
qla_printk(KERN_WARNING, ha,
"Failed to reserve interrupt %d already in use.\n",
^ permalink raw reply related [flat|nested] 24+ messages in thread* Re: [PATCH] qla2xxx: Resolved a performance issue in interrupt handler
2009-06-09 21:40 ` Anirban Chakraborty
@ 2009-06-09 21:43 ` Matthew Wilcox
2009-06-09 21:46 ` Anirban Chakraborty
[not found] ` <D7C42C27E6CB1E4D8CBDF2F81EA92A26035402EBA0@azsmsx501.amr.corp.intel.com>
1 sibling, 1 reply; 24+ messages in thread
From: Matthew Wilcox @ 2009-06-09 21:43 UTC (permalink / raw)
To: Anirban Chakraborty
Cc: James Bottomley, linux-scsi@vger.kernel.org,
douglas.w.styner@intel.com
On Tue, Jun 09, 2009 at 02:40:44PM -0700, Anirban Chakraborty wrote:
> On Tue, 9 Jun 2009, James Bottomley wrote:
> > It depends what the root cause is ... if it's really latency introduced
> > by other interrupts, then IRQF_DISABLED might be the better course. If
> > it's purely interrupt problems in the spin locked critical sections,
> > then spin_lock_irq might be the better solution ... what would be useful
> > is to have the test rig at intel which turned up the problem see what
> > happens to the results for each case.
>
> I have attached the patch with IRQF_DISABLED. In my setup, I didn't find any
> significant difference in performance numbers between IRQF_DISABLED and
> spin_lock_irqsave. It would be interesting to see the numbers from Douglas's
> rig.
> Doug, could you please run it once more with this patch and let us know the
> numbers vs. the one you already tested with spin_lock_irqsave earlier.
> Thanks much,
> Anirban
>
> diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
> index c8d0a17..d07bd97 100644
> --- a/drivers/scsi/qla2xxx/qla_isr.c
> +++ b/drivers/scsi/qla2xxx/qla_isr.c
> @@ -1991,7 +1991,7 @@ skip_msix:
> skip_msi:
>
> ret = request_irq(ha->pdev->irq, ha->isp_ops->intr_handler,
> - IRQF_SHARED, QLA2XXX_DRIVER_NAME, rsp);
> + IRQF_DISABLED, QLA2XXX_DRIVER_NAME, rsp);
> if (ret) {
> qla_printk(KERN_WARNING, ha,
> "Failed to reserve interrupt %d already in use.\n",
While I don't think Doug has MSI-X adapters, a complete patch would change
all request_irq() calls to use IRQF_DISABLED, right?
--
Matthew Wilcox Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours. We can't possibly take such
a retrograde step."
^ permalink raw reply [flat|nested] 24+ messages in thread* Re: [PATCH] qla2xxx: Resolved a performance issue in interrupt handler
2009-06-09 21:43 ` Matthew Wilcox
@ 2009-06-09 21:46 ` Anirban Chakraborty
2009-06-09 21:47 ` Matthew Wilcox
0 siblings, 1 reply; 24+ messages in thread
From: Anirban Chakraborty @ 2009-06-09 21:46 UTC (permalink / raw)
To: Matthew Wilcox
Cc: James Bottomley, linux-scsi@vger.kernel.org,
douglas.w.styner@intel.com
On Jun 9, 2009, at 2:43 PM, Matthew Wilcox wrote:
> On Tue, Jun 09, 2009 at 02:40:44PM -0700, Anirban Chakraborty wrote:
>> On Tue, 9 Jun 2009, James Bottomley wrote:
>>> It depends what the root cause is ... if it's really latency
>>> introduced
>>> by other interrupts, then IRQF_DISABLED might be the better
>>> course. If
>>> it's purely interrupt problems in the spin locked critical sections,
>>> then spin_lock_irq might be the better solution ... what would be
>>> useful
>>> is to have the test rig at intel which turned up the problem see
>>> what
>>> happens to the results for each case.
>>
>> I have attached the patch with IRQF_DISABLED. In my setup, I didn't
>> find any
>> significant difference in performance numbers between IRQF_DISABLED
>> and
>> spin_lock_irqsave. It would be interesting to see the numbers from
>> Douglas's
>> rig.
>> Doug, could you please run it once more with this patch and let us
>> know the
>> numbers vs. the one you already tested with spin_lock_irqsave
>> earlier.
>> Thanks much,
>> Anirban
>>
>> diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/
>> qla_isr.c
>> index c8d0a17..d07bd97 100644
>> --- a/drivers/scsi/qla2xxx/qla_isr.c
>> +++ b/drivers/scsi/qla2xxx/qla_isr.c
>> @@ -1991,7 +1991,7 @@ skip_msix:
>> skip_msi:
>>
>> ret = request_irq(ha->pdev->irq, ha->isp_ops->intr_handler,
>> - IRQF_SHARED, QLA2XXX_DRIVER_NAME, rsp);
>> + IRQF_DISABLED, QLA2XXX_DRIVER_NAME, rsp);
>> if (ret) {
>> qla_printk(KERN_WARNING, ha,
>> "Failed to reserve interrupt %d already in use.\n",
>
> While I don't think Doug has MSI-X adapters, a complete patch would
> change
> all request_irq() calls to use IRQF_DISABLED, right?
>
> --
The above patch takes care of replacing all the IRQF_SHARED flags in
irq registrations with IRQF_DISABLED.
Thanks,
Anirban
^ permalink raw reply [flat|nested] 24+ messages in thread* Re: [PATCH] qla2xxx: Resolved a performance issue in interrupt handler
2009-06-09 21:46 ` Anirban Chakraborty
@ 2009-06-09 21:47 ` Matthew Wilcox
2009-06-09 22:30 ` Anirban Chakraborty
0 siblings, 1 reply; 24+ messages in thread
From: Matthew Wilcox @ 2009-06-09 21:47 UTC (permalink / raw)
To: Anirban Chakraborty
Cc: James Bottomley, linux-scsi@vger.kernel.org,
douglas.w.styner@intel.com
On Tue, Jun 09, 2009 at 02:46:12PM -0700, Anirban Chakraborty wrote:
>
> On Jun 9, 2009, at 2:43 PM, Matthew Wilcox wrote:
>> While I don't think Doug has MSI-X adapters, a complete patch would
>> change
>> all request_irq() calls to use IRQF_DISABLED, right?
>
> The above patch takes care of replacing all the IRQF_SHARED flags in irq
> registrations with IRQF_DISABLED.
Yes ... but even for the MSI-X case, you want the handler to be run with
interrupts disabled, don't you? If not, why not?
--
Matthew Wilcox Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours. We can't possibly take such
a retrograde step."
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] qla2xxx: Resolved a performance issue in interrupt handler
2009-06-09 21:47 ` Matthew Wilcox
@ 2009-06-09 22:30 ` Anirban Chakraborty
0 siblings, 0 replies; 24+ messages in thread
From: Anirban Chakraborty @ 2009-06-09 22:30 UTC (permalink / raw)
To: Matthew Wilcox
Cc: James Bottomley, linux-scsi@vger.kernel.org,
douglas.w.styner@intel.com
On Jun 9, 2009, at 2:47 PM, Matthew Wilcox wrote:
> On Tue, Jun 09, 2009 at 02:46:12PM -0700, Anirban Chakraborty wrote:
>>
>> On Jun 9, 2009, at 2:43 PM, Matthew Wilcox wrote:
>>> While I don't think Doug has MSI-X adapters, a complete patch would
>>> change
>>> all request_irq() calls to use IRQF_DISABLED, right?
>>
>> The above patch takes care of replacing all the IRQF_SHARED flags
>> in irq
>> registrations with IRQF_DISABLED.
>
> Yes ... but even for the MSI-X case, you want the handler to be run
> with
> interrupts disabled, don't you? If not, why not?
Yeah you're right. For some reason, request_irq for MSI-X passes 0 as
the irq flag. We need to take care of that.
Thanks,
Anirban
^ permalink raw reply [flat|nested] 24+ messages in thread
[parent not found: <D7C42C27E6CB1E4D8CBDF2F81EA92A26035402EBA0@azsmsx501.amr.corp.intel.com>]
[parent not found: <B8134F80-B547-4E04-890A-6B646D2BA3E8@qlogic.com>]
end of thread, other threads:[~2009-06-12 23:32 UTC | newest]
Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-09 18:42 [PATCH] qla2xxx: Resolved a performance issue in interrupt handler Anirban Chakraborty
2009-06-09 19:32 ` James Bottomley
2009-06-09 20:34 ` Anirban Chakraborty
2009-06-09 20:40 ` James Bottomley
2009-06-09 21:28 ` Giridhar Malavali
2009-06-09 21:41 ` Matthew Wilcox
2009-06-09 21:46 ` James Bottomley
2009-06-09 21:40 ` Anirban Chakraborty
2009-06-09 21:43 ` Matthew Wilcox
2009-06-09 21:46 ` Anirban Chakraborty
2009-06-09 21:47 ` Matthew Wilcox
2009-06-09 22:30 ` Anirban Chakraborty
[not found] ` <D7C42C27E6CB1E4D8CBDF2F81EA92A26035402EBA0@azsmsx501.amr.corp.intel.com>
[not found] ` <2796FDDF-31EA-44E2-8856-84A22F31A01F@qlogic.com>
2009-06-10 15:52 ` Styner, Douglas W
2009-06-10 16:09 ` Anirban Chakraborty
2009-06-10 16:17 ` James Bottomley
2009-06-10 16:18 ` Matthew Wilcox
2009-06-10 18:29 ` Anirban Chakraborty
2009-06-10 18:32 ` [PATCH] qla2xxx: Resolved a performance issue in interrupt Andrew Vasquez
2009-06-10 19:10 ` James Bottomley
2009-06-10 19:48 ` Matthew Wilcox
2009-06-10 20:55 ` Anirban Chakraborty
2009-06-12 22:48 ` Styner, Douglas W
2009-06-12 22:52 ` [PATCH] qla2xxx: Resolved a performance issue in interrupt - this time with data Styner, Douglas W
2009-06-12 23:32 ` Anirban Chakraborty
[not found] <B8134F80-B547-4E04-890A-6B646D2BA3E8@qlogic.com>
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox