All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/9] scsi_debug: collection of additions
@ 2021-12-31  2:08 Douglas Gilbert
  2021-12-31  2:08 ` [PATCH 1/9] scsi_debug: address races following module load Douglas Gilbert
                   ` (8 more replies)
  0 siblings, 9 replies; 15+ messages in thread
From: Douglas Gilbert @ 2021-12-31  2:08 UTC (permalink / raw)
  To: linux-scsi; +Cc: martin.petersen, jejb

The first patch is to address possible modprobe rmmod races.

The second patch adds READ_ONCE and WRITE_ONCE on several
high frequency variables.

See the headers of patches 3 and 4.

In patch 5 use different asc/ascq codes to distiguish between
and newly added LU and a reset on an existing LU.

In patch 6 add a no_rwlock module option to bypass the
read-write locks around user data reads and writes.

Patch 7 adds sdeb_sgl_copy_sgl, sdeb_sgl_compare_sgl_idx,
sdeb_sgl_compare_sgl and sdeb_sgl_memset functions for
performing sgl t0 sgl copy and compare operations currently
unsupported by scatterlist.h . This patch was originally
put forward as an enhancement of scatterlist.h but failed
to gain traction. So that patch is redirected to this driver
with the "sdeb_" added to each function. Compiling the
driver after this patch will result in warnings that those
newly introduced static functions are not used. Since LLDs
receive and send data "up" the stack via sgl_s, using
sgl_s as the storage medium for this driver bypasses one
level of conversions.

Patch 8 uses the new functions introduced in patch 7 to
change the internal store(s) used the this driver into
sgl_s rather than big vmalloc() allocations. The biggest
improvement is with the VERIFY(BYTCHK=1) performance
that went from about 20% slower than a copy operation
to 50% faster (up to 15 GB/s on my equipment). Before this
patch VERIFY(BYTCHK=1) needed a temporary, potentially
large, buffer for the incoming data-out transfer. The
COMPARE AND WRITE command also benefits from stores made
of sgl_s, and in addition it needs to know the index of
the first mismatched byte (if any).

Finally some issues have arisen in smartmontools with
SCSI log subpages. To aid is fixing this, the last patch
adds the driver's first log subpage (Environmental
reporting).

This patchset is based on lk 5.16.0-rc7 rather than MKP's
repository (based on rc1). Fixes have been added to this
driver between rc1 and rc7 that would break a single
patchset. So the most recent rc was chosen.


Douglas Gilbert (9):
  scsi_debug: address races following module load
  scsi_debug: strengthen defer_t accesses
  scsi_debug: use task set full more
  scsi_debug: refine sdebug_blk_mq_poll
  scsi_debug: divide power on reset unit attention
  scsi_debug: add no_rwlock parameter
  scsi_debug: add sdeb_sgl_copy_sgl and friends
  scsi_debug: change store from vmalloc to sgl
  scsi_debug: add environmental reporting log subpage

 drivers/scsi/Kconfig      |    3 +-
 drivers/scsi/scsi_debug.c | 1078 +++++++++++++++++++++++++++----------
 2 files changed, 800 insertions(+), 281 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 15+ messages in thread
* Re: [PATCH 8/9] scsi_debug: change store from vmalloc to sgl
  2021-12-31  2:08 ` [PATCH 8/9] scsi_debug: change store from vmalloc to sgl Douglas Gilbert
@ 2022-01-07  6:57 ` Dan Carpenter
  0 siblings, 0 replies; 15+ messages in thread
From: kernel test robot @ 2021-12-31 22:43 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 6143 bytes --]

CC: kbuild-all(a)lists.01.org
In-Reply-To: <20211231020829.29147-9-dgilbert@interlog.com>
References: <20211231020829.29147-9-dgilbert@interlog.com>
TO: Douglas Gilbert <dgilbert@interlog.com>

