linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Max Gurtovoy <maxg@mellanox.com>
To: Johannes Thumshirn <jthumshirn@suse.de>
Cc: Logan Gunthorpe <logang@deltatee.com>,
	<linux-nvme@lists.infradead.org>, <linux-kernel@vger.kernel.org>,
	Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>
Subject: Re: [PATCH] nvmet: convert from kmap to nvmet_copy_from_sgl
Date: Wed, 19 Apr 2017 12:44:50 +0300	[thread overview]
Message-ID: <6dfa2fbf-78e6-2c7b-f6e3-c765fe5015c2@mellanox.com> (raw)
In-Reply-To: <20170419093826.GB10632@linux-x5ow.site>



On 4/19/2017 12:38 PM, Johannes Thumshirn wrote:
> 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.

Thanks Johannes, I missed that comment.

Looks good,

Reviewed-by: Max Gurtovoy <maxg@mellanox.com>

>
>

  reply	other threads:[~2017-04-19  9:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-18 23:32 [PATCH] nvmet: convert from kmap to nvmet_copy_from_sgl Logan Gunthorpe
2017-04-19  9:33 ` Max Gurtovoy
2017-04-19  9:38   ` Johannes Thumshirn
2017-04-19  9:44     ` Max Gurtovoy [this message]
2017-04-19 15:40       ` Logan Gunthorpe
2017-04-19 19:32 ` Christoph Hellwig
2017-04-20 11:31 ` Sagi Grimberg

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=6dfa2fbf-78e6-2c7b-f6e3-c765fe5015c2@mellanox.com \
    --to=maxg@mellanox.com \
    --cc=hch@lst.de \
    --cc=jthumshirn@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=logang@deltatee.com \
    --cc=sagi@grimberg.me \
    /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;
as well as URLs for NNTP newsgroup(s).