Skip to contentSkip to conversation

Use common functions for module loading and unloading

RFC PATCH Superseded Jan Glauber 3 participants 12 messages Apr 3, 2014 – May 14, 2014 7 messages not in the archive

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#1 lore raw

RFC PATCH 1/4 Use common functions for module loading and unloading

In reply to a message not in the archive

Module loading (and unloading) is identical for control and data modules so use common funtions to avoid code duplication.

---
 src/bin/lttng-sessiond/modprobe.c |  109 ++++++++++++-------------------------
 1 file changed, 34 insertions(+), 75 deletions(-)
src/bin/lttng-sessiond/modprobe.c +34 -75
index 92563b0..b84c07e 100644
@@ -82,18 +82,16 @@ const struct kern_modules_param kern_modules_list[] = {
 	{ "lttng-probe-writeback", 0 },
 };
 
-/*
- * Remove control kernel module(s) in reverse load order.
- */
-void modprobe_remove_lttng_control(void)
+void modprobe_remove_lttng(const struct kern_modules_param *modules,
+			   int entries)
 {
 	int ret = 0, i;
 	char modprobe[256];
 
-	for (i = ARRAY_SIZE(kern_modules_control) - 1; i >= 0; i--) {
+	for (i = entries - 1; i >= 0; i--) {
 		ret = snprintf(modprobe, sizeof(modprobe),
 				"/sbin/modprobe -r -q %s",
-				kern_modules_control[i].name);
+				modules[i].name);
 		if (ret < 0) {
 			PERROR("snprintf modprobe -r");
 			goto error;
@@ -115,6 +113,16 @@ void modprobe_remove_lttng_control(void)
 
 error:
 	return;
+
+}
+
+/*
+ * Remove control kernel module(s) in reverse load order.
+ */
+void modprobe_remove_lttng_control(void)
+{
+	return modprobe_remove_lttng(kern_modules_control,
+				     ARRAY_SIZE(kern_modules_control));
 }
 
 /*
@@ -122,34 +130,8 @@ error:
  */
 void modprobe_remove_lttng_data(void)
 {
-	int ret = 0, i;
-	char modprobe[256];
-
-	for (i = ARRAY_SIZE(kern_modules_list) - 1; i >= 0; i--) {
-		ret = snprintf(modprobe, sizeof(modprobe),
-				"/sbin/modprobe -r -q %s",
-				kern_modules_list[i].name);
-		if (ret < 0) {
-			PERROR("snprintf modprobe -r");
-			goto error;
-		}
-		modprobe[sizeof(modprobe) - 1] = '\0';
-		ret = system(modprobe);
-		if (ret == -1) {
-			ERR("Unable to launch modprobe -r for module %s",
-					kern_modules_list[i].name);
-		} else if (kern_modules_list[i].required
-				&& WEXITSTATUS(ret) != 0) {
-			ERR("Unable to remove module %s",
-					kern_modules_list[i].name);
-		} else {
-			DBG("Modprobe removal successful %s",
-					kern_modules_list[i].name);
-		}
-	}
-
-error:
-	return;
+	return modprobe_remove_lttng(kern_modules_list,
+				     ARRAY_SIZE(kern_modules_list));
 }
 
 /*
@@ -161,19 +143,16 @@ void modprobe_remove_lttng_all(void)
 	modprobe_remove_lttng_control();
 }
 
-/*
- * Load control kernel module(s).
- */
-int modprobe_lttng_control(void)
+static int modprobe_lttng(const struct kern_modules_param *modules, int entries)
 {
 	int ret = 0, i;
 	char modprobe[256];
 
-	for (i = 0; i < ARRAY_SIZE(kern_modules_control); i++) {
+	for (i = 0; i < entries; i++) {
 		ret = snprintf(modprobe, sizeof(modprobe),
 				"/sbin/modprobe %s%s",
-				kern_modules_control[i].required ? "" : "-q ",
-				kern_modules_control[i].name);
+				modules[i].required ? "" : "-q ",
+				modules[i].name);
 		if (ret < 0) {
 			PERROR("snprintf modprobe");
 			goto error;
@@ -182,14 +161,13 @@ int modprobe_lttng_control(void)
 		ret = system(modprobe);
 		if (ret == -1) {
 			ERR("Unable to launch modprobe for module %s",
-					kern_modules_control[i].name);
-		} else if (kern_modules_control[i].required
-				&& WEXITSTATUS(ret) != 0) {
+					modules[i].name);
+		} else if (modules[i].required && WEXITSTATUS(ret) != 0) {
 			ERR("Unable to load module %s",
-					kern_modules_control[i].name);
+					modules[i].name);
 		} else {
 			DBG("Modprobe successfully %s",
-					kern_modules_control[i].name);
+					modules[i].name);
 		}
 	}
 
@@ -198,37 +176,18 @@ error:
 }
 
 /*
+ * Load control kernel module(s).
+ */
+int modprobe_lttng_control(void)
+{
+	return modprobe_lttng(kern_modules_control,
+			      ARRAY_SIZE(kern_modules_control));
+}
+/*
  * Load data kernel module(s).
  */
 int modprobe_lttng_data(void)
 {
-	int ret = 0, i;
-	char modprobe[256];
-
-	for (i = 0; i < ARRAY_SIZE(kern_modules_list); i++) {
-		ret = snprintf(modprobe, sizeof(modprobe),
-				"/sbin/modprobe %s%s",
-				kern_modules_list[i].required ? "" : "-q ",
-				kern_modules_list[i].name);
-		if (ret < 0) {
-			PERROR("snprintf modprobe");
-			goto error;
-		}
-		modprobe[sizeof(modprobe) - 1] = '\0';
-		ret = system(modprobe);
-		if (ret == -1) {
-			ERR("Unable to launch modprobe for module %s",
-					kern_modules_list[i].name);
-		} else if (kern_modules_list[i].required
-				&& WEXITSTATUS(ret) != 0) {
-			ERR("Unable to load module %s",
-					kern_modules_list[i].name);
-		} else {
-			DBG("Modprobe successfully %s",
-					kern_modules_list[i].name);
-		}
-	}
-
-error:
-	return ret;
+	return modprobe_lttng(kern_modules_list,
+			      ARRAY_SIZE(kern_modules_list));
 }
Signature · 1 line
1.7.9.5
#2 lore raw

RFC PATCH 2/4 Seperate probe modules from control modules

In reply to a message not in the archive

Move all control modules to the control list and make a seperate probes list.

---
 src/bin/lttng-sessiond/modprobe.c |   24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
src/bin/lttng-sessiond/modprobe.c +12 -12
index b84c07e..ea3fb39 100644
@@ -25,16 +25,9 @@
 #include "modprobe.h"
 #include "kern-modules.h"
 
-/* MUST be loaded first */
+/* LTTng kernel tracer base modules list */
 const struct kern_modules_param kern_modules_control[] = {
-	{ "lttng-tracer", 1 },
-};
-
-/* LTTng kernel tracer modules list */
-const struct kern_modules_param kern_modules_list[] = {
-	{ "lttng-ftrace", 0 },
-	{ "lttng-kprobes", 0 },
-	{ "lttng-kretprobes", 0 },
+	{ "lttng-tracer", 1 },	/* MUST be loaded first so keep at top */
 	{ "lttng-lib-ring-buffer", 1 },
 	{ "lttng-ring-buffer-client-discard", 1 },
 	{ "lttng-ring-buffer-client-overwrite", 1 },
@@ -43,6 +36,13 @@ const struct kern_modules_param kern_modules_list[] = {
 	{ "lttng-ring-buffer-client-mmap-overwrite", 1 },
 	{ "lttng-ring-buffer-metadata-mmap-client", 1 },
 	{ "lttng-types", 0 },
+	{ "lttng-ftrace", 0 },
+	{ "lttng-kprobes", 0 },
+	{ "lttng-kretprobes", 0 },
+};
+
+/* LTTng kernel tracer probe modules list */
+const struct kern_modules_param kern_modules_probes[] = {
 	{ "lttng-probe-asoc", 0 },
 	{ "lttng-probe-block", 0 },
 	{ "lttng-probe-btrfs", 0 },
@@ -130,7 +130,7 @@ void modprobe_remove_lttng_control(void)
  */
 void modprobe_remove_lttng_data(void)
 {
-	return modprobe_remove_lttng(kern_modules_list,
+	return modprobe_remove_lttng(kern_modules_probes,
 				     ARRAY_SIZE(kern_modules_list));
 }
 
@@ -188,6 +188,6 @@ int modprobe_lttng_control(void)
  */
 int modprobe_lttng_data(void)
 {
-	return modprobe_lttng(kern_modules_list,
-			      ARRAY_SIZE(kern_modules_list));
+	return modprobe_lttng(kern_modules_probes,
+			      ARRAY_SIZE(kern_modules_probes));
 }
Signature · 1 line
1.7.9.5
#3 lore raw

RFC PATCH 3/4 Remove required parameter from module parameters

In reply to a message not in the archive

Remove the per module required parameter by adding another list for optional core modules, so we have:

- required core modules
- optional core modules
- optional probe modules

---
 src/bin/lttng-sessiond/kern-modules.h |    1 -
 src/bin/lttng-sessiond/modprobe.c     |  167 ++++++++++++++++++---------------
 2 files changed, 92 insertions(+), 76 deletions(-)
src/bin/lttng-sessiond/kern-modules.h +0 -1
index 7ce8b0b..ca09fc3 100644
@@ -29,7 +29,6 @@
 
 struct kern_modules_param {
 	const char *name;
-	int required;
 };
 
 #endif /* _KERN_MODULES_H */
src/bin/lttng-sessiond/modprobe.c +92 -75

238 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#4 lore raw

RFC PATCH 4/4 Dynamic probe list support

In reply to a message not in the archive

Create a dynamic probe list if the LTTNG_PROBE_LIST environment variable is set and use it to load these probes. If the environment variable is not set all probes are loaded so the default behaviour is not changed.

---
 src/bin/lttng-sessiond/kern-modules.h |    2 +-
 src/bin/lttng-sessiond/modprobe.c     |   78 ++++++++++++++++++++++++++-------
 src/common/defaults.h                 |    3 ++
 src/common/utils.c                    |   10 +++++
 src/common/utils.h                    |    1 +
 5 files changed, 77 insertions(+), 17 deletions(-)
src/bin/lttng-sessiond/kern-modules.h +1 -1
index ca09fc3..26f4457 100644
@@ -28,7 +28,7 @@
 #define KERN_MODULES_MINOR         0
 
 struct kern_modules_param {
-	const char *name;
+	char *name;
 };
 
 #endif /* _KERN_MODULES_H */
src/bin/lttng-sessiond/modprobe.c +62 -16

143 lines not on this page · raw message

src/common/defaults.h +3 -0
index 7acabf1..6892efd 100644
@@ -90,6 +90,9 @@
 #define DEFAULT_LTTNG_SESSIOND_PIDFILE          "lttng-sessiond.pid"
 #define DEFAULT_LTTNG_SESSIOND_JULPORT_FILE     "jul.port"
 
+/* Default probe list */
+#define DEFAULT_LTTNG_PROBE_LIST		"LTTNG_PROBE_LIST"
+
 /* Default unix socket path */
 #define DEFAULT_GLOBAL_CLIENT_UNIX_SOCK         DEFAULT_LTTNG_RUNDIR "/client-lttng-sessiond"
 #define DEFAULT_HOME_CLIENT_UNIX_SOCK           DEFAULT_LTTNG_HOME_RUNDIR "/client-lttng-sessiond"
src/common/utils.c +10 -0
index 31596dd..12edd2c 100644
@@ -896,6 +896,16 @@ end:
 }
 
 /*
+ * Obtain the value of LTTNG_PROBE_LIST environment variable, if exists.
+ * Otherwise returns an empty string.
+ */
+LTTNG_HIDDEN
+char *utils_get_probe_list(void)
+{
+	return getenv(DEFAULT_LTTNG_PROBE_LIST);
+}
+
+/*
  * With the given format, fill dst with the time of len maximum siz.
  *
  * Return amount of bytes set in the buffer or else 0 on error.
src/common/utils.h +1 -0
index 63290a7..4f61575 100644
@@ -47,6 +47,7 @@ int utils_parse_size_suffix(char *str, uint64_t *size);
 int utils_get_count_order_u32(uint32_t x);
 char *utils_get_home_dir(void);
 char *utils_get_user_home_dir(uid_t uid);
+char *utils_get_probe_list(void);
 size_t utils_get_current_time_str(const char *format, char *dst, size_t len);
 gid_t utils_get_group_id(const char *name);
 char *utils_generate_optstring(const struct option *long_options,
Signature · 1 line
1.7.9.5
#5 lore raw

Re: [RFC Patch Tools 0/4] Configurable lttng-probe modules

In reply to a message not in the archive
Quoted 13 lines · Jan Glauber

Hi LTTng'ers,

I've asked briefly for the configurable probes feature at the Tracing summit, here is an RFC how we could implement it.

Why I want to have this feature:
Currently the LTTng probes that are loaded when a session is created are defined in a static list. If the user wants to change the loaded probes (for instance disable the very noisy rcu) then lttng-tools must be recompiled or the modules must be blacklisted or deleted. I also found that in our embedded environment the default busybox configuration is to disable the blacklist feature, so blacklisting is not an option.

Quoted 6 lines

Therefore I want to have a more flexible way of defining which probes to load on session start. We could use an environment variable that (if present) overrides the default and only loads the probes named in the variable.

Patch 1 is a cleanup and patch 2 & 3 are preparation for the feature in patch 4. Please review and give feedback if this approach is feasible.

Hi Jan,

First of all, thanks for this! Except some syntax issue, this looks great! Sorry took a while to respond, busy busy improving lttng :P.

Before we go further in mergin this, I see you took the approach of adding an env. variable to provide the list of probes you want to load. Right now in the upstream master (for 2.5), we have the support for a configuration file for lttng-sessiond. Could it be a way you would prefer (or use) instead of env. var? I understand that embedded stuff, a conf file might not be preferable.

Anyhow, I'm comfortable merging this and adding this env. var but an option in the configuration file could also be awesome! :)

One thing that would be great if you have a minute, is to send me a patch for the man page update of that new variable.

Cheers!
David

Quoted 14 lines

thanks,
Jan
---
Harman Becker Automotive GmbH
System Profiling & Optimizing Team

Jan Glauber (4):
Use common functions for module loading and unloading Seperate probe modules from control modules Remove required parameter from module parameters Dynamic probe list support

Quoted 15 lines
 src/bin/lttng-sessiond/kern-modules.h |    3 +-
 src/bin/lttng-sessiond/modprobe.c     |  292 ++++++++++++++++++---------------
 src/common/defaults.h                 |    3 +
 src/common/utils.c                    |   10 ++
 src/common/utils.h                    |    1 +
 5 files changed, 172 insertions(+), 137 deletions(-)
Signature · 7 lines
1.7.9.5


_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

#7 lore raw

Re: [RFC Patch Tools 0/4] Configurable lttng-probe modules

In reply to a message not in the archive
Quoted 18 lines · David Goulet
Quoted 17 lines · Jan Glauber

Hi LTTng'ers,

I've asked briefly for the configurable probes feature at the Tracing summit, here is an RFC how we could implement it.

Why I want to have this feature:
Currently the LTTng probes that are loaded when a session is created are defined in a static list. If the user wants to change the loaded probes (for instance disable the very noisy rcu) then lttng-tools must be recompiled or the modules must be blacklisted or deleted. I also found that in our embedded environment the default busybox configuration is to disable the blacklist feature, so blacklisting is not an option.

Therefore I want to have a more flexible way of defining which probes to load on session start. We could use an environment variable that (if present) overrides the default and only loads the probes named in the variable.

Quoted 7 lines
Quoted 2 lines

Patch 1 is a cleanup and patch 2 & 3 are preparation for the feature in patch 4. Please review and give feedback if this approach is feasible.

Hi Jan,

First of all, thanks for this! Except some syntax issue, this looks great! Sorry took a while to respond, busy busy improving lttng :P.

Hi David,

thanks for reviewing! Also, I hope part of the improvement work was to decide on the name for the 2.5 release ;-

Quoted 6 lines

Before we go further in mergin this, I see you took the approach of adding an env. variable to provide the list of probes you want to load. Right now in the upstream master (for 2.5), we have the support for a configuration file for lttng-sessiond. Could it be a way you would prefer (or use) instead of env. var? I understand that embedded stuff, a conf file might not be preferable.

Actually a config file was my first thought also, but I only found the .lttngrc which is generated when a session is started. Where is the sessiond config file located? I don't see a config file under /etc or in the home directory.

Quoted 5 lines

Anyhow, I'm comfortable merging this and adding this env. var but an option in the configuration file could also be awesome! :)

One thing that would be great if you have a minute, is to send me a patch for the man page update of that new variable.

I'll do that when we've decided about config file vs. env variable...

--Jan

Quoted 32 lines

Cheers!
David

Quoted 29 lines

thanks,
Jan
---
Harman Becker Automotive GmbH
System Profiling & Optimizing Team

Jan Glauber (4):
Use common functions for module loading and unloading Seperate probe modules from control modules Remove required parameter from module parameters Dynamic probe list support

 src/bin/lttng-sessiond/kern-modules.h |    3 +-
 src/bin/lttng-sessiond/modprobe.c     |  292 ++++++++++++++++++---------------
 src/common/defaults.h                 |    3 +
 src/common/utils.c                    |   10 ++
 src/common/utils.h                    |    1 +
 5 files changed, 172 insertions(+), 137 deletions(-)
Signature · 7 lines
1.7.9.5


_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
#9 lore raw

Re: [RFC Patch Tools 0/4] Configurable lttng-probe modules

In reply to a message not in the archive
Quoted 24 lines · Jan Glauber
Quoted 23 lines · David Goulet
Quoted 13 lines · Jan Glauber

Hi LTTng'ers,

I've asked briefly for the configurable probes feature at the Tracing summit, here is an RFC how we could implement it.

Why I want to have this feature:
Currently the LTTng probes that are loaded when a session is created are defined in a static list. If the user wants to change the loaded probes (for instance disable the very noisy rcu) then lttng-tools must be recompiled or the modules must be blacklisted or deleted. I also found that in our embedded environment the default busybox configuration is to disable the blacklist feature, so blacklisting is not an option.

Quoted 6 lines

Therefore I want to have a more flexible way of defining which probes to load on session start. We could use an environment variable that (if present) overrides the default and only loads the probes named in the variable.

Patch 1 is a cleanup and patch 2 & 3 are preparation for the feature in patch 4. Please review and give feedback if this approach is feasible.

Hi Jan,

Quoted 7 lines
Quoted 2 lines

First of all, thanks for this! Except some syntax issue, this looks great! Sorry took a while to respond, busy busy improving lttng :P.

Hi David,

thanks for reviewing! Also, I hope part of the improvement work was to decide on the name for the 2.5 release ;-

Always a priority! :P

Quoted 11 lines
Quoted 7 lines

Before we go further in mergin this, I see you took the approach of adding an env. variable to provide the list of probes you want to load. Right now in the upstream master (for 2.5), we have the support for a configuration file for lttng-sessiond. Could it be a way you would prefer (or use) instead of env. var? I understand that embedded stuff, a conf file might not be preferable.

Actually a config file was my first thought also, but I only found the .lttngrc which is generated when a session is started. Where is the sessiond config file located? I don't see a config file under /etc or in the home directory.

As of now, you have to pass it to the daemon:

  -f  --config                       Load daemon configuration file

For 2.5, we want to have a default config. file installed in /etc/lttng/ and provide also documentation on it with probably a man page.

We went with the INI file format so in our case here I can see a simple option like:

modules = probe1, probe2, probe3, ...

and by default load ALL.

Quoted 8 lines
Quoted 6 lines

Anyhow, I'm comfortable merging this and adding this env. var but an option in the configuration file could also be awesome! :)

One thing that would be great if you have a minute, is to send me a patch for the man page update of that new variable.

I'll do that when we've decided about config file vs. env variable...

Yeah to be thorough, we should have an ENV. variable, command line option and config option. ENV overrides cmdline which overrides config.

For now, I'm OK merging your patches but having at least the configuration option in the config file for 2.5 would be very appreciated.

Cheers!
David

Quoted 38 lines

--Jan

Quoted 32 lines

Cheers!
David

Quoted 29 lines

thanks,
Jan
---
Harman Becker Automotive GmbH
System Profiling & Optimizing Team

Jan Glauber (4):
Use common functions for module loading and unloading Seperate probe modules from control modules Remove required parameter from module parameters Dynamic probe list support

 src/bin/lttng-sessiond/kern-modules.h |    3 +-
 src/bin/lttng-sessiond/modprobe.c     |  292 ++++++++++++++++++---------------
 src/common/defaults.h                 |    3 +
 src/common/utils.c                    |   10 ++
 src/common/utils.h                    |    1 +
 5 files changed, 172 insertions(+), 137 deletions(-)
Signature · 7 lines
1.7.9.5


_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

#11 lore raw

Re: [RFC Patch Tools 0/4] Configurable lttng-probe modules

In reply to a message not in the archive

----- Original Message -----

Quoted 83 lines

From: "David Goulet" <[email protected]>
To: "Jan Glauber" <[email protected]>
Cc: [email protected]
Sent: Monday, April 14, 2014 8:40:51 PM
Subject: Re: [lttng-dev] [RFC Patch Tools 0/4] Configurable lttng-probe modules

Quoted 33 lines · Jan Glauber
Quoted 32 lines · David Goulet
Quoted 25 lines · Jan Glauber

Hi LTTng'ers,

I've asked briefly for the configurable probes feature at the Tracing summit,
here is an RFC how we could implement it.

Why I want to have this feature:
Currently the LTTng probes that are loaded when a session is created are defined
in a static list. If the user wants to change the loaded probes (for instance
disable the very noisy rcu) then lttng-tools must be recompiled or the modules must
be blacklisted or deleted. I also found that in our embedded environment the default
busybox configuration is to disable the blacklist feature, so blacklisting is not an
option.

Therefore I want to have a more flexible way of defining which probes to load
on session start. We could use an environment variable that (if present)
overrides the default and only loads the probes named in the variable.

Quoted 3 lines

Patch 1 is a cleanup and patch 2 & 3 are preparation for the feature in patch 4.
Please review and give feedback if this approach is feasible.

Hi Jan,

Quoted 8 lines
Quoted 2 lines

First of all, thanks for this! Except some syntax issue, this looks great! Sorry took a while to respond, busy busy improving lttng :P.

Hi David,

thanks for reviewing! Also, I hope part of the improvement work was to decide
on the name for the 2.5 release ;-

Always a priority! :P

Quoted 8 lines
Quoted 7 lines

Before we go further in mergin this, I see you took the approach of adding an env. variable to provide the list of probes you want to load. Right now in the upstream master (for 2.5), we have the support for a configuration file for lttng-sessiond. Could it be a way you would prefer (or use) instead of env. var? I understand that embedded stuff, a conf file might not be preferable.

Quoted 5 lines

Actually a config file was my first thought also, but I only found the .lttngrc
which is generated when a session is started. Where is the sessiond config file
located? I don't see a config file under /etc or in the home directory.

As of now, you have to pass it to the daemon:

  -f  --config                       Load daemon configuration file

For 2.5, we want to have a default config. file installed in /etc/lttng/ and provide also documentation on it with probably a man page.

We went with the INI file format so in our case here I can see a simple option like:

modules = probe1, probe2, probe3, ...

and by default load ALL.

Quoted 4 lines
Quoted 4 lines

Anyhow, I'm comfortable merging this and adding this env. var but an option in the configuration file could also be awesome! :)

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

One thing that would be great if you have a minute, is to send me a patch for the man page update of that new variable.

I'll do that when we've decided about config file vs. env variable...

Yeah to be thorough, we should have an ENV. variable, command line option and config option. ENV overrides cmdline which overrides config.

Did you rather mean:

- environment variables override config.
- cmdline options override environment variables and config,

Thanks,

Mathieu

Quoted 53 lines

For now, I'm OK merging your patches but having at least the configuration option in the config file for 2.5 would be very appreciated.

Cheers!
David

Quoted 39 lines

--Jan

Quoted 33 lines

Cheers!
David

Quoted 30 lines

thanks,
Jan
---
Harman Becker Automotive GmbH
System Profiling & Optimizing Team

Jan Glauber (4):
Use common functions for module loading and unloading Seperate probe modules from control modules Remove required parameter from module parameters Dynamic probe list support

 src/bin/lttng-sessiond/kern-modules.h |    3 +-
 src/bin/lttng-sessiond/modprobe.c     |  292
 ++++++++++++++++++---------------
 src/common/defaults.h                 |    3 +
 src/common/utils.c                    |   10 ++
 src/common/utils.h                    |    1 +
 5 files changed, 172 insertions(+), 137 deletions(-)

--
1.7.9.5

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

Signature · 3 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
#12 lore raw

Re: [RFC Patch Tools 0/4] Configurable lttng-probe modules

In reply to a message not in the archive
Quoted 2 lines · David Goulet
Quoted 1 line · Jan Glauber

On Thu, Apr 10, 2014 at 03:45:51PM -0400, David Goulet wrote:

Hi David,

sorry for my vacational late response. Some more questions...

Quoted 11 lines

As of now, you have to pass it to the daemon:

  -f  --config                       Load daemon configuration file

For 2.5, we want to have a default config. file installed in /etc/lttng/ and provide also documentation on it with probably a man page.

We went with the INI file format so in our case here I can see a simple option like:

modules = probe1, probe2, probe3, ...

For the env variable I choose an PATH-like format so currently it is:
"probe1:probe2:...".
Should I change this to match the config file format then?

Quoted 5 lines

and by default load ALL.

Quoted 3 lines
Quoted 3 lines

Anyhow, I'm comfortable merging this and adding this env. var but an option in the configuration file could also be awesome! :)

I'm looking into this now but its not obvious to me how the config file should look like. If I provide an empty config file lttng seems to not have any config options and fails to start. So do you have an example of a working config file?

I guess because its INI based there should be sections? Which?

Jan

#14 lore raw

PATCH v2 1/1 Dynamic probe list support

In reply to a message not in the archive

Hi David,

I did a respin to add the command line option and the man page description. If you still want the config file support please answer my previous questions.

V2 Changes:
- add command line option --kmod-probes to lttng-sessiond
Note: The command line option only works if lttng-sessiond is started manually because the lttng tool does currently not pass the option to the lttng-sessiond.
- document command line option and env variable in man page
- change the env variable delimeter to "," instead of ":" and allow spaces in the list
- rename the env variable to LTTNG_KMOD_PROBES

Create a kernel module probes list and use it to load the specified probes. The probes are selectable by the --kmod-probes command line option to lttng-sessiond or the LTTNG_KMOD_PROBES environment variable. If neither is set all probes are loaded so the current behaviour is not changed.

---
 doc/man/lttng-sessiond.8              |    7 +++
 src/bin/lttng-sessiond/kern-modules.h |    2 +-
 src/bin/lttng-sessiond/main.c         |    5 ++
 src/bin/lttng-sessiond/modprobe.c     |   87 +++++++++++++++++++++++++++------
 src/bin/lttng-sessiond/modprobe.h     |    2 +
 src/common/defaults.h                 |    3 ++
 src/common/utils.c                    |   10 ++++
 src/common/utils.h                    |    1 +
 8 files changed, 102 insertions(+), 15 deletions(-)
doc/man/lttng-sessiond.8 +7 -0
index 633cf81..133c69f 100644
@@ -81,6 +81,11 @@ No kernel tracer support
 .BR "    --jul-tcp-port"
 JUL application registration TCP port (default: 5345)
 .TP
+.BR "    --kmod-probes=probe1, probe2, ..."
+Specify the kernel modules containing LTTng probes to load by the session daemon.
+Only the component name of the probe needs to be specified, e.g. to load the
+lttng-probe-irq and lttng-probe-sched use: --kmod-probes="irq, sched".
+.TP
 .BR "-c, --client-sock=PATH"
 Specify path for the client unix socket
 .TP
@@ -150,6 +155,8 @@ parameter: the timeout value, in milliseconds. A value of 0 or -1 uses
 the timeout of the operating system (this is the default).
 .IP "LTTNG_SESSION_CONFIG_XSD_PATH"
 Specify the path that contains the XML session configuration schema (xsd).
+.IP "LTTNG_KMOD_PROBES"
+Specify the kernel modules probes that should be loaded by the session daemon.
 .SH "SEE ALSO"
 
 .PP
src/bin/lttng-sessiond/kern-modules.h +1 -1
index ca09fc3..26f4457 100644
@@ -28,7 +28,7 @@
 #define KERN_MODULES_MINOR         0
 
 struct kern_modules_param {
-	const char *name;
+	char *name;
 };
 
 #endif /* _KERN_MODULES_H */
src/bin/lttng-sessiond/main.c +5 -0
index 052e32e..c90cfe1 100644
@@ -152,6 +152,7 @@ static const struct option long_options[] = {
 	{ "pidfile", 1, 0, 'p' },
 	{ "jul-tcp-port", 1, 0, 'J' },
 	{ "config", 1, 0, 'f' },
+	{ "kmod-probes", 1, 0, 'P' },
 	{ NULL, 0, 0, 0 }
 };
 
@@ -4110,6 +4111,7 @@ static void usage(void)
 	fprintf(stderr, "      --no-kernel                    Disable kernel tracer\n");
 	fprintf(stderr, "      --jul-tcp-port                 JUL application registration TCP port\n");
 	fprintf(stderr, "  -f  --config                       Load daemon configuration file\n");
+	fprintf(stderr, "      --kmod-probes                  Specify kernel module probes to load\n");
 }
 
 /*
@@ -4229,6 +4231,9 @@ static int set_option(int opt, const char *arg, const char *optname)
 		DBG3("JUL TCP port set to non default: %u", jul_tcp_port);
 		break;
 	}
+	case 'P': /* probe modules list */
+		kmod_probes_list = strdup(arg);
+		break;
 	default:
 		/* Unknown option or other error.
 		 * Error is printed by getopt, just return */
src/bin/lttng-sessiond/modprobe.c +73 -14

140 lines not on this page · raw message

src/bin/lttng-sessiond/modprobe.h +2 -0
index 0c6f5f1..42e1912 100644
@@ -24,4 +24,6 @@ void modprobe_remove_lttng_data(void);
 int modprobe_lttng_control(void);
 int modprobe_lttng_data(void);
 
+char *kmod_probes_list;
+
 #endif /* _MODPROBE_H */
src/common/defaults.h +3 -0
index de61064..b49bf4b 100644
@@ -90,6 +90,9 @@
 #define DEFAULT_LTTNG_SESSIOND_PIDFILE          "lttng-sessiond.pid"
 #define DEFAULT_LTTNG_SESSIOND_JULPORT_FILE     "jul.port"
 
+/* Default probes list */
+#define DEFAULT_LTTNG_KMOD_PROBES		"LTTNG_KMOD_PROBES"
+
 /* Default unix socket path */
 #define DEFAULT_GLOBAL_CLIENT_UNIX_SOCK         DEFAULT_LTTNG_RUNDIR "/client-lttng-sessiond"
 #define DEFAULT_HOME_CLIENT_UNIX_SOCK           DEFAULT_LTTNG_HOME_RUNDIR "/client-lttng-sessiond"
src/common/utils.c +10 -0
index 815965b..78f858c 100644
@@ -870,6 +870,16 @@ end:
 }
 
 /*
+ * Obtain the value of LTTNG_KMOD_PROBES environment variable, if exists.
+ * Otherwise returns an empty string.
+ */
+LTTNG_HIDDEN
+char *utils_get_kmod_probes_list(void)
+{
+	return getenv(DEFAULT_LTTNG_KMOD_PROBES);
+}
+
+/*
  * With the given format, fill dst with the time of len maximum siz.
  *
  * Return amount of bytes set in the buffer or else 0 on error.
src/common/utils.h +1 -0
index b872b53..cc80a53 100644
@@ -47,6 +47,7 @@ int utils_parse_size_suffix(char const * const str, uint64_t * const size);
 int utils_get_count_order_u32(uint32_t x);
 char *utils_get_home_dir(void);
 char *utils_get_user_home_dir(uid_t uid);
+char *utils_get_kmod_probes_list(void);
 size_t utils_get_current_time_str(const char *format, char *dst, size_t len);
 gid_t utils_get_group_id(const char *name);
 char *utils_generate_optstring(const struct option *long_options,
Signature · 1 line
1.7.9.5
#16 lore raw

Re: [RFC Patch Tools 3/4] Remove required parameter from module parameters

In reply to a message not in the archive

Hi Jan,

I was merging those for 2.5 but this one (3/4) does not apply. I tried to play with it but I can't make it work.

The only thing that has changed is that we've added a module lately but even by modifying your patch to add that module, it still does not apply.

Do you think you can simply rebase those on upstream master and send it back to me? (You can also send me a branch, I'm fine with emails or branch).

Big thanks!
David

Quoted 283 lines · Jan Glauber

Remove the per module required parameter by adding another list for optional core modules, so we have:

- required core modules
- optional core modules
- optional probe modules

---
 src/bin/lttng-sessiond/kern-modules.h |    1 -
 src/bin/lttng-sessiond/modprobe.c     |  167 ++++++++++++++++++---------------
 2 files changed, 92 insertions(+), 76 deletions(-)
src/bin/lttng-sessiond/kern-modules.h +0 -1
index 7ce8b0b..ca09fc3 100644
@@ -29,7 +29,6 @@
 
 struct kern_modules_param {
 	const char *name;
-	int required;
 };
 
 #endif /* _KERN_MODULES_H */
