Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp90591rwe; Thu, 13 Apr 2023 22:54:35 -0700 (PDT) X-Google-Smtp-Source: AKy350Z2p7W8N0xHq/LQBTdgOYI1ZBJZRo6i0b2zO3pvfgSibXdSZDjLePFnJpLG2IGE6+e50JBN X-Received: by 2002:a17:902:c149:b0:19e:839e:49d8 with SMTP id 9-20020a170902c14900b0019e839e49d8mr1371529plj.59.1681451674694; Thu, 13 Apr 2023 22:54:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681451674; cv=none; d=google.com; s=arc-20160816; b=T0Qz86ziWAMD71L1ibiSf56PVcb3SS2hwyLnnmVPfZwitAfcHj0yOh5gAks0iOAH75 +FNpUgGGW2YjxgwRfn+R3H8aI83uTBjhFBOfE5m3RfmcjiNnq3pXOymd2p/ldvyo1+E3 YeVPsmykKQOFYtfn7YRFncEkRDGHBwOscvb/VltUTBn59TqNJ2bK22rMNpT9dHiQrTji Pg0n8Vx/C44b8T6UYrwrm8MQcFswUNR8MWxJBTWdPfY39R8fna8w+2FzhHB83m8wGUJx QCpQ2qbLGJxYwKss7DWoUY5IjL7rAz/JOoUcy5QCRNiqP7LZ+Yu4erKmoKnZcWcFFdn0 Yh6Q== 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=zQE4wvka/0/4+o5H/NgW9BNv4wfz/VF5TFtsQx3nNj0=; b=weL1dnjd5G+zKotn5KLW4Ajz3apBatsTEzCG8XL5JKgBZPcKRnHPVhTxP7JqmZsuKA OWqg9AOzh0FEPeumpWrJmxGFLaOoqvcLdLEtnleKDNvWXRWWDet9qOvb00h7KurKDx8g EM2RuhVkJICAsNouC6uy/EfXRADVZuXySaXegSnyrLGpnuWfu5ppH+ChwGFgCUo9y7Se v9qEd9hoc5kn6SflrB0EZKzVgq06XRJuqYE5HF46Rh+KIxO+zkPS1239HXOnpQL1o+fe zHzPgjNSKyFhxJqRcbD2NyaARSBo1UftKrs2JeKB+/d4zRgUNyASenOkRFLWHkzeUf2k Dn5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=Z6oDvtEg; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ij29-20020a170902ab5d00b001a1abc91952si3617211plb.194.2023.04.13.22.54.21; Thu, 13 Apr 2023 22:54:34 -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=@infradead.org header.s=bombadil.20210309 header.b=Z6oDvtEg; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229947AbjDNFuP (ORCPT + 99 others); Fri, 14 Apr 2023 01:50:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229932AbjDNFuM (ORCPT ); Fri, 14 Apr 2023 01:50:12 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06D9B5248; Thu, 13 Apr 2023 22:50:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=zQE4wvka/0/4+o5H/NgW9BNv4wfz/VF5TFtsQx3nNj0=; b=Z6oDvtEguDHwR/dQy8aDqWWDJj arrvi3VLc70vB/TwF5o5lbfa1Bjnp0bQqFHWmB9jhZK1HvoDPeDgrnG4wA+zuvffirEHa29KOGeFq SrpdgbgFDDDW//yOIWvG7ZdJYGSpYQ5Vw5BQPOdamtBk6dSsO3D5SIMIMK2O4M5BldEtCZ5ub0L3v FHnxiG5HVHpzXWGWMbA/3w1I9lMzjI5xEbJfyB86tVxm1LN5aYjMcXcR5fwEiz4+sxFDNNbDpDexg Ajw10u3hsmd2ItIGPRkegUG5+1WlMLJVmOkrzPmPxVRrbhJQyBSOSTiUNlLZP7ogfWrlHZFGvlCAr gCl7CLDQ==; Received: from hch by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1pnCJz-008PDG-2v; Fri, 14 Apr 2023 05:50:07 +0000 Date: Thu, 13 Apr 2023 22:50:07 -0700 From: Christoph Hellwig To: Kelvin.Cao@microchip.com Cc: hch@infradead.org, dmaengine@vger.kernel.org, vkoul@kernel.org, George.Ge@microchip.com, linux-kernel@vger.kernel.org, logang@deltatee.com Subject: Re: [PATCH v2 1/1] dmaengine: switchtec-dma: Introduce Switchtec DMA engine PCI driver Message-ID: References: <20230403180630.4186061-1-kelvin.cao@microchip.com> <20230403180630.4186061-2-kelvin.cao@microchip.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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 Thu, Apr 13, 2023 at 10:40:41PM +0000, Kelvin.Cao@microchip.com wrote: > > > Why is the lock needed while reading the status and waiting > > > for it with long delays? > There's (low) chance of access to the same ctrl register from other > paths which might change the value of status in an unexpected way. It > also prevents the hardware operation from being interrupted until it > indicates it has finished by a bit set in the status register. Well, the lock is obviously required to protecte the reads to the register. But why do you need to hold the lock over the reads and the delay?