[gustavoars-linux:for-next/clang-fallthrough 1/1] drivers/scsi/st.c:3831:2: warning: unannotated fall-through between switch labels
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git for-next/clang-fallthrough
head: 3b37740f7d04ef32cc1a7bb17c2bc69d737c9056
commit: 3b37740f7d04ef32cc1a7bb17c2bc69d737c9056 [1/1] Makefile: Enable -Wimplicit-fallthrough for Clang
config: x86_64-randconfig-a016-20210816 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project af7818093677dcb4c0840aef96bc029deb219e57)
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://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git/comm...
git remote add gustavoars-linux https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git
git fetch --no-tags gustavoars-linux for-next/clang-fallthrough
git checkout 3b37740f7d04ef32cc1a7bb17c2bc69d737c9056
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
>> drivers/scsi/st.c:3831:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
default:
^
drivers/scsi/st.c:3831:2: note: insert 'break;' to avoid fall-through
default:
^
break;
1 warning generated.
vim +3831 drivers/scsi/st.c
8038e6456a3e6f Kai Makisara 2016-02-09 3353
8038e6456a3e6f Kai Makisara 2016-02-09 3354
^1da177e4c3f41 Linus Torvalds 2005-04-16 3355 /* Partition the tape into two partitions if size > 0 or one partition if
^1da177e4c3f41 Linus Torvalds 2005-04-16 3356 size == 0.
^1da177e4c3f41 Linus Torvalds 2005-04-16 3357
^1da177e4c3f41 Linus Torvalds 2005-04-16 3358 The block descriptors are read and written because Sony SDT-7000 does not
^1da177e4c3f41 Linus Torvalds 2005-04-16 3359 work without this (suggestion from Michael Schaefer <Michael.Schaefer(a)dlr.de>).
^1da177e4c3f41 Linus Torvalds 2005-04-16 3360
^1da177e4c3f41 Linus Torvalds 2005-04-16 3361 My HP C1533A drive returns only one partition size field. This is used to
^1da177e4c3f41 Linus Torvalds 2005-04-16 3362 set the size of partition 1. There is no size field for the default partition.
^1da177e4c3f41 Linus Torvalds 2005-04-16 3363 Michael Schaefer's Sony SDT-7000 returns two descriptors and the second is
^1da177e4c3f41 Linus Torvalds 2005-04-16 3364 used to set the size of partition 1 (this is what the SCSI-3 standard specifies).
^1da177e4c3f41 Linus Torvalds 2005-04-16 3365 The following algorithm is used to accommodate both drives: if the number of
^1da177e4c3f41 Linus Torvalds 2005-04-16 3366 partition size fields is greater than the maximum number of additional partitions
^1da177e4c3f41 Linus Torvalds 2005-04-16 3367 in the mode page, the second field is used. Otherwise the first field is used.
^1da177e4c3f41 Linus Torvalds 2005-04-16 3368
^1da177e4c3f41 Linus Torvalds 2005-04-16 3369 For Seagate DDS drives the page length must be 8 when no partitions is defined
^1da177e4c3f41 Linus Torvalds 2005-04-16 3370 and 10 when 1 partition is defined (information from Eric Lee Green). This is
^1da177e4c3f41 Linus Torvalds 2005-04-16 3371 is acceptable also to some other old drives and enforced if the first partition
^1da177e4c3f41 Linus Torvalds 2005-04-16 3372 size field is used for the first additional partition size.
8038e6456a3e6f Kai Makisara 2016-02-09 3373
8038e6456a3e6f Kai Makisara 2016-02-09 3374 For drives that advertize SCSI-3 or newer, use the SSC-3 methods.
^1da177e4c3f41 Linus Torvalds 2005-04-16 3375 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 3376 static int partition_tape(struct scsi_tape *STp, int size)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3377 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3378 int result;
8038e6456a3e6f Kai Makisara 2016-02-09 3379 int target_partition;
8038e6456a3e6f Kai Makisara 2016-02-09 3380 bool scsi3 = STp->device->scsi_level >= SCSI_3, needs_format = false;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3381 int pgo, psd_cnt, psdo;
8038e6456a3e6f Kai Makisara 2016-02-09 3382 int psum = PP_MSK_PSUM_MB, units = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3383 unsigned char *bp;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3384
^1da177e4c3f41 Linus Torvalds 2005-04-16 3385 result = read_mode_page(STp, PART_PAGE, 0);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3386 if (result) {
b30d8bca5b525b Hannes Reinecke 2014-06-25 3387 DEBC_printk(STp, "Can't read partition mode page.\n");
^1da177e4c3f41 Linus Torvalds 2005-04-16 3388 return result;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3389 }
8038e6456a3e6f Kai Makisara 2016-02-09 3390 target_partition = 1;
8038e6456a3e6f Kai Makisara 2016-02-09 3391 if (size < 0) {
8038e6456a3e6f Kai Makisara 2016-02-09 3392 target_partition = 0;
8038e6456a3e6f Kai Makisara 2016-02-09 3393 size = -size;
8038e6456a3e6f Kai Makisara 2016-02-09 3394 }
8038e6456a3e6f Kai Makisara 2016-02-09 3395
^1da177e4c3f41 Linus Torvalds 2005-04-16 3396 /* The mode page is in the buffer. Let's modify it and write it. */
^1da177e4c3f41 Linus Torvalds 2005-04-16 3397 bp = (STp->buffer)->b_data;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3398 pgo = MODE_HEADER_LENGTH + bp[MH_OFF_BDESCS_LENGTH];
b30d8bca5b525b Hannes Reinecke 2014-06-25 3399 DEBC_printk(STp, "Partition page length is %d bytes.\n",
b30d8bca5b525b Hannes Reinecke 2014-06-25 3400 bp[pgo + MP_OFF_PAGE_LENGTH] + 2);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3401
^1da177e4c3f41 Linus Torvalds 2005-04-16 3402 psd_cnt = (bp[pgo + MP_OFF_PAGE_LENGTH] + 2 - PART_PAGE_FIXED_LENGTH) / 2;
8038e6456a3e6f Kai Makisara 2016-02-09 3403
8038e6456a3e6f Kai Makisara 2016-02-09 3404 if (scsi3) {
8038e6456a3e6f Kai Makisara 2016-02-09 3405 needs_format = (bp[pgo + PP_OFF_FLAGS] & PP_MSK_POFM) != 0;
8038e6456a3e6f Kai Makisara 2016-02-09 3406 if (needs_format && size == 0) {
8038e6456a3e6f Kai Makisara 2016-02-09 3407 /* No need to write the mode page when clearing
8038e6456a3e6f Kai Makisara 2016-02-09 3408 * partitioning
8038e6456a3e6f Kai Makisara 2016-02-09 3409 */
8038e6456a3e6f Kai Makisara 2016-02-09 3410 DEBC_printk(STp, "Formatting tape with one partition.\n");
8038e6456a3e6f Kai Makisara 2016-02-09 3411 result = format_medium(STp, 0);
8038e6456a3e6f Kai Makisara 2016-02-09 3412 goto out;
8038e6456a3e6f Kai Makisara 2016-02-09 3413 }
8038e6456a3e6f Kai Makisara 2016-02-09 3414 if (needs_format) /* Leave the old value for HP DATs claiming SCSI_3 */
8038e6456a3e6f Kai Makisara 2016-02-09 3415 psd_cnt = 2;
8038e6456a3e6f Kai Makisara 2016-02-09 3416 if ((bp[pgo + PP_OFF_FLAGS] & PP_MSK_PSUM_UNITS) == PP_MSK_PSUM_UNITS) {
8038e6456a3e6f Kai Makisara 2016-02-09 3417 /* Use units scaling for large partitions if the device
8038e6456a3e6f Kai Makisara 2016-02-09 3418 * suggests it and no precision lost. Required for IBM
8038e6456a3e6f Kai Makisara 2016-02-09 3419 * TS1140/50 drives that don't support MB units.
8038e6456a3e6f Kai Makisara 2016-02-09 3420 */
8038e6456a3e6f Kai Makisara 2016-02-09 3421 if (size >= 1000 && (size % 1000) == 0) {
8038e6456a3e6f Kai Makisara 2016-02-09 3422 size /= 1000;
8038e6456a3e6f Kai Makisara 2016-02-09 3423 psum = PP_MSK_PSUM_UNITS;
8038e6456a3e6f Kai Makisara 2016-02-09 3424 units = 9; /* GB */
8038e6456a3e6f Kai Makisara 2016-02-09 3425 }
8038e6456a3e6f Kai Makisara 2016-02-09 3426 }
8038e6456a3e6f Kai Makisara 2016-02-09 3427 /* Try it anyway if too large to specify in MB */
8038e6456a3e6f Kai Makisara 2016-02-09 3428 if (psum == PP_MSK_PSUM_MB && size >= 65534) {
8038e6456a3e6f Kai Makisara 2016-02-09 3429 size /= 1000;
8038e6456a3e6f Kai Makisara 2016-02-09 3430 psum = PP_MSK_PSUM_UNITS;
8038e6456a3e6f Kai Makisara 2016-02-09 3431 units = 9; /* GB */
8038e6456a3e6f Kai Makisara 2016-02-09 3432 }
8038e6456a3e6f Kai Makisara 2016-02-09 3433 }
8038e6456a3e6f Kai Makisara 2016-02-09 3434
8038e6456a3e6f Kai Makisara 2016-02-09 3435 if (size >= 65535 || /* Does not fit into two bytes */
8038e6456a3e6f Kai Makisara 2016-02-09 3436 (target_partition == 0 && psd_cnt < 2)) {
8038e6456a3e6f Kai Makisara 2016-02-09 3437 result = -EINVAL;
8038e6456a3e6f Kai Makisara 2016-02-09 3438 goto out;
8038e6456a3e6f Kai Makisara 2016-02-09 3439 }
8038e6456a3e6f Kai Makisara 2016-02-09 3440
^1da177e4c3f41 Linus Torvalds 2005-04-16 3441 psdo = pgo + PART_PAGE_FIXED_LENGTH;
8038e6456a3e6f Kai Makisara 2016-02-09 3442 /* The second condition is for HP DDS which use only one partition size
8038e6456a3e6f Kai Makisara 2016-02-09 3443 * descriptor
8038e6456a3e6f Kai Makisara 2016-02-09 3444 */
8038e6456a3e6f Kai Makisara 2016-02-09 3445 if (target_partition > 0 &&
8038e6456a3e6f Kai Makisara 2016-02-09 3446 (psd_cnt > bp[pgo + PP_OFF_MAX_ADD_PARTS] ||
8038e6456a3e6f Kai Makisara 2016-02-09 3447 bp[pgo + PP_OFF_MAX_ADD_PARTS] != 1)) {
8038e6456a3e6f Kai Makisara 2016-02-09 3448 bp[psdo] = bp[psdo + 1] = 0xff; /* Rest to partition 0 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 3449 psdo += 2;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3450 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3451 memset(bp + psdo, 0, bp[pgo + PP_OFF_NBR_ADD_PARTS] * 2);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3452
b30d8bca5b525b Hannes Reinecke 2014-06-25 3453 DEBC_printk(STp, "psd_cnt %d, max.parts %d, nbr_parts %d\n",
^1da177e4c3f41 Linus Torvalds 2005-04-16 3454 psd_cnt, bp[pgo + PP_OFF_MAX_ADD_PARTS],
b30d8bca5b525b Hannes Reinecke 2014-06-25 3455 bp[pgo + PP_OFF_NBR_ADD_PARTS]);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3456
8038e6456a3e6f Kai Makisara 2016-02-09 3457 if (size == 0) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3458 bp[pgo + PP_OFF_NBR_ADD_PARTS] = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3459 if (psd_cnt <= bp[pgo + PP_OFF_MAX_ADD_PARTS])
^1da177e4c3f41 Linus Torvalds 2005-04-16 3460 bp[pgo + MP_OFF_PAGE_LENGTH] = 6;
b30d8bca5b525b Hannes Reinecke 2014-06-25 3461 DEBC_printk(STp, "Formatting tape with one partition.\n");
^1da177e4c3f41 Linus Torvalds 2005-04-16 3462 } else {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3463 bp[psdo] = (size >> 8) & 0xff;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3464 bp[psdo + 1] = size & 0xff;
8038e6456a3e6f Kai Makisara 2016-02-09 3465 if (target_partition == 0)
8038e6456a3e6f Kai Makisara 2016-02-09 3466 bp[psdo + 2] = bp[psdo + 3] = 0xff;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3467 bp[pgo + 3] = 1;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3468 if (bp[pgo + MP_OFF_PAGE_LENGTH] < 8)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3469 bp[pgo + MP_OFF_PAGE_LENGTH] = 8;
8038e6456a3e6f Kai Makisara 2016-02-09 3470 DEBC_printk(STp,
8038e6456a3e6f Kai Makisara 2016-02-09 3471 "Formatting tape with two partitions (%i = %d MB).\n",
8038e6456a3e6f Kai Makisara 2016-02-09 3472 target_partition, units > 0 ? size * 1000 : size);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3473 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3474 bp[pgo + PP_OFF_PART_UNITS] = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3475 bp[pgo + PP_OFF_RESERVED] = 0;
8038e6456a3e6f Kai Makisara 2016-02-09 3476 if (size != 1 || units != 0) {
8038e6456a3e6f Kai Makisara 2016-02-09 3477 bp[pgo + PP_OFF_FLAGS] = PP_BIT_IDP | psum |
8038e6456a3e6f Kai Makisara 2016-02-09 3478 (bp[pgo + PP_OFF_FLAGS] & 0x07);
8038e6456a3e6f Kai Makisara 2016-02-09 3479 bp[pgo + PP_OFF_PART_UNITS] = units;
8038e6456a3e6f Kai Makisara 2016-02-09 3480 } else
8038e6456a3e6f Kai Makisara 2016-02-09 3481 bp[pgo + PP_OFF_FLAGS] = PP_BIT_FDP |
8038e6456a3e6f Kai Makisara 2016-02-09 3482 (bp[pgo + PP_OFF_FLAGS] & 0x1f);
8038e6456a3e6f Kai Makisara 2016-02-09 3483 bp[pgo + MP_OFF_PAGE_LENGTH] = 6 + psd_cnt * 2;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3484
^1da177e4c3f41 Linus Torvalds 2005-04-16 3485 result = write_mode_page(STp, PART_PAGE, 1);
8038e6456a3e6f Kai Makisara 2016-02-09 3486
8038e6456a3e6f Kai Makisara 2016-02-09 3487 if (!result && needs_format)
8038e6456a3e6f Kai Makisara 2016-02-09 3488 result = format_medium(STp, 1);
8038e6456a3e6f Kai Makisara 2016-02-09 3489
^1da177e4c3f41 Linus Torvalds 2005-04-16 3490 if (result) {
b30d8bca5b525b Hannes Reinecke 2014-06-25 3491 st_printk(KERN_INFO, STp, "Partitioning of tape failed.\n");
^1da177e4c3f41 Linus Torvalds 2005-04-16 3492 result = (-EIO);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3493 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3494
8038e6456a3e6f Kai Makisara 2016-02-09 3495 out:
^1da177e4c3f41 Linus Torvalds 2005-04-16 3496 return result;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3497 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3498
^1da177e4c3f41 Linus Torvalds 2005-04-16 3499
^1da177e4c3f41 Linus Torvalds 2005-04-16 3500
^1da177e4c3f41 Linus Torvalds 2005-04-16 3501 /* The ioctl command */
dba7688fc9037c Christoph Hellwig 2021-07-24 3502 static long st_ioctl(struct file *file, unsigned int cmd_in, unsigned long arg)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3503 {
dba7688fc9037c Christoph Hellwig 2021-07-24 3504 void __user *p = (void __user *)arg;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3505 int i, cmd_nr, cmd_type, bt;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3506 int retval = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3507 unsigned int blk;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3508 struct scsi_tape *STp = file->private_data;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3509 struct st_modedef *STm;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3510 struct st_partstat *STps;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3511
28f85009e0cf6a Matthias Kaehlcke 2007-07-29 3512 if (mutex_lock_interruptible(&STp->lock))
^1da177e4c3f41 Linus Torvalds 2005-04-16 3513 return -ERESTARTSYS;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3514
^1da177e4c3f41 Linus Torvalds 2005-04-16 3515 DEB(
^1da177e4c3f41 Linus Torvalds 2005-04-16 3516 if (debugging && !STp->in_use) {
b30d8bca5b525b Hannes Reinecke 2014-06-25 3517 st_printk(ST_DEB_MSG, STp, "Incorrect device.\n");
^1da177e4c3f41 Linus Torvalds 2005-04-16 3518 retval = (-EIO);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3519 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3520 } ) /* end DEB */
^1da177e4c3f41 Linus Torvalds 2005-04-16 3521
^1da177e4c3f41 Linus Torvalds 2005-04-16 3522 STm = &(STp->modes[STp->current_mode]);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3523 STps = &(STp->ps[STp->partition]);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3524
^1da177e4c3f41 Linus Torvalds 2005-04-16 3525 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 3526 * If we are in the middle of error recovery, don't let anyone
^1da177e4c3f41 Linus Torvalds 2005-04-16 3527 * else try and use this device. Also, if error recovery fails, it
^1da177e4c3f41 Linus Torvalds 2005-04-16 3528 * may try and take the device offline, in which case all further
^1da177e4c3f41 Linus Torvalds 2005-04-16 3529 * access to the device is prohibited.
^1da177e4c3f41 Linus Torvalds 2005-04-16 3530 */
906d15fbd23c12 Christoph Hellwig 2014-10-11 3531 retval = scsi_ioctl_block_when_processing_errors(STp->device, cmd_in,
83ff6fe8580a7c Al Viro 2008-03-02 3532 file->f_flags & O_NDELAY);
906d15fbd23c12 Christoph Hellwig 2014-10-11 3533 if (retval)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3534 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3535
^1da177e4c3f41 Linus Torvalds 2005-04-16 3536 cmd_type = _IOC_TYPE(cmd_in);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3537 cmd_nr = _IOC_NR(cmd_in);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3538
^1da177e4c3f41 Linus Torvalds 2005-04-16 3539 if (cmd_type == _IOC_TYPE(MTIOCTOP) && cmd_nr == _IOC_NR(MTIOCTOP)) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3540 struct mtop mtc;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3541
^1da177e4c3f41 Linus Torvalds 2005-04-16 3542 if (_IOC_SIZE(cmd_in) != sizeof(mtc)) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3543 retval = (-EINVAL);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3544 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3545 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3546
^1da177e4c3f41 Linus Torvalds 2005-04-16 3547 i = copy_from_user(&mtc, p, sizeof(struct mtop));
^1da177e4c3f41 Linus Torvalds 2005-04-16 3548 if (i) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3549 retval = (-EFAULT);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3550 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3551 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3552
^1da177e4c3f41 Linus Torvalds 2005-04-16 3553 if (mtc.mt_op == MTSETDRVBUFFER && !capable(CAP_SYS_ADMIN)) {
b30d8bca5b525b Hannes Reinecke 2014-06-25 3554 st_printk(KERN_WARNING, STp,
b30d8bca5b525b Hannes Reinecke 2014-06-25 3555 "MTSETDRVBUFFER only allowed for root.\n");
^1da177e4c3f41 Linus Torvalds 2005-04-16 3556 retval = (-EPERM);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3557 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3558 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3559 if (!STm->defined &&
^1da177e4c3f41 Linus Torvalds 2005-04-16 3560 (mtc.mt_op != MTSETDRVBUFFER &&
^1da177e4c3f41 Linus Torvalds 2005-04-16 3561 (mtc.mt_count & MT_ST_OPTIONS) == 0)) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3562 retval = (-ENXIO);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3563 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3564 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3565
^1da177e4c3f41 Linus Torvalds 2005-04-16 3566 if (!STp->pos_unknown) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3567
^1da177e4c3f41 Linus Torvalds 2005-04-16 3568 if (STps->eof == ST_FM_HIT) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3569 if (mtc.mt_op == MTFSF || mtc.mt_op == MTFSFM ||
^1da177e4c3f41 Linus Torvalds 2005-04-16 3570 mtc.mt_op == MTEOM) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3571 mtc.mt_count -= 1;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3572 if (STps->drv_file >= 0)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3573 STps->drv_file += 1;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3574 } else if (mtc.mt_op == MTBSF || mtc.mt_op == MTBSFM) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3575 mtc.mt_count += 1;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3576 if (STps->drv_file >= 0)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3577 STps->drv_file += 1;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3578 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3579 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3580
^1da177e4c3f41 Linus Torvalds 2005-04-16 3581 if (mtc.mt_op == MTSEEK) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3582 /* Old position must be restored if partition will be
^1da177e4c3f41 Linus Torvalds 2005-04-16 3583 changed */
^1da177e4c3f41 Linus Torvalds 2005-04-16 3584 i = !STp->can_partitions ||
^1da177e4c3f41 Linus Torvalds 2005-04-16 3585 (STp->new_partition != STp->partition);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3586 } else {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3587 i = mtc.mt_op == MTREW || mtc.mt_op == MTOFFL ||
^1da177e4c3f41 Linus Torvalds 2005-04-16 3588 mtc.mt_op == MTRETEN || mtc.mt_op == MTEOM ||
^1da177e4c3f41 Linus Torvalds 2005-04-16 3589 mtc.mt_op == MTLOCK || mtc.mt_op == MTLOAD ||
^1da177e4c3f41 Linus Torvalds 2005-04-16 3590 mtc.mt_op == MTFSF || mtc.mt_op == MTFSFM ||
^1da177e4c3f41 Linus Torvalds 2005-04-16 3591 mtc.mt_op == MTBSF || mtc.mt_op == MTBSFM ||
^1da177e4c3f41 Linus Torvalds 2005-04-16 3592 mtc.mt_op == MTCOMPRESSION;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3593 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3594 i = flush_buffer(STp, i);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3595 if (i < 0) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3596 retval = i;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3597 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3598 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3599 if (STps->rw == ST_WRITING &&
^1da177e4c3f41 Linus Torvalds 2005-04-16 3600 (mtc.mt_op == MTREW || mtc.mt_op == MTOFFL ||
^1da177e4c3f41 Linus Torvalds 2005-04-16 3601 mtc.mt_op == MTSEEK ||
^1da177e4c3f41 Linus Torvalds 2005-04-16 3602 mtc.mt_op == MTBSF || mtc.mt_op == MTBSFM)) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3603 i = st_int_ioctl(STp, MTWEOF, 1);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3604 if (i < 0) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3605 retval = i;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3606 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3607 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3608 if (mtc.mt_op == MTBSF || mtc.mt_op == MTBSFM)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3609 mtc.mt_count++;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3610 STps->rw = ST_IDLE;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3611 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3612
^1da177e4c3f41 Linus Torvalds 2005-04-16 3613 } else {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3614 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 3615 * If there was a bus reset, block further access
^1da177e4c3f41 Linus Torvalds 2005-04-16 3616 * to this device. If the user wants to rewind the tape,
^1da177e4c3f41 Linus Torvalds 2005-04-16 3617 * then reset the flag and allow access again.
^1da177e4c3f41 Linus Torvalds 2005-04-16 3618 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 3619 if (mtc.mt_op != MTREW &&
^1da177e4c3f41 Linus Torvalds 2005-04-16 3620 mtc.mt_op != MTOFFL &&
^1da177e4c3f41 Linus Torvalds 2005-04-16 3621 mtc.mt_op != MTRETEN &&
^1da177e4c3f41 Linus Torvalds 2005-04-16 3622 mtc.mt_op != MTERASE &&
^1da177e4c3f41 Linus Torvalds 2005-04-16 3623 mtc.mt_op != MTSEEK &&
^1da177e4c3f41 Linus Torvalds 2005-04-16 3624 mtc.mt_op != MTEOM) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3625 retval = (-EIO);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3626 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3627 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3628 reset_state(STp);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3629 /* remove this when the midlevel properly clears was_reset */
^1da177e4c3f41 Linus Torvalds 2005-04-16 3630 STp->device->was_reset = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3631 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3632
^1da177e4c3f41 Linus Torvalds 2005-04-16 3633 if (mtc.mt_op != MTNOP && mtc.mt_op != MTSETBLK &&
^1da177e4c3f41 Linus Torvalds 2005-04-16 3634 mtc.mt_op != MTSETDENSITY && mtc.mt_op != MTWSM &&
^1da177e4c3f41 Linus Torvalds 2005-04-16 3635 mtc.mt_op != MTSETDRVBUFFER && mtc.mt_op != MTSETPART)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3636 STps->rw = ST_IDLE; /* Prevent automatic WEOF and fsf */
^1da177e4c3f41 Linus Torvalds 2005-04-16 3637
^1da177e4c3f41 Linus Torvalds 2005-04-16 3638 if (mtc.mt_op == MTOFFL && STp->door_locked != ST_UNLOCKED)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3639 do_door_lock(STp, 0); /* Ignore result! */
^1da177e4c3f41 Linus Torvalds 2005-04-16 3640
^1da177e4c3f41 Linus Torvalds 2005-04-16 3641 if (mtc.mt_op == MTSETDRVBUFFER &&
^1da177e4c3f41 Linus Torvalds 2005-04-16 3642 (mtc.mt_count & MT_ST_OPTIONS) != 0) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3643 retval = st_set_options(STp, mtc.mt_count);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3644 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3645 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3646
^1da177e4c3f41 Linus Torvalds 2005-04-16 3647 if (mtc.mt_op == MTSETPART) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3648 if (!STp->can_partitions ||
^1da177e4c3f41 Linus Torvalds 2005-04-16 3649 mtc.mt_count < 0 || mtc.mt_count >= ST_NBR_PARTITIONS) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3650 retval = (-EINVAL);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3651 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3652 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3653 if (mtc.mt_count >= STp->nbr_partitions &&
^1da177e4c3f41 Linus Torvalds 2005-04-16 3654 (STp->nbr_partitions = nbr_partitions(STp)) < 0) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3655 retval = (-EIO);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3656 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3657 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3658 if (mtc.mt_count >= STp->nbr_partitions) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3659 retval = (-EINVAL);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3660 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3661 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3662 STp->new_partition = mtc.mt_count;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3663 retval = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3664 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3665 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3666
^1da177e4c3f41 Linus Torvalds 2005-04-16 3667 if (mtc.mt_op == MTMKPART) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3668 if (!STp->can_partitions) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3669 retval = (-EINVAL);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3670 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3671 }
8038e6456a3e6f Kai Makisara 2016-02-09 3672 i = do_load_unload(STp, file, 1);
8038e6456a3e6f Kai Makisara 2016-02-09 3673 if (i < 0) {
8038e6456a3e6f Kai Makisara 2016-02-09 3674 retval = i;
8038e6456a3e6f Kai Makisara 2016-02-09 3675 goto out;
8038e6456a3e6f Kai Makisara 2016-02-09 3676 }
8038e6456a3e6f Kai Makisara 2016-02-09 3677 i = partition_tape(STp, mtc.mt_count);
8038e6456a3e6f Kai Makisara 2016-02-09 3678 if (i < 0) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3679 retval = i;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3680 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3681 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3682 for (i = 0; i < ST_NBR_PARTITIONS; i++) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3683 STp->ps[i].rw = ST_IDLE;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3684 STp->ps[i].at_sm = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3685 STp->ps[i].last_block_valid = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3686 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3687 STp->partition = STp->new_partition = 0;
8038e6456a3e6f Kai Makisara 2016-02-09 3688 STp->nbr_partitions = mtc.mt_count != 0 ? 2 : 1;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3689 STps->drv_block = STps->drv_file = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3690 retval = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3691 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3692 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3693
^1da177e4c3f41 Linus Torvalds 2005-04-16 3694 if (mtc.mt_op == MTSEEK) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3695 i = set_location(STp, mtc.mt_count, STp->new_partition, 0);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3696 if (!STp->can_partitions)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3697 STp->ps[0].rw = ST_IDLE;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3698 retval = i;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3699 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3700 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3701
^1da177e4c3f41 Linus Torvalds 2005-04-16 3702 if (mtc.mt_op == MTUNLOAD || mtc.mt_op == MTOFFL) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3703 retval = do_load_unload(STp, file, 0);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3704 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3705 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3706
^1da177e4c3f41 Linus Torvalds 2005-04-16 3707 if (mtc.mt_op == MTLOAD) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3708 retval = do_load_unload(STp, file, max(1, mtc.mt_count));
^1da177e4c3f41 Linus Torvalds 2005-04-16 3709 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3710 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3711
^1da177e4c3f41 Linus Torvalds 2005-04-16 3712 if (mtc.mt_op == MTLOCK || mtc.mt_op == MTUNLOCK) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3713 retval = do_door_lock(STp, (mtc.mt_op == MTLOCK));
^1da177e4c3f41 Linus Torvalds 2005-04-16 3714 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3715 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3716
^1da177e4c3f41 Linus Torvalds 2005-04-16 3717 if (STp->can_partitions && STp->ready == ST_READY &&
^1da177e4c3f41 Linus Torvalds 2005-04-16 3718 (i = switch_partition(STp)) < 0) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3719 retval = i;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3720 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3721 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3722
^1da177e4c3f41 Linus Torvalds 2005-04-16 3723 if (mtc.mt_op == MTCOMPRESSION)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3724 retval = st_compression(STp, (mtc.mt_count & 1));
^1da177e4c3f41 Linus Torvalds 2005-04-16 3725 else
^1da177e4c3f41 Linus Torvalds 2005-04-16 3726 retval = st_int_ioctl(STp, mtc.mt_op, mtc.mt_count);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3727 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3728 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3729 if (!STm->defined) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3730 retval = (-ENXIO);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3731 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3732 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3733
^1da177e4c3f41 Linus Torvalds 2005-04-16 3734 if ((i = flush_buffer(STp, 0)) < 0) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3735 retval = i;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3736 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3737 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3738 if (STp->can_partitions &&
^1da177e4c3f41 Linus Torvalds 2005-04-16 3739 (i = switch_partition(STp)) < 0) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3740 retval = i;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3741 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3742 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3743
^1da177e4c3f41 Linus Torvalds 2005-04-16 3744 if (cmd_type == _IOC_TYPE(MTIOCGET) && cmd_nr == _IOC_NR(MTIOCGET)) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3745 struct mtget mt_status;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3746
^1da177e4c3f41 Linus Torvalds 2005-04-16 3747 if (_IOC_SIZE(cmd_in) != sizeof(struct mtget)) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3748 retval = (-EINVAL);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3749 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3750 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3751
^1da177e4c3f41 Linus Torvalds 2005-04-16 3752 mt_status.mt_type = STp->tape_type;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3753 mt_status.mt_dsreg =
^1da177e4c3f41 Linus Torvalds 2005-04-16 3754 ((STp->block_size << MT_ST_BLKSIZE_SHIFT) & MT_ST_BLKSIZE_MASK) |
^1da177e4c3f41 Linus Torvalds 2005-04-16 3755 ((STp->density << MT_ST_DENSITY_SHIFT) & MT_ST_DENSITY_MASK);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3756 mt_status.mt_blkno = STps->drv_block;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3757 mt_status.mt_fileno = STps->drv_file;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3758 if (STp->block_size != 0) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3759 if (STps->rw == ST_WRITING)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3760 mt_status.mt_blkno +=
^1da177e4c3f41 Linus Torvalds 2005-04-16 3761 (STp->buffer)->buffer_bytes / STp->block_size;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3762 else if (STps->rw == ST_READING)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3763 mt_status.mt_blkno -=
^1da177e4c3f41 Linus Torvalds 2005-04-16 3764 ((STp->buffer)->buffer_bytes +
^1da177e4c3f41 Linus Torvalds 2005-04-16 3765 STp->block_size - 1) / STp->block_size;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3766 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3767
^1da177e4c3f41 Linus Torvalds 2005-04-16 3768 mt_status.mt_gstat = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3769 if (STp->drv_write_prot)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3770 mt_status.mt_gstat |= GMT_WR_PROT(0xffffffff);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3771 if (mt_status.mt_blkno == 0) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3772 if (mt_status.mt_fileno == 0)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3773 mt_status.mt_gstat |= GMT_BOT(0xffffffff);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3774 else
^1da177e4c3f41 Linus Torvalds 2005-04-16 3775 mt_status.mt_gstat |= GMT_EOF(0xffffffff);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3776 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3777 mt_status.mt_erreg = (STp->recover_reg << MT_ST_SOFTERR_SHIFT);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3778 mt_status.mt_resid = STp->partition;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3779 if (STps->eof == ST_EOM_OK || STps->eof == ST_EOM_ERROR)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3780 mt_status.mt_gstat |= GMT_EOT(0xffffffff);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3781 else if (STps->eof >= ST_EOM_OK)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3782 mt_status.mt_gstat |= GMT_EOD(0xffffffff);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3783 if (STp->density == 1)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3784 mt_status.mt_gstat |= GMT_D_800(0xffffffff);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3785 else if (STp->density == 2)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3786 mt_status.mt_gstat |= GMT_D_1600(0xffffffff);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3787 else if (STp->density == 3)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3788 mt_status.mt_gstat |= GMT_D_6250(0xffffffff);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3789 if (STp->ready == ST_READY)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3790 mt_status.mt_gstat |= GMT_ONLINE(0xffffffff);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3791 if (STp->ready == ST_NO_TAPE)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3792 mt_status.mt_gstat |= GMT_DR_OPEN(0xffffffff);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3793 if (STps->at_sm)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3794 mt_status.mt_gstat |= GMT_SM(0xffffffff);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3795 if (STm->do_async_writes ||
^1da177e4c3f41 Linus Torvalds 2005-04-16 3796 (STm->do_buffer_writes && STp->block_size != 0) ||
^1da177e4c3f41 Linus Torvalds 2005-04-16 3797 STp->drv_buffer != 0)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3798 mt_status.mt_gstat |= GMT_IM_REP_EN(0xffffffff);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3799 if (STp->cleaning_req)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3800 mt_status.mt_gstat |= GMT_CLN(0xffffffff);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3801
1207045da5a7c9 Arnd Bergmann 2018-09-07 3802 retval = put_user_mtget(p, &mt_status);
1207045da5a7c9 Arnd Bergmann 2018-09-07 3803 if (retval)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3804 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3805
^1da177e4c3f41 Linus Torvalds 2005-04-16 3806 STp->recover_reg = 0; /* Clear after read */
^1da177e4c3f41 Linus Torvalds 2005-04-16 3807 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3808 } /* End of MTIOCGET */
^1da177e4c3f41 Linus Torvalds 2005-04-16 3809 if (cmd_type == _IOC_TYPE(MTIOCPOS) && cmd_nr == _IOC_NR(MTIOCPOS)) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3810 struct mtpos mt_pos;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3811 if (_IOC_SIZE(cmd_in) != sizeof(struct mtpos)) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3812 retval = (-EINVAL);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3813 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3814 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3815 if ((i = get_location(STp, &blk, &bt, 0)) < 0) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3816 retval = i;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3817 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3818 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3819 mt_pos.mt_blkno = blk;
1207045da5a7c9 Arnd Bergmann 2018-09-07 3820 retval = put_user_mtpos(p, &mt_pos);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3821 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3822 }
28f85009e0cf6a Matthias Kaehlcke 2007-07-29 3823 mutex_unlock(&STp->lock);
d320a9551e394c Arnd Bergmann 2019-03-15 3824
dba7688fc9037c Christoph Hellwig 2021-07-24 3825 switch (cmd_in) {
dba7688fc9037c Christoph Hellwig 2021-07-24 3826 case SG_IO:
dba7688fc9037c Christoph Hellwig 2021-07-24 3827 case SCSI_IOCTL_SEND_COMMAND:
dba7688fc9037c Christoph Hellwig 2021-07-24 3828 case CDROM_SEND_PACKET:
dba7688fc9037c Christoph Hellwig 2021-07-24 3829 if (!capable(CAP_SYS_RAWIO))
dba7688fc9037c Christoph Hellwig 2021-07-24 3830 return -EPERM;
^1da177e4c3f41 Linus Torvalds 2005-04-16 @3831 default:
^1da177e4c3f41 Linus Torvalds 2005-04-16 3832 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3833 }
dba7688fc9037c Christoph Hellwig 2021-07-24 3834
2e27f576abc6f0 Christoph Hellwig 2021-07-24 3835 retval = scsi_ioctl(STp->device, STp->disk, file->f_mode, cmd_in, p);
dba7688fc9037c Christoph Hellwig 2021-07-24 3836 if (!retval && cmd_in == SCSI_IOCTL_STOP_UNIT) {
dba7688fc9037c Christoph Hellwig 2021-07-24 3837 /* unload */
dba7688fc9037c Christoph Hellwig 2021-07-24 3838 STp->rew_at_close = 0;
dba7688fc9037c Christoph Hellwig 2021-07-24 3839 STp->ready = ST_NO_TAPE;
dba7688fc9037c Christoph Hellwig 2021-07-24 3840 }
dba7688fc9037c Christoph Hellwig 2021-07-24 3841 return retval;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3842
^1da177e4c3f41 Linus Torvalds 2005-04-16 3843 out:
28f85009e0cf6a Matthias Kaehlcke 2007-07-29 3844 mutex_unlock(&STp->lock);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3845 return retval;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3846 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3847
:::::: The code at line 3831 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2
:::::: TO: Linus Torvalds <torvalds(a)ppc970.osdl.org>
:::::: CC: Linus Torvalds <torvalds(a)ppc970.osdl.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 1 month
Re: [PATCH v3] soc: rockchip: io-domain: set 3.3V before regulator disable
by kernel test robot
Hi Jianqun,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on rockchip/for-next]
[also build test ERROR on asoc/for-next v5.14-rc6 next-20210817]
[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/Jianqun-Xu/soc-rockchip-io-domai...
base: https://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip.git for-next
config: arm64-randconfig-r011-20210816 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project af7818093677dcb4c0840aef96bc029deb219e57)
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 arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
# https://github.com/0day-ci/linux/commit/883d33a4052a54385679fe84a17345d70...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Jianqun-Xu/soc-rockchip-io-domain-set-3-3V-before-regulator-disable/20210818-091213
git checkout 883d33a4052a54385679fe84a17345d7083f3a76
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/soc/rockchip/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
>> drivers/soc/rockchip/io-domain.c:173:21: error: use of undeclared identifier 'REGULATOR_EVENT_PRE_ENABLE'
} else if (event & REGULATOR_EVENT_PRE_ENABLE) {
^
1 error generated.
vim +/REGULATOR_EVENT_PRE_ENABLE +173 drivers/soc/rockchip/io-domain.c
143
144 static int rockchip_iodomain_notify(struct notifier_block *nb,
145 unsigned long event,
146 void *data)
147 {
148 struct rockchip_iodomain_supply *supply =
149 container_of(nb, struct rockchip_iodomain_supply, nb);
150 int uV;
151 int ret;
152
153 /*
154 * According to Rockchip it's important to keep the SoC IO domain
155 * higher than (or equal to) the external voltage. That means we need
156 * to change it before external voltage changes happen in the case
157 * of an increase.
158 *
159 * Note that in the "pre" change we pick the max possible voltage that
160 * the regulator might end up at (the client requests a range and we
161 * don't know for certain the exact voltage). Right now we rely on the
162 * slop in MAX_VOLTAGE_1_8 and MAX_VOLTAGE_3_3 to save us if clients
163 * request something like a max of 3.6V when they really want 3.3V.
164 * We could attempt to come up with better rules if this fails.
165 */
166 if (event & REGULATOR_EVENT_PRE_VOLTAGE_CHANGE) {
167 struct pre_voltage_change_data *pvc_data = data;
168
169 uV = max_t(unsigned long, pvc_data->old_uV, pvc_data->max_uV);
170 } else if (event & (REGULATOR_EVENT_VOLTAGE_CHANGE |
171 REGULATOR_EVENT_ABORT_VOLTAGE_CHANGE)) {
172 uV = (unsigned long)data;
> 173 } else if (event & REGULATOR_EVENT_PRE_ENABLE) {
174 uV = MAX_VOLTAGE_3_3;
175 } else if (event & REGULATOR_EVENT_PRE_DISABLE) {
176 uV = MAX_VOLTAGE_3_3;
177 } else if (event & REGULATOR_EVENT_ENABLE) {
178 uV = regulator_get_voltage(supply->reg);
179 } else {
180 return NOTIFY_OK;
181 }
182
183 dev_dbg(supply->iod->dev, "Setting to %d\n", uV);
184
185 if (uV > MAX_VOLTAGE_3_3) {
186 dev_err(supply->iod->dev, "Voltage too high: %d\n", uV);
187
188 if (event == REGULATOR_EVENT_PRE_VOLTAGE_CHANGE)
189 return NOTIFY_BAD;
190 }
191
192 ret = supply->iod->write(supply, uV);
193 if (ret && event == REGULATOR_EVENT_PRE_VOLTAGE_CHANGE)
194 return NOTIFY_BAD;
195
196 dev_dbg(supply->iod->dev, "Setting to %d done\n", uV);
197 return NOTIFY_OK;
198 }
199
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 1 month
[android-common:android11-5.4 3942/13266] drivers/rtc/hctosys.c:24:5: warning: no previous prototype for 'rtc_hctosys'
by kernel test robot
Hi Steve,
FYI, the error/warning still remains.
tree: https://android.googlesource.com/kernel/common android11-5.4
head: bf4d02ab1ecad898c38734f26b71ace90293c588
commit: 5f378fd56aa3988be21e859254a2d72628d044c6 [3942/13266] ANDROID: rtc: class: support hctosys from modular RTC drivers
config: i386-randconfig-r013-20210816 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
git remote add android-common https://android.googlesource.com/kernel/common
git fetch --no-tags android-common android11-5.4
git checkout 5f378fd56aa3988be21e859254a2d72628d044c6
# save the attached .config to linux build tree
make W=1 ARCH=i386
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
>> drivers/rtc/hctosys.c:24:5: warning: no previous prototype for 'rtc_hctosys' [-Wmissing-prototypes]
24 | int rtc_hctosys(void)
| ^~~~~~~~~~~
vim +/rtc_hctosys +24 drivers/rtc/hctosys.c
12
13 /* IMPORTANT: the RTC only stores whole seconds. It is arbitrary
14 * whether it stores the most close value or the value with partial
15 * seconds truncated. However, it is important that we use it to store
16 * the truncated value. This is because otherwise it is necessary,
17 * in an rtc sync function, to read both xtime.tv_sec and
18 * xtime.tv_nsec. On some processors (i.e. ARM), an atomic read
19 * of >32bits is not possible. So storing the most close value would
20 * slow down the sync API. So here we have the truncated value and
21 * the best guess is to add 0.5s.
22 */
23
> 24 int rtc_hctosys(void)
25 {
26 int err = -ENODEV;
27 struct rtc_time tm;
28 struct timespec64 tv64 = {
29 .tv_nsec = NSEC_PER_SEC >> 1,
30 };
31 struct rtc_device *rtc = rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE);
32
33 if (!rtc) {
34 pr_info("unable to open rtc device (%s)\n",
35 CONFIG_RTC_HCTOSYS_DEVICE);
36 goto err_open;
37 }
38
39 err = rtc_read_time(rtc, &tm);
40 if (err) {
41 dev_err(rtc->dev.parent,
42 "hctosys: unable to read the hardware clock\n");
43 goto err_read;
44 }
45
46 tv64.tv_sec = rtc_tm_to_time64(&tm);
47
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 1 month
Re: [RFC] bpf: lbr: enable reading LBR from tracing bpf programs
by kernel test robot
Hi Song,
[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on bpf-next/master]
[also build test WARNING on next-20210817]
[cannot apply to bpf/master tip/perf/core v5.14-rc6]
[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/Song-Liu/bpf-lbr-enable-reading-...
base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: hexagon-randconfig-r014-20210816 (attached as .config)
compiler: clang version 12.0.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/bdd132049280755216aa3d2f4417bb425...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Song-Liu/bpf-lbr-enable-reading-LBR-from-tracing-bpf-programs/20210818-093217
git checkout bdd132049280755216aa3d2f4417bb4253b777d1
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=hexagon
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
net/bpf/test_run.c:169:14: warning: no previous prototype for function 'bpf_fentry_test1' [-Wmissing-prototypes]
int noinline bpf_fentry_test1(int a)
^
net/bpf/test_run.c:169:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int noinline bpf_fentry_test1(int a)
^
static
net/bpf/test_run.c:174:14: warning: no previous prototype for function 'bpf_fentry_test2' [-Wmissing-prototypes]
int noinline bpf_fentry_test2(int a, u64 b)
^
net/bpf/test_run.c:174:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int noinline bpf_fentry_test2(int a, u64 b)
^
static
net/bpf/test_run.c:179:14: warning: no previous prototype for function 'bpf_fentry_test3' [-Wmissing-prototypes]
int noinline bpf_fentry_test3(char a, int b, u64 c)
^
net/bpf/test_run.c:179:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int noinline bpf_fentry_test3(char a, int b, u64 c)
^
static
net/bpf/test_run.c:184:14: warning: no previous prototype for function 'bpf_fentry_test4' [-Wmissing-prototypes]
int noinline bpf_fentry_test4(void *a, char b, int c, u64 d)
^
net/bpf/test_run.c:184:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int noinline bpf_fentry_test4(void *a, char b, int c, u64 d)
^
static
net/bpf/test_run.c:189:14: warning: no previous prototype for function 'bpf_fentry_test5' [-Wmissing-prototypes]
int noinline bpf_fentry_test5(u64 a, void *b, short c, int d, u64 e)
^
net/bpf/test_run.c:189:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int noinline bpf_fentry_test5(u64 a, void *b, short c, int d, u64 e)
^
static
net/bpf/test_run.c:194:14: warning: no previous prototype for function 'bpf_fentry_test6' [-Wmissing-prototypes]
int noinline bpf_fentry_test6(u64 a, void *b, short c, int d, void *e, u64 f)
^
net/bpf/test_run.c:194:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int noinline bpf_fentry_test6(u64 a, void *b, short c, int d, void *e, u64 f)
^
static
net/bpf/test_run.c:203:14: warning: no previous prototype for function 'bpf_fentry_test7' [-Wmissing-prototypes]
int noinline bpf_fentry_test7(struct bpf_fentry_test_t *arg)
^
net/bpf/test_run.c:203:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int noinline bpf_fentry_test7(struct bpf_fentry_test_t *arg)
^
static
net/bpf/test_run.c:208:14: warning: no previous prototype for function 'bpf_fentry_test8' [-Wmissing-prototypes]
int noinline bpf_fentry_test8(struct bpf_fentry_test_t *arg)
^
net/bpf/test_run.c:208:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int noinline bpf_fentry_test8(struct bpf_fentry_test_t *arg)
^
static
net/bpf/test_run.c:213:14: warning: no previous prototype for function 'bpf_modify_return_test' [-Wmissing-prototypes]
int noinline bpf_modify_return_test(int a, int *b)
^
net/bpf/test_run.c:213:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int noinline bpf_modify_return_test(int a, int *b)
^
static
net/bpf/test_run.c:219:14: warning: no previous prototype for function 'bpf_kfunc_call_test1' [-Wmissing-prototypes]
u64 noinline bpf_kfunc_call_test1(struct sock *sk, u32 a, u64 b, u32 c, u64 d)
^
net/bpf/test_run.c:219:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
u64 noinline bpf_kfunc_call_test1(struct sock *sk, u32 a, u64 b, u32 c, u64 d)
^
static
net/bpf/test_run.c:224:14: warning: no previous prototype for function 'bpf_kfunc_call_test2' [-Wmissing-prototypes]
int noinline bpf_kfunc_call_test2(struct sock *sk, u32 a, u32 b)
^
net/bpf/test_run.c:224:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int noinline bpf_kfunc_call_test2(struct sock *sk, u32 a, u32 b)
^
static
net/bpf/test_run.c:229:24: warning: no previous prototype for function 'bpf_kfunc_call_test3' [-Wmissing-prototypes]
struct sock * noinline bpf_kfunc_call_test3(struct sock *sk)
^
net/bpf/test_run.c:229:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
struct sock * noinline bpf_kfunc_call_test3(struct sock *sk)
^
static
>> net/bpf/test_run.c:234:14: warning: no previous prototype for function 'bpf_fexit_loop_test1' [-Wmissing-prototypes]
int noinline bpf_fexit_loop_test1(int n)
^
net/bpf/test_run.c:234:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int noinline bpf_fexit_loop_test1(int n)
^
static
13 warnings generated.
vim +/bpf_fexit_loop_test1 +234 net/bpf/test_run.c
228
> 229 struct sock * noinline bpf_kfunc_call_test3(struct sock *sk)
230 {
231 return sk;
232 }
233
> 234 int noinline bpf_fexit_loop_test1(int n)
235 {
236 int i, sum = 0;
237
238 /* the primary goal of this test is to test LBR. Create a lot of
239 * branches in the function, so we can catch it easily.
240 */
241 for (i = 0; i < n; i++)
242 sum += i;
243 return sum;
244 }
245
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 1 month
[android-common:android12-5.10 6733/10755] arch/arm64/kvm/fpsimd.c:129:5: error: implicit declaration of function 'sve_cond_update_zcr_vq'
by kernel test robot
Hi Marc,
FYI, the error/warning still remains.
tree: https://android.googlesource.com/kernel/common android12-5.10
head: d0331b15e6abcacfccdc17a384f2de69c89b25fc
commit: b0e15c8c44275afef4aacfb1560e38b974b02ac8 [6733/10755] FROMGIT: KVM: arm64: Save/restore SVE state for nVHE
config: arm64-randconfig-r022-20210816 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 2c6448cdc2f68f8c28fd0bd9404182b81306e6e6)
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 arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
git remote add android-common https://android.googlesource.com/kernel/common
git fetch --no-tags android-common android12-5.10
git checkout b0e15c8c44275afef4aacfb1560e38b974b02ac8
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
>> arch/arm64/kvm/fpsimd.c:129:5: error: implicit declaration of function 'sve_cond_update_zcr_vq' [-Werror,-Wimplicit-function-declaration]
sve_cond_update_zcr_vq(vcpu_sve_max_vq(vcpu) - 1,
^
1 error generated.
vim +/sve_cond_update_zcr_vq +129 arch/arm64/kvm/fpsimd.c
108
109 /*
110 * Write back the vcpu FPSIMD regs if they are dirty, and invalidate the
111 * cpu FPSIMD regs so that they can't be spuriously reused if this vcpu
112 * disappears and another task or vcpu appears that recycles the same
113 * struct fpsimd_state.
114 */
115 void kvm_arch_vcpu_put_fp(struct kvm_vcpu *vcpu)
116 {
117 unsigned long flags;
118 bool host_has_sve = system_supports_sve();
119 bool guest_has_sve = vcpu_has_sve(vcpu);
120
121 local_irq_save(flags);
122
123 if (vcpu->arch.flags & KVM_ARM64_FP_ENABLED) {
124 if (guest_has_sve) {
125 __vcpu_sys_reg(vcpu, ZCR_EL1) = read_sysreg_el1(SYS_ZCR);
126
127 /* Restore the VL that was saved when bound to the CPU */
128 if (!has_vhe())
> 129 sve_cond_update_zcr_vq(vcpu_sve_max_vq(vcpu) - 1,
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 1 month
[android-common:android12-5.10 6732/10755] arch/arm64/kvm/hyp/nvhe/hyp-main.c:245:3: error: implicit declaration of function 'sve_cond_update_zcr_vq'
by kernel test robot
Hi Marc,
FYI, the error/warning still remains.
tree: https://android.googlesource.com/kernel/common android12-5.10
head: d0331b15e6abcacfccdc17a384f2de69c89b25fc
commit: 194fd166b5d5f6694047b45dc409f9620a8a9646 [6732/10755] BACKPORT: FROMGIT: KVM: arm64: Trap host SVE accesses when the FPSIMD state is dirty
config: arm64-randconfig-r022-20210816 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 2c6448cdc2f68f8c28fd0bd9404182b81306e6e6)
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 arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
git remote add android-common https://android.googlesource.com/kernel/common
git fetch --no-tags android-common android12-5.10
git checkout 194fd166b5d5f6694047b45dc409f9620a8a9646
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
In file included from arch/arm64/kvm/hyp/nvhe/hyp-main.c:7:
arch/arm64/kvm/hyp/include/hyp/switch.h:216:2: error: implicit declaration of function 'sve_cond_update_zcr_vq' [-Werror,-Wimplicit-function-declaration]
sve_cond_update_zcr_vq(vcpu_sve_max_vq(vcpu) - 1, SYS_ZCR_EL2);
^
>> arch/arm64/kvm/hyp/nvhe/hyp-main.c:245:3: error: implicit declaration of function 'sve_cond_update_zcr_vq' [-Werror,-Wimplicit-function-declaration]
sve_cond_update_zcr_vq(ZCR_ELx_LEN_MASK, SYS_ZCR_EL2);
^
arch/arm64/kvm/hyp/nvhe/hyp-main.c:233:6: warning: no previous prototype for function 'handle_trap' [-Wmissing-prototypes]
void handle_trap(struct kvm_cpu_context *host_ctxt)
^
arch/arm64/kvm/hyp/nvhe/hyp-main.c:233:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void handle_trap(struct kvm_cpu_context *host_ctxt)
^
static
1 warning and 2 errors generated.
vim +/sve_cond_update_zcr_vq +245 arch/arm64/kvm/hyp/nvhe/hyp-main.c
232
233 void handle_trap(struct kvm_cpu_context *host_ctxt)
234 {
235 u64 esr = read_sysreg_el2(SYS_ESR);
236
237 switch (ESR_ELx_EC(esr)) {
238 case ESR_ELx_EC_HVC64:
239 handle_host_hcall(host_ctxt);
240 break;
241 case ESR_ELx_EC_SMC64:
242 handle_host_smc(host_ctxt);
243 break;
244 case ESR_ELx_EC_SVE:
> 245 sve_cond_update_zcr_vq(ZCR_ELx_LEN_MASK, SYS_ZCR_EL2);
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 1 month
[android-common:android12-5.10 6729/10755] arch/arm64/kvm/hyp/include/hyp/switch.h:216:2: error: implicit declaration of function 'sve_cond_update_zcr_vq'
by kernel test robot
Hi Marc,
FYI, the error/warning still remains.
tree: https://android.googlesource.com/kernel/common android12-5.10
head: d0331b15e6abcacfccdc17a384f2de69c89b25fc
commit: 1105b4d1cef4bc19ad20129a716194268c937eaf [6729/10755] BACKPORT: FROMGIT: KVM: arm64: Rework SVE host-save/guest-restore
config: arm64-randconfig-r022-20210816 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 2c6448cdc2f68f8c28fd0bd9404182b81306e6e6)
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 arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
git remote add android-common https://android.googlesource.com/kernel/common
git fetch --no-tags android-common android12-5.10
git checkout 1105b4d1cef4bc19ad20129a716194268c937eaf
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
In file included from arch/arm64/kvm/hyp/nvhe/switch.c:8:
>> arch/arm64/kvm/hyp/include/hyp/switch.h:216:2: error: implicit declaration of function 'sve_cond_update_zcr_vq' [-Werror,-Wimplicit-function-declaration]
sve_cond_update_zcr_vq(vcpu_sve_max_vq(vcpu) - 1, SYS_ZCR_EL2);
^
arch/arm64/kvm/hyp/nvhe/switch.c:282:17: warning: no previous prototype for function 'kvm_unexpected_el2_exception' [-Wmissing-prototypes]
asmlinkage void kvm_unexpected_el2_exception(void)
^
arch/arm64/kvm/hyp/nvhe/switch.c:282:12: note: declare 'static' if the function is not intended to be used outside of this translation unit
asmlinkage void kvm_unexpected_el2_exception(void)
^
static
1 warning and 1 error generated.
--
In file included from arch/arm64/kvm/hyp/nvhe/hyp-main.c:7:
>> arch/arm64/kvm/hyp/include/hyp/switch.h:216:2: error: implicit declaration of function 'sve_cond_update_zcr_vq' [-Werror,-Wimplicit-function-declaration]
sve_cond_update_zcr_vq(vcpu_sve_max_vq(vcpu) - 1, SYS_ZCR_EL2);
^
arch/arm64/kvm/hyp/nvhe/hyp-main.c:233:6: warning: no previous prototype for function 'handle_trap' [-Wmissing-prototypes]
void handle_trap(struct kvm_cpu_context *host_ctxt)
^
arch/arm64/kvm/hyp/nvhe/hyp-main.c:233:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void handle_trap(struct kvm_cpu_context *host_ctxt)
^
static
1 warning and 1 error generated.
--
In file included from arch/arm64/kvm/hyp/nvhe/mem_protect.c:15:
>> arch/arm64/kvm/hyp/include/hyp/switch.h:216:2: error: implicit declaration of function 'sve_cond_update_zcr_vq' [-Werror,-Wimplicit-function-declaration]
sve_cond_update_zcr_vq(vcpu_sve_max_vq(vcpu) - 1, SYS_ZCR_EL2);
^
1 error generated.
--
In file included from arch/arm64/kvm/hyp/vhe/switch.c:8:
>> arch/arm64/kvm/hyp/include/hyp/switch.h:216:2: error: implicit declaration of function 'sve_cond_update_zcr_vq' [-Werror,-Wimplicit-function-declaration]
sve_cond_update_zcr_vq(vcpu_sve_max_vq(vcpu) - 1, SYS_ZCR_EL2);
^
arch/arm64/kvm/hyp/vhe/switch.c:227:17: warning: no previous prototype for function 'kvm_unexpected_el2_exception' [-Wmissing-prototypes]
asmlinkage void kvm_unexpected_el2_exception(void)
^
arch/arm64/kvm/hyp/vhe/switch.c:227:12: note: declare 'static' if the function is not intended to be used outside of this translation unit
asmlinkage void kvm_unexpected_el2_exception(void)
^
static
1 warning and 1 error generated.
vim +/sve_cond_update_zcr_vq +216 arch/arm64/kvm/hyp/include/hyp/switch.h
213
214 static inline void __hyp_sve_restore_guest(struct kvm_vcpu *vcpu)
215 {
> 216 sve_cond_update_zcr_vq(vcpu_sve_max_vq(vcpu) - 1, SYS_ZCR_EL2);
217 __sve_restore_state(vcpu_sve_pffr(vcpu),
218 &vcpu->arch.ctxt.fp_regs.fpsr);
219 write_sysreg_el1(__vcpu_sys_reg(vcpu, ZCR_EL1), SYS_ZCR);
220 }
221
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 1 month
[linux-next:master 7954/8516] include/linux/trace_events.h:695:81: warning: unused parameter 'bpf_cookie'
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: 9803fb968c8c2e1283f67b3baeb88e0adba435b4
commit: 82e6b1eee6a8875ef4eacfd60711cce6965c6b04 [7954/8516] bpf: Allow to specify user-provided bpf_cookie for BPF perf links
config: i386-randconfig-r021-20210816 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 2c6448cdc2f68f8c28fd0bd9404182b81306e6e6)
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://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commi...
git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git fetch --no-tags linux-next master
git checkout 82e6b1eee6a8875ef4eacfd60711cce6965c6b04
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
include/linux/tracepoint.h:419:2: note: expanded from macro 'DECLARE_TRACE'
__DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), \
^
include/linux/tracepoint.h:279:42: note: expanded from macro '__DECLARE_TRACE'
check_trace_callback_type_##name(void (*cb)(data_proto)) \
^
In file included from drivers/gpu/drm/i915/i915_trace_points.c:13:
drivers/gpu/drm/i915/i915_trace.h:956:1: warning: unused parameter 'cb' [-Wunused-parameter]
TRACE_EVENT_CONDITION(i915_reg_rw,
^
include/linux/tracepoint.h:563:2: note: expanded from macro 'TRACE_EVENT_CONDITION'
DECLARE_TRACE_CONDITION(name, PARAMS(proto), \
^
include/linux/tracepoint.h:424:2: note: expanded from macro 'DECLARE_TRACE_CONDITION'
__DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), \
^
include/linux/tracepoint.h:279:42: note: expanded from macro '__DECLARE_TRACE'
check_trace_callback_type_##name(void (*cb)(data_proto)) \
^
In file included from drivers/gpu/drm/i915/i915_trace_points.c:13:
drivers/gpu/drm/i915/i915_trace.h:984:1: warning: unused parameter 'cb' [-Wunused-parameter]
TRACE_EVENT(intel_gpu_freq_change,
^
include/linux/tracepoint.h:553:2: note: expanded from macro 'TRACE_EVENT'
DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
^
include/linux/tracepoint.h:419:2: note: expanded from macro 'DECLARE_TRACE'
__DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), \
^
include/linux/tracepoint.h:279:42: note: expanded from macro '__DECLARE_TRACE'
check_trace_callback_type_##name(void (*cb)(data_proto)) \
^
In file included from drivers/gpu/drm/i915/i915_trace_points.c:13:
drivers/gpu/drm/i915/i915_trace.h:1026:1: warning: unused parameter 'cb' [-Wunused-parameter]
DEFINE_EVENT(i915_ppgtt, i915_ppgtt_create,
^
include/linux/tracepoint.h:542:2: note: expanded from macro 'DEFINE_EVENT'
DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
^
include/linux/tracepoint.h:419:2: note: expanded from macro 'DECLARE_TRACE'
__DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), \
^
include/linux/tracepoint.h:279:42: note: expanded from macro '__DECLARE_TRACE'
check_trace_callback_type_##name(void (*cb)(data_proto)) \
^
In file included from drivers/gpu/drm/i915/i915_trace_points.c:13:
drivers/gpu/drm/i915/i915_trace.h:1031:1: warning: unused parameter 'cb' [-Wunused-parameter]
DEFINE_EVENT(i915_ppgtt, i915_ppgtt_release,
^
include/linux/tracepoint.h:542:2: note: expanded from macro 'DEFINE_EVENT'
DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
^
include/linux/tracepoint.h:419:2: note: expanded from macro 'DECLARE_TRACE'
__DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), \
^
include/linux/tracepoint.h:279:42: note: expanded from macro '__DECLARE_TRACE'
check_trace_callback_type_##name(void (*cb)(data_proto)) \
^
In file included from drivers/gpu/drm/i915/i915_trace_points.c:13:
drivers/gpu/drm/i915/i915_trace.h:1063:1: warning: unused parameter 'cb' [-Wunused-parameter]
DEFINE_EVENT(i915_context, i915_context_create,
^
include/linux/tracepoint.h:542:2: note: expanded from macro 'DEFINE_EVENT'
DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
^
include/linux/tracepoint.h:419:2: note: expanded from macro 'DECLARE_TRACE'
__DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), \
^
include/linux/tracepoint.h:279:42: note: expanded from macro '__DECLARE_TRACE'
check_trace_callback_type_##name(void (*cb)(data_proto)) \
^
In file included from drivers/gpu/drm/i915/i915_trace_points.c:13:
drivers/gpu/drm/i915/i915_trace.h:1068:1: warning: unused parameter 'cb' [-Wunused-parameter]
DEFINE_EVENT(i915_context, i915_context_free,
^
include/linux/tracepoint.h:542:2: note: expanded from macro 'DEFINE_EVENT'
DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
^
include/linux/tracepoint.h:419:2: note: expanded from macro 'DECLARE_TRACE'
__DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), \
^
include/linux/tracepoint.h:279:42: note: expanded from macro '__DECLARE_TRACE'
check_trace_callback_type_##name(void (*cb)(data_proto)) \
^
In file included from drivers/gpu/drm/i915/i915_trace_points.c:13:
In file included from include/trace/../../drivers/gpu/drm/i915/i915_trace.h:1078:
In file included from include/trace/define_trace.h:102:
In file included from include/trace/trace_events.h:21:
include/linux/trace_events.h:689:68: warning: unused parameter 'call' [-Wunused-parameter]
static inline unsigned int trace_call_bpf(struct trace_event_call *call, void *ctx)
^
include/linux/trace_events.h:689:80: warning: unused parameter 'ctx' [-Wunused-parameter]
static inline unsigned int trace_call_bpf(struct trace_event_call *call, void *ctx)
^
include/linux/trace_events.h:695:47: warning: unused parameter 'event' [-Wunused-parameter]
perf_event_attach_bpf_prog(struct perf_event *event, struct bpf_prog *prog, u64 bpf_cookie)
^
include/linux/trace_events.h:695:71: warning: unused parameter 'prog' [-Wunused-parameter]
perf_event_attach_bpf_prog(struct perf_event *event, struct bpf_prog *prog, u64 bpf_cookie)
^
>> include/linux/trace_events.h:695:81: warning: unused parameter 'bpf_cookie' [-Wunused-parameter]
perf_event_attach_bpf_prog(struct perf_event *event, struct bpf_prog *prog, u64 bpf_cookie)
^
include/linux/trace_events.h:700:66: warning: unused parameter 'event' [-Wunused-parameter]
static inline void perf_event_detach_bpf_prog(struct perf_event *event) { }
^
include/linux/trace_events.h:703:48: warning: unused parameter 'event' [-Wunused-parameter]
perf_event_query_prog_array(struct perf_event *event, void __user *info)
^
include/linux/trace_events.h:703:68: warning: unused parameter 'info' [-Wunused-parameter]
perf_event_query_prog_array(struct perf_event *event, void __user *info)
^
include/linux/trace_events.h:707:64: warning: unused parameter 'btp' [-Wunused-parameter]
static inline int bpf_probe_register(struct bpf_raw_event_map *btp, struct bpf_prog *p)
^
include/linux/trace_events.h:707:86: warning: unused parameter 'p' [-Wunused-parameter]
static inline int bpf_probe_register(struct bpf_raw_event_map *btp, struct bpf_prog *p)
^
include/linux/trace_events.h:711:66: warning: unused parameter 'btp' [-Wunused-parameter]
static inline int bpf_probe_unregister(struct bpf_raw_event_map *btp, struct bpf_prog *p)
^
include/linux/trace_events.h:711:88: warning: unused parameter 'p' [-Wunused-parameter]
static inline int bpf_probe_unregister(struct bpf_raw_event_map *btp, struct bpf_prog *p)
^
include/linux/trace_events.h:715:76: warning: unused parameter 'name' [-Wunused-parameter]
static inline struct bpf_raw_event_map *bpf_get_raw_tracepoint(const char *name)
^
include/linux/trace_events.h:719:69: warning: unused parameter 'btp' [-Wunused-parameter]
static inline void bpf_put_raw_tracepoint(struct bpf_raw_event_map *btp)
^
include/linux/trace_events.h:722:68: warning: unused parameter 'event' [-Wunused-parameter]
static inline int bpf_get_perf_event_info(const struct perf_event *event,
^
include/linux/trace_events.h:723:13: warning: unused parameter 'prog_id' [-Wunused-parameter]
u32 *prog_id, u32 *fd_type,
^
include/linux/trace_events.h:723:27: warning: unused parameter 'fd_type' [-Wunused-parameter]
u32 *prog_id, u32 *fd_type,
^
include/linux/trace_events.h:724:21: warning: unused parameter 'buf' [-Wunused-parameter]
const char **buf, u64 *probe_offset,
^
include/linux/trace_events.h:724:31: warning: unused parameter 'probe_offset' [-Wunused-parameter]
const char **buf, u64 *probe_offset,
^
include/linux/trace_events.h:725:13: warning: unused parameter 'probe_addr' [-Wunused-parameter]
u64 *probe_addr)
^
In file included from drivers/gpu/drm/i915/i915_trace_points.c:13:
In file included from include/trace/../../drivers/gpu/drm/i915/i915_trace.h:1078:
In file included from include/trace/define_trace.h:102:
In file included from include/trace/trace_events.h:427:
include/trace/../../drivers/gpu/drm/i915/i915_trace.h:24:1: warning: unused parameter 'flags' [-Wunused-parameter]
TRACE_EVENT(intel_pipe_enable,
^
include/trace/trace_events.h:75:2: note: expanded from macro 'TRACE_EVENT'
DECLARE_EVENT_CLASS(name, \
^
include/trace/trace_events.h:379:58: note: expanded from macro 'DECLARE_EVENT_CLASS'
trace_raw_output_##call(struct trace_iterator *iter, int flags, \
^
In file included from drivers/gpu/drm/i915/i915_trace_points.c:13:
In file included from include/trace/../../drivers/gpu/drm/i915/i915_trace.h:1078:
In file included from include/trace/define_trace.h:102:
In file included from include/trace/trace_events.h:427:
include/trace/../../drivers/gpu/drm/i915/i915_trace.h:50:1: warning: unused parameter 'flags' [-Wunused-parameter]
TRACE_EVENT(intel_pipe_disable,
^
include/trace/trace_events.h:75:2: note: expanded from macro 'TRACE_EVENT'
DECLARE_EVENT_CLASS(name, \
^
include/trace/trace_events.h:379:58: note: expanded from macro 'DECLARE_EVENT_CLASS'
trace_raw_output_##call(struct trace_iterator *iter, int flags, \
^
In file included from drivers/gpu/drm/i915/i915_trace_points.c:13:
In file included from include/trace/../../drivers/gpu/drm/i915/i915_trace.h:1078:
In file included from include/trace/define_trace.h:102:
In file included from include/trace/trace_events.h:427:
include/trace/../../drivers/gpu/drm/i915/i915_trace.h:77:1: warning: unused parameter 'flags' [-Wunused-parameter]
TRACE_EVENT(intel_pipe_crc,
^
include/trace/trace_events.h:75:2: note: expanded from macro 'TRACE_EVENT'
DECLARE_EVENT_CLASS(name, \
^
include/trace/trace_events.h:379:58: note: expanded from macro 'DECLARE_EVENT_CLASS'
trace_raw_output_##call(struct trace_iterator *iter, int flags, \
^
In file included from drivers/gpu/drm/i915/i915_trace_points.c:13:
In file included from include/trace/../../drivers/gpu/drm/i915/i915_trace.h:1078:
In file included from include/trace/define_trace.h:102:
In file included from include/trace/trace_events.h:427:
include/trace/../../drivers/gpu/drm/i915/i915_trace.h:101:1: warning: unused parameter 'flags' [-Wunused-parameter]
TRACE_EVENT(intel_cpu_fifo_underrun,
^
include/trace/trace_events.h:75:2: note: expanded from macro 'TRACE_EVENT'
DECLARE_EVENT_CLASS(name, \
^
include/trace/trace_events.h:379:58: note: expanded from macro 'DECLARE_EVENT_CLASS'
trace_raw_output_##call(struct trace_iterator *iter, int flags, \
^
In file included from drivers/gpu/drm/i915/i915_trace_points.c:13:
vim +/bpf_cookie +695 include/linux/trace_events.h
693
694 static inline int
> 695 perf_event_attach_bpf_prog(struct perf_event *event, struct bpf_prog *prog, u64 bpf_cookie)
696 {
697 return -EOPNOTSUPP;
698 }
699
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 1 month
[linux-rt-devel:linux-5.14.y-rt-rebase 194/245] kernel/rcu/rcutorture.c:1525:16: warning: Value stored to 'preempts_irq' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git linux-5.14.y-rt-rebase
head: 0eead4e5a60cb716ec911a552787a69332cf6943
commit: 32a3c5313cce130c4526507975314b84714b043a [194/245] rcutorture: Avoid problematic critical section nesting on RT
config: mips-randconfig-c004-20210816 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 44d0a99a12ec7ead4d2f5ef649ba05b40f6d463d)
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 mips cross compiling tool for clang build
# apt-get install binutils-mips-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git/com...
git remote add linux-rt-devel https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git
git fetch --no-tags linux-rt-devel linux-5.14.y-rt-rebase
git checkout 32a3c5313cce130c4526507975314b84714b043a
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
^
kernel/rcu/rcutorture.c:1734:9: note: Calling 'timer_pending'
if (!timer_pending(&t))
^~~~~~~~~~~~~~~~~
include/linux/timer.h:168:10: note: Calling 'hlist_unhashed_lockless'
return !hlist_unhashed_lockless(&timer->entry);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/list.h:821:10: note: Left side of '||' is false
return !READ_ONCE(h->pprev);
^
include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
compiletime_assert_rwonce_type(x); \
^
include/asm-generic/rwonce.h:36:21: note: expanded from macro 'compiletime_assert_rwonce_type'
compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
^
include/linux/compiler_types.h:290:3: note: expanded from macro '__native_word'
(sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
^
include/linux/list.h:821:10: note: Left side of '||' is false
return !READ_ONCE(h->pprev);
^
include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
compiletime_assert_rwonce_type(x); \
^
include/asm-generic/rwonce.h:36:21: note: expanded from macro 'compiletime_assert_rwonce_type'
compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
^
include/linux/compiler_types.h:290:3: note: expanded from macro '__native_word'
(sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
^
include/linux/list.h:821:10: note: Left side of '||' is true
return !READ_ONCE(h->pprev);
^
include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
compiletime_assert_rwonce_type(x); \
^
include/asm-generic/rwonce.h:36:21: note: expanded from macro 'compiletime_assert_rwonce_type'
compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
^
include/linux/compiler_types.h:291:28: note: expanded from macro '__native_word'
sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long))
^
include/linux/list.h:821:10: note: Taking false branch
return !READ_ONCE(h->pprev);
^
include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
compiletime_assert_rwonce_type(x); \
^
include/asm-generic/rwonce.h:36:2: note: expanded from macro 'compiletime_assert_rwonce_type'
compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
^
include/linux/compiler_types.h:328:2: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler_types.h:308:3: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
^
include/linux/list.h:821:10: note: Loop condition is false. Exiting loop
return !READ_ONCE(h->pprev);
^
include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
compiletime_assert_rwonce_type(x); \
^
include/asm-generic/rwonce.h:36:2: note: expanded from macro 'compiletime_assert_rwonce_type'
compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
^
include/linux/compiler_types.h:328:2: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler_types.h:306:2: note: expanded from macro '__compiletime_assert'
do { \
^
include/linux/list.h:821:2: note: Undefined or garbage value returned to caller
return !READ_ONCE(h->pprev);
^ ~~~~~~~~~~~~~~~~~~~~
kernel/rcu/rcutorture.c:387:3: warning: Value stored to 'started' is never read [clang-analyzer-deadcode.DeadStores]
started = cur_ops->get_gp_seq();
^ ~~~~~~~~~~~~~~~~~~~~~
kernel/rcu/rcutorture.c:387:3: note: Value stored to 'started' is never read
started = cur_ops->get_gp_seq();
^ ~~~~~~~~~~~~~~~~~~~~~
kernel/rcu/rcutorture.c:388:3: warning: Value stored to 'ts' is never read [clang-analyzer-deadcode.DeadStores]
ts = rcu_trace_clock_local();
^ ~~~~~~~~~~~~~~~~~~~~~~~
kernel/rcu/rcutorture.c:388:3: note: Value stored to 'ts' is never read
ts = rcu_trace_clock_local();
^ ~~~~~~~~~~~~~~~~~~~~~~~
kernel/rcu/rcutorture.c:393:3: warning: Value stored to 'completed' is never read [clang-analyzer-deadcode.DeadStores]
completed = cur_ops->get_gp_seq();
^ ~~~~~~~~~~~~~~~~~~~~~
kernel/rcu/rcutorture.c:393:3: note: Value stored to 'completed' is never read
completed = cur_ops->get_gp_seq();
^ ~~~~~~~~~~~~~~~~~~~~~
>> kernel/rcu/rcutorture.c:1525:16: warning: Value stored to 'preempts_irq' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
unsigned long preempts_irq = preempts | RCUTORTURE_RDR_IRQ;
^~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/rcu/rcutorture.c:1525:16: note: Value stored to 'preempts_irq' during its initialization is never read
unsigned long preempts_irq = preempts | RCUTORTURE_RDR_IRQ;
^~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/rcu/rcutorture.c:1634:2: warning: Value stored to 'ts' is never read [clang-analyzer-deadcode.DeadStores]
ts = rcu_trace_clock_local();
^ ~~~~~~~~~~~~~~~~~~~~~~~
kernel/rcu/rcutorture.c:1634:2: note: Value stored to 'ts' is never read
ts = rcu_trace_clock_local();
^ ~~~~~~~~~~~~~~~~~~~~~~~
kernel/rcu/rcutorture.c:1667:13: warning: 1st function call argument is an uninitialized value [clang-analyzer-core.CallAndMessage]
WARN_ONCE(cur_ops->poll_gp_state(cookie),
^
include/asm-generic/bug.h:150:18: note: expanded from macro 'WARN_ONCE'
DO_ONCE_LITE_IF(condition, WARN, 1, format)
^~~~~~~~~
include/linux/once_lite.h:15:27: note: expanded from macro 'DO_ONCE_LITE_IF'
bool __ret_do_once = !!(condition); \
^~~~~~~~~
kernel/rcu/rcutorture.c:1615:2: note: 'cookie' declared without an initial value
unsigned long cookie;
^~~~~~~~~~~~~~~~~~~~
kernel/rcu/rcutorture.c:1628:2: note: '__ret_do_once' is false
WARN_ON_ONCE(!rcu_is_watching());
^
include/asm-generic/bug.h:146:2: note: expanded from macro 'WARN_ON_ONCE'
DO_ONCE_LITE_IF(condition, WARN_ON, 1)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/once_lite.h:17:16: note: expanded from macro 'DO_ONCE_LITE_IF'
if (unlikely(__ret_do_once && !__already_done)) { \
^~~~~~~~~~~~~
include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^
kernel/rcu/rcutorture.c:1628:2: note: Left side of '&&' is false
WARN_ON_ONCE(!rcu_is_watching());
^
include/asm-generic/bug.h:146:2: note: expanded from macro 'WARN_ON_ONCE'
DO_ONCE_LITE_IF(condition, WARN_ON, 1)
^
include/linux/once_lite.h:17:30: note: expanded from macro 'DO_ONCE_LITE_IF'
if (unlikely(__ret_do_once && !__already_done)) { \
^
kernel/rcu/rcutorture.c:1628:2: note: Taking false branch
WARN_ON_ONCE(!rcu_is_watching());
^
include/asm-generic/bug.h:146:2: note: expanded from macro 'WARN_ON_ONCE'
DO_ONCE_LITE_IF(condition, WARN_ON, 1)
^
include/linux/once_lite.h:17:3: note: expanded from macro 'DO_ONCE_LITE_IF'
if (unlikely(__ret_do_once && !__already_done)) { \
^
kernel/rcu/rcutorture.c:1631:6: note: Assuming field 'get_gp_state' is null
if (cur_ops->get_gp_state && cur_ops->poll_gp_state)
^~~~~~~~~~~~~~~~~~~~~
kernel/rcu/rcutorture.c:1631:28: note: Left side of '&&' is false
if (cur_ops->get_gp_state && cur_ops->poll_gp_state)
^
kernel/rcu/rcutorture.c:1635:6: note: Left side of '||' is false
p = rcu_dereference_check(rcu_torture_current,
^
include/linux/rcupdate.h:542:2: note: expanded from macro 'rcu_dereference_check'
__rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu)
^
include/linux/rcupdate.h:403:48: note: expanded from macro '__rcu_dereference_check'
typeof(*p) *________p1 = (typeof(*p) *__force)READ_ONCE(p); \
^
include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
compiletime_assert_rwonce_type(x); \
^
include/asm-generic/rwonce.h:36:21: note: expanded from macro 'compiletime_assert_rwonce_type'
compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
^
include/linux/compiler_types.h:290:3: note: expanded from macro '__native_word'
(sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
^
kernel/rcu/rcutorture.c:1635:6: note: Left side of '||' is false
p = rcu_dereference_check(rcu_torture_current,
^
include/linux/rcupdate.h:542:2: note: expanded from macro 'rcu_dereference_check'
__rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu)
^
include/linux/rcupdate.h:403:48: note: expanded from macro '__rcu_dereference_check'
typeof(*p) *________p1 = (typeof(*p) *__force)READ_ONCE(p); \
^
include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
compiletime_assert_rwonce_type(x); \
^
include/asm-generic/rwonce.h:36:21: note: expanded from macro 'compiletime_assert_rwonce_type'
compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
^
include/linux/compiler_types.h:290:3: note: expanded from macro '__native_word'
(sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
^
kernel/rcu/rcutorture.c:1635:6: note: Left side of '||' is true
p = rcu_dereference_check(rcu_torture_current,
^
include/linux/rcupdate.h:542:2: note: expanded from macro 'rcu_dereference_check'
__rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu)
vim +/preempts_irq +1525 kernel/rcu/rcutorture.c
1516
1517 /* Return a random protection state mask, but with at least one bit set. */
1518 static int
1519 rcutorture_extend_mask(int oldmask, struct torture_random_state *trsp)
1520 {
1521 int mask = rcutorture_extend_mask_max();
1522 unsigned long randmask1 = torture_random(trsp) >> 8;
1523 unsigned long randmask2 = randmask1 >> 3;
1524 unsigned long preempts = RCUTORTURE_RDR_PREEMPT | RCUTORTURE_RDR_SCHED;
> 1525 unsigned long preempts_irq = preempts | RCUTORTURE_RDR_IRQ;
1526 unsigned long nonatomic_bhs = RCUTORTURE_RDR_BH | RCUTORTURE_RDR_RBH;
1527 unsigned long atomic_bhs = RCUTORTURE_RDR_ATOM_BH |
1528 RCUTORTURE_RDR_ATOM_RBH;
1529 unsigned long tmp;
1530
1531 WARN_ON_ONCE(mask >> RCUTORTURE_RDR_SHIFT);
1532 /* Mostly only one bit (need preemption!), sometimes lots of bits. */
1533 if (!(randmask1 & 0x7))
1534 mask = mask & randmask2;
1535 else
1536 mask = mask & (1 << (randmask2 % RCUTORTURE_RDR_NBITS));
1537
1538 /*
1539 * Can't enable bh w/irq disabled.
1540 */
1541 tmp = atomic_bhs | nonatomic_bhs;
1542 if (mask & RCUTORTURE_RDR_IRQ)
1543 mask |= oldmask & tmp;
1544
1545 /*
1546 * Ideally these sequences would be detected in debug builds
1547 * (regardless of RT), but until then don't stop testing
1548 * them on non-RT.
1549 */
1550 if (IS_ENABLED(CONFIG_PREEMPT_RT)) {
1551 /*
1552 * Can't release the outermost rcu lock in an irq disabled
1553 * section without preemption also being disabled, if irqs
1554 * had ever been enabled during this RCU critical section
1555 * (could leak a special flag and delay reporting the qs).
1556 */
1557 if ((oldmask & RCUTORTURE_RDR_RCU) &&
1558 (mask & RCUTORTURE_RDR_IRQ) &&
1559 !(mask & preempts))
1560 mask |= RCUTORTURE_RDR_RCU;
1561
1562 /* Can't modify atomic bh in non-atomic context */
1563 if ((oldmask & atomic_bhs) && (mask & atomic_bhs) &&
1564 !(mask & preempts_irq)) {
1565 mask |= oldmask & preempts_irq;
1566 if (mask & RCUTORTURE_RDR_IRQ)
1567 mask |= oldmask & tmp;
1568 }
1569 if ((mask & atomic_bhs) && !(mask & preempts_irq))
1570 mask |= RCUTORTURE_RDR_PREEMPT;
1571
1572 /* Can't modify non-atomic bh in atomic context */
1573 tmp = nonatomic_bhs;
1574 if (oldmask & preempts_irq)
1575 mask &= ~tmp;
1576 if ((oldmask | mask) & preempts_irq)
1577 mask |= oldmask & tmp;
1578 }
1579
1580 return mask ?: RCUTORTURE_RDR_RCU;
1581 }
1582
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 1 month