From patchwork Tue Mar 22 15:36:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory CLEMENT X-Patchwork-Id: 8643781 Return-Path: X-Original-To: patchwork-dmaengine@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8B865C0553 for ; Tue, 22 Mar 2016 15:36:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7703B2038A for ; Tue, 22 Mar 2016 15:36:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6CD33201FA for ; Tue, 22 Mar 2016 15:36:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751245AbcCVPgz (ORCPT ); Tue, 22 Mar 2016 11:36:55 -0400 Received: from down.free-electrons.com ([37.187.137.238]:35380 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750860AbcCVPgy (ORCPT ); Tue, 22 Mar 2016 11:36:54 -0400 Received: by mail.free-electrons.com (Postfix, from userid 110) id 1369D288; Tue, 22 Mar 2016 16:36:52 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from localhost (81-67-231-93.rev.numericable.fr [81.67.231.93]) by mail.free-electrons.com (Postfix) with ESMTPSA id D75248A; Tue, 22 Mar 2016 16:36:51 +0100 (CET) From: Gregory CLEMENT To: dmaengine@vger.kernel.org, Vinod Koul , Dan Williams Cc: Maxime Ripard , Thomas Petazzoni Subject: Adding a parameter to set a minimal length for dmatest Date: Tue, 22 Mar 2016 16:36:52 +0100 Message-ID: <87y49aplrf.fsf@free-electrons.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi, while using the dmatest module to test the mv_xor.c driver, I got failures. I finally found that when the "noverify" parameter is not set, then the buffer length used is totally random (modulo the maximum size of the buffer). But in the mv_xor_prep_dma_xor there is a test about the minimal size the dmaengine can use. So when the length was under this minimum size then I got some test failures like the following: "dmatest: dma1chan0-copy0: result #11: 'prep error' with src_off=0x29c9 dst_off=0x1c51 len=0x33 (0)". Unless the drivers are supposed to accept all buffer size I think it is not an error, and I would like to be able to use this dmatest for automatic test and not to have to check if the error is a real one or not. I think that the following patch could improve the dmatest module. What do you think about it? Did I miss something or is a good ieda to send a proper patch? Thanks! Gregory diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c index b8576fd6bd0e..81b8cd893621 100644 --- a/drivers/dma/dmatest.c +++ b/drivers/dma/dmatest.c @@ -74,6 +74,10 @@ static bool verbose; module_param(verbose, bool, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(verbose, "Enable \"success\" result messages (default: off)"); +static unsigned int min_size = 1; +module_param(min_size, uint, S_IRUGO | S_IWUSR); +MODULE_PARM_DESC(min_size, "Minimal size of the buffer (default: 1)"); + /** * struct dmatest_params - test parameters. * @buf_size: size of the memcpy test buffer @@ -97,6 +101,7 @@ struct dmatest_params { unsigned int pq_sources; int timeout; bool noverify; + unsigned int min_size; }; /** @@ -505,7 +510,8 @@ static int dmatest_func(void *data) if (params->noverify) len = params->buf_size; else - len = dmatest_random() % params->buf_size + 1; + len = dmatest_random() % (params->buf_size - params->min_size) + + params->min_size; len = (len >> align) << align; if (!len) @@ -864,6 +870,8 @@ static void run_threaded_test(struct dmatest_info *info) struct dmatest_params *params = &info->params; /* Copy test parameters */ + if (test_buf_size < min_size) + test_buf_size = min_size; params->buf_size = test_buf_size; strlcpy(params->channel, strim(test_channel), sizeof(params->channel)); strlcpy(params->device, strim(test_device), sizeof(params->device)); @@ -874,6 +882,7 @@ static void run_threaded_test(struct dmatest_info *info) params->pq_sources = pq_sources; params->timeout = timeout; params->noverify = noverify; + params->min_size = min_size; request_channels(info, DMA_MEMCPY); request_channels(info, DMA_XOR);