Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1186692pxb; Fri, 20 Nov 2020 03:30:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJy9tnVXcTXmXAMl/BIvQ9atHzaDMTOoDV7qIA/kzgTsKcVBhtL8l1G7fJIFXQSxAHyHBkxM X-Received: by 2002:aa7:d888:: with SMTP id u8mr35827234edq.210.1605871804368; Fri, 20 Nov 2020 03:30:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605871804; cv=none; d=google.com; s=arc-20160816; b=KIPivx2SbhdupoBOBsO3JW7cHY9JbszgVuP/cbjw4pQq0MXkguuS2aZlXCiWkHivbb t/qHQ+lN0vKLaD+FMORMMrK090XXCCewd4wgNnUmMQL4lYnKStTVJhmHk8DgvPc+DDJS Oaf3Zb2HVQNjdsWp2XIeJyuqvYrHTORLpc0FO7ndwVmbFIuB1Ey5WCqVz+HyYQDSMRNs GwABvgaON1Q3IDFmGhWQubUCKP5BZZINES9nusyToanLxprXxyr73GNzYYXv5suweV9B mgT+zbsOqeMpu54yRo/a5E2nH90+yUH72jwi7A7FSo0bICLyMUTPQyhermXS13hZLx1U O4JQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=6YRLFtbXfIWL7x+gve2yDE47ATYMog+MU17XQgAhU4U=; b=MhmXBFIPPB41uT0kLNPzVtuoKpXDAyaSQ3UlgIYDqWylvRYplzeOn0Y2OnPCHD53vF HS7UoEcnzf1JGYkFOZmktQien5OvChej/QtGcDMtrGd8K5l7xNPL3wRAhllIa1inl5F9 V/p60ql3elhU4g3Y5ejF8aPg9Xbh0yGQXllqRK1GF/5w3eyA3KQZhurB6k8DQJLqYO/Y J1w0vwOlBuqv7CRMSqPr4axc4Jy62SY2E41lalE6M5DCW27KdCDFs4VdYVnAqTytuqPz rwDV4WGbTs3jedFZQhWo78H3ZBEjIO1iIuU92Kjral8fl1E1zltiB/xIxRqbeuP+OKeN krcg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w14si998236ejz.314.2020.11.20.03.29.41; Fri, 20 Nov 2020 03:30:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728163AbgKTLZQ (ORCPT + 99 others); Fri, 20 Nov 2020 06:25:16 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:7962 "EHLO szxga06-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728129AbgKTLZQ (ORCPT ); Fri, 20 Nov 2020 06:25:16 -0500 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4CcvN926DKzhdJ2; Fri, 20 Nov 2020 19:24:57 +0800 (CST) Received: from [127.0.0.1] (10.57.60.129) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.487.0; Fri, 20 Nov 2020 19:25:03 +0800 Subject: Re: [PATCH] tty: serial: replace spin_lock_irqsave by spin_lock in hard IRQ To: Johan Hovold , Tian Tao CC: , , , , , , References: <1605776489-16283-1-git-send-email-tiantao6@hisilicon.com> From: "tiantao (H)" Message-ID: <9ce93d7b-f769-58ed-e6bf-95c34bd0123e@huawei.com> Date: Fri, 20 Nov 2020 19:25:03 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="gbk"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.57.60.129] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ?? 2020/11/20 16:23, Johan Hovold ะด??: > On Thu, Nov 19, 2020 at 05:01:29PM +0800, Tian Tao wrote: >> The code has been in a irq-disabled context since it is hard IRQ. There >> is no necessity to do it again. >> >> Signed-off-by: Tian Tao >> --- >> drivers/tty/serial/owl-uart.c | 5 ++--- >> 1 file changed, 2 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/tty/serial/owl-uart.c b/drivers/tty/serial/owl-uart.c >> index c149f8c3..472fdaf 100644 >> --- a/drivers/tty/serial/owl-uart.c >> +++ b/drivers/tty/serial/owl-uart.c >> @@ -251,10 +251,9 @@ static void owl_uart_receive_chars(struct uart_port *port) >> static irqreturn_t owl_uart_irq(int irq, void *dev_id) >> { >> struct uart_port *port = dev_id; >> - unsigned long flags; >> u32 stat; >> >> - spin_lock_irqsave(&port->lock, flags); >> + spin_lock(&port->lock); > > Same thing here; this will break with forced irq threading (i.e. > "threadirqs") since the console code can still end up being called from > interrupt context. As the following code shows, owl_uart_irq does not run in the irq threading context. ret = request_irq(port->irq, owl_uart_irq, IRQF_TRIGGER_HIGH, "owl-uart", port); if (ret) return ret; > >> stat = owl_uart_read(port, OWL_UART_STAT); >> >> @@ -268,7 +267,7 @@ static irqreturn_t owl_uart_irq(int irq, void *dev_id) >> stat |= OWL_UART_STAT_RIP | OWL_UART_STAT_TIP; >> owl_uart_write(port, stat, OWL_UART_STAT); >> >> - spin_unlock_irqrestore(&port->lock, flags); >> + spin_unlock(&port->lock); >> >> return IRQ_HANDLED; >> } > > Johan > > . >