qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: pavel.dovgaluk@ispras.ru
Subject: [Qemu-devel] [PATCH 1/4] replay: generalize ptimer event to bottom halves
Date: Tue,  6 Oct 2015 22:00:55 +0200	[thread overview]
Message-ID: <1444161658-15038-2-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1444161658-15038-1-git-send-email-pbonzini@redhat.com>

Make the code a bit more type safe and follow the same scheme as
replay_input_event and replay_input_sync_event.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/core/ptimer.c         |  6 +-----
 replay/replay-events.c   | 15 ++++++++++-----
 replay/replay-internal.h |  2 +-
 replay/replay.h          |  4 ++--
 4 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/hw/core/ptimer.c b/hw/core/ptimer.c
index c56078d..86d544f 100644
--- a/hw/core/ptimer.c
+++ b/hw/core/ptimer.c
@@ -28,11 +28,7 @@ struct ptimer_state
 static void ptimer_trigger(ptimer_state *s)
 {
     if (s->bh) {
-        if (replay_mode != REPLAY_MODE_NONE) {
-            replay_add_ptimer_event(s->bh, replay_get_current_step());
-        } else {
-            qemu_bh_schedule(s->bh);
-        }
+        replay_bh_schedule_event(s->bh);
     }
 }
 
diff --git a/replay/replay-events.c b/replay/replay-events.c
index 23f3b12..06dd4ca 100755
--- a/replay/replay-events.c
+++ b/replay/replay-events.c
@@ -37,7 +37,7 @@ static bool events_enabled;
 static void replay_run_event(Event *event)
 {
     switch (event->event_kind) {
-    case REPLAY_ASYNC_EVENT_PTIMER:
+    case REPLAY_ASYNC_EVENT_BH:
         aio_bh_call(event->opaque);
         break;
     case REPLAY_ASYNC_EVENT_INPUT:
@@ -129,9 +129,14 @@ static void replay_add_event(ReplayAsyncEventKind event_kind,
     replay_mutex_unlock();
 }
 
-void replay_add_ptimer_event(void *bh, uint64_t id)
+void replay_bh_schedule_event(QEMUBH *bh)
 {
-    replay_add_event(REPLAY_ASYNC_EVENT_PTIMER, bh, NULL, id);
+    if (replay_mode != REPLAY_MODE_NONE) {
+        uint64_t id = replay_get_current_step();
+        replay_add_event(REPLAY_ASYNC_EVENT_BH, bh, NULL, id);
+    } else {
+        qemu_bh_schedule(bh);
+    }
 }
 
 void replay_add_input_event(struct InputEvent *event)
@@ -154,7 +159,7 @@ static void replay_save_event(Event *event, int checkpoint)
 
         /* save event-specific data */
         switch (event->event_kind) {
-        case REPLAY_ASYNC_EVENT_PTIMER:
+        case REPLAY_ASYNC_EVENT_BH:
             replay_put_qword(event->id);
             break;
         case REPLAY_ASYNC_EVENT_INPUT:
@@ -200,7 +205,7 @@ static Event *replay_read_event(int checkpoint)
 
     /* Events that has not to be in the queue */
     switch (read_event_kind) {
-    case REPLAY_ASYNC_EVENT_PTIMER:
+    case REPLAY_ASYNC_EVENT_BH:
         if (read_id == -1) {
             read_id = replay_get_qword();
         }
diff --git a/replay/replay-internal.h b/replay/replay-internal.h
index 04d2e1b..77e0d29 100755
--- a/replay/replay-internal.h
+++ b/replay/replay-internal.h
@@ -41,7 +41,7 @@ enum ReplayEvents {
 /* Asynchronous events IDs */
 
 enum ReplayAsyncEventKind {
-    REPLAY_ASYNC_EVENT_PTIMER,
+    REPLAY_ASYNC_EVENT_BH,
     REPLAY_ASYNC_EVENT_INPUT,
     REPLAY_ASYNC_EVENT_INPUT_SYNC,
     REPLAY_ASYNC_COUNT
diff --git a/replay/replay.h b/replay/replay.h
index cbb4e11..abb4688 100755
--- a/replay/replay.h
+++ b/replay/replay.h
@@ -110,8 +110,8 @@ bool replay_checkpoint(ReplayCheckpoint checkpoint);
 void replay_disable_events(void);
 /*! Returns true when saving events is enabled */
 bool replay_events_enabled(void);
-/*! Adds ptimer event to the queue */
-void replay_add_ptimer_event(void *bh, uint64_t id);
+/*! Adds bottom half event to the queue */
+void replay_bh_schedule_event(QEMUBH *bh);
 /*! Adds input event to the queue */
 void replay_input_event(QemuConsole *src, InputEvent *evt);
 /*! Adds input sync event to the queue */
-- 
2.5.0

  reply	other threads:[~2015-10-06 20:01 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-06 20:00 [Qemu-devel] [RFH PATCH 0/4] record/replay fixups and doubts Paolo Bonzini
2015-10-06 20:00 ` Paolo Bonzini [this message]
2015-10-07  7:53   ` [Qemu-devel] [PATCH 1/4] replay: generalize ptimer event to bottom halves Pavel Dovgaluk
2015-10-06 20:00 ` [Qemu-devel] [PATCH 2/4] more replay fixes Paolo Bonzini
2015-10-06 20:13   ` Eric Blake
2015-10-07  8:11   ` Pavel Dovgaluk
2015-10-06 20:00 ` [Qemu-devel] [PATCH 3/4] why is runstate_is_running needed? Paolo Bonzini
2015-10-07  8:14   ` Pavel Dovgaluk
     [not found]   ` <22126.3941414238$1444205724@news.gmane.org>
2015-10-07  8:46     ` Paolo Bonzini
2015-10-07  9:37   ` Pavel Dovgaluk
2015-10-06 20:00 ` [Qemu-devel] [PATCH 4/4] events doubts Paolo Bonzini
2015-10-07  8:21   ` Pavel Dovgaluk
     [not found]   ` <35633.6639299572$1444206177@news.gmane.org>
2015-10-07  8:52     ` Paolo Bonzini
2015-10-07  9:50       ` Pavel Dovgaluk
2015-10-07 10:23         ` Paolo Bonzini
2015-10-07 10:42           ` Pavel Dovgaluk
2015-10-07 10:48             ` Paolo Bonzini
2015-10-07 10:51               ` Pavel Dovgaluk
2015-10-07 14:59                 ` Paolo Bonzini
2015-10-13  8:10 ` [Qemu-devel] [RFH PATCH 0/4] record/replay fixups and doubts Pavel Dovgaluk
2015-10-13 16:39   ` Paolo Bonzini
2015-10-23  7:28 ` Pavel Dovgaluk
2015-10-23  8:12   ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1444161658-15038-2-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=pavel.dovgaluk@ispras.ru \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).