src/bin/lttng-sessiond/modprobe.c +92 -75
index ea3fb39..79a01ea 100644
@@ -25,65 +25,72 @@
 #include "modprobe.h"
 #include "kern-modules.h"
 
-/* LTTng kernel tracer base modules list */
-const struct kern_modules_param kern_modules_control[] = {
-	{ "lttng-tracer", 1 },	/* MUST be loaded first so keep at top */
-	{ "lttng-lib-ring-buffer", 1 },
-	{ "lttng-ring-buffer-client-discard", 1 },
-	{ "lttng-ring-buffer-client-overwrite", 1 },
-	{ "lttng-ring-buffer-metadata-client", 1 },
-	{ "lttng-ring-buffer-client-mmap-discard", 1 },
-	{ "lttng-ring-buffer-client-mmap-overwrite", 1 },
-	{ "lttng-ring-buffer-metadata-mmap-client", 1 },
-	{ "lttng-types", 0 },
-	{ "lttng-ftrace", 0 },
-	{ "lttng-kprobes", 0 },
-	{ "lttng-kretprobes", 0 },
+#define LTTNG_MOD_REQUIRED	1
+#define LTTNG_MOD_OPTIONAL	0
+
+/* LTTng kernel tracer mandatory core modules list */
+const struct kern_modules_param kern_modules_control_core[] = {
+	{ "lttng-tracer" },	/* MUST be loaded first so keep at top */
+	{ "lttng-lib-ring-buffer" },
+	{ "lttng-ring-buffer-client-discard" },
+	{ "lttng-ring-buffer-client-overwrite" },
+	{ "lttng-ring-buffer-metadata-client" },
+	{ "lttng-ring-buffer-client-mmap-discard" },
+	{ "lttng-ring-buffer-client-mmap-overwrite" },
+	{ "lttng-ring-buffer-metadata-mmap-client" },
+};
+
+/* LTTng kernel tracer optional base modules list */
+const struct kern_modules_param kern_modules_control_opt[] = {
+	{ "lttng-types" },
+	{ "lttng-ftrace" },
+	{ "lttng-kprobes" },
+	{ "lttng-kretprobes" },
 };
 
 /* LTTng kernel tracer probe modules list */
 const struct kern_modules_param kern_modules_probes[] = {
-	{ "lttng-probe-asoc", 0 },
-	{ "lttng-probe-block", 0 },
-	{ "lttng-probe-btrfs", 0 },
-	{ "lttng-probe-compaction", 0 },
-	{ "lttng-probe-ext3", 0 },
-	{ "lttng-probe-ext4", 0 },
-	{ "lttng-probe-gpio", 0 },
-	{ "lttng-probe-irq", 0 },
-	{ "lttng-probe-jbd", 0 },
-	{ "lttng-probe-jbd2", 0 },
-	{ "lttng-probe-kmem", 0 },
-	{ "lttng-probe-kvm", 0 },
-	{ "lttng-probe-kvm-x86", 0 },
-	{ "lttng-probe-kvm-x86-mmu", 0 },
-	{ "lttng-probe-lock", 0 },
-	{ "lttng-probe-module", 0 },
-	{ "lttng-probe-napi", 0 },
-	{ "lttng-probe-net", 0 },
-	{ "lttng-probe-power", 0 },
-	{ "lttng-probe-printk", 0 },
-	{ "lttng-probe-random", 0 },
-	{ "lttng-probe-rcu", 0 },
-	{ "lttng-probe-regmap", 0 },
-	{ "lttng-probe-regulator", 0 },
-	{ "lttng-probe-rpm", 0 },
-	{ "lttng-probe-sched", 0 },
-	{ "lttng-probe-scsi", 0 },
-	{ "lttng-probe-signal", 0 },
-	{ "lttng-probe-skb", 0 },
-	{ "lttng-probe-sock", 0 },
-	{ "lttng-probe-statedump", 0 },
-	{ "lttng-probe-sunrpc", 0 },
-	{ "lttng-probe-timer", 0 },
-	{ "lttng-probe-udp", 0 },
-	{ "lttng-probe-vmscan", 0 },
-	{ "lttng-probe-workqueue", 0 },
-	{ "lttng-probe-writeback", 0 },
+	{ "lttng-probe-asoc" },
+	{ "lttng-probe-block" },
+	{ "lttng-probe-btrfs" },
+	{ "lttng-probe-compaction" },
+	{ "lttng-probe-ext3" },
+	{ "lttng-probe-ext4" },
+	{ "lttng-probe-gpio" },
+	{ "lttng-probe-irq" },
+	{ "lttng-probe-jbd" },
+	{ "lttng-probe-jbd2" },
+	{ "lttng-probe-kmem" },
+	{ "lttng-probe-kvm" },
+	{ "lttng-probe-kvm-x86" },
+	{ "lttng-probe-kvm-x86-mmu" },
+	{ "lttng-probe-lock" },
+	{ "lttng-probe-module" },
+	{ "lttng-probe-napi" },
+	{ "lttng-probe-net" },
+	{ "lttng-probe-power" },
+	{ "lttng-probe-printk" },
+	{ "lttng-probe-random" },
+	{ "lttng-probe-rcu" },
+	{ "lttng-probe-regmap" },
+	{ "lttng-probe-regulator" },
+	{ "lttng-probe-rpm" },
+	{ "lttng-probe-sched" },
+	{ "lttng-probe-scsi" },
+	{ "lttng-probe-signal" },
+	{ "lttng-probe-skb" },
+	{ "lttng-probe-sock" },
+	{ "lttng-probe-statedump" },
+	{ "lttng-probe-sunrpc" },
+	{ "lttng-probe-timer" },
+	{ "lttng-probe-udp" },
+	{ "lttng-probe-vmscan" },
+	{ "lttng-probe-workqueue" },
+	{ "lttng-probe-writeback" },
 };
 
 void modprobe_remove_lttng(const struct kern_modules_param *modules,
-			   int entries)
+			   int entries, int required)
 {
 	int ret = 0, i;
 	char modprobe[256];
@@ -94,26 +101,21 @@ void modprobe_remove_lttng(const struct kern_modules_param *modules,
 				modules[i].name);
 		if (ret < 0) {
 			PERROR("snprintf modprobe -r");
-			goto error;
+			return;
 		}
 		modprobe[sizeof(modprobe) - 1] = '\0';
 		ret = system(modprobe);
 		if (ret == -1) {
 			ERR("Unable to launch modprobe -r for module %s",
-					kern_modules_control[i].name);
-		} else if (kern_modules_control[i].required
-				&& WEXITSTATUS(ret) != 0) {
+					modules[i].name);
+		} else if (required && WEXITSTATUS(ret) != 0) {
 			ERR("Unable to remove module %s",
-					kern_modules_control[i].name);
+					modules[i].name);
 		} else {
 			DBG("Modprobe removal successful %s",
-					kern_modules_control[i].name);
+					modules[i].name);
 		}
 	}
