public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
From: Nilay Shroff <nilay@linux.ibm.com>
To: Keith Busch <kbusch@kernel.org>, Christoph Hellwig <hch@lst.de>
Cc: linux-nvme@lists.infradead.org, linux-block@vger.kernel.org,
	sagi@grimberg.me, axboe@fb.com, chaitanyak@nvidia.com,
	yi.zhang@redhat.com, shinichiro.kawasaki@wdc.com,
	mlombard@redhat.com, gjoyce@linux.ibm.com
Subject: Re: [PATCH] nvmet: fix the use of ZERO_PAGE in nvme_execute_identify_ns_nvm()
Date: Sun, 24 Nov 2024 18:13:17 +0530	[thread overview]
Message-ID: <54d2875b-0658-46a6-9bc0-4fb5faf5d816@linux.ibm.com> (raw)
In-Reply-To: <Z0CqnBhIpmf2snuY@kbusch-mbp.dhcp.thefacebook.com>



On 11/22/24 21:30, Keith Busch wrote:
> On Fri, Nov 22, 2024 at 01:08:28PM +0100, Christoph Hellwig wrote:
>> On Fri, Nov 22, 2024 at 02:20:36PM +0530, Nilay Shroff wrote:
>>> The nvme_execute_identify_ns_nvm function uses ZERO_PAGE
>>> for copying SG list with all zeros. As ZERO_PAGE would not
>>> necessarily return the virtual-address of the zero page, we
>>> need to first convert the page address to kernel virtual-
>>> address and then use it as source address for copying the
>>> data to SG list with all zeros.
>>>
>>> Using return address of ZERO_PAGE(0) as source address for
>>> copying data to SG list would fill the target buffer with
>>> random value and causes the undesired side effect. This patch
>>> implements the fix ensuring that we use virtual-address of the
>>> zero page for copying all zeros to the SG list buffers.
>>
>> I wonder if using ZERO_PAGE() is simply a little too smart for it's
>> own sake and it should just use kzalloc like a bunch of other identify
>> implementation..
> 
> Sure. That'll make it easier to report non-zero values if we decide to
> implement a non-stubbed version of this identification later.

Ok, so if we prefer using kzalloc instead of ZERO_PAGE() in 
nvme_execute_identify_ns_nvm function, as we're using kzalloc 
at other identify call sites, then I would update the patch 
and send v2 where we would replace ZERO_PAGE() with kzalloc. 

Thanks,
--Nilay


      reply	other threads:[~2024-11-24 12:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-22  8:50 [PATCH] nvmet: fix the use of ZERO_PAGE in nvme_execute_identify_ns_nvm() Nilay Shroff
2024-11-22  8:57 ` Nilay Shroff
2024-11-22  9:29 ` Maurizio Lombardi
2024-11-22 12:08 ` Christoph Hellwig
2024-11-22 16:00   ` Keith Busch
2024-11-24 12:43     ` Nilay Shroff [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=54d2875b-0658-46a6-9bc0-4fb5faf5d816@linux.ibm.com \
    --to=nilay@linux.ibm.com \
    --cc=axboe@fb.com \
    --cc=chaitanyak@nvidia.com \
    --cc=gjoyce@linux.ibm.com \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=mlombard@redhat.com \
    --cc=sagi@grimberg.me \
    --cc=shinichiro.kawasaki@wdc.com \
    --cc=yi.zhang@redhat.com \
    /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