Message ID | 20221209061325.705999-6-michael.christie@oracle.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | scsi: Add struct for args to execution functions | expand |
On 09/12/2022 06:13, Mike Christie wrote: > scsi_execute is going to be removed. Convert the scsi_dh users to > scsi_execute_args > > Signed-off-by: Mike Christie<michael.christie@oracle.com> FWIW, Reviewed-by: John Garry <john.g.garry@oracle.com>
Hi Mike, I love your patch! Yet something to improve: [auto build test ERROR on mkp-scsi/for-next] [also build test ERROR on jejb-scsi/for-next groeck-staging/hwmon-next linus/master v6.1-rc8 next-20221208] [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/Mike-Christie/scsi-Add-struct-for-args-to-execution-functions/20221209-141751 base: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next patch link: https://lore.kernel.org/r/20221209061325.705999-6-michael.christie%40oracle.com patch subject: [PATCH v2 05/15] scsi: scsi_dh: Convert to scsi_execute_args config: powerpc-pseries_defconfig compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 6e4cea55f0d1104408b26ac574566a0e4de48036) 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 # install powerpc cross compiling tool for clang build # apt-get install binutils-powerpc-linux-gnu # https://github.com/intel-lab-lkp/linux/commit/ffdc00dd8a793937de0c817ac52ad58d9f7a36a4 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Mike-Christie/scsi-Add-struct-for-args-to-execution-functions/20221209-141751 git checkout ffdc00dd8a793937de0c817ac52ad58d9f7a36a4 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=powerpc SHELL=/bin/bash drivers/scsi/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): >> drivers/scsi/device_handler/scsi_dh_rdac.c:561:6: error: call to '__compiletime_assert_288' declared with 'error' attribute: BUILD_BUG_ON failed: exec_args.sense && exec_args.sense_len != SCSI_SENSE_BUFFERSIZE if (scsi_execute_args(sdev, cdb, opf, &h->ctlr->mode_select, data_size, ^ include/scsi/scsi_device.h:475:2: note: expanded from macro 'scsi_execute_args' BUILD_BUG_ON(args.sense && \ ^ include/linux/build_bug.h:50:2: note: expanded from macro 'BUILD_BUG_ON' BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition) ^ include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG' #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) ^ note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/linux/compiler_types.h:345:2: note: expanded from macro '_compiletime_assert' __compiletime_assert(condition, msg, prefix, suffix) ^ include/linux/compiler_types.h:338:4: note: expanded from macro '__compiletime_assert' prefix ## suffix(); \ ^ <scratch space>:9:1: note: expanded from here __compiletime_assert_288 ^ 1 error generated. vim +561 drivers/scsi/device_handler/scsi_dh_rdac.c 526 527 static void send_mode_select(struct work_struct *work) 528 { 529 struct rdac_controller *ctlr = 530 container_of(work, struct rdac_controller, ms_work); 531 struct scsi_device *sdev = ctlr->ms_sdev; 532 struct rdac_dh_data *h = sdev->handler_data; 533 int err = SCSI_DH_OK, retry_cnt = RDAC_RETRY_COUNT; 534 struct rdac_queue_data *tmp, *qdata; 535 LIST_HEAD(list); 536 unsigned char cdb[MAX_COMMAND_SIZE]; 537 struct scsi_sense_hdr sshdr; 538 unsigned int data_size; 539 blk_opf_t opf = REQ_OP_DRV_OUT | REQ_FAILFAST_DEV | 540 REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER; 541 const struct scsi_exec_args exec_args = { 542 .sshdr = &sshdr, 543 }; 544 545 spin_lock(&ctlr->ms_lock); 546 list_splice_init(&ctlr->ms_head, &list); 547 ctlr->ms_queued = 0; 548 ctlr->ms_sdev = NULL; 549 spin_unlock(&ctlr->ms_lock); 550 551 retry: 552 memset(cdb, 0, sizeof(cdb)); 553 554 data_size = rdac_failover_get(ctlr, &list, cdb); 555 556 RDAC_LOG(RDAC_LOG_FAILOVER, sdev, "array %s, ctlr %d, " 557 "%s MODE_SELECT command", 558 (char *) h->ctlr->array_name, h->ctlr->index, 559 (retry_cnt == RDAC_RETRY_COUNT) ? "queueing" : "retrying"); 560 > 561 if (scsi_execute_args(sdev, cdb, opf, &h->ctlr->mode_select, data_size, 562 RDAC_TIMEOUT * HZ, RDAC_RETRIES, exec_args)) { 563 err = mode_select_handle_sense(sdev, &sshdr); 564 if (err == SCSI_DH_RETRY && retry_cnt--) 565 goto retry; 566 if (err == SCSI_DH_IMM_RETRY) 567 goto retry; 568 } 569 if (err == SCSI_DH_OK) { 570 h->state = RDAC_STATE_ACTIVE; 571 RDAC_LOG(RDAC_LOG_FAILOVER, sdev, "array %s, ctlr %d, " 572 "MODE_SELECT completed", 573 (char *) h->ctlr->array_name, h->ctlr->index); 574 } 575 576 list_for_each_entry_safe(qdata, tmp, &list, entry) { 577 list_del(&qdata->entry); 578 if (err == SCSI_DH_OK) 579 qdata->h->state = RDAC_STATE_ACTIVE; 580 if (qdata->callback_fn) 581 qdata->callback_fn(qdata->callback_data, err); 582 kfree(qdata); 583 } 584 return; 585 } 586
Hi Mike, I love your patch! Yet something to improve: [auto build test ERROR on mkp-scsi/for-next] [also build test ERROR on jejb-scsi/for-next groeck-staging/hwmon-next linus/master v6.1-rc8 next-20221208] [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/Mike-Christie/scsi-Add-struct-for-args-to-execution-functions/20221209-141751 base: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next patch link: https://lore.kernel.org/r/20221209061325.705999-6-michael.christie%40oracle.com patch subject: [PATCH v2 05/15] scsi: scsi_dh: Convert to scsi_execute_args config: i386-randconfig-a002 compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1) 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/intel-lab-lkp/linux/commit/ffdc00dd8a793937de0c817ac52ad58d9f7a36a4 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Mike-Christie/scsi-Add-struct-for-args-to-execution-functions/20221209-141751 git checkout ffdc00dd8a793937de0c817ac52ad58d9f7a36a4 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/scsi/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): >> drivers/scsi/device_handler/scsi_dh_hp_sw.c:134:8: error: call to __compiletime_assert_266 declared with 'error' attribute: BUILD_BUG_ON failed: exec_args.sense && exec_args.sense_len != SCSI_SENSE_BUFFERSIZE res = scsi_execute_args(sdev, cmd, opf, NULL, 0, HP_SW_TIMEOUT, ^ include/scsi/scsi_device.h:475:2: note: expanded from macro 'scsi_execute_args' BUILD_BUG_ON(args.sense && \ ^ include/linux/build_bug.h:50:2: note: expanded from macro 'BUILD_BUG_ON' BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition) ^ include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG' #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) ^ note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/linux/compiler_types.h:345:2: note: expanded from macro '_compiletime_assert' __compiletime_assert(condition, msg, prefix, suffix) ^ include/linux/compiler_types.h:338:4: note: expanded from macro '__compiletime_assert' prefix ## suffix(); \ ^ <scratch space>:239:1: note: expanded from here __compiletime_assert_266 ^ drivers/scsi/device_handler/scsi_dh_hp_sw.c:93:8: error: call to __compiletime_assert_265 declared with 'error' attribute: BUILD_BUG_ON failed: exec_args.sense && exec_args.sense_len != SCSI_SENSE_BUFFERSIZE res = scsi_execute_args(sdev, cmd, opf, NULL, 0, HP_SW_TIMEOUT, ^ include/scsi/scsi_device.h:475:2: note: expanded from macro 'scsi_execute_args' BUILD_BUG_ON(args.sense && \ ^ include/linux/build_bug.h:50:2: note: expanded from macro 'BUILD_BUG_ON' BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition) ^ include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG' #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) ^ note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/linux/compiler_types.h:345:2: note: expanded from macro '_compiletime_assert' __compiletime_assert(condition, msg, prefix, suffix) ^ include/linux/compiler_types.h:338:4: note: expanded from macro '__compiletime_assert' prefix ## suffix(); \ ^ <scratch space>:235:1: note: expanded from here __compiletime_assert_265 ^ 2 errors generated. vim +/error +134 drivers/scsi/device_handler/scsi_dh_hp_sw.c 113 114 /* 115 * hp_sw_start_stop - Send START STOP UNIT command 116 * @sdev: sdev command should be sent to 117 * 118 * Sending START STOP UNIT activates the SP. 119 */ 120 static int hp_sw_start_stop(struct hp_sw_dh_data *h) 121 { 122 unsigned char cmd[6] = { START_STOP, 0, 0, 0, 1, 0 }; 123 struct scsi_sense_hdr sshdr; 124 struct scsi_device *sdev = h->sdev; 125 int res, rc = SCSI_DH_OK; 126 int retry_cnt = HP_SW_RETRIES; 127 blk_opf_t opf = REQ_OP_DRV_IN | REQ_FAILFAST_DEV | 128 REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER; 129 const struct scsi_exec_args exec_args = { 130 .sshdr = &sshdr, 131 }; 132 133 retry: > 134 res = scsi_execute_args(sdev, cmd, opf, NULL, 0, HP_SW_TIMEOUT, 135 HP_SW_RETRIES, exec_args); 136 if (res) { 137 if (!scsi_sense_valid(&sshdr)) { 138 sdev_printk(KERN_WARNING, sdev, 139 "%s: sending start_stop_unit failed, " 140 "no sense available\n", HP_SW_NAME); 141 return SCSI_DH_IO; 142 } 143 switch (sshdr.sense_key) { 144 case NOT_READY: 145 if (sshdr.asc == 0x04 && sshdr.ascq == 3) { 146 /* 147 * LUN not ready - manual intervention required 148 * 149 * Switch-over in progress, retry. 150 */ 151 if (--retry_cnt) 152 goto retry; 153 rc = SCSI_DH_RETRY; 154 break; 155 } 156 fallthrough; 157 default: 158 sdev_printk(KERN_WARNING, sdev, 159 "%s: sending start_stop_unit failed, " 160 "sense %x/%x/%x\n", HP_SW_NAME, 161 sshdr.sense_key, sshdr.asc, sshdr.ascq); 162 rc = SCSI_DH_IO; 163 } 164 } 165 return rc; 166 } 167
On 12/8/22 22:13, Mike Christie wrote: > scsi_execute is going to be removed. Convert the scsi_dh users to > scsi_execute_args Reviewed-by: Bart Van Assche <bvanassche@acm.org>
diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c index 49cc18a87473..c5bb04a8992b 100644 --- a/drivers/scsi/device_handler/scsi_dh_alua.c +++ b/drivers/scsi/device_handler/scsi_dh_alua.c @@ -127,8 +127,11 @@ static int submit_rtpg(struct scsi_device *sdev, unsigned char *buff, int bufflen, struct scsi_sense_hdr *sshdr, int flags) { u8 cdb[MAX_COMMAND_SIZE]; - blk_opf_t req_flags = REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | - REQ_FAILFAST_DRIVER; + blk_opf_t opf = REQ_OP_DRV_IN | REQ_FAILFAST_DEV | + REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER; + const struct scsi_exec_args exec_args = { + .sshdr = sshdr, + }; /* Prepare the command. */ memset(cdb, 0x0, MAX_COMMAND_SIZE); @@ -139,9 +142,9 @@ static int submit_rtpg(struct scsi_device *sdev, unsigned char *buff, cdb[1] = MI_REPORT_TARGET_PGS; put_unaligned_be32(bufflen, &cdb[6]); - return scsi_execute(sdev, cdb, DMA_FROM_DEVICE, buff, bufflen, NULL, - sshdr, ALUA_FAILOVER_TIMEOUT * HZ, - ALUA_FAILOVER_RETRIES, req_flags, 0, NULL); + return scsi_execute_args(sdev, cdb, opf, buff, bufflen, + ALUA_FAILOVER_TIMEOUT * HZ, + ALUA_FAILOVER_RETRIES, exec_args); } /* @@ -157,8 +160,11 @@ static int submit_stpg(struct scsi_device *sdev, int group_id, u8 cdb[MAX_COMMAND_SIZE]; unsigned char stpg_data[8]; int stpg_len = 8; - blk_opf_t req_flags = REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | - REQ_FAILFAST_DRIVER; + blk_opf_t opf = REQ_OP_DRV_OUT | REQ_FAILFAST_DEV | + REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER; + const struct scsi_exec_args exec_args = { + .sshdr = sshdr, + }; /* Prepare the data buffer */ memset(stpg_data, 0, stpg_len); @@ -171,9 +177,9 @@ static int submit_stpg(struct scsi_device *sdev, int group_id, cdb[1] = MO_SET_TARGET_PGS; put_unaligned_be32(stpg_len, &cdb[6]); - return scsi_execute(sdev, cdb, DMA_TO_DEVICE, stpg_data, stpg_len, NULL, - sshdr, ALUA_FAILOVER_TIMEOUT * HZ, - ALUA_FAILOVER_RETRIES, req_flags, 0, NULL); + return scsi_execute_args(sdev, cdb, opf, stpg_data, + stpg_len, ALUA_FAILOVER_TIMEOUT * HZ, + ALUA_FAILOVER_RETRIES, exec_args); } static struct alua_port_group *alua_find_get_pg(char *id_str, size_t id_size, diff --git a/drivers/scsi/device_handler/scsi_dh_emc.c b/drivers/scsi/device_handler/scsi_dh_emc.c index 2e21ab447873..b07bc996b3f2 100644 --- a/drivers/scsi/device_handler/scsi_dh_emc.c +++ b/drivers/scsi/device_handler/scsi_dh_emc.c @@ -239,8 +239,11 @@ static int send_trespass_cmd(struct scsi_device *sdev, unsigned char cdb[MAX_COMMAND_SIZE]; int err, res = SCSI_DH_OK, len; struct scsi_sense_hdr sshdr; - blk_opf_t req_flags = REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | - REQ_FAILFAST_DRIVER; + blk_opf_t opf = REQ_OP_DRV_OUT | REQ_FAILFAST_DEV | + REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER; + const struct scsi_exec_args exec_args = { + .sshdr = &sshdr, + }; if (csdev->flags & CLARIION_SHORT_TRESPASS) { page22 = short_trespass; @@ -263,9 +266,9 @@ static int send_trespass_cmd(struct scsi_device *sdev, BUG_ON((len > CLARIION_BUFFER_SIZE)); memcpy(csdev->buffer, page22, len); - err = scsi_execute(sdev, cdb, DMA_TO_DEVICE, csdev->buffer, len, NULL, - &sshdr, CLARIION_TIMEOUT * HZ, CLARIION_RETRIES, - req_flags, 0, NULL); + err = scsi_execute_args(sdev, cdb, opf, csdev->buffer, len, + CLARIION_TIMEOUT * HZ, CLARIION_RETRIES, + exec_args); if (err) { if (scsi_sense_valid(&sshdr)) res = trespass_endio(sdev, &sshdr); diff --git a/drivers/scsi/device_handler/scsi_dh_hp_sw.c b/drivers/scsi/device_handler/scsi_dh_hp_sw.c index 0d2cfa60aa06..4cb78a2f825d 100644 --- a/drivers/scsi/device_handler/scsi_dh_hp_sw.c +++ b/drivers/scsi/device_handler/scsi_dh_hp_sw.c @@ -83,12 +83,15 @@ static int hp_sw_tur(struct scsi_device *sdev, struct hp_sw_dh_data *h) unsigned char cmd[6] = { TEST_UNIT_READY }; struct scsi_sense_hdr sshdr; int ret = SCSI_DH_OK, res; - blk_opf_t req_flags = REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | - REQ_FAILFAST_DRIVER; + blk_opf_t opf = REQ_OP_DRV_IN | REQ_FAILFAST_DEV | + REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER; + const struct scsi_exec_args exec_args = { + .sshdr = &sshdr, + }; retry: - res = scsi_execute(sdev, cmd, DMA_NONE, NULL, 0, NULL, &sshdr, - HP_SW_TIMEOUT, HP_SW_RETRIES, req_flags, 0, NULL); + res = scsi_execute_args(sdev, cmd, opf, NULL, 0, HP_SW_TIMEOUT, + HP_SW_RETRIES, exec_args); if (res) { if (scsi_sense_valid(&sshdr)) ret = tur_done(sdev, h, &sshdr); @@ -121,12 +124,15 @@ static int hp_sw_start_stop(struct hp_sw_dh_data *h) struct scsi_device *sdev = h->sdev; int res, rc = SCSI_DH_OK; int retry_cnt = HP_SW_RETRIES; - blk_opf_t req_flags = REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | - REQ_FAILFAST_DRIVER; + blk_opf_t opf = REQ_OP_DRV_IN | REQ_FAILFAST_DEV | + REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER; + const struct scsi_exec_args exec_args = { + .sshdr = &sshdr, + }; retry: - res = scsi_execute(sdev, cmd, DMA_NONE, NULL, 0, NULL, &sshdr, - HP_SW_TIMEOUT, HP_SW_RETRIES, req_flags, 0, NULL); + res = scsi_execute_args(sdev, cmd, opf, NULL, 0, HP_SW_TIMEOUT, + HP_SW_RETRIES, exec_args); if (res) { if (!scsi_sense_valid(&sshdr)) { sdev_printk(KERN_WARNING, sdev, diff --git a/drivers/scsi/device_handler/scsi_dh_rdac.c b/drivers/scsi/device_handler/scsi_dh_rdac.c index bf8754741f85..c5fe40f1f845 100644 --- a/drivers/scsi/device_handler/scsi_dh_rdac.c +++ b/drivers/scsi/device_handler/scsi_dh_rdac.c @@ -536,8 +536,11 @@ static void send_mode_select(struct work_struct *work) unsigned char cdb[MAX_COMMAND_SIZE]; struct scsi_sense_hdr sshdr; unsigned int data_size; - blk_opf_t req_flags = REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | - REQ_FAILFAST_DRIVER; + blk_opf_t opf = REQ_OP_DRV_OUT | REQ_FAILFAST_DEV | + REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER; + const struct scsi_exec_args exec_args = { + .sshdr = &sshdr, + }; spin_lock(&ctlr->ms_lock); list_splice_init(&ctlr->ms_head, &list); @@ -555,9 +558,8 @@ static void send_mode_select(struct work_struct *work) (char *) h->ctlr->array_name, h->ctlr->index, (retry_cnt == RDAC_RETRY_COUNT) ? "queueing" : "retrying"); - if (scsi_execute(sdev, cdb, DMA_TO_DEVICE, &h->ctlr->mode_select, - data_size, NULL, &sshdr, RDAC_TIMEOUT * HZ, - RDAC_RETRIES, req_flags, 0, NULL)) { + if (scsi_execute_args(sdev, cdb, opf, &h->ctlr->mode_select, data_size, + RDAC_TIMEOUT * HZ, RDAC_RETRIES, exec_args)) { err = mode_select_handle_sense(sdev, &sshdr); if (err == SCSI_DH_RETRY && retry_cnt--) goto retry;
scsi_execute is going to be removed. Convert the scsi_dh users to scsi_execute_args Signed-off-by: Mike Christie <michael.christie@oracle.com> --- drivers/scsi/device_handler/scsi_dh_alua.c | 26 +++++++++++++-------- drivers/scsi/device_handler/scsi_dh_emc.c | 13 +++++++---- drivers/scsi/device_handler/scsi_dh_hp_sw.c | 22 ++++++++++------- drivers/scsi/device_handler/scsi_dh_rdac.c | 12 ++++++---- 4 files changed, 45 insertions(+), 28 deletions(-)