From nobody Mon Feb 9 03:12:43 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584438728; cv=none; d=zohomail.com; s=zohoarc; b=UNo6HDbqrgUFNz82t3mxefecXhF/7AemJNhEOOOKKcWMcmUgh9j1BHxmCrn5GWsre87UK3bFNRnUjC3fssDCqOmHRV/KNOeAcweNgFvuZGpoTsFOtQV2xKyuABerl8ksZXPKQRARd2GJKCmaCqHou5MWt4oQKJIShsXonM9UkV0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584438728; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=9inKhgTKTv0zqUNtHcvV+Fodc2GZ+KSmWsdMNps03Lw=; b=GJ4B5x9TPiCclD/f/kkUBLkJyoasJ3JlU5Mkk6Ttbi64s0L1sMLr+LD9+CSGp4DvwgJ37lTCjJET5w/GaNVBE56Om0tBr4ulsWmYGaN0gWLD8NAldWBOzSpIf/T2DPysGvRDZtUuJPMTP8B5ZyOn3TUp+I8vKyJWyyvhcVMqyAk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1584438728242100.54123600498406; Tue, 17 Mar 2020 02:52:08 -0700 (PDT) Received: from localhost ([::1]:55239 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jE8tK-0007Q0-L3 for importer@patchew.org; Tue, 17 Mar 2020 05:52:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56910) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jE8sI-0005oB-C4 for qemu-devel@nongnu.org; Tue, 17 Mar 2020 05:51:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jE8sD-0004kJ-On for qemu-devel@nongnu.org; Tue, 17 Mar 2020 05:51:02 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:38327) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jE8sD-0004ja-L3 for qemu-devel@nongnu.org; Tue, 17 Mar 2020 05:50:57 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-273-djqS0EqCMci9L8iicU9oeg-1; Tue, 17 Mar 2020 05:50:55 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D94F7801E6C; Tue, 17 Mar 2020 09:50:53 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-49.ams2.redhat.com [10.36.112.49]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0D2578F37B; Tue, 17 Mar 2020 09:50:50 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 1A88B204A0; Tue, 17 Mar 2020 10:50:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584438657; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9inKhgTKTv0zqUNtHcvV+Fodc2GZ+KSmWsdMNps03Lw=; b=d3yfzBSSwLrPh3/VeqYSI63Fx2aSYuMSyDjtm/ch1b+3edd/INYIXV6Q0BwYp7Nbl9zblP FHz6va+dfMDj0j40nVw/i5pMXF+iYKp1uYXPAhN/EycR3XT5yccYOsQiNrv3L60hXZCmbq zmIfT7aiC8QE2WwRIRkNHGnu70CVJcg= X-MC-Unique: djqS0EqCMci9L8iicU9oeg-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 4/4] usb-serial: Fix timeout closing the device Date: Tue, 17 Mar 2020 10:50:49 +0100 Message-Id: <20200317095049.28486-5-kraxel@redhat.com> In-Reply-To: <20200317095049.28486-1-kraxel@redhat.com> References: <20200317095049.28486-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 216.205.24.74 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Samuel Thibault , Gerd Hoffmann , Jason Andryuk Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Jason Andryuk Linux guests wait ~30 seconds when closing the emulated /dev/ttyUSB0. During that time, the kernel driver is sending many control URBs requesting GetModemStat (5). Real hardware returns a status with FTDI_THRE (Transmitter Holding Register) and FTDI_TEMT (Transmitter Empty) set. QEMU leaves them clear, and it seems Linux is waiting for FTDI_TEMT to be set to indicate the tx queue is empty before closing. Set the bits when responding to a GetModemStat query and avoid the shutdown delay. Signed-off-by: Jason Andryuk Reviewed-by: Samuel Thibault Message-id: 20200316174610.115820-5-jandryuk@gmail.com Signed-off-by: Gerd Hoffmann --- hw/usb/dev-serial.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/usb/dev-serial.c b/hw/usb/dev-serial.c index 77b964588b5f..d2c03681b7f0 100644 --- a/hw/usb/dev-serial.c +++ b/hw/usb/dev-serial.c @@ -332,7 +332,7 @@ static void usb_serial_handle_control(USBDevice *dev, U= SBPacket *p, break; case DeviceInVendor | FTDI_GET_MDM_ST: data[0] =3D usb_get_modem_lines(s) | 1; - data[1] =3D 0; + data[1] =3D FTDI_THRE | FTDI_TEMT; p->actual_length =3D 2; break; case DeviceOutVendor | FTDI_SET_EVENT_CHR: --=20 2.18.2