tree:
https://github.com/bvanassche/linux scsi-for-next
head: d8044d773ae9d9e70f9c61f98296c6c8391447ad
commit: 4e1b57cbdabcd444b21d5c463cfa1d4579dc1fb0 [35/41] Change the return type of
scsi_execute() into union scsi_status
config: powerpc-allyesconfig (attached as .config)
compiler: powerpc64-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/bvanassche/linux/commit/4e1b57cbdabcd444b21d5c463cfa1d...
git remote add bvanassche
https://github.com/bvanassche/linux
git fetch --no-tags bvanassche scsi-for-next
git checkout 4e1b57cbdabcd444b21d5c463cfa1d4579dc1fb0
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross W=1 ARCH=powerpc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All error/warnings (new ones prefixed by >>):
In file included from include/linux/device.h:15,
from arch/powerpc/include/asm/io.h:27,
from include/linux/io.h:13,
from include/linux/irq.h:20,
from arch/powerpc/include/asm/hardirq.h:6,
from include/linux/hardirq.h:10,
from include/linux/interrupt.h:11,
from drivers/scsi/cxlflash/superpipe.c:13:
drivers/scsi/cxlflash/superpipe.c: In function 'read_cap16':
> drivers/scsi/cxlflash/superpipe.c:366:16: warning: format
'%x' expects argument of type 'unsigned int', but argument 4 has type
'union scsi_status' [-Wformat=]
366 | dev_err(dev, "%s: Failed
state result=%08x\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
19 | #define dev_fmt(fmt) fmt
| ^~~
drivers/scsi/cxlflash/superpipe.c:366:3: note: in expansion of macro 'dev_err'
366 | dev_err(dev, "%s: Failed state result=%08x\n",
| ^~~~~~~
drivers/scsi/cxlflash/superpipe.c:366:44: note: format string is defined here
366 | dev_err(dev, "%s: Failed state result=%08x\n",
| ~~~^
| |
| unsigned int
> drivers/scsi/cxlflash/superpipe.c:373:10: error: invalid operands
to binary & (have 'union scsi_status' and 'int')
373 |
result &= ~(0xFF<<24); /* DRIVER_SENSE is not an error */
| ^~
drivers/scsi/cxlflash/superpipe.c:374:14: error: invalid operands to binary & (have
'union scsi_status' and 'int')
374 | if (result & SAM_STAT_CHECK_CONDITION) {
| ^
drivers/scsi/cxlflash/superpipe.c:379:12: error: invalid operands to binary & (have
'union scsi_status' and 'int')
379 | result &= ~SAM_STAT_CHECK_CONDITION;
| ^~
> drivers/scsi/cxlflash/superpipe.c:401:6: error: used union type
value where scalar is required
401 | if (result) {
| ^~~~~~
In file included from include/linux/device.h:15,
from arch/powerpc/include/asm/io.h:27,
from include/linux/io.h:13,
from include/linux/irq.h:20,
from arch/powerpc/include/asm/hardirq.h:6,
from include/linux/hardirq.h:10,
from include/linux/interrupt.h:11,
from drivers/scsi/cxlflash/superpipe.c:13:
drivers/scsi/cxlflash/superpipe.c:402:16: warning: format '%x' expects argument
of type 'unsigned int', but argument 4 has type 'union scsi_status'
[-Wformat=]
402 | dev_err(dev, "%s: command failed, result=%08x\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
19 | #define dev_fmt(fmt) fmt
| ^~~
drivers/scsi/cxlflash/superpipe.c:402:3: note: in expansion of macro 'dev_err'
402 | dev_err(dev, "%s: command failed, result=%08x\n",
| ^~~~~~~
drivers/scsi/cxlflash/superpipe.c:402:47: note: format string is defined here
402 | dev_err(dev, "%s: command failed, result=%08x\n",
| ~~~^
| |
| unsigned int
--
In file included from include/linux/device.h:15,
from arch/powerpc/include/asm/io.h:27,
from include/linux/io.h:13,
from include/linux/irq.h:20,
from arch/powerpc/include/asm/hardirq.h:6,
from include/linux/hardirq.h:10,
from include/linux/interrupt.h:11,
from drivers/scsi/cxlflash/vlun.c:11:
drivers/scsi/cxlflash/vlun.c: In function 'write_same16':
> drivers/scsi/cxlflash/vlun.c:459:17: warning: format '%x'
expects argument of type 'unsigned int', but argument 4 has type 'union
scsi_status' [-Wformat=]
459 | dev_err(dev, "%s: Failed state
result=%08x\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
19 | #define dev_fmt(fmt) fmt
| ^~~
drivers/scsi/cxlflash/vlun.c:459:4: note: in expansion of macro 'dev_err'
459 | dev_err(dev, "%s: Failed state result=%08x\n",
| ^~~~~~~
drivers/scsi/cxlflash/vlun.c:459:45: note: format string is defined here
459 | dev_err(dev, "%s: Failed state result=%08x\n",
| ~~~^
| |
| unsigned int
> drivers/scsi/cxlflash/vlun.c:465:7: error: used union type value
where scalar is required
465 | if (result) {
| ^~~~~~
In file included from include/linux/device.h:15,
from arch/powerpc/include/asm/io.h:27,
from include/linux/io.h:13,
from include/linux/irq.h:20,
from arch/powerpc/include/asm/hardirq.h:6,
from include/linux/hardirq.h:10,
from include/linux/interrupt.h:11,
from drivers/scsi/cxlflash/vlun.c:11:
drivers/scsi/cxlflash/vlun.c:466:29: warning: format '%x' expects argument of
type 'unsigned int', but argument 5 has type 'union scsi_status'
[-Wformat=]
466 | dev_err_ratelimited(dev, "%s: command failed for "
| ^~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
19 | #define dev_fmt(fmt) fmt
| ^~~
include/linux/dev_printk.h:176:3: note: in expansion of macro 'dev_err'
176 | dev_level(dev, fmt, ##__VA_ARGS__); \
| ^~~~~~~~~
include/linux/dev_printk.h:186:2: note: in expansion of macro
'dev_level_ratelimited'
186 | dev_level_ratelimited(dev_err, dev, fmt, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~
drivers/scsi/cxlflash/vlun.c:466:4: note: in expansion of macro
'dev_err_ratelimited'
466 | dev_err_ratelimited(dev, "%s: command failed for "
| ^~~~~~~~~~~~~~~~~~~
drivers/scsi/cxlflash/vlun.c:467:33: note: format string is defined here
467 | "offset=%lld result=%08x\n",
| ~~~^
| |
| unsigned int
vim +373 drivers/scsi/cxlflash/superpipe.c
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 304
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 305 /**
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 306 * read_cap16() - issues a SCSI
READ_CAP16 command
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 307 * @sdev: SCSI device associated with
LUN.
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 308 * @lli: LUN destined for capacity
request.
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 309 *
aacb4ff69eea4ac Matthew R. Ochs 2015-10-21 310 * The READ_CAP16 can take quite a
while to complete. Should an EEH occur while
aacb4ff69eea4ac Matthew R. Ochs 2015-10-21 311 * in scsi_execute(), the EEH handler
will attempt to recover. As part of the
aacb4ff69eea4ac Matthew R. Ochs 2015-10-21 312 * recovery, the handler drains all
currently running ioctls, waiting until they
aacb4ff69eea4ac Matthew R. Ochs 2015-10-21 313 * have completed before proceeding
with a reset. As this routine is used on the
aacb4ff69eea4ac Matthew R. Ochs 2015-10-21 314 * ioctl path, this can create a
condition where the EEH handler becomes stuck,
aacb4ff69eea4ac Matthew R. Ochs 2015-10-21 315 * infinitely waiting for this ioctl
thread. To avoid this behavior, temporarily
aacb4ff69eea4ac Matthew R. Ochs 2015-10-21 316 * unmark this thread as an ioctl
thread by releasing the ioctl read semaphore.
aacb4ff69eea4ac Matthew R. Ochs 2015-10-21 317 * This will allow the EEH handler to
proceed with a recovery while this thread
aacb4ff69eea4ac Matthew R. Ochs 2015-10-21 318 * is still running. Once the
scsi_execute() returns, reacquire the ioctl read
aacb4ff69eea4ac Matthew R. Ochs 2015-10-21 319 * semaphore and check the adapter
state in case it changed while inside of
aacb4ff69eea4ac Matthew R. Ochs 2015-10-21 320 * scsi_execute(). The state check
will wait if the adapter is still being
aacb4ff69eea4ac Matthew R. Ochs 2015-10-21 321 * recovered or return a failure if
the recovery failed. In the event that the
aacb4ff69eea4ac Matthew R. Ochs 2015-10-21 322 * adapter reset failed, simply
return the failure as the ioctl would be unable
aacb4ff69eea4ac Matthew R. Ochs 2015-10-21 323 * to continue.
aacb4ff69eea4ac Matthew R. Ochs 2015-10-21 324 *
aacb4ff69eea4ac Matthew R. Ochs 2015-10-21 325 * Note that the above puts a
requirement on this routine to only be called on
aacb4ff69eea4ac Matthew R. Ochs 2015-10-21 326 * an ioctl thread.
aacb4ff69eea4ac Matthew R. Ochs 2015-10-21 327 *
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 328 * Return: 0 on success, -errno on
failure
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 329 */
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 330 static int read_cap16(struct
scsi_device *sdev, struct llun_info *lli)
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 331 {
fb67d44dfbdf85d Matthew R. Ochs 2017-01-11 332 struct cxlflash_cfg *cfg =
shost_priv(sdev->host);
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 333 struct device *dev =
&cfg->dev->dev;
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 334 struct glun_info *gli =
lli->parent;
76aaf87b4cdc7f7 Christoph Hellwig 2017-02-23 335 struct scsi_sense_hdr sshdr;
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 336 u8 *cmd_buf = NULL;
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 337 u8 *scsi_cmd = NULL;
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 338 int rc = 0;
4e1b57cbdabcd44 Bart Van Assche 2021-04-09 339 union scsi_status result = { };
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 340 int retry_cnt = 0;
471a5a60aaf13b2 Manoj Kumar 2015-10-21 341 u32 to = CMD_TIMEOUT * HZ;
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 342
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 343 retry:
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 344 cmd_buf = kzalloc(CMD_BUFSIZE,
GFP_KERNEL);
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 345 scsi_cmd = kzalloc(MAX_COMMAND_SIZE,
GFP_KERNEL);
1fd89e4ddcec0c8 Kees Cook 2018-07-31 346 if (unlikely(!cmd_buf || !scsi_cmd))
{
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 347 rc = -ENOMEM;
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 348 goto out;
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 349 }
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 350
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 351 scsi_cmd[0] =
SERVICE_ACTION_IN_16; /* read cap(16) */
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 352 scsi_cmd[1] =
SAI_READ_CAPACITY_16; /* service action */
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 353 put_unaligned_be32(CMD_BUFSIZE,
&scsi_cmd[10]);
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 354
fb67d44dfbdf85d Matthew R. Ochs 2017-01-11 355 dev_dbg(dev, "%s: %ssending
cmd(%02x)\n", __func__,
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 356 retry_cnt ? "re" :
"", scsi_cmd[0]);
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 357
aacb4ff69eea4ac Matthew R. Ochs 2015-10-21 358 /* Drop the ioctl read semahpore
across lengthy call */
aacb4ff69eea4ac Matthew R. Ochs 2015-10-21 359 up_read(&cfg->ioctl_rwsem);
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 360 result = scsi_execute(sdev,
scsi_cmd, DMA_FROM_DEVICE, cmd_buf,
1fd89e4ddcec0c8 Kees Cook 2018-07-31 361 CMD_BUFSIZE, NULL,
&sshdr, to, CMD_RETRIES,
76aaf87b4cdc7f7 Christoph Hellwig 2017-02-23 362 0, 0, NULL);
aacb4ff69eea4ac Matthew R. Ochs 2015-10-21 363
down_read(&cfg->ioctl_rwsem);
aacb4ff69eea4ac Matthew R. Ochs 2015-10-21 364 rc = check_state(cfg);
aacb4ff69eea4ac Matthew R. Ochs 2015-10-21 365 if (rc) {
fb67d44dfbdf85d Matthew R. Ochs 2017-01-11 @366 dev_err(dev, "%s: Failed state
result=%08x\n",
aacb4ff69eea4ac Matthew R. Ochs 2015-10-21 367 __func__, result);
aacb4ff69eea4ac Matthew R. Ochs 2015-10-21 368 rc = -ENODEV;
aacb4ff69eea4ac Matthew R. Ochs 2015-10-21 369 goto out;
aacb4ff69eea4ac Matthew R. Ochs 2015-10-21 370 }
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 371
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 372 if (driver_byte(result) ==
DRIVER_SENSE) {
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 @373 result &= ~(0xFF<<24); /*
DRIVER_SENSE is not an error */
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 374 if (result &
SAM_STAT_CHECK_CONDITION) {
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 375 switch (sshdr.sense_key) {
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 376 case NO_SENSE:
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 377 case RECOVERED_ERROR:
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 378 case NOT_READY:
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 379 result &=
~SAM_STAT_CHECK_CONDITION;
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 380 break;
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 381 case UNIT_ATTENTION:
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 382 switch (sshdr.asc) {
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 383 case 0x29: /* Power on Reset or
Device Reset */
df561f6688fef77 Gustavo A. R. Silva 2020-08-23 384 fallthrough;
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 385 case 0x2A: /* Device capacity
changed */
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 386 case 0x3F: /* Report LUNs changed
*/
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 387 /* Retry the command once more
*/
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 388 if (retry_cnt++ < 1) {
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 389 kfree(cmd_buf);
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 390 kfree(scsi_cmd);
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 391 goto retry;
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 392 }
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 393 }
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 394 break;
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 395 default:
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 396 break;
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 397 }
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 398 }
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 399 }
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 400
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 @401 if (result) {
fb67d44dfbdf85d Matthew R. Ochs 2017-01-11 402 dev_err(dev, "%s: command
failed, result=%08x\n",
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 403 __func__, result);
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 404 rc = -EIO;
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 405 goto out;
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 406 }
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 407
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 408 /*
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 409 * Read cap was successful, grab
values from the buffer;
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 410 * note that we don't need to
worry about unaligned access
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 411 * as the buffer is allocated on an
aligned boundary.
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 412 */
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 413 mutex_lock(&gli->mutex);
1786f4a09331986 Matthew R. Ochs 2015-10-21 414 gli->max_lba =
be64_to_cpu(*((__be64 *)&cmd_buf[0]));
1786f4a09331986 Matthew R. Ochs 2015-10-21 415 gli->blk_len =
be32_to_cpu(*((__be32 *)&cmd_buf[8]));
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 416 mutex_unlock(&gli->mutex);
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 417
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 418 out:
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 419 kfree(cmd_buf);
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 420 kfree(scsi_cmd);
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 421
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 422 dev_dbg(dev, "%s: maxlba=%lld
blklen=%d rc=%d\n",
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 423 __func__, gli->max_lba,
gli->blk_len, rc);
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 424 return rc;
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 425 }
65be2c79acc3aa0 Matthew R. Ochs 2015-08-13 426
:::::: The code at line 373 was first introduced by commit
:::::: 65be2c79acc3aa0f9c0e8d4871f5a451d854465a cxlflash: Superpipe support
:::::: TO: Matthew R. Ochs <mrochs(a)linux.vnet.ibm.com>
:::::: CC: James Bottomley <JBottomley(a)Odin.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org