Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp2588872rdh; Mon, 30 Oct 2023 01:31:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFDn4YPmHo6selov3VwsHQEmakzdi2ZRXbEPBrxYbOc3aDSXL0GPUqZeovuIthMXP+sn8Y7 X-Received: by 2002:a05:6a21:999f:b0:180:b492:cb6e with SMTP id ve31-20020a056a21999f00b00180b492cb6emr440877pzb.32.1698654690567; Mon, 30 Oct 2023 01:31:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698654690; cv=none; d=google.com; s=arc-20160816; b=PgE7Pzohu82Gr2UnY2v1dUtB9dpDRfRZNMNfAJQFfMRtggcp6q1Dn7pY/OyprvoV0U TDqgeaxBnQBwk3aSoFNFRrRgCySo4BCWmT3LzbgA0mOrNBaR4nlFaDw2auMnP9/JddGL ENW3LkIZlNPVfuMmF1LybmZx8QSQk6UiWB0DzFr93GNNIvSVHlJGyaIhESd3+UTmorRw iOWZX+Rsm0Aln34kVhOlYLAN1YvFcTb590p9KE9Y/aSx6c2bz3bfPHCfvElsilGp+pS7 +mKdSC5Mybx934tlLclBq5As4L30Cq871POhKLuQ9bX2RFQFZ8h77q0pMf/Vz46Jw42r /NxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=NJjuReufmhhvHtzqtnqzm7uDG6fdBnwgWhGG187bcyk=; fh=H5CgL2BDC6Lm4WQFZd/57RJDG4LR7xTIzvZNptOS2dI=; b=prnHw/OaNtjFAZruOahzvFwTSq3kLpGa6ZtN94tDwgxMTHMNHF0P4LTYBGLW15Blzl NKUyEPORgPtsSn2lVJ5QGhoebCcMF3lo65JHaXPCaq8awBPgCF0igaWOz8P2st4YvVu3 P5MYPZ5+9Ek2L/QHbISwxGCtWq5gsfe+P6EOLaOqlmbMmv02YwdLIuv+FuhudX7zGywW HdDaLYS58nl1FfNHb6tBQv7oCdPfohOEB2g7kt/kCGk1xcQx80jGHzwQ7+I414EBajpi gp5P3/9u+ROVMlbRQgQ3SILcQI3q2MjzWTDUUdUNuS4Bl8SXvUb4MnW8ImAY+Mo9cQ7E zrVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Cn3QcCi9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id e10-20020a17090301ca00b001beef8ccd05si1149328plh.489.2023.10.30.01.31.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 01:31:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Cn3QcCi9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 0A316807C7CC; Mon, 30 Oct 2023 01:30:39 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232185AbjJ3Ia0 (ORCPT + 99 others); Mon, 30 Oct 2023 04:30:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232182AbjJ3IaW (ORCPT ); Mon, 30 Oct 2023 04:30:22 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93665CC for ; Mon, 30 Oct 2023 01:30:19 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5DA7C433C7; Mon, 30 Oct 2023 08:30:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1698654619; bh=0UimFwwOXgzTlodgzdl7ZzZqU/y6LF8gHiLYvuFrwC0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Cn3QcCi9Gk5JXC4nGvd8HJvk1R9BTyA46Zf/w6/gxGOf7nXin+kTsmd5qeCY4zXsM ioUUsqX/MHFSJJHhudmv1VuW4zWQ8w6L3BmXFdkeN6OP26kNPr7DqVNcbsmi6jSgVK IvgicuqynQtxtIf64GriJEwqcc21BWOgxWUSD204= Date: Mon, 30 Oct 2023 09:30:15 +0100 From: Greg KH To: ariel marcovitch Cc: johan@kernel.org, linux-usb@vger.kernel.org, Linux Kernel Mailing List Subject: Re: Gaps in logs while using usb-serial as a console Message-ID: <2023103003-defection-recess-cf49@gregkh> References: <2023103052-unpeeled-calibrate-ae48@gregkh> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.3 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 30 Oct 2023 01:30:39 -0700 (PDT) On Mon, Oct 30, 2023 at 10:15:30AM +0200, ariel marcovitch wrote: > > Please realize that usb-serial console was the result of me loosing a > > drunken bet. It's amazing it works at all. For "fake" devices like > LOL your drunken bet was quite helpful to some people > Because modern PCs come without a serial port, I wanted to use it to > see early logs on my crashing kernel without having to use printk > delay and things like that. > I'm curious as to how kernel people debug PCs in general... We use a usb debug port connection (it's a special cable). > In any case, the usb-serial setup was quite weird as it required two > usb-serial and a gender changer Yes, that's normal. > > this, that use the generic usb-serial code, yes, you will have overruns > > and other problems, that's just part of how it works (i.e. not well.) > > > > For something like qemu, please use a real console, like the serial port > > (i.e. a fake serial port), not the fake usb-serial port. > Yeah I was just using it to demonstrate the problem (I agree it is > quite weird to use usb-serial as a console for qemu) > I experienced the same problem with a real usb-serial device, then I > tried to use emulation so I can debug it more easily Which real usb-serial device? That matters as it's up to the individual driver to handle the flow control properly. > > So this is "working as designed" in that it wasn't designed at all and > > again, it is a miracle any data is flowing there at all :) > I see... > However it may be possible to fix it without much effort, so why not? > Something like checking the return value for the console's write > function seems reasonable to me anyway... But overflows for buffers can not be handled by consoles like this > Besides, don't other types of consoles have the same problem (being > initialized late, getting a lot of data, losing some of it)? Yes, they do have that problem, this is not unique. You can just see it very easily when using the generic usb-serial driver as there is almost no buffering at all in it other than what the tty layer provides. Adding larger buffers can help with this, but where do you stop? What is the proper buffer size to always use? Overall, if you are going to be doing lots of debugging of early-boot and console logs, I recommend getting a usb debug cable instead, sorry. usb-serial console is just "best effort" and we're happy that any data flows out of the thing at all :) thanks, greg k-h