From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36687) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g0iVr-00009K-Iu for qemu-devel@nongnu.org; Fri, 14 Sep 2018 03:27:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g0iVn-00024n-30 for qemu-devel@nongnu.org; Fri, 14 Sep 2018 03:27:35 -0400 Received: from mail.ispras.ru ([83.149.199.45]:48036) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g0iVm-00020R-KV for qemu-devel@nongnu.org; Fri, 14 Sep 2018 03:27:30 -0400 From: "Pavel Dovgalyuk" References: <20180912081747.3228.21861.stgit@pasha-VirtualBox> <20180912081950.3228.68987.stgit@pasha-VirtualBox> <002101d44bee$9edf9720$dc9ec560$@ru> In-Reply-To: <002101d44bee$9edf9720$dc9ec560$@ru> Date: Fri, 14 Sep 2018 10:27:21 +0300 Message-ID: <002301d44bfc$603513c0$209f3b40$@ru> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Content-Language: ru Subject: Re: [Qemu-devel] [PATCH v6 21/25] replay: replay BH for IDE trim operation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: 'Pavel Dovgalyuk' , 'John Snow' , 'Pavel Dovgalyuk' , qemu-devel@nongnu.org Cc: kwolf@redhat.com, peter.maydell@linaro.org, war2jordan@live.com, pbonzini@redhat.com, quintela@redhat.com, ciro.santilli@gmail.com, jasowang@redhat.com, crosthwaite.peter@gmail.com, zuban32s@gmail.com, armbru@redhat.com, maria.klimushenkova@ispras.ru, mst@redhat.com, kraxel@redhat.com, boost.lists@gmail.com, thomas.dullien@googlemail.com, mreitz@redhat.com, alex.bennee@linaro.org, dgilbert@redhat.com, rth@twiddle.net > From: Pavel Dovgalyuk [mailto:dovgaluk@ispras.ru] > > From: John Snow [mailto:jsnow@redhat.com] > > On 09/12/2018 04:19 AM, Pavel Dovgalyuk wrote: > > > This patch makes IDE trim BH deterministic, because it affects > > > the device state. Therefore its invocation should be replayed > > > instead of running at the random moment. > > > > > > Signed-off-by: Pavel Dovgalyuk > > > Reviewed-by: Paolo Bonzini > > > --- > > > hw/ide/core.c | 3 ++- > > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > > > diff --git a/hw/ide/core.c b/hw/ide/core.c > > > index 2c62efc..04e22e7 100644 > > > --- a/hw/ide/core.c > > > +++ b/hw/ide/core.c > > > @@ -35,6 +35,7 @@ > > > #include "sysemu/block-backend.h" > > > #include "qapi/error.h" > > > #include "qemu/cutils.h" > > > +#include "sysemu/replay.h" > > > > > > #include "hw/ide/internal.h" > > > #include "trace.h" > > > @@ -479,7 +480,7 @@ static void ide_issue_trim_cb(void *opaque, int ret) > > > done: > > > iocb->aiocb = NULL; > > > if (iocb->bh) { > > > - qemu_bh_schedule(iocb->bh); > > > + replay_bh_schedule_event(iocb->bh); > > > } > > > } > > > > > Just passing by: Why do we need to change this call, but nothing else in > > IDE? > > This call is responsible for a bug that was reproducible. > > > I don't mind conceptually, but it's odd to me that of all the calls I > > make in this emulator that change state somewhere that this is the only > > one you need to hijack for the replay feature. > > > > Is this a necessarily complete change? I found one more BH in ide/core: static void ide_restart_cb(void *opaque, int running, RunState state) { IDEBus *bus = opaque; if (!running) return; if (!bus->bh) { bus->bh = qemu_bh_new(ide_restart_bh, bus); qemu_bh_schedule(bus->bh); } } void ide_register_restart_cb(IDEBus *bus) { if (bus->dma->ops->restart_dma) { bus->vmstate = qemu_add_vm_change_state_handler(ide_restart_cb, bus); } } As I understand, it is called when VM start/stop event happen. These events are not related to the guest state. Does this BH change the guest state somehow? Pavel Dovgalyuk