Hi Douglas,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on jejb-scsi/for-next]
[also build test WARNING on mkp-scsi/for-next v5.16-rc7 next-20211224]
[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/Douglas-Gilbert/scsi_debug-collection-of-additions/20211231-101808
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
:::::: branch date: 20 hours ago
:::::: commit date: 20 hours ago
config: x86_64-randconfig-m001-20211230 (https://download.01.org/0day-ci/archive/20220101/202201010609.ZMDBG5yX-lkp(a)intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/scsi/scsi_debug.c:3352 prot_verify_read() warn: returning -1 instead of -ENOMEM is sloppy

vim +3352 drivers/scsi/scsi_debug.c

bb8c063c6afcd9 Akinobu Mita       2013-09-18  3335  
87c715dcde633f Douglas Gilbert    2020-04-21  3336  static int prot_verify_read(struct scsi_cmnd *scp, sector_t start_sec,
bb8c063c6afcd9 Akinobu Mita       2013-09-18  3337  			    unsigned int sectors, u32 ei_lba)
bb8c063c6afcd9 Akinobu Mita       2013-09-18  3338  {
f7be677227a537 Martin K. Petersen 2021-06-08  3339  	int ret = 0;
bb8c063c6afcd9 Akinobu Mita       2013-09-18  3340  	unsigned int i;
49adea5162df30 Douglas Gilbert    2021-12-30  3341  	const u32 lb_size = sdebug_sector_size;
bb8c063c6afcd9 Akinobu Mita       2013-09-18  3342  	sector_t sector;
49adea5162df30 Douglas Gilbert    2021-12-30  3343  	u64 lba, lba_start, block, rem, sgl_i;
87c715dcde633f Douglas Gilbert    2020-04-21  3344  	struct sdeb_store_info *sip = devip2sip((struct sdebug_dev_info *)
b6ff8ca733500a Douglas Gilbert    2020-05-12  3345  						scp->device->hostdata, true);
87c715dcde633f Douglas Gilbert    2020-04-21  3346  	struct t10_pi_tuple *sdt;
49adea5162df30 Douglas Gilbert    2021-12-30  3347  	struct scatterlist *store_sgl;
49adea5162df30 Douglas Gilbert    2021-12-30  3348  	u8 *arr;
49adea5162df30 Douglas Gilbert    2021-12-30  3349  
49adea5162df30 Douglas Gilbert    2021-12-30  3350  	arr = kzalloc(lb_size, GFP_ATOMIC);
49adea5162df30 Douglas Gilbert    2021-12-30  3351  	if (!arr)
49adea5162df30 Douglas Gilbert    2021-12-30 @3352  		return -1;	/* mkp, is this correct? */
bb8c063c6afcd9 Akinobu Mita       2013-09-18  3353  
c45eabec08776d Akinobu Mita       2014-02-26  3354  	for (i = 0; i < sectors; i++, ei_lba++) {
bb8c063c6afcd9 Akinobu Mita       2013-09-18  3355  		sector = start_sec + i;
49adea5162df30 Douglas Gilbert    2021-12-30  3356  		lba = sector;
87c715dcde633f Douglas Gilbert    2020-04-21  3357  		sdt = dif_store(sip, sector);
bb8c063c6afcd9 Akinobu Mita       2013-09-18  3358  
51d648af589221 Akinobu Mita       2013-09-18  3359  		if (sdt->app_tag == cpu_to_be16(0xffff))
bb8c063c6afcd9 Akinobu Mita       2013-09-18  3360  			continue;
bb8c063c6afcd9 Akinobu Mita       2013-09-18  3361  
f7be677227a537 Martin K. Petersen 2021-06-08  3362  		/*
f7be677227a537 Martin K. Petersen 2021-06-08  3363  		 * Because scsi_debug acts as both initiator and
f7be677227a537 Martin K. Petersen 2021-06-08  3364  		 * target we proceed to verify the PI even if
f7be677227a537 Martin K. Petersen 2021-06-08  3365  		 * RDPROTECT=3. This is done so the "initiator" knows
f7be677227a537 Martin K. Petersen 2021-06-08  3366  		 * which type of error to return. Otherwise we would
f7be677227a537 Martin K. Petersen 2021-06-08  3367  		 * have to iterate over the PI twice.
f7be677227a537 Martin K. Petersen 2021-06-08  3368  		 */
f7be677227a537 Martin K. Petersen 2021-06-08  3369  		if (scp->cmnd[1] >> 5) { /* RDPROTECT */
49adea5162df30 Douglas Gilbert    2021-12-30  3370  			block = do_div(lba, sdebug_store_sectors);
49adea5162df30 Douglas Gilbert    2021-12-30  3371  			lba_start = block * lb_size;
49adea5162df30 Douglas Gilbert    2021-12-30  3372  			sgl_i = lba_start >> sip->elem_pow2;
49adea5162df30 Douglas Gilbert    2021-12-30  3373  			rem = lba_start - (sgl_i ? (sgl_i << sip->elem_pow2) : 0);
49adea5162df30 Douglas Gilbert    2021-12-30  3374  			store_sgl = sip->sgl + sgl_i;
49adea5162df30 Douglas Gilbert    2021-12-30  3375  
49adea5162df30 Douglas Gilbert    2021-12-30  3376  			ret = sg_copy_buffer(store_sgl, sip->n_elem - sgl_i, arr, lb_size, rem, true);
49adea5162df30 Douglas Gilbert    2021-12-30  3377  
49adea5162df30 Douglas Gilbert    2021-12-30  3378  			ret = dif_verify(sdt, arr, sector, ei_lba);
49adea5162df30 Douglas Gilbert    2021-12-30  3379  
bb8c063c6afcd9 Akinobu Mita       2013-09-18  3380  			if (ret) {
bb8c063c6afcd9 Akinobu Mita       2013-09-18  3381  				dif_errors++;
49adea5162df30 Douglas Gilbert    2021-12-30  3382  				goto fini;
f7be677227a537 Martin K. Petersen 2021-06-08  3383  			}
bb8c063c6afcd9 Akinobu Mita       2013-09-18  3384  		}
bb8c063c6afcd9 Akinobu Mita       2013-09-18  3385  	}
c6a44287417de1 Martin K. Petersen 2009-01-04  3386  
87c715dcde633f Douglas Gilbert    2020-04-21  3387  	dif_copy_prot(scp, start_sec, sectors, true);
c6a44287417de1 Martin K. Petersen 2009-01-04  3388  	dix_reads++;
c6a44287417de1 Martin K. Petersen 2009-01-04  3389  
49adea5162df30 Douglas Gilbert    2021-12-30  3390  fini:
49adea5162df30 Douglas Gilbert    2021-12-30  3391  	kfree(arr);
f7be677227a537 Martin K. Petersen 2021-06-08  3392  	return ret;
c6a44287417de1 Martin K. Petersen 2009-01-04  3393  }
c6a44287417de1 Martin K. Petersen 2009-01-04  3394  

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

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2022-01-12  3:39 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-31  2:08 [PATCH 0/9] scsi_debug: collection of additions Douglas Gilbert
2021-12-31  2:08 ` [PATCH 1/9] scsi_debug: address races following module load Douglas Gilbert
2022-01-05 19:41   ` Bart Van Assche
2022-01-12  3:39   ` Luis Chamberlain
2021-12-31  2:08 ` [PATCH 2/9] scsi_debug: strengthen defer_t accesses Douglas Gilbert
2021-12-31  2:08 ` [PATCH 3/9] scsi_debug: use task set full more Douglas Gilbert
2021-12-31  2:08 ` [PATCH 4/9] scsi_debug: refine sdebug_blk_mq_poll Douglas Gilbert
2021-12-31  2:08 ` [PATCH 5/9] scsi_debug: divide power on reset unit attention Douglas Gilbert
2021-12-31  2:08 ` [PATCH 6/9] scsi_debug: add no_rwlock parameter Douglas Gilbert
2021-12-31  2:08 ` [PATCH 7/9] scsi_debug: add sdeb_sgl_copy_sgl and friends Douglas Gilbert
2021-12-31  2:08 ` [PATCH 8/9] scsi_debug: change store from vmalloc to sgl Douglas Gilbert
2022-01-05  9:28   ` Shinichiro Kawasaki
2021-12-31  2:08 ` [PATCH 9/9] scsi_debug: add environmental reporting log subpage Douglas Gilbert
2021-12-31 22:43 [PATCH 8/9] scsi_debug: change store from vmalloc to sgl kernel test robot
2022-01-07  6:57 ` Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.