From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761797AbdDSJib (ORCPT ); Wed, 19 Apr 2017 05:38:31 -0400 Received: from mx2.suse.de ([195.135.220.15]:48784 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1761779AbdDSJi3 (ORCPT ); Wed, 19 Apr 2017 05:38:29 -0400 Date: Wed, 19 Apr 2017 11:38:26 +0200 From: Johannes Thumshirn To: Max Gurtovoy Cc: Logan Gunthorpe , linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, Christoph Hellwig , Sagi Grimberg Subject: Re: [PATCH] nvmet: convert from kmap to nvmet_copy_from_sgl Message-ID: <20170419093826.GB10632@linux-x5ow.site> References: <1492558335-2845-1-git-send-email-logang@deltatee.com> <3cf1fbf9-8b1d-4acb-e680-87efa5ca7c6d@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <3cf1fbf9-8b1d-4acb-e680-87efa5ca7c6d@mellanox.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > >Cc: Christoph Hellwig > >Cc: Sagi Grimberg > >--- > > 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