From: kernel test robot <lkp@intel.com>
To: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>,
linux-scsi@vger.kernel.org,
"Martin K . Petersen" <martin.petersen@oracle.com>
Cc: oe-kbuild-all@lists.linux.dev,
Damien Le Moal <damien.lemoal@opensource.wdc.com>,
Johannes Thumshirn <johannes.thumshirn@wdc.com>,
Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Subject: Re: [PATCH 1/2] scsi: sd: Check physical sector alignment of sequential zone writes
Date: Fri, 3 Mar 2023 13:34:27 +0800 [thread overview]
Message-ID: <202303031358.dwPeGHeZ-lkp@intel.com> (raw)
In-Reply-To: <20230303014422.2466103-2-shinichiro.kawasaki@wdc.com>
Hi Shin'ichiro,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on jejb-scsi/for-next]
[also build test ERROR on mkp-scsi/for-next linus/master v6.2 next-20230303]
[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/Shin-ichiro-Kawasaki/scsi-sd-Check-physical-sector-alignment-of-sequential-zone-writes/20230303-094618
base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
patch link: https://lore.kernel.org/r/20230303014422.2466103-2-shinichiro.kawasaki%40wdc.com
patch subject: [PATCH 1/2] scsi: sd: Check physical sector alignment of sequential zone writes
config: arc-randconfig-r031-20230302 (https://download.01.org/0day-ci/archive/20230303/202303031358.dwPeGHeZ-lkp@intel.com/config)
compiler: arc-elf-gcc (GCC) 12.1.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/intel-lab-lkp/linux/commit/60573809bdc58708e29f2f9ecbddb06aeb9e8716
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Shin-ichiro-Kawasaki/scsi-sd-Check-physical-sector-alignment-of-sequential-zone-writes/20230303-094618
git checkout 60573809bdc58708e29f2f9ecbddb06aeb9e8716
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arc olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arc SHELL=/bin/bash drivers/scsi/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202303031358.dwPeGHeZ-lkp@intel.com/
All errors (new ones prefixed by >>):
drivers/scsi/sd.c: In function 'sd_setup_read_write_cmnd':
>> drivers/scsi/sd.c:1151:47: error: implicit declaration of function 'blk_rq_zone_is_seq'; did you mean 'bio_zone_is_seq'? [-Werror=implicit-function-declaration]
1151 | if (sdkp->device->type == TYPE_ZBC && blk_rq_zone_is_seq(rq) &&
| ^~~~~~~~~~~~~~~~~~
| bio_zone_is_seq
cc1: some warnings being treated as errors
vim +1151 drivers/scsi/sd.c
1119
1120 static blk_status_t sd_setup_read_write_cmnd(struct scsi_cmnd *cmd)
1121 {
1122 struct request *rq = scsi_cmd_to_rq(cmd);
1123 struct scsi_device *sdp = cmd->device;
1124 struct scsi_disk *sdkp = scsi_disk(rq->q->disk);
1125 sector_t lba = sectors_to_logical(sdp, blk_rq_pos(rq));
1126 sector_t threshold;
1127 unsigned int nr_blocks = sectors_to_logical(sdp, blk_rq_sectors(rq));
1128 unsigned int pb_sectors = sdkp->physical_block_size >> SECTOR_SHIFT;
1129 unsigned int mask = logical_to_sectors(sdp, 1) - 1;
1130 bool write = rq_data_dir(rq) == WRITE;
1131 unsigned char protect, fua;
1132 blk_status_t ret;
1133 unsigned int dif;
1134 bool dix;
1135
1136 ret = scsi_alloc_sgtables(cmd);
1137 if (ret != BLK_STS_OK)
1138 return ret;
1139
1140 ret = BLK_STS_IOERR;
1141 if (!scsi_device_online(sdp) || sdp->changed) {
1142 scmd_printk(KERN_ERR, cmd, "device offline or changed\n");
1143 goto fail;
1144 }
1145
1146 if (blk_rq_pos(rq) + blk_rq_sectors(rq) > get_capacity(rq->q->disk)) {
1147 scmd_printk(KERN_ERR, cmd, "access beyond end of device\n");
1148 goto fail;
1149 }
1150
> 1151 if (sdkp->device->type == TYPE_ZBC && blk_rq_zone_is_seq(rq) &&
1152 (req_op(rq) == REQ_OP_WRITE || req_op(rq) == REQ_OP_ZONE_APPEND) &&
1153 (!IS_ALIGNED(blk_rq_pos(rq), pb_sectors) ||
1154 !IS_ALIGNED(blk_rq_sectors(rq), pb_sectors))) {
1155 scmd_printk(KERN_ERR, cmd,
1156 "Sequential write request not aligned to the physical block size\n");
1157 goto fail;
1158 }
1159
1160 if ((blk_rq_pos(rq) & mask) || (blk_rq_sectors(rq) & mask)) {
1161 scmd_printk(KERN_ERR, cmd, "request not aligned to the logical block size\n");
1162 goto fail;
1163 }
1164
1165 /*
1166 * Some SD card readers can't handle accesses which touch the
1167 * last one or two logical blocks. Split accesses as needed.
1168 */
1169 threshold = sdkp->capacity - SD_LAST_BUGGY_SECTORS;
1170
1171 if (unlikely(sdp->last_sector_bug && lba + nr_blocks > threshold)) {
1172 if (lba < threshold) {
1173 /* Access up to the threshold but not beyond */
1174 nr_blocks = threshold - lba;
1175 } else {
1176 /* Access only a single logical block */
1177 nr_blocks = 1;
1178 }
1179 }
1180
1181 if (req_op(rq) == REQ_OP_ZONE_APPEND) {
1182 ret = sd_zbc_prepare_zone_append(cmd, &lba, nr_blocks);
1183 if (ret)
1184 goto fail;
1185 }
1186
1187 fua = rq->cmd_flags & REQ_FUA ? 0x8 : 0;
1188 dix = scsi_prot_sg_count(cmd);
1189 dif = scsi_host_dif_capable(cmd->device->host, sdkp->protection_type);
1190
1191 if (dif || dix)
1192 protect = sd_setup_protect_cmnd(cmd, dix, dif);
1193 else
1194 protect = 0;
1195
1196 if (protect && sdkp->protection_type == T10_PI_TYPE2_PROTECTION) {
1197 ret = sd_setup_rw32_cmnd(cmd, write, lba, nr_blocks,
1198 protect | fua);
1199 } else if (sdp->use_16_for_rw || (nr_blocks > 0xffff)) {
1200 ret = sd_setup_rw16_cmnd(cmd, write, lba, nr_blocks,
1201 protect | fua);
1202 } else if ((nr_blocks > 0xff) || (lba > 0x1fffff) ||
1203 sdp->use_10_for_rw || protect) {
1204 ret = sd_setup_rw10_cmnd(cmd, write, lba, nr_blocks,
1205 protect | fua);
1206 } else {
1207 ret = sd_setup_rw6_cmnd(cmd, write, lba, nr_blocks,
1208 protect | fua);
1209 }
1210
1211 if (unlikely(ret != BLK_STS_OK))
1212 goto fail;
1213
1214 /*
1215 * We shouldn't disconnect in the middle of a sector, so with a dumb
1216 * host adapter, it's safe to assume that we can at least transfer
1217 * this many bytes between each connect / disconnect.
1218 */
1219 cmd->transfersize = sdp->sector_size;
1220 cmd->underflow = nr_blocks << 9;
1221 cmd->allowed = sdkp->max_retries;
1222 cmd->sdb.length = nr_blocks * sdp->sector_size;
1223
1224 SCSI_LOG_HLQUEUE(1,
1225 scmd_printk(KERN_INFO, cmd,
1226 "%s: block=%llu, count=%d\n", __func__,
1227 (unsigned long long)blk_rq_pos(rq),
1228 blk_rq_sectors(rq)));
1229 SCSI_LOG_HLQUEUE(2,
1230 scmd_printk(KERN_INFO, cmd,
1231 "%s %d/%u 512 byte blocks.\n",
1232 write ? "writing" : "reading", nr_blocks,
1233 blk_rq_sectors(rq)));
1234
1235 /*
1236 * This indicates that the command is ready from our end to be queued.
1237 */
1238 return BLK_STS_OK;
1239 fail:
1240 scsi_free_sgtables(cmd);
1241 return ret;
1242 }
1243
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
next prev parent reply other threads:[~2023-03-03 5:34 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-03 1:44 [PATCH 0/2] scsi: sd: Fix physical block size issues of host-managed zoned disks Shin'ichiro Kawasaki
2023-03-03 1:44 ` [PATCH 1/2] scsi: sd: Check physical sector alignment of sequential zone writes Shin'ichiro Kawasaki
2023-03-03 5:34 ` kernel test robot [this message]
2023-03-03 6:44 ` Damien Le Moal
2023-03-03 8:57 ` Johannes Thumshirn
2023-03-03 18:03 ` Bart Van Assche
2023-03-04 3:03 ` Damien Le Moal
2023-03-04 15:21 ` Bart Van Assche
2023-03-06 6:15 ` Shinichiro Kawasaki
2023-03-06 7:58 ` Johannes Thumshirn
2023-03-03 1:44 ` [PATCH 2/2] scsi: sd: Fix wrong zone_write_granularity value at revalidate Shin'ichiro Kawasaki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202303031358.dwPeGHeZ-lkp@intel.com \
--to=lkp@intel.com \
--cc=damien.lemoal@opensource.wdc.com \
--cc=johannes.thumshirn@wdc.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=shinichiro.kawasaki@wdc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox