Skip to content

Commit 59f10a0

Browse files
njavalimartinkpetersen
authored andcommitted
scsi: qla2xxx: Use raw_smp_processor_id() instead of smp_processor_id()
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: [email protected] Suggested-by: John Garry <[email protected]> Signed-off-by: Nilesh Javali <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 0be7592 commit 59f10a0

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

drivers/scsi/qla2xxx/qla_inline.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ fcport_is_bigger(fc_port_t *fcport)
577577
static inline struct qla_qpair *
578578
qla_mapq_nvme_select_qpair(struct qla_hw_data *ha, struct qla_qpair *qpair)
579579
{
580-
int cpuid = smp_processor_id();
580+
int cpuid = raw_smp_processor_id();
581581

582582
if (qpair->cpuid != cpuid &&
583583
ha->qp_cpu_map[cpuid]) {

drivers/scsi/qla2xxx/qla_isr.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3965,7 +3965,7 @@ void qla24xx_process_response_queue(struct scsi_qla_host *vha,
39653965
if (!ha->flags.fw_started)
39663966
return;
39673967

3968-
if (rsp->qpair->cpuid != smp_processor_id() || !rsp->qpair->rcv_intr) {
3968+
if (rsp->qpair->cpuid != raw_smp_processor_id() || !rsp->qpair->rcv_intr) {
39693969
rsp->qpair->rcv_intr = 1;
39703970

39713971
if (!rsp->qpair->cpu_mapped)
@@ -4468,7 +4468,7 @@ qla2xxx_msix_rsp_q(int irq, void *dev_id)
44684468
}
44694469
ha = qpair->hw;
44704470

4471-
queue_work_on(smp_processor_id(), ha->wq, &qpair->q_work);
4471+
queue_work(ha->wq, &qpair->q_work);
44724472

44734473
return IRQ_HANDLED;
44744474
}
@@ -4494,7 +4494,7 @@ qla2xxx_msix_rsp_q_hs(int irq, void *dev_id)
44944494
wrt_reg_dword(&reg->hccr, HCCRX_CLR_RISC_INT);
44954495
spin_unlock_irqrestore(&ha->hardware_lock, flags);
44964496

4497-
queue_work_on(smp_processor_id(), ha->wq, &qpair->q_work);
4497+
queue_work(ha->wq, &qpair->q_work);
44984498

44994499
return IRQ_HANDLED;
45004500
}

drivers/scsi/qla2xxx/qla_target.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4425,8 +4425,7 @@ static int qlt_handle_cmd_for_atio(struct scsi_qla_host *vha,
44254425
queue_work_on(cmd->se_cmd.cpuid, qla_tgt_wq, &cmd->work);
44264426
} else if (ha->msix_count) {
44274427
if (cmd->atio.u.isp24.fcp_cmnd.rddata)
4428-
queue_work_on(smp_processor_id(), qla_tgt_wq,
4429-
&cmd->work);
4428+
queue_work(qla_tgt_wq, &cmd->work);
44304429
else
44314430
queue_work_on(cmd->se_cmd.cpuid, qla_tgt_wq,
44324431
&cmd->work);

drivers/scsi/qla2xxx/tcm_qla2xxx.c

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

312312
INIT_WORK(&cmd->work, tcm_qla2xxx_complete_free);
313-
queue_work_on(smp_processor_id(), tcm_qla2xxx_free_wq, &cmd->work);
313+
queue_work(tcm_qla2xxx_free_wq, &cmd->work);
314314
}
315315

316316
/*
@@ -547,7 +547,7 @@ static void tcm_qla2xxx_handle_data(struct qla_tgt_cmd *cmd)
547547
cmd->trc_flags |= TRC_DATA_IN;
548548
cmd->cmd_in_wq = 1;
549549
INIT_WORK(&cmd->work, tcm_qla2xxx_handle_data_work);
550-
queue_work_on(smp_processor_id(), tcm_qla2xxx_free_wq, &cmd->work);
550+
queue_work(tcm_qla2xxx_free_wq, &cmd->work);
551551
}
552552

553553
static int tcm_qla2xxx_chk_dif_tags(uint32_t tag)

0 commit comments

Comments
 (0)