Patchwork [1/3] qemu-timer: drop outdated signal safety comments

login
register
mail settings
Submitter Stefan Hajnoczi
Date July 5, 2013, 12:39 p.m.
Message ID <1373027986-17868-2-git-send-email-stefanha@redhat.com>
Download mbox | patch
Permalink /patch/257171/
State New
Headers show

Comments

Stefan Hajnoczi - July 5, 2013, 12:39 p.m.
host_alarm_handler() may be invoked as a signal handler.  Previously we
did more processing in the signal handler and therefore needed
signal-safe timer code.

Today host_alarm_handler() just marks the alarm timer as expired/pending
and notifies the main loop using qemu_notify_event().

Therefore these outdated comments about signal safety can be dropped.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 qemu-timer.c | 4 ----
 1 file changed, 4 deletions(-)
Jan Kiszka - July 5, 2013, 5:52 p.m.
On 2013-07-05 14:39, Stefan Hajnoczi wrote:
> host_alarm_handler() may be invoked as a signal handler.  Previously we
> did more processing in the signal handler and therefore needed
> signal-safe timer code.

Signal handlers run in the context of the signal processing thread, i.e.
the iothread so far.

> 
> Today host_alarm_handler() just marks the alarm timer as expired/pending
> and notifies the main loop using qemu_notify_event().
> 
> Therefore these outdated comments about signal safety can be dropped.
> 
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
>  qemu-timer.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/qemu-timer.c b/qemu-timer.c
> index b2d95e2..4740da9 100644
> --- a/qemu-timer.c
> +++ b/qemu-timer.c
> @@ -300,8 +300,6 @@ void qemu_del_timer(QEMUTimer *ts)
>  {
>      QEMUTimer **pt, *t;
>  
> -    /* NOTE: this code must be signal safe because
> -       qemu_timer_expired() can be called from a signal. */
>      pt = &ts->clock->active_timers;
>      for(;;) {
>          t = *pt;
> @@ -324,8 +322,6 @@ void qemu_mod_timer_ns(QEMUTimer *ts, int64_t expire_time)
>      qemu_del_timer(ts);
>  
>      /* add the timer in the sorted list */
> -    /* NOTE: this code must be signal safe because
> -       qemu_timer_expired() can be called from a signal. */
>      pt = &ts->clock->active_timers;
>      for(;;) {
>          t = *pt;
> 

If you fix the imprecision in the log:

Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com>

Jan

Patch

diff --git a/qemu-timer.c b/qemu-timer.c
index b2d95e2..4740da9 100644
--- a/qemu-timer.c
+++ b/qemu-timer.c
@@ -300,8 +300,6 @@  void qemu_del_timer(QEMUTimer *ts)
 {
     QEMUTimer **pt, *t;
 
-    /* NOTE: this code must be signal safe because
-       qemu_timer_expired() can be called from a signal. */
     pt = &ts->clock->active_timers;
     for(;;) {
         t = *pt;
@@ -324,8 +322,6 @@  void qemu_mod_timer_ns(QEMUTimer *ts, int64_t expire_time)
     qemu_del_timer(ts);
 
     /* add the timer in the sorted list */
-    /* NOTE: this code must be signal safe because
-       qemu_timer_expired() can be called from a signal. */
     pt = &ts->clock->active_timers;
     for(;;) {
         t = *pt;