提交 a4e45a06 编写于 作者: D Daniel P. Berrange

Split QEMU dtrace probes into separate file

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: NDaniel P. Berrange <berrange@redhat.com>
上级 f5f1fe1b
...@@ -112,7 +112,7 @@ libvirtd_LDADD = \ ...@@ -112,7 +112,7 @@ libvirtd_LDADD = \
$(POLKIT_LIBS) $(POLKIT_LIBS)
if WITH_DTRACE_PROBES if WITH_DTRACE_PROBES
libvirtd_LDADD += ../src/probes.o libvirtd_LDADD += ../src/libvirt_probes.o
endif endif
libvirtd_LDADD += \ libvirtd_LDADD += \
...@@ -121,6 +121,9 @@ libvirtd_LDADD += \ ...@@ -121,6 +121,9 @@ libvirtd_LDADD += \
if ! WITH_DRIVER_MODULES if ! WITH_DRIVER_MODULES
if WITH_QEMU if WITH_QEMU
libvirtd_LDADD += ../src/libvirt_driver_qemu.la libvirtd_LDADD += ../src/libvirt_driver_qemu.la
if WITH_DTRACE_PROBES
libvirtd_LDADD += ../src/libvirt_qemu_probes.o
endif
endif endif
if WITH_LXC if WITH_LXC
......
...@@ -1246,22 +1246,30 @@ libvirt_la_CFLAGS = -DIN_LIBVIRT $(AM_CFLAGS) ...@@ -1246,22 +1246,30 @@ libvirt_la_CFLAGS = -DIN_LIBVIRT $(AM_CFLAGS)
libvirt_la_DEPENDENCIES = $(libvirt_la_BUILT_LIBADD) $(LIBVIRT_SYMBOL_FILE) libvirt_la_DEPENDENCIES = $(libvirt_la_BUILT_LIBADD) $(LIBVIRT_SYMBOL_FILE)
if WITH_DTRACE_PROBES if WITH_DTRACE_PROBES
libvirt_la_BUILT_LIBADD += probes.o libvirt_la_BUILT_LIBADD += libvirt_probes.o
libvirt_la_DEPENDENCIES += probes.o libvirt_la_DEPENDENCIES += libvirt_probes.o
nodist_libvirt_la_SOURCES = probes.h nodist_libvirt_la_SOURCES = libvirt_probes.h
if WITH_REMOTE if WITH_REMOTE
$(REMOTE_DRIVER_GENERATED): probes.h $(REMOTE_DRIVER_GENERATED): libvirt_probes.h
endif WITH_REMOTE 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 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 $< $(AM_V_GEN)$(DTRACE) -o $@ -h -s $<
probes.o: probes.d %_probes.o: %_probes.d
$(AM_V_GEN)$(DTRACE) -o $@ -G -s $< $(AM_V_GEN)$(DTRACE) -o $@ -G -s $<
RPC_PROBE_FILES = $(srcdir)/rpc/virnetprotocol.x \ RPC_PROBE_FILES = $(srcdir)/rpc/virnetprotocol.x \
...@@ -1272,13 +1280,19 @@ RPC_PROBE_FILES = $(srcdir)/rpc/virnetprotocol.x \ ...@@ -1272,13 +1280,19 @@ RPC_PROBE_FILES = $(srcdir)/rpc/virnetprotocol.x \
libvirt_functions.stp: $(RPC_PROBE_FILES) $(srcdir)/rpc/gensystemtap.pl libvirt_functions.stp: $(RPC_PROBE_FILES) $(srcdir)/rpc/gensystemtap.pl
$(AM_V_GEN)perl -w $(srcdir)/rpc/gensystemtap.pl $(RPC_PROBE_FILES) > $@ $(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) $< > $@ $(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 endif
EXTRA_DIST += probes.d EXTRA_DIST += libvirt_probes.d libvirt_qemu_probes.d
libvirt_qemu_la_SOURCES = libvirt-qemu.c libvirt_qemu_la_SOURCES = libvirt-qemu.c
libvirt_qemu_la_LDFLAGS = $(VERSION_SCRIPT_FLAGS)$(LIBVIRT_QEMU_SYMBOL_FILE) \ libvirt_qemu_la_LDFLAGS = $(VERSION_SCRIPT_FLAGS)$(LIBVIRT_QEMU_SYMBOL_FILE) \
...@@ -1465,7 +1479,7 @@ libvirt_lxc_LDADD = $(CAPNG_LIBS) $(YAJL_LIBS) \ ...@@ -1465,7 +1479,7 @@ libvirt_lxc_LDADD = $(CAPNG_LIBS) $(YAJL_LIBS) \
$(RT_LIBS) $(DBUS_LIBS) \ $(RT_LIBS) $(DBUS_LIBS) \
../gnulib/lib/libgnu.la ../gnulib/lib/libgnu.la
if WITH_DTRACE_PROBES if WITH_DTRACE_PROBES
libvirt_lxc_LDADD += probes.o libvirt_lxc_LDADD += libvirt_probes.o
endif endif
if WITH_SECDRIVER_SELINUX if WITH_SECDRIVER_SELINUX
libvirt_lxc_LDADD += $(SELINUX_LIBS) libvirt_lxc_LDADD += $(SELINUX_LIBS)
...@@ -1510,7 +1524,7 @@ virt_aa_helper_LDADD = \ ...@@ -1510,7 +1524,7 @@ virt_aa_helper_LDADD = \
libvirt_util.la \ libvirt_util.la \
../gnulib/lib/libgnu.la ../gnulib/lib/libgnu.la
if WITH_DTRACE_PROBES if WITH_DTRACE_PROBES
virt_aa_helper_LDADD += probes.o virt_aa_helper_LDADD += libvirt_probes.o
endif endif
virt_aa_helper_CFLAGS = \ virt_aa_helper_CFLAGS = \
-I$(top_srcdir)/src/conf \ -I$(top_srcdir)/src/conf \
......
...@@ -250,7 +250,7 @@ ...@@ -250,7 +250,7 @@
# if WITH_DTRACE_PROBES # if WITH_DTRACE_PROBES
# ifndef LIBVIRT_PROBES_H # ifndef LIBVIRT_PROBES_H
# define LIBVIRT_PROBES_H # define LIBVIRT_PROBES_H
# include "probes.h" # include "libvirt_probes.h"
# endif /* LIBVIRT_PROBES_H */ # endif /* LIBVIRT_PROBES_H */
/* Systemtap 1.2 headers have a bug where they cannot handle a /* Systemtap 1.2 headers have a bug where they cannot handle a
......
...@@ -82,25 +82,4 @@ provider libvirt { ...@@ -82,25 +82,4 @@ provider libvirt {
probe rpc_keepalive_send(void *ka, void *client, int prog, int vers, int proc); 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_received(void *ka, void *client, int prog, int vers, int proc);
probe rpc_keepalive_timeout(void *ka, void *client, int coundToDeath, int idle); 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);
}; };
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);
};
...@@ -37,6 +37,10 @@ ...@@ -37,6 +37,10 @@
#include "logging.h" #include "logging.h"
#include "virfile.h" #include "virfile.h"
#ifdef WITH_DTRACE_PROBES
# include "libvirt_qemu_probes.h"
#endif
#define VIR_FROM_THIS VIR_FROM_QEMU #define VIR_FROM_THIS VIR_FROM_QEMU
#define DEBUG_IO 0 #define DEBUG_IO 0
......
...@@ -43,6 +43,10 @@ ...@@ -43,6 +43,10 @@
#include "json.h" #include "json.h"
#include "ignore-value.h" #include "ignore-value.h"
#ifdef WITH_DTRACE_PROBES
# include "libvirt_qemu_probes.h"
#endif
#define VIR_FROM_THIS VIR_FROM_QEMU #define VIR_FROM_THIS VIR_FROM_QEMU
......
...@@ -41,6 +41,10 @@ ...@@ -41,6 +41,10 @@
#include "virterror_internal.h" #include "virterror_internal.h"
#include "buf.h" #include "buf.h"
#ifdef WITH_DTRACE_PROBES
# include "libvirt_qemu_probes.h"
#endif
#define VIR_FROM_THIS VIR_FROM_QEMU #define VIR_FROM_THIS VIR_FROM_QEMU
#define QEMU_CMD_PROMPT "\n(qemu) " #define QEMU_CMD_PROMPT "\n(qemu) "
......
...@@ -31,7 +31,7 @@ endif ...@@ -31,7 +31,7 @@ endif
PROBES_O = PROBES_O =
if WITH_DTRACE_PROBES if WITH_DTRACE_PROBES
PROBES_O += ../src/probes.o PROBES_O += ../src/libvirt_probes.o
endif endif
LDADDS = \ LDADDS = \
...@@ -290,6 +290,9 @@ qemu_LDADDS = ../src/libvirt_driver_qemu.la ...@@ -290,6 +290,9 @@ qemu_LDADDS = ../src/libvirt_driver_qemu.la
if WITH_NETWORK if WITH_NETWORK
qemu_LDADDS += ../src/libvirt_driver_network.la qemu_LDADDS += ../src/libvirt_driver_network.la
endif endif
if WITH_DTRACE_PROBES
qemu_LDADDS += ../src/libvirt_qemu_probes.o
endif
qemu_LDADDS += $(LDADDS) qemu_LDADDS += $(LDADDS)
qemuxml2argvtest_SOURCES = \ qemuxml2argvtest_SOURCES = \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册