Skip to contentSkip to conversation

remove use_sg_chaining

PATCH In review James Bottomley 6 participants 21 messages Jan 15, 2008 – Jan 21, 2008

Subsystems (18)
lore
Share & tools
lore

James Bottomley

author maintainer
#0 lore raw

PATCH 1/1 remove use_sg_chaining

this patch depends on the sg branch of the block tree

James

---
From: James Bottomley <[email protected]>
Date: Tue, 15 Jan 2008 11:11:46 -0600
Subject: remove use_sg_chaining

With the sg table code, every SCSI driver is now either chain capable or broken, so there's no need to have a check in the host template.

Also tidy up the code by moving the scatterlist size defines into the SCSI includes and permit the last entry of the scatterlist pools not to be a power of two.

---
 arch/ia64/hp/sim/simscsi.c            |    1 -
 drivers/scsi/3w-9xxx.c                |    1 -
 drivers/scsi/3w-xxxx.c                |    1 -
 drivers/scsi/BusLogic.c               |    1 -
 drivers/scsi/NCR53c406a.c             |    1 -
 drivers/scsi/a100u2w.c                |    1 -
 drivers/scsi/aacraid/linit.c          |    1 -
 drivers/scsi/aha1740.c                |    1 -
 drivers/scsi/aic7xxx/aic79xx_osm.c    |    1 -
 drivers/scsi/aic7xxx/aic7xxx_osm.c    |    1 -
 drivers/scsi/aic7xxx_old.c            |    1 -
 drivers/scsi/arcmsr/arcmsr_hba.c      |    1 -
 drivers/scsi/dc395x.c                 |    1 -
 drivers/scsi/dpt_i2o.c                |    1 -
 drivers/scsi/eata.c                   |    1 -
 drivers/scsi/hosts.c                  |    1 -
 drivers/scsi/hptiop.c                 |    1 -
 drivers/scsi/ibmmca.c                 |    1 -
 drivers/scsi/ibmvscsi/ibmvscsi.c      |    1 -
 drivers/scsi/initio.c                 |    1 -
 drivers/scsi/iscsi_tcp.c              |    1 -
 drivers/scsi/lpfc/lpfc_scsi.c         |    2 -
 drivers/scsi/mac53c94.c               |    1 -
 drivers/scsi/megaraid.c               |    1 -
 drivers/scsi/megaraid/megaraid_mbox.c |    1 -
 drivers/scsi/megaraid/megaraid_sas.c  |    1 -
 drivers/scsi/mesh.c                   |    1 -
 drivers/scsi/nsp32.c                  |    1 -
 drivers/scsi/pcmcia/sym53c500_cs.c    |    1 -
 drivers/scsi/qla1280.c                |    1 -
 drivers/scsi/qla2xxx/qla_os.c         |    2 -
 drivers/scsi/qla4xxx/ql4_os.c         |    1 -
 drivers/scsi/qlogicfas.c              |    1 -
 drivers/scsi/scsi_lib.c               |   72 ++++++++-------------------------
 drivers/scsi/stex.c                   |    1 -
 drivers/scsi/sym53c416.c              |    1 -
 drivers/scsi/sym53c8xx_2/sym_glue.c   |    1 -
 drivers/scsi/u14-34f.c                |    1 -
 drivers/scsi/ultrastor.c              |    1 -
 drivers/scsi/wd7000.c                 |    1 -
 include/scsi/scsi.h                   |   19 +++++++++
 include/scsi/scsi_host.h              |   13 ------
 42 files changed, 36 insertions(+), 109 deletions(-)
arch/ia64/hp/sim/simscsi.c +0 -1
index 6ef9b52..7661bb0 100644
@@ -360,7 +360,6 @@ static struct scsi_host_template driver_template = {
 	.max_sectors		= 1024,
 	.cmd_per_lun		= SIMSCSI_REQ_QUEUE_LEN,
 	.use_clustering		= DISABLE_CLUSTERING,
-	.use_sg_chaining	= ENABLE_SG_CHAINING,
 };
 
 static int __init
drivers/scsi/3w-9xxx.c +0 -1
index 1c24483..b4912d1 100644
@@ -1990,7 +1990,6 @@ static struct scsi_host_template driver_template = {
 	.max_sectors		= TW_MAX_SECTORS,
 	.cmd_per_lun		= TW_MAX_CMDS_PER_LUN,
 	.use_clustering		= ENABLE_CLUSTERING,
-	.use_sg_chaining	= ENABLE_SG_CHAINING,
 	.shost_attrs		= twa_host_attrs,
 	.emulated		= 1
 };
drivers/scsi/3w-xxxx.c +0 -1
index 59716eb..d095321 100644
@@ -2261,7 +2261,6 @@ static struct scsi_host_template driver_template = {
 	.max_sectors		= TW_MAX_SECTORS,
 	.cmd_per_lun		= TW_MAX_CMDS_PER_LUN,	
 	.use_clustering		= ENABLE_CLUSTERING,
-	.use_sg_chaining	= ENABLE_SG_CHAINING,
 	.shost_attrs		= tw_host_attrs,
 	.emulated		= 1
 };
drivers/scsi/BusLogic.c +0 -1
index ead47c1..4d3ebb1 100644
@@ -3575,7 +3575,6 @@ static struct scsi_host_template Bus_Logic_template = {
 	.unchecked_isa_dma = 1,
 	.max_sectors = 128,
 	.use_clustering = ENABLE_CLUSTERING,
-	.use_sg_chaining = ENABLE_SG_CHAINING,
 };
 
 /*
drivers/scsi/NCR53c406a.c +0 -1
index 137d065..6961f78 100644
@@ -1065,7 +1065,6 @@ static struct scsi_host_template driver_template =
      .cmd_per_lun       	= 1			/* commands per lun */, 
      .unchecked_isa_dma 	= 1			/* unchecked_isa_dma */,
      .use_clustering    	= ENABLE_CLUSTERING,
-     .use_sg_chaining           = ENABLE_SG_CHAINING,
 };
 
 #include "scsi_module.c"
drivers/scsi/a100u2w.c +0 -1
index d3a6d15..f608d4a 100644
@@ -1071,7 +1071,6 @@ static struct scsi_host_template inia100_template = {
 	.sg_tablesize		= SG_ALL,
 	.cmd_per_lun 		= 1,
 	.use_clustering		= ENABLE_CLUSTERING,
-	.use_sg_chaining	= ENABLE_SG_CHAINING,
 };
 
 static int __devinit inia100_probe_one(struct pci_dev *pdev,
drivers/scsi/aacraid/linit.c +0 -1
index 143e4c1..c844288 100644
@@ -1000,7 +1000,6 @@ static struct scsi_host_template aac_driver_template = {
 	.cmd_per_lun    		= AAC_NUM_IO_FIB, 
 #endif	
 	.use_clustering			= ENABLE_CLUSTERING,
-	.use_sg_chaining		= ENABLE_SG_CHAINING,
 	.emulated                       = 1,
 };
 
drivers/scsi/aha1740.c +0 -1
index be58a0b..7c45d88 100644
@@ -563,7 +563,6 @@ static struct scsi_host_template aha1740_template = {
 	.sg_tablesize     = AHA1740_SCATTER,
 	.cmd_per_lun      = AHA1740_CMDLUN,
 	.use_clustering   = ENABLE_CLUSTERING,
-	.use_sg_chaining  = ENABLE_SG_CHAINING,
 	.eh_abort_handler = aha1740_eh_abort_handler,
 };
 
drivers/scsi/aic7xxx/aic79xx_osm.c +0 -1
index 0e4708f..4eed504 100644
@@ -766,7 +766,6 @@ struct scsi_host_template aic79xx_driver_template = {
 	.max_sectors		= 8192,
 	.cmd_per_lun		= 2,
 	.use_clustering		= ENABLE_CLUSTERING,
-	.use_sg_chaining	= ENABLE_SG_CHAINING,
 	.slave_alloc		= ahd_linux_slave_alloc,
 	.slave_configure	= ahd_linux_slave_configure,
 	.target_alloc		= ahd_linux_target_alloc,
drivers/scsi/aic7xxx/aic7xxx_osm.c +0 -1
index e310e41..d6d074a 100644
@@ -747,7 +747,6 @@ struct scsi_host_template aic7xxx_driver_template = {
 	.max_sectors		= 8192,
 	.cmd_per_lun		= 2,
 	.use_clustering		= ENABLE_CLUSTERING,
-	.use_sg_chaining	= ENABLE_SG_CHAINING,
 	.slave_alloc		= ahc_linux_slave_alloc,
 	.slave_configure	= ahc_linux_slave_configure,
 	.target_alloc		= ahc_linux_target_alloc,
drivers/scsi/aic7xxx_old.c +0 -1
index bcb0b87..3bfd929 100644
@@ -11141,7 +11141,6 @@ static struct scsi_host_template driver_template = {
 	.max_sectors		= 2048,
 	.cmd_per_lun		= 3,
 	.use_clustering		= ENABLE_CLUSTERING,
-	.use_sg_chaining	= ENABLE_SG_CHAINING,
 };
 
 #include "scsi_module.c"
drivers/scsi/arcmsr/arcmsr_hba.c +0 -1
index d80dba9..f4a202e 100644
@@ -122,7 +122,6 @@ static struct scsi_host_template arcmsr_scsi_host_template = {
 	.max_sectors    	= ARCMSR_MAX_XFER_SECTORS,
 	.cmd_per_lun		= ARCMSR_MAX_CMD_PERLUN,
 	.use_clustering		= ENABLE_CLUSTERING,
-	.use_sg_chaining	= ENABLE_SG_CHAINING,
 	.shost_attrs		= arcmsr_host_attrs,
 };
 #ifdef CONFIG_SCSI_ARCMSR_AER
drivers/scsi/dc395x.c +0 -1
index f93c73c..22ef371 100644
@@ -4763,7 +4763,6 @@ static struct scsi_host_template dc395x_driver_template = {
 	.eh_bus_reset_handler   = dc395x_eh_bus_reset,
 	.unchecked_isa_dma      = 0,
 	.use_clustering         = DISABLE_CLUSTERING,
-	.use_sg_chaining	= ENABLE_SG_CHAINING,
 };
 
 
drivers/scsi/dpt_i2o.c +0 -1
index 577b34c..86ac271 100644
@@ -3340,7 +3340,6 @@ static struct scsi_host_template driver_template = {
 	.this_id		= 7,
 	.cmd_per_lun		= 1,
 	.use_clustering		= ENABLE_CLUSTERING,
-	.use_sg_chaining	= ENABLE_SG_CHAINING,
 };
 #include "scsi_module.c"
 MODULE_LICENSE("GPL");
drivers/scsi/eata.c +0 -1
index 05163ce..8be3d76 100644
@@ -524,7 +524,6 @@ static struct scsi_host_template driver_template = {
 	.this_id = 7,
 	.unchecked_isa_dma = 1,
 	.use_clustering = ENABLE_CLUSTERING,
-	.use_sg_chaining = ENABLE_SG_CHAINING,
 };
 
 #if !defined(__BIG_ENDIAN_BITFIELD) && !defined(__LITTLE_ENDIAN_BITFIELD)
drivers/scsi/hosts.c +0 -1
index 9a10b43..7e69efb 100644
@@ -342,7 +342,6 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
 	shost->use_clustering = sht->use_clustering;
 	shost->ordered_tag = sht->ordered_tag;
 	shost->active_mode = sht->supported_mode;
-	shost->use_sg_chaining = sht->use_sg_chaining;
 
 	if (sht->supported_mode == MODE_UNKNOWN)
 		/* means we didn't set it ... default to INITIATOR */
drivers/scsi/hptiop.c +0 -1
index e7b2f35..443a4c1 100644
@@ -906,7 +906,6 @@ static struct scsi_host_template driver_template = {
 	.unchecked_isa_dma          = 0,
 	.emulated                   = 0,
 	.use_clustering             = ENABLE_CLUSTERING,
-	.use_sg_chaining            = ENABLE_SG_CHAINING,
 	.proc_name                  = driver_name,
 	.shost_attrs                = hptiop_attrs,
 	.this_id                    = -1,
drivers/scsi/ibmmca.c +0 -1
index db004a4..4d15a62 100644
@@ -1501,7 +1501,6 @@ static struct scsi_host_template ibmmca_driver_template = {
           .sg_tablesize   = 16,
           .cmd_per_lun    = 1,
           .use_clustering = ENABLE_CLUSTERING,
-          .use_sg_chaining = ENABLE_SG_CHAINING,
 };
 
 static int ibmmca_probe(struct device *dev)
drivers/scsi/ibmvscsi/ibmvscsi.c +0 -1
index 3081901..78d46a9 100644
@@ -1600,7 +1600,6 @@ static struct scsi_host_template driver_template = {
 	.this_id = -1,
 	.sg_tablesize = SG_ALL,
 	.use_clustering = ENABLE_CLUSTERING,
-	.use_sg_chaining = ENABLE_SG_CHAINING,
 	.shost_attrs = ibmvscsi_attrs,
 };
 
drivers/scsi/initio.c +0 -1
index 01bf018..52238ee 100644
@@ -2832,7 +2832,6 @@ static struct scsi_host_template initio_template = {
 	.sg_tablesize		= SG_ALL,
 	.cmd_per_lun		= 1,
 	.use_clustering		= ENABLE_CLUSTERING,
-	.use_sg_chaining	= ENABLE_SG_CHAINING,
 };
 
 static int initio_probe_one(struct pci_dev *pdev,
drivers/scsi/iscsi_tcp.c +0 -1
index e5be5fd..b6f99df 100644
@@ -1933,7 +1933,6 @@ static struct scsi_host_template iscsi_sht = {
 	.eh_device_reset_handler= iscsi_eh_device_reset,
 	.eh_host_reset_handler	= iscsi_eh_host_reset,
 	.use_clustering         = DISABLE_CLUSTERING,
-	.use_sg_chaining	= ENABLE_SG_CHAINING,
 	.slave_configure        = iscsi_tcp_slave_configure,
 	.proc_name		= "iscsi_tcp",
 	.this_id		= -1,
drivers/scsi/lpfc/lpfc_scsi.c +0 -2
index 883c915..6d8c814 100644
@@ -1464,7 +1464,6 @@ struct scsi_host_template lpfc_template = {
 	.scan_finished		= lpfc_scan_finished,
 	.this_id		= -1,
 	.sg_tablesize		= LPFC_DEFAULT_SG_SEG_CNT,
-	.use_sg_chaining	= ENABLE_SG_CHAINING,
 	.cmd_per_lun		= LPFC_CMD_PER_LUN,
 	.use_clustering		= ENABLE_CLUSTERING,
 	.shost_attrs		= lpfc_hba_attrs,
@@ -1487,7 +1486,6 @@ struct scsi_host_template lpfc_vport_template = {
 	.sg_tablesize		= LPFC_DEFAULT_SG_SEG_CNT,
 	.cmd_per_lun		= LPFC_CMD_PER_LUN,
 	.use_clustering		= ENABLE_CLUSTERING,
-	.use_sg_chaining	= ENABLE_SG_CHAINING,
 	.shost_attrs		= lpfc_vport_attrs,
 	.max_sectors		= 0xFFFF,
 };
drivers/scsi/mac53c94.c +0 -1
index a035001..b12ad7c 100644
@@ -402,7 +402,6 @@ static struct scsi_host_template mac53c94_template = {
 	.sg_tablesize	= SG_ALL,
 	.cmd_per_lun	= 1,
 	.use_clustering	= DISABLE_CLUSTERING,
-	.use_sg_chaining = ENABLE_SG_CHAINING,
 };
 
 static int mac53c94_probe(struct macio_dev *mdev, const struct of_device_id *match)
drivers/scsi/megaraid.c +0 -1
index 765c24d..4d59ae8 100644
@@ -4490,7 +4490,6 @@ static struct scsi_host_template megaraid_template = {
 	.sg_tablesize			= MAX_SGLIST,
 	.cmd_per_lun			= DEF_CMD_PER_LUN,
 	.use_clustering			= ENABLE_CLUSTERING,
-	.use_sg_chaining		= ENABLE_SG_CHAINING,
 	.eh_abort_handler		= megaraid_abort,
 	.eh_device_reset_handler	= megaraid_reset,
 	.eh_bus_reset_handler		= megaraid_reset,
drivers/scsi/megaraid/megaraid_mbox.c +0 -1
index 24e32e4..6db77c0 100644
@@ -361,7 +361,6 @@ static struct scsi_host_template megaraid_template_g = {
 	.eh_host_reset_handler		= megaraid_reset_handler,
 	.change_queue_depth		= megaraid_change_queue_depth,
 	.use_clustering			= ENABLE_CLUSTERING,
-	.use_sg_chaining		= ENABLE_SG_CHAINING,
 	.sdev_attrs			= megaraid_sdev_attrs,
 	.shost_attrs			= megaraid_shost_attrs,
 };
drivers/scsi/megaraid/megaraid_sas.c +0 -1
index d7ec921..672c759 100644
@@ -1192,7 +1192,6 @@ static struct scsi_host_template megasas_template = {
 	.eh_timed_out = megasas_reset_timer,
 	.bios_param = megasas_bios_param,
 	.use_clustering = ENABLE_CLUSTERING,
-	.use_sg_chaining = ENABLE_SG_CHAINING,
 };
 
 /**
drivers/scsi/mesh.c +0 -1
index 7470ff3..651d09b 100644
@@ -1843,7 +1843,6 @@ static struct scsi_host_template mesh_template = {
 	.sg_tablesize			= SG_ALL,
 	.cmd_per_lun			= 2,
 	.use_clustering			= DISABLE_CLUSTERING,
-	.use_sg_chaining		= ENABLE_SG_CHAINING,
 };
 
 static int mesh_probe(struct macio_dev *mdev, const struct of_device_id *match)
drivers/scsi/nsp32.c +0 -1
index 28161dc..7fed353 100644
@@ -281,7 +281,6 @@ static struct scsi_host_template nsp32_template = {
 	.cmd_per_lun			= 1,
 	.this_id			= NSP32_HOST_SCSIID,
 	.use_clustering			= DISABLE_CLUSTERING,
-	.use_sg_chaining		= ENABLE_SG_CHAINING,
 	.eh_abort_handler       	= nsp32_eh_abort,
 	.eh_bus_reset_handler		= nsp32_eh_bus_reset,
 	.eh_host_reset_handler		= nsp32_eh_host_reset,
drivers/scsi/pcmcia/sym53c500_cs.c +0 -1
index 969b938..3454a57 100644
@@ -692,7 +692,6 @@ static struct scsi_host_template sym53c500_driver_template = {
      .sg_tablesize		= 32,
      .cmd_per_lun		= 1,
      .use_clustering		= ENABLE_CLUSTERING,
-     .use_sg_chaining		= ENABLE_SG_CHAINING,
      .shost_attrs		= SYM53C500_shost_attrs
 };
 
drivers/scsi/qla1280.c +0 -1
index c94906a..68c0d09 100644
@@ -4204,7 +4204,6 @@ static struct scsi_host_template qla1280_driver_template = {
 	.sg_tablesize		= SG_ALL,
 	.cmd_per_lun		= 1,
 	.use_clustering		= ENABLE_CLUSTERING,
-	.use_sg_chaining	= ENABLE_SG_CHAINING,
 };
 
 
drivers/scsi/qla2xxx/qla_os.c +0 -2
index a5bcf1f..78d1103 100644
@@ -132,7 +132,6 @@ struct scsi_host_template qla2x00_driver_template = {
 	.this_id		= -1,
 	.cmd_per_lun		= 3,
 	.use_clustering		= ENABLE_CLUSTERING,
-	.use_sg_chaining	= ENABLE_SG_CHAINING,
 	.sg_tablesize		= SG_ALL,
 
 	/*
@@ -164,7 +163,6 @@ struct scsi_host_template qla24xx_driver_template = {
 	.this_id		= -1,
 	.cmd_per_lun		= 3,
 	.use_clustering		= ENABLE_CLUSTERING,
-	.use_sg_chaining	= ENABLE_SG_CHAINING,
 	.sg_tablesize		= SG_ALL,
 
 	.max_sectors		= 0xFFFF,
drivers/scsi/qla4xxx/ql4_os.c +0 -1
index f55b9f7..b128da5 100644
@@ -94,7 +94,6 @@ static struct scsi_host_template qla4xxx_driver_template = {
 	.this_id		= -1,
 	.cmd_per_lun		= 3,
 	.use_clustering		= ENABLE_CLUSTERING,
-	.use_sg_chaining	= ENABLE_SG_CHAINING,
 	.sg_tablesize		= SG_ALL,
 
 	.max_sectors		= 0xFFFF,
drivers/scsi/qlogicfas.c +0 -1
index 1769f96..1e874f1 100644
@@ -197,7 +197,6 @@ static struct scsi_host_template qlogicfas_driver_template = {
 	.sg_tablesize		= SG_ALL,
 	.cmd_per_lun		= 1,
 	.use_clustering		= DISABLE_CLUSTERING,
-	.use_sg_chaining	= ENABLE_SG_CHAINING,
 };
 
 static __init int qlogicfas_init(void)
drivers/scsi/scsi_lib.c +17 -55

116 lines not on this page · raw message

drivers/scsi/stex.c +0 -1
index e3fab3a..72f6d80 100644
@@ -1123,7 +1123,6 @@ static struct scsi_host_template driver_template = {
 	.this_id			= -1,
 	.sg_tablesize			= ST_MAX_SG,
 	.cmd_per_lun			= ST_CMD_PER_LUN,
-	.use_sg_chaining		= ENABLE_SG_CHAINING,
 };
 
 static int stex_set_dma_mask(struct pci_dev * pdev)
drivers/scsi/sym53c416.c +0 -1
index 1f6fd16..6325901 100644
@@ -840,6 +840,5 @@ static struct scsi_host_template driver_template = {
 	.cmd_per_lun =		1,
 	.unchecked_isa_dma =	1,
 	.use_clustering =	ENABLE_CLUSTERING,
-	.use_sg_chaining =	ENABLE_SG_CHAINING,
 };
 #include "scsi_module.c"
drivers/scsi/sym53c8xx_2/sym_glue.c +0 -1
index 21e926d..9716019 100644
@@ -1681,7 +1681,6 @@ static struct scsi_host_template sym2_template = {
 	.eh_host_reset_handler	= sym53c8xx_eh_host_reset_handler,
 	.this_id		= 7,
 	.use_clustering		= ENABLE_CLUSTERING,
-	.use_sg_chaining	= ENABLE_SG_CHAINING,
 	.max_sectors		= 0xFFFF,
 #ifdef SYM_LINUX_PROC_INFO_SUPPORT
 	.proc_info		= sym53c8xx_proc_info,
drivers/scsi/u14-34f.c +0 -1
index 4bc5407..662c004 100644
@@ -451,7 +451,6 @@ static struct scsi_host_template driver_template = {
                 .this_id                 = 7,
                 .unchecked_isa_dma       = 1,
                 .use_clustering          = ENABLE_CLUSTERING,
-                .use_sg_chaining         = ENABLE_SG_CHAINING,
                 };
 
 #if !defined(__BIG_ENDIAN_BITFIELD) && !defined(__LITTLE_ENDIAN_BITFIELD)
drivers/scsi/ultrastor.c +0 -1
index 1d3b029..d86302c 100644
@@ -1197,6 +1197,5 @@ static struct scsi_host_template driver_template = {
 	.cmd_per_lun       = ULTRASTOR_MAX_CMDS_PER_LUN,
 	.unchecked_isa_dma = 1,
 	.use_clustering    = ENABLE_CLUSTERING,
-	.use_sg_chaining   = ENABLE_SG_CHAINING,
 };
 #include "scsi_module.c"
drivers/scsi/wd7000.c +0 -1
index b4304ae..c975c01 100644
@@ -1671,7 +1671,6 @@ static struct scsi_host_template driver_template = {
 	.cmd_per_lun		= 1,
 	.unchecked_isa_dma	= 1,
 	.use_clustering		= ENABLE_CLUSTERING,
-	.use_sg_chaining	= ENABLE_SG_CHAINING,
 };
 
 #include "scsi_module.c"
include/scsi/scsi.h +19 -0
index 702fcfe..056c5af 100644
@@ -11,6 +11,25 @@
 #include <linux/types.h>
 
 /*
+ * The maximum number of SG segments that we will put inside a
+ * scatterlist (unless chaining is used). Should ideally fit inside a
+ * single page, to avoid a higher order allocation.  We could define this
+ * to SG_MAX_SINGLE_ALLOC to pack correctly at the highest order.  The 
+ * minimum value is 32
+ */
+#define SCSI_MAX_SG_SEGMENTS	128
+
+/*
+ * Like SCSI_MAX_SG_SEGMENTS, but for archs that have sg chaining. This limit
+ * is totally arbitrary, a setting of 2048 will get you at least 8mb ios.
+ */
+#ifdef ARCH_HAS_SG_CHAIN
+#define SCSI_MAX_SG_CHAIN_SEGMENTS	2048
+#else
+#define SCSI_MAX_SG_CHAIN_SEGMENTS	SCSI_MAX_SG_SEGMENTS
+#endif
+
+/*
  *	SCSI command lengths
  */
 
include/scsi/scsi_host.h +0 -13
index cb2bcab..5c58d59 100644
@@ -39,9 +39,6 @@ struct blk_queue_tags;
 #define DISABLE_CLUSTERING 0
 #define ENABLE_CLUSTERING 1
 
-#define DISABLE_SG_CHAINING 0
-#define ENABLE_SG_CHAINING 1
-
 enum scsi_eh_timer_return {
 	EH_NOT_HANDLED,
 	EH_HANDLED,
@@ -446,15 +443,6 @@ struct scsi_host_template {
 	unsigned ordered_tag:1;
 
 	/*
-	 * true if the low-level driver can support sg chaining. this
-	 * will be removed eventually when all the drivers are
-	 * converted to support sg chaining.
-	 *
-	 * Status: OBSOLETE
-	 */
-	unsigned use_sg_chaining:1;
-
-	/*
 	 * Countdown for host blocking with no commands outstanding
 	 */
 	unsigned int max_host_blocked;
@@ -598,7 +586,6 @@ struct Scsi_Host {
 	unsigned unchecked_isa_dma:1;
 	unsigned use_clustering:1;
 	unsigned use_blk_tcq:1;
-	unsigned use_sg_chaining:1;
 
 	/*
 	 * Host has requested that no further requests come through for the
Signature · 1 line
1.5.3.7
#1 lore raw

PATCH 1/1 firewire: fw-sbp2: prepare for s/g chaining

---

Replacement of patch "firewire: fw-sbp2: enable s/g chaining".

It's the same, minus '+ .use_sg_chaining = ENABLE_SG_CHAINING,' hunk to prevent conflicts when James is going to remove .use_sg_chaining.

 drivers/firewire/fw-sbp2.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/firewire/fw-sbp2.c +3 -3
Index: linux/drivers/firewire/fw-sbp2.c
===================================================================
@@ -1107,9 +1107,9 @@ sbp2_map_scatterlist(struct sbp2_command
 	 * elements larger than 65535 bytes, some IOMMUs may merge sg elements
 	 * during DMA mapping, and Linux currently doesn't prevent this.
 	 */
-	for (i = 0, j = 0; i < count; i++) {
-		sg_len = sg_dma_len(sg + i);
-		sg_addr = sg_dma_address(sg + i);
+	for (i = 0, j = 0; i < count; i++, sg = sg_next(sg)) {
+		sg_len = sg_dma_len(sg);
+		sg_addr = sg_dma_address(sg);
 		while (sg_len) {
 			/* FIXME: This won't get us out of the pinch. */
 			if (unlikely(j >= ARRAY_SIZE(orb->page_table))) {
Signature · 9 lines
Stefan Richter
-=====-==--- ---= -====
http://arcgraph.de/sr/


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
#2 lore raw

PATCH 1/1 ieee1394: sbp2: prepare for s/g chaining

---

Replacement of patch "ieee1394: sbp2: enable s/g chaining".

It's the same, minus '+ .use_sg_chaining = ENABLE_SG_CHAINING,' hunk to prevent conflicts when James is going to remove .use_sg_chaining.

 drivers/ieee1394/sbp2.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/ieee1394/sbp2.c +1 -1
Index: linux/drivers/ieee1394/sbp2.c
===================================================================
@@ -1489,7 +1490,7 @@ static void sbp2_prep_command_orb_sg(str
 
 		/* loop through and fill out our SBP-2 page tables
 		 * (and split up anything too large) */
-		for (i = 0, sg_count = 0 ; i < count; i++, sgpnt++) {
+		for (i = 0, sg_count = 0; i < count; i++, sgpnt = sg_next(sgpnt)) {
 			sg_len = sg_dma_len(sgpnt);
 			sg_addr = sg_dma_address(sgpnt);
 			while (sg_len) {
Signature · 9 lines
Stefan Richter
-=====-==--- ---= -====
http://arcgraph.de/sr/


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
#3 lore raw

Re: [PATCH] ieee1394: sbp2: prepare for s/g chaining

Quoted 5 lines · Stefan Richter
Quoted 2 lines
 drivers/firewire/fw-sbp2.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
 drivers/ieee1394/sbp2.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Never mind the diffstats. I forgot to refresh them.

Signature · 8 lines
Stefan Richter
-=====-==--- ---= -====
http://arcgraph.de/sr/

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
#4 lore raw

Re: [PATCH] firewire: fw-sbp2: prepare for s/g chaining

In reply to Stefan Richter
Quoted 17 lines · On Tue, 15 Jan 2008 21:10:50 +0100 (CET) Stefan Richter…

---

Replacement of patch "firewire: fw-sbp2: enable s/g chaining".

It's the same, minus '+ .use_sg_chaining = ENABLE_SG_CHAINING,' hunk to prevent conflicts when James is going to remove .use_sg_chaining.

 drivers/firewire/fw-sbp2.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Index: linux/drivers/firewire/fw-sbp2.c
===================================================================

drivers/firewire/fw-sbp2.c sbp2_map_scatterlist(struct sbp2_command · line 1109

Quoted 3 lines
drivers/firewire/fw-sbp2.c +0 -0
@@ -1107,9 +1107,9 @@ sbp2_map_scatterlist(struct sbp2_command
 	 * elements larger than 65535 bytes, some IOMMUs may merge sg elements
 	 * during DMA mapping, and Linux currently doesn't prevent this.
 	 */

On a relate note, I fixed the IOMMU merge issue. The patches have been -mm though I'm not sure whether they will go into v2.6.25. The patches enable you to remove the following workaround if you configure the maximum sg element length.

Quoted 1 line

From a quick look, fw-sbp2 uses scsi-ml in a different way so it would

be a bit trick to configure the maximum sg element length.

You call dma_map_sg with pci_dev::dev but don't call scsi_add_host with pci_dev::dev.

If you set the maximum sg element length to pci_dev::dev, and then call scsi_add_host with it, the block layer and the IOMMU send you proper size sg elements.

Quoted 19 lines
drivers/firewire/fw-sbp2.c +3 -3
-	for (i = 0, j = 0; i < count; i++) {
-		sg_len = sg_dma_len(sg + i);
-		sg_addr = sg_dma_address(sg + i);
+	for (i = 0, j = 0; i < count; i++, sg = sg_next(sg)) {
+		sg_len = sg_dma_len(sg);
+		sg_addr = sg_dma_address(sg);
 		while (sg_len) {
 			/* FIXME: This won't get us out of the pinch. */
 			if (unlikely(j >= ARRAY_SIZE(orb->page_table))) {
Signature · 9 lines
-- 
Stefan Richter
-=====-==--- ---= -====
http://arcgraph.de/sr/

-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

#5 lore raw

Re: [PATCH] firewire: fw-sbp2: prepare for s/g chaining

Quoted 12 lines · FUJITA Tomonori

drivers/firewire/fw-sbp2.c sbp2_map_scatterlist(struct sbp2_command · line 1109

Quoted 5 lines · On Tue, 15 Jan 2008 21:10:50 +0100 (CET) Stefan Richter…

+++ linux/drivers/firewire/fw-sbp2.c

drivers/firewire/fw-sbp2.c +0 -0
@@ -1107,9 +1107,9 @@ sbp2_map_scatterlist(struct sbp2_command
 	 * elements larger than 65535 bytes, some IOMMUs may merge sg elements
 	 * during DMA mapping, and Linux currently doesn't prevent this.
 	 */

On a relate note, I fixed the IOMMU merge issue. The patches have been -mm though I'm not sure whether they will go into v2.6.25. The patches enable you to remove the following workaround if you configure the maximum sg element length.

Thanks, I will keep an eye on it.

Quoted 9 lines

From a quick look, fw-sbp2 uses scsi-ml in a different way so it would be a bit trick to configure the maximum sg element length.

You call dma_map_sg with pci_dev::dev but don't call scsi_add_host with pci_dev::dev.

If you set the maximum sg element length to pci_dev::dev, and then call scsi_add_host with it, the block layer and the IOMMU send you proper size sg elements.

At the moment, the Scsi_Host instances map 1:1 to SBP-2 target instances. I have to think about whether we can map it to FireWire controller instances instead. (Besides, the s/g element length limitation is actually a limitation of the SBP-2 protocol, not of FireWire PCI cards.)

Signature · 8 lines
Stefan Richter
-=====-==--- ---= =--==
http://arcgraph.de/sr/

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
#6 lore raw
In reply to James Bottomley
Quoted 9 lines · James Bottomley

this patch depends on the sg branch of the block tree

James

---
From: James Bottomley <[email protected]>
Date: Tue, 15 Jan 2008 11:11:46 -0600
Subject: remove use_sg_chaining

Quoted 7 lines

With the sg table code, every SCSI driver is now either chain capable or broken, so there's no need to have a check in the host template.

Also tidy up the code by moving the scatterlist size defines into the SCSI includes and permit the last entry of the scatterlist pools not to be a power of two.
---

I have a theoretical problem that BUGed me from the beginning.

Could it happen that a memory critical IO, (that is needed to free memory), be collected into an sg-chained large IO, and the allocation of the multiple sg-pool-allocations fail, thous dead locking on out-of-memory? Is there a mechanism in place that will split large IO's into smaller chunks in the event of out-of-memory condition in prep_fn?

Is it possible to call blk_rq_map_sg() with less then what is present at request to only map the starting portion?

Boaz

author maintainer
#7 lore raw
Quoted 20 lines · Boaz Harrosh
Quoted 9 lines · James Bottomley

this patch depends on the sg branch of the block tree

James

---
From: James Bottomley <[email protected]>
Date: Tue, 15 Jan 2008 11:11:46 -0600
Subject: remove use_sg_chaining

Quoted 7 lines

With the sg table code, every SCSI driver is now either chain capable or broken, so there's no need to have a check in the host template.

Also tidy up the code by moving the scatterlist size defines into the SCSI includes and permit the last entry of the scatterlist pools not to be a power of two.
---

I have a theoretical problem that BUGed me from the beginning.

Quoted 8 lines

Could it happen that a memory critical IO, (that is needed to free memory), be collected into an sg-chained large IO, and the allocation of the multiple sg-pool-allocations fail, thous dead locking on out-of-memory? Is there a mechanism in place that will split large IO's into smaller chunks in the event of out-of-memory condition in prep_fn?

Is it possible to call blk_rq_map_sg() with less then what is present at request to only map the starting portion?

Obviously, that's why I was worrying about mempool size and default blocks a while ago.

However, the deadlock only occurs if the device is swap or backing a filesystem with memory mapped files. The use cases for this are really tapes and other entities that need huge buffers. That's why we're keeping the system sector size at 1024 unless you alter it through sysfs (here gun, there foot ...)

James

#8 lore raw
Quoted 31 lines · James Bottomley
Quoted 20 lines · Boaz Harrosh
Quoted 9 lines · James Bottomley

this patch depends on the sg branch of the block tree

James

---
From: James Bottomley <[email protected]>
Date: Tue, 15 Jan 2008 11:11:46 -0600
Subject: remove use_sg_chaining

Quoted 7 lines

With the sg table code, every SCSI driver is now either chain capable or broken, so there's no need to have a check in the host template.

Also tidy up the code by moving the scatterlist size defines into the SCSI includes and permit the last entry of the scatterlist pools not to be a power of two.
---

I have a theoretical problem that BUGed me from the beginning.

Quoted 8 lines

Could it happen that a memory critical IO, (that is needed to free memory), be collected into an sg-chained large IO, and the allocation of the multiple sg-pool-allocations fail, thous dead locking on out-of-memory? Is there a mechanism in place that will split large IO's into smaller chunks in the event of out-of-memory condition in prep_fn?

Is it possible to call blk_rq_map_sg() with less then what is present at request to only map the starting portion?

Quoted 8 lines

Obviously, that's why I was worrying about mempool size and default blocks a while ago.

However, the deadlock only occurs if the device is swap or backing a filesystem with memory mapped files. The use cases for this are really tapes and other entities that need huge buffers. That's why we're keeping the system sector size at 1024 unless you alter it through sysfs (here gun, there foot ...)

Alternatively (and much safer, imho), we allow blk_rq_map_sg() return smaller than nr_phys_segments and just ensure that the request is continued nicely through the normal 'request if residual' logic.

Signature · 1 line
Jens Axboe
#17 lore raw
In reply to James Bottomley
Quoted 32 lines · James Bottomley
Quoted 19 lines · Boaz Harrosh
Quoted 9 lines · James Bottomley

this patch depends on the sg branch of the block tree

James

---
From: James Bottomley <[email protected]>
Date: Tue, 15 Jan 2008 11:11:46 -0600
Subject: remove use_sg_chaining

Quoted 7 lines

With the sg table code, every SCSI driver is now either chain capable or broken, so there's no need to have a check in the host template.

Also tidy up the code by moving the scatterlist size defines into the SCSI includes and permit the last entry of the scatterlist pools not to be a power of two.
---

I have a theoretical problem that BUGed me from the beginning.

Quoted 8 lines

Could it happen that a memory critical IO, (that is needed to free memory), be collected into an sg-chained large IO, and the allocation of the multiple sg-pool-allocations fail, thous dead locking on out-of-memory? Is there a mechanism in place that will split large IO's into smaller chunks in the event of out-of-memory condition in prep_fn?

Is it possible to call blk_rq_map_sg() with less then what is present at request to only map the starting portion?

Obviously, that's why I was worrying about mempool size and default blocks a while ago.

Quoted 8 lines

However, the deadlock only occurs if the device is swap or backing a filesystem with memory mapped files. The use cases for this are really tapes and other entities that need huge buffers. That's why we're keeping the system sector size at 1024 unless you alter it through sysfs (here gun, there foot ...)

James

OK Thanks for confirming my concern, In modern life with devices like iSCSI that have ~0 as it's max_sector, swapping over that should be considered and configured carefully. Once with pNFS over blocks/objects it should be addressed. Perhaps with a FAIL_FAST semantics for users like pNFS to split up the requests if they fail with out-of-memory.

Thanks
Boaz

#9 lore raw
In reply to Jens Axboe
Quoted 38 lines · Jens Axboe
Quoted 28 lines · James Bottomley
Quoted 19 lines · Boaz Harrosh
Quoted 9 lines · James Bottomley

this patch depends on the sg branch of the block tree

James

---
From: James Bottomley <[email protected]>
Date: Tue, 15 Jan 2008 11:11:46 -0600
Subject: remove use_sg_chaining

Quoted 7 lines

With the sg table code, every SCSI driver is now either chain capable or broken, so there's no need to have a check in the host template.

Also tidy up the code by moving the scatterlist size defines into the SCSI includes and permit the last entry of the scatterlist pools not to be a power of two.
---

I have a theoretical problem that BUGed me from the beginning.

Quoted 8 lines

Could it happen that a memory critical IO, (that is needed to free memory), be collected into an sg-chained large IO, and the allocation of the multiple sg-pool-allocations fail, thous dead locking on out-of-memory? Is there a mechanism in place that will split large IO's into smaller chunks in the event of out-of-memory condition in prep_fn?

Is it possible to call blk_rq_map_sg() with less then what is present at request to only map the starting portion?

Quoted 8 lines

Obviously, that's why I was worrying about mempool size and default blocks a while ago.

However, the deadlock only occurs if the device is swap or backing a filesystem with memory mapped files. The use cases for this are really tapes and other entities that need huge buffers. That's why we're keeping the system sector size at 1024 unless you alter it through sysfs (here gun, there foot ...)

Quoted 4 lines

Alternatively (and much safer, imho), we allow blk_rq_map_sg() return smaller than nr_phys_segments and just ensure that the request is continued nicely through the normal 'request if residual' logic.

Thats a grate Idea. I will Q it on my todo list. Thanks

Boaz

#18 lore raw
In reply to Boaz Harrosh
Quoted 42 lines · Boaz Harrosh
Quoted 32 lines · James Bottomley
Quoted 19 lines · Boaz Harrosh
Quoted 9 lines · James Bottomley

this patch depends on the sg branch of the block tree

James

---
From: James Bottomley <[email protected]>
Date: Tue, 15 Jan 2008 11:11:46 -0600
Subject: remove use_sg_chaining

Quoted 7 lines

With the sg table code, every SCSI driver is now either chain capable or broken, so there's no need to have a check in the host template.

Also tidy up the code by moving the scatterlist size defines into the SCSI includes and permit the last entry of the scatterlist pools not to be a power of two.
---

I have a theoretical problem that BUGed me from the beginning.

Quoted 8 lines

Could it happen that a memory critical IO, (that is needed to free memory), be collected into an sg-chained large IO, and the allocation of the multiple sg-pool-allocations fail, thous dead locking on out-of-memory? Is there a mechanism in place that will split large IO's into smaller chunks in the event of out-of-memory condition in prep_fn?

Is it possible to call blk_rq_map_sg() with less then what is present at request to only map the starting portion?

Obviously, that's why I was worrying about mempool size and default blocks a while ago.

Quoted 8 lines

However, the deadlock only occurs if the device is swap or backing a filesystem with memory mapped files. The use cases for this are really tapes and other entities that need huge buffers. That's why we're keeping the system sector size at 1024 unless you alter it through sysfs (here gun, there foot ...)

James

Quoted 6 lines

OK Thanks for confirming my concern, In modern life with devices like iSCSI that have ~0 as it's max_sector, swapping over that should be considered and configured carefully. Once with pNFS over blocks/objects it should be addressed. Perhaps with a FAIL_FAST semantics for users like pNFS to split up the requests if they fail with out-of-memory.

I'll have to disagree again, you can't expect users to know these sorts of things ("sorry your system deadlocked, you should have known not to increase max_sectors_kb for something you swap on"). Especially when handling it correctly in scsi_init_io() is a few lines of change.

No excuse for not doing this correctly. At least for blk_fs_request() requests, for blk_pc_request() failing is the only option.

Signature · 1 line
Jens Axboe
#10 lore raw
In reply to Boaz Harrosh
Quoted 39 lines · Boaz Harrosh
Quoted 38 lines · Jens Axboe
Quoted 36 lines · James Bottomley
Quoted 19 lines · Boaz Harrosh
Quoted 9 lines · James Bottomley

this patch depends on the sg branch of the block tree

James

---
From: James Bottomley <[email protected]>
Date: Tue, 15 Jan 2008 11:11:46 -0600
Subject: remove use_sg_chaining

Quoted 7 lines

With the sg table code, every SCSI driver is now either chain capable or broken, so there's no need to have a check in the host template.

Also tidy up the code by moving the scatterlist size defines into the SCSI includes and permit the last entry of the scatterlist pools not to be a power of two.
---

I have a theoretical problem that BUGed me from the beginning.

Quoted 8 lines

Could it happen that a memory critical IO, (that is needed to free memory), be collected into an sg-chained large IO, and the allocation of the multiple sg-pool-allocations fail, thous dead locking on out-of-memory? Is there a mechanism in place that will split large IO's into smaller chunks in the event of out-of-memory condition in prep_fn?

Is it possible to call blk_rq_map_sg() with less then what is present at request to only map the starting portion?

Obviously, that's why I was worrying about mempool size and default blocks a while ago.

However, the deadlock only occurs if the device is swap or backing a filesystem with memory mapped files. The use cases for this are really tapes and other entities that need huge buffers. That's why we're keeping the system sector size at 1024 unless you alter it through sysfs (here gun, there foot ...)

Quoted 5 lines
Quoted 4 lines

Alternatively (and much safer, imho), we allow blk_rq_map_sg() return smaller than nr_phys_segments and just ensure that the request is continued nicely through the normal 'request if residual' logic.

Thats a grate Idea. I will Q it on my todo list. Thanks

ok good, thanks :-)

Signature · 1 line
Jens Axboe
#11 lore raw
Quoted 40 lines · Jens Axboe
Quoted 39 lines · Boaz Harrosh
Quoted 38 lines · Jens Axboe
Quoted 36 lines · James Bottomley
Quoted 19 lines · Boaz Harrosh
Quoted 9 lines · James Bottomley

this patch depends on the sg branch of the block tree

James

---
From: James Bottomley <[email protected]>
Date: Tue, 15 Jan 2008 11:11:46 -0600
Subject: remove use_sg_chaining

Quoted 7 lines

With the sg table code, every SCSI driver is now either chain capable or broken, so there's no need to have a check in the host template.

Also tidy up the code by moving the scatterlist size defines into the SCSI includes and permit the last entry of the scatterlist pools not to be a power of two.
---

I have a theoretical problem that BUGed me from the beginning.

Quoted 8 lines

Could it happen that a memory critical IO, (that is needed to free memory), be collected into an sg-chained large IO, and the allocation of the multiple sg-pool-allocations fail, thous dead locking on out-of-memory? Is there a mechanism in place that will split large IO's into smaller chunks in the event of out-of-memory condition in prep_fn?

Is it possible to call blk_rq_map_sg() with less then what is present at request to only map the starting portion?

Obviously, that's why I was worrying about mempool size and default blocks a while ago.

However, the deadlock only occurs if the device is swap or backing a filesystem with memory mapped files. The use cases for this are really tapes and other entities that need huge buffers. That's why we're keeping the system sector size at 1024 unless you alter it through sysfs (here gun, there foot ...)

Quoted 7 lines
Quoted 5 lines
Quoted 4 lines

Alternatively (and much safer, imho), we allow blk_rq_map_sg() return smaller than nr_phys_segments and just ensure that the request is continued nicely through the normal 'request if residual' logic.

Thats a grate Idea. I will Q it on my todo list. Thanks

ok good, thanks :-)

btw, the above is full of typos, my apologies. it should read "requeue if residual", but I guess you already guessed as much.

Signature · 1 line
Jens Axboe
author maintainer
#19 lore raw
In reply to Boaz Harrosh
Quoted 39 lines · Boaz Harrosh
Quoted 38 lines · James Bottomley
Quoted 19 lines · Boaz Harrosh
Quoted 9 lines · James Bottomley

this patch depends on the sg branch of the block tree

James

---
From: James Bottomley <[email protected]>
Date: Tue, 15 Jan 2008 11:11:46 -0600
Subject: remove use_sg_chaining

Quoted 7 lines

With the sg table code, every SCSI driver is now either chain capable or broken, so there's no need to have a check in the host template.

Also tidy up the code by moving the scatterlist size defines into the SCSI includes and permit the last entry of the scatterlist pools not to be a power of two.
---

I have a theoretical problem that BUGed me from the beginning.

Quoted 8 lines

Could it happen that a memory critical IO, (that is needed to free memory), be collected into an sg-chained large IO, and the allocation of the multiple sg-pool-allocations fail, thous dead locking on out-of-memory? Is there a mechanism in place that will split large IO's into smaller chunks in the event of out-of-memory condition in prep_fn?

Is it possible to call blk_rq_map_sg() with less then what is present at request to only map the starting portion?

Obviously, that's why I was worrying about mempool size and default blocks a while ago.

However, the deadlock only occurs if the device is swap or backing a filesystem with memory mapped files. The use cases for this are really tapes and other entities that need huge buffers. That's why we're keeping the system sector size at 1024 unless you alter it through sysfs (here gun, there foot ...)

Quoted 8 lines
Quoted 2 lines

James

OK Thanks for confirming my concern, In modern life with devices like iSCSI that have ~0 as it's max_sector, swapping over that should be considered and configured carefully. Once with pNFS over blocks/objects it should be addressed. Perhaps with a FAIL_FAST semantics for users like pNFS to split up the requests if they fail with out-of-memory.

Well, swap over networked backed devices is an order of magnitude worse of a problem.

However, the block layer doesn't let you set max_sectors over 1024; even when iscsi requests ~0 it gets 1024 but the user is allowed to raise this via sysfs. (That's the difference between max_sectors [currently operating parameter] and max_hw_sectors [passed in maximum])

James

author maintainer
#12 lore raw
In reply to Jens Axboe
Quoted 45 lines · Jens Axboe
Quoted 44 lines · Jens Axboe
Quoted 43 lines · Boaz Harrosh
Quoted 42 lines · Jens Axboe
Quoted 28 lines · James Bottomley
Quoted 19 lines · Boaz Harrosh
Quoted 9 lines · James Bottomley

this patch depends on the sg branch of the block tree

James

---
From: James Bottomley <[email protected]>
Date: Tue, 15 Jan 2008 11:11:46 -0600
Subject: remove use_sg_chaining

Quoted 7 lines

With the sg table code, every SCSI driver is now either chain capable or broken, so there's no need to have a check in the host template.

Also tidy up the code by moving the scatterlist size defines into the SCSI includes and permit the last entry of the scatterlist pools not to be a power of two.
---

I have a theoretical problem that BUGed me from the beginning.

Quoted 8 lines

Could it happen that a memory critical IO, (that is needed to free memory), be collected into an sg-chained large IO, and the allocation of the multiple sg-pool-allocations fail, thous dead locking on out-of-memory? Is there a mechanism in place that will split large IO's into smaller chunks in the event of out-of-memory condition in prep_fn?

Is it possible to call blk_rq_map_sg() with less then what is present at request to only map the starting portion?

Quoted 8 lines

Obviously, that's why I was worrying about mempool size and default blocks a while ago.

However, the deadlock only occurs if the device is swap or backing a filesystem with memory mapped files. The use cases for this are really tapes and other entities that need huge buffers. That's why we're keeping the system sector size at 1024 unless you alter it through sysfs (here gun, there foot ...)

Alternatively (and much safer, imho), we allow blk_rq_map_sg() return smaller than nr_phys_segments and just ensure that the request is continued nicely through the normal 'request if residual' logic.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Thats a grate Idea. I will Q it on my todo list. Thanks

ok good, thanks :-)

btw, the above is full of typos, my apologies. it should read "requeue if residual", but I guess you already guessed as much.

Something like ...

It looks to me like it would make sense to have something like a BLKPREP_SGALLOCFAIL return so the block layer can do this for us ... Alternatively, we'll have to find a way of adjusting the sector count as it goes into the ULD prep functions.

James

#20 lore raw
In reply to Boaz Harrosh
Quoted 39 lines · On Sun, 20 Jan 2008 21:54:21 +0200 Boaz Harrosh <[email protected]> wrote:
Quoted 38 lines · James Bottomley
Quoted 19 lines · Boaz Harrosh
Quoted 9 lines · James Bottomley

this patch depends on the sg branch of the block tree

James

---
From: James Bottomley <[email protected]>
Date: Tue, 15 Jan 2008 11:11:46 -0600
Subject: remove use_sg_chaining

Quoted 7 lines

With the sg table code, every SCSI driver is now either chain capable or broken, so there's no need to have a check in the host template.

Also tidy up the code by moving the scatterlist size defines into the SCSI includes and permit the last entry of the scatterlist pools not to be a power of two.
---

I have a theoretical problem that BUGed me from the beginning.

Quoted 8 lines

Could it happen that a memory critical IO, (that is needed to free memory), be collected into an sg-chained large IO, and the allocation of the multiple sg-pool-allocations fail, thous dead locking on out-of-memory? Is there a mechanism in place that will split large IO's into smaller chunks in the event of out-of-memory condition in prep_fn?

Is it possible to call blk_rq_map_sg() with less then what is present at request to only map the starting portion?

Obviously, that's why I was worrying about mempool size and default blocks a while ago.

However, the deadlock only occurs if the device is swap or backing a filesystem with memory mapped files. The use cases for this are really tapes and other entities that need huge buffers. That's why we're keeping the system sector size at 1024 unless you alter it through sysfs (here gun, there foot ...)

Quoted 8 lines
Quoted 2 lines

James

OK Thanks for confirming my concern, In modern life with devices like iSCSI that have ~0 as it's max_sector, swapping over that should be considered and configured carefully. Once with pNFS over blocks/objects it should be addressed. Perhaps with a FAIL_FAST semantics for users like pNFS to split up the requests if they fail with out-of-memory.

As James pointed out, with networked backed device, the things are much more complicated (I have no idea when such configuration will be possible).

http://kerneltrap.org/Linux/Swap_Over_NFS

#13 lore raw
In reply to James Bottomley
Quoted 50 lines · James Bottomley
Quoted 40 lines · Jens Axboe
Quoted 39 lines · Jens Axboe
Quoted 38 lines · Boaz Harrosh
Quoted 37 lines · Jens Axboe
Quoted 36 lines · James Bottomley
Quoted 19 lines · Boaz Harrosh
Quoted 9 lines · James Bottomley

this patch depends on the sg branch of the block tree

James

---
From: James Bottomley <[email protected]>
Date: Tue, 15 Jan 2008 11:11:46 -0600
Subject: remove use_sg_chaining

Quoted 7 lines

With the sg table code, every SCSI driver is now either chain capable or broken, so there's no need to have a check in the host template.

Also tidy up the code by moving the scatterlist size defines into the SCSI includes and permit the last entry of the scatterlist pools not to be a power of two.
---

I have a theoretical problem that BUGed me from the beginning.

Quoted 8 lines

Could it happen that a memory critical IO, (that is needed to free memory), be collected into an sg-chained large IO, and the allocation of the multiple sg-pool-allocations fail, thous dead locking on out-of-memory? Is there a mechanism in place that will split large IO's into smaller chunks in the event of out-of-memory condition in prep_fn?

Is it possible to call blk_rq_map_sg() with less then what is present at request to only map the starting portion?

Obviously, that's why I was worrying about mempool size and default blocks a while ago.

However, the deadlock only occurs if the device is swap or backing a filesystem with memory mapped files. The use cases for this are really tapes and other entities that need huge buffers. That's why we're keeping the system sector size at 1024 unless you alter it through sysfs (here gun, there foot ...)

Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
Quoted 4 lines

Alternatively (and much safer, imho), we allow blk_rq_map_sg() return smaller than nr_phys_segments and just ensure that the request is continued nicely through the normal 'request if residual' logic.

Thats a grate Idea. I will Q it on my todo list. Thanks

ok good, thanks :-)

btw, the above is full of typos, my apologies. it should read "requeue if residual", but I guess you already guessed as much.

Quoted 8 lines

Something like ...

It looks to me like it would make sense to have something like a BLKPREP_SGALLOCFAIL return so the block layer can do this for us ... Alternatively, we'll have to find a way of adjusting the sector count as it goes into the ULD prep functions.

James

By luck this is no problem because it happens exactly before the ULD actually prepares the command. sd and sr are already doing these adjustments based on bufflen. For BLOCK_PC we will need to fail with perhaps a new BLKPREP_SGALLOCFAIL, like you said, and let the initiator take care of it.

Boaz

#14 lore raw
Quoted 58 lines · Boaz Harrosh
Quoted 57 lines · James Bottomley
Quoted 40 lines · Jens Axboe
Quoted 39 lines · Jens Axboe
Quoted 38 lines · Boaz Harrosh
Quoted 37 lines · Jens Axboe
Quoted 36 lines · James Bottomley
Quoted 19 lines · Boaz Harrosh
Quoted 9 lines · James Bottomley

this patch depends on the sg branch of the block tree

James

---
From: James Bottomley <[email protected]>
Date: Tue, 15 Jan 2008 11:11:46 -0600
Subject: remove use_sg_chaining

Quoted 7 lines

With the sg table code, every SCSI driver is now either chain capable or broken, so there's no need to have a check in the host template.

Also tidy up the code by moving the scatterlist size defines into the SCSI includes and permit the last entry of the scatterlist pools not to be a power of two.
---

I have a theoretical problem that BUGed me from the beginning.

Quoted 8 lines

Could it happen that a memory critical IO, (that is needed to free memory), be collected into an sg-chained large IO, and the allocation of the multiple sg-pool-allocations fail, thous dead locking on out-of-memory? Is there a mechanism in place that will split large IO's into smaller chunks in the event of out-of-memory condition in prep_fn?

Is it possible to call blk_rq_map_sg() with less then what is present at request to only map the starting portion?

Obviously, that's why I was worrying about mempool size and default blocks a while ago.

However, the deadlock only occurs if the device is swap or backing a filesystem with memory mapped files. The use cases for this are really tapes and other entities that need huge buffers. That's why we're keeping the system sector size at 1024 unless you alter it through sysfs (here gun, there foot ...)

Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
Quoted 4 lines

Alternatively (and much safer, imho), we allow blk_rq_map_sg() return smaller than nr_phys_segments and just ensure that the request is continued nicely through the normal 'request if residual' logic.

Thats a grate Idea. I will Q it on my todo list. Thanks

ok good, thanks :-)

btw, the above is full of typos, my apologies. it should read "requeue if residual", but I guess you already guessed as much.

Something like ...

It looks to me like it would make sense to have something like a BLKPREP_SGALLOCFAIL return so the block layer can do this for us ... Alternatively, we'll have to find a way of adjusting the sector count as it goes into the ULD prep functions.

Quoted 7 lines
Quoted 1 line

James

By luck this is no problem because it happens exactly before the ULD actually prepares the command. sd and sr are already doing these adjustments based on bufflen. For BLOCK_PC we will need to fail with perhaps a new BLKPREP_SGALLOCFAIL, like you said, and let the initiator take care of it.

Right, the scsi_init_io() takes care of it and adjusts the buflen as needed, no need to pass this "erro"r back. As far as I'm concerned, blocking for BLOCK_PC requests should be fine (is anyone using these for swap?).

Signature · 1 line
Jens Axboe
#15 lore raw
Quoted 65 lines · Jens Axboe
Quoted 57 lines · Boaz Harrosh
Quoted 56 lines · James Bottomley
Quoted 40 lines · Jens Axboe
Quoted 39 lines · Jens Axboe
Quoted 38 lines · Boaz Harrosh
Quoted 37 lines · Jens Axboe
Quoted 36 lines · James Bottomley
Quoted 19 lines · Boaz Harrosh
Quoted 9 lines · James Bottomley

this patch depends on the sg branch of the block tree

James

---
From: James Bottomley <[email protected]>
Date: Tue, 15 Jan 2008 11:11:46 -0600
Subject: remove use_sg_chaining

Quoted 7 lines

With the sg table code, every SCSI driver is now either chain capable or broken, so there's no need to have a check in the host template.

Also tidy up the code by moving the scatterlist size defines into the SCSI includes and permit the last entry of the scatterlist pools not to be a power of two.
---

I have a theoretical problem that BUGed me from the beginning.

Quoted 8 lines

Could it happen that a memory critical IO, (that is needed to free memory), be collected into an sg-chained large IO, and the allocation of the multiple sg-pool-allocations fail, thous dead locking on out-of-memory? Is there a mechanism in place that will split large IO's into smaller chunks in the event of out-of-memory condition in prep_fn?

Is it possible to call blk_rq_map_sg() with less then what is present at request to only map the starting portion?

Obviously, that's why I was worrying about mempool size and default blocks a while ago.

However, the deadlock only occurs if the device is swap or backing a filesystem with memory mapped files. The use cases for this are really tapes and other entities that need huge buffers. That's why we're keeping the system sector size at 1024 unless you alter it through sysfs (here gun, there foot ...)

Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
Quoted 4 lines

Alternatively (and much safer, imho), we allow blk_rq_map_sg() return smaller than nr_phys_segments and just ensure that the request is continued nicely through the normal 'request if residual' logic.

Thats a grate Idea. I will Q it on my todo list. Thanks

ok good, thanks :-)

btw, the above is full of typos, my apologies. it should read "requeue if residual", but I guess you already guessed as much.

Something like ...

It looks to me like it would make sense to have something like a BLKPREP_SGALLOCFAIL return so the block layer can do this for us ... Alternatively, we'll have to find a way of adjusting the sector count as it goes into the ULD prep functions.

Quoted 6 lines
Quoted 1 line

James

By luck this is no problem because it happens exactly before the ULD actually prepares the command. sd and sr are already doing these adjustments based on bufflen. For BLOCK_PC we will need to fail with perhaps a new BLKPREP_SGALLOCFAIL, like you said, and let the initiator take care of it.

Quoted 5 lines

Right, the scsi_init_io() takes care of it and adjusts the buflen as needed, no need to pass this "erro"r back. As far as I'm concerned, blocking for BLOCK_PC requests should be fine (is anyone using these for swap?).

I was also thinking of a live-lock as opposed to dead-lock, where thousands of requests are issued to tens/hundreds of devices all large chained IO, so each fails to allocate second order chain segment and all are stuck in a traffic jam. Maybe BLKPREP_SGALLOCFAIL could mean wait for normal BLOCK_PC commands and return if FAIL_FAST. But I guess we can do that much later, after the picture settles. (And some experiments are do)

Thanks Jens
Boaz

#16 lore raw
In reply to Jens Axboe
Quoted 65 lines · Jens Axboe
Quoted 57 lines · Boaz Harrosh
Quoted 56 lines · James Bottomley
Quoted 40 lines · Jens Axboe
Quoted 39 lines · Jens Axboe
Quoted 38 lines · Boaz Harrosh
Quoted 37 lines · Jens Axboe
Quoted 36 lines · James Bottomley
Quoted 19 lines · Boaz Harrosh
Quoted 9 lines · James Bottomley

this patch depends on the sg branch of the block tree

James

---
From: James Bottomley <[email protected]>
Date: Tue, 15 Jan 2008 11:11:46 -0600
Subject: remove use_sg_chaining

Quoted 7 lines

With the sg table code, every SCSI driver is now either chain capable or broken, so there's no need to have a check in the host template.

Also tidy up the code by moving the scatterlist size defines into the SCSI includes and permit the last entry of the scatterlist pools not to be a power of two.
---

I have a theoretical problem that BUGed me from the beginning.

Quoted 8 lines

Could it happen that a memory critical IO, (that is needed to free memory), be collected into an sg-chained large IO, and the allocation of the multiple sg-pool-allocations fail, thous dead locking on out-of-memory? Is there a mechanism in place that will split large IO's into smaller chunks in the event of out-of-memory condition in prep_fn?

Is it possible to call blk_rq_map_sg() with less then what is present at request to only map the starting portion?

Obviously, that's why I was worrying about mempool size and default blocks a while ago.

However, the deadlock only occurs if the device is swap or backing a filesystem with memory mapped files. The use cases for this are really tapes and other entities that need huge buffers. That's why we're keeping the system sector size at 1024 unless you alter it through sysfs (here gun, there foot ...)

Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
Quoted 4 lines

Alternatively (and much safer, imho), we allow blk_rq_map_sg() return smaller than nr_phys_segments and just ensure that the request is continued nicely through the normal 'request if residual' logic.

Thats a grate Idea. I will Q it on my todo list. Thanks

ok good, thanks :-)

btw, the above is full of typos, my apologies. it should read "requeue if residual", but I guess you already guessed as much.

Something like ...

It looks to me like it would make sense to have something like a BLKPREP_SGALLOCFAIL return so the block layer can do this for us ... Alternatively, we'll have to find a way of adjusting the sector count as it goes into the ULD prep functions.

Quoted 6 lines
Quoted 1 line

James

By luck this is no problem because it happens exactly before the ULD actually prepares the command. sd and sr are already doing these adjustments based on bufflen. For BLOCK_PC we will need to fail with perhaps a new BLKPREP_SGALLOCFAIL, like you said, and let the initiator take care of it.

Quoted 5 lines

Right, the scsi_init_io() takes care of it and adjusts the buflen as needed, no need to pass this "erro"r back. As far as I'm concerned, blocking for BLOCK_PC requests should be fine (is anyone using these for swap?).

It could help the OSD I/O module which will produce BLOCK_PC bidi CDBs to get feedback in the form of ENOMEM so to throttle down its I/O coalescing sizes and generate smaller I/Os in face of memory pressure and then gradually throttle up when on success. If the requests are held back and blocked at the queue I'm concerned that could hurt performance under memory pressure by not filling up the pipeline as much as we can.

Benny