* [PATCH] kernel BUG at scsi_merge.c:83
@ 2002-01-02 1:38 Peter Osterlund
2002-01-02 7:32 ` Jens Axboe
0 siblings, 1 reply; 5+ messages in thread
From: Peter Osterlund @ 2002-01-02 1:38 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-kernel
Hi!
While doing some stress testing on the 2.5.2-pre5 kernel, I am hitting
a kernel BUG at scsi_merge.c:83, followed by a kernel panic. The
problem is that scsi_alloc_sgtable fails because the request contains
too many physical segments. I think this patch is the correct fix:
--- linux-2.5.2-pre5/drivers/scsi/scsi.c Fri Dec 28 12:38:01 2001
+++ linux-2.5-packet/drivers/scsi/scsi.c Wed Jan 2 02:27:45 2002
@@ -201,11 +201,6 @@
/* Hardware imposed limit. */
blk_queue_max_hw_segments(q, SHpnt->sg_tablesize);
- /*
- * When we remove scsi_malloc soonish, this can die too
- */
- blk_queue_max_phys_segments(q, PAGE_SIZE / sizeof(struct scatterlist));
-
blk_queue_max_sectors(q, SHpnt->max_sectors);
if (!SHpnt->use_clustering)
--
Peter Osterlund - petero2@telia.com
http://w1.894.telia.com/~u89404340
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] kernel BUG at scsi_merge.c:83
2002-01-02 1:38 Peter Osterlund
@ 2002-01-02 7:32 ` Jens Axboe
2002-01-02 11:23 ` Peter Osterlund
0 siblings, 1 reply; 5+ messages in thread
From: Jens Axboe @ 2002-01-02 7:32 UTC (permalink / raw)
To: Peter Osterlund; +Cc: linux-kernel
On Wed, Jan 02 2002, Peter Osterlund wrote:
> Hi!
>
> While doing some stress testing on the 2.5.2-pre5 kernel, I am hitting
> a kernel BUG at scsi_merge.c:83, followed by a kernel panic. The
> problem is that scsi_alloc_sgtable fails because the request contains
> too many physical segments. I think this patch is the correct fix:
Correct, ll_rw_blk default is ok now. I missed this when killing
scsi_malloc/scsi_dma, thanks.
--
Jens Axboe
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] kernel BUG at scsi_merge.c:83
2002-01-02 7:32 ` Jens Axboe
@ 2002-01-02 11:23 ` Peter Osterlund
0 siblings, 0 replies; 5+ messages in thread
From: Peter Osterlund @ 2002-01-02 11:23 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-kernel
Jens Axboe <axboe@suse.de> writes:
> On Wed, Jan 02 2002, Peter Osterlund wrote:
> > Hi!
> >
> > While doing some stress testing on the 2.5.2-pre5 kernel, I am hitting
> > a kernel BUG at scsi_merge.c:83, followed by a kernel panic. The
> > problem is that scsi_alloc_sgtable fails because the request contains
> > too many physical segments. I think this patch is the correct fix:
>
> Correct, ll_rw_blk default is ok now. I missed this when killing
> scsi_malloc/scsi_dma, thanks.
It turns out this is still not enough to fix the problem for me,
because ll_new_hw_segment is still allowing nr_phys_segments to become
too large. Is the following patch the correct way to deal with this
problem, or is that case supposed to be prevented by some other means?
At least, this patch prevents the kernel panic during my stress test.
--- linux-2.5.2-pre5/drivers/block/ll_rw_blk.c Mon Dec 31 14:56:37 2001
+++ linux-2.5-packet/drivers/block/ll_rw_blk.c Wed Jan 2 11:44:21 2002
@@ -530,6 +530,7 @@
struct bio *bio)
{
int nr_hw_segs = bio_hw_segments(q, bio);
+ int nr_phys_segs;
if (req->nr_hw_segments + nr_hw_segs > q->max_hw_segments) {
req->flags |= REQ_NOMERGE;
@@ -537,12 +538,19 @@
return 0;
}
+ nr_phys_segs = bio_phys_segments(q, bio);
+ if (req->nr_phys_segments + nr_phys_segs > q->max_phys_segments) {
+ req->flags |= REQ_NOMERGE;
+ q->last_merge = NULL;
+ return 0;
+ }
+
/*
* This will form the start of a new hw segment. Bump both
* counters.
*/
req->nr_hw_segments += nr_hw_segs;
- req->nr_phys_segments += bio_phys_segments(q, bio);
+ req->nr_phys_segments += nr_phys_segs;
return 1;
}
--
Peter Osterlund - petero2@telia.com
http://w1.894.telia.com/~u89404340
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] kernel BUG at scsi_merge.c:83
@ 2002-01-03 4:28 Douglas Gilbert
2002-01-03 8:18 ` Jens Axboe
0 siblings, 1 reply; 5+ messages in thread
From: Douglas Gilbert @ 2002-01-03 4:28 UTC (permalink / raw)
To: Peter Osterlund; +Cc: linux-kernel, Jens Axboe
Peter Osterlund <petero2@telia.com> wrote:
> Jens Axboe <axboe@suse.de> writes:
>
> > On Wed, Jan 02 2002, Peter Osterlund wrote:
> > > Hi!
> > >
> > > While doing some stress testing on the 2.5.2-pre5 kernel, I am hitting
> > > a kernel BUG at scsi_merge.c:83, followed by a kernel panic. The
> > > problem is that scsi_alloc_sgtable fails because the request contains
> > > too many physical segments. I think this patch is the correct fix:
> >
> > Correct, ll_rw_blk default is ok now. I missed this when killing
> > scsi_malloc/scsi_dma, thanks.
>
> It turns out this is still not enough to fix the problem for me,
> because ll_new_hw_segment is still allowing nr_phys_segments to become
> too large. Is the following patch the correct way to deal with this
> problem, or is that case supposed to be prevented by some other means?
> At least, this patch prevents the kernel panic during my stress test.
<snipped patches/>
Peter,
I was able to get a repeatable oops at that line copying
files from /boot onto a "fake" scsi_debug disk with "pre5".
The first largish file it attempted to copy caused the
oops (which I sent to Jens).
Anyway, I just applied your 2 patches (to scsi.c and ll_rw_blk.c)
and the oops is no more.
Good work.
Doug Gilbert
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] kernel BUG at scsi_merge.c:83
2002-01-03 4:28 [PATCH] kernel BUG at scsi_merge.c:83 Douglas Gilbert
@ 2002-01-03 8:18 ` Jens Axboe
0 siblings, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2002-01-03 8:18 UTC (permalink / raw)
To: Douglas Gilbert; +Cc: Peter Osterlund, linux-kernel
On Wed, Jan 02 2002, Douglas Gilbert wrote:
> Peter Osterlund <petero2@telia.com> wrote:
>
> > Jens Axboe <axboe@suse.de> writes:
> >
> > > On Wed, Jan 02 2002, Peter Osterlund wrote:
> > > > Hi!
> > > >
> > > > While doing some stress testing on the 2.5.2-pre5 kernel, I am hitting
> > > > a kernel BUG at scsi_merge.c:83, followed by a kernel panic. The
> > > > problem is that scsi_alloc_sgtable fails because the request contains
> > > > too many physical segments. I think this patch is the correct fix:
> > >
> > > Correct, ll_rw_blk default is ok now. I missed this when killing
> > > scsi_malloc/scsi_dma, thanks.
> >
> > It turns out this is still not enough to fix the problem for me,
> > because ll_new_hw_segment is still allowing nr_phys_segments to become
> > too large. Is the following patch the correct way to deal with this
> > problem, or is that case supposed to be prevented by some other means?
> > At least, this patch prevents the kernel panic during my stress test.
>
> <snipped patches/>
>
> Peter,
> I was able to get a repeatable oops at that line copying
> files from /boot onto a "fake" scsi_debug disk with "pre5".
> The first largish file it attempted to copy caused the
> oops (which I sent to Jens).
>
> Anyway, I just applied your 2 patches (to scsi.c and ll_rw_blk.c)
> and the oops is no more.
I've included a slightly modified version, your logic was correct though
Peter. Thanks.
--
Jens Axboe
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2002-01-03 8:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-01-03 4:28 [PATCH] kernel BUG at scsi_merge.c:83 Douglas Gilbert
2002-01-03 8:18 ` Jens Axboe
-- strict thread matches above, loose matches on Subject: below --
2002-01-02 1:38 Peter Osterlund
2002-01-02 7:32 ` Jens Axboe
2002-01-02 11:23 ` Peter Osterlund
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox