Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4890271yba; Mon, 13 May 2019 01:19:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqzVSRnTyLGyq4R8ODcwdHM34ztcGALAfGers733d1Xf0OwwEkHUlwk/dtx+8Tv+9+bS4Q5v X-Received: by 2002:a63:7141:: with SMTP id b1mr29229633pgn.331.1557735576062; Mon, 13 May 2019 01:19:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557735576; cv=none; d=google.com; s=arc-20160816; b=AEnxwLbfMlfSQ6wEZS+d1Yu625/zZY3Q7jSJC9hm+jAHeYfQmVSKnnR7y3zIyaJux/ qaXrlubDqLKRHxZncO/Iu3Oqjes4Mu7Ip4epKR+f3rr1stWyVPP/dgKBIxVOpS/FNp+K CxXm0t6lzNtK8RNpPZVGm6/MPUSt4lhfbaUyGDqjavU6NH+AXuGtasAO640wJ3hqiFWH K6idL6li0fikjOztexOWREptqeOKO59pQ0UJ6yKegaCjMdI1qe4uCQ4fOSS1R4cAsSaX /DVE0r+cQO/NDxVCvy723woa9zn6/Xlxr9xQhaRJjCFdbJVv+Pyrbp1V2ydKLOdugbCj jeYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:dlp-filter:cms-type :content-transfer-encoding:date:message-id:in-reply-to:cc:to:from :reply-to:subject:mime-version:dkim-signature:dkim-filter; bh=szTOp4qdFhF5LZJ70Oq3g8WGaUzNNw6KiVLFGlGom3M=; b=fxMTUo42VSQp3ymTzhiE5Ggw8VAh3KVGlNl+leq8d8V9lS68G7IXMERdnc+CbEKvC0 cxRzryNBD2t4SudumorqOQWoPCguBKjQxaui+ZmiH58pMJC9NlhRwmmjCMaMssEH0FWL gLYmaozZwjKzlFmVYERJGYFOGvCfTf3oBSmCOqfxoRJql9sx7T4yPkBCrCPM8ciT6OPr 4xw7GQ/8nGpR+zNuSrqQGCVnnHFyU/czOss2vndILQsIfvQmSnvC8gLgz5LrUMwgc96N KtXS5hYrC/9JPpa1Rya0SRlQCwEWzinNp4YGdJ2HOLrcKPkugUQh0WziA+Tzg2maAm1P JE3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=WW4c84Zu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f5si6929037plt.420.2019.05.13.01.19.20; Mon, 13 May 2019 01:19:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=WW4c84Zu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727919AbfEMHqK (ORCPT + 99 others); Mon, 13 May 2019 03:46:10 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:61270 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727726AbfEMHqK (ORCPT ); Mon, 13 May 2019 03:46:10 -0400 Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20190513074608epoutp01be03308a7b73e44843fbd077d300e071~eLm1LtPyN2755427554epoutp01U for ; Mon, 13 May 2019 07:46:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20190513074608epoutp01be03308a7b73e44843fbd077d300e071~eLm1LtPyN2755427554epoutp01U DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1557733568; bh=szTOp4qdFhF5LZJ70Oq3g8WGaUzNNw6KiVLFGlGom3M=; h=Subject:Reply-To:From:To:CC:In-Reply-To:Date:References:From; b=WW4c84ZuJCYR1m8TXGRWyoh38AQR96nAbw6HAenGw/LRV9d4IIJ/EuyjyUC+IgGaa KOj5yHi8fFHh8//2ylk9nwhvMbnr88iLw/RgfWPnHmZ02AirDiRx3c/MvPkalP56Rr au/lk+DMcqa977FKUVtbcNTXafdFiCXGI8Bto9Dk= Received: from epsmges2p1.samsung.com (unknown [182.195.40.189]) by epcas2p4.samsung.com (KnoxPortal) with ESMTP id 20190513074605epcas2p4594314afd8cddf9bf1dde4c608a5ce7a~eLmyib23C1624816248epcas2p4B; Mon, 13 May 2019 07:46:05 +0000 (GMT) X-AuditID: b6c32a45-d5fff70000001063-8f-5cd920ba3383 Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 75.D6.04195.AB029DC5; Mon, 13 May 2019 16:46:02 +0900 (KST) Mime-Version: 1.0 Subject: Re: [PATCH v3 5/7] nvme-pci: add device coredump infrastructure Reply-To: minwoo.im@samsung.com From: Minwoo Im To: "linux-nvme@lists.infradead.org" , "linux-kernel@vger.kernel.org" , Minwoo Im CC: Jens Axboe , Sagi Grimberg , Kenneth Heitke , Akinobu Mita , Keith Busch , Minwoo Im , Johannes Berg , Christoph Hellwig X-Priority: 3 X-Content-Kind-Code: NORMAL In-Reply-To: <1557676457-4195-6-git-send-email-akinobu.mita@gmail.com> X-Drm-Type: N,general X-Msg-Generator: Mail X-Msg-Type: PERSONAL X-Reply-Demand: N Message-ID: <20190513074601epcms2p12c0a32730a16be3b69b68e3c9d4d0b92@epcms2p1> Date: Mon, 13 May 2019 16:46:01 +0900 X-CMS-MailID: 20190513074601epcms2p12c0a32730a16be3b69b68e3c9d4d0b92 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-Brightmail-Tracker: H4sIAAAAAAAAA02Ta0hTcRjG+Z9ztp25Fqdp9WZR60hJhbotZ6fIijQ7UMEgqDDLDnpw0m7t zEtBZdnVyDQockp2z7SbdtGmH3SZFM0ig5qRo0itZk3Mohtdth2lvv14eN/3eZ//hcRVjdJo Mtfi4O0WzkRLI4jbd2cxcS51d4bmR6mM8bceQMyflg4pc6nuHsYMXf9EML57nzHG/SmVeeqq kjLVF/pkzI+DCqb/YSvOXB0YJJYo2PLigIy94+yRsY999QR7tuU9xt44t5Nt7i6SsqU3axF7 5PBtgh1umGqQp5sWGnkum7ereUuWNTvXkpNMr1idmZKpT9Jo47TzmXm02sKZ+WQ6daUhLi3X FNyVVudzprygZOAEgU5YtNBuzXPwaqNVcCTTvC3bZNNqbfECZxbyLDnxWVbzAq1Go9MHKzeZ jPeflSPbG3lhf28HUYROy0qQnAQqEZqf/8RKUASpopoQPPnciUoQSSqpcfCrKTJUE0mxEHjq wUOyipoG3/waUZ4FgWaPJMRSKhaKjvmJEEdRdQj8XUxoJE5dxqDrwbBE9FLCif19hMiTofHi LRRiOZUG3sZDI/p46K77KBvlwY5qJHIU7PV14iKPg1ffm8NrAgXgCywScSfcrAnbArUHgffD lZHWBNj1dig8Xkmtgt3XDmEhJqgZ0OYqG6lJhcFdbWFbPBix8WNVOC4ezHjNlSCOj4H2F4RY MRYO3P0lGw3VdLIXEzkGhtzukSUnwcWuAanYykJl2TrxjB8geO96JylDaue/Y3b+5+v853sK 4bVoAm8TzDm8oLNp/7/ZBhR+tLOXNaETj1a6EUUieoySeuvNUEm4fGGr2Y2AxOkoZfr0oKTM 5rZu4+3WTHueiRfcSB+MX45Hj8+yBr+AxZGp1euSkjTz9Yw+ScfQE5U3FN0ZKiqHc/Cbed7G 20f7MFIeXYQGooufT3nC/gmk5S8B37v+esXvgnlrH3ngqNygS2nB+l4W3jopPS+0Gzw7hpe3 HTkjnE08/nNmRUHsHJtx2ZeNE3oUhhr94fU9ERva53rHOLmCPZV9hZ3FNV8lr7dXb/F7l3Zc UDQY7KXJB9Uxa1Zvvh/fWRJb8W2xBl+R0lq+z0MTgpHTzsbtAvcXmrYWDMoDAAA= DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20190512155540epcas4p14c15eb86b08dcd281e9a93a4fc190800 References: <1557676457-4195-6-git-send-email-akinobu.mita@gmail.com> <1557676457-4195-1-git-send-email-akinobu.mita@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > +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; > + > + 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?