From patchwork Tue Nov 24 21:40:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Zary X-Patchwork-Id: 7693261 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E61189F2EC for ; Tue, 24 Nov 2015 21:40:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0544B20620 for ; Tue, 24 Nov 2015 21:40:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 76101205CB for ; Tue, 24 Nov 2015 21:40:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755075AbbKXVkg (ORCPT ); Tue, 24 Nov 2015 16:40:36 -0500 Received: from smtp-1b.atlantis.sk ([80.94.52.26]:51759 "EHLO smtp-1b.atlantis.sk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755058AbbKXVke (ORCPT ); Tue, 24 Nov 2015 16:40:34 -0500 Received: from [192.168.0.2] (188-167-69-119.dynamic.chello.sk [188.167.69.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp-1b.atlantis.sk (Postfix) with ESMTPSA id E563E8746325; Tue, 24 Nov 2015 22:40:31 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rainbow-software.org; s=atlsmtp; t=1448401231; bh=Il7LNeUnMKsBibQfbSHnv6mj5/aL4k9N2k7B4SWZHM4=; h=From:To:Subject:Date:Cc:References:In-Reply-To; b=RpexaYScBFuhPFuHNNFbF8YzwIOc7bgUkfvHiXmuPWJ+Uba0o9F/i0Kypdw3ixS8h G9iiprld3JFdjFAe+vzkQJFRFKsdtCi9cbJH+dHL4DYZAnccpU0LviE55qGn7igKBz iYAbpUWImuQrW7L5WeHmJH2CETFFTSDlnQiB0am4= From: Ondrej Zary To: Finn Thain Subject: Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers Date: Tue, 24 Nov 2015 22:40:24 +0100 User-Agent: KMail/1.9.10 (enterprise35 0.20100827.1168748) Cc: Sam Creasey , Michael Schmitz , "James E.J. Bottomley" , linux-m68k@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org References: <20151118083455.331768508@telegraphics.com.au> <201511240904.55085.linux@rainbow-software.org> In-Reply-To: X-KMail-QuotePrefix: > MIME-Version: 1.0 Content-Disposition: inline Message-Id: <201511242240.24959.linux@rainbow-software.org> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Tuesday 24 November 2015 10:13:17 Finn Thain wrote: > > On Tue, 24 Nov 2015, Ondrej Zary wrote: > > > On Tuesday 24 November 2015, Finn Thain wrote: > > > > > > On Mon, 23 Nov 2015, Ondrej Zary wrote: > > > > > > > > > > > PDMA seems to be broken in multiple ways. NCR5380_pread cannot > > > > process less than 128 bytes. In fact, 53C400 datasheet says that > > > > it's HW limitation: non-modulo-128-byte transfers should use PIO. > > > > > > > > Adding > > > > transfersize = round_down(transfersize, 128); > > > > to generic_NCR5380_dma_xfer_len() improves the situation a bit. > > > > > > > > After modprobe, some small reads (8, 4, 24 and 64 bytes) are done > > > > using PIO, then eight 512-byte reads using PDMA and then it fails on > > > > a 254-byte read. First 128 bytes are read using PDMA and the next > > > > PDMA operation hangs waiting forever for the host buffer to be > > > > ready. > > > > > > > > > > A 128-byte PDMA receive followed by 126-byte PDMA receive? I don't see > > > how that is possible given round_down(126, 128) == 0. Was this the > > > actual 'len' argument to NCR5380_pread() in g_NCR5380.c? > > > > No 126-byte PDMA. The 126 bytes were probably lost (or mixed with the > > next read?). > > When you said, the "PDMA operation hangs waiting forever", I figured that > you had hit an infinite loop in NCR5380_pread()... but now I'm lost. > > My main concern here is to confirm that I didn't break anything e.g. with > patch 24 or 41. It would be nice to know that this hang is not the result > of a new bug. > > > The next read was also 254 bytes so another 128-byte PDMA transfer. > > > > Then modified NCR5380_information_transfer() to transfer the remaining > > data (126 bytes in this case) using PIO. It did not help, the next PDMA > > transfer failed too. > > > > AFAICT, no change to NCR5380_information_transfer() should be needed. It > was always meant to cope with the need to split a transfer between (P)DMA > and PIO. Instead of fixing split transfers, simply forced everything non-modulo-128 to PIO: It seems to work and greatly improves performance: # hdparm -t --direct /dev/sdb /dev/sdb: Timing O_DIRECT disk reads: 4 MB in 4.84 seconds = 846.15 kB/sec --- a/drivers/scsi/g_NCR5380.c +++ b/drivers/scsi/g_NCR5380.c @@ -703,6 +703,10 @@ static int generic_NCR5380_dma_xfer_len(struct scsi_cmnd *cmd) !(cmd->SCp.this_residual % transfersize)) transfersize = 32 * 1024; + /* 53C400 datasheet: non-modulo-128-byte transfers should use PIO */ + if (transfersize % 128) + transfersize = 0; + return transfersize; }