From 4495753e791260f3e0ad9eb6ac353da2585fa6239338d7ecc6fe7b74fe1be8f0 Mon Sep 17 00:00:00 2001 From: Bruce Rogers Date: Thu, 31 May 2018 21:00:53 +0000 Subject: [PATCH] Accepting request 613354 from home:bfrogers:branches:Virtualization Fixes for AHCI (workaround->proper upstream fix), ccid-card-passthrough regression, and one more qemu-guest-agent tweak. OBS-URL: https://build.opensuse.org/request/show/613354 OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=412 --- ...-Revert-replay-don-t-process-async-e.patch | 45 -- 0065-ahci-fix-PxCI-register-race.patch | 56 ++ ...-Revert-replay-avoid-recursive-call-.patch | 51 -- ...-ccid-card-passthru-fix-regression-i.patch | 38 + ...-Revert-replay-check-return-values-o.patch | 53 -- ...-Revert-replay-push-replay_mutex_loc.patch | 680 ------------------ 80-qemu-ga.rules | 2 +- qemu-linux-user.changes | 13 + qemu-linux-user.spec | 8 +- qemu-testsuite.changes | 23 + qemu-testsuite.spec | 8 +- qemu.changes | 23 + qemu.spec | 8 +- 13 files changed, 160 insertions(+), 848 deletions(-) delete mode 100644 0065-Revert-replay-don-t-process-async-e.patch create mode 100644 0065-ahci-fix-PxCI-register-race.patch delete mode 100644 0066-Revert-replay-avoid-recursive-call-.patch create mode 100644 0066-ccid-card-passthru-fix-regression-i.patch delete mode 100644 0067-Revert-replay-check-return-values-o.patch delete mode 100644 0068-Revert-replay-push-replay_mutex_loc.patch diff --git a/0065-Revert-replay-don-t-process-async-e.patch b/0065-Revert-replay-don-t-process-async-e.patch deleted file mode 100644 index 5f62ad5..0000000 --- a/0065-Revert-replay-don-t-process-async-e.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 41e6f70a01044bf814949da00e22a18d0ada809b Mon Sep 17 00:00:00 2001 -From: Bruce Rogers -Date: Fri, 25 May 2018 09:08:20 -0600 -Subject: [PATCH] Revert "replay: don't process async events when warping the - clock" - -This reverts commit 89e46eb477113550485bc24264d249de9fd1260a. - -[BR: BSC#1094406] -Signed-off-by: Bruce Rogers ---- - replay/replay-events.c | 1 - - replay/replay.c | 7 +------ - 2 files changed, 1 insertion(+), 7 deletions(-) - -diff --git a/replay/replay-events.c b/replay/replay-events.c -index 707de3867b..fc7d458b90 100644 ---- a/replay/replay-events.c -+++ b/replay/replay-events.c -@@ -201,7 +201,6 @@ static void replay_save_event(Event *event, int checkpoint) - void replay_save_events(int checkpoint) - { - g_assert(replay_mutex_locked()); -- g_assert(checkpoint != CHECKPOINT_CLOCK_WARP_START); - while (!QTAILQ_EMPTY(&events_list)) { - Event *event = QTAILQ_FIRST(&events_list); - replay_save_event(event, checkpoint); -diff --git a/replay/replay.c b/replay/replay.c -index 8228261401..eae8daf18a 100644 ---- a/replay/replay.c -+++ b/replay/replay.c -@@ -211,12 +211,7 @@ bool replay_checkpoint(ReplayCheckpoint checkpoint) - } else if (replay_mode == REPLAY_MODE_RECORD) { - g_assert(replay_mutex_locked()); - replay_put_event(EVENT_CHECKPOINT + checkpoint); -- /* This checkpoint belongs to several threads. -- Processing events from different threads is -- non-deterministic */ -- if (checkpoint != CHECKPOINT_CLOCK_WARP_START) { -- replay_save_events(checkpoint); -- } -+ replay_save_events(checkpoint); - res = true; - } - out: diff --git a/0065-ahci-fix-PxCI-register-race.patch b/0065-ahci-fix-PxCI-register-race.patch new file mode 100644 index 0000000..0fef9f9 --- /dev/null +++ b/0065-ahci-fix-PxCI-register-race.patch @@ -0,0 +1,56 @@ +From e0efecf6cb09ed306c6082949f0ce92f23439c71 Mon Sep 17 00:00:00 2001 +From: John Snow +Date: Thu, 31 May 2018 04:16:16 -0600 +Subject: [PATCH] ahci: fix PxCI register race + +AHCI presently signals completion prior to the PxCI register being +cleared to indicate completion. If a guest driver attempts to issue +a new command in its IRQ handler, it might be surprised to learn there +is still a command pending. + +In the case of Windows 10's boot driver, it will actually poll the IRQ +register hoping to find out when the command is done running -- which +will never happen, as there isn't a command running. + +Fix this: clear PxCI in ahci_cmd_done and not in the asynchronous BH. +Because it now runs synchronously, we don't need to check if the command +is actually done by spying on the ATA registers. We know it's done. + +Signed-off-by: John Snow +[BR: BSC#1094406] +Signed-off-by: Bruce Rogers +--- + hw/ide/ahci.c | 13 ++++++------- + 1 file changed, 6 insertions(+), 7 deletions(-) + +diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c +index e22d7be05f..18b9a9c18b 100644 +--- a/hw/ide/ahci.c ++++ b/hw/ide/ahci.c +@@ -532,13 +532,6 @@ static void ahci_check_cmd_bh(void *opaque) + qemu_bh_delete(ad->check_bh); + ad->check_bh = NULL; + +- if ((ad->busy_slot != -1) && +- !(ad->port.ifs[0].status & (BUSY_STAT|DRQ_STAT))) { +- /* no longer busy */ +- ad->port_regs.cmd_issue &= ~(1 << ad->busy_slot); +- ad->busy_slot = -1; +- } +- + check_cmd(ad->hba, ad->port_no); + } + +@@ -1425,6 +1418,12 @@ static void ahci_cmd_done(IDEDMA *dma) + + trace_ahci_cmd_done(ad->hba, ad->port_no); + ++ /* no longer busy */ ++ if (ad->busy_slot != -1) { ++ ad->port_regs.cmd_issue &= ~(1 << ad->busy_slot); ++ ad->busy_slot = -1; ++ } ++ + /* update d2h status */ + ahci_write_fis_d2h(ad); + diff --git a/0066-Revert-replay-avoid-recursive-call-.patch b/0066-Revert-replay-avoid-recursive-call-.patch deleted file mode 100644 index 04c5cef..0000000 --- a/0066-Revert-replay-avoid-recursive-call-.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 00300f4a36119691fc8689575424d380b2450bf7 Mon Sep 17 00:00:00 2001 -From: Bruce Rogers -Date: Fri, 25 May 2018 09:09:04 -0600 -Subject: [PATCH] Revert "replay: avoid recursive call of checkpoints" - -This reverts commit 66eb7825d0bd84a870a054fb208fe765317109fa. - -[BR: BSC#1094406] -Signed-off-by: Bruce Rogers ---- - replay/replay.c | 14 +------------- - 1 file changed, 1 insertion(+), 13 deletions(-) - -diff --git a/replay/replay.c b/replay/replay.c -index eae8daf18a..90f98b7490 100644 ---- a/replay/replay.c -+++ b/replay/replay.c -@@ -176,24 +176,13 @@ void replay_shutdown_request(ShutdownCause cause) - bool replay_checkpoint(ReplayCheckpoint checkpoint) - { - bool res = false; -- static bool in_checkpoint; - assert(EVENT_CHECKPOINT + checkpoint <= EVENT_CHECKPOINT_LAST); -+ replay_save_instructions(); - - if (!replay_file) { - return true; - } - -- if (in_checkpoint) { -- /* If we are already in checkpoint, then there is no need -- for additional synchronization. -- Recursion occurs when HW event modifies timers. -- Timer modification may invoke the checkpoint and -- proceed to recursion. */ -- return true; -- } -- in_checkpoint = true; -- -- replay_save_instructions(); - - if (replay_mode == REPLAY_MODE_PLAY) { - g_assert(replay_mutex_locked()); -@@ -215,7 +204,6 @@ bool replay_checkpoint(ReplayCheckpoint checkpoint) - res = true; - } - out: -- in_checkpoint = false; - return res; - } - diff --git a/0066-ccid-card-passthru-fix-regression-i.patch b/0066-ccid-card-passthru-fix-regression-i.patch new file mode 100644 index 0000000..f60420a --- /dev/null +++ b/0066-ccid-card-passthru-fix-regression-i.patch @@ -0,0 +1,38 @@ +From 69a3175c82f1a8453e021d19a5ddd362e8c4fb80 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= +Date: Tue, 15 May 2018 17:30:39 +0200 +Subject: [PATCH] ccid-card-passthru: fix regression in realize() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Since cc847bfd16d894fd8c1a2ce25f31772f6cdbbc74, CCID card-passthru +fails to intialize, because it changed a debug line to an error, +probably by mistake. Change it back to a DPRINTF debug. + +(solves Boxes creating VM with smartcard passthru failing to start) + +Signed-off-by: Marc-André Lureau +Reviewed-by: Philippe Mathieu-Daudé +Message-id: 20180515153039.27514-1-marcandre.lureau@redhat.com +Signed-off-by: Gerd Hoffmann +(cherry picked from commit e58d64a16abc2304c4dcb644411eb9580bf63b1e) +[BR: BSC#1095419] +Signed-off-by: Bruce Rogers +--- + hw/usb/ccid-card-passthru.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/hw/usb/ccid-card-passthru.c b/hw/usb/ccid-card-passthru.c +index b7dd3602dc..668a22d2da 100644 +--- a/hw/usb/ccid-card-passthru.c ++++ b/hw/usb/ccid-card-passthru.c +@@ -345,7 +345,7 @@ static void passthru_realize(CCIDCardState *base, Error **errp) + card->vscard_in_pos = 0; + card->vscard_in_hdr = 0; + if (qemu_chr_fe_backend_connected(&card->cs)) { +- error_setg(errp, "ccid-card-passthru: initing chardev"); ++ DPRINTF(card, D_INFO, "ccid-card-passthru: initing chardev"); + qemu_chr_fe_set_handlers(&card->cs, + ccid_card_vscard_can_read, + ccid_card_vscard_read, diff --git a/0067-Revert-replay-check-return-values-o.patch b/0067-Revert-replay-check-return-values-o.patch deleted file mode 100644 index ca0d4e1..0000000 --- a/0067-Revert-replay-check-return-values-o.patch +++ /dev/null @@ -1,53 +0,0 @@ -From cceb1b09c36f71bdb84cd8b3ad20d63335fc1559 Mon Sep 17 00:00:00 2001 -From: Bruce Rogers -Date: Fri, 25 May 2018 09:09:28 -0600 -Subject: [PATCH] Revert "replay: check return values of fwrite" - -This reverts commit 6dc0f5296359ff59c248215a965c8658dea9544b. - -[BR: BSC#1094406] -Signed-off-by: Bruce Rogers ---- - replay/replay-internal.c | 17 ++--------------- - 1 file changed, 2 insertions(+), 15 deletions(-) - -diff --git a/replay/replay-internal.c b/replay/replay-internal.c -index b077cb5fd5..8e7474f787 100644 ---- a/replay/replay-internal.c -+++ b/replay/replay-internal.c -@@ -24,23 +24,12 @@ - static QemuMutex lock; - - /* File for replay writing */ --static bool write_error; - FILE *replay_file; - --static void replay_write_error(void) --{ -- if (!write_error) { -- error_report("replay write error"); -- write_error = true; -- } --} -- - void replay_put_byte(uint8_t byte) - { - if (replay_file) { -- if (putc(byte, replay_file) == EOF) { -- replay_write_error(); -- } -+ putc(byte, replay_file); - } - } - -@@ -73,9 +62,7 @@ void replay_put_array(const uint8_t *buf, size_t size) - { - if (replay_file) { - replay_put_dword(size); -- if (fwrite(buf, 1, size, replay_file) != size) { -- replay_write_error(); -- } -+ fwrite(buf, 1, size, replay_file); - } - } - diff --git a/0068-Revert-replay-push-replay_mutex_loc.patch b/0068-Revert-replay-push-replay_mutex_loc.patch deleted file mode 100644 index 7ddf67c..0000000 --- a/0068-Revert-replay-push-replay_mutex_loc.patch +++ /dev/null @@ -1,680 +0,0 @@ -From 844d663fad2ad36a2960d21a93f36ab29de8215f Mon Sep 17 00:00:00 2001 -From: Bruce Rogers -Date: Fri, 25 May 2018 09:10:26 -0600 -Subject: [PATCH] Revert "replay: push replay_mutex_lock up the call tree" - -This reverts commit d759c951f3287fad04210a52f2dc93f94cf58c7f. - -[BR: BSC#1094406] -Signed-off-by: Bruce Rogers ---- - cpus.c | 24 ++---------------------- - docs/replay.txt | 22 ---------------------- - replay/replay-audio.c | 14 ++++++++++---- - replay/replay-char.c | 21 +++++++++++++-------- - replay/replay-events.c | 19 ++++++++++++------- - replay/replay-internal.c | 24 ++++++++---------------- - replay/replay-time.c | 10 +++++----- - replay/replay.c | 34 +++++++++++++++++++++------------- - util/main-loop.c | 15 ++++----------- - vl.c | 1 - - 10 files changed, 75 insertions(+), 109 deletions(-) - -diff --git a/cpus.c b/cpus.c -index b13112b8e2..7ea0d1c560 100644 ---- a/cpus.c -+++ b/cpus.c -@@ -1325,8 +1325,6 @@ static void prepare_icount_for_run(CPUState *cpu) - insns_left = MIN(0xffff, cpu->icount_budget); - cpu->icount_decr.u16.low = insns_left; - cpu->icount_extra = cpu->icount_budget - insns_left; -- -- replay_mutex_lock(); - } - } - -@@ -1342,8 +1340,6 @@ static void process_icount_data(CPUState *cpu) - cpu->icount_budget = 0; - - replay_account_executed_instructions(); -- -- replay_mutex_unlock(); - } - } - -@@ -1358,9 +1354,11 @@ static int tcg_cpu_exec(CPUState *cpu) - #ifdef CONFIG_PROFILER - ti = profile_getclock(); - #endif -+ qemu_mutex_unlock_iothread(); - cpu_exec_start(cpu); - ret = cpu_exec(cpu); - cpu_exec_end(cpu); -+ qemu_mutex_lock_iothread(); - #ifdef CONFIG_PROFILER - tcg_time += profile_getclock() - ti; - #endif -@@ -1427,9 +1425,6 @@ static void *qemu_tcg_rr_cpu_thread_fn(void *arg) - cpu->exit_request = 1; - - while (1) { -- qemu_mutex_unlock_iothread(); -- replay_mutex_lock(); -- qemu_mutex_lock_iothread(); - /* Account partial waits to QEMU_CLOCK_VIRTUAL. */ - qemu_account_warp_timer(); - -@@ -1438,8 +1433,6 @@ static void *qemu_tcg_rr_cpu_thread_fn(void *arg) - */ - handle_icount_deadline(); - -- replay_mutex_unlock(); -- - if (!cpu) { - cpu = first_cpu; - } -@@ -1455,13 +1448,11 @@ static void *qemu_tcg_rr_cpu_thread_fn(void *arg) - if (cpu_can_run(cpu)) { - int r; - -- qemu_mutex_unlock_iothread(); - prepare_icount_for_run(cpu); - - r = tcg_cpu_exec(cpu); - - process_icount_data(cpu); -- qemu_mutex_lock_iothread(); - - if (r == EXCP_DEBUG) { - cpu_handle_guest_debug(cpu); -@@ -1651,9 +1642,7 @@ static void *qemu_tcg_cpu_thread_fn(void *arg) - do { - if (cpu_can_run(cpu)) { - int r; -- qemu_mutex_unlock_iothread(); - r = tcg_cpu_exec(cpu); -- qemu_mutex_lock_iothread(); - switch (r) { - case EXCP_DEBUG: - cpu_handle_guest_debug(cpu); -@@ -1800,21 +1789,12 @@ void pause_all_vcpus(void) - } - } - -- /* We need to drop the replay_lock so any vCPU threads woken up -- * can finish their replay tasks -- */ -- replay_mutex_unlock(); -- - while (!all_vcpus_paused()) { - qemu_cond_wait(&qemu_pause_cond, &qemu_global_mutex); - CPU_FOREACH(cpu) { - qemu_cpu_kick(cpu); - } - } -- -- qemu_mutex_unlock_iothread(); -- replay_mutex_lock(); -- qemu_mutex_lock_iothread(); - } - - void cpu_resume(CPUState *cpu) -diff --git a/docs/replay.txt b/docs/replay.txt -index 2e21e9ccb0..91875db3cd 100644 ---- a/docs/replay.txt -+++ b/docs/replay.txt -@@ -68,28 +68,6 @@ Modifications of qemu include: - * block driver for making block layer deterministic - * serial port input record and replay - --Locking and thread synchronisation ------------------------------------ -- --Previously the synchronisation of the main thread and the vCPU thread --was ensured by the holding of the BQL. However the trend has been to --reduce the time the BQL was held across the system including under TCG --system emulation. As it is important that batches of events are kept --in sequence (e.g. expiring timers and checkpoints in the main thread --while instruction checkpoints are written by the vCPU thread) we need --another lock to keep things in lock-step. This role is now handled by --the replay_mutex_lock. It used to be held only for each event being --written but now it is held for a whole execution period. This results --in a deterministic ping-pong between the two main threads. -- --As the BQL is now a finer grained lock than the replay_lock it is almost --certainly a bug, and a source of deadlocks, to take the --replay_mutex_lock while the BQL is held. This is enforced by an assert. --While the unlocks are usually in the reverse order, this is not --necessary; you can drop the replay_lock while holding the BQL, without --doing a more complicated unlock_iothread/replay_unlock/lock_iothread --sequence. -- - Non-deterministic events - ------------------------ - -diff --git a/replay/replay-audio.c b/replay/replay-audio.c -index b113836de4..3d837434d4 100644 ---- a/replay/replay-audio.c -+++ b/replay/replay-audio.c -@@ -19,17 +19,20 @@ - void replay_audio_out(int *played) - { - if (replay_mode == REPLAY_MODE_RECORD) { -- g_assert(replay_mutex_locked()); - replay_save_instructions(); -+ replay_mutex_lock(); - replay_put_event(EVENT_AUDIO_OUT); - replay_put_dword(*played); -+ replay_mutex_unlock(); - } else if (replay_mode == REPLAY_MODE_PLAY) { -- g_assert(replay_mutex_locked()); - replay_account_executed_instructions(); -+ replay_mutex_lock(); - if (replay_next_event_is(EVENT_AUDIO_OUT)) { - *played = replay_get_dword(); - replay_finish_event(); -+ replay_mutex_unlock(); - } else { -+ replay_mutex_unlock(); - error_report("Missing audio out event in the replay log"); - abort(); - } -@@ -41,8 +44,8 @@ void replay_audio_in(int *recorded, void *samples, int *wpos, int size) - int pos; - uint64_t left, right; - if (replay_mode == REPLAY_MODE_RECORD) { -- g_assert(replay_mutex_locked()); - replay_save_instructions(); -+ replay_mutex_lock(); - replay_put_event(EVENT_AUDIO_IN); - replay_put_dword(*recorded); - replay_put_dword(*wpos); -@@ -52,9 +55,10 @@ void replay_audio_in(int *recorded, void *samples, int *wpos, int size) - replay_put_qword(left); - replay_put_qword(right); - } -+ replay_mutex_unlock(); - } else if (replay_mode == REPLAY_MODE_PLAY) { -- g_assert(replay_mutex_locked()); - replay_account_executed_instructions(); -+ replay_mutex_lock(); - if (replay_next_event_is(EVENT_AUDIO_IN)) { - *recorded = replay_get_dword(); - *wpos = replay_get_dword(); -@@ -65,7 +69,9 @@ void replay_audio_in(int *recorded, void *samples, int *wpos, int size) - audio_sample_from_uint64(samples, pos, left, right); - } - replay_finish_event(); -+ replay_mutex_unlock(); - } else { -+ replay_mutex_unlock(); - error_report("Missing audio in event in the replay log"); - abort(); - } -diff --git a/replay/replay-char.c b/replay/replay-char.c -index 736cc8c2e6..cbf7c04a9f 100755 ---- a/replay/replay-char.c -+++ b/replay/replay-char.c -@@ -96,24 +96,25 @@ void *replay_event_char_read_load(void) - - void replay_char_write_event_save(int res, int offset) - { -- g_assert(replay_mutex_locked()); -- - replay_save_instructions(); -+ replay_mutex_lock(); - replay_put_event(EVENT_CHAR_WRITE); - replay_put_dword(res); - replay_put_dword(offset); -+ replay_mutex_unlock(); - } - - void replay_char_write_event_load(int *res, int *offset) - { -- g_assert(replay_mutex_locked()); -- - replay_account_executed_instructions(); -+ replay_mutex_lock(); - if (replay_next_event_is(EVENT_CHAR_WRITE)) { - *res = replay_get_dword(); - *offset = replay_get_dword(); - replay_finish_event(); -+ replay_mutex_unlock(); - } else { -+ replay_mutex_unlock(); - error_report("Missing character write event in the replay log"); - exit(1); - } -@@ -121,21 +122,23 @@ void replay_char_write_event_load(int *res, int *offset) - - int replay_char_read_all_load(uint8_t *buf) - { -- g_assert(replay_mutex_locked()); -- -+ replay_mutex_lock(); - if (replay_next_event_is(EVENT_CHAR_READ_ALL)) { - size_t size; - int res; - replay_get_array(buf, &size); - replay_finish_event(); -+ replay_mutex_unlock(); - res = (int)size; - assert(res >= 0); - return res; - } else if (replay_next_event_is(EVENT_CHAR_READ_ALL_ERROR)) { - int res = replay_get_dword(); - replay_finish_event(); -+ replay_mutex_unlock(); - return res; - } else { -+ replay_mutex_unlock(); - error_report("Missing character read all event in the replay log"); - exit(1); - } -@@ -143,17 +146,19 @@ int replay_char_read_all_load(uint8_t *buf) - - void replay_char_read_all_save_error(int res) - { -- g_assert(replay_mutex_locked()); - assert(res < 0); - replay_save_instructions(); -+ replay_mutex_lock(); - replay_put_event(EVENT_CHAR_READ_ALL_ERROR); - replay_put_dword(res); -+ replay_mutex_unlock(); - } - - void replay_char_read_all_save_buf(uint8_t *buf, int offset) - { -- g_assert(replay_mutex_locked()); - replay_save_instructions(); -+ replay_mutex_lock(); - replay_put_event(EVENT_CHAR_READ_ALL); - replay_put_array(buf, offset); -+ replay_mutex_unlock(); - } -diff --git a/replay/replay-events.c b/replay/replay-events.c -index fc7d458b90..75d7e09ccc 100644 ---- a/replay/replay-events.c -+++ b/replay/replay-events.c -@@ -75,14 +75,16 @@ bool replay_has_events(void) - - void replay_flush_events(void) - { -- g_assert(replay_mutex_locked()); -- -+ replay_mutex_lock(); - while (!QTAILQ_EMPTY(&events_list)) { - Event *event = QTAILQ_FIRST(&events_list); -+ replay_mutex_unlock(); - replay_run_event(event); -+ replay_mutex_lock(); - QTAILQ_REMOVE(&events_list, event, events); - g_free(event); - } -+ replay_mutex_unlock(); - } - - void replay_disable_events(void) -@@ -96,14 +98,14 @@ void replay_disable_events(void) - - void replay_clear_events(void) - { -- g_assert(replay_mutex_locked()); -- -+ replay_mutex_lock(); - while (!QTAILQ_EMPTY(&events_list)) { - Event *event = QTAILQ_FIRST(&events_list); - QTAILQ_REMOVE(&events_list, event, events); - - g_free(event); - } -+ replay_mutex_unlock(); - } - - /*! Adds specified async event to the queue */ -@@ -130,8 +132,9 @@ void replay_add_event(ReplayAsyncEventKind event_kind, - event->opaque2 = opaque2; - event->id = id; - -- g_assert(replay_mutex_locked()); -+ replay_mutex_lock(); - QTAILQ_INSERT_TAIL(&events_list, event, events); -+ replay_mutex_unlock(); - } - - void replay_bh_schedule_event(QEMUBH *bh) -@@ -200,11 +203,13 @@ static void replay_save_event(Event *event, int checkpoint) - /* Called with replay mutex locked */ - void replay_save_events(int checkpoint) - { -- g_assert(replay_mutex_locked()); - while (!QTAILQ_EMPTY(&events_list)) { - Event *event = QTAILQ_FIRST(&events_list); - replay_save_event(event, checkpoint); -+ -+ replay_mutex_unlock(); - replay_run_event(event); -+ replay_mutex_lock(); - QTAILQ_REMOVE(&events_list, event, events); - g_free(event); - } -@@ -285,7 +290,6 @@ static Event *replay_read_event(int checkpoint) - /* Called with replay mutex locked */ - void replay_read_events(int checkpoint) - { -- g_assert(replay_mutex_locked()); - while (replay_state.data_kind == EVENT_ASYNC) { - Event *event = replay_read_event(checkpoint); - if (!event) { -@@ -294,6 +298,7 @@ void replay_read_events(int checkpoint) - replay_finish_event(); - replay_state.read_event_kind = -1; - replay_run_event(event); -+ replay_mutex_lock(); - - g_free(event); - } -diff --git a/replay/replay-internal.c b/replay/replay-internal.c -index 8e7474f787..fa7bba6dfd 100644 ---- a/replay/replay-internal.c -+++ b/replay/replay-internal.c -@@ -174,9 +174,6 @@ static __thread bool replay_locked; - void replay_mutex_init(void) - { - qemu_mutex_init(&lock); -- /* Hold the mutex while we start-up */ -- qemu_mutex_lock(&lock); -- replay_locked = true; - } - - bool replay_mutex_locked(void) -@@ -184,31 +181,25 @@ bool replay_mutex_locked(void) - return replay_locked; - } - --/* Ordering constraints, replay_lock must be taken before BQL */ - void replay_mutex_lock(void) - { -- if (replay_mode != REPLAY_MODE_NONE) { -- g_assert(!qemu_mutex_iothread_locked()); -- g_assert(!replay_mutex_locked()); -- qemu_mutex_lock(&lock); -- replay_locked = true; -- } -+ g_assert(!replay_mutex_locked()); -+ qemu_mutex_lock(&lock); -+ replay_locked = true; - } - - void replay_mutex_unlock(void) - { -- if (replay_mode != REPLAY_MODE_NONE) { -- g_assert(replay_mutex_locked()); -- replay_locked = false; -- qemu_mutex_unlock(&lock); -- } -+ g_assert(replay_mutex_locked()); -+ replay_locked = false; -+ qemu_mutex_unlock(&lock); - } - - /*! Saves cached instructions. */ - void replay_save_instructions(void) - { - if (replay_file && replay_mode == REPLAY_MODE_RECORD) { -- g_assert(replay_mutex_locked()); -+ replay_mutex_lock(); - int diff = (int)(replay_get_current_step() - replay_state.current_step); - - /* Time can only go forward */ -@@ -219,5 +210,6 @@ void replay_save_instructions(void) - replay_put_dword(diff); - replay_state.current_step += diff; - } -+ replay_mutex_unlock(); - } - } -diff --git a/replay/replay-time.c b/replay/replay-time.c -index 6a7565ec8d..f70382a88f 100644 ---- a/replay/replay-time.c -+++ b/replay/replay-time.c -@@ -17,13 +17,13 @@ - - int64_t replay_save_clock(ReplayClockKind kind, int64_t clock) - { -+ replay_save_instructions(); - - if (replay_file) { -- g_assert(replay_mutex_locked()); -- -- replay_save_instructions(); -+ replay_mutex_lock(); - replay_put_event(EVENT_CLOCK + kind); - replay_put_qword(clock); -+ replay_mutex_unlock(); - } - - return clock; -@@ -46,16 +46,16 @@ void replay_read_next_clock(ReplayClockKind kind) - /*! Reads next clock event from the input. */ - int64_t replay_read_clock(ReplayClockKind kind) - { -- g_assert(replay_file && replay_mutex_locked()); -- - replay_account_executed_instructions(); - - if (replay_file) { - int64_t ret; -+ replay_mutex_lock(); - if (replay_next_event_is(EVENT_CLOCK + kind)) { - replay_read_next_clock(kind); - } - ret = replay_state.cached_clock[kind]; -+ replay_mutex_unlock(); - - return ret; - } -diff --git a/replay/replay.c b/replay/replay.c -index 90f98b7490..5d05ee0460 100644 ---- a/replay/replay.c -+++ b/replay/replay.c -@@ -81,7 +81,7 @@ int replay_get_instructions(void) - void replay_account_executed_instructions(void) - { - if (replay_mode == REPLAY_MODE_PLAY) { -- g_assert(replay_mutex_locked()); -+ replay_mutex_lock(); - if (replay_state.instructions_count > 0) { - int count = (int)(replay_get_current_step() - - replay_state.current_step); -@@ -100,22 +100,24 @@ void replay_account_executed_instructions(void) - qemu_notify_event(); - } - } -+ replay_mutex_unlock(); - } - } - - bool replay_exception(void) - { -- - if (replay_mode == REPLAY_MODE_RECORD) { -- g_assert(replay_mutex_locked()); - replay_save_instructions(); -+ replay_mutex_lock(); - replay_put_event(EVENT_EXCEPTION); -+ replay_mutex_unlock(); - return true; - } else if (replay_mode == REPLAY_MODE_PLAY) { -- g_assert(replay_mutex_locked()); - bool res = replay_has_exception(); - if (res) { -+ replay_mutex_lock(); - replay_finish_event(); -+ replay_mutex_unlock(); - } - return res; - } -@@ -127,9 +129,10 @@ bool replay_has_exception(void) - { - bool res = false; - if (replay_mode == REPLAY_MODE_PLAY) { -- g_assert(replay_mutex_locked()); - replay_account_executed_instructions(); -+ replay_mutex_lock(); - res = replay_next_event_is(EVENT_EXCEPTION); -+ replay_mutex_unlock(); - } - - return res; -@@ -138,15 +141,17 @@ bool replay_has_exception(void) - bool replay_interrupt(void) - { - if (replay_mode == REPLAY_MODE_RECORD) { -- g_assert(replay_mutex_locked()); - replay_save_instructions(); -+ replay_mutex_lock(); - replay_put_event(EVENT_INTERRUPT); -+ replay_mutex_unlock(); - return true; - } else if (replay_mode == REPLAY_MODE_PLAY) { -- g_assert(replay_mutex_locked()); - bool res = replay_has_interrupt(); - if (res) { -+ replay_mutex_lock(); - replay_finish_event(); -+ replay_mutex_unlock(); - } - return res; - } -@@ -158,9 +163,10 @@ bool replay_has_interrupt(void) - { - bool res = false; - if (replay_mode == REPLAY_MODE_PLAY) { -- g_assert(replay_mutex_locked()); - replay_account_executed_instructions(); -+ replay_mutex_lock(); - res = replay_next_event_is(EVENT_INTERRUPT); -+ replay_mutex_unlock(); - } - return res; - } -@@ -168,8 +174,9 @@ bool replay_has_interrupt(void) - void replay_shutdown_request(ShutdownCause cause) - { - if (replay_mode == REPLAY_MODE_RECORD) { -- g_assert(replay_mutex_locked()); -+ replay_mutex_lock(); - replay_put_event(EVENT_SHUTDOWN + cause); -+ replay_mutex_unlock(); - } - } - -@@ -183,9 +190,9 @@ bool replay_checkpoint(ReplayCheckpoint checkpoint) - return true; - } - -+ replay_mutex_lock(); - - if (replay_mode == REPLAY_MODE_PLAY) { -- g_assert(replay_mutex_locked()); - if (replay_next_event_is(EVENT_CHECKPOINT + checkpoint)) { - replay_finish_event(); - } else if (replay_state.data_kind != EVENT_ASYNC) { -@@ -198,12 +205,12 @@ bool replay_checkpoint(ReplayCheckpoint checkpoint) - checkpoint were processed */ - res = replay_state.data_kind != EVENT_ASYNC; - } else if (replay_mode == REPLAY_MODE_RECORD) { -- g_assert(replay_mutex_locked()); - replay_put_event(EVENT_CHECKPOINT + checkpoint); - replay_save_events(checkpoint); - res = true; - } - out: -+ replay_mutex_unlock(); - return res; - } - -@@ -226,6 +233,8 @@ static void replay_enable(const char *fname, int mode) - - atexit(replay_finish); - -+ replay_mutex_init(); -+ - replay_file = fopen(fname, fmode); - if (replay_file == NULL) { - fprintf(stderr, "Replay: open %s: %s\n", fname, strerror(errno)); -@@ -233,9 +242,8 @@ static void replay_enable(const char *fname, int mode) - } - - replay_filename = g_strdup(fname); -- replay_mode = mode; -- replay_mutex_init(); - -+ replay_mode = mode; - replay_state.data_kind = -1; - replay_state.instructions_count = 0; - replay_state.current_step = 0; -diff --git a/util/main-loop.c b/util/main-loop.c -index 992f9b0f34..7558eb5f53 100644 ---- a/util/main-loop.c -+++ b/util/main-loop.c -@@ -29,7 +29,6 @@ - #include "qemu/sockets.h" // struct in_addr needed for libslirp.h - #include "sysemu/qtest.h" - #include "sysemu/cpus.h" --#include "sysemu/replay.h" - #include "slirp/libslirp.h" - #include "qemu/main-loop.h" - #include "block/aio.h" -@@ -246,19 +245,18 @@ static int os_host_main_loop_wait(int64_t timeout) - timeout = SCALE_MS; - } - -- - if (timeout) { - spin_counter = 0; -+ qemu_mutex_unlock_iothread(); - } else { - spin_counter++; - } -- qemu_mutex_unlock_iothread(); -- replay_mutex_unlock(); - - ret = qemu_poll_ns((GPollFD *)gpollfds->data, gpollfds->len, timeout); - -- replay_mutex_lock(); -- qemu_mutex_lock_iothread(); -+ if (timeout) { -+ qemu_mutex_lock_iothread(); -+ } - - glib_pollfds_poll(); - -@@ -465,13 +463,8 @@ static int os_host_main_loop_wait(int64_t timeout) - poll_timeout_ns = qemu_soonest_timeout(poll_timeout_ns, timeout); - - qemu_mutex_unlock_iothread(); -- -- replay_mutex_unlock(); -- - g_poll_ret = qemu_poll_ns(poll_fds, n_poll_fds + w->num, poll_timeout_ns); - -- replay_mutex_lock(); -- - qemu_mutex_lock_iothread(); - if (g_poll_ret > 0) { - for (i = 0; i < w->num; i++) { -diff --git a/vl.c b/vl.c -index c00a250831..7b55c5ae7f 100644 ---- a/vl.c -+++ b/vl.c -@@ -3066,7 +3066,6 @@ int main(int argc, char **argv, char **envp) - - qemu_init_cpu_list(); - qemu_init_cpu_loop(); -- - qemu_mutex_lock_iothread(); - - /* diff --git a/80-qemu-ga.rules b/80-qemu-ga.rules index 9d7733c..2bc19a1 100644 --- a/80-qemu-ga.rules +++ b/80-qemu-ga.rules @@ -1 +1 @@ -SUBSYSTEM=="virtio-ports", ATTR{name}=="org.qemu.guest_agent.0", TAG+="systemd", ENV{SYSTEMD_WANTS}+="qemu-ga@virtio\x2dports-org.qemu.guest_agent.0.service" +SUBSYSTEM=="virtio-ports", ATTR{name}=="org.qemu.guest_agent.0", TAG+="systemd", ENV{SYSTEMD_WANTS}+="qemu-ga@virtio\\x2dports-org.qemu.guest_agent.0.service" diff --git a/qemu-linux-user.changes b/qemu-linux-user.changes index 4d334f1..05aeb92 100644 --- a/qemu-linux-user.changes +++ b/qemu-linux-user.changes @@ -1,3 +1,16 @@ +------------------------------------------------------------------- +Thu May 31 19:51:59 UTC 2018 - brogers@suse.com + +- Patch queue updated from git://github.com/openSUSE/qemu.git opensuse-2.12 +* Patches dropped: + 0065-Revert-replay-don-t-process-async-e.patch + 0066-Revert-replay-avoid-recursive-call-.patch + 0067-Revert-replay-check-return-values-o.patch + 0068-Revert-replay-push-replay_mutex_loc.patch +* Patches added: + 0065-ahci-fix-PxCI-register-race.patch + 0066-ccid-card-passthru-fix-regression-i.patch + ------------------------------------------------------------------- Fri May 25 15:13:19 UTC 2018 - brogers@suse.com diff --git a/qemu-linux-user.spec b/qemu-linux-user.spec index b2e69fc..152b697 100644 --- a/qemu-linux-user.spec +++ b/qemu-linux-user.spec @@ -90,10 +90,8 @@ Patch0061: 0061-nfs-Remove-processed-options-from-Q.patch Patch0062: 0062-i386-define-the-ssbd-CPUID-feature-.patch Patch0063: 0063-i386-Define-the-Virt-SSBD-MSR-and-h.patch Patch0064: 0064-i386-define-the-AMD-virt-ssbd-CPUID.patch -Patch0065: 0065-Revert-replay-don-t-process-async-e.patch -Patch0066: 0066-Revert-replay-avoid-recursive-call-.patch -Patch0067: 0067-Revert-replay-check-return-values-o.patch -Patch0068: 0068-Revert-replay-push-replay_mutex_loc.patch +Patch0065: 0065-ahci-fix-PxCI-register-race.patch +Patch0066: 0066-ccid-card-passthru-fix-regression-i.patch # Please do not add QEMU patches manually here. # Run update_git.sh to regenerate this queue. Source400: update_git.sh @@ -193,8 +191,6 @@ syscall layer occurs on the native hardware and operating system. %patch0064 -p1 %patch0065 -p1 %patch0066 -p1 -%patch0067 -p1 -%patch0068 -p1 %build ./configure \ diff --git a/qemu-testsuite.changes b/qemu-testsuite.changes index 8e2a777..2fb0188 100644 --- a/qemu-testsuite.changes +++ b/qemu-testsuite.changes @@ -1,3 +1,26 @@ +------------------------------------------------------------------- +Thu May 31 19:51:52 UTC 2018 - brogers@suse.com + +- Looks like the right fix for the AHCI issue has been identified + upstream. Turns out to also affect Linux guests as well. + (bsc#1094406) +* Patches dropped: + 0065-Revert-replay-don-t-process-async-e.patch + 0066-Revert-replay-avoid-recursive-call-.patch + 0067-Revert-replay-check-return-values-o.patch + 0068-Revert-replay-push-replay_mutex_loc.patch +* Patches added: + 0065-ahci-fix-PxCI-register-race.patch +- Fix a regresssion introduced in v2.12.0 for ccid-card-passthrough + (bsc#1095419) + 0066-ccid-card-passthru-fix-regression-i.patch +- Patch queue updated from git://github.com/openSUSE/qemu.git opensuse-2.12 + +------------------------------------------------------------------- +Tue May 29 10:44:23 UTC 2018 - lma@suse.com + +- Fix qemu-guest-agent service issue (bsc#1094898) + ------------------------------------------------------------------- Fri May 25 15:13:16 UTC 2018 - brogers@suse.com diff --git a/qemu-testsuite.spec b/qemu-testsuite.spec index a216f6c..20d8f63 100644 --- a/qemu-testsuite.spec +++ b/qemu-testsuite.spec @@ -194,10 +194,8 @@ Patch0061: 0061-nfs-Remove-processed-options-from-Q.patch Patch0062: 0062-i386-define-the-ssbd-CPUID-feature-.patch Patch0063: 0063-i386-Define-the-Virt-SSBD-MSR-and-h.patch Patch0064: 0064-i386-define-the-AMD-virt-ssbd-CPUID.patch -Patch0065: 0065-Revert-replay-don-t-process-async-e.patch -Patch0066: 0066-Revert-replay-avoid-recursive-call-.patch -Patch0067: 0067-Revert-replay-check-return-values-o.patch -Patch0068: 0068-Revert-replay-push-replay_mutex_loc.patch +Patch0065: 0065-ahci-fix-PxCI-register-race.patch +Patch0066: 0066-ccid-card-passthru-fix-regression-i.patch # Please do not add QEMU patches manually here. # Run update_git.sh to regenerate this queue. @@ -932,8 +930,6 @@ This package provides a service file for starting and stopping KSM. %patch0064 -p1 %patch0065 -p1 %patch0066 -p1 -%patch0067 -p1 -%patch0068 -p1 %if 0%{?suse_version} > 1320 %patch1000 -p1 diff --git a/qemu.changes b/qemu.changes index 8e2a777..2fb0188 100644 --- a/qemu.changes +++ b/qemu.changes @@ -1,3 +1,26 @@ +------------------------------------------------------------------- +Thu May 31 19:51:52 UTC 2018 - brogers@suse.com + +- Looks like the right fix for the AHCI issue has been identified + upstream. Turns out to also affect Linux guests as well. + (bsc#1094406) +* Patches dropped: + 0065-Revert-replay-don-t-process-async-e.patch + 0066-Revert-replay-avoid-recursive-call-.patch + 0067-Revert-replay-check-return-values-o.patch + 0068-Revert-replay-push-replay_mutex_loc.patch +* Patches added: + 0065-ahci-fix-PxCI-register-race.patch +- Fix a regresssion introduced in v2.12.0 for ccid-card-passthrough + (bsc#1095419) + 0066-ccid-card-passthru-fix-regression-i.patch +- Patch queue updated from git://github.com/openSUSE/qemu.git opensuse-2.12 + +------------------------------------------------------------------- +Tue May 29 10:44:23 UTC 2018 - lma@suse.com + +- Fix qemu-guest-agent service issue (bsc#1094898) + ------------------------------------------------------------------- Fri May 25 15:13:16 UTC 2018 - brogers@suse.com diff --git a/qemu.spec b/qemu.spec index db50314..4d3ddd4 100644 --- a/qemu.spec +++ b/qemu.spec @@ -194,10 +194,8 @@ Patch0061: 0061-nfs-Remove-processed-options-from-Q.patch Patch0062: 0062-i386-define-the-ssbd-CPUID-feature-.patch Patch0063: 0063-i386-Define-the-Virt-SSBD-MSR-and-h.patch Patch0064: 0064-i386-define-the-AMD-virt-ssbd-CPUID.patch -Patch0065: 0065-Revert-replay-don-t-process-async-e.patch -Patch0066: 0066-Revert-replay-avoid-recursive-call-.patch -Patch0067: 0067-Revert-replay-check-return-values-o.patch -Patch0068: 0068-Revert-replay-push-replay_mutex_loc.patch +Patch0065: 0065-ahci-fix-PxCI-register-race.patch +Patch0066: 0066-ccid-card-passthru-fix-regression-i.patch # Please do not add QEMU patches manually here. # Run update_git.sh to regenerate this queue. @@ -932,8 +930,6 @@ This package provides a service file for starting and stopping KSM. %patch0064 -p1 %patch0065 -p1 %patch0066 -p1 -%patch0067 -p1 -%patch0068 -p1 %if 0%{?suse_version} > 1320 %patch1000 -p1