Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1625973

Re: [PATCH] nvmet: convert from kmap to nvmet_copy_from_sgl

From Johannes Thumshirn <jthumshirn@suse.de>
Newsgroups linux.kernel
Subject Re: [PATCH] nvmet: convert from kmap to nvmet_copy_from_sgl
Date 2017-04-19 11:40 +0200
Message-ID <txUfD-1Kf-3@gated-at.bofh.it> (permalink)
References <txKSZ-3YV-7@gated-at.bofh.it> <txUfD-1Kf-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Apr 19, 2017 at 12:33:09PM +0300, Max Gurtovoy wrote:
> Hi Logan,
> 
> On 4/19/2017 2:32 AM, Logan Gunthorpe wrote:
> >This is safer as it doesn't rely on the data being stored in
> >a single page in an sgl.
> >
> >It also aids our effort to start phasing out users of sg_page. See [1].
> >
> >For this we kmalloc some memory, copy to it and free at the end. Note:
> >we can't allocate this memory on the stack as the kbuild test robot
> >reports some frame size overflows on i386.
> >
> >[1] https://lwn.net/Articles/720053/
> >
> >Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
> >Cc: Christoph Hellwig <hch@lst.de>
> >Cc: Sagi Grimberg <sagi@grimberg.me>
> >---
> > drivers/nvme/target/fabrics-cmd.c | 32 +++++++++++++++++++++++++-------
> > 1 file changed, 25 insertions(+), 7 deletions(-)
> >
> >diff --git a/drivers/nvme/target/fabrics-cmd.c b/drivers/nvme/target/fabrics-cmd.c
> >index 8bd022af..2e0ab10 100644
> >--- a/drivers/nvme/target/fabrics-cmd.c
> >+++ b/drivers/nvme/target/fabrics-cmd.c
> >@@ -122,7 +122,15 @@ static void nvmet_execute_admin_connect(struct nvmet_req *req)
> > 	struct nvmet_ctrl *ctrl = NULL;
> > 	u16 status = 0;
> >
> >-	d = kmap(sg_page(req->sg)) + req->sg->offset;
> >+	d = kmalloc(sizeof(*d), GFP_KERNEL);
> 
> I'd prefer removing the dynamic allocation and use d on the stack to
> simplify the code.
> Any thoughts ?

Hi Max, 

Pasting from above:

> >we can't allocate this memory on the stack as the kbuild test robot
> >reports some frame size overflows on i386.


-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] nvmet: convert from kmap to nvmet_copy_from_sgl Logan Gunthorpe <logang@deltatee.com> - 2017-04-19 01:40 +0200
  Re: [PATCH] nvmet: convert from kmap to nvmet_copy_from_sgl Johannes Thumshirn <jthumshirn@suse.de> - 2017-04-19 11:40 +0200
    Re: [PATCH] nvmet: convert from kmap to nvmet_copy_from_sgl Logan Gunthorpe <logang@deltatee.com> - 2017-04-19 17:50 +0200
  Re: [PATCH] nvmet: convert from kmap to nvmet_copy_from_sgl Christoph Hellwig <hch@lst.de> - 2017-04-19 21:40 +0200
  Re: [PATCH] nvmet: convert from kmap to nvmet_copy_from_sgl Sagi Grimberg <sagi@grimberg.me> - 2017-04-20 13:40 +0200

csiph-web