Skip to content

Commit 764c2c3

Browse files
njavalinathan-zcgao
authored andcommitted
scsi: qla2xxx: Use raw_smp_processor_id() instead of smp_processor_id()
[ Upstream commit 59f10a0 ] The following call trace was observed: localhost kernel: nvme nvme0: NVME-FC{0}: controller connect complete localhost kernel: BUG: using smp_processor_id() in preemptible [00000000] code: kworker/u129:4/75092 localhost kernel: nvme nvme0: NVME-FC{0}: new ctrl: NQN "nqn.1992-08.com.netapp:sn.b42d198afb4d11ecad6d00a098d6abfa:subsystem.PR_Channel2022_RH84_subsystem_291" localhost kernel: caller is qla_nvme_post_cmd+0x216/0x1380 [qla2xxx] localhost kernel: CPU: 6 PID: 75092 Comm: kworker/u129:4 Kdump: loaded Tainted: G B W OE --------- --- 5.14.0-70.22.1.el9_0.x86_64+debug #1 localhost kernel: Hardware name: HPE ProLiant XL420 Gen10/ProLiant XL420 Gen10, BIOS U39 01/13/2022 localhost kernel: Workqueue: nvme-wq nvme_async_event_work [nvme_core] localhost kernel: Call Trace: localhost kernel: dump_stack_lvl+0x57/0x7d localhost kernel: check_preemption_disabled+0xc8/0xd0 localhost kernel: qla_nvme_post_cmd+0x216/0x1380 [qla2xxx] Use raw_smp_processor_id() instead of smp_processor_id(). Also use queue_work() across the driver instead of queue_work_on() thus avoiding usage of smp_processor_id() when CONFIG_DEBUG_PREEMPT is enabled. Cc: stable@vger.kernel.org Suggested-by: John Garry <john.g.garry@oracle.com> Signed-off-by: Nilesh Javali <njavali@marvell.com> Link: https://lore.kernel.org/r/20230831112146.32595-2-njavali@marvell.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Sasha Levin <sashal@kernel.org> [Take into account missing commit 532a239 ("scsi: qla2xxx: Select qpair depending on which CPU post_cmd() gets called") and drop the change in drivers/scsi/qla2xxx/qla_inline.h. The absense of this commit requires us to change an additional use of smp_processor_id to raw_smp_processor_id in qla24xx_process_response_queue.] Signed-off-by: Maximilian Heyne <mheyne@amazon.de>
1 parent bc00664 commit 764c2c3

3 files changed

Lines changed: 7 additions & 8 deletions

File tree

drivers/scsi/qla2xxx/qla_isr.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3423,9 +3423,9 @@ void qla24xx_process_response_queue(struct scsi_qla_host *vha,
34233423
if (!ha->flags.fw_started)
34243424
return;
34253425

3426-
if (rsp->qpair->cpuid != smp_processor_id() || !rsp->qpair->rcv_intr) {
3426+
if (rsp->qpair->cpuid != raw_smp_processor_id() || !rsp->qpair->rcv_intr) {
34273427
rsp->qpair->rcv_intr = 1;
3428-
qla_cpu_update(rsp->qpair, smp_processor_id());
3428+
qla_cpu_update(rsp->qpair, raw_smp_processor_id());
34293429
}
34303430

34313431
while (rsp->ring_ptr->signature != RESPONSE_PROCESSED) {
@@ -3876,7 +3876,7 @@ qla2xxx_msix_rsp_q(int irq, void *dev_id)
38763876
}
38773877
ha = qpair->hw;
38783878

3879-
queue_work_on(smp_processor_id(), ha->wq, &qpair->q_work);
3879+
queue_work(ha->wq, &qpair->q_work);
38803880

38813881
return IRQ_HANDLED;
38823882
}
@@ -3902,7 +3902,7 @@ qla2xxx_msix_rsp_q_hs(int irq, void *dev_id)
39023902
wrt_reg_dword(&reg->hccr, HCCRX_CLR_RISC_INT);
39033903
spin_unlock_irqrestore(&ha->hardware_lock, flags);
39043904

3905-
queue_work_on(smp_processor_id(), ha->wq, &qpair->q_work);
3905+
queue_work(ha->wq, &qpair->q_work);
39063906

39073907
return IRQ_HANDLED;
39083908
}

drivers/scsi/qla2xxx/qla_target.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4385,8 +4385,7 @@ static int qlt_handle_cmd_for_atio(struct scsi_qla_host *vha,
43854385
queue_work_on(cmd->se_cmd.cpuid, qla_tgt_wq, &cmd->work);
43864386
} else if (ha->msix_count) {
43874387
if (cmd->atio.u.isp24.fcp_cmnd.rddata)
4388-
queue_work_on(smp_processor_id(), qla_tgt_wq,
4389-
&cmd->work);
4388+
queue_work(qla_tgt_wq, &cmd->work);
43904389
else
43914390
queue_work_on(cmd->se_cmd.cpuid, qla_tgt_wq,
43924391
&cmd->work);

drivers/scsi/qla2xxx/tcm_qla2xxx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ static void tcm_qla2xxx_free_cmd(struct qla_tgt_cmd *cmd)
305305
cmd->trc_flags |= TRC_CMD_DONE;
306306

307307
INIT_WORK(&cmd->work, tcm_qla2xxx_complete_free);
308-
queue_work_on(smp_processor_id(), tcm_qla2xxx_free_wq, &cmd->work);
308+
queue_work(tcm_qla2xxx_free_wq, &cmd->work);
309309
}
310310

311311
/*
@@ -543,7 +543,7 @@ static void tcm_qla2xxx_handle_data(struct qla_tgt_cmd *cmd)
543543
cmd->trc_flags |= TRC_DATA_IN;
544544
cmd->cmd_in_wq = 1;
545545
INIT_WORK(&cmd->work, tcm_qla2xxx_handle_data_work);
546-
queue_work_on(smp_processor_id(), tcm_qla2xxx_free_wq, &cmd->work);
546+
queue_work(tcm_qla2xxx_free_wq, &cmd->work);
547547
}
548548

549549
static int tcm_qla2xxx_chk_dif_tags(uint32_t tag)

0 commit comments

Comments
 (0)