Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1088537pxb; Fri, 20 Nov 2020 00:18:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJx8GvHv8Y74BFxA9s8rXXITMMYXnMJWTnEd2tjNY67+cS+VSrWbJCwqWQuIOtaJ+bzPqVBK X-Received: by 2002:a05:6402:1ef:: with SMTP id i15mr6056613edy.60.1605860313578; Fri, 20 Nov 2020 00:18:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605860313; cv=none; d=google.com; s=arc-20160816; b=CBd1TMCHj/isj1da7xA5+vQKGmcAlZcZOa6POpRcSY0XtjpEBQRCfPqi6pfTLkhi1a z5g3qaSEV2tKsCrUtARZKkvlB7FGY9qdsh7wHsKiaCQtVB9qp7kMDlxe1QpGyKF+g0Bk xzOKlXHc1oHYrswmXy/V4XT9Uimg7uYKa5QP8q/om81HK3/IR+ogdHbzz7c4H2hs4dho HNWiARo0SvlPD0SfeSr2XlGFnJ17fDRAy3tnxQM8EgdaO3/uP4R47E++1EY/B7WhEKpe kRmn6AjSU2gVMFwIRH2iN9D179GhFYVJpBWq/DtnebRg1biPDjdo1mroPMYuqJLlM0Du lg3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=WDs6obGTLR1+wdJ6BVB6dndSCVFd0as/yCTkI8gYmPU=; b=XexON4ThevxEnkFq9c+zYsaBiEN1osMUpV0FPkjfEPF2r+j85Cun3QTrTybZb2aJH7 SOwvKgJwUNdh0rBoOsWt3KaVGWBsEjmsD6RinUgl3O2TR5oJMJmDs9Mo9os2vZI5UNue 1pgmNC93viMP8Zil0lB6k0+RztexyciPQrJ+F55T9cSmo8iLiHAK7XIkoTv1QeVFghzO 9Z26/vrNO6mDti97aZ5QgJFlgre2f+dxO6jV+Z4oghOzwukdB5HyZ745ay7sj1Q8T0YK o/YSnEmb/vx0YqZBWW/6Nec7ZQ2sDVrP6MHGHNnWzbg7g2rpj38h2rJa3sdr3T/vM/Eh Wutw== 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z41si1425145ede.250.2020.11.20.00.18.11; Fri, 20 Nov 2020 00:18:33 -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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725818AbgKTIP0 (ORCPT + 99 others); Fri, 20 Nov 2020 03:15:26 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:38666 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725766AbgKTIPZ (ORCPT ); Fri, 20 Nov 2020 03:15:25 -0500 Received: by mail-lj1-f194.google.com with SMTP id r17so9144570ljg.5; Fri, 20 Nov 2020 00:15:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=WDs6obGTLR1+wdJ6BVB6dndSCVFd0as/yCTkI8gYmPU=; b=Y/xPta9rvf7YKf4ZukcFJI5daQExV4qAMp40tpHdLOeUXuDb6YQ0Nxn36UQg1WFNWs fkReHJeQ3naoM3VQIjwZ4XVldStY0TJ4BX2LJ8ljlAp9zjrmI/dctR7Sy3LjiuAR0RZf n5u3UgKtTb7Wpcows8hreTNurE4CBobwpn9BgT9wsI6TYy+BvPbn5da0v2yMBt/pbPfs YxdbVnX9O4VvnKXJ5819YZ+C2ZRHA/VH0B0yhsnXZ7dbMBaozuXOx1HM61V3+wbNAlkL +tndx23C+gMd01/d6rBC9swXLkwR/9RZbQ6KsluVbq7OdjbdHmelrz22gCHGCiAZ36dF otIg== X-Gm-Message-State: AOAM533G7gzApWGtyW1HkeXxnghiEHXppCuKQLaVJyKO9P7gEUnk4AIa iUwdqeKeA4LttgM9uv9u0d8= X-Received: by 2002:a2e:9005:: with SMTP id h5mr6752085ljg.59.1605860122921; Fri, 20 Nov 2020 00:15:22 -0800 (PST) Received: from xi.terra (c-beaee455.07-184-6d6c6d4.bbcust.telenor.se. [85.228.174.190]) by smtp.gmail.com with ESMTPSA id p25sm261261lfc.125.2020.11.20.00.15.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Nov 2020 00:15:21 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.93.0.4) (envelope-from ) id 1kg1Zl-0006KK-9f; Fri, 20 Nov 2020 09:15:26 +0100 Date: Fri, 20 Nov 2020 09:15:25 +0100 From: Johan Hovold To: Tian Tao Cc: gregkh@linuxfoundation.org, jirislaby@kernel.org, linux-arm-kernel@lists.infradead.org, linux-unisoc@lists.infradead.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] tty: serial: rad-uart: replace spin_lock_irqsave by spin_lock in hard IRQ Message-ID: References: <1605835613-28359-1-git-send-email-tiantao6@hisilicon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1605835613-28359-1-git-send-email-tiantao6@hisilicon.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 20, 2020 at 09:26:53AM +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/rda-uart.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/drivers/tty/serial/rda-uart.c b/drivers/tty/serial/rda-uart.c > index 85366e0..d6705a0 100644 > --- a/drivers/tty/serial/rda-uart.c > +++ b/drivers/tty/serial/rda-uart.c > @@ -406,10 +406,9 @@ static void rda_uart_receive_chars(struct uart_port *port) > static irqreturn_t rda_interrupt(int irq, void *dev_id) > { > struct uart_port *port = dev_id; > - unsigned long flags; > u32 val, irq_mask; > > - spin_lock_irqsave(&port->lock, flags); > + spin_lock(&port->lock); This will break with forced irq threading (i.e. "threadirqs") since the console code can still end up being called from interrupt context (which can result in a deadlock). > > /* Clear IRQ cause */ > val = rda_uart_read(port, RDA_UART_IRQ_CAUSE); > @@ -426,7 +425,7 @@ static irqreturn_t rda_interrupt(int irq, void *dev_id) > rda_uart_send_chars(port); > } > > - spin_unlock_irqrestore(&port->lock, flags); > + spin_unlock(&port->lock); > > return IRQ_HANDLED; > } Johan