From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E5199C433DF for ; Fri, 10 Jul 2020 11:45:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A931A20748 for ; Fri, 10 Jul 2020 11:45:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.b="OKrH2Sgp" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726757AbgGJLpi (ORCPT ); Fri, 10 Jul 2020 07:45:38 -0400 Received: from mail-dm6nam11on2065.outbound.protection.outlook.com ([40.107.223.65]:31147 "EHLO NAM11-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726725AbgGJLph (ORCPT ); Fri, 10 Jul 2020 07:45:37 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kxRu4Y/XZvt31l/nECuyKrhBS5qN8d3UDDT3wvdZbdfxfTrMSR8DjgC+J6SSKmr4Qq/6f0fNb5f04XfcMprLuYqgrk7NMiBwxPlcUMa1cnYvV+8QP8AueCy07DkV0yvtxWNjtN6WDlX8vYxj/0YrzN7dj8UiN4qFBvdCjYE8tn9KrlLy8f3D9A2WoHciEM2mcpEmLv2Jqtibsl2xd1pVq2c+GT+TeR0zH95eE6ugJWJ4IxmlcxzbD8U+ihT9YlizpZLwdAObbFjyySCYmNcxOZO1jA3pxCl5E9bxdkx2y1H/OQIUfyTX2focYadVvSMkyEa8rHDgdlPGURcgz6mQ4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tLOYZERGU2M0QFXZAq3aH9Bba5xFQVTfksdfa61I+MM=; b=bzkLFvTqjQ6AmYiEjLAgvrmJadnOs4fs6LDy9D0XvN+6oiEVuXgKNIQO66rp7YbqdNZMdYMNFB2Matn7M4HCIWGAUpxUuP9Lrq/DEyIxqg/S7ZSd3hdXfPblk/7pUe7x4lJn3WhfDK7/LKJZ/zXCmOBRBGbyoHvYR98cf2xXXP9I8B/ZdFPZ3sylbCihtCBM1F0H6L3aqo8uD101Jwbk4QyzldA042ZVaOlXSBPL5Muvvqba8V85nzUX4iHf30ukGyVeYLnRymliXiIdeFcPSa4A/EFC/xEcoojrVFOkz1JLYW6l9rQlS1Hukc7sBcZL+n9aQOrOLHZ3S5Ucbt3obg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.60.83) smtp.rcpttodomain=intenta.de smtp.mailfrom=xilinx.com; dmarc=bestguesspass action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tLOYZERGU2M0QFXZAq3aH9Bba5xFQVTfksdfa61I+MM=; b=OKrH2SgpdnfxiMeOSdKzT1+M9yT2pAMBDawnV4a+tE1Ay3dwHfocqCZv2qJS1w7syNIN3z8rLH9miExDs/JT/TzjMvQI3wkOsuItpMdsTE+hqDzf50Bx42rU6eVPj9WCuG93JhYEg97z7Ki2q/EF24A2eCOnWmiyXalHEaeKJsU= Received: from CY4PR08CA0046.namprd08.prod.outlook.com (2603:10b6:903:151::32) by DM6PR02MB7065.namprd02.prod.outlook.com (2603:10b6:5:25a::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3174.20; Fri, 10 Jul 2020 11:45:33 +0000 Received: from CY1NAM02FT044.eop-nam02.prod.protection.outlook.com (2603:10b6:903:151:cafe::6a) by CY4PR08CA0046.outlook.office365.com (2603:10b6:903:151::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3174.21 via Frontend Transport; Fri, 10 Jul 2020 11:45:33 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; intenta.de; dkim=none (message not signed) header.d=none;intenta.de; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.83 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.83; helo=xsj-pvapsmtpgw01; Received: from xsj-pvapsmtpgw01 (149.199.60.83) by CY1NAM02FT044.mail.protection.outlook.com (10.152.75.137) with Microsoft SMTP Server id 15.20.3174.21 via Frontend Transport; Fri, 10 Jul 2020 11:45:32 +0000 Received: from [149.199.38.66] (port=56829 helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw01 with esmtp (Exim 4.90) (envelope-from ) id 1jtrRc-0003T0-3x; Fri, 10 Jul 2020 04:43:56 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1jtrT9-0007QK-Sd; Fri, 10 Jul 2020 04:45:31 -0700 Received: from xsj-pvapsmtp01 (mailhost.xilinx.com [149.199.38.66]) by xsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id 06ABjOt8030935; Fri, 10 Jul 2020 04:45:24 -0700 Received: from [172.30.17.109] by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1jtrT1-0007Lz-Vu; Fri, 10 Jul 2020 04:45:24 -0700 From: Michal Simek Subject: Re: [PATCH] tty: xilinx_uartps: Really fix id assignment To: Helmut Grohne , Greg Kroah-Hartman , Jiri Slaby , Michal Simek , Shubhrajyoti Datta , Jan Kiszka Cc: linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org References: <20200709074849.GA28968@laureti-dev> Autocrypt: addr=michals@xilinx.com; keydata= xsFNBFFuvDEBEAC9Amu3nk79+J+4xBOuM5XmDmljuukOc6mKB5bBYOa4SrWJZTjeGRf52VMc howHe8Y9nSbG92obZMqsdt+d/hmRu3fgwRYiiU97YJjUkCN5paHXyBb+3IdrLNGt8I7C9RMy svSoH4WcApYNqvB3rcMtJIna+HUhx8xOk+XCfyKJDnrSuKgx0Svj446qgM5fe7RyFOlGX/wF Ae63Hs0RkFo3I/+hLLJP6kwPnOEo3lkvzm3FMMy0D9VxT9e6Y3afe1UTQuhkg8PbABxhowzj SEnl0ICoqpBqqROV/w1fOlPrm4WSNlZJunYV4gTEustZf8j9FWncn3QzRhnQOSuzTPFbsbH5 WVxwDvgHLRTmBuMw1sqvCc7CofjsD1XM9bP3HOBwCxKaTyOxbPJh3D4AdD1u+cF/lj9Fj255 Es9aATHPvoDQmOzyyRNTQzupN8UtZ+/tB4mhgxWzorpbdItaSXWgdDPDtssJIC+d5+hskys8 B3jbv86lyM+4jh2URpnL1gqOPwnaf1zm/7sqoN3r64cml94q68jfY4lNTwjA/SnaS1DE9XXa XQlkhHgjSLyRjjsMsz+2A4otRLrBbumEUtSMlPfhTi8xUsj9ZfPIUz3fji8vmxZG/Da6jx/c a0UQdFFCL4Ay/EMSoGbQouzhC69OQLWNH3rMQbBvrRbiMJbEZwARAQABzR9NaWNoYWwgU2lt ZWsgPG1vbnN0ckBtb25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Qlx7c 1CzxB6Ht93NvfLaMyRtqgc7Yvg2fKyO/+XzYPOHAwTPM4xrlOmCKZNI4zkPleVeXnrPuyaa8 LMGqjA52gNsQ5g3rUkhp61Gw7g83rjDDZs5vgZ7Q2x3CdH0mLrQPw2u9QJ8K8OVnXFtiKt8Q L3FaukbCKIcP3ogCcTHJ3t75m4+pwH50MM1yQdFgqtLxPgrgn3U7fUVS9x4MPyO57JDFPOG4 oa0OZXydlVP7wrnJdi3m8DnljxyInPxbxdKGN5XnMq/r9Y70uRVyeqwp97sKLXd9GsxuaSg7 QJKUaltvN/i7ng1UOT/xsKeVdfXuqDIIElZ+dyEVTweDM011Zv0NN3OWFz6oD+GzyBetuBwD 0Z1MQlmNcq2bhOMzTxuXX2NDzUZs4aqEyZQ= Message-ID: Date: Fri, 10 Jul 2020 13:45:21 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200709074849.GA28968@laureti-dev> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.83;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:xsj-pvapsmtpgw01;PTR:unknown-60-83.xilinx.com;CAT:NONE;SFTY:;SFS:(376002)(39860400002)(396003)(136003)(346002)(46966005)(966005)(36756003)(70586007)(44832011)(478600001)(70206006)(8676002)(8936002)(316002)(31696002)(2616005)(2906002)(336012)(426003)(4326008)(6666004)(186003)(81166007)(9786002)(31686004)(110136005)(82310400002)(83380400001)(356005)(26005)(82740400003)(47076004)(5660300002)(43740500002);DIR:OUT;SFP:1101; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 186c005b-231a-41d4-e50c-08d824c6c050 X-MS-TrafficTypeDiagnostic: DM6PR02MB7065: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6D2F7iN/FlSdq70R5IwEvURKsHChsl/2FD6KcAHnR1BSV9TzREUrYT5Q8FkPZlQm7qDYfzOmsBBPDlMo+wYTtRh6dF3qvcmroQY2NDE52XnXpKwkmNxkp9N3dDBAajHR5Z2RWsNw70HHvW0tzBIv0u4NPWpH7Yb+PGcmWpomb7q9gbFqBIJyp+Ez2OwCEIfp0+fzu02Eol0jKeh0hnyU8lohJFaCoQ9y7ScWwdKpL7d89hC7K7vtGYGy/hS77MqTM23SHdl5Rr7+t69UaEQ4Ifid7eRDPMnT2oU7dwLEMDgJh5aEuQ4sh3NoXhR50dpqiRKZF9yyQN1YJ7KzfteiLcmZKeNKrSAJqWHj1g3q9ITSmXBeDimOoMQgUnD1KTIcHdAb/nVLfqBbwNzjehKXO/j6iI466oDwohQK3xp7ui61eHSLFGXwN9XTsWfYMfHTwjMRaV09I8LM8NOYpw98DQP3ogeSKvH09+/T+/wuth0feZtAY7RGI0RnZ2Lh+bon X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2020 11:45:32.1282 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 186c005b-231a-41d4-e50c-08d824c6c050 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.60.83];Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-AuthSource: CY1NAM02FT044.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR02MB7065 Sender: linux-serial-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Hi, On 09. 07. 20 9:48, Helmut Grohne wrote: > The problems started with the revert (18cc7ac8a28e28). The > cdns_uart_console.index is statically assigned -1. When the port is > registered, Linux assigns consecutive numbers to it. It turned out that > when using ttyPS1 as console, the index is not updated as we are reusing > the same cdns_uart_console instance for multiple ports. When registering > ttyPS0, it gets updated from -1 to 0, but when registering ttyPS1, it > already is 0 and not updated. > > That led to 2ae11c46d5fdc4. It assigns the index prior to registering > the uart_driver once. Unfortunately, that ended up breaking the > situation where the probe order does not match the id order. When using > the same device tree for both uboot and linux, it is important that the > serial0 alias points to the console. So some boards reverse those > aliases. This was reported by Jan Kiszka. The proposed fix was reverting > the index assignment and going back to the previous iteration. > > However such a reversed assignement (serial0 -> uart1, serial1 -> uart0) > was already partially broken by the revert (18cc7ac8a28e28). While the > ttyPS device works, the kmsg connection is already broken and kernel > messages go missing. Reverting the id assignment does not fix this. > > From the xilinx_uartps driver pov (after reverting the refactoring > commits), there can be only one console. This manifests in static > variables console_pprt and cdns_uart_console. These variables are not > properly linked and can go out of sync. The cdns_uart_console.index is > important for uart_add_one_port. We call that function for each port - > one of which hopefully is the console. If it isn't, the CON_ENABLED flag > is not set and console_port is cleared. The next cdns_uart_probe call > then tries to register the next port using that same cdns_uart_console. > > It is important that console_port and cdns_uart_console (and its index > in particular) stay in sync. The index assignment implemented by > Shubhrajyoti Datta is correct in principle. It just may have to happen a > second time if the first cdns_uart_probe call didn't encounter the > console device. And we shouldn't change the index once the console uart > is registered. > > Reported-by: Shubhrajyoti Datta > Reported-by: Jan Kiszka > Link: https://lore.kernel.org/linux-serial/f4092727-d8f5-5f91-2c9f-76643aace993@siemens.com/ > Fixes: 18cc7ac8a28e28 ("Revert "serial: uartps: Register own uart console and driver structures"") > Fixes: 2ae11c46d5fdc4 ("tty: xilinx_uartps: Fix missing id assignment to the console") > Signed-off-by: Helmut Grohne > --- > drivers/tty/serial/xilinx_uartps.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c > index b9d672af8b65..2833f1418d6d 100644 > --- a/drivers/tty/serial/xilinx_uartps.c > +++ b/drivers/tty/serial/xilinx_uartps.c > @@ -1465,7 +1465,6 @@ static int cdns_uart_probe(struct platform_device *pdev) > cdns_uart_uart_driver.nr = CDNS_UART_NR_PORTS; > #ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE > cdns_uart_uart_driver.cons = &cdns_uart_console; > - cdns_uart_console.index = id; > #endif > > rc = uart_register_driver(&cdns_uart_uart_driver); > @@ -1581,8 +1580,10 @@ static int cdns_uart_probe(struct platform_device *pdev) > * If register_console() don't assign value, then console_port pointer > * is cleanup. > */ > - if (!console_port) > + if (!console_port) { > + cdns_uart_console.index = id; > console_port = port; > + } > #endif > > rc = uart_add_one_port(&cdns_uart_uart_driver, port); > @@ -1595,8 +1596,10 @@ static int cdns_uart_probe(struct platform_device *pdev) > #ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE > /* This is not port which is used for console that's why clean it up */ > if (console_port == port && > - !(cdns_uart_uart_driver.cons->flags & CON_ENABLED)) > + !(cdns_uart_uart_driver.cons->flags & CON_ENABLED)) { > console_port = NULL; > + cdns_uart_console.index = -1; > + } > #endif > > cdns_uart_data->cts_override = of_property_read_bool(pdev->dev.of_node, > Thanks for the patch. I think that it will be very useful to list out all testcases to make sure that we test all that scenarios and finally get over it. We are testing scenarios and likely we are missing some that we are not able catch all issues before we submit a patch. Thanks, Michal From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA3E0C433E0 for ; Fri, 10 Jul 2020 11:47:26 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 87F9F20772 for ; Fri, 10 Jul 2020 11:47:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="mDEcdIrn"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.b="OKrH2Sgp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 87F9F20772 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:References: To:Subject:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=jwVbI9XPjNJK1NIY5UX6dy9mab5pYW676MMVoI/6Qoo=; b=mDEcdIrnqQoK2ta5weTKy/JRT EkD/zDEtssj8K8gGWLuNO/I1+x8VfhUmLX0ea2nXqL9bbW2jAd8DhasN9NCFIqBpj+XwqIqxsYo/O z53kxZeFko5z9pLQ6rb4uCJSTLAb+l+MJLTJXItVEeEHqrO4i23UQ8nXlxGQ+PKpLzvhovnF7iDdn ti6cWWSzCzGGvdoXfVw3ycmSa22f9p2g26URI5eHzXdWE2OyLo9jGjP47WeQe7cmWaMaN5N9vLbS5 xKdNjel8StMHNC4x3d1Ml/eR2jhXMxWNBreq+uy4UzX6zqyrAh8nB5x/t1JKOz13KpIHLtoPiXovZ si/oIEjKA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jtrTG-0005e5-D1; Fri, 10 Jul 2020 11:45:38 +0000 Received: from mail-bn8nam12on2077.outbound.protection.outlook.com ([40.107.237.77] helo=NAM12-BN8-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jtrTE-0005di-5W for linux-arm-kernel@lists.infradead.org; Fri, 10 Jul 2020 11:45:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kxRu4Y/XZvt31l/nECuyKrhBS5qN8d3UDDT3wvdZbdfxfTrMSR8DjgC+J6SSKmr4Qq/6f0fNb5f04XfcMprLuYqgrk7NMiBwxPlcUMa1cnYvV+8QP8AueCy07DkV0yvtxWNjtN6WDlX8vYxj/0YrzN7dj8UiN4qFBvdCjYE8tn9KrlLy8f3D9A2WoHciEM2mcpEmLv2Jqtibsl2xd1pVq2c+GT+TeR0zH95eE6ugJWJ4IxmlcxzbD8U+ihT9YlizpZLwdAObbFjyySCYmNcxOZO1jA3pxCl5E9bxdkx2y1H/OQIUfyTX2focYadVvSMkyEa8rHDgdlPGURcgz6mQ4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tLOYZERGU2M0QFXZAq3aH9Bba5xFQVTfksdfa61I+MM=; b=bzkLFvTqjQ6AmYiEjLAgvrmJadnOs4fs6LDy9D0XvN+6oiEVuXgKNIQO66rp7YbqdNZMdYMNFB2Matn7M4HCIWGAUpxUuP9Lrq/DEyIxqg/S7ZSd3hdXfPblk/7pUe7x4lJn3WhfDK7/LKJZ/zXCmOBRBGbyoHvYR98cf2xXXP9I8B/ZdFPZ3sylbCihtCBM1F0H6L3aqo8uD101Jwbk4QyzldA042ZVaOlXSBPL5Muvvqba8V85nzUX4iHf30ukGyVeYLnRymliXiIdeFcPSa4A/EFC/xEcoojrVFOkz1JLYW6l9rQlS1Hukc7sBcZL+n9aQOrOLHZ3S5Ucbt3obg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.60.83) smtp.rcpttodomain=intenta.de smtp.mailfrom=xilinx.com; dmarc=bestguesspass action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tLOYZERGU2M0QFXZAq3aH9Bba5xFQVTfksdfa61I+MM=; b=OKrH2SgpdnfxiMeOSdKzT1+M9yT2pAMBDawnV4a+tE1Ay3dwHfocqCZv2qJS1w7syNIN3z8rLH9miExDs/JT/TzjMvQI3wkOsuItpMdsTE+hqDzf50Bx42rU6eVPj9WCuG93JhYEg97z7Ki2q/EF24A2eCOnWmiyXalHEaeKJsU= Received: from CY4PR08CA0046.namprd08.prod.outlook.com (2603:10b6:903:151::32) by DM6PR02MB7065.namprd02.prod.outlook.com (2603:10b6:5:25a::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3174.20; Fri, 10 Jul 2020 11:45:33 +0000 Received: from CY1NAM02FT044.eop-nam02.prod.protection.outlook.com (2603:10b6:903:151:cafe::6a) by CY4PR08CA0046.outlook.office365.com (2603:10b6:903:151::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3174.21 via Frontend Transport; Fri, 10 Jul 2020 11:45:33 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; intenta.de; dkim=none (message not signed) header.d=none;intenta.de; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.83 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.83; helo=xsj-pvapsmtpgw01; Received: from xsj-pvapsmtpgw01 (149.199.60.83) by CY1NAM02FT044.mail.protection.outlook.com (10.152.75.137) with Microsoft SMTP Server id 15.20.3174.21 via Frontend Transport; Fri, 10 Jul 2020 11:45:32 +0000 Received: from [149.199.38.66] (port=56829 helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw01 with esmtp (Exim 4.90) (envelope-from ) id 1jtrRc-0003T0-3x; Fri, 10 Jul 2020 04:43:56 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1jtrT9-0007QK-Sd; Fri, 10 Jul 2020 04:45:31 -0700 Received: from xsj-pvapsmtp01 (mailhost.xilinx.com [149.199.38.66]) by xsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id 06ABjOt8030935; Fri, 10 Jul 2020 04:45:24 -0700 Received: from [172.30.17.109] by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1jtrT1-0007Lz-Vu; Fri, 10 Jul 2020 04:45:24 -0700 From: Michal Simek Subject: Re: [PATCH] tty: xilinx_uartps: Really fix id assignment To: Helmut Grohne , Greg Kroah-Hartman , Jiri Slaby , Michal Simek , Shubhrajyoti Datta , Jan Kiszka References: <20200709074849.GA28968@laureti-dev> Autocrypt: addr=michals@xilinx.com; keydata= xsFNBFFuvDEBEAC9Amu3nk79+J+4xBOuM5XmDmljuukOc6mKB5bBYOa4SrWJZTjeGRf52VMc howHe8Y9nSbG92obZMqsdt+d/hmRu3fgwRYiiU97YJjUkCN5paHXyBb+3IdrLNGt8I7C9RMy svSoH4WcApYNqvB3rcMtJIna+HUhx8xOk+XCfyKJDnrSuKgx0Svj446qgM5fe7RyFOlGX/wF Ae63Hs0RkFo3I/+hLLJP6kwPnOEo3lkvzm3FMMy0D9VxT9e6Y3afe1UTQuhkg8PbABxhowzj SEnl0ICoqpBqqROV/w1fOlPrm4WSNlZJunYV4gTEustZf8j9FWncn3QzRhnQOSuzTPFbsbH5 WVxwDvgHLRTmBuMw1sqvCc7CofjsD1XM9bP3HOBwCxKaTyOxbPJh3D4AdD1u+cF/lj9Fj255 Es9aATHPvoDQmOzyyRNTQzupN8UtZ+/tB4mhgxWzorpbdItaSXWgdDPDtssJIC+d5+hskys8 B3jbv86lyM+4jh2URpnL1gqOPwnaf1zm/7sqoN3r64cml94q68jfY4lNTwjA/SnaS1DE9XXa XQlkhHgjSLyRjjsMsz+2A4otRLrBbumEUtSMlPfhTi8xUsj9ZfPIUz3fji8vmxZG/Da6jx/c a0UQdFFCL4Ay/EMSoGbQouzhC69OQLWNH3rMQbBvrRbiMJbEZwARAQABzR9NaWNoYWwgU2lt ZWsgPG1vbnN0ckBtb25zdHIuZXU+wsGBBBMBAgArAhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIe AQIXgAIZAQUCWq+GEgUJDuRkWQAKCRA3fH8h/j0fkW9/D/9IBoykgOWah2BakL43PoHAyEKb Wt3QxWZSgQjeV3pBys08uQDxByChT1ZW3wsb30GIQSTlzQ7juacoUosje1ygaLHR4xoFMAT9 L6F4YzZaPwW6aLI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U7fUVS9x4MPyO57JDFPOG4 oa0OZXydlVP7wrnJdi3m8DnljxyInPxbxdKGN5XnMq/r9Y70uRVyeqwp97sKLXd9GsxuaSg7 QJKUaltvN/i7ng1UOT/xsKeVdfXuqDIIElZ+dyEVTweDM011Zv0NN3OWFz6oD+GzyBetuBwD 0Z1MQlmNcq2bhOMzTxuXX2NDzUZs4aqEyZQ= Message-ID: Date: Fri, 10 Jul 2020 13:45:21 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200709074849.GA28968@laureti-dev> Content-Language: en-US X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.83; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapsmtpgw01; PTR:unknown-60-83.xilinx.com; CAT:NONE; SFTY:; SFS:(376002)(39860400002)(396003)(136003)(346002)(46966005)(966005)(36756003)(70586007)(44832011)(478600001)(70206006)(8676002)(8936002)(316002)(31696002)(2616005)(2906002)(336012)(426003)(4326008)(6666004)(186003)(81166007)(9786002)(31686004)(110136005)(82310400002)(83380400001)(356005)(26005)(82740400003)(47076004)(5660300002)(43740500002); DIR:OUT; SFP:1101; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 186c005b-231a-41d4-e50c-08d824c6c050 X-MS-TrafficTypeDiagnostic: DM6PR02MB7065: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6D2F7iN/FlSdq70R5IwEvURKsHChsl/2FD6KcAHnR1BSV9TzREUrYT5Q8FkPZlQm7qDYfzOmsBBPDlMo+wYTtRh6dF3qvcmroQY2NDE52XnXpKwkmNxkp9N3dDBAajHR5Z2RWsNw70HHvW0tzBIv0u4NPWpH7Yb+PGcmWpomb7q9gbFqBIJyp+Ez2OwCEIfp0+fzu02Eol0jKeh0hnyU8lohJFaCoQ9y7ScWwdKpL7d89hC7K7vtGYGy/hS77MqTM23SHdl5Rr7+t69UaEQ4Ifid7eRDPMnT2oU7dwLEMDgJh5aEuQ4sh3NoXhR50dpqiRKZF9yyQN1YJ7KzfteiLcmZKeNKrSAJqWHj1g3q9ITSmXBeDimOoMQgUnD1KTIcHdAb/nVLfqBbwNzjehKXO/j6iI466oDwohQK3xp7ui61eHSLFGXwN9XTsWfYMfHTwjMRaV09I8LM8NOYpw98DQP3ogeSKvH09+/T+/wuth0feZtAY7RGI0RnZ2Lh+bon X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2020 11:45:32.1282 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 186c005b-231a-41d4-e50c-08d824c6c050 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.60.83]; Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-AuthSource: CY1NAM02FT044.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR02MB7065 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200710_074536_308566_612CADC3 X-CRM114-Status: GOOD ( 32.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, linux-serial@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, On 09. 07. 20 9:48, Helmut Grohne wrote: > The problems started with the revert (18cc7ac8a28e28). The > cdns_uart_console.index is statically assigned -1. When the port is > registered, Linux assigns consecutive numbers to it. It turned out that > when using ttyPS1 as console, the index is not updated as we are reusing > the same cdns_uart_console instance for multiple ports. When registering > ttyPS0, it gets updated from -1 to 0, but when registering ttyPS1, it > already is 0 and not updated. > > That led to 2ae11c46d5fdc4. It assigns the index prior to registering > the uart_driver once. Unfortunately, that ended up breaking the > situation where the probe order does not match the id order. When using > the same device tree for both uboot and linux, it is important that the > serial0 alias points to the console. So some boards reverse those > aliases. This was reported by Jan Kiszka. The proposed fix was reverting > the index assignment and going back to the previous iteration. > > However such a reversed assignement (serial0 -> uart1, serial1 -> uart0) > was already partially broken by the revert (18cc7ac8a28e28). While the > ttyPS device works, the kmsg connection is already broken and kernel > messages go missing. Reverting the id assignment does not fix this. > > From the xilinx_uartps driver pov (after reverting the refactoring > commits), there can be only one console. This manifests in static > variables console_pprt and cdns_uart_console. These variables are not > properly linked and can go out of sync. The cdns_uart_console.index is > important for uart_add_one_port. We call that function for each port - > one of which hopefully is the console. If it isn't, the CON_ENABLED flag > is not set and console_port is cleared. The next cdns_uart_probe call > then tries to register the next port using that same cdns_uart_console. > > It is important that console_port and cdns_uart_console (and its index > in particular) stay in sync. The index assignment implemented by > Shubhrajyoti Datta is correct in principle. It just may have to happen a > second time if the first cdns_uart_probe call didn't encounter the > console device. And we shouldn't change the index once the console uart > is registered. > > Reported-by: Shubhrajyoti Datta > Reported-by: Jan Kiszka > Link: https://lore.kernel.org/linux-serial/f4092727-d8f5-5f91-2c9f-76643aace993@siemens.com/ > Fixes: 18cc7ac8a28e28 ("Revert "serial: uartps: Register own uart console and driver structures"") > Fixes: 2ae11c46d5fdc4 ("tty: xilinx_uartps: Fix missing id assignment to the console") > Signed-off-by: Helmut Grohne > --- > drivers/tty/serial/xilinx_uartps.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c > index b9d672af8b65..2833f1418d6d 100644 > --- a/drivers/tty/serial/xilinx_uartps.c > +++ b/drivers/tty/serial/xilinx_uartps.c > @@ -1465,7 +1465,6 @@ static int cdns_uart_probe(struct platform_device *pdev) > cdns_uart_uart_driver.nr = CDNS_UART_NR_PORTS; > #ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE > cdns_uart_uart_driver.cons = &cdns_uart_console; > - cdns_uart_console.index = id; > #endif > > rc = uart_register_driver(&cdns_uart_uart_driver); > @@ -1581,8 +1580,10 @@ static int cdns_uart_probe(struct platform_device *pdev) > * If register_console() don't assign value, then console_port pointer > * is cleanup. > */ > - if (!console_port) > + if (!console_port) { > + cdns_uart_console.index = id; > console_port = port; > + } > #endif > > rc = uart_add_one_port(&cdns_uart_uart_driver, port); > @@ -1595,8 +1596,10 @@ static int cdns_uart_probe(struct platform_device *pdev) > #ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE > /* This is not port which is used for console that's why clean it up */ > if (console_port == port && > - !(cdns_uart_uart_driver.cons->flags & CON_ENABLED)) > + !(cdns_uart_uart_driver.cons->flags & CON_ENABLED)) { > console_port = NULL; > + cdns_uart_console.index = -1; > + } > #endif > > cdns_uart_data->cts_override = of_property_read_bool(pdev->dev.of_node, > Thanks for the patch. I think that it will be very useful to list out all testcases to make sure that we test all that scenarios and finally get over it. We are testing scenarios and likely we are missing some that we are not able catch all issues before we submit a patch. Thanks, Michal _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel