Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp496488lqh; Thu, 28 Mar 2024 08:00:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXspsRL3k1DsqZAn+EbDNFDxrfo1ICy58p5GD5T7Ab+y5t486hD3rlQVIJ+aat4w+BEYWzIMmEdqNvsRKlQcCXv+eeztXEgeNQi6zr9bg== X-Google-Smtp-Source: AGHT+IHpcavkzM/4zbHNKRzfOCuu9GOqB7VjG/Cy6NLBB1N505zVsB4ceh0LagdXrR3BCi/GXLWK X-Received: by 2002:a05:622a:5b0c:b0:432:76b8:975 with SMTP id ea12-20020a05622a5b0c00b0043276b80975mr2679646qtb.36.1711638040398; Thu, 28 Mar 2024 08:00:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711638040; cv=pass; d=google.com; s=arc-20160816; b=I0Mf0OUCsDcj7USiRS1983coRCdJAUjh+oih5QZD80CbbJGHJS5KDXJjM23s5A9NL1 IzGbzKMTmTQe+wOrzALCXB+wLp6KIsYbLaGExrd7vT/B3pCDpdpoD5FIyLsFNDODH6nW 1zCDOd19u6nygHi+tn8oSNsbUBNVU4jsMNKl5XTLR4F59/1jcSyXKvf7sRUmxwa/dbc+ n1OHkwN0/0r1OVUtar9ca1fD9kHC20TUJcB3HpEI9al4NqNh1t28CmB5eplV66Gok0Lj Dg4p6uuvZFOGMcUVnjLPAHk9Tn2bJjSD1M9yywVZZsENreU40Huw26C7h2/46lP1m9+4 leuQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:dkim-signature:message-id; bh=vnqQ84/rMjC+/rcGQR2+/HXsL+AxeYk9jECNf55kBHU=; fh=RIcoaSiA0BWYdmFMK//ouXlqOtBMNx/rQrXUB50DEkk=; b=DAjpFX0IdhEsfTlc6njVd5M+4goEClnPT43qoe73/YnD7fNKBAaQvXICW8+2Zuf5P4 1Hp6VdcmvVSaOsAHCY9VO6IlHDU2RwyFVKw6yOLt/wADOisGRCxPJS1JUK3sOvddyXSI Cex/STE0lkb7FXJZj/klT8LACf6FIniNMyk3VXYznWVI41TUVyi/R6KCwPa5C4e87962 97qc/4GPTpfWuGmkFAgD/7NcmOr96u567JBfFA01PyCnXYsEh2SJTg+t2ZIkEntB/eig U9B9fU8AZu0z2+vaEjWjCtX63tJzJ9ntzHwMRdNY3qfgSc0pOZgMa/OZnwGFs7gPOFKr aO0Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=pSI293zi; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-123126-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-123126-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id v22-20020ac85796000000b00432b5821825si1286316qta.26.2024.03.28.08.00.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 08:00:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-123126-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=pSI293zi; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-123126-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-123126-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 160721C29E4F for ; Thu, 28 Mar 2024 15:00:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8603412BEBE; Thu, 28 Mar 2024 15:00:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="pSI293zi" Received: from out-188.mta1.migadu.com (out-188.mta1.migadu.com [95.215.58.188]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4F30D7E78B for ; Thu, 28 Mar 2024 15:00:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.188 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711638033; cv=none; b=n4X4WPiUaxc4B5rSXfpUvLATbVzO6tXYSUSxS8quFL3dlAUk4aMqOuwVxfkfsg0ZDArnEg7TzJr5z0mjLvmDHBgd8PoQpRBGyaMvZpRTZg6r6FIDmkSaF9Tp/rM5a5mpLz+YO8doWstRCT2YlRSWBqk9fYMIEaY0KEJKMhpQzwM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711638033; c=relaxed/simple; bh=QcYao87vHK3QJ3Zezb5WiwzKOnj5m0Xji4J1XJL6zKE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=AjGbwewhFax+s7zhHuDDMtNU8NlNLeOHccakUWi0gt/dJxc204/61bloxuYt9ymAPtuWD+4z7sw0KnkHgYdEYlgMWty3x4Xuz+y8AM81zwaHP9dEQHZaPJIfv/w1k+Oqy4UVCCGQ9Vs7/BboTdJtmPXGr8yJPC+i/mgp4/6kF+4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=pSI293zi; arc=none smtp.client-ip=95.215.58.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1711638028; 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=vnqQ84/rMjC+/rcGQR2+/HXsL+AxeYk9jECNf55kBHU=; b=pSI293ziwMZM/xh2IUz27+6/EZ2rERRrKJz2IlDn3Ql42kY6xoKt0zIee6GNFz3GAUN66I vh1yg2NdG+pSoEk3BktZGUQE+cNSoB2L5EsSOV5xH6Tz4jIXj1Cby7JYJHB+6R+G0cJaHh wk2zMItRX3y+JW8JpXDmSxILAzEWIIk= Date: Thu, 28 Mar 2024 11:00:24 -0400 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH 2/3] dma: xilinx_dpdma: Remove unnecessary use of irqsave/restore Content-Language: en-US To: Tomi Valkeinen Cc: Michal Simek , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Laurent Pinchart , Vinod Koul , dmaengine@vger.kernel.org References: <20240308210034.3634938-1-sean.anderson@linux.dev> <20240308210034.3634938-3-sean.anderson@linux.dev> <0652c82f-b0a2-4881-ac51-38399b180ad4@ideasonboard.com> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Sean Anderson In-Reply-To: <0652c82f-b0a2-4881-ac51-38399b180ad4@ideasonboard.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 3/27/24 08:27, Tomi Valkeinen wrote: > Hi, > > On 08/03/2024 23:00, Sean Anderson wrote: >> xilinx_dpdma_chan_done_irq and xilinx_dpdma_chan_vsync_irq are always >> called with IRQs disabled from xilinx_dpdma_irq_handler. Therefore we >> don't need to save/restore the IRQ flags. > > I think this is fine, but a few thoughts: > > - Is spin_lock clearly faster than the irqsave variant, or is this a pointless optimization? It's safer to just use irqsave variant, instead of making sure the code is always called from the expected contexts. It's not an optimization. Technically this will save a few instructions, but... > - Is this style documented/recommended anywhere? Going through docs, I only found docs telling to use irqsave when mixing irq and non-irq contexts. The purpose is mainly to make it clear that this is meant to be called in IRQ context. With irqsave, there's an implication that this could be called in non-IRQ context, which it never is. > - Does this cause issues on PREEMPT_RT? Why would it? --Sean > > Tomi > >> Signed-off-by: Sean Anderson >> --- >> >> drivers/dma/xilinx/xilinx_dpdma.c | 10 ++++------ >> 1 file changed, 4 insertions(+), 6 deletions(-) >> >> diff --git a/drivers/dma/xilinx/xilinx_dpdma.c b/drivers/dma/xilinx/xilinx_dpdma.c >> index eb0637d90342..36bd4825d389 100644 >> --- a/drivers/dma/xilinx/xilinx_dpdma.c >> +++ b/drivers/dma/xilinx/xilinx_dpdma.c >> @@ -1043,9 +1043,8 @@ static int xilinx_dpdma_chan_stop(struct xilinx_dpdma_chan *chan) >> static void xilinx_dpdma_chan_done_irq(struct xilinx_dpdma_chan *chan) >> { >> struct xilinx_dpdma_tx_desc *active; >> - unsigned long flags; >> - spin_lock_irqsave(&chan->lock, flags); >> + spin_lock(&chan->lock); >> xilinx_dpdma_debugfs_desc_done_irq(chan); >> @@ -1057,7 +1056,7 @@ static void xilinx_dpdma_chan_done_irq(struct xilinx_dpdma_chan *chan) >> "chan%u: DONE IRQ with no active descriptor!\n", >> chan->id); >> - spin_unlock_irqrestore(&chan->lock, flags); >> + spin_unlock(&chan->lock); >> } >> /** >> @@ -1072,10 +1071,9 @@ static void xilinx_dpdma_chan_vsync_irq(struct xilinx_dpdma_chan *chan) >> { >> struct xilinx_dpdma_tx_desc *pending; >> struct xilinx_dpdma_sw_desc *sw_desc; >> - unsigned long flags; >> u32 desc_id; >> - spin_lock_irqsave(&chan->lock, flags); >> + spin_lock(&chan->lock); >> pending = chan->desc.pending; >> if (!chan->running || !pending) >> @@ -1108,7 +1106,7 @@ static void xilinx_dpdma_chan_vsync_irq(struct xilinx_dpdma_chan *chan) >> spin_unlock(&chan->vchan.lock); >> out: >> - spin_unlock_irqrestore(&chan->lock, flags); >> + spin_unlock(&chan->lock); >> } >> /** >