From: John Stultz <john.stultz@linaro.org>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Mitchel Humpherys <mitchelh@codeaurora.org>,
Greg KH <gregkh@linuxfoundation.org>,
Colin Cross <ccross@android.com>,
Android Kernel Team <kernel-team@android.com>,
John Stultz <john.stultz@linaro.org>
Subject: [PATCH 06/14] staging: ion: Create separate heap and client debugfs directories
Date: Mon, 17 Feb 2014 13:58:34 -0800 [thread overview]
Message-ID: <1392674322-9036-7-git-send-email-john.stultz@linaro.org> (raw)
In-Reply-To: <1392674322-9036-1-git-send-email-john.stultz@linaro.org>
From: Mitchel Humpherys <mitchelh@codeaurora.org>
It can be slightly annoying to figure out which files under the ion
debugfs directory are heap debug files and which ones are client debug
files. Create separate subdirectories under ion to hold the different
types of debug files.
Cc: Greg KH <gregkh@linuxfoundation.org>
Cc: Colin Cross <ccross@android.com>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
[jstultz: Minor commit subject tweaks]
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
drivers/staging/android/ion/ion.c | 57 +++++++++++++++++++++++++++++++++------
1 file changed, 49 insertions(+), 8 deletions(-)
diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
index 14cb6c6..8f6bdb7 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -60,6 +60,8 @@ struct ion_device {
unsigned long arg);
struct rb_root clients;
struct dentry *debug_root;
+ struct dentry *heaps_debug_root;
+ struct dentry *clients_debug_root;
};
/**
@@ -764,8 +766,15 @@ struct ion_client *ion_client_create(struct ion_device *dev,
snprintf(debug_name, 64, "%u", client->pid);
client->debug_root = debugfs_create_file(debug_name, 0664,
- dev->debug_root, client,
- &debug_client_fops);
+ dev->clients_debug_root,
+ client, &debug_client_fops);
+ if (!client->debug_root) {
+ char buf[256], *path;
+ path = dentry_path(dev->clients_debug_root, buf, 256);
+ pr_err("Failed to create client debugfs at %s/%s\n",
+ path, debug_name);
+ }
+
up_write(&dev->lock);
return client;
@@ -1442,6 +1451,8 @@ DEFINE_SIMPLE_ATTRIBUTE(debug_shrink_fops, debug_shrink_get,
void ion_device_add_heap(struct ion_device *dev, struct ion_heap *heap)
{
+ struct dentry *debug_file;
+
if (!heap->ops->allocate || !heap->ops->free || !heap->ops->map_dma ||
!heap->ops->unmap_dma)
pr_err("%s: can not add heap with invalid ops struct.\n",
@@ -1456,15 +1467,31 @@ void ion_device_add_heap(struct ion_device *dev, struct ion_heap *heap)
the list later attempt higher id numbers first */
plist_node_init(&heap->node, -heap->id);
plist_add(&heap->node, &dev->heaps);
- debugfs_create_file(heap->name, 0664, dev->debug_root, heap,
- &debug_heap_fops);
+ debug_file = debugfs_create_file(heap->name, 0664,
+ dev->heaps_debug_root, heap,
+ &debug_heap_fops);
+
+ if (!debug_file) {
+ char buf[256], *path;
+ path = dentry_path(dev->heaps_debug_root, buf, 256);
+ pr_err("Failed to create heap debugfs at %s/%s\n",
+ path, heap->name);
+ }
+
#ifdef DEBUG_HEAP_SHRINKER
if (heap->shrinker.shrink) {
char debug_name[64];
snprintf(debug_name, 64, "%s_shrink", heap->name);
- debugfs_create_file(debug_name, 0644, dev->debug_root, heap,
- &debug_shrink_fops);
+ debug_file = debugfs_create_file(
+ debug_name, 0644, dev->heaps_debug_root, heap,
+ &debug_shrink_fops);
+ if (!debug_file) {
+ char buf[256], *path;
+ path = dentry_path(dev->heaps_debug_root, buf, 256);
+ pr_err("Failed to create heap shrinker debugfs at %s/%s\n",
+ path, debug_name);
+ }
}
#endif
up_write(&dev->lock);
@@ -1493,8 +1520,21 @@ struct ion_device *ion_device_create(long (*custom_ioctl)
}
idev->debug_root = debugfs_create_dir("ion", NULL);
- if (!idev->debug_root)
- pr_err("ion: failed to create debug files.\n");
+ if (!idev->debug_root) {
+ pr_err("ion: failed to create debugfs root directory.\n");
+ goto debugfs_done;
+ }
+ idev->heaps_debug_root = debugfs_create_dir("heaps", idev->debug_root);
+ if (!idev->heaps_debug_root) {
+ pr_err("ion: failed to create debugfs heaps directory.\n");
+ goto debugfs_done;
+ }
+ idev->clients_debug_root = debugfs_create_dir("clients",
+ idev->debug_root);
+ if (!idev->clients_debug_root)
+ pr_err("ion: failed to create debugfs clients directory.\n");
+
+debugfs_done:
idev->custom_ioctl = custom_ioctl;
idev->buffers = RB_ROOT;
@@ -1508,6 +1548,7 @@ struct ion_device *ion_device_create(long (*custom_ioctl)
void ion_device_destroy(struct ion_device *dev)
{
misc_deregister(&dev->dev);
+ debugfs_remove_recursive(dev->debug_root);
/* XXX need to free the heaps and clients ? */
kfree(dev);
}
--
1.8.3.2
next prev parent reply other threads:[~2014-02-17 21:59 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-17 21:58 [PATCH 00/14][RFC] Android updates for staging-next John Stultz
2014-02-17 21:58 ` [PATCH 01/14] staging: binder: Fix death notifications John Stultz
2014-02-18 19:02 ` Greg KH
2014-02-18 19:21 ` John Stultz
2014-02-18 19:33 ` Greg KH
2014-02-17 21:58 ` [PATCH 02/14] staging: android: Split uapi out of android_alarm.h John Stultz
2014-02-17 21:58 ` [PATCH 03/14] staging: android: Split uapi out of ashmem.h John Stultz
2014-02-17 21:58 ` [PATCH 04/14] staging: android: split uapi out of sync.h and sw_sync.h John Stultz
2014-02-17 21:58 ` [PATCH 05/14] staging: android: Split uapi out of binder.h John Stultz
2014-02-17 21:58 ` John Stultz [this message]
2014-02-17 21:58 ` [PATCH 07/14] staging: ion: Fix debugfs handling of multiple kernel clients John Stultz
2014-02-17 21:58 ` [PATCH 08/14] staging: ion: Store a copy of the client name on client creation John Stultz
2014-02-17 21:58 ` [PATCH 09/14] staging: ion: Make sure all clients are exposed in debugfs John Stultz
2014-02-17 21:58 ` [PATCH 10/14] staging: ion: Move shrinker out of heaps John Stultz
2014-02-17 21:58 ` [PATCH 11/14] staging: ion: Add private buffer flag to skip page pooling on free John Stultz
2014-02-17 21:58 ` [PATCH 12/14] staging: binder: Fix ABI for 64bit Android John Stultz
2014-02-18 19:08 ` Greg KH
2014-02-18 19:30 ` John Stultz
2014-02-18 19:49 ` Greg KH
2014-02-18 20:02 ` John Stultz
2014-02-18 20:32 ` Greg KH
2014-02-19 0:08 ` Arve Hjønnevåg
2014-02-19 2:13 ` Greg KH
2014-02-17 21:58 ` [PATCH 13/14] staging: binder: Support concurrent 32 bit and 64 bit processes John Stultz
2014-02-18 19:09 ` Greg KH
2014-02-18 19:10 ` Greg KH
2014-02-18 19:43 ` John Stultz
2014-02-17 21:58 ` [PATCH 14/14] staging: binder: Improve Kconfig entry for ANDROID_BINDER_IPC_32BIT John Stultz
2014-02-19 0:18 ` Arve Hjønnevåg
2014-02-19 0:30 ` John Stultz
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=1392674322-9036-7-git-send-email-john.stultz@linaro.org \
--to=john.stultz@linaro.org \
--cc=ccross@android.com \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-team@android.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mitchelh@codeaurora.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
Powered by JetHome