Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4046689imm; Thu, 17 May 2018 21:12:17 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpDS0liOAPw9kQqIW19vS3wf65UdDGjxa3ACniLoI3CgyLg5k+OzYiHNiE0EHXm4+h1nQcP X-Received: by 2002:a63:9302:: with SMTP id b2-v6mr6243557pge.263.1526616737371; Thu, 17 May 2018 21:12:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526616737; cv=none; d=google.com; s=arc-20160816; b=BO5wBDH5FtUmLP08QQ4YVsRKs9snV6Wy82MjzWBYNUFB2kz1XSx8TGQ7A5nHD5y/1C PbQPxc+9hnm2o1uTwkHhiNdP/cSHcQFx4f39D+K/uTwWrYSm+IC+b1SBAPaGoXvXnYpi 4XI1auLHeyxW45PF5Z1OV07oWctEp1hZ0xkOtlkHrNCroAQwPZPLeU/p1LDXQC4CktsX L8h5f8nCqFT7A3bq1FBejCfp42BTL6+CZgH7NA7yrNo6m9U2Bhh0WO/evkIUCHHkQako 1HgRV4F+WNCya+mSSr1SHSKasqwC31snf16FgSpkH0HBVOFYWJGMA2568xwyuYOsvlQg 5DJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=JDDLeDKjLI6oKqeNRamsNiGpYiSuS+m59IIr4QJmCZI=; b=fIwTmkQMXEi1h9s8tgog+mBeSZLRgsW/KeRjn/qw3bktwDzB68IKHNoa6DPBwFITvW z778EI6LZ4OfjPACSTZQ4lZXYjXt0B+ur0IviMQhNuKgqkQZzSRcPZtLVPFMYwyN1pHC 7j1wLMcQSd9MWNww4LjvY5MaNJFrBiS3XH6ijQHgmRL1MfEe3Ur6colXcEYKHKj1c3XG bCoYi/xre0SPU1azQHbaQw3BDg9SMfe1KE/h4C/mfNvT2a2LgFjDtJYOEhes/0dHsqHR 4fqXjXRQGhSfOY/izTnPK9rTbkzst1E6/TpHyThTK9ptsWCfi4Vgq87FAnwwl/uJyB67 yHxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Pa5c9AvL; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p8-v6si6416811plk.441.2018.05.17.21.12.01; Thu, 17 May 2018 21:12:17 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=Pa5c9AvL; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751413AbeERED5 (ORCPT + 99 others); Fri, 18 May 2018 00:03:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:58052 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751281AbeEREDz (ORCPT ); Fri, 18 May 2018 00:03:55 -0400 Received: from localhost (unknown [171.76.76.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2100D20660; Fri, 18 May 2018 04:03:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1526616234; bh=scQa936bd3mdOIjTaP0xIRiW4iqysa6lxsRmUmAQtGM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Pa5c9AvLfle40wtrjRYSw0AyFUJby2jZe03kpgmJlsm4FCNVUJ7gEj7IjJ/A3pm18 mX5rkZMsiKne/xWGTHbFt+eASw/VQGJw44jDBkFmzXgOBXI3Nhi+Owin9hyMFqkcf2 FkNJJfKNtcLL3ndzqE1q7A5GsxuBpqNQgfc/PYiQ= Date: Fri, 18 May 2018 09:33:49 +0530 From: Vinod To: Frank Mori Hess Cc: Marek Szyprowski , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, Dan Williams , r.baldyga@hackerion.com, Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Linux Samsung SOC Subject: Re: Revert "dmaengine: pl330: add DMA_PAUSE feature" Message-ID: <20180518040349.GB2932@vkoul-mobl> References: <182f50b9-55b6-c9ce-07fb-718a1d22e9c8@samsung.com> <06f54061-c537-b399-e493-ec2cdf4def5d@samsung.com> <20180515062144.GC13271@vkoul-mobl> <20180517041946.GQ13271@vkoul-mobl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 17-05-18, 12:20, Frank Mori Hess wrote: > Sorry to keep coming back to this, but I'm experiencing a bit of > incredulity that you are saying what you seem to be saying. You seem > to be saying dmaengine provides no way to permanently stop a transfer > safely other than transferring the full number of bytes initially > requested. So the proper resolution is the 8250 serial driver needs > to remove rx dma support, because they are just trying to do something > that is not supported. > > On Thu, May 17, 2018 at 12:19 AM, Vinod Koul wrote: > >> > Terminate is abort, data loss may happen here. > >> > >> Wait, are you saying if you do > >> > >> dma pause > > > > no data loss > >> read residue > > > > here as well > >> dma terminate > > > > Oh yes, we aborted... > >> > > I see two ways of interpreting what you are saying. First, from the > point of view of the user of the dmaengine api. From this point of > view it is impossible for data loss to occur during pause or reading > the residue, so saying they cause no data loss during > pause/residue/terminate is meaningless. This is because the user > can't confirm any data loss until after they have read the residue and > the transfer is terminated, since optimistically the data may still be > available if only the user would resume and allow the transfer to > continue. > > Second there is the interpretation I want to believe. This is "no > data loss on pause" means that after the pause, no data has been > discarded by the dma controller hardware, in fact all the data it has > read before being paused has been fully transferred to its > destination. Reading the residue while paused gives you an accurate, > up-to-date state of the paused transfer. Then finally, although in > general dma terminate causes data loss, it does not in this case since > we terminated while we were paused and read the up-to-date residue. > This is the interpretation implicit in the 8250 serial driver. You are simply mixing things up! On Pause we don't expect data loss, as user can resume the transfer. This means as you rightly guessed, the DMA HW should not drop any data, nor should SW. Now if you want to read residue at this point it is perfectly valid. But if you decide to terminate the channel (yes it is terminate_all API), we abort and don't have context to report back! As Lars rightly pointed out, residue calculation are very tricky, DMA fifo may have data, some data may be in device FIFO, so residue is always from DMA point of view and may differ from device view (more or less depending upon direction) Now if you require to add more features for your usecase, please do feel free to send a patch. The framework can always be improved, we haven't solved world hunger yet! -- ~Vinod