Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2497805rwb; Thu, 29 Sep 2022 10:56:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6tKjyAxMkhMDblwAoy0+kA/jGX/PNAPBwOU3LSvbGpBa3mXI6qAPDO9RJFmhHeSX89Tdjw X-Received: by 2002:a17:90a:2f43:b0:205:f4dc:a47b with SMTP id s61-20020a17090a2f4300b00205f4dca47bmr9573891pjd.62.1664474217948; Thu, 29 Sep 2022 10:56:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664474217; cv=none; d=google.com; s=arc-20160816; b=OFGTpjXBILvoH7tZRuuJQWUWU70JbTG7vd28iYNE/mvObnnHzXDKVn8XPuVSt8aIjH GcsOKX/R8X+gAzX2f0KSbvhAgG7B6rm/e6TXZyv+SsXtt/YVy56FgTba0ZbUdxZpNYXd 2zNHhJNkIxDYuXFw7+R/amsGDKYxCTrXGCVR1sH4pB/n0F8HP/Mhhzyob386Sf3yIKRg J7WAmd7bPqClmupVoEC2DMnm+ap3lsX0WbkAruuRjs16rmqw6hXa/kvBHgPiI4NLOPlt POtR2IBPSlxo7ZScR8NAkCe+ESREIW+a4KWGdcndhZ43NE2Fjc6a4cx+XYbsyXVg7vg+ Wyqg== 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=Ls8n7hJsgg/XBEwdI7SfnN0PoDTYd4YkxLZXvfSpw6o=; b=dch2SuGRgutM5fDl7qMzJEWx0zdhFJIMzPk7lcMcIOwV3MclZwRELfaI4YlrBrpbNs O0wk2OaaRxvMu4J3GusET6QIfi2nC+cQzASEaU2UvFZ5cVq7NBjYetk0V7ti0Ec7s3LE 4Hqv7kj8s7IzKcSxy70AJd7tLeTb1jx2TMwUbdHyONe+7NA/h23mpmGMZOvywM+P2EVU nUd2u7ZLKYZNRMyV4kNKWBNh2ops/ditdqK8wc2UOfFYI4rynnOg7VG1XMBlcM+Whe4k Tc+dgdRAKkDIw9BQewSMpafSHv0zr31euzE3Mtp1JOxDp8aQQp78Rxu0ecF53mf3RZ4X lVwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iGegMLL3; 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=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ip12-20020a17090b314c00b001fdb1694973si6541483pjb.157.2022.09.29.10.56.46; Thu, 29 Sep 2022 10:56:57 -0700 (PDT) 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=@redhat.com header.s=mimecast20190719 header.b=iGegMLL3; 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=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235868AbiI2Q5R (ORCPT + 99 others); Thu, 29 Sep 2022 12:57:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235731AbiI2Q5Q (ORCPT ); Thu, 29 Sep 2022 12:57:16 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E5271BB201 for ; Thu, 29 Sep 2022 09:57:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664470634; 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: in-reply-to:in-reply-to:references:references; bh=Ls8n7hJsgg/XBEwdI7SfnN0PoDTYd4YkxLZXvfSpw6o=; b=iGegMLL3tjNZ1nUUf3TQHcGJYQZXVXSvdU7HGLbmv3j5FPtY45SL6h79nsH7hNJOmgJ8cW o28Ms1KDnZ/3vaONqM71LsNuzIujwmUSdlzxWHYI5JxIbsyWmGrcxIb440Vl1NtP9TQBo0 1Talu0zdyStPdWAVrgM9kVCtrBU2zEA= Received: from mail-oo1-f71.google.com (mail-oo1-f71.google.com [209.85.161.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-605-n-OYU5cVM-qv_HB58pp9ng-1; Thu, 29 Sep 2022 12:57:13 -0400 X-MC-Unique: n-OYU5cVM-qv_HB58pp9ng-1 Received: by mail-oo1-f71.google.com with SMTP id k3-20020a4a8503000000b0047463a13402so654655ooh.2 for ; Thu, 29 Sep 2022 09:57:13 -0700 (PDT) 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; bh=Ls8n7hJsgg/XBEwdI7SfnN0PoDTYd4YkxLZXvfSpw6o=; b=OixmdXh1FQEOfwSI5jrCgAkq8uTfMeC+2DJTvXGi3OoXwf2v40PGCX6oc9cUG4Xy8+ T7uIP9CajEm59erVhy4GT/dHrcpEi/uRKvakoqL0UEc6ND64PfWwexWsL5nb41tcD2PT waLzRBWzrCamAUd5SHkWelrZfO6jTzi4FCGR0rE+u6G+oJ+4o3FO0R6Hs9vqY877eIEP gbvXg5KjTi+gzF/U0v8ft0i22DSvgNBrNvP4UB8/pYXsVGcN+rsylkH/MB7iQXFprSjY 2/4H9QzgaUSPJAoNAsbgVG073UuagfQf2G4Sv7dOz2AiQdKXTuotEOnbeKpNwOqQLZy4 Scuw== X-Gm-Message-State: ACrzQf22ufwV5DI4d+tky0L6BZTA1ftpgd4+3fJzm+3hbqTFZInJrfbT 0fXQI5aknaAsOVGFpIy8aLcu0uvUvTA63lyXQPvRRjK/0t750kQYHQJrBvkMXS/DgCPXxJftVkG /do51oDjbSmYKWPbyx6S68kFG X-Received: by 2002:a05:6870:630b:b0:128:828:5ec0 with SMTP id s11-20020a056870630b00b0012808285ec0mr2317764oao.249.1664470632611; Thu, 29 Sep 2022 09:57:12 -0700 (PDT) X-Received: by 2002:a05:6870:630b:b0:128:828:5ec0 with SMTP id s11-20020a056870630b00b0012808285ec0mr2317753oao.249.1664470632377; Thu, 29 Sep 2022 09:57:12 -0700 (PDT) Received: from localhost (ip98-179-76-75.ph.ph.cox.net. [98.179.76.75]) by smtp.gmail.com with ESMTPSA id a11-20020acab10b000000b003450abf4404sm2886036oif.21.2022.09.29.09.57.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Sep 2022 09:57:12 -0700 (PDT) Date: Thu, 29 Sep 2022 09:57:10 -0700 From: Jerry Snitselaar To: Vinod Koul Cc: dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, Koba Ko Subject: Re: [PATCH 3/3] dmaengine: Fix client_count is countered one more incorrectly. Message-ID: <20220929165710.biw4yry4xuxv7jbh@cantor> References: <20220830093207.951704-1-koba.ko@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220830093207.951704-1-koba.ko@canonical.com> X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE 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 Tue, Aug 30, 2022 at 05:32:07PM +0800, Koba Ko wrote: > If the passed client_count is 0, > it would be incremented by balance_ref_count first > then increment one more. > This would cause client_count to 2. > > cat /sys/class/dma/dma0chan*/in_use > 2 > 2 > 2 > > Fixes: d2f4f99db3e9 ("dmaengine: Rework dma_chan_get") > Signed-off-by: Koba Ko > --- > drivers/dma/dmaengine.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c > index 2cfa8458b51be..78f8a9f3ad825 100644 > --- a/drivers/dma/dmaengine.c > +++ b/drivers/dma/dmaengine.c > @@ -451,7 +451,8 @@ static int dma_chan_get(struct dma_chan *chan) > /* The channel is already in use, update client count */ > if (chan->client_count) { > __module_get(owner); > - goto out; > + chan->client_count++; > + return 0; > } > > if (!try_module_get(owner)) > @@ -470,11 +471,11 @@ static int dma_chan_get(struct dma_chan *chan) > goto err_out; > } > > + chan->client_count++; > + > if (!dma_has_cap(DMA_PRIVATE, chan->device->cap_mask)) > balance_ref_count(chan); > > -out: > - chan->client_count++; > return 0; > > err_out: > -- > 2.25.1 > Hi Vinod, Any thoughts on this patch? We recently came across this issue as well. Thanks, Jerry