[libvirt] [PATCH 06/10] Split QEMU dtrace probes into separate file

Daniel P. Berrange berrange at redhat.com
Mon May 21 19:59:14 UTC 2012


From: "Daniel P. Berrange" <berrange at redhat.com>

When building as driver modules, it is not possible for the QEMU
driver module to reference the DTrace/SystemTAP probes linked into
the main libvirt.so. Thus we need to move the QEMU probes into a
separate file 'libvirt_qemu_probes.d'. Also rename the existing
file from 'probes.d' to 'libvirt_probes.d' while we're at it

* daemon/Makefile.am, src/internal.h: Include libvirt_probes.h
  instead of probes.h
* src/Makefile.am: Add rules for libvirt_qemu_probes.d
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor_json.c,
  src/qemu/qemu_monitor_text.c: Include libvirt_qemu_probes.h
* src/libvirt_probes.d: Rename from probes.d
* src/libvirt_qemu_probes.d: QEMU specific probes formerly
  in probes.d

Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
---
 daemon/Makefile.am           |    5 ++-
 src/Makefile.am              |   40 +++++++++++-----
 src/internal.h               |    2 +-
 src/libvirt_probes.d         |   85 +++++++++++++++++++++++++++++++++
 src/libvirt_qemu_probes.d    |   21 ++++++++
 src/probes.d                 |  106 ------------------------------------------
 src/qemu/qemu_monitor.c      |    4 ++
 src/qemu/qemu_monitor_json.c |    4 ++
 src/qemu/qemu_monitor_text.c |    4 ++
 tests/Makefile.am            |    5 ++-
 10 files changed, 154 insertions(+), 122 deletions(-)
 create mode 100644 src/libvirt_probes.d
 create mode 100644 src/libvirt_qemu_probes.d
 delete mode 100644 src/probes.d

diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 24cce8f..5d4c1a7 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -112,7 +112,7 @@ libvirtd_LDADD =					\
 	$(POLKIT_LIBS)
 
 if WITH_DTRACE_PROBES
-libvirtd_LDADD += ../src/probes.o
+libvirtd_LDADD += ../src/libvirt_probes.o
 endif
 
 libvirtd_LDADD += \
@@ -121,6 +121,9 @@ libvirtd_LDADD += \
 if ! WITH_DRIVER_MODULES
 if WITH_QEMU
     libvirtd_LDADD += ../src/libvirt_driver_qemu.la
+if WITH_DTRACE_PROBES
+    libvirtd_LDADD += ../src/libvirt_qemu_probes.o
+endif
 endif
 
 if WITH_LXC
diff --git a/src/Makefile.am b/src/Makefile.am
index ff3eaec..954c6e9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1252,22 +1252,30 @@ libvirt_la_CFLAGS = -DIN_LIBVIRT $(AM_CFLAGS)
 libvirt_la_DEPENDENCIES = $(libvirt_la_BUILT_LIBADD) $(LIBVIRT_SYMBOL_FILE)
 
 if WITH_DTRACE_PROBES
-libvirt_la_BUILT_LIBADD += probes.o
-libvirt_la_DEPENDENCIES += probes.o
-nodist_libvirt_la_SOURCES = probes.h
+libvirt_la_BUILT_LIBADD += libvirt_probes.o
+libvirt_la_DEPENDENCIES += libvirt_probes.o
+nodist_libvirt_la_SOURCES = libvirt_probes.h
 if WITH_REMOTE
-$(REMOTE_DRIVER_GENERATED): probes.h
+$(REMOTE_DRIVER_GENERATED): libvirt_probes.h
 endif WITH_REMOTE
 
-BUILT_SOURCES += probes.h libvirt_probes.stp libvirt_functions.stp
+BUILT_SOURCES += libvirt_probes.h libvirt_probes.stp libvirt_functions.stp
+
+if WITH_QEMU
+libvirt_driver_qemu_la_LIBADD += libvirt_qemu_probes.o
+nodist_libvirt_driver_qemu_la_SOURCES = libvirt_qemu_probes.h
+libvirt_driver_qemu_la_DEPENDENCIES = libvirt_qemu_probes.o
+
+$(libvirt_driver_qemu_la_SOURCES): libvirt_qemu_probes.h
+endif
 
 tapsetdir = $(datadir)/systemtap/tapset
-tapset_DATA = libvirt_probes.stp libvirt_functions.stp
+tapset_DATA = libvirt_probes.stp libvirt_qemu_probes.stp libvirt_functions.stp
 
-probes.h: probes.d
+%_probes.h: %_probes.d
 	$(AM_V_GEN)$(DTRACE) -o $@ -h -s $<
 
-probes.o: probes.d
+%_probes.o: %_probes.d
 	$(AM_V_GEN)$(DTRACE) -o $@ -G -s $<
 
 RPC_PROBE_FILES = $(srcdir)/rpc/virnetprotocol.x \
@@ -1278,13 +1286,19 @@ RPC_PROBE_FILES = $(srcdir)/rpc/virnetprotocol.x \
 libvirt_functions.stp: $(RPC_PROBE_FILES) $(srcdir)/rpc/gensystemtap.pl
 	$(AM_V_GEN)perl -w $(srcdir)/rpc/gensystemtap.pl $(RPC_PROBE_FILES) > $@
 
-libvirt_probes.stp: probes.d $(srcdir)/dtrace2systemtap.pl
+libvirt_probes.stp: libvirt_probes.d $(srcdir)/dtrace2systemtap.pl
+	$(AM_V_GEN)perl -w $(srcdir)/dtrace2systemtap.pl $(bindir) $(sbindir) $(libdir) $< > $@
+
+libvirt_qemu_probes.stp: libvirt_qemu_probes.d $(srcdir)/dtrace2systemtap.pl
 	$(AM_V_GEN)perl -w $(srcdir)/dtrace2systemtap.pl $(bindir) $(sbindir) $(libdir) $< > $@
 
-CLEANFILES += probes.h probes.o libvirt_functions.stp libvirt_probes.stp
+CLEANFILES += libvirt_probes.h libvirt_probes.o \
+              libvirt_qemu_probes.h libvirt_qemu_probes.o \
+              libvirt_functions.stp libvirt_probes.stp \
+              libvirt_qemu_probes.stp
 endif
 
-EXTRA_DIST += probes.d
+EXTRA_DIST += libvirt_probes.d libvirt_qemu_probes.d
 
 libvirt_qemu_la_SOURCES = libvirt-qemu.c
 libvirt_qemu_la_LDFLAGS = $(VERSION_SCRIPT_FLAGS)$(LIBVIRT_QEMU_SYMBOL_FILE) \
@@ -1471,7 +1485,7 @@ libvirt_lxc_LDADD = $(CAPNG_LIBS) $(YAJL_LIBS) \
 		$(RT_LIBS) $(DBUS_LIBS) \
 		../gnulib/lib/libgnu.la
 if WITH_DTRACE_PROBES
-libvirt_lxc_LDADD += probes.o
+libvirt_lxc_LDADD += libvirt_probes.o
 endif
 if WITH_SECDRIVER_SELINUX
 libvirt_lxc_LDADD += $(SELINUX_LIBS)
@@ -1516,7 +1530,7 @@ virt_aa_helper_LDADD =						\
 		libvirt_util.la					\
 		../gnulib/lib/libgnu.la
 if WITH_DTRACE_PROBES
-virt_aa_helper_LDADD += probes.o
+virt_aa_helper_LDADD += libvirt_probes.o
 endif
 virt_aa_helper_CFLAGS =						\
 		-I$(top_srcdir)/src/conf			\
diff --git a/src/internal.h b/src/internal.h
index 83f468d..d13847a 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -250,7 +250,7 @@
 # if WITH_DTRACE_PROBES
 #  ifndef LIBVIRT_PROBES_H
 #   define LIBVIRT_PROBES_H
-#   include "probes.h"
+#   include "libvirt_probes.h"
 #  endif /* LIBVIRT_PROBES_H */
 
 /* Systemtap 1.2 headers have a bug where they cannot handle a
diff --git a/src/libvirt_probes.d b/src/libvirt_probes.d
new file mode 100644
index 0000000..ac6c546
--- /dev/null
+++ b/src/libvirt_probes.d
@@ -0,0 +1,85 @@
+provider libvirt {
+	# file: src/util/event_poll.c
+	# prefix: event_poll
+	probe event_poll_add_handle(int watch, int fd, int events, void *cb, void *opaque, void *ff);
+	probe event_poll_update_handle(int watch, int events);
+	probe event_poll_remove_handle(int watch);
+	probe event_poll_dispatch_handle(int watch, int events);
+	probe event_poll_purge_handle(int watch);
+
+	probe event_poll_add_timeout(int timer, int frequency, void *cb, void *opaque, void *ff);
+	probe event_poll_update_timeout(int timer, int frequency);
+	probe event_poll_remove_timeout(int timer);
+	probe event_poll_dispatch_timeout(int timer);
+	probe event_poll_purge_timeout(int timer);
+
+	probe event_poll_run(int nfds, int timeout);
+
+
+	# file: src/rpc/virnetsocket.c
+	# prefix: rpc
+	probe rpc_socket_new(void *sock, int refs, int fd, int errfd, pid_t pid, const char *localAddr, const char *remoteAddr);
+	probe rpc_socket_send_fd(void *sock, int fd);
+	probe rpc_socket_recv_fd(void *sock, int fd);
+	probe rpc_socket_ref(void *sock, int refs);
+	probe rpc_socket_free(void *sock, int refs);
+
+
+	# file: src/rpc/virnetserverclient.c
+	# prefix: rpc
+	probe rpc_server_client_new(void *client, int refs, void *sock);
+	probe rpc_server_client_ref(void *client, int refs);
+	probe rpc_server_client_free(void *client, int refs);
+
+	probe rpc_server_client_msg_tx_queue(void *client, int len, int prog, int vers, int proc, int type, int status, int serial);
+	probe rpc_server_client_msg_rx(void *client, int len, int prog, int vers, int proc, int type, int status, int serial);
+
+
+	# file: src/rpc/virnetclient.c
+	# prefix: rpc
+	probe rpc_client_new(void *client, int refs, void *sock);
+	probe rpc_client_ref(void *client, int refs);
+	probe rpc_client_free(void *client, int refs);
+
+	probe rpc_client_msg_tx_queue(void *client, int len, int prog, int vers, int proc, int type, int status, int serial);
+	probe rpc_client_msg_rx(void *client, int len, int prog, int vers, int proc, int type, int status, int serial);
+
+
+	# file: daemon/libvirtd.c
+	# prefix: rpc
+	probe rpc_server_client_auth_allow(void *client, int authtype, const char *identity);
+	probe rpc_server_client_auth_deny(void *client, int authtype, const char *identity);
+	probe rpc_server_client_auth_fail(void *client, int authtype);
+
+
+	# file: src/rpc/virnettlscontext.c
+	# prefix: rpc
+	probe rpc_tls_context_new(void *ctxt, int refs, const char *cacert, const char *cacrl,
+				  const char *cert, const char *key, int sanityCheckCert, int requireValidCert, int isServer);
+	probe rpc_tls_context_ref(void *ctxt, int refs);
+	probe rpc_tls_context_free(void *ctxt, int refs);
+
+	probe rpc_tls_context_session_allow(void *ctxt, void *sess, const char *dname);
+	probe rpc_tls_context_session_deny(void *ctxt, void *sess, const char *dname);
+	probe rpc_tls_context_session_fail(void *ctxt, void *sess);
+
+
+	probe rpc_tls_session_new(void *sess, void *ctxt, int refs, const char *hostname, int isServer);
+	probe rpc_tls_session_ref(void *sess, int refs);
+	probe rpc_tls_session_free(void *sess, int refs);
+
+	probe rpc_tls_session_handshake_pass(void *sess);
+	probe rpc_tls_session_handshake_fail(void *sess);
+
+
+	# file: src/rpc/virkeepalive.c
+	# prefix: rpc
+	probe rpc_keepalive_new(void *ka, void *client, int refs);
+	probe rpc_keepalive_ref(void *ka, void *client, int refs);
+	probe rpc_keepalive_free(void *ka, void *client, int refs);
+	probe rpc_keepalive_start(void *ka, void *client, int interval, int count);
+	probe rpc_keepalive_stop(void *ka, void *client, bool all);
+	probe rpc_keepalive_send(void *ka, void *client, int prog, int vers, int proc);
+	probe rpc_keepalive_received(void *ka, void *client, int prog, int vers, int proc);
+	probe rpc_keepalive_timeout(void *ka, void *client, int coundToDeath, int idle);
+};
diff --git a/src/libvirt_qemu_probes.d b/src/libvirt_qemu_probes.d
new file mode 100644
index 0000000..6916778
--- /dev/null
+++ b/src/libvirt_qemu_probes.d
@@ -0,0 +1,21 @@
+provider libvirt {
+        # file: src/qemu/qemu_monitor.c
+        # prefix: qemu
+        # binary: libvirtd
+        # Monitor lifecycle
+        probe qemu_monitor_new(void *mon, int refs, int fd);
+        probe qemu_monitor_ref(void *mon, int refs);
+        probe qemu_monitor_unref(void *mon, int refs);
+        probe qemu_monitor_close(void *monm, int refs);
+
+        # High level monitor message processing
+        probe qemu_monitor_send_msg(void *mon, const char *msg, int fd);
+        probe qemu_monitor_recv_reply(void *mon, const char *reply);
+        probe qemu_monitor_recv_event(void *mon, const char *event);
+
+        # Low level monitor I/O processing
+        probe qemu_monitor_io_process(void *mon, const char *buf, unsigned int len);
+        probe qemu_monitor_io_read(void *mon, const char *buf, unsigned int len, int ret, int errno);
+        probe qemu_monitor_io_write(void *mon, const char *buf, unsigned int len, int ret, int errno);
+        probe qemu_monitor_io_send_fd(void *mon, int fd, int ret, int errno);
+};
diff --git a/src/probes.d b/src/probes.d
deleted file mode 100644
index e56dc3e..0000000
--- a/src/probes.d
+++ /dev/null
@@ -1,106 +0,0 @@
-provider libvirt {
-	# file: src/util/event_poll.c
-	# prefix: event_poll
-	probe event_poll_add_handle(int watch, int fd, int events, void *cb, void *opaque, void *ff);
-	probe event_poll_update_handle(int watch, int events);
-	probe event_poll_remove_handle(int watch);
-	probe event_poll_dispatch_handle(int watch, int events);
-	probe event_poll_purge_handle(int watch);
-
-	probe event_poll_add_timeout(int timer, int frequency, void *cb, void *opaque, void *ff);
-	probe event_poll_update_timeout(int timer, int frequency);
-	probe event_poll_remove_timeout(int timer);
-	probe event_poll_dispatch_timeout(int timer);
-	probe event_poll_purge_timeout(int timer);
-
-	probe event_poll_run(int nfds, int timeout);
-
-
-	# file: src/rpc/virnetsocket.c
-	# prefix: rpc
-	probe rpc_socket_new(void *sock, int refs, int fd, int errfd, pid_t pid, const char *localAddr, const char *remoteAddr);
-	probe rpc_socket_send_fd(void *sock, int fd);
-	probe rpc_socket_recv_fd(void *sock, int fd);
-	probe rpc_socket_ref(void *sock, int refs);
-	probe rpc_socket_free(void *sock, int refs);
-
-
-	# file: src/rpc/virnetserverclient.c
-	# prefix: rpc
-	probe rpc_server_client_new(void *client, int refs, void *sock);
-	probe rpc_server_client_ref(void *client, int refs);
-	probe rpc_server_client_free(void *client, int refs);
-
-	probe rpc_server_client_msg_tx_queue(void *client, int len, int prog, int vers, int proc, int type, int status, int serial);
-	probe rpc_server_client_msg_rx(void *client, int len, int prog, int vers, int proc, int type, int status, int serial);
-
-
-	# file: src/rpc/virnetclient.c
-	# prefix: rpc
-	probe rpc_client_new(void *client, int refs, void *sock);
-	probe rpc_client_ref(void *client, int refs);
-	probe rpc_client_free(void *client, int refs);
-
-	probe rpc_client_msg_tx_queue(void *client, int len, int prog, int vers, int proc, int type, int status, int serial);
-	probe rpc_client_msg_rx(void *client, int len, int prog, int vers, int proc, int type, int status, int serial);
-
-
-	# file: daemon/libvirtd.c
-	# prefix: rpc
-	probe rpc_server_client_auth_allow(void *client, int authtype, const char *identity);
-	probe rpc_server_client_auth_deny(void *client, int authtype, const char *identity);
-	probe rpc_server_client_auth_fail(void *client, int authtype);
-
-
-	# file: src/rpc/virnettlscontext.c
-	# prefix: rpc
-	probe rpc_tls_context_new(void *ctxt, int refs, const char *cacert, const char *cacrl,
-				  const char *cert, const char *key, int sanityCheckCert, int requireValidCert, int isServer);
-	probe rpc_tls_context_ref(void *ctxt, int refs);
-	probe rpc_tls_context_free(void *ctxt, int refs);
-
-	probe rpc_tls_context_session_allow(void *ctxt, void *sess, const char *dname);
-	probe rpc_tls_context_session_deny(void *ctxt, void *sess, const char *dname);
-	probe rpc_tls_context_session_fail(void *ctxt, void *sess);
-
-
-	probe rpc_tls_session_new(void *sess, void *ctxt, int refs, const char *hostname, int isServer);
-	probe rpc_tls_session_ref(void *sess, int refs);
-	probe rpc_tls_session_free(void *sess, int refs);
-
-	probe rpc_tls_session_handshake_pass(void *sess);
-	probe rpc_tls_session_handshake_fail(void *sess);
-
-
-	# file: src/rpc/virkeepalive.c
-	# prefix: rpc
-	probe rpc_keepalive_new(void *ka, void *client, int refs);
-	probe rpc_keepalive_ref(void *ka, void *client, int refs);
-	probe rpc_keepalive_free(void *ka, void *client, int refs);
-	probe rpc_keepalive_start(void *ka, void *client, int interval, int count);
-	probe rpc_keepalive_stop(void *ka, void *client, bool all);
-	probe rpc_keepalive_send(void *ka, void *client, int prog, int vers, int proc);
-	probe rpc_keepalive_received(void *ka, void *client, int prog, int vers, int proc);
-	probe rpc_keepalive_timeout(void *ka, void *client, int coundToDeath, int idle);
-
-
-        # file: src/qemu/qemu_monitor.c
-        # prefix: qemu
-        # binary: libvirtd
-        # Monitor lifecycle
-        probe qemu_monitor_new(void *mon, int refs, int fd);
-        probe qemu_monitor_ref(void *mon, int refs);
-        probe qemu_monitor_unref(void *mon, int refs);
-        probe qemu_monitor_close(void *monm, int refs);
-
-        # High level monitor message processing
-        probe qemu_monitor_send_msg(void *mon, const char *msg, int fd);
-        probe qemu_monitor_recv_reply(void *mon, const char *reply);
-        probe qemu_monitor_recv_event(void *mon, const char *event);
-
-        # Low level monitor I/O processing
-        probe qemu_monitor_io_process(void *mon, const char *buf, unsigned int len);
-        probe qemu_monitor_io_read(void *mon, const char *buf, unsigned int len, int ret, int errno);
-        probe qemu_monitor_io_write(void *mon, const char *buf, unsigned int len, int ret, int errno);
-        probe qemu_monitor_io_send_fd(void *mon, int fd, int ret, int errno);
-};
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 7d69c67..7084c68 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -37,6 +37,10 @@
 #include "logging.h"
 #include "virfile.h"
 
+#ifdef WITH_DTRACE_PROBES
+# include "libvirt_qemu_probes.h"
+#endif
+
 #define VIR_FROM_THIS VIR_FROM_QEMU
 
 #define DEBUG_IO 0
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index e1f5453..9030347 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -43,6 +43,10 @@
 #include "json.h"
 #include "ignore-value.h"
 
+#ifdef WITH_DTRACE_PROBES
+# include "libvirt_qemu_probes.h"
+#endif
+
 #define VIR_FROM_THIS VIR_FROM_QEMU
 
 
diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
index 9e2991b..edb5dfd 100644
--- a/src/qemu/qemu_monitor_text.c
+++ b/src/qemu/qemu_monitor_text.c
@@ -41,6 +41,10 @@
 #include "virterror_internal.h"
 #include "buf.h"
 
+#ifdef WITH_DTRACE_PROBES
+# include "libvirt_qemu_probes.h"
+#endif
+
 #define VIR_FROM_THIS VIR_FROM_QEMU
 
 #define QEMU_CMD_PROMPT "\n(qemu) "
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 6b1f95e..4575a56 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -31,7 +31,7 @@ endif
 
 PROBES_O =
 if WITH_DTRACE_PROBES
-PROBES_O += ../src/probes.o
+PROBES_O += ../src/libvirt_probes.o
 endif
 
 LDADDS = \
@@ -290,6 +290,9 @@ qemu_LDADDS = ../src/libvirt_driver_qemu.la
 if WITH_NETWORK
 qemu_LDADDS += ../src/libvirt_driver_network.la
 endif
+if WITH_DTRACE_PROBES
+qemu_LDADDS += ../src/libvirt_qemu_probes.o
+endif
 qemu_LDADDS += $(LDADDS)
 
 qemuxml2argvtest_SOURCES = \
-- 
1.7.7.6




More information about the libvir-list mailing list