-
-error:
-	return;
-
 }
 
 /*
@@ -121,8 +123,12 @@ error:
  */
 void modprobe_remove_lttng_control(void)
 {
-	return modprobe_remove_lttng(kern_modules_control,
-				     ARRAY_SIZE(kern_modules_control));
+	modprobe_remove_lttng(kern_modules_control_opt,
+				    ARRAY_SIZE(kern_modules_control_opt),
+				    LTTNG_MOD_OPTIONAL);
+	modprobe_remove_lttng(kern_modules_control_core,
+				     ARRAY_SIZE(kern_modules_control_core),
+				     LTTNG_MOD_REQUIRED);
 }
 
 /*
@@ -131,7 +137,8 @@ void modprobe_remove_lttng_control(void)
 void modprobe_remove_lttng_data(void)
 {
 	return modprobe_remove_lttng(kern_modules_probes,
-				     ARRAY_SIZE(kern_modules_list));
+				     ARRAY_SIZE(kern_modules_probes),
+				     LTTNG_MOD_OPTIONAL);
 }
 
 /*
@@ -143,7 +150,8 @@ void modprobe_remove_lttng_all(void)
 	modprobe_remove_lttng_control();
 }
 
-static int modprobe_lttng(const struct kern_modules_param *modules, int entries)
+static int modprobe_lttng(const struct kern_modules_param *modules,
+			  int entries, int required)
 {
 	int ret = 0, i;
 	char modprobe[256];
@@ -151,7 +159,7 @@ static int modprobe_lttng(const struct kern_modules_param *modules, int entries)
 	for (i = 0; i < entries; i++) {
 		ret = snprintf(modprobe, sizeof(modprobe),
 				"/sbin/modprobe %s%s",
-				modules[i].required ? "" : "-q ",
+				required ? "" : "-q ",
 				modules[i].name);
 		if (ret < 0) {
 			PERROR("snprintf modprobe");
@@ -162,12 +170,10 @@ static int modprobe_lttng(const struct kern_modules_param *modules, int entries)
 		if (ret == -1) {
 			ERR("Unable to launch modprobe for module %s",
 					modules[i].name);
-		} else if (modules[i].required && WEXITSTATUS(ret) != 0) {
-			ERR("Unable to load module %s",
-					modules[i].name);
+		} else if (required && WEXITSTATUS(ret) != 0) {
+			ERR("Unable to load module %s", modules[i].name);
 		} else {
-			DBG("Modprobe successfully %s",
-					modules[i].name);
+			DBG("Modprobe successfully %s", modules[i].name);
 		}
 	}
 
@@ -180,14 +186,25 @@ error:
  */
 int modprobe_lttng_control(void)
 {
-	return modprobe_lttng(kern_modules_control,
-			      ARRAY_SIZE(kern_modules_control));
+	int ret;
+
+	ret = modprobe_lttng(kern_modules_control_core,
+			     ARRAY_SIZE(kern_modules_control_core),
+			     LTTNG_MOD_REQUIRED);
+	if (ret != 0)
+		return ret;
+	ret = modprobe_lttng(kern_modules_control_opt,
+			      ARRAY_SIZE(kern_modules_control_opt),
+			      LTTNG_MOD_OPTIONAL);
+	return ret;
 }
