Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754890AbbKMUVE (ORCPT ); Fri, 13 Nov 2015 15:21:04 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:57536 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754793AbbKMUU6 (ORCPT ); Fri, 13 Nov 2015 15:20:58 -0500 Message-ID: <0cbe4b9bd72dad1336178e1d7cd94267.squirrel@www.codeaurora.org> In-Reply-To: <20151108135352.GA22709@localhost> References: <20151103041528.GS21326@localhost> <5638359D.9080507@codeaurora.org> <20151103063009.GT21326@localhost> <20151103160800.GD12910@localhost> <563AC226.30303@codeaurora.org> <20151105120527.GX12910@localhost> <563B812E.5090202@codeaurora.org> <563D98E6.6070501@codeaurora.org> <20151108135352.GA22709@localhost> Date: Fri, 13 Nov 2015 20:20:57 -0000 Subject: Re: [PATCH V2 2/3] dmaselftest: add memcpy selftest support functions From: okaya@codeaurora.org To: "Vinod Koul" Cc: "Sinan Kaya" , "Andy Shevchenko" , "Dan Williams" , "dmaengine@vger.kernel.org" , timur@codeaurora.org, cov@codeaurora.org, jcm@redhat.com, "linux-kernel@vger.kernel.org" User-Agent: SquirrelMail/1.4.22-4.el6 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7BIT X-Priority: 3 (Normal) Importance: Normal Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1720 Lines: 48 >> >> I looked at this. IMO, merging selftest code and dmatest code is not >> a good idea. >> >> Dmatest code has been well written and structured so that multiple >> DMA capabilities (XOR, PQ, MEMCPY) can be tested with the same code. >> >> It supports threads and user space interaction. >> >> The code I want to change (dmatest_func) is 3 levels deep in >> structure. My refactored code looked really ugly compared to the >> original code. > > dmatest_func is still a bigger fn specific to dmatest. I was thinking that > we > should have rather have two common functions > 1) dmatest_do_dma() which does buffer allocation, invoking dmaengine APIs > and > checking results, part of dmatest_func today > > 2) request_channels() would also be common along with cleanup routines > Tried again, It still doesn't look right. Depending on the used API, the source and destination buffers are different. For instance, when you use dma_map_page, your source addresses are pages. If you use scatter_sg, you are working on the scatter-gather list. If you use dma_coherent, then the source cannot be a kmalloc API. Source comes from the DMA API. If you use dma_map_single, it is a kmalloc buffer. This is causing havoc in the compare APIs. IMO, in the goals of sharing code, we are making it unmanageable. I'm leaning towards dropping this patch altogether (which I'm not very happy about) or pushing it this way and have somebody do the reorganization in another iteration. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/