LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com>
To: "minwoo.im@samsung.com" <minwoo.im@samsung.com>,
	"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: Keith Busch <keith.busch@intel.com>,
	Sagi Grimberg <sagi@grimberg.me>,
	Kenneth Heitke <kenneth.heitke@intel.com>,
	Akinobu Mita <akinobu.mita@gmail.com>, Jens Axboe <axboe@fb.com>,
	Minwoo Im <minwoo.im.dev@gmail.com>,
	Johannes Berg <johannes@sipsolutions.net>,
	Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH v3 5/7] nvme-pci: add device coredump infrastructure
Date: Mon, 13 May 2019 15:23:32 +0000	[thread overview]
Message-ID: <SN6PR04MB4527DFC75838C3236F5D05B2860F0@SN6PR04MB4527.namprd04.prod.outlook.com> (raw)
In-Reply-To: 20190513074601epcms2p12c0a32730a16be3b69b68e3c9d4d0b92@epcms2p1

On 05/13/2019 12:46 AM, Minwoo Im wrote:
>> +static int nvme_get_telemetry_log_blocks(struct nvme_ctrl *ctrl, void *buf,
>> +					 size_t bytes, loff_t offset)
>> +{
>> +	loff_t pos = 0;
>> +	u32 chunk_size;
>> +
>> +	if (check_mul_overflow(ctrl->max_hw_sectors, 512u, &chunk_size))
>> +		chunk_size = UINT_MAX;
>> +
>> +	while (pos < bytes) {
>> +		size_t size = min_t(size_t, bytes - pos, chunk_size);
>> +		int ret;
>> +
>> +		ret = nvme_get_log(ctrl, NVME_NSID_ALL,
>> NVME_LOG_TELEMETRY_CTRL,
>> +				   0, buf + pos, size, offset + pos);
>> +		if (ret)
>> +			return ret;
>> +
>> +		pos += size;
>> +	}
>> +
>> +	return 0;
>> +}
>> +
>> +static int nvme_get_telemetry_log(struct nvme_ctrl *ctrl,
>> +				  struct sg_table *table, size_t bytes)
>> +{
>> +	int n = sg_nents(table->sgl);
>> +	struct scatterlist *sg;
>> +	size_t offset = 0;
>> +	int i;
>> +
A little comment would be nice if you are using sg operations.
>> +	for_each_sg(table->sgl, sg, n, i) {
>> +		struct page *page = sg_page(sg);
>> +		size_t size = min_t(int, bytes - offset, sg->length);
>> +		int ret;
>> +
>> +		ret = nvme_get_telemetry_log_blocks(ctrl,
>> page_address(page),
>> +						    size, offset);
>> +		if (ret)
>> +			return ret;
>> +
>> +		offset += size;
>> +	}
>> +
>> +	return 0;
>> +}
>
> Can we have those two in nvme-core module instead of being in pci module?

Since they are based on the controller they should be moved next to 
nvme_get_log() in the ${KERN_DIR}/drivers/nvme/host/core.c.

>
> _______________________________________________
> Linux-nvme mailing list
> Linux-nvme@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-nvme
>


  reply	other threads:[~2019-05-13 15:23 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-12 15:54 [PATCH v3 0/7] nvme-pci: support device coredump Akinobu Mita
2019-05-12 15:54 ` [PATCH v3 1/7] devcoredump: use memory_read_from_buffer Akinobu Mita
2019-05-13 15:28   ` Chaitanya Kulkarni
2019-05-12 15:54 ` [PATCH v3 2/7] devcoredump: fix typo in comment Akinobu Mita
2019-05-13 15:24   ` Chaitanya Kulkarni
2019-05-12 15:54 ` [PATCH v3 3/7] devcoredump: allow to create several coredump files in one device Akinobu Mita
2019-05-12 15:54 ` [PATCH v3 4/7] nvme: add basic facility to get telemetry log page Akinobu Mita
2019-05-13 15:34   ` Chaitanya Kulkarni
2019-05-14 14:04     ` Akinobu Mita
2019-05-12 15:54 ` [PATCH v3 5/7] nvme-pci: add device coredump infrastructure Akinobu Mita
2019-05-13 13:50   ` Keith Busch
2019-05-13 15:01     ` Akinobu Mita
2019-05-13 14:02   ` Christoph Hellwig
2019-05-13 15:01     ` Akinobu Mita
2019-05-12 15:54 ` [PATCH v3 6/7] nvme-pci: trigger device coredump on command timeout Akinobu Mita
2019-05-13 13:52   ` Keith Busch
2019-05-12 15:54 ` [PATCH v3 7/7] nvme-pci: enable to trigger device coredump by hand Akinobu Mita
     [not found] ` <CGME20190512155533epcas4p110edff15ebf5b2efae32e43f0f10ab59@epcms2p5>
2019-05-13  7:41   ` [PATCH v3 6/7] nvme-pci: trigger device coredump on command timeout Minwoo Im
2019-05-13 14:59     ` Akinobu Mita
     [not found] ` <CGME20190512155540epcas4p14c15eb86b08dcd281e9a93a4fc190800@epcms2p1>
2019-05-13  7:46   ` [PATCH v3 5/7] nvme-pci: add device coredump infrastructure Minwoo Im
2019-05-13 15:23     ` Chaitanya Kulkarni [this message]
2019-05-14 14:06       ` Akinobu Mita

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=SN6PR04MB4527DFC75838C3236F5D05B2860F0@SN6PR04MB4527.namprd04.prod.outlook.com \
    --to=chaitanya.kulkarni@wdc.com \
    --cc=akinobu.mita@gmail.com \
    --cc=axboe@fb.com \
    --cc=hch@lst.de \
    --cc=johannes@sipsolutions.net \
    --cc=keith.busch@intel.com \
    --cc=kenneth.heitke@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=minwoo.im.dev@gmail.com \
    --cc=minwoo.im@samsung.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).