From: Logan Gunthorpe <logang-OTvnGxWRz7hWk0Htik3J/w@public.gmane.org>
To: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>,
Sagi Grimberg <sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>,
"James E.J. Bottomley"
<jejb-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>,
"Martin K. Petersen"
<martin.petersen-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>,
Jens Axboe <axboe-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org>,
Steve Wise
<swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>,
Stephen Bates <sbates-pv7U853sEMVWk0Htik3J/w@public.gmane.org>,
Max Gurtovoy <maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
Dan Williams
<dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
Keith Busch <keith.busch-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
Jason Gunthorpe
<jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
Cc: linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-nvme-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Logan Gunthorpe <logang-OTvnGxWRz7hWk0Htik3J/w@public.gmane.org>
Subject: [RFC 4/8] p2pmem: Add debugfs "stats" file
Date: Thu, 30 Mar 2017 16:12:35 -0600 [thread overview]
Message-ID: <1490911959-5146-5-git-send-email-logang@deltatee.com> (raw)
In-Reply-To: <1490911959-5146-1-git-send-email-logang-OTvnGxWRz7hWk0Htik3J/w@public.gmane.org>
From: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
For each p2pmem instance, add a "stats" file to show
the gen_pool statistics.
Signed-off-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
Signed-off-by: Logan Gunthorpe <logang-OTvnGxWRz7hWk0Htik3J/w@public.gmane.org>
Signed-off-by: Stephen Bates <sbates-pv7U853sEMVWk0Htik3J/w@public.gmane.org>
---
drivers/memory/p2pmem.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
include/linux/p2pmem.h | 2 ++
2 files changed, 51 insertions(+)
diff --git a/drivers/memory/p2pmem.c b/drivers/memory/p2pmem.c
index c4ea311..71741c2 100644
--- a/drivers/memory/p2pmem.c
+++ b/drivers/memory/p2pmem.c
@@ -18,6 +18,7 @@
#include <linux/slab.h>
#include <linux/genalloc.h>
#include <linux/memremap.h>
+#include <linux/debugfs.h>
MODULE_DESCRIPTION("Peer 2 Peer Memory Device");
MODULE_VERSION("0.1");
@@ -27,6 +28,40 @@ MODULE_AUTHOR("Microsemi Corporation");
static struct class *p2pmem_class;
static DEFINE_IDA(p2pmem_ida);
+static struct dentry *p2pmem_debugfs_root;
+
+static int stats_show(struct seq_file *seq, void *v)
+{
+ struct p2pmem_dev *p = seq->private;
+
+ if (p->pool) {
+ seq_printf(seq, "total size: %lu\n", gen_pool_size(p->pool));
+ seq_printf(seq, "available: %lu\n", gen_pool_avail(p->pool));
+ }
+ return 0;
+}
+
+static int stats_open(struct inode *inode, struct file *file)
+{
+ return single_open(file, stats_show, inode->i_private);
+}
+
+static const struct file_operations stats_debugfs_fops = {
+ .owner = THIS_MODULE,
+ .open = stats_open,
+ .release = single_release,
+ .read = seq_read,
+ .llseek = seq_lseek,
+};
+
+static void setup_debugfs(struct p2pmem_dev *p)
+{
+ struct dentry *de;
+
+ de = debugfs_create_file("stats", 0400, p->debugfs_root,
+ (void *)p, &stats_debugfs_fops);
+}
+
static struct p2pmem_dev *to_p2pmem(struct device *dev)
{
return container_of(dev, struct p2pmem_dev, dev);
@@ -62,6 +97,8 @@ static void p2pmem_release(struct device *dev)
{
struct p2pmem_dev *p = to_p2pmem(dev);
+ debugfs_remove_recursive(p->debugfs_root);
+
if (p->pool)
gen_pool_destroy(p->pool);
@@ -114,6 +151,13 @@ struct p2pmem_dev *p2pmem_create(struct device *parent)
if (rc)
goto err_id;
+ if (p2pmem_debugfs_root) {
+ p->debugfs_root = debugfs_create_dir(dev_name(&p->dev),
+ p2pmem_debugfs_root);
+ if (p->debugfs_root)
+ setup_debugfs(p);
+ }
+
rc = device_add(&p->dev);
if (rc)
goto err_id;
@@ -390,12 +434,17 @@ static int __init p2pmem_init(void)
if (IS_ERR(p2pmem_class))
return PTR_ERR(p2pmem_class);
+ p2pmem_debugfs_root = debugfs_create_dir("p2pmem", NULL);
+ if (!p2pmem_debugfs_root)
+ pr_info("could not create debugfs entry, continuing\n");
+
return 0;
}
module_init(p2pmem_init);
static void __exit p2pmem_exit(void)
{
+ debugfs_remove_recursive(p2pmem_debugfs_root);
class_destroy(p2pmem_class);
pr_info(KBUILD_MODNAME ": unloaded.\n");
diff --git a/include/linux/p2pmem.h b/include/linux/p2pmem.h
index 71dc1e1..4cd6f35 100644
--- a/include/linux/p2pmem.h
+++ b/include/linux/p2pmem.h
@@ -26,6 +26,8 @@ struct p2pmem_dev {
struct percpu_ref ref;
struct completion cmp;
struct gen_pool *pool;
+
+ struct dentry *debugfs_root;
};
#ifdef CONFIG_P2PMEM
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2017-03-30 22:12 UTC|newest]
Thread overview: 81+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-30 22:12 [RFC 0/8] Copy Offload with Peer-to-Peer PCI Memory Logan Gunthorpe
[not found] ` <1490911959-5146-1-git-send-email-logang-OTvnGxWRz7hWk0Htik3J/w@public.gmane.org>
2017-03-30 22:12 ` [RFC 1/8] Introduce Peer-to-Peer memory (p2pmem) device Logan Gunthorpe
[not found] ` <1490911959-5146-2-git-send-email-logang-OTvnGxWRz7hWk0Htik3J/w@public.gmane.org>
2017-03-31 18:49 ` Sinan Kaya
[not found] ` <cb102386-0314-a3a3-ed44-b42debdf1512-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2017-03-31 21:23 ` Logan Gunthorpe
[not found] ` <7158f2e8-2016-f398-e77f-0fcbe6cb41dd-OTvnGxWRz7hWk0Htik3J/w@public.gmane.org>
2017-03-31 21:38 ` Sinan Kaya
[not found] ` <e6a74aeb-9f54-51c5-8ad9-3b6fb92c03b3-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2017-03-31 22:42 ` Logan Gunthorpe
[not found] ` <0280fbb4-ba9e-ac64-6bb3-b72590a54e57-OTvnGxWRz7hWk0Htik3J/w@public.gmane.org>
2017-03-31 23:51 ` Sinan Kaya
[not found] ` <0ae27bca-21be-b89c-aba4-6cc9766ebd7b-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2017-04-01 1:57 ` Logan Gunthorpe
[not found] ` <c8edc480-a2ac-a763-8438-18f3396db483-OTvnGxWRz7hWk0Htik3J/w@public.gmane.org>
2017-04-01 2:17 ` okaya-sgV2jX0FEOL9JmXXK+q4OQ
2017-04-01 22:16 ` Logan Gunthorpe
2017-04-02 2:26 ` Sinan Kaya
[not found] ` <f0448277-9381-5c3d-d194-1efa1d1b44a6-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2017-04-02 17:21 ` Logan Gunthorpe
2017-04-02 21:03 ` Sinan Kaya
2017-04-03 4:26 ` Logan Gunthorpe
[not found] ` <ef507444-d3e5-0454-86a0-b5c4ae4b4dd9-OTvnGxWRz7hWk0Htik3J/w@public.gmane.org>
2017-04-25 11:58 ` Marta Rybczynska
[not found] ` <117239810.400362790.1493121533234.JavaMail.zimbra-FNhOzJFKnXGHXe+LvDLADg@public.gmane.org>
2017-04-25 16:58 ` Logan Gunthorpe
2017-03-30 22:12 ` [RFC 2/8] cxgb4: setup pcie memory window 4 and create p2pmem region Logan Gunthorpe
[not found] ` <1490911959-5146-3-git-send-email-logang-OTvnGxWRz7hWk0Htik3J/w@public.gmane.org>
2017-04-04 10:42 ` Sagi Grimberg
[not found] ` <f269d9e1-8dcf-7970-382e-cb0d9a020efc-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
2017-04-04 15:56 ` Logan Gunthorpe
2017-04-05 15:41 ` Steve Wise
2017-03-30 22:12 ` [RFC 3/8] nvmet: Use p2pmem in nvme target Logan Gunthorpe
2017-04-04 10:40 ` Sagi Grimberg
[not found] ` <bce6b009-7756-3cf7-5053-2628b26c8d97-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
2017-04-04 16:16 ` Logan Gunthorpe
[not found] ` <ec05b7d9-8dfd-8227-84d2-7d391df32219-OTvnGxWRz7hWk0Htik3J/w@public.gmane.org>
2017-04-06 5:47 ` Sagi Grimberg
[not found] ` <0689e764-bf04-6da2-3b7d-2cbf0b6b94a0-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
2017-04-06 15:52 ` Logan Gunthorpe
2017-03-30 22:12 ` Logan Gunthorpe [this message]
[not found] ` <1490911959-5146-5-git-send-email-logang-OTvnGxWRz7hWk0Htik3J/w@public.gmane.org>
2017-04-04 10:46 ` [RFC 4/8] p2pmem: Add debugfs "stats" file Sagi Grimberg
[not found] ` <95928b70-0148-7297-8f5e-5031d996bb98-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
2017-04-04 17:25 ` Logan Gunthorpe
2017-04-05 15:43 ` Steve Wise
2017-03-30 22:12 ` [RFC 5/8] scatterlist: Modify SG copy functions to support io memory Logan Gunthorpe
[not found] ` <1490911959-5146-6-git-send-email-logang-OTvnGxWRz7hWk0Htik3J/w@public.gmane.org>
2017-03-31 7:09 ` Christoph Hellwig
[not found] ` <20170331070950.GA9059-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2017-03-31 15:41 ` Logan Gunthorpe
[not found] ` <435d4471-436b-87e6-8827-c9fc6cbdde2c-OTvnGxWRz7hWk0Htik3J/w@public.gmane.org>
2017-04-03 21:20 ` Logan Gunthorpe
[not found] ` <445bc352-75d7-438f-96ef-c2411215628d-OTvnGxWRz7hWk0Htik3J/w@public.gmane.org>
2017-04-03 21:44 ` Dan Williams
[not found] ` <CAPcyv4g=MHbjbY0GFPoLq3wAGwhcC7813O7iLUWGEChWh0M7Dw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-04-03 22:10 ` Logan Gunthorpe
[not found] ` <ff0dd5ec-2562-9f1d-1335-d0a8813f2f50-OTvnGxWRz7hWk0Htik3J/w@public.gmane.org>
2017-04-03 22:47 ` Dan Williams
[not found] ` <CAPcyv4gx4g3Ry_A99yTodqwm2vH72oMSLKAKF7iEsmG5G4TcbQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-04-03 23:12 ` Logan Gunthorpe
[not found] ` <22930db3-a194-8b60-5aab-4a8add1ddc55-OTvnGxWRz7hWk0Htik3J/w@public.gmane.org>
2017-04-04 0:07 ` Dan Williams
[not found] ` <CAPcyv4gL=Z42x52So1iL-MNhPY67Pktz3c0J_h0tj_60TowNuQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-04-07 17:59 ` Logan Gunthorpe
2017-03-30 22:12 ` [RFC 6/8] nvmet: Be careful about using iomem accesses when dealing with p2pmem Logan Gunthorpe
[not found] ` <1490911959-5146-7-git-send-email-logang-OTvnGxWRz7hWk0Htik3J/w@public.gmane.org>
2017-04-04 10:59 ` Sagi Grimberg
[not found] ` <080b68b4-eba3-861c-4f29-5d829425b5e7-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
2017-04-04 15:46 ` Jason Gunthorpe
[not found] ` <20170404154629.GA13552-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-04-04 17:21 ` Logan Gunthorpe
2017-04-06 5:33 ` Sagi Grimberg
2017-04-06 16:35 ` Jason Gunthorpe
[not found] ` <4df229d8-8124-664a-9bc4-6401bc034be1-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
2017-04-06 16:02 ` Logan Gunthorpe
2017-04-07 11:19 ` Stephen Bates
[not found] ` <3E85B4D4-9EBC-4299-8209-2D8740947764-pv7U853sEMVWk0Htik3J/w@public.gmane.org>
2017-04-10 8:29 ` Sagi Grimberg
[not found] ` <7fcc3ac8-8b96-90f5-3942-87f999c7499d-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
2017-04-10 16:03 ` Logan Gunthorpe
2017-03-30 22:12 ` [RFC 7/8] p2pmem: Support device removal Logan Gunthorpe
2017-04-12 5:22 ` [RFC 0/8] Copy Offload with Peer-to-Peer PCI Memory Benjamin Herrenschmidt
[not found] ` <1491974532.7236.43.camel-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
2017-04-12 17:09 ` Logan Gunthorpe
[not found] ` <5ac22496-56ec-025d-f153-140001d2a7f9-OTvnGxWRz7hWk0Htik3J/w@public.gmane.org>
2017-04-12 21:55 ` Benjamin Herrenschmidt
[not found] ` <1492034124.7236.77.camel-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
2017-04-13 21:22 ` Logan Gunthorpe
[not found] ` <81888a1e-eb0d-cbbc-dc66-0a09c32e4ea2-OTvnGxWRz7hWk0Htik3J/w@public.gmane.org>
2017-04-13 22:37 ` Benjamin Herrenschmidt
2017-04-13 23:26 ` Bjorn Helgaas
[not found] ` <20170413232631.GB24910-1RhO1Y9PlrlHTL0Zs8A6p5iNqAH0jzoTYJqu5kTmcBRl57MIdRCFDg@public.gmane.org>
2017-04-14 4:16 ` Jason Gunthorpe
[not found] ` <20170414041656.GA30694-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-04-14 4:40 ` Logan Gunthorpe
[not found] ` <08c32f0d-6c7c-b65f-6453-dde0d7c173d1-OTvnGxWRz7hWk0Htik3J/w@public.gmane.org>
2017-04-14 11:37 ` Benjamin Herrenschmidt
[not found] ` <1492169879.25766.4.camel-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
2017-04-14 11:39 ` Benjamin Herrenschmidt
2017-04-14 11:37 ` Benjamin Herrenschmidt
[not found] ` <1492169849.25766.3.camel-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
2017-04-14 17:30 ` Logan Gunthorpe
[not found] ` <630c1c63-ff17-1116-e069-2b8f93e50fa2-OTvnGxWRz7hWk0Htik3J/w@public.gmane.org>
2017-04-14 19:04 ` Bjorn Helgaas
[not found] ` <20170414190452.GA15679-1RhO1Y9PlrlHTL0Zs8A6p5iNqAH0jzoTYJqu5kTmcBRl57MIdRCFDg@public.gmane.org>
2017-04-14 22:07 ` Benjamin Herrenschmidt
[not found] ` <1492207643.25766.18.camel-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
2017-04-15 17:41 ` Logan Gunthorpe
2017-04-15 22:09 ` Dan Williams
[not found] ` <CAPcyv4jUeKzKDARp6Z35kdPLKnP-M6aF8X5KpOx55CLyjnj4dA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-04-16 3:01 ` Benjamin Herrenschmidt
[not found] ` <1492311719.25766.37.camel-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
2017-04-16 4:46 ` Logan Gunthorpe
2017-04-16 15:53 ` Dan Williams
[not found] ` <CAPcyv4iqnz1B00Q3xG-nGrLXdOyB7ditxmwZyotksLFgUqr+jA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-04-16 16:34 ` Logan Gunthorpe
[not found] ` <5e43818e-8c6b-8be8-23ff-b798633d2a73-OTvnGxWRz7hWk0Htik3J/w@public.gmane.org>
2017-04-16 22:31 ` Benjamin Herrenschmidt
[not found] ` <1492381907.25766.49.camel-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
2017-04-24 7:36 ` Knut Omang
[not found] ` <1493019397.3171.118.camel-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2017-04-24 16:14 ` Logan Gunthorpe
[not found] ` <9b6c0830-a728-c7ca-e6c6-2135f3f760ed-OTvnGxWRz7hWk0Htik3J/w@public.gmane.org>
2017-04-25 6:30 ` Knut Omang
[not found] ` <1493101803.3171.246.camel-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2017-04-25 17:03 ` Logan Gunthorpe
[not found] ` <0cc95df5-b9dd-6493-15fe-771d535c1020-OTvnGxWRz7hWk0Htik3J/w@public.gmane.org>
2017-04-25 21:23 ` Stephen Bates
2017-04-25 21:23 ` Stephen Bates
2017-04-16 22:26 ` Benjamin Herrenschmidt
[not found] ` <bff1e503-95a9-e19f-bfd9-0ff962c63a81-OTvnGxWRz7hWk0Htik3J/w@public.gmane.org>
2017-04-15 22:17 ` Benjamin Herrenschmidt
[not found] ` <1492294628.25766.33.camel-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
2017-04-16 5:36 ` Logan Gunthorpe
2017-03-30 22:12 ` [RFC 8/8] p2pmem: Added char device user interface Logan Gunthorpe
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=1490911959-5146-5-git-send-email-logang@deltatee.com \
--to=logang-otvngxwrz7hwk0htik3j/w@public.gmane.org \
--cc=axboe-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org \
--cc=dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=hch-jcswGhMUV9g@public.gmane.org \
--cc=jejb-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org \
--cc=jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org \
--cc=keith.busch-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org \
--cc=linux-nvme-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=martin.petersen-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org \
--cc=maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org \
--cc=sbates-pv7U853sEMVWk0Htik3J/w@public.gmane.org \
--cc=swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org \
/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).