From: Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com>
To: Christoph Hellwig <hch@lst.de>
Cc: "kbusch@kernel.org" <kbusch@kernel.org>,
"sagi@grimberg.me" <sagi@grimberg.me>,
"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>
Subject: Re: [PATCH V2 1/2] nvme-core: replace ctrl page size with a macro
Date: Tue, 14 Jul 2020 00:02:07 +0000 [thread overview]
Message-ID: <BYAPR04MB49658A5EAA53980A2A26C8FF86610@BYAPR04MB4965.namprd04.prod.outlook.com> (raw)
In-Reply-To: 20200713074210.GB14676@lst.de
On 7/13/20 00:42, Christoph Hellwig wrote:
> On Thu, Jul 09, 2020 at 04:40:24PM -0700, Chaitanya Kulkarni wrote:
>> +/*
>> + * Default to a 4K page size, with the intention to update this
>> + * path in the future to accommodate architectures with differing
>> + * kernel and IO page sizes.
>> + */
>> +#define NVME_CTRL_PAGE_SHIFT 12
>> +#define NVME_CTRL_PAGE_SIZE 4096
> NVME_CTRL_PAGE_SIZE can be defined as
>
> (1 << NVME_CTRL_PAGE_SHIFT) instead of duplicating the value.
This adds a calculation every time we use the macro and makes us rely on
compiler to substitute the value, I guess we are okay with this, will
send V3.
>
>> index 45e94f016ec2..68f7c090cf51 100644
>> --- a/drivers/nvme/host/pci.c
>> +++ b/drivers/nvme/host/pci.c
>> @@ -348,8 +348,8 @@ static bool nvme_dbbuf_update_and_check_event(u16 value, u32 *dbbuf_db,
>> */
>> static int nvme_npages(unsigned size, struct nvme_dev *dev)
>> {
>> - unsigned nprps = DIV_ROUND_UP(size + dev->ctrl.page_size,
>> - dev->ctrl.page_size);
>> + unsigned nprps = DIV_ROUND_UP(size + NVME_CTRL_PAGE_SIZE,
>> + NVME_CTRL_PAGE_SIZE);
>> return DIV_ROUND_UP(8 * nprps, PAGE_SIZE - 8);
> This looks like the existing code here is wrong, as DIV_ROUND_UP already
> adds the page size itself. But that is better left for another patch..
>
This nprp calculation should be ?
DIV_ROUND_UP(size, dev->ctrl.page_size);
Should I add a 3rd patch to get it done since we are touching this code
in this series ?
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
next prev parent reply other threads:[~2020-07-14 0:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-09 23:40 [PATCH V2 0/2] nvme: fix iod size calculation in nvme_probe() Chaitanya Kulkarni
2020-07-09 23:40 ` [PATCH V2 1/2] nvme-core: replace ctrl page size with a macro Chaitanya Kulkarni
2020-07-10 14:57 ` Keith Busch
2020-07-11 18:20 ` Chaitanya Kulkarni
2020-07-13 7:42 ` Christoph Hellwig
2020-07-14 0:02 ` Chaitanya Kulkarni [this message]
2020-07-14 16:44 ` Keith Busch
2020-07-09 23:40 ` [PATCH V2 2/2] nvme-pci: use max of PRP or SGL for iod size Chaitanya Kulkarni
2020-07-13 7:42 ` Christoph Hellwig
2020-07-13 23:59 ` Chaitanya Kulkarni
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=BYAPR04MB49658A5EAA53980A2A26C8FF86610@BYAPR04MB4965.namprd04.prod.outlook.com \
--to=chaitanya.kulkarni@wdc.com \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-nvme@lists.infradead.org \
--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).