Re: [PATCH v3 09/17] scsi: qedi: fix race during abort timeouts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Mike,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on scsi/for-next]
[also build test WARNING on next-20210415]
[cannot apply to mkp-scsi/for-next rdma/for-next v5.12-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]

url:    https://github.com/0day-ci/linux/commits/Mike-Christie/libicsi-and-qedi-TMF-fixes/20210416-100636
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: alpha-randconfig-r016-20210416 (attached as .config)
compiler: alpha-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/9d4a83c1316e3dad2bd5687563584509a3d6557c
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Mike-Christie/libicsi-and-qedi-TMF-fixes/20210416-100636
        git checkout 9d4a83c1316e3dad2bd5687563584509a3d6557c
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross W=1 ARCH=alpha 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

   drivers/scsi/qedi/qedi_fw.c: In function 'qedi_process_cmd_cleanup_resp':
>> drivers/scsi/qedi/qedi_fw.c:741:6: warning: variable 'rtid' set but not used [-Wunused-but-set-variable]
     741 |  u32 rtid = 0;
         |      ^~~~


vim +/rtid +741 drivers/scsi/qedi/qedi_fw.c

ace7f46ba5fde7 Manish Rangankar 2016-12-01  729  
ace7f46ba5fde7 Manish Rangankar 2016-12-01  730  static void qedi_process_cmd_cleanup_resp(struct qedi_ctx *qedi,
ace7f46ba5fde7 Manish Rangankar 2016-12-01  731  					  struct iscsi_cqe_solicited *cqe,
ace7f46ba5fde7 Manish Rangankar 2016-12-01  732  					  struct iscsi_task *task,
ace7f46ba5fde7 Manish Rangankar 2016-12-01  733  					  struct iscsi_conn *conn)
ace7f46ba5fde7 Manish Rangankar 2016-12-01  734  {
ace7f46ba5fde7 Manish Rangankar 2016-12-01  735  	struct qedi_work_map *work, *work_tmp;
ace7f46ba5fde7 Manish Rangankar 2016-12-01  736  	u32 proto_itt = cqe->itid;
ace7f46ba5fde7 Manish Rangankar 2016-12-01  737  	u32 ptmp_itt = 0;
ace7f46ba5fde7 Manish Rangankar 2016-12-01  738  	itt_t protoitt = 0;
ace7f46ba5fde7 Manish Rangankar 2016-12-01  739  	int found = 0;
ace7f46ba5fde7 Manish Rangankar 2016-12-01  740  	struct qedi_cmd *qedi_cmd = NULL;
ace7f46ba5fde7 Manish Rangankar 2016-12-01 @741  	u32 rtid = 0;
ace7f46ba5fde7 Manish Rangankar 2016-12-01  742  	u32 iscsi_cid;
ace7f46ba5fde7 Manish Rangankar 2016-12-01  743  	struct qedi_conn *qedi_conn;
8712f467d4a560 Christos Gkekas  2017-10-14  744  	struct qedi_cmd *dbg_cmd;
ace7f46ba5fde7 Manish Rangankar 2016-12-01  745  	struct iscsi_task *mtask;
ace7f46ba5fde7 Manish Rangankar 2016-12-01  746  	struct iscsi_tm *tmf_hdr = NULL;
ace7f46ba5fde7 Manish Rangankar 2016-12-01  747  
ace7f46ba5fde7 Manish Rangankar 2016-12-01  748  	iscsi_cid = cqe->conn_id;
ace7f46ba5fde7 Manish Rangankar 2016-12-01  749  	qedi_conn = qedi->cid_que.conn_cid_tbl[iscsi_cid];
967823d6c3980a Manish Rangankar 2018-02-26  750  	if (!qedi_conn) {
967823d6c3980a Manish Rangankar 2018-02-26  751  		QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
967823d6c3980a Manish Rangankar 2018-02-26  752  			  "icid not found 0x%x\n", cqe->conn_id);
967823d6c3980a Manish Rangankar 2018-02-26  753  		return;
967823d6c3980a Manish Rangankar 2018-02-26  754  	}
ace7f46ba5fde7 Manish Rangankar 2016-12-01  755  
ace7f46ba5fde7 Manish Rangankar 2016-12-01  756  	/* Based on this itt get the corresponding qedi_cmd */
ace7f46ba5fde7 Manish Rangankar 2016-12-01  757  	spin_lock_bh(&qedi_conn->tmf_work_lock);
ace7f46ba5fde7 Manish Rangankar 2016-12-01  758  	list_for_each_entry_safe(work, work_tmp, &qedi_conn->tmf_work_list,
ace7f46ba5fde7 Manish Rangankar 2016-12-01  759  				 list) {
ace7f46ba5fde7 Manish Rangankar 2016-12-01  760  		if (work->rtid == proto_itt) {
ace7f46ba5fde7 Manish Rangankar 2016-12-01  761  			/* We found the command */
ace7f46ba5fde7 Manish Rangankar 2016-12-01  762  			qedi_cmd = work->qedi_cmd;
ace7f46ba5fde7 Manish Rangankar 2016-12-01  763  			if (!qedi_cmd->list_tmf_work) {
ace7f46ba5fde7 Manish Rangankar 2016-12-01  764  				QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM,
ace7f46ba5fde7 Manish Rangankar 2016-12-01  765  					  "TMF work not found, cqe->tid=0x%x, cid=0x%x\n",
ace7f46ba5fde7 Manish Rangankar 2016-12-01  766  					  proto_itt, qedi_conn->iscsi_conn_id);
ace7f46ba5fde7 Manish Rangankar 2016-12-01  767  				WARN_ON(1);
ace7f46ba5fde7 Manish Rangankar 2016-12-01  768  			}
ace7f46ba5fde7 Manish Rangankar 2016-12-01  769  			found = 1;
ace7f46ba5fde7 Manish Rangankar 2016-12-01  770  			mtask = qedi_cmd->task;
ace7f46ba5fde7 Manish Rangankar 2016-12-01  771  			tmf_hdr = (struct iscsi_tm *)mtask->hdr;
ace7f46ba5fde7 Manish Rangankar 2016-12-01  772  			rtid = work->rtid;
ace7f46ba5fde7 Manish Rangankar 2016-12-01  773  
ace7f46ba5fde7 Manish Rangankar 2016-12-01  774  			list_del_init(&work->list);
ace7f46ba5fde7 Manish Rangankar 2016-12-01  775  			kfree(work);
ace7f46ba5fde7 Manish Rangankar 2016-12-01  776  			qedi_cmd->list_tmf_work = NULL;
ace7f46ba5fde7 Manish Rangankar 2016-12-01  777  		}
ace7f46ba5fde7 Manish Rangankar 2016-12-01  778  	}
ace7f46ba5fde7 Manish Rangankar 2016-12-01  779  	spin_unlock_bh(&qedi_conn->tmf_work_lock);
ace7f46ba5fde7 Manish Rangankar 2016-12-01  780  
ace7f46ba5fde7 Manish Rangankar 2016-12-01  781  	if (found) {
ace7f46ba5fde7 Manish Rangankar 2016-12-01  782  		QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM,
ace7f46ba5fde7 Manish Rangankar 2016-12-01  783  			  "TMF work, cqe->tid=0x%x, tmf flags=0x%x, cid=0x%x\n",
ace7f46ba5fde7 Manish Rangankar 2016-12-01  784  			  proto_itt, tmf_hdr->flags, qedi_conn->iscsi_conn_id);
ace7f46ba5fde7 Manish Rangankar 2016-12-01  785  
ace7f46ba5fde7 Manish Rangankar 2016-12-01  786  		if ((tmf_hdr->flags & ISCSI_FLAG_TM_FUNC_MASK) ==
ace7f46ba5fde7 Manish Rangankar 2016-12-01  787  		    ISCSI_TM_FUNC_ABORT_TASK) {
ace7f46ba5fde7 Manish Rangankar 2016-12-01  788  			spin_lock_bh(&conn->session->back_lock);
ace7f46ba5fde7 Manish Rangankar 2016-12-01  789  
ace7f46ba5fde7 Manish Rangankar 2016-12-01  790  			protoitt = build_itt(get_itt(tmf_hdr->rtt),
ace7f46ba5fde7 Manish Rangankar 2016-12-01  791  					     conn->session->age);
ace7f46ba5fde7 Manish Rangankar 2016-12-01  792  			task = iscsi_itt_to_task(conn, protoitt);
ace7f46ba5fde7 Manish Rangankar 2016-12-01  793  
ace7f46ba5fde7 Manish Rangankar 2016-12-01  794  			spin_unlock_bh(&conn->session->back_lock);
ace7f46ba5fde7 Manish Rangankar 2016-12-01  795  
ace7f46ba5fde7 Manish Rangankar 2016-12-01  796  			if (!task) {
ace7f46ba5fde7 Manish Rangankar 2016-12-01  797  				QEDI_NOTICE(&qedi->dbg_ctx,
ace7f46ba5fde7 Manish Rangankar 2016-12-01  798  					    "IO task completed, tmf rtt=0x%x, cid=0x%x\n",
ace7f46ba5fde7 Manish Rangankar 2016-12-01  799  					    get_itt(tmf_hdr->rtt),
ace7f46ba5fde7 Manish Rangankar 2016-12-01  800  					    qedi_conn->iscsi_conn_id);
ace7f46ba5fde7 Manish Rangankar 2016-12-01  801  				return;
ace7f46ba5fde7 Manish Rangankar 2016-12-01  802  			}
ace7f46ba5fde7 Manish Rangankar 2016-12-01  803  
ace7f46ba5fde7 Manish Rangankar 2016-12-01  804  			dbg_cmd = task->dd_data;
ace7f46ba5fde7 Manish Rangankar 2016-12-01  805  
ace7f46ba5fde7 Manish Rangankar 2016-12-01  806  			QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM,
ace7f46ba5fde7 Manish Rangankar 2016-12-01  807  				  "Abort tmf rtt=0x%x, i/o itt=0x%x, i/o tid=0x%x, cid=0x%x\n",
ace7f46ba5fde7 Manish Rangankar 2016-12-01  808  				  get_itt(tmf_hdr->rtt), get_itt(task->itt),
ace7f46ba5fde7 Manish Rangankar 2016-12-01  809  				  dbg_cmd->task_id, qedi_conn->iscsi_conn_id);
ace7f46ba5fde7 Manish Rangankar 2016-12-01  810  
ace7f46ba5fde7 Manish Rangankar 2016-12-01  811  			if (qedi_cmd->state == CLEANUP_WAIT_FAILED)
ace7f46ba5fde7 Manish Rangankar 2016-12-01  812  				qedi_cmd->state = CLEANUP_RECV;
ace7f46ba5fde7 Manish Rangankar 2016-12-01  813  
ace7f46ba5fde7 Manish Rangankar 2016-12-01  814  			spin_lock(&qedi_conn->list_lock);
28b35d17f9f857 Nilesh Javali    2020-09-08  815  			if (likely(dbg_cmd->io_cmd_in_list)) {
28b35d17f9f857 Nilesh Javali    2020-09-08  816  				dbg_cmd->io_cmd_in_list = false;
ace7f46ba5fde7 Manish Rangankar 2016-12-01  817  				list_del_init(&dbg_cmd->io_cmd);
ace7f46ba5fde7 Manish Rangankar 2016-12-01  818  				qedi_conn->active_cmd_count--;
28b35d17f9f857 Nilesh Javali    2020-09-08  819  			}
ace7f46ba5fde7 Manish Rangankar 2016-12-01  820  			spin_unlock(&qedi_conn->list_lock);
ace7f46ba5fde7 Manish Rangankar 2016-12-01  821  			qedi_cmd->state = CLEANUP_RECV;
ace7f46ba5fde7 Manish Rangankar 2016-12-01  822  			wake_up_interruptible(&qedi_conn->wait_queue);
ace7f46ba5fde7 Manish Rangankar 2016-12-01  823  		}
ace7f46ba5fde7 Manish Rangankar 2016-12-01  824  	} else if (qedi_conn->cmd_cleanup_req > 0) {
ace7f46ba5fde7 Manish Rangankar 2016-12-01  825  		spin_lock_bh(&conn->session->back_lock);
ace7f46ba5fde7 Manish Rangankar 2016-12-01  826  		qedi_get_proto_itt(qedi, cqe->itid, &ptmp_itt);
ace7f46ba5fde7 Manish Rangankar 2016-12-01  827  		protoitt = build_itt(ptmp_itt, conn->session->age);
ace7f46ba5fde7 Manish Rangankar 2016-12-01  828  		task = iscsi_itt_to_task(conn, protoitt);
ace7f46ba5fde7 Manish Rangankar 2016-12-01  829  		QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM,
ace7f46ba5fde7 Manish Rangankar 2016-12-01  830  			  "cleanup io itid=0x%x, protoitt=0x%x, cmd_cleanup_cmpl=%d, cid=0x%x\n",
ace7f46ba5fde7 Manish Rangankar 2016-12-01  831  			  cqe->itid, protoitt, qedi_conn->cmd_cleanup_cmpl,
ace7f46ba5fde7 Manish Rangankar 2016-12-01  832  			  qedi_conn->iscsi_conn_id);
ace7f46ba5fde7 Manish Rangankar 2016-12-01  833  
ace7f46ba5fde7 Manish Rangankar 2016-12-01  834  		spin_unlock_bh(&conn->session->back_lock);
ace7f46ba5fde7 Manish Rangankar 2016-12-01  835  		if (!task) {
ace7f46ba5fde7 Manish Rangankar 2016-12-01  836  			QEDI_NOTICE(&qedi->dbg_ctx,
ace7f46ba5fde7 Manish Rangankar 2016-12-01  837  				    "task is null, itid=0x%x, cid=0x%x\n",
ace7f46ba5fde7 Manish Rangankar 2016-12-01  838  				    cqe->itid, qedi_conn->iscsi_conn_id);
ace7f46ba5fde7 Manish Rangankar 2016-12-01  839  			return;
ace7f46ba5fde7 Manish Rangankar 2016-12-01  840  		}
ace7f46ba5fde7 Manish Rangankar 2016-12-01  841  		qedi_conn->cmd_cleanup_cmpl++;
ace7f46ba5fde7 Manish Rangankar 2016-12-01  842  		wake_up(&qedi_conn->wait_queue);
ace7f46ba5fde7 Manish Rangankar 2016-12-01  843  
ace7f46ba5fde7 Manish Rangankar 2016-12-01  844  		QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_TID,
ace7f46ba5fde7 Manish Rangankar 2016-12-01  845  			  "Freeing tid=0x%x for cid=0x%x\n",
ace7f46ba5fde7 Manish Rangankar 2016-12-01  846  			  cqe->itid, qedi_conn->iscsi_conn_id);
ace7f46ba5fde7 Manish Rangankar 2016-12-01  847  
ace7f46ba5fde7 Manish Rangankar 2016-12-01  848  	} else {
ace7f46ba5fde7 Manish Rangankar 2016-12-01  849  		qedi_get_proto_itt(qedi, cqe->itid, &ptmp_itt);
ace7f46ba5fde7 Manish Rangankar 2016-12-01  850  		protoitt = build_itt(ptmp_itt, conn->session->age);
ace7f46ba5fde7 Manish Rangankar 2016-12-01  851  		task = iscsi_itt_to_task(conn, protoitt);
ace7f46ba5fde7 Manish Rangankar 2016-12-01  852  		QEDI_ERR(&qedi->dbg_ctx,
ace7f46ba5fde7 Manish Rangankar 2016-12-01  853  			 "Delayed or untracked cleanup response, itt=0x%x, tid=0x%x, cid=0x%x, task=%p\n",
ace7f46ba5fde7 Manish Rangankar 2016-12-01  854  			 protoitt, cqe->itid, qedi_conn->iscsi_conn_id, task);
ace7f46ba5fde7 Manish Rangankar 2016-12-01  855  	}
ace7f46ba5fde7 Manish Rangankar 2016-12-01  856  }
ace7f46ba5fde7 Manish Rangankar 2016-12-01  857  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux