From patchwork Wed Sep 19 19:52:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seraj Alijan X-Patchwork-Id: 10606427 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C6C7A112B for ; Wed, 19 Sep 2018 19:53:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B5EB128708 for ; Wed, 19 Sep 2018 19:53:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A989928C72; Wed, 19 Sep 2018 19:53:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CA4AF28708 for ; Wed, 19 Sep 2018 19:53:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731869AbeITBcu (ORCPT ); Wed, 19 Sep 2018 21:32:50 -0400 Received: from mail-eopbgr00050.outbound.protection.outlook.com ([40.107.0.50]:13958 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726718AbeITBct (ORCPT ); Wed, 19 Sep 2018 21:32:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sondrel.onmicrosoft.com; s=selector1-sondrel-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=p4rBA6AtHMexC3wuF7VEk6E+VSvMgCC0W+CTXSLjexI=; b=BZMCt4HeBrnd5fcNAMo1IpHLLL/qXgnZxQcboBhcG7TjoUxDA/4Yf7UmEFlYLOctHtlxOc8QxY37KaKWyWhSumqdZkObgl+Zyv/2sjKAK23rhelEicdnpnUgIjlZJS5oI5cBjHZx8VYWttkop3lUPT4YF/FD0IZFiYcC1yqaMSE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=seraj.mohammed@sondrel.com; Received: from Seraj-pc.hh.imgtec.org (195.88.9.101) by DB6P191MB0245.EURP191.PROD.OUTLOOK.COM (2603:10a6:4:8e::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1143.15; Wed, 19 Sep 2018 19:53:19 +0000 From: Seraj Alijan To: vkoul@kernel.org Cc: dmaengine@vger.kernel.org, dan.j.williams@intel.com, james.hartley@sondrel.com, sifan.naeem@sondrel.com, ed.blake@sondrel.com, Seraj Alijan Subject: [PATCH V3 1/5] dmaengine: dmatest: Add support for multi channel testing Date: Wed, 19 Sep 2018 20:52:50 +0100 Message-Id: <1537386774-20749-2-git-send-email-seraj.alijan@sondrel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1537386774-20749-1-git-send-email-seraj.alijan@sondrel.com> References: <1537386774-20749-1-git-send-email-seraj.alijan@sondrel.com> MIME-Version: 1.0 X-Originating-IP: [195.88.9.101] X-ClientProxiedBy: CWLP265CA0040.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:11::28) To DB6P191MB0245.EURP191.PROD.OUTLOOK.COM (2603:10a6:4:8e::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 54ae4447-cac3-4644-05ef-08d61e698c8a X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:DB6P191MB0245; X-Micros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cDlK3Nded+CVvOeQO/Xnt7unAYuWNn4uZiXCpcfmC4MLuf34ci7FCLpWo+qsZjTHgdOEsI+zDIYhX6G1d548seWukqraDCgciAWivIA4Q6jYrE7QNrvOWkMK7FrGrAFnVvuxkTLnLIn9qu/QuXTiNAwAAjsRk0ZnoWxF46+UFZNKqmRZGPA5A1HBD/YciYRFgergjI7XVxY2ognP8r2+e0UYAnEfwgdH02jB+DFA0bwWQoaJXMxyVaSmUyvFlcz44XNN27O+Ak4l0G2J2FqMsiXXuSbKYWeIG2hj+psphhvFpSfHDux/aP0iUy2EdEfqNfID5tbyKerWgCbGHZcVgmDkL6kJ0z2qx8YhEEnklwHEFRf49RZ2cgkCZ;4:rOqH8b6L1CuinwyRb4Ajn+AV9Io3ikyz0dvKBZCfmXvCiUyLfwyOFmELL2VfICTDk5y55kbb78OVSDGvPxRqU6vsaAiDHh86N+hqGdcWJnRqiHxj6iOgI/G0KdP2Gb/ZvJcNIwIWPZU4PbOq1uT4fkUf7RF9N8vX4nPctCrVgVGHA0rI3PjYJubD65hFGXTtaTVYG1sgrGtB0jDF8FADJQSiJSCxGW5G3vkzIb7GTlSeMP2yMeYi6O93JOXkT8I1QpzBmwDzl5IK0/ukZEBj7Q== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3002001)(3231355)(944501410)(52105095)(10201501046)(149027)(150027)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123564045)(201708071742011)(7699051);SRVR:DB6P191MB0245;BCL:0;PCL:0;RULEID:;SRVR:DB6P191MB0245; X-Forefront-PRVS: 0800C0C167 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(39840400004)(366004)(396003)(136003)(376002)(346002)(189003)(199004)(316002)(16586007)(53936002)(25786009)(5660300001)(2351001)(76176011)(81166006)(50466002)(52116002)(51416003)(2906002)(36756003)(6916009)(6116002)(3846002)(14444005)(48376002)(8936002)(386003)(478600001)(81156014)(6506007)(66066001)(97736004)(486006)(107886003)(2361001)(105586002)(106356001)(6666003)(6486002)(7736002)(6512007)(4326008)(47776003)(50226002)(956004)(16526019)(11346002)(476003)(186003)(2616005)(26005)(44832011)(446003)(68736007)(305945005)(8676002)(16060500001);DIR:OUT;SFP:1101;SCL:1;SRVR:DB6P191MB0245;H:Seraj-pc.hh.imgtec.org;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; Received-SPF: None (protection.outlook.com: sondrel.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: 1;DB6P191MB0245;23:H6Vzh5gBZrxK9VjJdGDlzACDODoJNwFs58dGgif9GOZOHcfLRbLcxFqWXQb9r2e8toDANPy8cFIOlCJ9R4LgHDQI0dJuopt4JbW5axzecT7O4Ym65ru/rbUX+7zo6wQ57m5pBqyqKeD9B+2Bi+Vc/SKWYCuy3cxW2TLdJXa9JB+b54kh+hu8lEilI5c0hGxbX2oKs2DAt3XoyVxtZPhkE8pIKAOnverOE/GAhzvS6oQcRY45lRmMsEKyUrKAkTR47UsAbw3u1icLuU8mfm19Bd0EPiPguG7GZhIrmXvv0LkYZTC6z158s+wgj0ZsyRzrxlMhO9PKbuFO3nN2TINxSXhhpN9Y0q1LUUT0wi15VvQp7rlzBc94t44Z/DYm6Q0M/fvs4CIOT7JJ49gO2MTAygUBxdyBf9tLFQUoNsgeIvJ3iRbF6DLnIr7sp0q+wRpA9g6m19hmsucdWNZCwyYuni0rLGpDnBxdfQYRNfZhIN6871o+2OVNqKUG2gcUZ2J0rC1m+Lioewa6p5Cq/bgrfQ33CwJZ2N3fnzoilQiAMmHCd8rLec4IB063YDixq/yTtvYXlef98Ji6UiyVxVcTAaj2V6TBQgYSQQTkihi8zZbulxTrOr9KerSkWiXvuFDTT5lEQOsA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+HsRjR7zL/tkDTjtGec2udJIMvFiQbIskMNvCCTJVGFYFoWgAqNdLvUeLkrRkoeVjMhWmUWN+H1P0caNbjItuoyIjl3SsOUsp+4qxH+8MwSp5ul0PASe8i9xkzz0h1VHIRjBNDPFXaBvgdMy6VsrY2nvho/YFBP2aqrv0eXmW/K5Pq3S5s737B4iu2Lu0jw0bY9B8eEuTPsfrmQ8FGlJe9A3GZLW36SF6fvTCfn6txk4bNI3lXQ8vN/W48fb51O1B4hcqQhvSizy3/T4TKYxO8i5LcoyAwvpvZPKGh8pDvfmfIOQLyjqH8wz6/yewZAwEpFSpfcHnFDQrOJ6QGI7rKNbtXAH+mm0ntXw3ZXTQPJp85LfMHcgbf+ajXMdP3Hqf/+yeSLH8CjG9Y2lTdPaavzyfNq7zdR9C1zuy+eHgO/jCMHG1Nmi1A==;5:Qb24e2LcblAjSk27xO5xQuKDAgNFqCkXl2sPxAzE2YjldCTOt06xKGIDzSVuXXxqOxuNOR4amP7j6Za/ISQBmN3PaqAjD951Azl6JjqEqbOSM1giFzagjV/VycPAqDTMr/6fd7Oqm997byCGxs+w5hQS59rCmgPXVfDDkL+8jwY=;7:7j7xchy9TKJUaP0e0fSUiQeUzXiRdTEaA8EJRAmLFac7HySBDC0N8sUFyE6zIp0mskhIjZcYAgPQOPwFIzogEFoDjksZLdsRMEAbZTSr+FzZ3gwtTHCKlG4oK8l4ZQLEMYUZthOVQUaGMyY+fd5SVvBpbMxEKjA73++RPi5Lnjxc9mFMZI+Qkn8Cn9oHb+J4jixFWwrOVsowyL6rUvAnz6xy6Xgc09cIQMCv1H+/z9YeJ3+I4Of65DzwiKWzUQ15 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: sondrel.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Sep 2018 19:53:19.5386 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 54ae4447-cac3-4644-05ef-08d61e698c8a X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4faa3872-698e-4896-80ec-148b916cb1ba X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6P191MB0245 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add support for running tests on multiple channels simultaneously as the driver currently limits to 1 channel per test run. This will add support for stress testing DMA controllers with multi channel capabilities. This is done by adding a callback function to the "channel" parameter that registers the requested channel prior to the "run" parameter being set to 1. Each time the "channel" parameter is populated with a new dma channel, a new test is appended to the thread queue. Once the "run" parameter is set to 1, the test will kick start all pending threads. Signed-off-by: Seraj Alijan --- drivers/dma/dmatest.c | 196 +++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 177 insertions(+), 19 deletions(-) diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c index aa1712b..ea69033 100644 --- a/drivers/dma/dmatest.c +++ b/drivers/dma/dmatest.c @@ -27,11 +27,6 @@ static unsigned int test_buf_size = 16384; module_param(test_buf_size, uint, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(test_buf_size, "Size of the memcpy test buffer"); -static char test_channel[20]; -module_param_string(channel, test_channel, sizeof(test_channel), - S_IRUGO | S_IWUSR); -MODULE_PARM_DESC(channel, "Bus ID of the channel to test (default: any)"); - static char test_device[32]; module_param_string(device, test_device, sizeof(test_device), S_IRUGO | S_IWUSR); @@ -139,6 +134,28 @@ static bool dmatest_run; module_param_cb(run, &run_ops, &dmatest_run, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(run, "Run the test (default: false)"); +static int dmatest_chan_set(const char *val, const struct kernel_param *kp); +static int dmatest_chan_get(char *val, const struct kernel_param *kp); +static const struct kernel_param_ops multi_chan_ops = { + .set = dmatest_chan_set, + .get = dmatest_chan_get, +}; + +static char test_channel[20]; +static struct kparam_string newchan_kps = { + .string = test_channel, + .maxlen = 20, +}; +module_param_cb(channel, &multi_chan_ops, &newchan_kps, 0644); +MODULE_PARM_DESC(channel, "Bus ID of the channel to test (default: any)"); + +static int dmatest_test_list_get(char *val, const struct kernel_param *kp); +static const struct kernel_param_ops test_list_ops = { + .get = dmatest_test_list_get, +}; +module_param_cb(test_list, &test_list_ops, NULL, 0444); +MODULE_PARM_DESC(test_list, "Print current test list"); + /* Maximum amount of mismatched bytes in buffer to print */ #define MAX_ERROR_COUNT 32 @@ -179,6 +196,7 @@ struct dmatest_thread { wait_queue_head_t done_wait; struct dmatest_done test_done; bool done; + bool pending; }; struct dmatest_chan { @@ -206,6 +224,22 @@ static bool is_threaded_test_run(struct dmatest_info *info) return false; } +static bool is_threaded_test_pending(struct dmatest_info *info) +{ + struct dmatest_chan *dtc; + + list_for_each_entry(dtc, &info->channels, node) { + struct dmatest_thread *thread; + + list_for_each_entry(thread, &dtc->threads, node) { + if (thread->pending) + return true; + } + } + + return false; +} + static int dmatest_wait_get(char *val, const struct kernel_param *kp) { struct dmatest_info *info = &test_info; @@ -476,6 +510,7 @@ static int dmatest_func(void *data) ret = -ENOMEM; smp_rmb(); + thread->pending = false; info = thread->info; params = &info->params; chan = thread->chan; @@ -886,7 +921,7 @@ static int dmatest_add_threads(struct dmatest_info *info, /* srcbuf and dstbuf are allocated by the thread itself */ get_task_struct(thread->task); list_add_tail(&thread->node, &dtc->threads); - wake_up_process(thread->task); + thread->pending = true; } return i; @@ -932,7 +967,7 @@ static int dmatest_add_channel(struct dmatest_info *info, thread_count += cnt > 0 ? cnt : 0; } - pr_info("Started %u threads using %s\n", + pr_info("Added %u threads using %s\n", thread_count, dma_chan_name(chan)); list_add_tail(&dtc->node, &info->channels); @@ -977,7 +1012,7 @@ static void request_channels(struct dmatest_info *info, } } -static void run_threaded_test(struct dmatest_info *info) +static void add_threaded_test(struct dmatest_info *info) { struct dmatest_params *params = &info->params; @@ -1000,6 +1035,24 @@ static void run_threaded_test(struct dmatest_info *info) request_channels(info, DMA_PQ); } +static void run_pending_tests(struct dmatest_info *info) +{ + struct dmatest_chan *dtc; + unsigned int thread_count = 0; + + list_for_each_entry(dtc, &info->channels, node) { + struct dmatest_thread *thread; + + thread_count = 0; + list_for_each_entry(thread, &dtc->threads, node) { + wake_up_process(thread->task); + thread_count++; + } + pr_info("Started %u threads using %s\n", + thread_count, dma_chan_name(dtc->chan)); + } +} + static void stop_threaded_test(struct dmatest_info *info) { struct dmatest_chan *dtc, *_dtc; @@ -1016,7 +1069,7 @@ static void stop_threaded_test(struct dmatest_info *info) info->nr_channels = 0; } -static void restart_threaded_test(struct dmatest_info *info, bool run) +static void start_threaded_tests(struct dmatest_info *info) { /* we might be called early to set run=, defer running until all * parameters have been evaluated @@ -1024,11 +1077,7 @@ static void restart_threaded_test(struct dmatest_info *info, bool run) if (!info->did_init) return; - /* Stop any running test first */ - stop_threaded_test(info); - - /* Run test with new parameters */ - run_threaded_test(info); + run_pending_tests(info); } static int dmatest_run_get(char *val, const struct kernel_param *kp) @@ -1039,7 +1088,8 @@ static int dmatest_run_get(char *val, const struct kernel_param *kp) if (is_threaded_test_run(info)) { dmatest_run = true; } else { - stop_threaded_test(info); + if (!is_threaded_test_pending(info)) + stop_threaded_test(info); dmatest_run = false; } mutex_unlock(&info->lock); @@ -1057,18 +1107,125 @@ static int dmatest_run_set(const char *val, const struct kernel_param *kp) if (ret) { mutex_unlock(&info->lock); return ret; + } else if (dmatest_run) { + if (is_threaded_test_pending(info)) + start_threaded_tests(info); + else + pr_info("Could not start test, no channels configured\n"); + } else { + stop_threaded_test(info); + } + + mutex_unlock(&info->lock); + + return ret; +} + +static int dmatest_chan_set(const char *val, const struct kernel_param *kp) +{ + struct dmatest_info *info = &test_info; + struct dmatest_chan *dtc; + char chan_reset_val[20]; + int ret = 0; + + mutex_lock(&info->lock); + ret = param_set_copystring(val, kp); + if (ret) { + mutex_unlock(&info->lock); + return ret; + } + /*Clear any previously run threads */ + if (!is_threaded_test_run(info) && !is_threaded_test_pending(info)) + stop_threaded_test(info); + /* Reject channels that are already registered */ + if (is_threaded_test_pending(info)) { + list_for_each_entry(dtc, &info->channels, node) { + if (strcmp(dma_chan_name(dtc->chan), + strim(test_channel)) == 0) { + dtc = list_last_entry(&info->channels, + struct dmatest_chan, + node); + strlcpy(chan_reset_val, + dma_chan_name(dtc->chan), + sizeof(chan_reset_val)); + ret = -EBUSY; + goto add_chan_err; + } + } } - if (is_threaded_test_run(info)) + add_threaded_test(info); + + /* Check if channel was added successfully */ + dtc = list_last_entry(&info->channels, struct dmatest_chan, node); + + if (dtc->chan) { + /* + * if new channel was not successfully added, revert the the + * "test_channel" string to the name of the last successfully + * added channel. exception for when users issues empty string + * to channel parameter. + */ + if ((strcmp(dma_chan_name(dtc->chan), strim(test_channel)) != 0) + && (strcmp("", strim(test_channel)) != 0)) { + ret = -EINVAL; + strlcpy(chan_reset_val, dma_chan_name(dtc->chan), + sizeof(chan_reset_val)); + goto add_chan_err; + } + + } else { + /* Clear test_channel if no channels were added successfully */ + strlcpy(chan_reset_val, "", sizeof(chan_reset_val)); ret = -EBUSY; - else if (dmatest_run) - restart_threaded_test(info, dmatest_run); + goto add_chan_err; + } + + mutex_unlock(&info->lock); + + return ret; +add_chan_err: + param_set_copystring(chan_reset_val, kp); mutex_unlock(&info->lock); return ret; } +static int dmatest_chan_get(char *val, const struct kernel_param *kp) +{ + struct dmatest_info *info = &test_info; + + mutex_lock(&info->lock); + if (!is_threaded_test_run(info) && !is_threaded_test_pending(info)) { + stop_threaded_test(info); + strlcpy(test_channel, "", sizeof(test_channel)); + } + mutex_unlock(&info->lock); + + return param_get_string(val, kp); +} + +static int dmatest_test_list_get(char *val, const struct kernel_param *kp) +{ + struct dmatest_info *info = &test_info; + struct dmatest_chan *dtc; + unsigned int thread_count = 0; + + list_for_each_entry(dtc, &info->channels, node) { + struct dmatest_thread *thread; + + thread_count = 0; + list_for_each_entry(thread, &dtc->threads, node) { + thread_count++; + } + pr_info("%u threads using %s\n", + thread_count, dma_chan_name(dtc->chan)); + } + + return 0; +} + static int __init dmatest_init(void) { struct dmatest_info *info = &test_info; @@ -1076,7 +1233,8 @@ static int __init dmatest_init(void) if (dmatest_run) { mutex_lock(&info->lock); - run_threaded_test(info); + add_threaded_test(info); + run_pending_tests(info); mutex_unlock(&info->lock); } From patchwork Wed Sep 19 19:52:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seraj Alijan X-Patchwork-Id: 10606429 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B35AC15A6 for ; Wed, 19 Sep 2018 19:53:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A2F0C2B8D5 for ; Wed, 19 Sep 2018 19:53:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 96C5C2BA2A; Wed, 19 Sep 2018 19:53:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D2B62B8D5 for ; Wed, 19 Sep 2018 19:53:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731914AbeITBc5 (ORCPT ); Wed, 19 Sep 2018 21:32:57 -0400 Received: from mail-eopbgr00060.outbound.protection.outlook.com ([40.107.0.60]:27849 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726718AbeITBc5 (ORCPT ); Wed, 19 Sep 2018 21:32:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sondrel.onmicrosoft.com; s=selector1-sondrel-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=f+bp77MumYvrTQ9byzeUmydiHMcraI2bZ4uVGYg7zJI=; b=c1fbUj5vU+qOEfw48bTJS/GFk00BpQfMpp2FG9rCq2sI3hqFcozPjqVaUYNh6QdMpEfEBY85Vky1GJWDeO6qrZyzsIotUdQKVe4sE16sW33CC5QAPqRlF0+HUzL8fZhZxWJbRm/g+DGxQPAEKQ7oy28bgqq7v1Uhw1gQY6LVDkI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=seraj.mohammed@sondrel.com; Received: from Seraj-pc.hh.imgtec.org (195.88.9.101) by DB6P191MB0245.EURP191.PROD.OUTLOOK.COM (2603:10a6:4:8e::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1143.15; Wed, 19 Sep 2018 19:53:22 +0000 From: Seraj Alijan To: vkoul@kernel.org Cc: dmaengine@vger.kernel.org, dan.j.williams@intel.com, james.hartley@sondrel.com, sifan.naeem@sondrel.com, ed.blake@sondrel.com, Seraj Alijan Subject: [PATCH V3 2/5] dmaengine: dmatest: Use fixed point div to calculate iops Date: Wed, 19 Sep 2018 20:52:51 +0100 Message-Id: <1537386774-20749-3-git-send-email-seraj.alijan@sondrel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1537386774-20749-1-git-send-email-seraj.alijan@sondrel.com> References: <1537386774-20749-1-git-send-email-seraj.alijan@sondrel.com> MIME-Version: 1.0 X-Originating-IP: [195.88.9.101] X-ClientProxiedBy: CWLP265CA0040.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:11::28) To DB6P191MB0245.EURP191.PROD.OUTLOOK.COM (2603:10a6:4:8e::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8ea4fc69-eabd-4880-4769-08d61e698e84 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:DB6P191MB0245; X-Microsoft-Exchange-Diagnostics: 1;DB6P191MB0245;3:OBOR7OvXccJ+PnTn6Mz0tRVyXGjRpNOCPLMBGHuSb4YISzgrCQRhzFqgSJUS/DLjMlK3Ey+AZxrr8k/Y0FQXFeEjVT+pM3Hyk6Re2qeksXqtFdkBJUliCZrkBsgCpMG4UeGqhKTKTNFXs6hNKOS1JWHEjhP+NgOnkb4HoeRQR3bvA6lhLgRXg6NjYiX2pXZ3W1yCYX+FnoZ+PXzMwfXewM489Hd+bF3kj/93IrxnvAw8aDJqS118cg7wIYbKkBdS;25:g6VFF2pWFTTu1yGQgD/wnawbIamymwQ8x1EBy040wcSErTee9caXreEUIamZESFucSE9BzUOCSHnnpnxtcEjvNyKFba54/X88AeFGBcaJY5TCk3r48zvgRcYBSuaIifbiK1boBneeQQ/0ViiupwsFlovR7MzRNMwLgN2QW+HBV8+WYYieyODCRz5CWrD0SPp3EBFLigAU+Uqyn2VmvBAFkzdJSUPGNiNiqYNWrgzfUAOIdQaeTsyoFqcP2janHyhKFJpaW1Mu+23mwZYTaYbsjuvthSm/t1Tbei+6CGfl+PkINcp1L0JKfkZscbTkkcS2Tbys0KE0mS96dL1eQD70w==;31:pBSPnMc7px6+WY49EYNMuHDmYUPwiBUCgVdjpbAyOFfpIK42uj/Y87Td0m7wNTJ6E6wwrD1cSZaV0EyGOBezQKKTVYbdPo/R6T9fXURWqBRgMxEDHAWg1a+M1qHH7VDMtiYLnDjPUsaJ1p8kiyrKZruHGFFvMAA5ArVj5IZB6nY5HCsHTpDOFX8fXuqMRAygIFRdrC3tDQyOLPwN8z07q5j/CFnVylwKXLmFKlDXGw0= X-MS-TrafficTypeDiagnostic: DB6P191MB0245: X-Microsoft-Exchange-Diagnostics: 1;DB6P191MB0245;20:SWVMlQuJWrCtlh7opVfRAWlmQsYd5+8J4jnZyTZ9i3UvlR8gGqqD49Q7w1c6AoDbQxMXBSAT0L4jRzx4dOgaobM9fsvq4oOry9zfIypaOgRSmRTFHRODWkYyp+SyUn/MvVbupG/T66qR6CCkxoWxEffts7YPJR1pn677EUVanPIIX13693+mN+DT1rdQHDOKZi+spWc2BAxJpHHgw55jWTdc5X1ykdmQlFaSb0VKZWt1ChCbYtiGxqycjZ6JCWA5Fi5f+Hd0dla7uYOpDCgXi3NBM42caw6hW2Jt4j7ZJqqj10I2mQibDXSnhGUboNfciFoM4x0SjfsvDOm7adJp+Z4o4BOFC7Q/5rpShkWuEARoSBGJpVpxwjvw+cNnH2YyLGOE8SwIQKSespatA2rqDDppmJzZoDt7aBVeags/7tCAyxhTJ1Dp9uAFazgeHTUIYJRZ+ylCmH6XVI7ZQIYZ7wamoEsRwsP1ajasFp5CZYO6tQwjSy8uBLLKAqpVm9yd;4:Nm7bmuyZMU/gXggeZbby6wWk/myHlO/E9rmFln1+G1/6yQKpogZLZ3fjOWQqHaAIGHG0hyiyifUgbgbL+2LqStnKn2ocXajwHtkxOUsk30+U9WDyqrSVTvLxTaDTN1I22elQnaXRVRJgsNKENeAVgLk+8rDqi5akZoxynPNSE7wQiLa6gavrjcP6XFS3i7zQ9YazSKBBN4A0DYMb+IqZ5hjJP1XkcHeAv+1/4nE4oYSS0dk8BeERwqyb45WxymN09Cv3tvpMe2tml00Zf9S7IKhkEjHVsR2m0lrPd6yXeKLlSNtPe53aOXp87oQzKa+V X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(211171220733660); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3002001)(3231355)(944501410)(52105095)(10201501046)(149027)(150027)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123564045)(201708071742011)(7699051);SRVR:DB6P191MB0245;BCL:0;PCL:0;RULEID:;SRVR:DB6P191MB0245; X-Forefront-PRVS: 0800C0C167 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(39840400004)(366004)(396003)(136003)(376002)(346002)(189003)(199004)(316002)(16586007)(53936002)(25786009)(5660300001)(2351001)(76176011)(81166006)(50466002)(52116002)(51416003)(2906002)(36756003)(6916009)(6116002)(3846002)(14444005)(575784001)(48376002)(8936002)(386003)(478600001)(81156014)(6506007)(66066001)(97736004)(486006)(107886003)(2361001)(105586002)(106356001)(6666003)(6486002)(7736002)(6512007)(4326008)(47776003)(50226002)(956004)(16526019)(11346002)(476003)(186003)(2616005)(26005)(44832011)(446003)(68736007)(305945005)(8676002)(16060500001);DIR:OUT;SFP:1101;SCL:1;SRVR:DB6P191MB0245;H:Seraj-pc.hh.imgtec.org;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; Received-SPF: None (protection.outlook.com: sondrel.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: 1;DB6P191MB0245;23:029UXt9MYKxSdwEKN1EcpT1Ar5m5HuKXNiNgZ4a5Pd90MybWa2yBGe3lW/uln2meU9XQlLLSWzNe2sYQ/mjW/8O/r3I/2OJ7FPq+3ffo5Yn0mH0FfzvrzMhyIXYEZT4VnEe4y06e8YJXVKE9qLwE87OY88i3yZJnkNGdgzmki8U3Y7hiQHR9vKCYd3+YKr6GJ2pFDIsk29QHvm/HfcZcKnpC79a+XUFP2Rs0Z4BTWsB2oSUuGcFvAq94s5urT5cv1l5RxWMwpi0G2AdRj1NH7BvFIr9/Tv+y9D+Y98OyMlbip/ln+uh8e/A03NDNMA3lUVqTqDYX+GqW+dxH5cWoF65KyIL0CdLm3vVkC1W4CfqdhDGVuJf8vLUujfYD6qSK6CZiZ44Bx4nT/HACX/IupM+j5ym1vrWtMD5wyiKvs84XIb4SFig6+9+JV66vUV8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wIcUTGSdJM4413kbmXxiX SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: sondrel.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Sep 2018 19:53:22.8574 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8ea4fc69-eabd-4880-4769-08d61e698e84 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4faa3872-698e-4896-80ec-148b916cb1ba X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6P191MB0245 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use fixed point division to calculate iops to prevent reporting 0 iops when operations last for longer than a second. Signed-off-by: Seraj Alijan --- drivers/dma/dmatest.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c index ea69033..22f0e4eb 100644 --- a/drivers/dma/dmatest.c +++ b/drivers/dma/dmatest.c @@ -177,6 +177,13 @@ MODULE_PARM_DESC(test_list, "Print current test list"); #define PATTERN_COUNT_MASK 0x1f #define PATTERN_MEMSET_IDX 0x01 +/* Fixed point arithmetic ops */ +#define FIXPT_SHIFT 8 +#define FIXPNT_MASK 0xFF +#define FIXPT_TO_INT(a) ((a) >> FIXPT_SHIFT) +#define INT_TO_FIXPT(a) ((a) << FIXPT_SHIFT) +#define FIXPT_GET_FRAC(a) ((((a) & FIXPNT_MASK) * 100) >> FIXPT_SHIFT) + /* poor man's completion - we want to use wait_event_freezable() on it */ struct dmatest_done { bool done; @@ -453,13 +460,15 @@ static unsigned long long dmatest_persec(s64 runtime, unsigned int val) } per_sec *= val; + per_sec = INT_TO_FIXPT(per_sec); do_div(per_sec, runtime); + return per_sec; } static unsigned long long dmatest_KBs(s64 runtime, unsigned long long len) { - return dmatest_persec(runtime, len >> 10); + return FIXPT_TO_INT(dmatest_persec(runtime, len >> 10)); } /* @@ -500,6 +509,7 @@ static int dmatest_func(void *data) ktime_t comparetime = 0; s64 runtime = 0; unsigned long long total_len = 0; + unsigned long long iops = 0; u8 align = 0; bool is_memset = false; dma_addr_t *srcs; @@ -840,9 +850,10 @@ static int dmatest_func(void *data) err_srcs: kfree(pq_coefs); err_thread_type: - pr_info("%s: summary %u tests, %u failures %llu iops %llu KB/s (%d)\n", + iops = dmatest_persec(runtime, total_tests); + pr_info("%s: summary %u tests, %u failures %llu.%02llu iops %llu KB/s (%d)\n", current->comm, total_tests, failed_tests, - dmatest_persec(runtime, total_tests), + FIXPT_TO_INT(iops), FIXPT_GET_FRAC(iops), dmatest_KBs(runtime, total_len), ret); /* terminate all transfers on specified channels */ From patchwork Wed Sep 19 19:52:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seraj Alijan X-Patchwork-Id: 10606431 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 489A5112B for ; Wed, 19 Sep 2018 19:53:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 392862B8D5 for ; Wed, 19 Sep 2018 19:53:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2D3FF2BA2A; Wed, 19 Sep 2018 19:53:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B11122B8D5 for ; Wed, 19 Sep 2018 19:53:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731950AbeITBc6 (ORCPT ); Wed, 19 Sep 2018 21:32:58 -0400 Received: from mail-eopbgr00060.outbound.protection.outlook.com ([40.107.0.60]:27849 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731253AbeITBc6 (ORCPT ); Wed, 19 Sep 2018 21:32:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sondrel.onmicrosoft.com; s=selector1-sondrel-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eEUSKccSL9lFY2/dYaT+1doFkhZYKZvzqzfw6bBbuc4=; b=CYveiufnqB1047pLSc3gCqWkqBHff0UrjtW8P5Y2A3zsLHBB4rVmKTKXezg8jQFe4lJoHspO6li1VdfA25tBj/GbQAw0R5wE/ygavONneotjpdEqA/vx8CWNuE2ReA3xGlQnBXIzaIqeTeIURGMNVTtWA4aAU/RzXJgtNxuoITY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=seraj.mohammed@sondrel.com; Received: from Seraj-pc.hh.imgtec.org (195.88.9.101) by DB6P191MB0245.EURP191.PROD.OUTLOOK.COM (2603:10a6:4:8e::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1143.15; Wed, 19 Sep 2018 19:53:24 +0000 From: Seraj Alijan To: vkoul@kernel.org Cc: dmaengine@vger.kernel.org, dan.j.williams@intel.com, james.hartley@sondrel.com, sifan.naeem@sondrel.com, ed.blake@sondrel.com, Seraj Alijan Subject: [PATCH V3 3/5] dmaengine: dmatest: Add alignment parameter Date: Wed, 19 Sep 2018 20:52:52 +0100 Message-Id: <1537386774-20749-4-git-send-email-seraj.alijan@sondrel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1537386774-20749-1-git-send-email-seraj.alijan@sondrel.com> References: <1537386774-20749-1-git-send-email-seraj.alijan@sondrel.com> MIME-Version: 1.0 X-Originating-IP: [195.88.9.101] X-ClientProxiedBy: CWLP265CA0040.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:11::28) To DB6P191MB0245.EURP191.PROD.OUTLOOK.COM (2603:10a6:4:8e::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 463a43dc-9682-410b-b7e6-08d61e698fc9 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:DB6P191MB0245; X-Microsoft-Exchange-Diagnostics: 1;DB6P191MB0245;3:m/yYJgAhyz/sYPpiY+VuY+wwFHT3pdMoslMOW5TOVXtC5ocyxLA42G2qwnw0HzT0nbPBPY0J1wb14PQlwT0LwicYMK+FzGwDnbMijqPebluKLKDLKE6KUpIQat6swnSLRLs4A4ej6lF7ort+wupIcqflEcjqlX6vapYAsrnHsZRhSXrxOJ33xnEHIrwfFcQupE2RQitNW3Ztm5evK8WostvBBlmG4C9nVA2hR00mC7TH5wpEder0FQbwfBbne8v2;25:wlqwL2P8Kw7JImdde7lxu/FwC8fEzn8vzcqtiOwNEDfy4oz4BJJYpNyGctJHmZZg9MKEpiuckPUmXMRPZC6d+2/KpHuB3d3TlK0KO71vqNsWcf5RVbPG4lc7jSjZDv739V3gHvr6jhN7TQqSwkPpkfzeOtIiD/WBGCQzmL+lvgjaJ1Ong5Rm8/0ia8Ay9Ka89GSkK51n/E5bPJfAsbge4MIxXtc2gWWcd06KpUPVzMwXOFSb6aflORqSl0knUBeXjXdP91eogc9kmRC+DDidpzW0VrGDmZ21H/dYFMvzzY3tBr/YutSZpMlp0mXwgBO55l4dj3ECcDbelyAVH7q06Q==;31:xNyK4plI/Fk4zF3t4j8/F1//QmAB8u3+G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Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3002001)(3231355)(944501410)(52105095)(10201501046)(149027)(150027)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123564045)(201708071742011)(7699051);SRVR:DB6P191MB0245;BCL:0;PCL:0;RULEID:;SRVR:DB6P191MB0245; X-Forefront-PRVS: 0800C0C167 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(39840400004)(366004)(396003)(136003)(376002)(346002)(189003)(199004)(316002)(16586007)(53936002)(25786009)(5660300001)(2351001)(76176011)(81166006)(50466002)(52116002)(51416003)(2906002)(36756003)(6916009)(6116002)(3846002)(14444005)(575784001)(48376002)(8936002)(386003)(478600001)(81156014)(6506007)(66066001)(97736004)(486006)(107886003)(2361001)(105586002)(106356001)(6666003)(6486002)(7736002)(6512007)(4326008)(47776003)(50226002)(956004)(16526019)(11346002)(476003)(186003)(2616005)(26005)(44832011)(446003)(68736007)(305945005)(8676002)(16060500001);DIR:OUT;SFP:1101;SCL:1;SRVR:DB6P191MB0245;H:Seraj-pc.hh.imgtec.org;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; Received-SPF: None (protection.outlook.com: sondrel.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: 1;DB6P191MB0245;23:go4wkShxkbi12JcuiVw7uG9G8Y1kjYsNGtTNYv+CiHe9GoaheZQPAcWBq8dAxGH2XGMn2arZVk9pN3iaoRl7NRERoYUAcsx5VCdd5uQdUOVGS//YBNmXohD72lXxZeT0EtQS5g2DWQxCmc+oE0g8MnKhY+JYhYVxI0KJ8OHRfvFuNQXEVZ7725elEFbtEizNUBwtrPoSPnIHTnjIoYxSwgjRhpi1+IZqpKOjwWXR5wr6b8kHnghHXwahWOepBOo3vlA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xp5JjT3xOEDlcunQvGiJ8DeflXZyWDpFpn18vVUEDOcNYuqWn4JM+Y7cEI3NwotO2v7h6eDCgVWDUnahDjKaGCUIaaEfCZxEmicyRnWhUO6M/oC69jK8KBagABizXA08cbGRGvnXgG369/emyk2L3geqO4Z6fxBFd2Wr09xex173StmsKJy2LhG9mCRygyDVmajrTm8DoGTgHmiKiv2PwDLAXaGc9eJy/tJ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: sondrel.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Sep 2018 19:53:24.9862 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 463a43dc-9682-410b-b7e6-08d61e698fc9 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4faa3872-698e-4896-80ec-148b916cb1ba X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6P191MB0245 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add parameter "alignment" to allow setting the address alignment manually. Having the ability to configure address alignment from user space adds new testing capabilities where different alignments can be configured for testing without having to modify the dma device alignment properties. If configured, the alignment value will override the device alignment property of the target device. Signed-off-by: Seraj Alijan --- drivers/dma/dmatest.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c index 22f0e4eb..300fe4c 100644 --- a/drivers/dma/dmatest.c +++ b/drivers/dma/dmatest.c @@ -79,6 +79,10 @@ static bool verbose; module_param(verbose, bool, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(verbose, "Enable \"success\" result messages (default: off)"); +static int alignment = -1; +module_param(alignment, int, 0644); +MODULE_PARM_DESC(alignment, "Custom data address alignment taken as 2^(alignment) (default: not used (-1))"); + /** * struct dmatest_params - test parameters. * @buf_size: size of the memcpy test buffer @@ -103,6 +107,7 @@ struct dmatest_params { int timeout; bool noverify; bool norandom; + int alignment; }; /** @@ -526,22 +531,26 @@ static int dmatest_func(void *data) chan = thread->chan; dev = chan->device; if (thread->type == DMA_MEMCPY) { - align = dev->copy_align; + align = params->alignment < 0 ? dev->copy_align : + params->alignment; src_cnt = dst_cnt = 1; } else if (thread->type == DMA_MEMSET) { - align = dev->fill_align; + align = params->alignment < 0 ? dev->fill_align : + params->alignment; src_cnt = dst_cnt = 1; is_memset = true; } else if (thread->type == DMA_XOR) { /* force odd to ensure dst = src */ src_cnt = min_odd(params->xor_sources | 1, dev->max_xor); dst_cnt = 1; - align = dev->xor_align; + align = params->alignment < 0 ? dev->xor_align : + params->alignment; } else if (thread->type == DMA_PQ) { /* force odd to ensure dst = src */ src_cnt = min_odd(params->pq_sources | 1, dma_maxpq(dev, 0)); dst_cnt = 2; - align = dev->pq_align; + align = params->alignment < 0 ? dev->pq_align : + params->alignment; pq_coefs = kmalloc(params->pq_sources + 1, GFP_KERNEL); if (!pq_coefs) @@ -1039,6 +1048,7 @@ static void add_threaded_test(struct dmatest_info *info) params->timeout = timeout; params->noverify = noverify; params->norandom = norandom; + params->alignment = alignment; request_channels(info, DMA_MEMCPY); request_channels(info, DMA_MEMSET); From patchwork Wed Sep 19 19:52:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seraj Alijan X-Patchwork-Id: 10606433 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3F428112B for ; Wed, 19 Sep 2018 19:53:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 301CA2BA2A for ; Wed, 19 Sep 2018 19:53:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 240852BAA1; Wed, 19 Sep 2018 19:53:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A75CD2BA2A for ; Wed, 19 Sep 2018 19:53:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731253AbeITBdC (ORCPT ); Wed, 19 Sep 2018 21:33:02 -0400 Received: from mail-eopbgr00060.outbound.protection.outlook.com ([40.107.0.60]:27849 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731823AbeITBdC (ORCPT ); Wed, 19 Sep 2018 21:33:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sondrel.onmicrosoft.com; s=selector1-sondrel-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=R5XWRhLIH8haF2s6q1xacM0IwPKpDKMGkHofhx/hxD8=; b=MSREiKulNSjVLzuT3s6OER+Lg/nBDCJbQC4sXkVvVHJERFP7cRP3KwlMponsdLtarneSlc3hYJRO0KCRoRuZrP4z49bmsm1OPkBAvNP8XYzjIeB2lXuf8W65/pWeN/raZCE9hGlCkTa4v9ZHCj0sMLZdndgz4DgLa1EY/SICmiI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=seraj.mohammed@sondrel.com; Received: from Seraj-pc.hh.imgtec.org (195.88.9.101) by DB6P191MB0245.EURP191.PROD.OUTLOOK.COM (2603:10a6:4:8e::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1143.15; Wed, 19 Sep 2018 19:53:27 +0000 From: Seraj Alijan To: vkoul@kernel.org Cc: dmaengine@vger.kernel.org, dan.j.williams@intel.com, james.hartley@sondrel.com, sifan.naeem@sondrel.com, ed.blake@sondrel.com, Seraj Alijan Subject: [PATCH V3 4/5] dmaengine: dmatest: Add transfer_size parameter Date: Wed, 19 Sep 2018 20:52:53 +0100 Message-Id: <1537386774-20749-5-git-send-email-seraj.alijan@sondrel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1537386774-20749-1-git-send-email-seraj.alijan@sondrel.com> References: <1537386774-20749-1-git-send-email-seraj.alijan@sondrel.com> MIME-Version: 1.0 X-Originating-IP: [195.88.9.101] X-ClientProxiedBy: CWLP265CA0040.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:11::28) To DB6P191MB0245.EURP191.PROD.OUTLOOK.COM (2603:10a6:4:8e::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6b87d54f-51cd-4a6c-b5bb-08d61e699117 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:DB6P191MB0245; X-Microsoft-Exchange-Diagnostics: 1;DB6P191MB0245;3:BtJigctCxKntRE7EyyjYUHLl1bS0ojqoCfDYnu/dp5dkntlGvdtj1bzeIgcb0U1TdXrrEP2KHOHp7diL/2yp84IlSxpYwntuqfPIWuYkNwsSF7vKjPxJjqr9V6wBTMZu7soQkz3GMk4HMRZyBiCBXxtNuS2uE1Ni1cd8puSvvpSW7t6QkPdHi8hUekNTJ9U5PVTsUAaynnCkurO3ZtXhcCaky51ZRi0Yfy8q21TE6W3PO7ImUfnS87Geq3VmaYBv;25:k2YctQfI3+qyOfUSbvWNmkGtIIUoBtGytp2Gs/5VrvuJVWLZhl+iDS5r5afNkxM75bXt/qgK2kkutodglukZyQTSnUn2Nx/Pd0niM57u10hABk0xe7B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PA0oH7fkVa1+8bIEQDiAkci3JOOFoauSwgueAAoA8Z0KlqPIU2rI4ecv4glS5LC3FQ5xcKaaj5vvs463Zkdu+iF4s5hOPvbvF47qXwaL2ME6uATq17PnGkDg2aQ2mDYXKx2WnDnNfvbrlamHA2xrLAdee4Ujx+31zmTF/2hGOFtwIYIIIUE/EHqDTc3uPfjLbWfShq6NzUrHZODljmvt4abhgr6x/neENERkUn+qb07VPUB4I2hx6eHLbkT9pDRtQIXQ/SmQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3002001)(3231355)(944501410)(52105095)(10201501046)(149027)(150027)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123564045)(201708071742011)(7699051);SRVR:DB6P191MB0245;BCL:0;PCL:0;RULEID:;SRVR:DB6P191MB0245; X-Forefront-PRVS: 0800C0C167 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(39840400004)(366004)(396003)(136003)(376002)(346002)(189003)(199004)(316002)(16586007)(53936002)(25786009)(5660300001)(2351001)(76176011)(81166006)(50466002)(52116002)(51416003)(2906002)(36756003)(6916009)(6116002)(3846002)(14444005)(48376002)(8936002)(386003)(478600001)(81156014)(6506007)(66066001)(97736004)(486006)(107886003)(2361001)(105586002)(106356001)(6666003)(6486002)(7736002)(6512007)(4326008)(47776003)(50226002)(956004)(16526019)(11346002)(476003)(186003)(2616005)(26005)(44832011)(446003)(68736007)(305945005)(8676002)(16060500001);DIR:OUT;SFP:1101;SCL:1;SRVR:DB6P191MB0245;H:Seraj-pc.hh.imgtec.org;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; Received-SPF: None (protection.outlook.com: sondrel.com does not designate permitted sender hosts) X-Microsoft-Exchange-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fuYHaTikb8W3gWD6eBX+pB1x9WMS5RE+w==;5:F0UyA1LGxLf9kGrO/adwk2hcUWSKPMGT/ToA4QGadMf0+SmC0WH/Ay030crVrXyz20dR7FiUhCQdrx3bRTxGqEBm7cHIJLD6Giloe2IokOh0dfKQ6RHmvQp6TPgl8pfCT7vxfsgjYymQ5h3GTKrO7zOoxHdGpVAUQe/mqIB6zDo=;7:nkIigE+O+eJQXVD7/03GKtREm+xXMaRjHGnTriXZJiNLDG3yFC50enLnAYY5Wv++REmsI3h6AbqGrSX/NhvjpsPFzM5VpbFSOibEaiIoMk+cRRko2I5ukYv9NWKlKkgU7J16R4yttYIPXlWYrrn0usa7meA96ukOCwekMBe44bApBx1RTlrV2nBQBG7/zIvIN1tUIX/bT8nfKuNlzzRNGO2v4oECTCV4XM/MN6yFdphmpaOHtu2T+4oIztQB/mb5 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: sondrel.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Sep 2018 19:53:27.1781 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6b87d54f-51cd-4a6c-b5bb-08d61e699117 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4faa3872-698e-4896-80ec-148b916cb1ba X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6P191MB0245 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Existing transfer size "len" is either generated randomly or set to the size of test_buf_size. In some cases we need to explicitly specify a transfer size that is different from the buffer size and non aligned to test the target device's ability to handle unaligned transfers. This patch adds optional parameter "transfer_size" to allow setting explicit transfer size for dma transfers. Signed-off-by: Seraj Alijan --- drivers/dma/dmatest.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c index 300fe4c..b6e613b 100644 --- a/drivers/dma/dmatest.c +++ b/drivers/dma/dmatest.c @@ -83,6 +83,10 @@ static int alignment = -1; module_param(alignment, int, 0644); MODULE_PARM_DESC(alignment, "Custom data address alignment taken as 2^(alignment) (default: not used (-1))"); +static unsigned int transfer_size; +module_param(transfer_size, uint, 0644); +MODULE_PARM_DESC(transfer_size, "Optional custom transfer size in bytes (default: not used (0))"); + /** * struct dmatest_params - test parameters. * @buf_size: size of the memcpy test buffer @@ -108,6 +112,7 @@ struct dmatest_params { bool noverify; bool norandom; int alignment; + unsigned int transfer_size; }; /** @@ -643,15 +648,25 @@ static int dmatest_func(void *data) break; } - if (params->norandom) + if (params->transfer_size) { + if (params->transfer_size >= params->buf_size) { + pr_err("%u-byte transfer size must be lower than %u-buffer size\n", + params->transfer_size, params->buf_size); + break; + } + len = params->transfer_size; + } else if (params->norandom) { len = params->buf_size; - else + } else { len = dmatest_random() % params->buf_size + 1; + } - len = (len >> align) << align; - if (!len) - len = 1 << align; - + /* Do not alter transfer size explicitly defined by user */ + if (!params->transfer_size) { + len = (len >> align) << align; + if (!len) + len = 1 << align; + } total_len += len; if (params->norandom) { @@ -1049,6 +1064,7 @@ static void add_threaded_test(struct dmatest_info *info) params->noverify = noverify; params->norandom = norandom; params->alignment = alignment; + params->transfer_size = transfer_size; request_channels(info, DMA_MEMCPY); request_channels(info, DMA_MEMSET); From patchwork Wed Sep 19 19:52:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seraj Alijan X-Patchwork-Id: 10606435 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4A66D112B for ; Wed, 19 Sep 2018 19:53:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3AB052BA2A for ; Wed, 19 Sep 2018 19:53:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2EB492BAA1; Wed, 19 Sep 2018 19:53:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 90E912BA2A for ; Wed, 19 Sep 2018 19:53:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731858AbeITBdE (ORCPT ); Wed, 19 Sep 2018 21:33:04 -0400 Received: from mail-eopbgr00060.outbound.protection.outlook.com ([40.107.0.60]:27849 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731823AbeITBdE (ORCPT ); Wed, 19 Sep 2018 21:33:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sondrel.onmicrosoft.com; s=selector1-sondrel-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sGgma36xLPTvMMql8rDTOhH7NJ/zOzA5VFgKqYUYnMA=; b=CGTUNzvh9LCv/rYBMSZlLjFwO3pt213DDUxRbYBxiG7ig6opJ9n5wPQaGnT2i2FyDiqqeuHKfBb3DDk2RwQD0ZP8JHJAYTsiSKbDosfWXoTecVBG+l+zWLARuTArBJbBX1k2qjXVZfMfwTohqQkogOzgiUcy2EnZRI86oHohKxI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=seraj.mohammed@sondrel.com; Received: from Seraj-pc.hh.imgtec.org (195.88.9.101) by DB6P191MB0245.EURP191.PROD.OUTLOOK.COM (2603:10a6:4:8e::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1143.15; Wed, 19 Sep 2018 19:53:29 +0000 From: Seraj Alijan To: vkoul@kernel.org Cc: dmaengine@vger.kernel.org, dan.j.williams@intel.com, james.hartley@sondrel.com, sifan.naeem@sondrel.com, ed.blake@sondrel.com, Seraj Alijan Subject: [PATCH V3 5/5] dmaengine: Documentation: Add documentation for multi chan testing Date: Wed, 19 Sep 2018 20:52:54 +0100 Message-Id: <1537386774-20749-6-git-send-email-seraj.alijan@sondrel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1537386774-20749-1-git-send-email-seraj.alijan@sondrel.com> References: <1537386774-20749-1-git-send-email-seraj.alijan@sondrel.com> MIME-Version: 1.0 X-Originating-IP: [195.88.9.101] X-ClientProxiedBy: CWLP265CA0040.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:11::28) To DB6P191MB0245.EURP191.PROD.OUTLOOK.COM (2603:10a6:4:8e::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d25c427c-9dfa-45d1-5ea0-08d61e6992a7 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:DB6P191MB0245; X-Microsoft-Exchange-Diagnostics: 1;DB6P191MB0245;3:tyw+I9a4aW8wnXj8+Q4i5urcj9zXVWP31FXPqn7xR9EEviqQTnCwSdD+16UlL6XT6Vu0MkDS1yX7Zd9w03gHFW7Ld+emHSBeJERK4iV5mz4tGR4Wb2PGCy8QrJpxdZxlZ/oOLbF9MWPRmtxxZP4XRw8GeXudZxW8K2mvs7P5OqPkw41NfkS+Cs/Jw5U56WJaDSzhsM4XAvVNqvyUcfQ3Em8smkcwa2Ksl8HCN1TK44HufgUVYZzmcdfKFdU2ZV+4;25:TT4LnNCqPD+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2yBlwACYv3NsQj20iuPqc3hsJwmAM73e3tVb/YZlKhwoqtpq1C3bGAf98dLFNzGpo0xg8xI4Vy0tr7;4:p/eAKSFPQK715pyWaRUjTUZvXT4G0TMpUB6Zbe0ScqswGpIBvbpCe6lyog939ANFxT7N5salmfoGZspkb0Jd/3VQUHnNCJOG5Tz9KDFfNVb54B+WJsOMZ8UvwLSMwAyOgunuKWpkYtPt/bV7yIaPuch/TFYGlbNGB9FBFmN0gXEPTfVov+5GZ4BA1eTd7c3Nz8P6IEBeVrAcPln/lCqCmwonAyi8EBjAYRsA8e7IK590wkNaaDwaqZU7lx4F7uoWjeuzTZwt/pCqOyGgsHEyQw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3002001)(3231355)(944501410)(52105095)(10201501046)(149027)(150027)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123564045)(201708071742011)(7699051);SRVR:DB6P191MB0245;BCL:0;PCL:0;RULEID:;SRVR:DB6P191MB0245; X-Forefront-PRVS: 0800C0C167 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(39840400004)(366004)(396003)(136003)(376002)(346002)(189003)(199004)(316002)(16586007)(53936002)(25786009)(5660300001)(2351001)(76176011)(81166006)(50466002)(52116002)(51416003)(2906002)(36756003)(6916009)(6116002)(3846002)(14444005)(575784001)(48376002)(8936002)(386003)(478600001)(81156014)(6506007)(66066001)(97736004)(486006)(107886003)(2361001)(105586002)(106356001)(6666003)(6486002)(7736002)(6512007)(4326008)(47776003)(50226002)(956004)(16526019)(11346002)(476003)(186003)(2616005)(26005)(44832011)(446003)(68736007)(305945005)(8676002)(16060500001);DIR:OUT;SFP:1101;SCL:1;SRVR:DB6P191MB0245;H:Seraj-pc.hh.imgtec.org;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; Received-SPF: None (protection.outlook.com: sondrel.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: 1;DB6P191MB0245;23:KUpS3cYVg8aSufoCE8gqoeMmunWs4AEF+e7gYY8Fc0uVeINYtlUoewj2bWummqAIh5QoOz4pjTxoltHyXhcAxgv0mFpK6/e2DEx09DyoWlM+dInr2LPGAac15ML1PVpwz41bVB9YtBAaVzEykrJK2U0yX0dQMQ8g6euPLCNwWynsR5XQi684xmh/CJ2M2P12khtkKfXkGCloDFbzcfHikY18n/PTIxa6inTT/XEelosBoAg2jhfnsfZKfzx4IxsPC7uHtUsSOsc3EL+3vmGUqCf2tZa5+Qq3PXtCtsn3fn63hDtKJyKCID62Vysh2swX+FHj4qJ9MOCFrCvZRIMKsKUYEdfEJHyZ1Dgkb4bYdjC35UGI8p8p0UdX+HfIpVJLbQk2REU6Ly/lP4aBnLqKQeZ+jYcFKrvSEkhpkazr/ppiWBGnPsK/y9PoAMk06rGyhzmAi6lXdag62apVyvafa+NGQGoy6T7qSRNk+1WKncLMl7zT4xv0HfBgdH921Jqca0E3D9zmZwcl17wDBDH69FI+o7PMbMW0MWDnghUN3Kjj7NwbVNTR5EY0c81g8qi/fiQc3NBBimyZK3DyLEvzNDWKAGcqr+Tgo22uizynILV7mHakJqR59ivoFL0w6EPRg048j4kOk68sScxHGdKwDGfzJXxWsywojLdlQuFTCPGIBy/dFgFD2zhvIkjLbR9VBUispFIujGDRtDmG5ywivH1ljauK3QAJiPxdXAKn6umDYngiJBV5eOgqmHfa5ehm7+qak5+CIq9JU/cHHShFSH+ipVxjKVKjcM+Odkrgb4yb/euTEYccG++wG4Riwqt4Q8zy5wDOUd+VIfxMF/49reUcKNUXzZrpDR47Ffi+IevT/urMsSNul9ZIfK518Sp6Vi29q+KR53SB23oD3vQlfFci50k1CdDcBkwm8STrAyHiYjjNHsMQpmNiyBM5dTAT6H7+4DlkYwp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DIG2T5HjMLFnCnUO2hOAX4VuOnXsB5NmlUzJkJLjyo5xqCi6kLtkOwHfKPdNBgKJO3E12AE7htODc87joc/U47Uw7zQ4TUyb9qYZh4rUG0cgv2lEqorvav7jkfrn6deFbJg==;5:VicUPCnMfUP/etdwYy6zzQ1xq4O937cVb4NQMvhZI4RHkS9ntuIqaKc5Cnz/pa9hS+02bJmXx0BFL2xNaNb59viDH5nkvrcpRHa9nNTA5dkGY6xfCe0hOgqgLFtM0bO2Ffp9Ox694sKnA6wgdDD3ea3E4agdjTwaHsSkdzeEtoY=;7:ah7b8VmiOKMjEz4RWk/xBTQsWt1Rf7Ybe92KfTtq8zLRMeMVL1BJXfg5PATwSkUEy/PHE+L0BkyoA27zPrOQwU3rUBol9ETg07U3eMRe46Z9fP8OJhOOldwwiKcfMdWtnHvFFRABNIp9Fetogmce5wDS7HIeWY2vnJnpOBt5rXvFspwY6Uo6Vc7o2hOgf1Gy7wyE7NO7CDNNFzSaLPYq4KSz8l41qvj1caNyshQyBIRi6nIl3uvaUXZYafgTFByQ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: sondrel.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Sep 2018 19:53:29.7943 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d25c427c-9dfa-45d1-5ea0-08d61e6992a7 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4faa3872-698e-4896-80ec-148b916cb1ba X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6P191MB0245 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Modify documentation to add multi channel testing support. Signed-off-by: Seraj Alijan --- Documentation/driver-api/dmaengine/dmatest.rst | 109 +++++++++++++++++++++++-- 1 file changed, 103 insertions(+), 6 deletions(-) diff --git a/Documentation/driver-api/dmaengine/dmatest.rst b/Documentation/driver-api/dmaengine/dmatest.rst index 7ce5e71..dd5263a 100644 --- a/Documentation/driver-api/dmaengine/dmatest.rst +++ b/Documentation/driver-api/dmaengine/dmatest.rst @@ -26,28 +26,43 @@ Part 2 - When dmatest is built as a module Example of usage:: - % modprobe dmatest channel=dma0chan0 timeout=2000 iterations=1 run=1 + % modprobe dmatest timeout=2000 iterations=1 channel=dma0chan0 run=1 ...or:: % modprobe dmatest - % echo dma0chan0 > /sys/module/dmatest/parameters/channel % echo 2000 > /sys/module/dmatest/parameters/timeout % echo 1 > /sys/module/dmatest/parameters/iterations + % echo dma0chan0 > /sys/module/dmatest/parameters/channel % echo 1 > /sys/module/dmatest/parameters/run ...or on the kernel command line:: - dmatest.channel=dma0chan0 dmatest.timeout=2000 dmatest.iterations=1 dmatest.run=1 + dmatest.timeout=2000 dmatest.iterations=1 dmatest.channel=dma0chan0 dmatest.run=1 + +Example of multi-channel test usage: + % modprobe dmatest + % echo 2000 > /sys/module/dmatest/parameters/timeout + % echo 1 > /sys/module/dmatest/parameters/iterations + % echo dma0chan0 > /sys/module/dmatest/parameters/channel + % echo dma0chan1 > /sys/module/dmatest/parameters/channel + % echo dma0chan2 > /sys/module/dmatest/parameters/channel + % echo 1 > /sys/module/dmatest/parameters/run +Note: the channel parameter should always be the last parameter set prior to +running the test (setting run=1), this is because upon setting the channel +parameter, that specific channel is requested using the dmaengine and a thread +is created with the existing parameters. This thread is set as pending +and will be executed once run is set to 1. Any parameters set after the thread +is created are not applied. .. hint:: available channel list could be extracted by running the following command:: % ls -1 /sys/class/dma/ -Once started a message like "dmatest: Started 1 threads using dma0chan0" is -emitted. After that only test failure messages are reported until the test -stops. +Once started a message like " dmatest: Added 1 threads using dma0chan0" is +emitted. A thread for that specific channel is created and is now pending, the +pending thread is started once run is to 1. Note that running a new test will not stop any in progress test. @@ -112,3 +127,85 @@ Example:: The details of a data miscompare error are also emitted, but do not follow the above format. + +Part 5 - Handling channel allocation +==================================== + +Allocating Channels +------------------- + +Channels are required to be configured prior to starting the test run. +Attempting to run the test without configuring the channels will fail. + +Example:: + + % echo 1 > /sys/module/dmatest/parameters/run + dmatest: Could not start test, no channels configured + +Channels are registered using the "channel" parameter. Channels can be requested by their +name, once requested, the channel is registered and a pending thread is added to the test list. + +Example:: + + % echo dma0chan2 > /sys/module/dmatest/parameters/channel + dmatest: Added 1 threads using dma0chan2 + +More channels can be added by repeating the example above. +Reading back the channel parameter will return the name of last channel that was added successfully. + +Example:: + + % echo dma0chan1 > /sys/module/dmatest/parameters/channel + dmatest: Added 1 threads using dma0chan1 + % echo dma0chan2 > /sys/module/dmatest/parameters/channel + dmatest: Added 1 threads using dma0chan2 + % cat /sys/module/dmatest/parameters/channel + dma0chan2 + +Another method of requesting channels is to request a channel with an empty string, Doing so +will request all channels available to be tested: + +Example:: + + % echo "" > /sys/module/dmatest/parameters/channel + dmatest: Added 1 threads using dma0chan0 + dmatest: Added 1 threads using dma0chan3 + dmatest: Added 1 threads using dma0chan4 + dmatest: Added 1 threads using dma0chan5 + dmatest: Added 1 threads using dma0chan6 + dmatest: Added 1 threads using dma0chan7 + dmatest: Added 1 threads using dma0chan8 + +At any point during the test configuration, reading the "test_list" parameter will +print the list of currently pending tests. + +Example:: + + % cat /sys/module/dmatest/parameters/test_list + dmatest: 1 threads using dma0chan0 + dmatest: 1 threads using dma0chan3 + dmatest: 1 threads using dma0chan4 + dmatest: 1 threads using dma0chan5 + dmatest: 1 threads using dma0chan6 + dmatest: 1 threads using dma0chan7 + dmatest: 1 threads using dma0chan8 + +Note: Channels will have to be configured for each test run as channel configurations do not +carry across to the next test run. + +Releasing Channels +------------------- + +Channels can be freed by setting run to 0. + +Example:: + % echo dma0chan1 > /sys/module/dmatest/parameters/channel + dmatest: Added 1 threads using dma0chan1 + % cat /sys/class/dma/dma0chan1/in_use + 1 + % echo 0 > /sys/module/dmatest/parameters/run + % cat /sys/class/dma/dma0chan1/in_use + 0 + +Channels allocated by previous test runs are automatically freed when a new +channel is requested after completing a successful test run.