]> sourceware.org Git - systemtap.git/commitdiff
Remove _stp_ctl_work_timer from module transport layer.
authorMark Wielaard <mjw@redhat.com>
Fri, 12 Aug 2011 17:34:20 +0000 (19:34 +0200)
committerMark Wielaard <mjw@redhat.com>
Fri, 12 Aug 2011 17:34:20 +0000 (19:34 +0200)
The _stp_ctl_work_timer would trigger every 20ms to check whether
there were cmd messages queued, but not announced yet and to
check the _stp_exit_flag was set.

This commit makes all control messages announce themselves and
check the _stp_exit_flag in the _stp_ctl_read_cmd loop (delivery
is still possibly delayed since the messages are just pushed on
a wait queue).

runtime/io.c
runtime/print_flush.c
runtime/transport/control.c
runtime/transport/transport.c
runtime/transport/transport.h
tapset/system.stp

index 82be03cc776ec438422fed38d049d2eaf957ff53..4de6825704dac529a4227b1b66d40cbc5106e493 100644 (file)
@@ -64,9 +64,7 @@ static void _stp_vlog (enum code type, const char *func, int line, const char *f
                 else printk (KERN_INFO "%s", buf);
 #else
                if (type != DBUG) {
-                       /* This is non-urgent .cmd data, so call
-                          _stp_ctl_write, instead of _stp_ctl_send.  */
-                       _stp_ctl_write(STP_OOB_DATA, buf, start + num + 1);
+                       _stp_ctl_send(STP_OOB_DATA, buf, start + num + 1);
                } else {
                        _stp_print(buf);
                        _stp_print_flush();
index 6741e9926500774ebf4c84c80d1339bb8a3a3024..a66a305e7d3e6f3170afeded2b96d5f8e2223602 100644 (file)
@@ -99,11 +99,11 @@ void EXPORT_FN(stp_print_flush)(_stp_pbuf *pb)
 #else  /* !STP_BULKMODE */
 
 #if STP_TRANSPORT_VERSION == 1
-       /** STP_TRANSPORT_VERSION == 1 is special, _stp_ctl_write will
+       /** STP_TRANSPORT_VERSION == 1 is special, _stp_ctl_send/write will
            pass through procfs _stp_ctl_write_fs which recognizes
            STP_REALTIME_DATA as data that needs to be send right away
            over the .cmd channel instead of being queued.  */
-       if (unlikely(_stp_ctl_write(STP_REALTIME_DATA, pb->buf, len) <= 0))
+       if (unlikely(_stp_ctl_send(STP_REALTIME_DATA, pb->buf, len) <= 0))
                atomic_inc (&_stp_transport_failures);
 
 #else  /* STP_TRANSPORT_VERSION != 1 */
index fd1b6ef9e3b2cc2dc6d27a67534101c507ececf1..d76ad820eb8ba837b61f403552e42d6d1671e553 100644 (file)
@@ -441,6 +441,12 @@ static ssize_t _stp_ctl_read_cmd(struct file *file, char __user *buf,
        spin_lock_irqsave(&_stp_ctl_ready_lock, flags);
        while (list_empty(&_stp_ctl_ready_q)) {
                spin_unlock_irqrestore(&_stp_ctl_ready_lock, flags);
+
+       /* Someone is listening, if exit flag is set AND we have finished
+          with probe_start() we might want them to know.  */
+       if (unlikely(_stp_exit_flag && _stp_probes_started))
+               _stp_request_exit();
+
                if (file->f_flags & O_NONBLOCK)
                        return -EAGAIN;
                if (wait_event_interruptible(_stp_ctl_wq, !list_empty(&_stp_ctl_ready_q)))
index e6a7a90a66093029f7446b7d3199160a1b618377..5d30a93d67f99779da2af41a99caffb284cd1a21 100644 (file)
@@ -33,12 +33,6 @@ static int _stp_probes_started = 0;
 static int _stp_exit_called = 0;
 static DEFINE_MUTEX(_stp_transport_mutex);
 
-#ifndef STP_CTL_TIMER_INTERVAL
-/* ctl timer interval in jiffies (default 20 ms) */
-#define STP_CTL_TIMER_INTERVAL         ((HZ+49)/50)
-#endif
-
-
 // For now, disable transport version 3 (unless STP_USE_RING_BUFFER is
 // defined).
 #if STP_TRANSPORT_VERSION == 3 && !defined(STP_USE_RING_BUFFER)
@@ -72,8 +66,6 @@ MODULE_PARM_DESC(_stp_bufsize, "buffer size");
 static void probe_exit(void);
 static int probe_start(void);
 
-struct timer_list _stp_ctl_work_timer;
-
 /*
  *     _stp_handle_start - handle STP_START
  */
@@ -163,7 +155,6 @@ static void _stp_detach(void)
        if (!_stp_exit_flag)
                _stp_transport_data_fs_overwrite(1);
 
-        del_timer_sync(&_stp_ctl_work_timer);
        wake_up_interruptible(&_stp_ctl_wq);
 }
 
@@ -178,37 +169,6 @@ static void _stp_attach(void)
        dbug_trans(1, "attach\n");
        _stp_pid = current->pid;
        _stp_transport_data_fs_overwrite(0);
-       init_timer(&_stp_ctl_work_timer);
-       _stp_ctl_work_timer.expires = jiffies + STP_CTL_TIMER_INTERVAL;
-       _stp_ctl_work_timer.function = _stp_ctl_work_callback;
-       _stp_ctl_work_timer.data= 0;
-       add_timer(&_stp_ctl_work_timer);
-}
-
-/*
- *     _stp_ctl_work_callback - periodically check for IO or exit
- *     This IO comes from ERRORs or WARNINGs which are send with
- *     _stp_ctl_write as type STP_OOB_DATA, so don't immediately
- *     trigger a wake_up of _stp_ctl_wq.
- *     This is run by a kernel thread and may NOT sleep.
- */
-static void _stp_ctl_work_callback(unsigned long val)
-{
-       int do_io = 0;
-       unsigned long flags;
-
-       spin_lock_irqsave(&_stp_ctl_ready_lock, flags);
-       if (!list_empty(&_stp_ctl_ready_q))
-               do_io = 1;
-       spin_unlock_irqrestore(&_stp_ctl_ready_lock, flags);
-       if (do_io)
-               wake_up_interruptible(&_stp_ctl_wq);
-
-       /* if exit flag is set AND we have finished with probe_start() */
-       if (unlikely(_stp_exit_flag && _stp_probes_started))
-               _stp_request_exit();
-       if (atomic_read(& _stp_ctl_attached))
-                mod_timer (&_stp_ctl_work_timer, jiffies + STP_CTL_TIMER_INTERVAL);
 }
 
 /**
index b3c6fe194c3d4960ce3bf01e4728bb76d11b9e53..c803d459afe2d640166fbe95f2a97561b2f3e32e 100644 (file)
@@ -11,7 +11,7 @@
 /* amount of data a print can send. */
 #define STP_BUFFER_SIZE 8192
 
-static int _stp_ctl_write(int type, void *data, unsigned len);
+static void _stp_request_exit(void);
 
 /* STP_CTL_BUFFER_SIZE is the maximum size of a message */
 /* exchanged on the control channel. */
index c17637ae4bb607ab7de7c887e0d5aaf1d7ede581..c3927975c39a1b106d2d5167bc244f8b0fe83241 100644 (file)
@@ -9,8 +9,5 @@
  * running the stap or staprun command.
  */
 function system (cmd:string) %{
-       /* NOTE this uses _stp_ctl_write and not _stp_ctl_send,
-          so this will only be flushed to the .cmd stream on
-          the next periodic _stp_ctl_work timer tick.  */
-       _stp_ctl_write(STP_SYSTEM, THIS->cmd, strlen(THIS->cmd)+1);
+       _stp_ctl_send(STP_SYSTEM, THIS->cmd, strlen(THIS->cmd)+1);
 %}
This page took 0.036242 seconds and 5 git commands to generate.