+
 /*
  * Load data kernel module(s).
  */
 int modprobe_lttng_data(void)
 {
 	return modprobe_lttng(kern_modules_probes,
-			      ARRAY_SIZE(kern_modules_probes));
+			      ARRAY_SIZE(kern_modules_probes),
+			      LTTNG_MOD_OPTIONAL);
 }
Signature · 7 lines
1.7.9.5


_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

#18 lore raw

Re: [RFC Patch Tools 3/4] Remove required parameter from module parameters

In reply to a message not in the archive

Hi David,
OK, I'll rebase onto upstream master and resend the whole series.

thanks, Jan

2014-05-13 19:47 GMT+02:00 David Goulet <[email protected]>:

Quoted 303 lines

Hi Jan,

I was merging those for 2.5 but this one (3/4) does not apply. I tried to play with it but I can't make it work.

The only thing that has changed is that we've added a module lately but even by modifying your patch to add that module, it still does not apply.

Do you think you can simply rebase those on upstream master and send it back to me? (You can also send me a branch, I'm fine with emails or branch).

Big thanks!
David

Quoted 11 lines · Jan Glauber

Remove the per module required parameter by adding another list for optional core modules, so we have:

- required core modules
- optional core modules
- optional probe modules

---
 src/bin/lttng-sessiond/kern-modules.h |    1 -
 src/bin/lttng-sessiond/modprobe.c     |  167

++++++++++++++++++---------------

Review

Quoted 3 lines
 2 files changed, 92 insertions(+), 76 deletions(-)
(quoted diff) +0 -0

b/src/bin/lttng-sessiond/kern-modules.h

Review

Quoted 12 lines

index 7ce8b0b..ca09fc3 100644

src/bin/lttng-sessiond/kern-modules.h +0 -1
@@ -29,7 +29,6 @@
 
 struct kern_modules_param {
      const char *name;
-     int required;
 };
 
 #endif /* _KERN_MODULES_H */
(quoted diff) +0 -0

b/src/bin/lttng-sessiond/modprobe.c

src/bin/lttng-sessiond/modprobe.c void modprobe_remove_lttng(const struct

Quoted 129 lines

index ea3fb39..79a01ea 100644

src/bin/lttng-sessiond/modprobe.c +59 -52
@@ -25,65 +25,72 @@
 #include "modprobe.h"
 #include "kern-modules.h"
 
-/* LTTng kernel tracer base modules list */
-const struct kern_modules_param kern_modules_control[] = {
-     { "lttng-tracer", 1 },  /* MUST be loaded first so keep at top */
-     { "lttng-lib-ring-buffer", 1 },
-     { "lttng-ring-buffer-client-discard", 1 },
-     { "lttng-ring-buffer-client-overwrite", 1 },
-     { "lttng-ring-buffer-metadata-client", 1 },
-     { "lttng-ring-buffer-client-mmap-discard", 1 },
-     { "lttng-ring-buffer-client-mmap-overwrite", 1 },
-     { "lttng-ring-buffer-metadata-mmap-client", 1 },
-     { "lttng-types", 0 },
-     { "lttng-ftrace", 0 },
-     { "lttng-kprobes", 0 },
-     { "lttng-kretprobes", 0 },
+#define LTTNG_MOD_REQUIRED   1
+#define LTTNG_MOD_OPTIONAL   0
+
+/* LTTng kernel tracer mandatory core modules list */
+const struct kern_modules_param kern_modules_control_core[] = {
+     { "lttng-tracer" },     /* MUST be loaded first so keep at top */
+     { "lttng-lib-ring-buffer" },
+     { "lttng-ring-buffer-client-discard" },
+     { "lttng-ring-buffer-client-overwrite" },
+     { "lttng-ring-buffer-metadata-client" },
+     { "lttng-ring-buffer-client-mmap-discard" },
+     { "lttng-ring-buffer-client-mmap-overwrite" },
+     { "lttng-ring-buffer-metadata-mmap-client" },
+};
+
+/* LTTng kernel tracer optional base modules list */
+const struct kern_modules_param kern_modules_control_opt[] = {
+     { "lttng-types" },
+     { "lttng-ftrace" },
+     { "lttng-kprobes" },
+     { "lttng-kretprobes" },
 };
 
 /* LTTng kernel tracer probe modules list */
 const struct kern_modules_param kern_modules_probes[] = {
-     { "lttng-probe-asoc", 0 },
-     { "lttng-probe-block", 0 },
-     { "lttng-probe-btrfs", 0 },
-     { "lttng-probe-compaction", 0 },
-     { "lttng-probe-ext3", 0 },
-     { "lttng-probe-ext4", 0 },
-     { "lttng-probe-gpio", 0 },
-     { "lttng-probe-irq", 0 },
-     { "lttng-probe-jbd", 0 },
-     { "lttng-probe-jbd2", 0 },
-     { "lttng-probe-kmem", 0 },
-     { "lttng-probe-kvm", 0 },
-     { "lttng-probe-kvm-x86", 0 },
-     { "lttng-probe-kvm-x86-mmu", 0 },
-     { "lttng-probe-lock", 0 },
-     { "lttng-probe-module", 0 },
-     { "lttng-probe-napi", 0 },
-     { "lttng-probe-net", 0 },
-     { "lttng-probe-power", 0 },
-     { "lttng-probe-printk", 0 },
-     { "lttng-probe-random", 0 },
-     { "lttng-probe-rcu", 0 },
-     { "lttng-probe-regmap", 0 },
-     { "lttng-probe-regulator", 0 },
-     { "lttng-probe-rpm", 0 },
-     { "lttng-probe-sched", 0 },
-     { "lttng-probe-scsi", 0 },
-     { "lttng-probe-signal", 0 },
-     { "lttng-probe-skb", 0 },
-     { "lttng-probe-sock", 0 },
-     { "lttng-probe-statedump", 0 },
-     { "lttng-probe-sunrpc", 0 },
-     { "lttng-probe-timer", 0 },
-     { "lttng-probe-udp", 0 },
-     { "lttng-probe-vmscan", 0 },
-     { "lttng-probe-workqueue", 0 },
-     { "lttng-probe-writeback", 0 },
+     { "lttng-probe-asoc" },
+     { "lttng-probe-block" },
+     { "lttng-probe-btrfs" },
+     { "lttng-probe-compaction" },
+     { "lttng-probe-ext3" },
+     { "lttng-probe-ext4" },
+     { "lttng-probe-gpio" },
+     { "lttng-probe-irq" },
+     { "lttng-probe-jbd" },
+     { "lttng-probe-jbd2" },
+     { "lttng-probe-kmem" },
+     { "lttng-probe-kvm" },
+     { "lttng-probe-kvm-x86" },
+     { "lttng-probe-kvm-x86-mmu" },
+     { "lttng-probe-lock" },
+     { "lttng-probe-module" },
+     { "lttng-probe-napi" },
+     { "lttng-probe-net" },
+     { "lttng-probe-power" },
+     { "lttng-probe-printk" },
+     { "lttng-probe-random" },
+     { "lttng-probe-rcu" },
+     { "lttng-probe-regmap" },
+     { "lttng-probe-regulator" },
+     { "lttng-probe-rpm" },
+     { "lttng-probe-sched" },
+     { "lttng-probe-scsi" },
+     { "lttng-probe-signal" },
+     { "lttng-probe-skb" },
+     { "lttng-probe-sock" },
+     { "lttng-probe-statedump" },
+     { "lttng-probe-sunrpc" },
+     { "lttng-probe-timer" },
+     { "lttng-probe-udp" },
+     { "lttng-probe-vmscan" },
+     { "lttng-probe-workqueue" },
+     { "lttng-probe-writeback" },
 };
 
 void modprobe_remove_lttng(const struct kern_modules_param *modules,
-                        int entries)
+                        int entries, int required)
 {
      int ret = 0, i;
      char modprobe[256];
@@ -94,26 +101,21 @@ void modprobe_remove_lttng(const struct

kern_modules_param *modules,

Quoted 57 lines
src/bin/lttng-sessiond/modprobe.c +13 -13
                              modules[i].name);
              if (ret < 0) {
                      PERROR("snprintf modprobe -r");
-                     goto error;
+                     return;
              }
              modprobe[sizeof(modprobe) - 1] = '\0';
              ret = system(modprobe);
              if (ret == -1) {
                      ERR("Unable to launch modprobe -r for module %s",
-                                     kern_modules_control[i].name);
-             } else if (kern_modules_control[i].required
-                             && WEXITSTATUS(ret) != 0) {
+                                     modules[i].name);
+             } else if (required && WEXITSTATUS(ret) != 0) {
                      ERR("Unable to remove module %s",
-                                     kern_modules_control[i].name);
+                                     modules[i].name);
              } else {
                      DBG("Modprobe removal successful %s",
-                                     kern_modules_control[i].name);
+                                     modules[i].name);
              }
      }
-
-error:
-     return;
-
 }
 
 /*
@@ -121,8 +123,12 @@ error:
  */
 void modprobe_remove_lttng_control(void)
 {
-     return modprobe_remove_lttng(kern_modules_control,
-                                  ARRAY_SIZE(kern_modules_control));
+     modprobe_remove_lttng(kern_modules_control_opt,
+                                 ARRAY_SIZE(kern_modules_control_opt),
+                                 LTTNG_MOD_OPTIONAL);
+     modprobe_remove_lttng(kern_modules_control_core,
+                                  ARRAY_SIZE(kern_modules_control_core),
+                                  LTTNG_MOD_REQUIRED);
 }
 
 /*
@@ -131,7 +137,8 @@ void modprobe_remove_lttng_control(void)
 void modprobe_remove_lttng_data(void)
 {
      return modprobe_remove_lttng(kern_modules_probes,
-                                  ARRAY_SIZE(kern_modules_list));
+                                  ARRAY_SIZE(kern_modules_probes),
+                                  LTTNG_MOD_OPTIONAL);
 }
 
 /*

src/bin/lttng-sessiond/modprobe.c void modprobe_remove_lttng_all(void) · line 146

Quoted 4 lines
src/bin/lttng-sessiond/modprobe.c +0 -1
@@ -143,7 +150,8 @@ void modprobe_remove_lttng_all(void)
      modprobe_remove_lttng_control();
 }
 
-static int modprobe_lttng(const struct kern_modules_param *modules, int

entries)

src/bin/lttng-sessiond/modprobe.c static int modprobe_lttng(const struct

Quoted 6 lines
src/bin/lttng-sessiond/modprobe.c +2 -0
+static int modprobe_lttng(const struct kern_modules_param *modules,
+                       int entries, int required)
 {
      int ret = 0, i;
      char modprobe[256];
@@ -151,7 +159,7 @@ static int modprobe_lttng(const struct

kern_modules_param *modules, int entries)

src/bin/lttng-sessiond/modprobe.c static int modprobe_lttng(const struct

Quoted 9 lines
src/bin/lttng-sessiond/modprobe.c +1 -1
      for (i = 0; i < entries; i++) {
              ret = snprintf(modprobe, sizeof(modprobe),
                              "/sbin/modprobe %s%s",
-                             modules[i].required ? "" : "-q ",
+                             required ? "" : "-q ",
                              modules[i].name);
              if (ret < 0) {
                      PERROR("snprintf modprobe");
@@ -162,12 +170,10 @@ static int modprobe_lttng(const struct

kern_modules_param *modules, int entries)

Quoted 48 lines
src/bin/lttng-sessiond/modprobe.c +17 -9
              if (ret == -1) {
                      ERR("Unable to launch modprobe for module %s",
                                      modules[i].name);
-             } else if (modules[i].required && WEXITSTATUS(ret) != 0) {
-                     ERR("Unable to load module %s",
-                                     modules[i].name);
+             } else if (required && WEXITSTATUS(ret) != 0) {
+                     ERR("Unable to load module %s", modules[i].name);
              } else {
-                     DBG("Modprobe successfully %s",
-                                     modules[i].name);
+                     DBG("Modprobe successfully %s", modules[i].name);
              }
      }
 
@@ -180,14 +186,25 @@ error:
  */
 int modprobe_lttng_control(void)
 {
-     return modprobe_lttng(kern_modules_control,
-                           ARRAY_SIZE(kern_modules_control));
+     int ret;
+
+     ret = modprobe_lttng(kern_modules_control_core,
+                          ARRAY_SIZE(kern_modules_control_core),
+                          LTTNG_MOD_REQUIRED);
+     if (ret != 0)
+             return ret;
+     ret = modprobe_lttng(kern_modules_control_opt,
+                           ARRAY_SIZE(kern_modules_control_opt),
+                           LTTNG_MOD_OPTIONAL);
+     return ret;
 }
+
 /*
  * Load data kernel module(s).
  */
 int modprobe_lttng_data(void)
 {
      return modprobe_lttng(kern_modules_probes,
-                           ARRAY_SIZE(kern_modules_probes));
+                           ARRAY_SIZE(kern_modules_probes),
+                           LTTNG_MOD_OPTIONAL);
 }
--

1.7.9.5

Quoted 5 lines
Quoted 4 lines

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev