[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1403694435-3180-19-git-send-email-jslaby@suse.cz>
Date: Wed, 25 Jun 2014 13:07:13 +0200
From: Jiri Slaby <jslaby@...e.cz>
To: linux-kernel@...r.kernel.org
Cc: tj@...nel.org, rostedt@...dmis.org, mingo@...hat.com,
akpm@...ux-foundation.org, andi@...stfloor.org,
paulmck@...ux.vnet.ibm.com, pavel@....cz, jirislaby@...il.com,
Vojtech Pavlik <vojtech@...e.cz>, Michael Matz <matz@...e.de>,
Jiri Kosina <jkosina@...e.cz>, Jiri Slaby <jslaby@...e.cz>
Subject: [PATCH -repost 19/21] kgr: expose global 'in_progress' state through procfs
From: Jiri Kosina <jkosina@...e.cz>
In addition to having a per-process flag that shows which processess have
already been "migrated", it's useful to have a global-wide flag that will
show whether the patching operation is currently undergoing without having
to traverse all /proc entries.
js: handle error
Reported-by: Libor Pechacek <lpechacek@...e.cz>
Signed-off-by: Jiri Kosina <jkosina@...e.cz>
Signed-off-by: Jiri Slaby <jslaby@...e.cz>
---
kernel/kgraft.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/kernel/kgraft.c b/kernel/kgraft.c
index 5ec0c1abe0d6..1247f1c60b09 100644
--- a/kernel/kgraft.c
+++ b/kernel/kgraft.c
@@ -26,6 +26,8 @@
#include <linux/spinlock.h>
#include <linux/types.h>
#include <linux/workqueue.h>
+#include <linux/seq_file.h>
+#include <linux/proc_fs.h>
static int kgr_patch_code(const struct kgr_patch *patch,
struct kgr_patch_fun *patch_fun, bool final);
@@ -382,6 +384,25 @@ unlock_free:
}
EXPORT_SYMBOL_GPL(kgr_start_patching);
+static int kgr_show(struct seq_file *m, void *v)
+{
+ seq_printf(m, "%d\n", kgr_in_progress);
+ return 0;
+}
+
+static int kgr_open(struct inode *inode, struct file *file)
+{
+ return single_open(file, kgr_show, NULL);
+}
+
+static const struct file_operations kgr_fops = {
+ .owner = THIS_MODULE,
+ .open = kgr_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
+};
+
static int __init kgr_init(void)
{
if (ftrace_is_dead()) {
@@ -398,6 +419,9 @@ static int __init kgr_init(void)
kgr_initialized = true;
pr_info("kgr: successfully initialized\n");
+ if (!proc_create("kgr_in_progress", 0, NULL, &kgr_fops))
+ pr_warn("kgr: cannot create kgr_in_progress in procfs\n");
+
return 0;
}
module_init(kgr_init);
--
2.0.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists