Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp4511838rwb; Sat, 21 Jan 2023 13:36:13 -0800 (PST) X-Google-Smtp-Source: AMrXdXt5tdi0p++EErzLE7F9WthTGlt1M2WOg7FPM5ufEK7LF/qzRokSQ4NIs3IrlLXrWE3CwS5g X-Received: by 2002:a17:902:d342:b0:189:89a4:3954 with SMTP id l2-20020a170902d34200b0018989a43954mr20280683plk.41.1674336972990; Sat, 21 Jan 2023 13:36:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674336972; cv=none; d=google.com; s=arc-20160816; b=WkZMVGrPdL9JnDg3sOvM1GB3wgql4tI4dh5yZWpMH2oKDA4xFgwX8WRI/VYNQWDoPw jTyV8tyDsC/5Zg1UCtpeh6Q6r/p9d0vaPz8DhUiX68p6SkxplPoVZwPK1iIaTyOsgWC5 eMSfkYDr+UBi3zovAsLDphGpf3so0XCxMYZJ481lZ8ln7FKO5hzc3EU8Gxflig7Ks0Wu 8mCNCGWQ4fkobuPvf9pQrb+PRFjBO6ZZ/Q+2y9eu7SWX2+QOUT3GE8OGKddKf8vjE8JK XWxj2PjG/vqNV08tUqGULI/4DgAAWNehZ+gGO1+kFwhu88cEcyWu5CZgEV78/8JpXg7E 5cgg== 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:dkim-signature; bh=hGyflcQqxHomC2pDK0ldQILNgIUhC4VODU07KwyIzHk=; b=JG6OfFKjPsXbaNvRyBCC+i1JHfWMaRw7zi2C+8MpilEGvYQOvys9WnN6+ZySNN/qZY rfidf/wfTrb0thOoaP8FKYelQd1kqICjnQaNeBXji4FaqSkdUqv6aATmfOJIE7qpsuYn zjFn8nBS7stdjMOkiZZto0q3mkVqm5q5P8x9Pt++ttPy9yg+XjLfbLd04v0aKRTv1Bvj TZcGy6vCAJT9OiSazr5eTvONEQSDeatngByj9MAo9JM0rW+t+b4Mg71oNp0+VqgC1M1F orYEFE3EZNADBZ+bQTSkfzNgSkRwK4CmJgKTcwtm8zge7kin8dEGcWAReege2XsrDM2C mqhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=V01JxkFY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s1-20020a170902ea0100b0018881a1c130si1918744plg.587.2023.01.21.13.36.07; Sat, 21 Jan 2023 13:36:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=V01JxkFY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229764AbjAUVK1 (ORCPT + 50 others); Sat, 21 Jan 2023 16:10:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229526AbjAUVKZ (ORCPT ); Sat, 21 Jan 2023 16:10:25 -0500 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E783D22028; Sat, 21 Jan 2023 13:10:23 -0800 (PST) Received: by mail-lf1-x12e.google.com with SMTP id br9so12867083lfb.4; Sat, 21 Jan 2023 13:10:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=hGyflcQqxHomC2pDK0ldQILNgIUhC4VODU07KwyIzHk=; b=V01JxkFYrjDtJe1ldE/9HF7v+C59zrdbaQmt0QImGE1Qfo5KACes3qFD0kKZ5+d7Qd XTNIgHB4LPnTzo1AyLy0y32V6ZJDT4MxWf6dfdTBmgAUrcCDrL334IDcPMgO26EC502D ML9HYvyxf0vO1hyxVa4zyzyj9f6vvhXWqFtHn7F4AbUpHqwKKePinEBuv3IuShq1JKN3 3DdiAqwRTFBLVjQ+tVvqs60q2jvoMNf/09wWBLI5G8A1YK61GfFhByY2eioiCYckhH/G XQhov/E3YPLrw1M3VNN80ijLnT/HFJcDOGHx1UQ93uP+XpWOqwkm/HcBUAMzxhbz4es0 GHfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=hGyflcQqxHomC2pDK0ldQILNgIUhC4VODU07KwyIzHk=; b=xZ/NNcS2sXU7iFSejDVcQ6trSDzk8iIqesgXe1GUZgkWMsVHMgngP/wD9WEUab3llu xlqfLAcLh4XsX9KzK0iT1iS7qPkjn2AAvNBHDW/oid9QPGxhpEBL7+HUb3hXtpPrZuYz vVMBTAb1XZzcAhz2ucfyDkofE/lpuTVJZKPIJpWP5kFaFQOahSv5wmOAdgLNxn/grd5e Lw5PA2Jh6d3AMI5z6T//n6oTSTtUb/T71FhQPMh6e9AZJM+VeG0cMGaJd8C/Oqov3jW8 o/HJh3rgFDHqRWc/Ixd9xj+NjGpnjwrmeC1ApZC+/NkBaFJtJitmHFOEBiIuawrwImSo /SPA== X-Gm-Message-State: AFqh2koLExGJ2Sef+9nWqcILvgmQ8r81iezFGE/FJtZp2ZOPYembNyj0 CP9dhhWSLwL120yuUsnz6c4= X-Received: by 2002:a05:6512:3a82:b0:4b6:e493:b798 with SMTP id q2-20020a0565123a8200b004b6e493b798mr6386544lfu.68.1674335422034; Sat, 21 Jan 2023 13:10:22 -0800 (PST) Received: from mobilestation ([95.79.133.202]) by smtp.gmail.com with ESMTPSA id cf37-20020a056512282500b004d254939bebsm2541840lfb.305.2023.01.21.13.10.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Jan 2023 13:10:21 -0800 (PST) Date: Sun, 22 Jan 2023 00:10:18 +0300 From: Serge Semin To: Bjorn Helgaas , Vinod Koul Cc: Serge Semin , Gustavo Pimentel , Rob Herring , Bjorn Helgaas , Lorenzo Pieralisi , Cai Huoqing , Robin Murphy , Jingoo Han , Frank Li , Manivannan Sadhasivam , Alexey Malahov , Pavel Parkhomenko , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , caihuoqing , Yoshihiro Shimoda , linux-pci@vger.kernel.org, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v9 09/27] dmaengine: dw-edma: Drop chancnt initialization Message-ID: <20230121211018.wn2zjxts7hzmetin@mobilestation> References: <20230113171409.30470-10-Sergey.Semin@baikalelectronics.ru> <20230120235449.GA682361@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230120235449.GA682361@bhelgaas> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 20, 2023 at 05:54:49PM -0600, Bjorn Helgaas wrote: > On Fri, Jan 13, 2023 at 08:13:51PM +0300, Serge Semin wrote: > > DMA device drivers aren't supposed to initialize the dma_device.chancnt > > field. It will be done by the DMA-engine core in accordance with number of > > added virtual DMA-channels. Pre-initializing it with some value causes > > having a wrong number of channels printed in the device summary. > > > > Fixes: e63d79d1ffcd ("dmaengine: Add Synopsys eDMA IP core driver") > > Signed-off-by: Serge Semin > > Reviewed-by: Manivannan Sadhasivam > > Tested-by: Manivannan Sadhasivam > > Acked-by: Vinod Koul > > --- > > drivers/dma/dw-edma/dw-edma-core.c | 1 - > > 1 file changed, 1 deletion(-) > > > > diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c > > index 6c9f95a8e397..ecd3e8f7ac5d 100644 > > --- a/drivers/dma/dw-edma/dw-edma-core.c > > +++ b/drivers/dma/dw-edma/dw-edma-core.c > > @@ -817,7 +817,6 @@ static int dw_edma_channel_setup(struct dw_edma *dw, bool write, > > dma->src_addr_widths = BIT(DMA_SLAVE_BUSWIDTH_4_BYTES); > > dma->dst_addr_widths = BIT(DMA_SLAVE_BUSWIDTH_4_BYTES); > > dma->residue_granularity = DMA_RESIDUE_GRANULARITY_DESCRIPTOR; > > - dma->chancnt = cnt; > > Did you look for other instances of this bug? There are several other > places that *look* like they might have the same issue: > > axi_dmac_probe > dw_probe (dw-axi-dmac-platform.c) > ioat_pci_probe > plx_dma_create > ... > > I hate to fix just one if there are other similar issues. Indeed. The same problem can be spotted in: drivers/dma/dma-axi-dmac.c drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c drivers/dma/ioat/init.c drivers/dma/plx_dma.c drivers/dma/qcom/hidma.c drivers/dma/sprd-dma.c drivers/rapidio/devices/tsi721_dma.c Moreover besides causing a wrong number of channels printed in the device summary the problem may also lead to the dma_ida IDs leak. So it's a bit more complex than I described in the patch log. @Vinod you didn't say anything about that during the patch review. Do you want me to provide a similar fix for the denoted drivers? -Serge(y) > > > /* Set DMA channel callbacks */ > > dma->dev = chip->dev; > > -- > > 2.39.0 > > > >