From nobody Tue Feb 10 15:01:04 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496063526291426.7902785949949; Mon, 29 May 2017 06:12:06 -0700 (PDT) Received: from localhost ([::1]:48717 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dFKSp-0000cx-E5 for importer@patchew.org; Mon, 29 May 2017 09:12:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54433) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dFKQz-0007uz-M6 for qemu-devel@nongnu.org; Mon, 29 May 2017 09:10:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dFKQy-0002GX-J2 for qemu-devel@nongnu.org; Mon, 29 May 2017 09:10:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43292) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dFKQy-0002Dt-Du for qemu-devel@nongnu.org; Mon, 29 May 2017 09:10:08 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8D07EC049D5D for ; Mon, 29 May 2017 13:10:07 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-32.ams2.redhat.com [10.36.116.32]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3CA42187A9; Mon, 29 May 2017 13:10:05 +0000 (UTC) Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id 49C7380E19; Mon, 29 May 2017 15:09:59 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8D07EC049D5D Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=kraxel@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 8D07EC049D5D From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 29 May 2017 15:09:56 +0200 Message-Id: <20170529130956.20297-10-kraxel@redhat.com> In-Reply-To: <20170529130956.20297-1-kraxel@redhat.com> References: <20170529130956.20297-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 29 May 2017 13:10:07 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 9/9] ehci: fix frame timer invocation. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=3D1449609 Signed-off-by: Gerd Hoffmann 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 =3D (ehci->frindex + uframes) % 0x4000; } =20 -static void ehci_frame_timer(void *opaque) +static void ehci_work_bh(void *opaque) { EHCIState *ehci =3D opaque; int need_timer =3D 0; @@ -2324,6 +2324,13 @@ static void ehci_frame_timer(void *opaque) } } =20 +static void ehci_work_timer(void *opaque) +{ + EHCIState *ehci =3D opaque; + + qemu_bh_schedule(ehci->async_bh); +} + static const MemoryRegionOps ehci_mmio_caps_ops =3D { .read =3D ehci_caps_read, .write =3D ehci_caps_write, @@ -2478,8 +2485,8 @@ void usb_ehci_realize(EHCIState *s, DeviceState *dev,= Error **errp) s->ports[i].dev =3D 0; } =20 - s->frame_timer =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, ehci_frame_timer, = s); - s->async_bh =3D qemu_bh_new(ehci_frame_timer, s); + s->frame_timer =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, ehci_work_timer, s= ); + s->async_bh =3D qemu_bh_new(ehci_work_bh, s); s->device =3D dev; =20 s->vmstate =3D qemu_add_vm_change_state_handler(usb_ehci_vm_state_chan= ge, s); --=20 2.9.3