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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A0F6C3DA7A for ; Fri, 6 Jan 2023 10:56:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229869AbjAFK42 (ORCPT ); Fri, 6 Jan 2023 05:56:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229746AbjAFK40 (ORCPT ); Fri, 6 Jan 2023 05:56:26 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 351DF6B5B4 for ; Fri, 6 Jan 2023 02:56:25 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C797261D7F for ; Fri, 6 Jan 2023 10:56:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2DEDBC433D2; Fri, 6 Jan 2023 10:56:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673002584; bh=nbW5XajoK2QVAl0EVdOaNOkV2Y1wIBpQ9zgctDUR4Qw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=gJ/A9EFgN6C5ZcWvpw+6eYLSOs5onyQmxZhit8VHS7NHySUkhhUuOm3V73dloz+/w vKhy3Hlg7nYn+OcBm+PqfrAS4KpLS6Ti2c8KHoFwKb1PcCtIZC8O6ECMz+uGnwXv8l gNWrdIa+T4G7fsmXqQiSv+rKcn0+tuq1b8VWvnPdAP0Wu2RGzhhj0LvL8Mv3yjfXpw aBS3/DS86W08XqhlgMK6n7mqxfAUdGQTPCpPXAmm3MHg3RD2f7A4ReO9/CEHCkMHWc jgGr2SJ6Jgdv5UEYjTDCCNMxEVHwJRgOQE/qWmGH1SrLV7BASJue+wUtUNUaAVZzAc FmO72MEp0bUBQ== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1pDkP0-0001c3-ME; Fri, 06 Jan 2023 11:56:47 +0100 Date: Fri, 6 Jan 2023 11:56:46 +0100 From: Johan Hovold To: Marek Vasut Cc: linux-serial@vger.kernel.org, Sebastian Andrzej Siewior , Alexandre Torgue , Erwan Le Ray , Greg Kroah-Hartman , Jiri Slaby , Maxime Coquelin , Thomas Gleixner , Valentin Caron , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com Subject: Re: [PATCH v3] serial: stm32: Merge hard IRQ and threaded IRQ handling into single IRQ handler Message-ID: References: <20221216115338.7150-1-marex@denx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org On Thu, Jan 05, 2023 at 09:46:57PM +0100, Marek Vasut wrote: > On 12/27/22 15:56, Johan Hovold wrote: > > [...] > > >> @@ -793,27 +794,13 @@ static irqreturn_t stm32_usart_interrupt(int irq, void *ptr) > >> } > >> > >> if ((sr & USART_SR_TXE) && !(stm32_port->tx_ch)) { > >> - spin_lock(&port->lock); > >> + spin_lock_irqsave(&port->lock, flags); > >> stm32_usart_transmit_chars(port); > >> - spin_unlock(&port->lock); > >> + spin_unlock_irqrestore(&port->lock, flags); > > > > This is not needed as the handler runs with interrupts disabled. > > On SMP system, another thread on another core can call > stm32_usart_transmit_chars() . I don't think removing the locking is > correct ? I didn't say that you should remove the locking, which is very much needed. There's just no need to disable interrupts in a (non-threaded) interrupt handler as that has already been done by IRQ core (and, yes, that is also the case with forced threading). Johan 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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 21168C3DA7A for ; Fri, 6 Jan 2023 10:57:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ckIsFdDlYFsDzX4tyTpKjuFikK/dRTghiiIpKM3EzRE=; b=Jlqj1Ni6hXsb1d dadZVNH1PAI00CzZ0mgO16lr90koPZnrr7ok2DL79zvWLWjIyihcGfluXDKym4HK0Kh7zJb49v+P3 zWk6EimfV6bxNp7MDAfEy3ingDnBq/ZXLy+ggrE7pd71ciueCW5OjAXgVJri0RpBt8Y56AQp7e/S2 XYjsUoIMGnzU4IHh95/7sbfALcjdIFL22tP4qRh3UnWvXd/5ShN22K/eJqSo+VvKEktInRbb4/OzG Ae/3OALcfxddnV3Lm3S9ixKGW0yxysCE/FWuIUvhk0Fhpfg/Sz4sksCr02P+FjMZWzLtOfKG9dmVa 7AK63h3iPXdmtje/03SA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDkOj-007aZU-Ee; Fri, 06 Jan 2023 10:56:29 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDkOg-007aXG-B2 for linux-arm-kernel@lists.infradead.org; Fri, 06 Jan 2023 10:56:27 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CAF6E61D9C; Fri, 6 Jan 2023 10:56:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2DEDBC433D2; Fri, 6 Jan 2023 10:56:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673002584; bh=nbW5XajoK2QVAl0EVdOaNOkV2Y1wIBpQ9zgctDUR4Qw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=gJ/A9EFgN6C5ZcWvpw+6eYLSOs5onyQmxZhit8VHS7NHySUkhhUuOm3V73dloz+/w vKhy3Hlg7nYn+OcBm+PqfrAS4KpLS6Ti2c8KHoFwKb1PcCtIZC8O6ECMz+uGnwXv8l gNWrdIa+T4G7fsmXqQiSv+rKcn0+tuq1b8VWvnPdAP0Wu2RGzhhj0LvL8Mv3yjfXpw aBS3/DS86W08XqhlgMK6n7mqxfAUdGQTPCpPXAmm3MHg3RD2f7A4ReO9/CEHCkMHWc jgGr2SJ6Jgdv5UEYjTDCCNMxEVHwJRgOQE/qWmGH1SrLV7BASJue+wUtUNUaAVZzAc FmO72MEp0bUBQ== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1pDkP0-0001c3-ME; Fri, 06 Jan 2023 11:56:47 +0100 Date: Fri, 6 Jan 2023 11:56:46 +0100 From: Johan Hovold To: Marek Vasut Cc: linux-serial@vger.kernel.org, Sebastian Andrzej Siewior , Alexandre Torgue , Erwan Le Ray , Greg Kroah-Hartman , Jiri Slaby , Maxime Coquelin , Thomas Gleixner , Valentin Caron , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com Subject: Re: [PATCH v3] serial: stm32: Merge hard IRQ and threaded IRQ handling into single IRQ handler Message-ID: References: <20221216115338.7150-1-marex@denx.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230106_025626_442869_52FFDF43 X-CRM114-Status: GOOD ( 17.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 On Thu, Jan 05, 2023 at 09:46:57PM +0100, Marek Vasut wrote: > On 12/27/22 15:56, Johan Hovold wrote: > > [...] > > >> @@ -793,27 +794,13 @@ static irqreturn_t stm32_usart_interrupt(int irq, void *ptr) > >> } > >> > >> if ((sr & USART_SR_TXE) && !(stm32_port->tx_ch)) { > >> - spin_lock(&port->lock); > >> + spin_lock_irqsave(&port->lock, flags); > >> stm32_usart_transmit_chars(port); > >> - spin_unlock(&port->lock); > >> + spin_unlock_irqrestore(&port->lock, flags); > > > > This is not needed as the handler runs with interrupts disabled. > > On SMP system, another thread on another core can call > stm32_usart_transmit_chars() . I don't think removing the locking is > correct ? I didn't say that you should remove the locking, which is very much needed. There's just no need to disable interrupts in a (non-threaded) interrupt handler as that has already been done by IRQ core (and, yes, that is also the case with forced threading). Johan _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel