dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: swati.dhingra@intel.com
To: intel-gfx@lists.freedesktop.org
Cc: Swati Dhingra <swati.dhingra@intel.com>,
	dri-devel@lists.freedesktop.org,
	Sourab Gupta <sourab.gupta@intel.com>
Subject: [RFC 4/4] drm/i915: Creating guc log file in drmfs instead of debugfs
Date: Mon,  5 Dec 2016 16:36:12 +0530	[thread overview]
Message-ID: <1480935972-6005-5-git-send-email-swati.dhingra@intel.com> (raw)
In-Reply-To: <1480935972-6005-1-git-send-email-swati.dhingra@intel.com>

From: Sourab Gupta <sourab.gupta@intel.com>

In the current scenario, the relay API fit well only with debugfs, due to
availability of parent dentry. Any other existing filesystem was not feasible for
holding guc logs, due to incompatibility with relay. But this makes the  guc_log
file unavailable on the production kernels.

GuC log file can therefore be one of candidates for movement to the drmfs
filesystem, which can satisfy all the requirements needed by relay API, and can
house any relayfs based output file.

The patch moves the parent directory of guc 'log_dir' from debugfs_root to
drmfs_root, while using the drmfs api's to create the requisite files.

Signed-off-by: Sourab Gupta <sourab.gupta@intel.com>
Signed-off-by: Swati Dhingra <swati.dhingra@intel.com>
---
 drivers/gpu/drm/i915/i915_guc_submission.c | 33 +++++++++++-------------------
 1 file changed, 12 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_guc_submission.c b/drivers/gpu/drm/i915/i915_guc_submission.c
index 5841380..3f5978a 100644
--- a/drivers/gpu/drm/i915/i915_guc_submission.c
+++ b/drivers/gpu/drm/i915/i915_guc_submission.c
@@ -22,8 +22,8 @@
  *
  */
 #include <linux/circ_buf.h>
-#include <linux/debugfs.h>
 #include <linux/relay.h>
+#include <drm/drmfs.h>
 #include "i915_drv.h"
 #include "intel_uc.h"
 
@@ -812,7 +812,7 @@ static int subbuf_start_callback(struct rchan_buf *buf,
 }
 
 /*
- * file_create() callback. Creates relay file in debugfs.
+ * file_create() callback. Creates relay file.
  */
 static struct dentry *create_buf_file_callback(const char *filename,
 					       struct dentry *parent,
@@ -838,17 +838,19 @@ static struct dentry *create_buf_file_callback(const char *filename,
 	 * dentry of the file associated with the channel buffer and that file's
 	 * name need not be same as the filename passed as an argument.
 	 */
-	buf_file = debugfs_create_file("guc_log", mode,
+
+	buf_file = drmfs_create_file("guc_log", mode,
 				       parent, buf, &relay_file_operations);
+
 	return buf_file;
 }
 
 /*
- * file_remove() default callback. Removes relay file in debugfs.
+ * file_remove() default callback. Removes relay file.
  */
 static int remove_buf_file_callback(struct dentry *dentry)
 {
-	debugfs_remove(dentry);
+	drmfs_remove(dentry);
 	return 0;
 }
 
@@ -898,22 +900,11 @@ static int guc_log_create_relay_file(struct intel_guc *guc)
 	struct dentry *log_dir;
 	int ret;
 
-	/* For now create the log file in /sys/kernel/debug/dri/0 dir */
-	log_dir = dev_priv->drm.primary->debugfs_root;
-
-	/* If /sys/kernel/debug/dri/0 location do not exist, then debugfs is
-	 * not mounted and so can't create the relay file.
-	 * The relay API seems to fit well with debugfs only, for availing relay
-	 * there are 3 requirements which can be met for debugfs file only in a
-	 * straightforward/clean manner :-
-	 * i)   Need the associated dentry pointer of the file, while opening the
-	 *      relay channel.
-	 * ii)  Should be able to use 'relay_file_operations' fops for the file.
-	 * iii) Set the 'i_private' field of file's inode to the pointer of
-	 *	relay channel buffer.
-	 */
+	/* Create the log file in drmfs dir: /sys/kernel/drm/i915/ */
+	log_dir = dev_priv->drm.driver->drmfs_root;
+
 	if (!log_dir) {
-		DRM_ERROR("Debugfs dir not available yet for GuC log file\n");
+		DRM_ERROR("Root dir not available yet for GuC log file\n");
 		return -ENODEV;
 	}
 
@@ -1154,7 +1145,7 @@ static int guc_log_create_extras(struct intel_guc *guc)
 	if (!guc->log.relay_chan) {
 		/* Create a relay channel, so that we have buffers for storing
 		 * the GuC firmware logs, the channel will be linked with a file
-		 * later on when debugfs is registered.
+		 * later on when drmfs is registered.
 		 */
 		ret = guc_log_create_relay_channel(guc);
 		if (ret)
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2016-12-05 11:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-05 11:06 [RFC 0/4] Introduce drmfs pseudo filesystem for drm subsystem swati.dhingra
2016-12-05 11:06 ` [RFC 1/4] drm: Introduce drmfs pseudo filesystem interfaces swati.dhingra
2016-12-05 11:06 ` [RFC 2/4] drm: Register drmfs filesystem from drm init swati.dhingra
2016-12-05 11:06 ` [RFC 3/4] drm: Create driver specific root directory inside drmfs swati.dhingra
2016-12-05 11:06 ` swati.dhingra [this message]
2016-12-12  6:14 ` [RFC 0/4] Introduce drmfs pseudo filesystem for drm subsystem sourab gupta
2016-12-12 15:33   ` Alex Deucher
2016-12-14  8:49     ` sourab gupta
  -- strict thread matches above, loose matches on Subject: below --
2016-12-19 10:42 swati.dhingra
2016-12-19 10:42 ` [RFC 4/4] drm/i915: Creating guc log file in drmfs instead of debugfs swati.dhingra

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=1480935972-6005-5-git-send-email-swati.dhingra@intel.com \
    --to=swati.dhingra@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=sourab.gupta@intel.com \
    /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).