From patchwork Tue Apr 18 10:14:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Lindgren X-Patchwork-Id: 84737 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2733630vqo; Tue, 18 Apr 2023 03:20:52 -0700 (PDT) X-Google-Smtp-Source: AKy350ZS9CPOVT6v5RjzDTfMuut0pJKSVdrQiizJFDSZjXdsbi6lD2SDVrRJcn2dVs1FC0es+DAR X-Received: by 2002:a05:6a20:3ca3:b0:ee:f5a4:c071 with SMTP id b35-20020a056a203ca300b000eef5a4c071mr7538985pzj.62.1681813252075; Tue, 18 Apr 2023 03:20:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681813252; cv=none; d=google.com; s=arc-20160816; b=txPFp9jce+ID2uurxHXMDcu3NC3xWwyZZ3zIc6wt2CC3YDcI+HhbhXWCxVNtQNDHjn NYWSuKH8RKFg4vOxmArbNwcySu06cErBQZs/3gskgBhObHgv6RErqooIoL9R3efloUb+ 1sSjjlRSmki7HsALLr/g8y023l4GsQXqpY/mxvV8Fjh+10uoT1UfWS4XFO2o8ZgUspaT xu2c3lWUn659PoobMpPzvHf7Wfb7cZ54ppkDAGd60psC6hIf/5i7yD0rGDkdNWvM10Ho I91BF3E3iUJZGF8iQ4ZM5WMqB87UwV7w/n4losjMHZW9mjYLF9tdyyuPGO4/lknX+jfV bZSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=xB/42awwvvLCNKccjbAp8QjXHfeYBPiPzvgyz9/5SKA=; b=Ga5x9olNI9NIqC8vm8pmno520ghcfBbznASzkO3YzSWr79pPC6QEjmmFCRNnz1h5nP lbpblI91DFuRb5kyCCHCfG37HxyW10EvDU0JWHq13wphtz/pEOPQ4rqw7wgssA2dhHDx ijHkbrS6dUSk4bXkhif+3ATAWwt6YuIm+TacUjCLnqsQH6J8zU4ALGiG83ry5AC4W5rq +B5UZ04VGX60r0iTR9zFimbdtxay/cTifspm/19DQUOL5hQKUaPCafP9nljfYc15f+Y2 6MZLxATM1LsC77jjuwqobEsddIS5cdSGPPBZCXBufGIGvypxG6qsjSFZo4GDrfNoYa4I kvYg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u14-20020a63790e000000b0051b6ee8bdd0si11512230pgc.687.2023.04.18.03.20.40; Tue, 18 Apr 2023 03:20:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230408AbjDRKOR (ORCPT + 99 others); Tue, 18 Apr 2023 06:14:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229706AbjDRKOO (ORCPT ); Tue, 18 Apr 2023 06:14:14 -0400 Received: from muru.com (muru.com [72.249.23.125]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 60E913ABF; Tue, 18 Apr 2023 03:14:13 -0700 (PDT) Received: from hillo.muru.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTP id 6899C8106; Tue, 18 Apr 2023 10:14:11 +0000 (UTC) From: Tony Lindgren To: Greg Kroah-Hartman , Jiri Slaby Cc: Andy Shevchenko , =?utf-8?q?Ilpo_J=C3=A4rvi?= =?utf-8?q?nen?= , Johan Hovold , Sebastian Andrzej Siewior , Vignesh Raghavendra , linux-omap@vger.kernel.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/1] serial: 8250: Reinit port->pm on port specific driver unbind Date: Tue, 18 Apr 2023 13:14:06 +0300 Message-Id: <20230418101407.12403-1-tony@atomide.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763509012269472955?= X-GMAIL-MSGID: =?utf-8?q?1763509012269472955?= When we unbind a serial port hardware specific 8250 driver, the generic serial8250 driver takes over the port. After that we see an oops about 10 seconds later. This can produce the following at least on some TI SoCs: Unhandled fault: imprecise external abort (0x1406) Internal error: : 1406 [#1] SMP ARM Turns out that we may still have the serial port hardware specific driver port->pm in use, and serial8250_pm() tries to call it after the port specific driver is gone: serial8250_pm [8250_base] from uart_change_pm+0x54/0x8c [serial_base] uart_change_pm [serial_base] from uart_hangup+0x154/0x198 [serial_base] uart_hangup [serial_base] from __tty_hangup.part.0+0x328/0x37c __tty_hangup.part.0 from disassociate_ctty+0x154/0x20c disassociate_ctty from do_exit+0x744/0xaac do_exit from do_group_exit+0x40/0x8c do_group_exit from __wake_up_parent+0x0/0x1c Let's fix the issue by calling serial8250_set_defaults() in serial8250_unregister_port(). This will set the port back to using the serial8250 default functions, and sets the port->pm to point to serial8250_pm. Signed-off-by: Tony Lindgren --- Changes since v1: - Call serial8250_init_port() instead of just clearing port->pm - Updated patch subject line a bit --- drivers/tty/serial/8250/8250_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c --- a/drivers/tty/serial/8250/8250_core.c +++ b/drivers/tty/serial/8250/8250_core.c @@ -1158,6 +1158,7 @@ void serial8250_unregister_port(int line) uart->port.type = PORT_UNKNOWN; uart->port.dev = &serial8250_isa_devs->dev; uart->capabilities = 0; + serial8250_init_port(uart); serial8250_apply_quirks(uart); uart_add_one_port(&serial8250_reg, &uart->port); } else {