From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PULL 9/9] ehci: fix frame timer invocation.
Date: Mon, 29 May 2017 15:09:56 +0200 [thread overview]
Message-ID: <20170529130956.20297-10-kraxel@redhat.com> (raw)
In-Reply-To: <20170529130956.20297-1-kraxel@redhat.com>
ehci registers ehci_frame_timer as both timer and bottom half, which
turned out to be a bad idea as it can be called as bottom half then
while it is running as timer, and it isn't prepared to handle recursive
calls.
Change the timer func to just schedule the bottom half to avoid this.
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1449609
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20170519120428.25981-1-kraxel@redhat.com
---
hw/usb/hcd-ehci.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index d7361e570f..17c572c55f 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -2232,7 +2232,7 @@ static void ehci_update_frindex(EHCIState *ehci, int uframes)
ehci->frindex = (ehci->frindex + uframes) % 0x4000;
}
-static void ehci_frame_timer(void *opaque)
+static void ehci_work_bh(void *opaque)
{
EHCIState *ehci = opaque;
int need_timer = 0;
@@ -2324,6 +2324,13 @@ static void ehci_frame_timer(void *opaque)
}
}
+static void ehci_work_timer(void *opaque)
+{
+ EHCIState *ehci = opaque;
+
+ qemu_bh_schedule(ehci->async_bh);
+}
+
static const MemoryRegionOps ehci_mmio_caps_ops = {
.read = ehci_caps_read,
.write = ehci_caps_write,
@@ -2478,8 +2485,8 @@ void usb_ehci_realize(EHCIState *s, DeviceState *dev, Error **errp)
s->ports[i].dev = 0;
}
- s->frame_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, ehci_frame_timer, s);
- s->async_bh = qemu_bh_new(ehci_frame_timer, s);
+ s->frame_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, ehci_work_timer, s);
+ s->async_bh = qemu_bh_new(ehci_work_bh, s);
s->device = dev;
s->vmstate = qemu_add_vm_change_state_handler(usb_ehci_vm_state_change, s);
--
2.9.3
next prev parent reply other threads:[~2017-05-29 13:10 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-29 13:09 [Qemu-devel] [PULL 0/9] usb patch queue Gerd Hoffmann
2017-05-29 13:09 ` [Qemu-devel] [PULL 1/9] ehci: fix overflow in frame timer code Gerd Hoffmann
2017-05-29 13:09 ` [Qemu-devel] [PULL 2/9] usb: Deprecate the legacy -usbdevice option Gerd Hoffmann
2017-05-29 13:09 ` [Qemu-devel] [PULL 3/9] usb: Deprecate HMP commands usb_add and usb_del Gerd Hoffmann
2017-05-29 13:09 ` [Qemu-devel] [PULL 4/9] usb: Simplify the parameter parsing of the legacy usb serial device Gerd Hoffmann
2017-05-29 13:09 ` [Qemu-devel] [PULL 5/9] xhci: split into multiple files Gerd Hoffmann
2017-05-29 13:09 ` [Qemu-devel] [PULL 6/9] xhci: add CONFIG_USB_XHCI_NEC option Gerd Hoffmann
2017-05-29 13:09 ` [Qemu-devel] [PULL 7/9] usb-hub: set PORT_STAT_C_SUSPEND on host-initiated wake-up Gerd Hoffmann
2017-05-29 13:09 ` [Qemu-devel] [PULL 8/9] usb: don't wakeup during coldplug Gerd Hoffmann
2017-05-29 13:09 ` Gerd Hoffmann [this message]
2017-05-30 9:43 ` [Qemu-devel] [PULL 0/9] usb patch queue Stefan Hajnoczi
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=20170529130956.20297-10-kraxel@redhat.com \
--to=kraxel@redhat.com \
--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).