[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <1285140566.1849.27.camel@haakon2.linux-iscsi.org>
Date: Wed, 22 Sep 2010 00:29:26 -0700
From: "Nicholas A. Bellinger" <nab@...ux-iscsi.org>
To: Fubo Chen <fubo.chen@...il.com>
Cc: linux-scsi <linux-scsi@...r.kernel.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>,
Mike Christie <michaelc@...wisc.edu>,
Christoph Hellwig <hch@....de>, Hannes Reinecke <hare@...e.de>,
James Bottomley <James.Bottomley@...e.de>,
Jens Axboe <axboe@...nel.dk>,
Boaz Harrosh <bharrosh@...asas.com>
Subject: Re: [RFC 15/22] tcm: Add FILEIO subsystem plugin
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@...ux-iscsi.org> wrote:
> > From: Nicholas Bellinger <nab@...ux-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@...ux-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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists