All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Eric Curtin" <ericcurtin17@gmail.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [RFC PATCH v2 01/13] scsi: core: Add dma_boundary_page for page-size DMA boundaries
Date: Thu, 03 Dec 2026 03:17:41 +0000	[thread overview]
Message-ID: <sashiko-outbox-247073@kernel.org> (raw)
In-Reply-To: <20261202031647.1690622-2-ericcurtin17@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] scsi: undeclared PAGE_SIZE_MIN/MAX and PAGE_SHIFT_MIN/MAX break
  build
- [Medium] scsi: uas and tcm_loop not converted to dma_boundary_page
--

commit 2dbf3d01cd25f3d099e02178bfbeccd9315ec05b
Author: Eric Curtin <eric.curtin@docker.com>

scsi: core: Add dma_boundary_page for page-size DMA boundaries

This commit adds a dma_boundary_page flag to struct scsi_host_template so
drivers can request a PAGE_SIZE - 1 DMA boundary without using PAGE_SIZE in
static initializers, and updates several SCSI drivers to avoid compile-time
PAGE_SIZE and PAGE_SHIFT assumptions.

> Add a dma_boundary_page flag to struct scsi_host_template. When set,
> scsi_host_alloc() uses PAGE_SIZE - 1 as the DMA boundary, taking
> precedence over .dma_boundary. Convert the drivers that used PAGE_SIZE -
> 1 (aha152x, cxgb3i, cxgb4i, dc395x, dmx3191d, fdomain, g_NCR5380,
> iscsi_tcp, mvumi, nsp32, nsp_cs, qlogic_stub, qlogicfas, stex and uas)
> to use the flag.

[Severity: Medium]
The commit message lists uas as converted, but uas_host_template in
drivers/usb/storage/uas.c still sets .dma_boundary = PAGE_SIZE - 1 (as does
tcm_loop_driver_template in drivers/target/loopback/tcm_loop.c).  Should
both templates be converted to .dma_boundary_page = 1 as well so they build
when PAGE_SIZE is not a compile-time constant?

[ ... ]

> diff --git a/drivers/scsi/ncr53c8xx.c b/drivers/scsi/ncr53c8xx.c
> index 5369ca3fe4fd3..dc010e65fe736 100644
> --- a/drivers/scsi/ncr53c8xx.c
> +++ b/drivers/scsi/ncr53c8xx.c
> @@ -184,7 +184,7 @@ static inline struct list_head *ncr_list_pop(struct list_head *head)
>  */
>  
>  #define MEMO_SHIFT	4	/* 16 bytes minimum memory chunk */
> -#if PAGE_SIZE >= 8192
> +#if PAGE_SIZE_MIN >= 8192
>  #define MEMO_PAGE_ORDER	0	/* 1 PAGE  maximum */
>  #else
>  #define MEMO_PAGE_ORDER	1	/* 2 PAGES maximum */
> @@ -221,7 +221,7 @@ typedef struct m_pool {		/* Memory pool of a given kind */
>  	int nump;
>  	m_vtob_s *(vtob[VTOB_HASH_SIZE]);
>  	struct m_pool *next;
> -	struct m_link h[PAGE_SHIFT-MEMO_SHIFT+MEMO_PAGE_ORDER+1];
> +	struct m_link h[PAGE_SHIFT_MAX-MEMO_SHIFT+MEMO_PAGE_ORDER+1];
>  } m_pool_s;
>  
>  static void *___m_alloc(m_pool_s *mp, int size)

[ ... ]

> diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.h b/drivers/scsi/sym53c8xx_2/sym_hipd.h
> index aa365e8ba66fc..4f17d91215cbf 100644
> --- a/drivers/scsi/sym53c8xx_2/sym_hipd.h
> +++ b/drivers/scsi/sym53c8xx_2/sym_hipd.h
> @@ -142,6 +142,8 @@
>  
>  #define SYM_MEM_PAGE_ORDER 0	/* 1 PAGE  maximum */
>  #define SYM_MEM_CLUSTER_SHIFT	(PAGE_SHIFT+SYM_MEM_PAGE_ORDER)
> +#define SYM_MEM_CLUSTER_SHIFT_MIN	(PAGE_SHIFT_MIN+SYM_MEM_PAGE_ORDER)
> +#define SYM_MEM_CLUSTER_SHIFT_MAX	(PAGE_SHIFT_MAX+SYM_MEM_PAGE_ORDER)
>  #define SYM_MEM_FREE_UNUSED	/* Free unused pages immediately */
>  /*
>   *  Shortest memory chunk is (1<<SYM_MEM_SHIFT), currently 16.
> @@ -165,9 +167,10 @@
>  #define	SYM_CONF_MAX_START (SYM_CONF_MAX_QUEUE-2)
>  #endif
>  
> -#if	SYM_CONF_MAX_QUEUE > SYM_MEM_CLUSTER_SIZE/8
> +#define SYM_MEM_CLUSTER_SIZE_MIN	(1UL << SYM_MEM_CLUSTER_SHIFT_MIN)
> +#if	SYM_CONF_MAX_QUEUE > SYM_MEM_CLUSTER_SIZE_MIN/8
>  #undef	SYM_CONF_MAX_QUEUE
> -#define	SYM_CONF_MAX_QUEUE (SYM_MEM_CLUSTER_SIZE/8)
> +#define	SYM_CONF_MAX_QUEUE (SYM_MEM_CLUSTER_SIZE_MIN/8)
>  #undef	SYM_CONF_MAX_START
>  #define	SYM_CONF_MAX_START (SYM_CONF_MAX_QUEUE-2)
>  #endif
> @@ -1158,7 +1161,7 @@ typedef struct sym_m_pool {
>  	int nump;
>  	m_vtob_p vtob[VTOB_HASH_SIZE];
>  	struct sym_m_pool *next;
> -	struct sym_m_link h[SYM_MEM_CLUSTER_SHIFT - SYM_MEM_SHIFT + 1];
> +	struct sym_m_link h[SYM_MEM_CLUSTER_SHIFT_MAX - SYM_MEM_SHIFT + 1];
>  } *m_pool_p;
>  
>  /*
> diff --git a/drivers/scsi/xen-scsifront.c b/drivers/scsi/xen-scsifront.c
> index b376579532452..d003066707340 100644
> --- a/drivers/scsi/xen-scsifront.c
> +++ b/drivers/scsi/xen-scsifront.c
> @@ -68,10 +68,14 @@
>  #define VSCSIIF_MAX_LUN             255
>  
>  #define VSCSIIF_RING_SIZE	__CONST_RING_SIZE(vscsiif, PAGE_SIZE)
> +#define VSCSIIF_RING_SIZE_MAX	__CONST_RING_SIZE(vscsiif, PAGE_SIZE_MAX)
>  #define VSCSIIF_MAX_REQS	VSCSIIF_RING_SIZE
> +#define VSCSIIF_MAX_REQS_MAX	VSCSIIF_RING_SIZE_MAX
>  
>  #define vscsiif_grants_sg(_sg)	(PFN_UP((_sg) *		\
>  				sizeof(struct scsiif_request_segment)))
> +#define vscsiif_grants_sg_max(_sg)				\
> +	DIV_ROUND_UP((_sg) * sizeof(struct scsiif_request_segment), PAGE_SIZE_MIN)
>  
>  struct vscsifrnt_shadow {
>  	/* command between backend and frontend */
> @@ -96,7 +100,7 @@ struct vscsifrnt_shadow {
>  
>  	/* Requested struct scsi_cmnd is stored from kernel. */
>  	struct scsi_cmnd *sc;
> -	int gref[vscsiif_grants_sg(SG_ALL) + SG_ALL];
> +	int gref[vscsiif_grants_sg_max(SG_ALL) + SG_ALL];
>  };
>  
>  struct vscsifrnt_info {
> @@ -117,8 +121,8 @@ struct vscsifrnt_info {
>  	struct vscsiif_response	ring_rsp;
>  
>  	spinlock_t shadow_lock;
> -	DECLARE_BITMAP(shadow_free_bitmap, VSCSIIF_MAX_REQS);
> -	struct vscsifrnt_shadow *shadow[VSCSIIF_MAX_REQS];
> +	DECLARE_BITMAP(shadow_free_bitmap, VSCSIIF_MAX_REQS_MAX);
> +	struct vscsifrnt_shadow *shadow[VSCSIIF_MAX_REQS_MAX];

[Severity: High]
Where are PAGE_SIZE_MIN, PAGE_SIZE_MAX, PAGE_SHIFT_MIN, and PAGE_SHIFT_MAX
defined?  None of these macros exist in the tree, so ncr53c8xx,
sym53c8xx_2, and xen-scsifront fail to compile with undeclared identifier
errors (and the #if checks in ncr53c8xx.c and sym_hipd.h evaluate the
undefined identifiers as 0).

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261202031647.1690622-1-ericcurtin17@gmail.com?part=1

  reply	other threads:[~2026-12-03  3:17 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02  3:16 [RFC PATCH v2 00/13] block/storage: Prepare for boot-time page size selection on arm64 Eric Curtin
2026-12-02  3:16 ` Eric Curtin
2026-12-02  3:16 ` [RFC PATCH v2 01/13] scsi: core: Add dma_boundary_page for page-size DMA boundaries Eric Curtin
2026-12-03  3:17   ` sashiko-bot [this message]
2026-12-02  3:16 ` [RFC PATCH v2 02/13] mtd: mtdswap: Initialise mtdswap_ops with a page size variable Eric Curtin
2026-12-02  3:16   ` Eric Curtin
2026-12-02 11:25   ` Miquel Raynal
2026-12-02 11:25     ` Miquel Raynal
2026-12-03  3:17   ` sashiko-bot
2026-12-02  3:16 ` [RFC PATCH v2 03/13] mmc: mmc_test: Allocate the scratch buffer with the test buffer Eric Curtin
2026-12-02  3:16 ` [RFC PATCH v2 04/13] md: Remove compile-time PAGE_SIZE use in md, dm and bcache Eric Curtin
2026-12-03  3:17   ` sashiko-bot
2026-12-02  3:16 ` [RFC PATCH v2 05/13] zram: Remove PAGE_SIZE use in preprocessor conditionals Eric Curtin
2026-12-02  3:16 ` [RFC PATCH v2 06/13] xen/blkback: Size indirect_pages for the largest page size Eric Curtin
2026-12-02  3:16 ` [RFC PATCH v2 07/13] null_blk: Size the nullb_page bitmap for PAGE_SIZE_MAX Eric Curtin
2026-12-02  3:16 ` [RFC PATCH v2 08/13] drbd: Use PAGE_SHIFT_MIN in preprocessor checks Eric Curtin
2026-12-02  3:16 ` [RFC PATCH v2 09/13] nvme: Check the DSM range buffer against PAGE_SIZE_MIN Eric Curtin
2026-12-03  3:17   ` sashiko-bot
2026-12-02  3:16 ` [RFC PATCH v2 10/13] dm: Initialise swap_bios from the runtime PAGE_SIZE Eric Curtin
2026-12-03  3:17   ` sashiko-bot
2026-12-02  3:16 ` [RFC PATCH v2 11/13] virtio: Handle boot-time PAGE_SIZE in balloon, blk and 9p transport Eric Curtin
2026-12-03  3:17   ` sashiko-bot
2026-12-02  3:16 ` [RFC PATCH v2 12/13] ata: sata_sil24: Use flexible arrays for the command block SGEs Eric Curtin
2026-12-02  7:10   ` Damien Le Moal
2026-12-03  3:17   ` sashiko-bot
2026-12-02  3:16 ` [RFC PATCH v2 13/13] mm: Use PAGE_SIZE_MIN/MAX where a compile-time constant is required Eric Curtin
2026-12-02  3:16   ` Eric Curtin
2026-12-03  3:17   ` sashiko-bot
2026-12-03  3:17     ` sashiko-bot
2026-12-03  3:17 ` [RFC PATCH v2 00/13] block/storage: Prepare for boot-time page size selection on arm64 sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-247073@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=ericcurtin17@gmail.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is 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.