Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4537665rdb; Fri, 15 Sep 2023 05:31:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG7TXM6dC8aL2wlkJcwd6NJqN9WGRz1HM5TSD2aWMTs5qukNsJSC4hGIy/BwBi33U2s9ZBS X-Received: by 2002:a05:6a20:394b:b0:14d:6309:fc90 with SMTP id r11-20020a056a20394b00b0014d6309fc90mr689502pzg.8.1694781066087; Fri, 15 Sep 2023 05:31:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694781066; cv=none; d=google.com; s=arc-20160816; b=uwBJoH2G8pwwQwalmtC+2YFU+ebS+ScJSqbcn4bs6r2X6sgjQliaDN1bmRcXbo3KeR 5creKzHKXGKk+UtIAQLTqEfZdRsUaUTUnRP/6K8UUXeaWGJG1jQesjGTIHsJ4JUWt+YW jowfG1+Wu0sS2uNKy2PskthGN4012UvcL2NxNrgEvo7RmUStl3IE3TMqkSUFF4ikYg2e K7HOGACVvlhpSlTFJt2Pvf2BakjNnFxVteC4rA97QyJR0b4AfJyJexxpjH4zAMsVgj5c MJbmMAEkd8G4a80fJaCswpxZsd04cIlEaSH+TC45DAdaI0hOBv++XPmIbndb+BCdf2aY o+1g== 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:references:in-reply-to:subject:cc:to:dkim-signature :dkim-signature:from; bh=TsnkGbttQgVvHiV9M03Q+LlQoOR8o5QNvoHNuHa+6nY=; fh=Tgbc2q12GbDzkokro+oeyFyURo5WNIYbPMVksMxsdLs=; b=UMbmzjYfQ1/eGfb0OZISRDpPmw5ZCBehUuzQDrNZPtlUKcoHDaqZWSnruOLUBsGFKv I8OQ9pTetmV+UHvMViUOEmBD/2MPDA97fOJfPJnm4KK1pICYLhKxUslUEHSAv17M9A7d BhNan05hR2f1L6KcODOw624Y0nLYE+tscp0JwWdOi5xtJ/rJW+VaZpagfeFqB1ZVCSmE kwhwwc0HLHVFv2iCgGSHSfke+2VjNbsPJP0B07azMrkw81rSsNMCoyVXG6E23aZ4tFA5 qf08tSSbLBEwCBAmPDs8Hzzz0gGybFlQYT8Iti1xUUfJ7G5wwPRQ6HCGHZr5nySaJdVP zqQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=kUVLHiYJ; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id cm10-20020a056a00338a00b0068e4d216325si3258112pfb.204.2023.09.15.05.31.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 05:31:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=kUVLHiYJ; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id C731D808726E; Fri, 15 Sep 2023 04:21:18 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234001AbjIOLVS (ORCPT + 99 others); Fri, 15 Sep 2023 07:21:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231221AbjIOLVR (ORCPT ); Fri, 15 Sep 2023 07:21:17 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6877101; Fri, 15 Sep 2023 04:21:11 -0700 (PDT) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1694776870; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TsnkGbttQgVvHiV9M03Q+LlQoOR8o5QNvoHNuHa+6nY=; b=kUVLHiYJMpOIKyckOH3EGEThs0EpvU+s0q8h8ytzvinMvOtAfd5B7odHXAHSsKB6ibsXQK PnVg39zA19vvSxKixPQ+lABJT51nPvqCctMMvlpaSLwmUt0ComnPBAbfOeDqJkm22KVl5U 69v1YPuRztdswpOaGK+V1mXP6/RYTyNTYTIpwcwlIW6bdb4dXpkVV+7oGssiK5q2PP4b7N S4ApnDPDAMrpld//Dw0tCaKyFut5XTSw4/B2YXE/SrDtZgEkRgbbAd9XRRdohfU850iP1Y sbsq1DHisj/HMJsjV4h+/F/DlveahLIkHgxgeYBSTU+NxAqze0LLubPKBH6ffA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1694776870; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TsnkGbttQgVvHiV9M03Q+LlQoOR8o5QNvoHNuHa+6nY=; b=W6ioBJ1+Iw5AzubKd6BZK7wo1pNLk50251horbdq/DP+xQJ60XUc0+8TacyLFi3g3eztn+ M8sSTyUWXVfOOHCQ== To: Ilpo =?utf-8?Q?J=C3=A4rvinen?= Cc: Greg Kroah-Hartman , Jiri Slaby , linux-serial , Petr Mladek , Thomas Gleixner , LKML , Tony Lindgren , Andy Shevchenko , Florian Fainelli Subject: Re: [PATCH tty v1 06/74] serial: 8250: Use port lock wrappers In-Reply-To: <2045de5e-b7f8-18fe-dc92-e1d88a62f810@linux.intel.com> References: <20230914183831.587273-1-john.ogness@linutronix.de> <20230914183831.587273-7-john.ogness@linutronix.de> <2045de5e-b7f8-18fe-dc92-e1d88a62f810@linux.intel.com> Date: Fri, 15 Sep 2023 13:27:05 +0206 Message-ID: <87y1h7vg0u.fsf@jogness.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INVALID_DATE_TZ_ABSURD, 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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Fri, 15 Sep 2023 04:21:18 -0700 (PDT) On 2023-09-15, Ilpo J=C3=A4rvinen wrote: >> @@ -3403,9 +3403,9 @@ void serial8250_console_write(struct uart_8250_por= t *up, const char *s, >> touch_nmi_watchdog(); >>=20=20 >> if (oops_in_progress) >> - locked =3D spin_trylock_irqsave(&port->lock, flags); >> + locked =3D uart_port_trylock_irqsave(port, &flags); >> else >> - spin_lock_irqsave(&port->lock, flags); >> + uart_port_lock_irqsave(port, &flags); > > Not related to any problem (with this patch) but I'm a bit curious is > this construct going to remain there after the follow-up work? Yes. The uart port lock already provides excellent coverage of unsafe regions in uart drivers. We want to take advantage of that. > And there's the similar one in some other drivers (with some > variations related to local_irq_save()): > > if (port->sysrq) { > locked =3D 0; > } else if (oops_in_progress) { > locked =3D spin_trylock(&port->lock); > } else { > spin_lock(&port->lock); > locked =3D 1; > } With the follow-up work we are introducing a new type of console (CON_NBCON) that supports atomic and threaded printing. Current console drivers must be converted if they want these features. When converting a driver to NBCON, such variations as above will need to be addressed. The follow-up work provides new functions and semantics to allow drivers to implement more reliable code than just: "trylock and keep going no matter what". For console drivers that are _not_ converted to NBCON, the uart port lock wrappers will not provide any changed functionality. John Ogness