Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4449306rdb; Fri, 15 Sep 2023 02:31:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGG+BywDDob3TqowKDwPbecxfRZaLf6w8R9sexjk4eoCsf+0AwNsaqAx8YT3POT1790zC7m X-Received: by 2002:a17:90a:bf06:b0:26d:43f9:11dd with SMTP id c6-20020a17090abf0600b0026d43f911ddmr889385pjs.0.1694770315825; Fri, 15 Sep 2023 02:31:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694770315; cv=none; d=google.com; s=arc-20160816; b=XYCyBt01E7cmMVsp9f0PySS/Y9XSHQo7j5s8T5YND+NNbeyc4nWbOa2Iii+kSUNCvf mocRchoWMJ86T4qoVUlfTCN5izyqEhx2NZUh7iMYff0BHveKpzmOCW7hjTDHpqLkZxVg AGQXqjyVpO4x/ejnAeR7IEVbhBqFXSw+qVSwk7Tm46qLmF6Qq0AZyRnLC7NekjnZ783r L75eK0JoOxsAJrYl0Cqs8sMuL8imQShft5E/7wXwbz3eepy+tvtwSWX++LHtCaTjTGrX rPgBNK9/TingDTX3eMCK7J3MYy8ecIxbxfVYm7ndaG7G0BTpLTbCOR11IgnoXwxB+TyA BPww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=R5XWG5/5Iht8ENYOboXAshJCx8zCdAiqVzeUGvU8IkA=; fh=STuivRkKX3u3nkEEJrfEJakCwgdDp++E92FKBr/ef7c=; b=FWWAlzJdxt9Xdq1gGwt5HpQhi85D/4D6cXH/A6E6MC5EZqWzr6nNjSYuU57/JyZJEI tGJP+liV1hL1stY7Y24/VhmMYA8qXPBekTDQm26He6ts23fnlEAYts8ZQTNlA7xPpZAG Er9d7jj66fj23zlleSu9Zfs67Vdp66aCFTO0jfqUFkhhLf/NqRoQK0RzWjw5UOx/x85y oE4RIbAocbx8B0HUs8aPUqL9DvP/Z1LEig9eKL9KEDvi+9F3sOp38pUB+DE6R9oXE0EJ tGOSsgesQxSck+cxrHfxNeNKXSJlwsXwQOAUnmjMCMxQB1F5/GyAAlErAHBkSMBRDIEa pKZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=IgrFkrYK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id me13-20020a17090b17cd00b0026b6c520edbsi5713946pjb.182.2023.09.15.02.31.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 02:31:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=IgrFkrYK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id CD2BB83CAA71; Fri, 15 Sep 2023 02:27:48 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233633AbjIOJ1o (ORCPT + 99 others); Fri, 15 Sep 2023 05:27:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233351AbjIOJ1m (ORCPT ); Fri, 15 Sep 2023 05:27:42 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF13E1700; Fri, 15 Sep 2023 02:26:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1694770000; x=1726306000; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=yl5Skd55X/lYjofp9pJE8uI3m8maxabpQwNbSQvXLsA=; b=IgrFkrYKxrRq/AUAD8qfLGIFFm/jyJUMfoSHwpwG3kP9mt96AcLaznVk FsWwak3+aM5+S0sfoct2ytIN5PZBXGIkb2py4VNInpH07zB+mSGe5Oh1u 9PykF6pCDRTE1ps3Jf/9ELBkRPfUcT2M1rask3zev+k3H1be4+ZmJZIsx SCrSuL3+NF98gkXiTGY64qAdISZbbS26PQDeiijjzmde2P+YU+lejjT9A 7i9PFhVuoc90uudmYwjo0dgSJ3F7wI8lto5+92043tIzkOChETWm9zKBa kcZBynP756Oqv6IZuTqfnIBgG6SRXgrrc1MmBv/PxLTHedn/t6JsZTW00 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10833"; a="378122551" X-IronPort-AV: E=Sophos;i="6.02,148,1688454000"; d="scan'208";a="378122551" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Sep 2023 02:26:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10833"; a="888167296" X-IronPort-AV: E=Sophos;i="6.02,148,1688454000"; d="scan'208";a="888167296" Received: from srdoo-mobl1.ger.corp.intel.com ([10.252.38.99]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Sep 2023 02:26:03 -0700 Date: Fri, 15 Sep 2023 12:26:35 +0300 (EEST) From: =?ISO-8859-15?Q?Ilpo_J=E4rvinen?= To: John Ogness cc: Greg Kroah-Hartman , Jiri Slaby , linux-serial , Petr Mladek , Thomas Gleixner , LKML Subject: Re: [PATCH tty v1 02/74] serial: core: Use lock wrappers In-Reply-To: <20230914183831.587273-3-john.ogness@linutronix.de> Message-ID: References: <20230914183831.587273-1-john.ogness@linutronix.de> <20230914183831.587273-3-john.ogness@linutronix.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-1914440644-1694769999=:2347" X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,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 groat.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 (groat.vger.email [0.0.0.0]); Fri, 15 Sep 2023 02:27:50 -0700 (PDT) This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-1914440644-1694769999=:2347 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 8BIT On Thu, 14 Sep 2023, John Ogness wrote: > From: Thomas Gleixner > > When a serial port is used for kernel console output, then all > modifications to the UART registers which are done from other contexts, > e.g. getty, termios, are interference points for the kernel console. > > So far this has been ignored and the printk output is based on the > principle of hope. The rework of the console infrastructure which aims to > support threaded and atomic consoles, requires to mark sections which > modify the UART registers as unsafe. This allows the atomic write function > to make informed decisions and eventually to restore operational state. It > also allows to prevent the regular UART code from modifying UART registers > while printk output is in progress. > > All modifications of UART registers are guarded by the UART port lock, > which provides an obvious synchronization point with the console > infrastructure. > > To avoid adding this functionality to all UART drivers, wrap the > spin_[un]lock*() invocations for uart_port::lock into helper functions > which just contain the spin_[un]lock*() invocations for now. In a > subsequent step these helpers will gain the console synchronization > mechanisms. > > Converted with coccinelle. No functional change. > > Signed-off-by: Thomas Gleixner > --- > include/linux/serial_core.h | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h > index f1d5c0d1568c..3091c62ec37b 100644 > --- a/include/linux/serial_core.h > +++ b/include/linux/serial_core.h > @@ -1035,14 +1035,14 @@ static inline void uart_unlock_and_check_sysrq(struct uart_port *port) > u8 sysrq_ch; > > if (!port->has_sysrq) { > - spin_unlock(&port->lock); > + uart_port_unlock(port); > return; > } > > sysrq_ch = port->sysrq_ch; > port->sysrq_ch = 0; > > - spin_unlock(&port->lock); > + uart_port_unlock(port); > > if (sysrq_ch) > handle_sysrq(sysrq_ch); > @@ -1054,14 +1054,14 @@ static inline void uart_unlock_and_check_sysrq_irqrestore(struct uart_port *port > u8 sysrq_ch; > > if (!port->has_sysrq) { > - spin_unlock_irqrestore(&port->lock, flags); > + uart_port_unlock_irqrestore(port, flags); > return; > } > > sysrq_ch = port->sysrq_ch; > port->sysrq_ch = 0; > > - spin_unlock_irqrestore(&port->lock, flags); > + uart_port_unlock_irqrestore(port, flags); > > if (sysrq_ch) > handle_sysrq(sysrq_ch); > @@ -1077,12 +1077,12 @@ static inline int uart_prepare_sysrq_char(struct uart_port *port, u8 ch) > } > static inline void uart_unlock_and_check_sysrq(struct uart_port *port) > { > - spin_unlock(&port->lock); > + uart_port_unlock(port); > } > static inline void uart_unlock_and_check_sysrq_irqrestore(struct uart_port *port, > unsigned long flags) > { > - spin_unlock_irqrestore(&port->lock, flags); > + uart_port_unlock_irqrestore(port, flags); > } > #endif /* CONFIG_MAGIC_SYSRQ_SERIAL */ > > Reviewed-by: Ilpo J?rvinen -- i. --8323329-1914440644-1694769999=:2347--