Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp2151514ybc; Sun, 17 Nov 2019 15:14:57 -0800 (PST) X-Google-Smtp-Source: APXvYqzi6n1Y5qycLqP2ej0NIBampiNW/wjOM1rBzlKwmy7YOjZNXhFUHBVHEQaQHMDU/Mjpoy15 X-Received: by 2002:a17:906:4899:: with SMTP id v25mr21698781ejq.235.1574032496964; Sun, 17 Nov 2019 15:14:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574032496; cv=none; d=google.com; s=arc-20160816; b=Sy/h96ZL5TV9lINPY8XhEsA9xj80ucU0oUN9xr0nmqTucTCjSBjxc1UvniD4pUtxnV a8boeRSpZuSbKEs6VltwGh6249+7TOWduMGeqLanL9Ujsk0wdDWH6V6YQSIpUmUnSs7U RuF0Ds36FKLwoYfor0mxn4Q3Y0pdTZ+4fkVUloCET3AU2YLFr/UysKICzzzz+rwLIsQW w771KijQWv3KwezVnc81K7JmHIhh1V3swQWmX76/d9e+Z4IXW0v+Tjg+rWtQULZQ6iZ2 6ZXa23F2iZToqrdr/rli4ceZjKy78Ng7Q+DR/YTJf7rZ2ZpZwaWZUdohY5/miSll+ld8 WeDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:message-id :in-reply-to:subject:cc:to:from:date; bh=WXcEtKGVh4DyF8VKOGTSZeHKeJggxPDdcrb/K6NtCi4=; b=pooyyP3sfIDBDEA8DUbXtJxMhBf+DKuy1H4lzMtj4TYOGNLRtvOIDGGeu04S93csH/ NLCMWVvrU45htWkR1mybn8h7LMU476YfZEyxd/16aUtd8e6nE56kkCh61BL1V0/oT50O OK1jVrcbGyIajQLcUXZGCqO0JQpFopT/PfLg+IQ+O8PkM1ctdB99eniW042rBAjrjp9t xXXTn/dB5coATh62OOM9WY9Cn5M/3vvzUTSJ5Ajg3VQ+wvb8T2EkfWkNFokPHognvHMr 5XDEVLjrnlW0dU0BnwPamtX/UbAG+hmXh5bzrM7LzfmN3gNLx5DH0iNRihZIJlJhplTq qf1A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s28si12820279edc.98.2019.11.17.15.14.30; Sun, 17 Nov 2019 15:14:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726325AbfKQXNO (ORCPT + 99 others); Sun, 17 Nov 2019 18:13:14 -0500 Received: from kvm5.telegraphics.com.au ([98.124.60.144]:49118 "EHLO kvm5.telegraphics.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726268AbfKQXNN (ORCPT ); Sun, 17 Nov 2019 18:13:13 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by kvm5.telegraphics.com.au (Postfix) with ESMTP id A4C032A771; Sun, 17 Nov 2019 18:13:10 -0500 (EST) Date: Mon, 18 Nov 2019 10:13:08 +1100 (AEDT) From: Finn Thain To: Kars de Jong cc: "James E.J. Bottomley" , "Martin K. Petersen" , Michael Schmitz , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] esp_scsi: Clear Transfer Count registers before PIO transfers In-Reply-To: Message-ID: References: <2bbb6359d542f5882be67c415ecc25ad2d9eeb5e.1573875417.git.fthain@telegraphics.com.au> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 17 Nov 2019, Kars de Jong wrote: > Hi Finn, > > Op za 16 nov. 2019 om 04:36 schreef Finn Thain > : > > > > The zorro_esp driver uses both PIO and DMA transfers. If a failed DMA > > transfer happened to be followed by a PIO transfer, the TCLOW and > > TCMED registers would not get cleared. It is theoretically possible > > that the stale value from the transfer counter or the TCLOW/TCMED > > registers could then be used by the controller and the driver. Avoid > > that by clearing these registers before each PIO transfer. > > Are you sure this is really needed? > No. I think it improves robustness and correctness. I would be interested to know whether there is any measurable performance impact on zorro_esp. > The only [time when] the driver reads these registers is after a data > transfer. These are done using DMA on all Zorro boards, so I don't think > there's a risk of stale values from a PIO transfer there. > I'm not entirely sure that the chip is unaffected by stale counter values. (Stale transfer counter values are distinct from stale transfer count register values. Both are addressed by the patch.) If there are DMA controllers out there that can't do very short transfers then this objection would seem to be invalid, because the "DMA length is zero!" issue could be tackled using PIO. > The only place the controller reads these registers is when a DMA > command is issued. The only place where that is done is in the zorro_esp > send_dma_command() functions. Aren't you overlooking all of the ESP_CMD_DMA flags in the core driver? Thanks for your review. -- > These all set both registers explicitly before issuing the DMA command > to the controller, so I don't think there's a risk there either. > > Kind regards, > > Kars. >