From: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
To: Fubo Chen <fubo.chen@gmail.com>
Cc: linux-scsi <linux-scsi@vger.kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
Mike Christie <michaelc@cs.wisc.edu>,
Christoph Hellwig <hch@lst.de>, Hannes Reinecke <hare@suse.de>,
James Bottomley <James.Bottomley@suse.de>,
Jens Axboe <axboe@kernel.dk>, Boaz Harrosh <bharrosh@panasas.com>
Subject: Re: [RFC 15/22] tcm: Add FILEIO subsystem plugin
Date: Wed, 22 Sep 2010 00:29:26 -0700 [thread overview]
Message-ID: <1285140566.1849.27.camel@haakon2.linux-iscsi.org> (raw)
In-Reply-To: <AANLkTimPh+SNroYoavomwVtQ5UHsr7Lsq_229Vkbc1CB@mail.gmail.com>
On Mon, 2010-09-20 at 18:18 +0200, Fubo Chen wrote:
> On Mon, Aug 30, 2010 at 11:22 AM, Nicholas A. Bellinger
> <nab@linux-iscsi.org> wrote:
> > From: Nicholas Bellinger <nab@linux-iscsi.org>
> >
> > This patch adds the O_SYNC FILEIO subsystem plugin for accessing struct file
> > using Linux/VFS struct file_operations. It also includes WriteCache and FUA
> > Write Emulation support to struct file using fs/sync.c/vfs_fsync_range()
> >
> > Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
> >
> > [ ... ]
> >
> > +static int fd_do_writev(struct fd_request *req, struct se_task *task)
> > +{
> > + struct file *fd = req->fd_dev->fd_file;
> > + struct scatterlist *sg = task->task_sg;
> > + struct iovec iov[req->fd_sg_count];
>
> Kernel stack size is 8 KB. On a 64-bit system struct iovec takes 16
> bytes. What happens if req->fd_sg_count is large ? Kernel crash ?
>
Greetings Fubo,
So wrt to a potential 8K stack over here for the local scope iov[]
arrays in fd_do_writev() and fd_do_read()..
Currently target_core_file.h defines a FD_MAX_SECTORS of 1024, which
means that each struct se_task *task here will be containing at most a
1024 sector request.
In scatterlist terms for a TCM fabric module like LIO-Target that does
1:1 struct scatterlist w/ PAGE_SIZE allocations, this would be:
((1024 * block_size) / PAGE_SIZE) * sizeof(struct iovec);
which for 64-bit uses 2048 bytes of stack for a FD_MAX_SECTORS task.
For a fabric module like TCM_Loop that maps incoming Linux/SCSI
scatterlist memory to internal TCM memory points and down to FILEIO
code, the maximum here is a scatterlist + offset for every block_size
sector for certain cases like mkfs* and friends, which means:
((1024 * block_size) / block_size) * sizeof(struct iovec);
which for 64-bit uses 16384 bytes for a FD_MAX_SECTORS task with a
scatterlist entry per 512-byte logical block.
For at least for the latter case this is a problem with 8K stacks, so it
looks these will need to convert to dynamic allocation within the local
scope. I will push a patch to fix this shortly.
Many thanks for your astute observation!
--nab
prev parent reply other threads:[~2010-09-22 7:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-30 9:22 Nicholas A. Bellinger
2010-09-20 16:18 ` Fubo Chen
2010-09-22 7:29 ` Nicholas A. Bellinger [this message]
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=1285140566.1849.27.camel@haakon2.linux-iscsi.org \
--to=nab@linux-iscsi.org \
--cc=James.Bottomley@suse.de \
--cc=axboe@kernel.dk \
--cc=bharrosh@panasas.com \
--cc=fubo.chen@gmail.com \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®