Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5752C6FA9D for ; Wed, 1 Mar 2023 14:10:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229977AbjCAOKB (ORCPT ); Wed, 1 Mar 2023 09:10:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229965AbjCAOJ5 (ORCPT ); Wed, 1 Mar 2023 09:09:57 -0500 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0A542F796 for ; Wed, 1 Mar 2023 06:09:47 -0800 (PST) Received: by mail-wr1-x429.google.com with SMTP id h11so1610130wrm.5 for ; Wed, 01 Mar 2023 06:09:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf.com; s=google; t=1677679786; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=t2tkGhWdBAa8vzlH7r5oMbSYEhnxp7JkbKglKgSKZPM=; b=oUYse4DWw7yraUVmj59PCoIil14gWfqSJGLpk8uuNeWmLJrodJcy6b/gtXgE5biTkP GcPvcVQZ3cZ/13zsauESm0SPU9qozBpH3CfZeUwHwG46Zdm85Pyw56Z/C/7MIbiBnWua 4OXFZBHbVyK0pv84eQaUU/HHUtolfdk2Uugk58+Kngve/qHUMX/LZcSbhTRrtLWC9F+S sSPnUzjWtlHvOf3VxgQyviEgwNeLtcPIr10deJxTr7Ktah0l89yiCzF2bFq7OQGWeqF+ KttFMWWs2TAL0f9D8K66/p8MxDEg/gPJr1OO5NAT9lKSrXGZQXWDkcj4dFoNKN6szQRm hkkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677679786; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=t2tkGhWdBAa8vzlH7r5oMbSYEhnxp7JkbKglKgSKZPM=; b=gh+eH6H/o+txOd/E19eQtPj8AKFdLN4S46B0wAMQ9p4saYfSoQLaRzS2GZS1Ii1lTF elWKNBI42f8oqfXYD3Fz4gkb5sDa5gvxFIAmoynQGjx02xeBQ86EXeNlMh+GXp+nBl0P NZTjxM1vw/EJkdkRkew8VP2k7tO95wDxapm6p8d7EPc0HSKzYzs/b/aauEXPnWPYx3aA LWaE5fEs+wssyh99HFPgWpTYdaAooArfHG5LmE/+0ClLECvuBg6WoY7MCOD3UTDNH8iT jJFg/P+vbfVeuHY+LI0DtkZYmLXhAvvMUwwBRzA2LR9euz/6npb4pSXXjB2RNG9S+Tkq oMLA== X-Gm-Message-State: AO0yUKU35Qum3Icg3Tv0Pd5s6ofTXdZzoyaGYGkq0EZ8HmdyUC/yXqBp jfY74OFmriuh/B4Sg3zY6LGT3OuDgmhErNvKCcxVyg== X-Google-Smtp-Source: AK7set9C5QJ7lsnqeJK/GewLPn7eFADZyhxWk7KE+HwrjwBBgCiFNzCVKAVfBkPHY46lDxy2+JoL8SXc11QLl/ITKFw= X-Received: by 2002:a05:6000:1e12:b0:2c5:5941:a04b with SMTP id bj18-20020a0560001e1200b002c55941a04bmr4283116wrb.7.1677679786037; Wed, 01 Mar 2023 06:09:46 -0800 (PST) MIME-Version: 1.0 References: <20230301075751.43839-1-lma@semihalf.com> In-Reply-To: From: Lukasz Majczak Date: Wed, 1 Mar 2023 15:09:35 +0100 Message-ID: Subject: Re: [PATCH] serial: core: fix broken console after suspend To: Greg Kroah-Hartman Cc: Jiri Slaby , Guenter Roeck , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, upstream@semihalf.com, stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org =C5=9Br., 1 mar 2023 o 13:22 Greg Kroah-Hartman napisa=C5=82(a): > > On Wed, Mar 01, 2023 at 10:51:31AM +0100, Lukasz Majczak wrote: > > =C5=9Br., 1 mar 2023 o 09:39 Greg Kroah-Hartman > > napisa=C5=82(a): > > > > > > On Wed, Mar 01, 2023 at 08:57:51AM +0100, Lukasz Majczak wrote: > > > > Re-enable the console device after suspending, causes its cflags, > > > > ispeed and ospeed to be set anew, basing on the values stored in > > > > uport->cons. The issue is that these values are set only once, > > > > when parsing console parameters after boot (see uart_set_options())= , > > > > next after configuring a port in uart_port_startup() these paramete= res > > > > (cflags, ispeed and ospeed) are copied to termios structure and > > > > the orginal one (stored in uport->cons) are cleared, but there is n= o place > > > > in code where those fields are checked against 0. > > > > When kernel calls uart_resume_port() and setups console, it copies = cflags, > > > > ispeed and ospeed values from uart->cons,but those are alread clear= ed. > > > > The efect is that console is broken. > > > > This patch address this by preserving the cflags, ispeed and > > > > ospeed fields in uart->cons during uart_port_startup(). > > > > > > > > Signed-off-by: Lukasz Majczak > > > > Cc: stable@vger.kernel.org > > > > --- > > > > drivers/tty/serial/serial_core.c | 3 --- > > > > 1 file changed, 3 deletions(-) > > > > > > > > diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/= serial_core.c > > > > index 2bd32c8ece39..394a05c09d87 100644 > > > > --- a/drivers/tty/serial/serial_core.c > > > > +++ b/drivers/tty/serial/serial_core.c > > > > @@ -225,9 +225,6 @@ static int uart_port_startup(struct tty_struct = *tty, struct uart_state *state, > > > > tty->termios.c_cflag =3D uport->cons->cflag; > > > > tty->termios.c_ispeed =3D uport->cons->ispeed= ; > > > > tty->termios.c_ospeed =3D uport->cons->ospeed= ; > > > > - uport->cons->cflag =3D 0; > > > > - uport->cons->ispeed =3D 0; > > > > - uport->cons->ospeed =3D 0; > > > > } > > > > /* > > > > * Initialise the hardware port settings. > > > > -- > > > > 2.39.2.722.g9855ee24e9-goog > > > > > > > > > > What commit id does this fix? > > > > > > thanks, > > > > > > greg k-h > > Hi Greg, > > > > There are actually two commits that introduce problematic uport flags > > clearing in uart_startup (for the sake of simplicity I'd ignore the > > older history): > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/comm= it/?h=3Dv6.2&id=3Dc7d7abff40c27f82fe78b1091ab3fad69b2546f9 > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/comm= it/?h=3Dv6.2&id=3D027b57170bf8bb6999a28e4a5f3d78bf1db0f90c > > It's 10 years between those 2 and to me it was hard to decide about > > picking a proper one for the `Fixes:` tag. > > How would you recommend to proceed wrt applying this patch on the > > stable releases? > > Where do you think this needs to go to? Pick something? > > And as you have obviously found this on a device running an older kernel > version, what kernel tree(s) did you test it on? > > thanks, > > greg k-h As this patch applies without conflict on 4.14, I would suggest 4.14+. I have tested the patch on chromes-5.15 (cannonlake device). Best regards, Lukasz