Re: [PATCH 06/23] scsi: add a no_highmem flag to struct Scsi_Host

2024-03-26 Thread Christoph Hellwig
On Mon, Mar 25, 2024 at 04:26:55PM +0900, Damien Le Moal wrote:
> On 3/25/24 08:54, Christoph Hellwig wrote:
> > While we really should be killing the block layer bounce buffering ASAP,
> > I even more urgently need to stop the drivers to fiddle with the limits
> > from ->slave_configure.  Add a no_highmem flag to the Scsi_Host to
> > centralize this setting and switch the remaining four drivers that use
> > block layer bounce buffering to it.
> > 
> > Signed-off-by: Christoph Hellwig 
> 
> The USB hunks could probably be moved to their own patch following this one ?

Seems like a bit too much churn to me.

-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to open-iscsi+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/open-iscsi/20240326060917.GC7108%40lst.de.


Re: [PATCH 06/23] scsi: add a no_highmem flag to struct Scsi_Host

2024-03-25 Thread Damien Le Moal
On 3/25/24 08:54, Christoph Hellwig wrote:
> While we really should be killing the block layer bounce buffering ASAP,
> I even more urgently need to stop the drivers to fiddle with the limits
> from ->slave_configure.  Add a no_highmem flag to the Scsi_Host to
> centralize this setting and switch the remaining four drivers that use
> block layer bounce buffering to it.
> 
> Signed-off-by: Christoph Hellwig 

The USB hunks could probably be moved to their own patch following this one ?
But otherwise, looks OK to me.

Reviewed-by: Damien Le Moal 

-- 
Damien Le Moal
Western Digital Research

-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to open-iscsi+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/open-iscsi/80162a6e-12d1-4fd4-ac74-dc5388853323%40kernel.org.


[PATCH 06/23] scsi: add a no_highmem flag to struct Scsi_Host

2024-03-24 Thread Christoph Hellwig
While we really should be killing the block layer bounce buffering ASAP,
I even more urgently need to stop the drivers to fiddle with the limits
from ->slave_configure.  Add a no_highmem flag to the Scsi_Host to
centralize this setting and switch the remaining four drivers that use
block layer bounce buffering to it.

Signed-off-by: Christoph Hellwig 
---
 drivers/scsi/aha152x.c |  8 +---
 drivers/scsi/imm.c | 12 +---
 drivers/scsi/ppa.c |  8 +---
 drivers/scsi/scsi_lib.c|  3 +++
 drivers/usb/storage/scsiglue.c | 10 --
 drivers/usb/storage/usb.c  | 10 ++
 include/scsi/scsi_host.h   |  2 ++
 7 files changed, 18 insertions(+), 35 deletions(-)

diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
index 055adb349b0e41..83f16fc14d9630 100644
--- a/drivers/scsi/aha152x.c
+++ b/drivers/scsi/aha152x.c
@@ -746,6 +746,7 @@ struct Scsi_Host *aha152x_probe_one(struct aha152x_setup 
*setup)
/* need to have host registered before triggering any interrupt */
list_add_tail((shpnt)->host_list, _host_list);
 
+   shpnt->no_highmem = true;
shpnt->io_port   = setup->io_port;
shpnt->n_io_port = IO_RANGE;
shpnt->irq   = setup->irq;
@@ -2940,12 +2941,6 @@ static int aha152x_show_info(struct seq_file *m, struct 
Scsi_Host *shpnt)
return 0;
 }
 
-static int aha152x_adjust_queue(struct scsi_device *device)
-{
-   blk_queue_bounce_limit(device->request_queue, BLK_BOUNCE_HIGH);
-   return 0;
-}
-
 static const struct scsi_host_template aha152x_driver_template = {
.module = THIS_MODULE,
.name   = AHA152X_REVID,
@@ -2961,7 +2956,6 @@ static const struct scsi_host_template 
aha152x_driver_template = {
.this_id= 7,
.sg_tablesize   = SG_ALL,
.dma_boundary   = PAGE_SIZE - 1,
-   .slave_alloc= aha152x_adjust_queue,
.cmd_size   = sizeof(struct aha152x_cmd_priv),
 };
 
diff --git a/drivers/scsi/imm.c b/drivers/scsi/imm.c
index 180a5ddedb2cda..21339da505f1ea 100644
--- a/drivers/scsi/imm.c
+++ b/drivers/scsi/imm.c
@@ -1100,16 +1100,6 @@ static int device_check(imm_struct *dev, bool autodetect)
return -ENODEV;
 }
 
-/*
- * imm cannot deal with highmem, so this causes all IO pages for this host
- * to reside in low memory (hence mapped)
- */
-static int imm_adjust_queue(struct scsi_device *device)
-{
-   blk_queue_bounce_limit(device->request_queue, BLK_BOUNCE_HIGH);
-   return 0;
-}
-
 static const struct scsi_host_template imm_template = {
.module = THIS_MODULE,
.proc_name  = "imm",
@@ -1123,7 +1113,6 @@ static const struct scsi_host_template imm_template = {
.this_id= 7,
.sg_tablesize   = SG_ALL,
.can_queue  = 1,
-   .slave_alloc= imm_adjust_queue,
.cmd_size   = sizeof(struct scsi_pointer),
 };
 
@@ -1235,6 +1224,7 @@ static int __imm_attach(struct parport *pb)
host = scsi_host_alloc(_template, sizeof(imm_struct *));
if (!host)
goto out1;
+   host->no_highmem = true;
host->io_port = pb->base;
host->n_io_port = ports;
host->dma_channel = -1;
diff --git a/drivers/scsi/ppa.c b/drivers/scsi/ppa.c
index d592ee9170c11f..8300f0bdddb37a 100644
--- a/drivers/scsi/ppa.c
+++ b/drivers/scsi/ppa.c
@@ -986,12 +986,6 @@ static int device_check(ppa_struct *dev, bool autodetect)
return -ENODEV;
 }
 
-static int ppa_adjust_queue(struct scsi_device *device)
-{
-   blk_queue_bounce_limit(device->request_queue, BLK_BOUNCE_HIGH);
-   return 0;
-}
-
 static const struct scsi_host_template ppa_template = {
.module = THIS_MODULE,
.proc_name  = "ppa",
@@ -1005,7 +999,6 @@ static const struct scsi_host_template ppa_template = {
.this_id= -1,
.sg_tablesize   = SG_ALL,
.can_queue  = 1,
-   .slave_alloc= ppa_adjust_queue,
.cmd_size   = sizeof(struct scsi_pointer),
 };
 
@@ -,6 +1104,7 @@ static int __ppa_attach(struct parport *pb)
host = scsi_host_alloc(_template, sizeof(ppa_struct *));
if (!host)
goto out1;
+   host->no_highmem = true;
host->io_port = pb->base;
host->n_io_port = ports;
host->dma_channel = -1;
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 1deca84914e87a..f1936f98abe3e2 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1995,6 +1995,9 @@ void scsi_init_limits(struct Scsi_Host *shost, struct 
queue_limits *lim)
 */
lim->dma_alignment = max(4, dma_get_cache_alignment()) - 1;
 
+   if (shost->no_highmem)
+