From: Benny Halevy <bhalevy@panasas.com>
To: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: bharrosh@panasas.com, jens.axboe@oracle.com,
James.Bottomley@SteelEye.com, linux-scsi@vger.kernel.org,
hch@infradead.org, akpm@linux-foundation.org,
michaelc@cs.wisc.edu
Subject: Re: [PATCH v2] add bidi support for block pc requests
Date: Thu, 17 May 2007 20:37:31 +0300 [thread overview]
Message-ID: <464C92DB.4050509@panasas.com> (raw)
In-Reply-To: <20070517201243E.fujita.tomonori@lab.ntt.co.jp>
FUJITA Tomonori wrote:
> From: Boaz Harrosh <bharrosh@panasas.com>
> Subject: Re: [PATCH v2] add bidi support for block pc requests
> Date: Thu, 17 May 2007 11:49:37 +0300
>
>> FUJITA Tomonori wrote:
>>> From: Jens Axboe <jens.axboe@oracle.com>
>>> Subject: Re: [PATCH v2] add bidi support for block pc requests
>>> Date: Thu, 17 May 2007 07:48:13 +0200
>>>
>>>> On Thu, May 17 2007, FUJITA Tomonori wrote:
>>>>> From: Jens Axboe <jens.axboe@oracle.com>
>>>>> Subject: Re: [PATCH v2] add bidi support for block pc requests
>>>>> Date: Wed, 16 May 2007 19:53:22 +0200
>>>>>
>>>>>> On Wed, May 16 2007, Boaz Harrosh wrote:
>>>>>>> now there are 2 issues with this:
>>>>>>> 1. Even if I do blk_queue_max_phys_segments(q, 127); I still get
>>>>>>> requests for use_sg=128 which will crash the kernel.
>>>>>> That sounds like a serious issue, it should definitely not happen. Stuff
>>>>>> like that would bite other drivers as well, are you absolutely sure that
>>>>>> is happening? Power-of-2 bug in your code, or in the SCSI code?
>>>>> Boaz, how do you send requests to the scsi-ml, via fs, sg, or bsg?
>> These are regular fs (ext3) requests during bootup. The machine will not
>> boot. (Usually from the read ahead code)
>> Don't believe me look at the second patch Over Tomo's cleanup.
>> If I define SCSI_MAX_SG_SEGMENTS to 127 it will crash even when I
>> did in code:
>> blk_queue_max_phys_segments(q, SCSI_MAX_SG_SEGMENTS);
>> I suppose someone is looking at a different definition. Or there is
>> another call I need to do for this to work.
>
> I modified your patch a bit (sgtable allocation) and set
> SCSI_MAX_SG_SEGMENTS to 127. My ppc64 box seems to work (with
> iscsi_tcp and ipr drivers).
>
> iscsi_tcp sets sg_tablesize to 255, but blk_queue_max_phys_segments
> seems to work.
>
> One thing that I found is:
>
> +#define scsi_resid(cmd) ((cmd)->sg_table->resid)
>
>
> This doesn't work for some drivers (at least ipr) since they set
> cmd->resid even with commands without data transfer.
Hmm, since we need a residual count also for the bidi_in transfer
this problem is another reason for having the scsi_cmd_buff in struct
scsi_cmnd, allocate another one from a pool for the bidi case,
and point to the sglist in both cases rather than having a sg_table
header allocated along with the sg list.
Alternatively, having a pool for the no-data case might be another
possible solution, though it seems a bit odd to me.
<snip>
> -void scsi_free_sgtable(struct scatterlist *sgl, int index)
> +static struct scsi_sg_table *scsi_alloc_sgtable(int nseg, gfp_t gfp_mask)
> {
> struct scsi_host_sg_pool *sgp;
> + struct scsi_sg_table *sgt;
> + unsigned int idx;
>
> - BUG_ON(index >= SG_MEMPOOL_NR);
> + for (idx = 0; idx < SG_MEMPOOL_NR; idx++)
> + if (scsi_sg_pools[idx].size >= nseg)
> + goto found;
Tomo, I prefer the loop to be based on calculation as follows rather
than scanning the scsi_sg_pools table in order to minimize memory access
(and thrashing of the cpu data cache - each scsi_host_sg_pool takes a cache
row on x86_64)
+ for (i = 0, size = 8; i < SG_MEMPOOL_NR-1; i++, size <<= 1)
+ if (size > nents)
+ return i;
Benny
next prev parent reply other threads:[~2007-05-17 17:43 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-08 2:25 [PATCH v2] add bidi support for block pc requests FUJITA Tomonori
2007-05-08 18:53 ` Boaz Harrosh
2007-05-08 20:01 ` James Bottomley
2007-05-09 7:46 ` Boaz Harrosh
2007-05-09 10:52 ` FUJITA Tomonori
2007-05-09 13:58 ` Boaz Harrosh
2007-05-09 14:54 ` FUJITA Tomonori
2007-05-09 14:55 ` James Bottomley
2007-05-09 16:54 ` Boaz Harrosh
2007-05-10 6:53 ` FUJITA Tomonori
2007-05-10 7:45 ` FUJITA Tomonori
2007-05-10 12:37 ` Boaz Harrosh
2007-05-10 13:01 ` FUJITA Tomonori
2007-05-10 15:10 ` Douglas Gilbert
2007-05-10 15:48 ` Boaz Harrosh
2007-05-11 16:26 ` James Bottomley
2007-05-16 17:29 ` Boaz Harrosh
2007-05-16 17:53 ` Jens Axboe
2007-05-16 18:06 ` James Bottomley
2007-05-16 18:13 ` Jens Axboe
2007-05-17 8:46 ` Boaz Harrosh
2007-05-17 2:57 ` FUJITA Tomonori
2007-05-17 5:48 ` Jens Axboe
2007-05-17 5:59 ` FUJITA Tomonori
2007-05-17 8:49 ` Boaz Harrosh
2007-05-17 11:12 ` FUJITA Tomonori
2007-05-17 17:37 ` Benny Halevy [this message]
2007-05-24 16:37 ` Boaz Harrosh
2007-05-24 16:46 ` Boaz Harrosh
2007-05-24 16:47 ` FUJITA Tomonori
2007-05-24 16:59 ` Boaz Harrosh
2007-05-17 11:29 ` FUJITA Tomonori
2007-05-17 13:27 ` James Bottomley
2007-05-17 14:00 ` Boaz Harrosh
2007-05-17 14:11 ` FUJITA Tomonori
2007-05-17 15:49 ` Boaz Harrosh
2007-06-01 20:21 ` Jeff Garzik
2007-06-03 7:45 ` Boaz Harrosh
2007-06-03 13:17 ` James Bottomley
2007-07-07 15:27 ` Jeff Garzik
2007-07-07 15:42 ` James Bottomley
2007-07-07 16:59 ` Jeff Garzik
2007-05-09 10:49 ` FUJITA Tomonori
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=464C92DB.4050509@panasas.com \
--to=bhalevy@panasas.com \
--cc=James.Bottomley@SteelEye.com \
--cc=akpm@linux-foundation.org \
--cc=bharrosh@panasas.com \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=hch@infradead.org \
--cc=jens.axboe@oracle.com \
--cc=linux-scsi@vger.kernel.org \
--cc=michaelc@cs.wisc.edu \
/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.