All of lore.kernel.org
 help / color / mirror / Atom feed
* [SCSI] Set max_phys_segments to sg_tablesize
@ 2003-10-15 11:57 Herbert Xu
  2003-10-15 12:02 ` Jens Axboe
  0 siblings, 1 reply; 8+ messages in thread
From: Herbert Xu @ 2003-10-15 11:57 UTC (permalink / raw)
  To: Linus Torvalds, Christoph Hellwig, axboe, Linux Kernel Mailing List

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

Hi:

Many SCSI host drivers assume that use_sg will be <= sg_tablesize.
Hence they may break under 2.6 as the number of physical segments
is not limited by sg_tablesize.  This patch fixes that.

Cheers,
-- 
Debian GNU/Linux 3.0 is out! ( http://www.debian.org/ )
Email:  Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

[-- Attachment #2: p --]
[-- Type: text/plain, Size: 813 bytes --]

Index: kernel-source-2.5/drivers/scsi/scsi_lib.c
===================================================================
RCS file: /home/gondolin/herbert/src/CVS/debian/kernel-source-2.5/drivers/scsi/scsi_lib.c,v
retrieving revision 1.1.1.16
diff -u -r1.1.1.16 scsi_lib.c
--- kernel-source-2.5/drivers/scsi/scsi_lib.c	28 Sep 2003 04:44:15 -0000	1.1.1.16
+++ kernel-source-2.5/drivers/scsi/scsi_lib.c	15 Oct 2003 11:32:20 -0000
@@ -1243,7 +1243,7 @@
 	blk_queue_prep_rq(q, scsi_prep_fn);
 
 	blk_queue_max_hw_segments(q, shost->sg_tablesize);
-	blk_queue_max_phys_segments(q, MAX_PHYS_SEGMENTS);
+	blk_queue_max_phys_segments(q, shost->sg_tablesize);
 	blk_queue_max_sectors(q, shost->max_sectors);
 	blk_queue_bounce_limit(q, scsi_calculate_bounce_limit(shost));
 	blk_queue_segment_boundary(q, shost->dma_boundary);

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

* Re: [SCSI] Set max_phys_segments to sg_tablesize
  2003-10-15 11:57 [SCSI] Set max_phys_segments to sg_tablesize Herbert Xu
@ 2003-10-15 12:02 ` Jens Axboe
  2003-10-15 12:06   ` Herbert Xu
  0 siblings, 1 reply; 8+ messages in thread
From: Jens Axboe @ 2003-10-15 12:02 UTC (permalink / raw)
  To: Herbert Xu; +Cc: Linus Torvalds, Christoph Hellwig, Linux Kernel Mailing List

On Wed, Oct 15 2003, Herbert Xu wrote:
> Hi:
> 
> Many SCSI host drivers assume that use_sg will be <= sg_tablesize.
> Hence they may break under 2.6 as the number of physical segments
> is not limited by sg_tablesize.  This patch fixes that.

Is sg_tablesize guarenteed to be set? Looks like you need a

===== drivers/scsi/hosts.c 1.94 vs edited =====
--- 1.94/drivers/scsi/hosts.c   Sun Sep 21 19:52:38 2003
+++ edited/drivers/scsi/hosts.c Wed Oct 15 14:02:14 2003
@@ -234,7 +234,11 @@
        shost->hostt = sht;
        shost->this_id = sht->this_id;
        shost->can_queue = sht->can_queue;
+
        shost->sg_tablesize = sht->sg_tablesize;
+       if (!shost->sg_tablesize)
+               shost->sg_tablesize = MAX_PHYS_SEGMENTS;
+
        shost->cmd_per_lun = sht->cmd_per_lun;
        shost->unchecked_isa_dma = sht->unchecked_isa_dma;
        shost->use_clustering = sht->use_clustering;

additionally.

-- 
Jens Axboe


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

* Re: [SCSI] Set max_phys_segments to sg_tablesize
  2003-10-15 12:02 ` Jens Axboe
@ 2003-10-15 12:06   ` Herbert Xu
  0 siblings, 0 replies; 8+ messages in thread
From: Herbert Xu @ 2003-10-15 12:06 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Linus Torvalds, Christoph Hellwig, Linux Kernel Mailing List

On Wed, Oct 15, 2003 at 02:02:59PM +0200, Jens Axboe wrote:
> 
> Is sg_tablesize guarenteed to be set? Looks like you need a

This doesn't hurt of course.

However, 2.4's merging code assumed that sg_tablesize is always set.

Cheers,
-- 
Debian GNU/Linux 3.0 is out! ( http://www.debian.org/ )
Email:  Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

* Re: [SCSI] Set max_phys_segments to sg_tablesize
  2003-10-16  4:51 ` David S. Miller
@ 2003-10-16  6:57   ` Jens Axboe
  0 siblings, 0 replies; 8+ messages in thread
From: Jens Axboe @ 2003-10-16  6:57 UTC (permalink / raw)
  To: David S. Miller; +Cc: mika.penttila, herbert, torvalds, hch, linux-kernel

On Wed, Oct 15 2003, David S. Miller wrote:
> On Wed, 15 Oct 2003 15:37:22 +0300
> <mika.penttila@kolumbus.fi> wrote:
> 
> > >It does matter if the driver can't cope with it.
> > 
> > But this fix may hurt performance with well behaving drivers in
> > iommu systems. It's better to fix the broken drivers I think. 
> 
> That's absolutely correct.
> 
> If you add Herbert's change, you will effectively turn off all
> of the IOMMU coalescing benefits we designed into the block layer.
> Please don't apply it, fix the broken drivers instead.

Just changing it to hw segments should be fine, but I agree phys
segments is the wrong check.

-- 
Jens Axboe


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

* Re: [SCSI] Set max_phys_segments to sg_tablesize
  2003-10-15 12:37 mika.penttila
@ 2003-10-16  4:51 ` David S. Miller
  2003-10-16  6:57   ` Jens Axboe
  0 siblings, 1 reply; 8+ messages in thread
From: David S. Miller @ 2003-10-16  4:51 UTC (permalink / raw)
  To: mika.penttila; +Cc: herbert, torvalds, hch, axboe, linux-kernel

On Wed, 15 Oct 2003 15:37:22 +0300
<mika.penttila@kolumbus.fi> wrote:

> >It does matter if the driver can't cope with it.
> 
> But this fix may hurt performance with well behaving drivers in
> iommu systems. It's better to fix the broken drivers I think. 

That's absolutely correct.

If you add Herbert's change, you will effectively turn off all
of the IOMMU coalescing benefits we designed into the block layer.
Please don't apply it, fix the broken drivers instead.

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

* Re: [SCSI] Set max_phys_segments to sg_tablesize
@ 2003-10-15 12:37 mika.penttila
  2003-10-16  4:51 ` David S. Miller
  0 siblings, 1 reply; 8+ messages in thread
From: mika.penttila @ 2003-10-15 12:37 UTC (permalink / raw)
  To: Herbert Xu, Linus Torvalds, Christoph Hellwig, axboe,
	Linux Kernel Mailing List

>>> Many SCSI host drivers assume that use_sg will be <= sg_tablesize.
>>> Hence they may break under 2.6 as the number of physical segments
>>> is not limited by sg_tablesize.  This patch fixes that.
>> 
>> Physical segments don't matter,  hw segments does and it's bounded >by sg_tablesize.

>It does matter if the driver can't cope with it.


But this fix may hurt performance with well behaving drivers in iommu systems. It's better to fix the broken drivers I think.

--Mika



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

* Re: [SCSI] Set max_phys_segments to sg_tablesize
  2003-10-15 12:14 mika.penttila
@ 2003-10-15 12:31 ` Herbert Xu
  0 siblings, 0 replies; 8+ messages in thread
From: Herbert Xu @ 2003-10-15 12:31 UTC (permalink / raw)
  To: mika.penttila, Linus Torvalds, Christoph Hellwig, axboe,
	Linux Kernel Mailing List

mika.penttila@kolumbus.fi wrote:
> 
>> Many SCSI host drivers assume that use_sg will be <= sg_tablesize.
>> Hence they may break under 2.6 as the number of physical segments
>> is not limited by sg_tablesize.  This patch fixes that.
> 
> Physical segments don't matter,  hw segments does and it's bounded by sg_tablesize.

It does matter if the driver can't cope with it.
-- 
Debian GNU/Linux 3.0 is out! ( http://www.debian.org/ )
Email:  Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

* Re: [SCSI] Set max_phys_segments to sg_tablesize
@ 2003-10-15 12:14 mika.penttila
  2003-10-15 12:31 ` Herbert Xu
  0 siblings, 1 reply; 8+ messages in thread
From: mika.penttila @ 2003-10-15 12:14 UTC (permalink / raw)
  To: Herbert Xu, Linus Torvalds, Christoph Hellwig, axboe,
	Linux Kernel Mailing List

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

> Many SCSI host drivers assume that use_sg will be <= sg_tablesize.
> Hence they may break under 2.6 as the number of physical segments
> is not limited by sg_tablesize.  This patch fixes that.
> 

Physical segments don't matter,  hw segments does and it's bounded by sg_tablesize.

--Mika


[-- Attachment #2: p --]
[-- Type: text/plain, Size: 814 bytes --]

Index: kernel-source-2.5/drivers/scsi/scsi_lib.c
===================================================================
RCS file: /home/gondolin/herbert/src/CVS/debian/kernel-source-2.5/drivers/scsi/scsi_lib.c,v
retrieving revision 1.1.1.16
diff -u -r1.1.1.16 scsi_lib.c
--- kernel-source-2.5/drivers/scsi/scsi_lib.c	28 Sep 2003 04:44:15 -0000	1.1.1.16
+++ kernel-source-2.5/drivers/scsi/scsi_lib.c	15 Oct 2003 11:32:20 -0000
@@ -1243,7 +1243,7 @@
 	blk_queue_prep_rq(q, scsi_prep_fn);
 
 	blk_queue_max_hw_segments(q, shost->sg_tablesize);
-	blk_queue_max_phys_segments(q, MAX_PHYS_SEGMENTS);
+	blk_queue_max_phys_segments(q, shost->sg_tablesize);
 	blk_queue_max_sectors(q, shost->max_sectors);
 	blk_queue_bounce_limit(q, scsi_calculate_bounce_limit(shost));
 	blk_queue_segment_boundary(q, shost->dma_boundary);


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

end of thread, other threads:[~2003-10-16  6:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-15 11:57 [SCSI] Set max_phys_segments to sg_tablesize Herbert Xu
2003-10-15 12:02 ` Jens Axboe
2003-10-15 12:06   ` Herbert Xu
2003-10-15 12:14 mika.penttila
2003-10-15 12:31 ` Herbert Xu
2003-10-15 12:37 mika.penttila
2003-10-16  4:51 ` David S. Miller
2003-10-16  6:57   ` Jens Axboe

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.