On 2016年09月01日 12:50, Zhang Chen wrote:
+ sprintf(thread_name, "colo-compare %d", compare_id);
+ qemu_thread_create(&s->thread, thread_name,
+ colo_compare_thread, s,
+ QEMU_THREAD_JOINABLE);
+ compare_id++;
+
+ /* A regular timer to kick any packets that the secondary
doesn't match */
+ s->timer = timer_new_ms(QEMU_CLOCK_VIRTUAL, /* Only when guest
runs */
+ check_old_packet_regular, s);
+ timer_mod(s->timer, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) +
+ REGULAR_PACKET_CHECK_MS);
I still think we need to make sure the timer were processed in colo
thread. Since check_old_packet_regular may iterate conn_list which
may be modified by colo thread at the same time.
Make sense, but in here we just read the conn_list, maybe we should
add a lock for it?
Because of we don't have a easy way to make timer's handler run in
colo thread,
the handler run in main-loop. Maybe this job we can do it later.
Thanks
Zhang Chen
A lock is ok for this series. But need to add a TODO here and we
something like patch 1 to make sure timer could be processed other than
main loop in the future.
Thanks