Hi Karan,
kernel test robot noticed the following build warnings:
[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on jejb-scsi/for-next next-20231025]
[cannot apply to linus/master v6.6-rc7]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Karan-Tilak-Kumar/scsi-fnic-Modify-definitions-to-sync-with-VIC-firmware/20231021-031259
base: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
patch link: https://lore.kernel.org/r/20231020190629.338623-8-kartilak%40cisco.com
patch subject: [PATCH 07/13] scsi: fnic: Modify ISRs to support multiqueue(MQ)
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20231025/202310251847.4T8BVZAZ-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231025/202310251847.4T8BVZAZ-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202310251847.4T8BVZAZ-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/scsi/fnic/fnic_isr.c:242:5: warning: no previous prototype for 'fnic_set_intr_mode_msix' [-Wmissing-prototypes]
242 | int fnic_set_intr_mode_msix(struct fnic *fnic)
| ^~~~~~~~~~~~~~~~~~~~~~~
vim +/fnic_set_intr_mode_msix +242 drivers/scsi/fnic/fnic_isr.c
241
> 242 int fnic_set_intr_mode_msix(struct fnic *fnic)
243 {
244 unsigned int n = ARRAY_SIZE(fnic->rq);
245 unsigned int m = ARRAY_SIZE(fnic->wq);
246 unsigned int o = ARRAY_SIZE(fnic->hw_copy_wq);
247 unsigned int min_irqs = n + m + 1 + 1; /*rq, raw wq, wq, err*/
248
249 /*
250 * We need n RQs, m WQs, o Copy WQs, n+m+o CQs, and n+m+o+1 INTRs
251 * (last INTR is used for WQ/RQ errors and notification area)
252 */
253 FNIC_ISR_DBG(KERN_INFO, fnic->lport->host,
254 "fnic<%d>: %s: %d: rq-array size: %d wq-array size: %d copy-wq array size: %d\n",
255 fnic->fnic_num, __func__, __LINE__, n, m, o);
256 FNIC_ISR_DBG(KERN_INFO, fnic->lport->host,
257 "fnic<%d>: %s: %d: rq_count: %d raw_wq_count: %d wq_copy_count: %d cq_count: %d\n",
258 fnic->fnic_num, __func__, __LINE__, fnic->rq_count, fnic->raw_wq_count,
259 fnic->wq_copy_count, fnic->cq_count);
260
261 if (fnic->rq_count <= n && fnic->raw_wq_count <= m &&
262 fnic->wq_copy_count <= o) {
263 int vec_count = 0;
264 int vecs = fnic->rq_count + fnic->raw_wq_count + fnic->wq_copy_count + 1;
265
266 vec_count = pci_alloc_irq_vectors(fnic->pdev, min_irqs, vecs,
267 PCI_IRQ_MSIX | PCI_IRQ_AFFINITY);
268 FNIC_ISR_DBG(KERN_INFO, fnic->lport->host,
269 "fnic<%d>: %s: %d: allocated %d MSI-X vectors\n",
270 fnic->fnic_num, __func__, __LINE__, vec_count);
271
272 if (vec_count > 0) {
273 if (vec_count < vecs) {
274 FNIC_ISR_DBG(KERN_ERR, fnic->lport->host,
275 "fnic<%d>: %s: %d: interrupts number mismatch: vec_count: %d vecs: %d\n",
276 fnic->fnic_num, __func__, __LINE__, vec_count, vecs);
277 if (vec_count < min_irqs) {
278 FNIC_ISR_DBG(KERN_ERR, fnic->lport->host,
279 "fnic<%d>: %s: %d: no interrupts for copy wq\n",
280 fnic->fnic_num, __func__, __LINE__);
281 return 1;
282 }
283 }
284
285 fnic->rq_count = n;
286 fnic->raw_wq_count = m;
287 fnic->cpy_wq_base = fnic->rq_count + fnic->raw_wq_count;
288 fnic->wq_copy_count = vec_count - n - m - 1;
289 fnic->wq_count = fnic->raw_wq_count + fnic->wq_copy_count;
290 if (fnic->cq_count != vec_count - 1) {
291 FNIC_ISR_DBG(KERN_ERR, fnic->lport->host,
292 "fnic<%d>: %s: %d: CQ count: %d does not match MSI-X vector count: %d\n",
293 fnic->fnic_num, __func__, __LINE__, fnic->cq_count, vec_count);
294 fnic->cq_count = vec_count - 1;
295 }
296 fnic->intr_count = vec_count;
297 fnic->err_intr_offset = fnic->rq_count + fnic->wq_count;
298
299 FNIC_ISR_DBG(KERN_INFO, fnic->lport->host,
300 "fnic<%d>: %s: %d: rq_count: %d raw_wq_count: %d cpy_wq_base: %d\n",
301 fnic->fnic_num, __func__, __LINE__, fnic->rq_count,
302 fnic->raw_wq_count, fnic->cpy_wq_base);
303
304 FNIC_ISR_DBG(KERN_INFO, fnic->lport->host,
305 "fnic<%d>: %s: %d: wq_copy_count: %d wq_count: %d cq_count: %d\n",
306 fnic->fnic_num, __func__, __LINE__, fnic->wq_copy_count,
307 fnic->wq_count, fnic->cq_count);
308
309 FNIC_ISR_DBG(KERN_INFO, fnic->lport->host,
310 "fnic<%d>: %s: %d: intr_count: %d err_intr_offset: %u",
311 fnic->fnic_num, __func__, __LINE__, fnic->intr_count,
312 fnic->err_intr_offset);
313
314 vnic_dev_set_intr_mode(fnic->vdev, VNIC_DEV_INTR_MODE_MSIX);
315 FNIC_ISR_DBG(KERN_INFO, fnic->lport->host,
316 "fnic<%d>: %s: %d: fnic using MSI-X\n", fnic->fnic_num,
317 __func__, __LINE__);
318 return 0;
319 }
320 }
321 return 1;
322 } //fnic_set_intr_mode_msix
323
@@ -369,7 +369,7 @@ void fnic_scsi_cleanup(struct fc_lport *);
void fnic_scsi_abort_io(struct fc_lport *);
void fnic_empty_scsi_cleanup(struct fc_lport *);
void fnic_exch_mgr_reset(struct fc_lport *, u32, u32);
-int fnic_wq_copy_cmpl_handler(struct fnic *fnic, int);
+int fnic_wq_copy_cmpl_handler(struct fnic *fnic, int copy_work_to_do, unsigned int cq_index);
int fnic_wq_cmpl_handler(struct fnic *fnic, int);
int fnic_flogi_reg_handler(struct fnic *fnic, u32);
void fnic_wq_copy_cleanup_handler(struct vnic_wq_copy *wq,
@@ -38,8 +38,13 @@ static irqreturn_t fnic_isr_legacy(int irq, void *data)
fnic_log_q_error(fnic);
}
+ if (pba & (1 << FNIC_INTX_DUMMY)) {
+ atomic64_inc(&fnic->fnic_stats.misc_stats.intx_dummy);
+ vnic_intr_return_all_credits(&fnic->intr[FNIC_INTX_DUMMY]);
+ }
+
if (pba & (1 << FNIC_INTX_WQ_RQ_COPYWQ)) {
- work_done += fnic_wq_copy_cmpl_handler(fnic, io_completions);
+ work_done += fnic_wq_copy_cmpl_handler(fnic, io_completions, FNIC_MQ_CQ_INDEX);
work_done += fnic_wq_cmpl_handler(fnic, -1);
work_done += fnic_rq_cmpl_handler(fnic, -1);
@@ -60,7 +65,7 @@ static irqreturn_t fnic_isr_msi(int irq, void *data)
fnic->fnic_stats.misc_stats.last_isr_time = jiffies;
atomic64_inc(&fnic->fnic_stats.misc_stats.isr_count);
- work_done += fnic_wq_copy_cmpl_handler(fnic, io_completions);
+ work_done += fnic_wq_copy_cmpl_handler(fnic, io_completions, FNIC_MQ_CQ_INDEX);
work_done += fnic_wq_cmpl_handler(fnic, -1);
work_done += fnic_rq_cmpl_handler(fnic, -1);
@@ -109,12 +114,22 @@ static irqreturn_t fnic_isr_msix_wq_copy(int irq, void *data)
{
struct fnic *fnic = data;
unsigned long wq_copy_work_done = 0;
+ int i;
fnic->fnic_stats.misc_stats.last_isr_time = jiffies;
atomic64_inc(&fnic->fnic_stats.misc_stats.isr_count);
- wq_copy_work_done = fnic_wq_copy_cmpl_handler(fnic, io_completions);
- vnic_intr_return_credits(&fnic->intr[FNIC_MSIX_WQ_COPY],
+ i = irq - fnic->msix[0].irq_num;
+ if (i >= fnic->wq_copy_count + fnic->cpy_wq_base ||
+ i < 0 || fnic->msix[i].irq_num != irq) {
+ for (i = fnic->cpy_wq_base; i < fnic->wq_copy_count + fnic->cpy_wq_base ; i++) {
+ if (fnic->msix[i].irq_num == irq)
+ break;
+ }
+ }
+
+ wq_copy_work_done = fnic_wq_copy_cmpl_handler(fnic, io_completions, i);
+ vnic_intr_return_credits(&fnic->intr[i],
wq_copy_work_done,
1 /* unmask intr */,
1 /* reset intr timer */);
@@ -128,7 +143,7 @@ static irqreturn_t fnic_isr_msix_err_notify(int irq, void *data)
fnic->fnic_stats.misc_stats.last_isr_time = jiffies;
atomic64_inc(&fnic->fnic_stats.misc_stats.isr_count);
- vnic_intr_return_all_credits(&fnic->intr[FNIC_MSIX_ERR_NOTIFY]);
+ vnic_intr_return_all_credits(&fnic->intr[fnic->err_intr_offset]);
fnic_log_q_error(fnic);
fnic_handle_link_event(fnic);
@@ -186,26 +201,30 @@ int fnic_request_intr(struct fnic *fnic)
fnic->msix[FNIC_MSIX_WQ].isr = fnic_isr_msix_wq;
fnic->msix[FNIC_MSIX_WQ].devid = fnic;
- sprintf(fnic->msix[FNIC_MSIX_WQ_COPY].devname,
- "%.11s-scsi-wq", fnic->name);
- fnic->msix[FNIC_MSIX_WQ_COPY].isr = fnic_isr_msix_wq_copy;
- fnic->msix[FNIC_MSIX_WQ_COPY].devid = fnic;
+ for (i = fnic->cpy_wq_base; i < fnic->wq_copy_count + fnic->cpy_wq_base; i++) {
+ sprintf(fnic->msix[i].devname,
+ "%.11s-scsi-wq-%d", fnic->name, i-FNIC_MSIX_WQ_COPY);
+ fnic->msix[i].isr = fnic_isr_msix_wq_copy;
+ fnic->msix[i].devid = fnic;
+ }
- sprintf(fnic->msix[FNIC_MSIX_ERR_NOTIFY].devname,
+ sprintf(fnic->msix[fnic->err_intr_offset].devname,
"%.11s-err-notify", fnic->name);
- fnic->msix[FNIC_MSIX_ERR_NOTIFY].isr =
+ fnic->msix[fnic->err_intr_offset].isr =
fnic_isr_msix_err_notify;
- fnic->msix[FNIC_MSIX_ERR_NOTIFY].devid = fnic;
+ fnic->msix[fnic->err_intr_offset].devid = fnic;
+
+ for (i = 0; i < fnic->intr_count; i++) {
+ fnic->msix[i].irq_num = pci_irq_vector(fnic->pdev, i);
- for (i = 0; i < ARRAY_SIZE(fnic->msix); i++) {
- err = request_irq(pci_irq_vector(fnic->pdev, i),
- fnic->msix[i].isr, 0,
- fnic->msix[i].devname,
- fnic->msix[i].devid);
+ err = request_irq(fnic->msix[i].irq_num,
+ fnic->msix[i].isr, 0,
+ fnic->msix[i].devname,
+ fnic->msix[i].devid);
if (err) {
- shost_printk(KERN_ERR, fnic->lport->host,
- "MSIX: request_irq"
- " failed %d\n", err);
+ FNIC_ISR_DBG(KERN_ERR, fnic->lport->host,
+ "fnic<%d>: %s: %d request_irq failed with error: %d\n",
+ fnic->fnic_num, __func__, __LINE__, err);
fnic_free_intr(fnic);
break;
}
@@ -220,44 +239,101 @@ int fnic_request_intr(struct fnic *fnic)
return err;
}
-int fnic_set_intr_mode(struct fnic *fnic)
+int fnic_set_intr_mode_msix(struct fnic *fnic)
{
unsigned int n = ARRAY_SIZE(fnic->rq);
unsigned int m = ARRAY_SIZE(fnic->wq);
unsigned int o = ARRAY_SIZE(fnic->hw_copy_wq);
+ unsigned int min_irqs = n + m + 1 + 1; /*rq, raw wq, wq, err*/
/*
- * Set interrupt mode (INTx, MSI, MSI-X) depending
- * system capabilities.
- *
- * Try MSI-X first
- *
* We need n RQs, m WQs, o Copy WQs, n+m+o CQs, and n+m+o+1 INTRs
* (last INTR is used for WQ/RQ errors and notification area)
*/
- if (fnic->rq_count >= n &&
- fnic->raw_wq_count >= m &&
- fnic->wq_copy_count >= o &&
- fnic->cq_count >= n + m + o) {
- int vecs = n + m + o + 1;
-
- if (pci_alloc_irq_vectors(fnic->pdev, vecs, vecs,
- PCI_IRQ_MSIX) == vecs) {
+ FNIC_ISR_DBG(KERN_INFO, fnic->lport->host,
+ "fnic<%d>: %s: %d: rq-array size: %d wq-array size: %d copy-wq array size: %d\n",
+ fnic->fnic_num, __func__, __LINE__, n, m, o);
+ FNIC_ISR_DBG(KERN_INFO, fnic->lport->host,
+ "fnic<%d>: %s: %d: rq_count: %d raw_wq_count: %d wq_copy_count: %d cq_count: %d\n",
+ fnic->fnic_num, __func__, __LINE__, fnic->rq_count, fnic->raw_wq_count,
+ fnic->wq_copy_count, fnic->cq_count);
+
+ if (fnic->rq_count <= n && fnic->raw_wq_count <= m &&
+ fnic->wq_copy_count <= o) {
+ int vec_count = 0;
+ int vecs = fnic->rq_count + fnic->raw_wq_count + fnic->wq_copy_count + 1;
+
+ vec_count = pci_alloc_irq_vectors(fnic->pdev, min_irqs, vecs,
+ PCI_IRQ_MSIX | PCI_IRQ_AFFINITY);
+ FNIC_ISR_DBG(KERN_INFO, fnic->lport->host,
+ "fnic<%d>: %s: %d: allocated %d MSI-X vectors\n",
+ fnic->fnic_num, __func__, __LINE__, vec_count);
+
+ if (vec_count > 0) {
+ if (vec_count < vecs) {
+ FNIC_ISR_DBG(KERN_ERR, fnic->lport->host,
+ "fnic<%d>: %s: %d: interrupts number mismatch: vec_count: %d vecs: %d\n",
+ fnic->fnic_num, __func__, __LINE__, vec_count, vecs);
+ if (vec_count < min_irqs) {
+ FNIC_ISR_DBG(KERN_ERR, fnic->lport->host,
+ "fnic<%d>: %s: %d: no interrupts for copy wq\n",
+ fnic->fnic_num, __func__, __LINE__);
+ return 1;
+ }
+ }
+
fnic->rq_count = n;
fnic->raw_wq_count = m;
- fnic->wq_copy_count = o;
- fnic->wq_count = m + o;
- fnic->cq_count = n + m + o;
- fnic->intr_count = vecs;
- fnic->err_intr_offset = FNIC_MSIX_ERR_NOTIFY;
-
- FNIC_ISR_DBG(KERN_DEBUG, fnic->lport->host,
- "Using MSI-X Interrupts\n");
- vnic_dev_set_intr_mode(fnic->vdev,
- VNIC_DEV_INTR_MODE_MSIX);
+ fnic->cpy_wq_base = fnic->rq_count + fnic->raw_wq_count;
+ fnic->wq_copy_count = vec_count - n - m - 1;
+ fnic->wq_count = fnic->raw_wq_count + fnic->wq_copy_count;
+ if (fnic->cq_count != vec_count - 1) {
+ FNIC_ISR_DBG(KERN_ERR, fnic->lport->host,
+ "fnic<%d>: %s: %d: CQ count: %d does not match MSI-X vector count: %d\n",
+ fnic->fnic_num, __func__, __LINE__, fnic->cq_count, vec_count);
+ fnic->cq_count = vec_count - 1;
+ }
+ fnic->intr_count = vec_count;
+ fnic->err_intr_offset = fnic->rq_count + fnic->wq_count;
+
+ FNIC_ISR_DBG(KERN_INFO, fnic->lport->host,
+ "fnic<%d>: %s: %d: rq_count: %d raw_wq_count: %d cpy_wq_base: %d\n",
+ fnic->fnic_num, __func__, __LINE__, fnic->rq_count,
+ fnic->raw_wq_count, fnic->cpy_wq_base);
+
+ FNIC_ISR_DBG(KERN_INFO, fnic->lport->host,
+ "fnic<%d>: %s: %d: wq_copy_count: %d wq_count: %d cq_count: %d\n",
+ fnic->fnic_num, __func__, __LINE__, fnic->wq_copy_count,
+ fnic->wq_count, fnic->cq_count);
+
+ FNIC_ISR_DBG(KERN_INFO, fnic->lport->host,
+ "fnic<%d>: %s: %d: intr_count: %d err_intr_offset: %u",
+ fnic->fnic_num, __func__, __LINE__, fnic->intr_count,
+ fnic->err_intr_offset);
+
+ vnic_dev_set_intr_mode(fnic->vdev, VNIC_DEV_INTR_MODE_MSIX);
+ FNIC_ISR_DBG(KERN_INFO, fnic->lport->host,
+ "fnic<%d>: %s: %d: fnic using MSI-X\n", fnic->fnic_num,
+ __func__, __LINE__);
return 0;
}
}
+ return 1;
+} //fnic_set_intr_mode_msix
+
+int fnic_set_intr_mode(struct fnic *fnic)
+{
+ int ret_status = 0;
+
+ /*
+ * Set interrupt mode (INTx, MSI, MSI-X) depending
+ * system capabilities.
+ *
+ * Try MSI-X first
+ */
+ ret_status = fnic_set_intr_mode_msix(fnic);
+ if (ret_status == 0)
+ return ret_status;
/*
* Next try MSI
@@ -478,6 +478,7 @@ static int fnic_cleanup(struct fnic *fnic)
{
unsigned int i;
int err;
+ int raw_wq_rq_counts;
vnic_dev_disable(fnic->vdev);
for (i = 0; i < fnic->intr_count; i++)
@@ -497,10 +498,11 @@ static int fnic_cleanup(struct fnic *fnic)
err = vnic_wq_copy_disable(&fnic->hw_copy_wq[i]);
if (err)
return err;
+ raw_wq_rq_counts = fnic->raw_wq_count + fnic->rq_count;
+ fnic_wq_copy_cmpl_handler(fnic, -1, i + raw_wq_rq_counts);
}
/* Clean up completed IOs and FCS frames */
- fnic_wq_copy_cmpl_handler(fnic, io_completions);
fnic_wq_cmpl_handler(fnic, -1);
fnic_rq_cmpl_handler(fnic, -1);
@@ -1303,10 +1303,8 @@ static int fnic_fcpio_cmpl_handler(struct vnic_dev *vdev,
* fnic_wq_copy_cmpl_handler
* Routine to process wq copy
*/
-int fnic_wq_copy_cmpl_handler(struct fnic *fnic, int copy_work_to_do)
+int fnic_wq_copy_cmpl_handler(struct fnic *fnic, int copy_work_to_do, unsigned int cq_index)
{
- unsigned int wq_work_done = 0;
- unsigned int i, cq_index;
unsigned int cur_work_done;
struct misc_stats *misc_stats = &fnic->fnic_stats.misc_stats;
u64 start_jiffies = 0;
@@ -1314,28 +1312,20 @@ int fnic_wq_copy_cmpl_handler(struct fnic *fnic, int copy_work_to_do)
u64 delta_jiffies = 0;
u64 delta_ms = 0;
- for (i = 0; i < fnic->wq_copy_count; i++) {
- cq_index = i + fnic->raw_wq_count + fnic->rq_count;
-
- start_jiffies = jiffies;
- cur_work_done = vnic_cq_copy_service(&fnic->cq[cq_index],
- fnic_fcpio_cmpl_handler,
- copy_work_to_do);
- end_jiffies = jiffies;
-
- wq_work_done += cur_work_done;
- delta_jiffies = end_jiffies - start_jiffies;
- if (delta_jiffies >
- (u64) atomic64_read(&misc_stats->max_isr_jiffies)) {
- atomic64_set(&misc_stats->max_isr_jiffies,
- delta_jiffies);
- delta_ms = jiffies_to_msecs(delta_jiffies);
- atomic64_set(&misc_stats->max_isr_time_ms, delta_ms);
- atomic64_set(&misc_stats->corr_work_done,
- cur_work_done);
- }
+ start_jiffies = jiffies;
+ cur_work_done = vnic_cq_copy_service(&fnic->cq[cq_index],
+ fnic_fcpio_cmpl_handler,
+ copy_work_to_do);
+ end_jiffies = jiffies;
+ delta_jiffies = end_jiffies - start_jiffies;
+ if (delta_jiffies > (u64) atomic64_read(&misc_stats->max_isr_jiffies)) {
+ atomic64_set(&misc_stats->max_isr_jiffies, delta_jiffies);
+ delta_ms = jiffies_to_msecs(delta_jiffies);
+ atomic64_set(&misc_stats->max_isr_time_ms, delta_ms);
+ atomic64_set(&misc_stats->corr_work_done, cur_work_done);
}
- return wq_work_done;
+
+ return cur_work_done;
}
static bool fnic_cleanup_io_iter(struct scsi_cmnd *sc, void *data)
@@ -103,6 +103,7 @@ struct misc_stats {
atomic64_t rport_not_ready;
atomic64_t frame_errors;
atomic64_t current_port_speed;
+ atomic64_t intx_dummy;
};
struct fnic_stats {