summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Smith <dsmith@redhat.com>2009-06-03 13:04:54 -0500
committerDavid Smith <dsmith@redhat.com>2009-06-03 13:04:54 -0500
commit01adca5bca8d61e3fdf09017496deec8859fe12d (patch)
treed256a8074b58fbf5607b1b594fc9ea8b7daa27ed
parenta655ff03c59722c229a40909d0de9e3dfe63483e (diff)
downloadsystemtap-steved-01adca5bca8d61e3fdf09017496deec8859fe12d.tar.gz
systemtap-steved-01adca5bca8d61e3fdf09017496deec8859fe12d.tar.xz
systemtap-steved-01adca5bca8d61e3fdf09017496deec8859fe12d.zip
Fixed STP_TRANSPORT_VERSION 1 behavior.
* runtime/transport/control.c (_stp_ctl_write_dbug): Added support for more messages. * runtime/transport/relay_v2.c (_stp_transport_data_fs_start): New function. (_stp_transport_data_fs_stop): Ditto. (_stp_transport_data_fs_close): Moved some functionality into _stp_transport_data_fs_stop() and calls _stp_transport_data_fs_stop() also. (_stp_transport_data_fs_init): Moved some functionality into _stp_transport_data_fs_start() and calls _stp_transport_data_fs_start() also. * runtime/transport/relayfs.c (_stp_transport_data_fs_start): New function. (_stp_transport_data_fs_stop): Ditto. (_stp_transport_data_fs_close): Moved some functionality into _stp_transport_data_fs_stop() and calls _stp_transport_data_fs_stop() also. (_stp_transport_data_fs_init): Moved some functionality into _stp_transport_data_fs_start() and calls _stp_transport_data_fs_start() also. * runtime/transport/ring_buffer.c (_stp_transport_data_fs_start): New empty function. (_stp_transport_data_fs_stop): Ditto. * runtime/transport/transport.h: Added _stp_transport_data_fs_start() and _stp_transport_data_fs_stop() prototypes. * runtime/transport/transport.c (_stp_cleanup_and_exit): Calls _stp_transport_data_fs_stop(). (_stp_transport_close): Calls _stp_transport_fs_close() earlier. (_stp_transport_init): Calls _stp_transport_data_fs_start().
-rw-r--r--runtime/transport/control.c18
-rw-r--r--runtime/transport/relay_v2.c29
-rw-r--r--runtime/transport/relayfs.c26
-rw-r--r--runtime/transport/ring_buffer.c10
-rw-r--r--runtime/transport/transport.c13
-rw-r--r--runtime/transport/transport.h14
6 files changed, 87 insertions, 23 deletions
diff --git a/runtime/transport/control.c b/runtime/transport/control.c
index a1624152..11338eb2 100644
--- a/runtime/transport/control.c
+++ b/runtime/transport/control.c
@@ -100,6 +100,24 @@ static void _stp_ctl_write_dbug(int type, void *data, int len)
case STP_TRANSPORT:
_dbug("sending STP_TRANSPORT\n");
break;
+ case STP_CONNECT:
+ _dbug("sending STP_CONNECT\n");
+ break;
+ case STP_DISCONNECT:
+ _dbug("sending STP_DISCONNECT\n");
+ break;
+ case STP_BULK:
+ _dbug("sending STP_BULK\n");
+ break;
+ case STP_READY:
+ case STP_RELOCATION:
+ case STP_BUF_INFO:
+ case STP_SUBBUFS_CONSUMED:
+ _dbug("sending old message\n");
+ break;
+ case STP_REALTIME_DATA:
+ _dbug("sending %d bytes of STP_REALTIME_DATA\n", len);
+ break;
case STP_REQUEST_EXIT:
_dbug("sending STP_REQUEST_EXIT\n");
break;
diff --git a/runtime/transport/relay_v2.c b/runtime/transport/relay_v2.c
index 0c8d0955..16b5afa1 100644
--- a/runtime/transport/relay_v2.c
+++ b/runtime/transport/relay_v2.c
@@ -220,18 +220,35 @@ static struct rchan_callbacks __stp_relay_callbacks = {
.remove_buf_file = __stp_relay_remove_buf_file_callback,
};
-static void _stp_transport_data_fs_close(void)
+static void _stp_transport_data_fs_start(void)
+{
+ if (_stp_relay_data.transport_state == STP_TRANSPORT_INITIALIZED) {
+ /* We're initialized. Now start the timer. */
+ __stp_relay_timer_init();
+ _stp_relay_data.transport_state = STP_TRANSPORT_RUNNING;
+ }
+}
+
+static void _stp_transport_data_fs_stop(void)
{
- if (_stp_relay_data.transport_state == STP_TRANSPORT_RUNNING)
+ if (_stp_relay_data.transport_state == STP_TRANSPORT_RUNNING) {
del_timer_sync(&_stp_relay_data.timer);
+ dbug_trans(0, "flushing...\n");
+ _stp_relay_data.transport_state = STP_TRANSPORT_STOPPED;
+ if (_stp_relay_data.rchan)
+ relay_flush(_stp_relay_data.rchan);
+ }
+}
+static void _stp_transport_data_fs_close(void)
+{
+ _stp_transport_data_fs_stop();
if (_stp_relay_data.dropped_file)
debugfs_remove(_stp_relay_data.dropped_file);
if (_stp_relay_data.rchan) {
- relay_flush(_stp_relay_data.rchan);
relay_close(_stp_relay_data.rchan);
+ _stp_relay_data.rchan = NULL;
}
- _stp_relay_data.transport_state = STP_TRANSPORT_STOPPED;
}
static int _stp_transport_data_fs_init(void)
@@ -300,10 +317,6 @@ static int _stp_transport_data_fs_init(void)
dbug_trans(1, "returning 0...\n");
_stp_relay_data.transport_state = STP_TRANSPORT_INITIALIZED;
- /* We're initialized. Now start the timer. */
- __stp_relay_timer_init();
- _stp_relay_data.transport_state = STP_TRANSPORT_RUNNING;
-
return 0;
err:
diff --git a/runtime/transport/relayfs.c b/runtime/transport/relayfs.c
index dac6db1d..191b932f 100644
--- a/runtime/transport/relayfs.c
+++ b/runtime/transport/relayfs.c
@@ -75,14 +75,29 @@ static struct rchan_callbacks stp_rchan_callbacks =
.buf_full = __stp_relay_buf_full_callback,
};
+static void _stp_transport_data_fs_start(void)
+{
+ if (_stp_relay_data.transport_state == STP_TRANSPORT_INITIALIZED)
+ _stp_relay_data.transport_state = STP_TRANSPORT_RUNNING;
+}
+
+static void _stp_transport_data_fs_stop(void)
+{
+ if (_stp_relay_data.transport_state == STP_TRANSPORT_RUNNING) {
+ _stp_relay_data.transport_state = STP_TRANSPORT_STOPPED;
+ _stp_relay_data.flushing = 1;
+ if (_stp_relay_data.rchan)
+ relay_flush(_stp_relay_data.rchan);
+ }
+}
+
static void _stp_transport_data_fs_close(void)
{
+ _stp_transport_data_fs_stop();
if (_stp_relay_data.rchan) {
- _stp_relay_data.flushing = 1;
- relay_flush(_stp_relay_data.rchan);
relay_close(_stp_relay_data.rchan);
+ _stp_relay_data.rchan = NULL;
}
- _stp_relay_data.transport_state = STP_TRANSPORT_STOPPED;
}
static int _stp_transport_data_fs_init(void)
@@ -111,9 +126,8 @@ static int _stp_transport_data_fs_init(void)
= _stp_gid;
}
- /* We're off and running. */
- smp_mb();
- _stp_relay_data.transport_state = STP_TRANSPORT_RUNNING;
+ /* We're initialized. */
+ _stp_relay_data.transport_state = STP_TRANSPORT_INITIALIZED;
return rc;
err:
diff --git a/runtime/transport/ring_buffer.c b/runtime/transport/ring_buffer.c
index 217d0735..bed441e5 100644
--- a/runtime/transport/ring_buffer.c
+++ b/runtime/transport/ring_buffer.c
@@ -425,6 +425,16 @@ static int _stp_transport_data_fs_init(void)
return 0;
}
+static void _stp_transport_data_fs_start(void)
+{
+ /* Do nothing. */
+}
+
+static void _stp_transport_data_fs_stop(void)
+{
+ /* Do nothing. */
+}
+
static void _stp_transport_data_fs_close(void)
{
int cpu;
diff --git a/runtime/transport/transport.c b/runtime/transport/transport.c
index 8425536a..84959f71 100644
--- a/runtime/transport/transport.c
+++ b/runtime/transport/transport.c
@@ -135,11 +135,8 @@ static void _stp_cleanup_and_exit(int send_exit)
if (failures)
_stp_warn("There were %d transport failures.\n", failures);
- dbug_trans(1, "************** calling startstop 0 *************\n");
-#if 0
- if (_stp_utt)
- utt_trace_startstop(_stp_utt, 0, &utt_seq);
-#endif
+ dbug_trans(1, "*** calling _stp_transport_data_fs_stop ***\n");
+ _stp_transport_data_fs_stop();
dbug_trans(1, "ctl_send STP_EXIT\n");
if (send_exit)
@@ -236,9 +233,9 @@ static void _stp_transport_close(void)
if (_stp_utt)
utt_trace_remove(_stp_utt);
#endif /* #if 0 */
+ _stp_transport_fs_close();
_stp_print_cleanup(); /* free print buffers */
_stp_mem_debug_done();
- _stp_transport_fs_close();
dbug_trans(1, "---- CLOSED ----\n");
}
@@ -317,10 +314,8 @@ static int _stp_transport_init(void)
if (_stp_print_init() < 0)
goto err2;
-#if 0
/* start transport */
- utt_trace_startstop(_stp_utt, 1, &utt_seq);
-#endif /* #if 0 */
+ _stp_transport_data_fs_start();
/* create workqueue of kernel threads */
_stp_wq = create_workqueue("systemtap");
diff --git a/runtime/transport/transport.h b/runtime/transport/transport.h
index c560be5d..df2d496d 100644
--- a/runtime/transport/transport.h
+++ b/runtime/transport/transport.h
@@ -75,6 +75,20 @@ static int _stp_bufsize;
static int _stp_transport_data_fs_init(void);
/*
+ * _stp_transport_data_fs_start
+ *
+ * This function actually starts the transport.
+ */
+static void _stp_transport_data_fs_start(void);
+
+/*
+ * _stp_transport_data_fs_start
+ *
+ * This function stops the transport without doing any cleanup.
+ */
+static void _stp_transport_data_fs_stop(void);
+
+/*
* _stp_transport_data_fs_close
*
* This function cleans up items created by