From: akash.goel@intel.com
To: linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
viro@zeniv.linux.org.uk
Cc: Akash Goel <akash.goel@intel.com>,
Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>,
Tom Zanussi <tzanussi@gmail.com>,
Chris Wilson <chris@chris-wilson.co.uk>
Subject: [PATCH v2] relay: Add global mode support for buffer-only channels
Date: Mon, 11 Jul 2016 12:47:36 +0530 [thread overview]
Message-ID: <1468221456-15537-1-git-send-email-akash.goel@intel.com> (raw)
In-Reply-To: <b905c0b6-a295-882f-9714-cf259119e96c@intel.com>
From: Akash Goel <akash.goel@intel.com>
The following patch added support to use channels with no associated files.
relay: add buffer-only channels; useful for early logging
This is useful when the exact location of relay file is not known or the
the parent directory of relay file is not available, while creating the
channel and the logging has to start right from the boot.
But there was no provision to use global mode with buffer-only channels,
which is added by this patch, without modifying the interface where initially
there will be a dummy invocation of create_buf_file callback through which
kernel client can convey the need of a global buffer.
For the use case where drivers/kernel clients want a simple interface for the
userspace, which enables them to capture data/logs from relay file in order &
without any post processing, support of Global buffer mode is warranted.
v2: Minor refactoring of code & rephrase the comment to be succinct. (Chris)
Cc: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
Cc: Tom Zanussi <tzanussi@gmail.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Akash Goel <akash.goel@intel.com>
---
kernel/relay.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/kernel/relay.c b/kernel/relay.c
index 04d7cf3..92db973 100644
--- a/kernel/relay.c
+++ b/kernel/relay.c
@@ -451,6 +451,13 @@ static struct rchan_buf *relay_open_buf(struct rchan *chan, unsigned int cpu)
if (!dentry)
goto free_buf;
relay_set_buf_dentry(buf, dentry);
+ } else {
+ /* Only retrieve global info, nothing more, nothing less */
+ dentry = chan->cb->create_buf_file(NULL, NULL,
+ S_IRUSR, buf,
+ &chan->is_global);
+ if (WARN_ON(dentry))
+ goto free_buf;
}
buf->cpu = cpu;
@@ -666,6 +673,20 @@ int relay_late_setup_files(struct rchan *chan,
}
chan->has_base_filename = 1;
chan->parent = parent;
+
+ if (chan->is_global) {
+ err = -EINVAL;
+ if (!WARN_ON_ONCE(!chan->buf[0])) {
+ dentry = relay_create_buf_file(chan, chan->buf[0], 0);
+ if (dentry && !WARN_ON_ONCE(!chan->is_global)) {
+ relay_set_buf_dentry(chan->buf[0], dentry);
+ err = 0;
+ }
+ }
+ mutex_unlock(&relay_channels_mutex);
+ return err;
+ }
+
curr_cpu = get_cpu();
/*
* The CPU hotplug notifier ran before us and created buffers with
@@ -706,6 +727,7 @@ int relay_late_setup_files(struct rchan *chan,
return err;
}
+EXPORT_SYMBOL_GPL(relay_late_setup_files);
/**
* relay_switch_subbuf - switch to a new sub-buffer
--
1.9.2
next prev parent reply other threads:[~2016-07-11 7:04 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-03 16:15 [PATCH] " akash.goel
2016-07-04 8:00 ` Chris Wilson
2016-07-04 13:03 ` Goel, Akash
2016-07-11 7:17 ` akash.goel [this message]
2016-07-11 20:17 ` [PATCH v2] " Andrew Morton
2016-07-12 9:24 ` Chris Wilson
2016-07-12 12:50 ` Goel, Akash
2016-07-12 13:01 ` Chris Wilson
2016-07-12 13:24 ` Goel, Akash
2016-07-12 19:51 ` Andrew Morton
2016-07-13 7:39 ` [PATCH v3] " akash.goel
2016-07-13 8:30 ` kbuild test robot
2016-07-13 10:09 ` [PATCH v4] " akash.goel
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=1468221456-15537-1-git-send-email-akash.goel@intel.com \
--to=akash.goel@intel.com \
--cc=akpm@linux-foundation.org \
--cc=chris@chris-wilson.co.uk \
--cc=eduard.munteanu@linux360.ro \
--cc=linux-kernel@vger.kernel.org \
--cc=tzanussi@gmail.com \
--cc=viro@zeniv.linux.org.uk \
/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
all inboxes | Powered by JetHome®