From patchwork Mon Dec 10 08:52:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seraj Alijan X-Patchwork-Id: 10720837 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 5AEF715A6 for ; Mon, 10 Dec 2018 08:52:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4BBC929CBB for ; Mon, 10 Dec 2018 08:52:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3FD3029CCD; Mon, 10 Dec 2018 08:52:43 +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 09E9C29CBB for ; Mon, 10 Dec 2018 08:52:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726519AbeLJIwl (ORCPT ); Mon, 10 Dec 2018 03:52:41 -0500 Received: from mail-eopbgr50076.outbound.protection.outlook.com ([40.107.5.76]:52480 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726472AbeLJIwl (ORCPT ); Mon, 10 Dec 2018 03:52:41 -0500 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=Qm7QXvpHK7+FocyBTaGgxFfsROdhkGDM2iIQrcdK6xY=; b=FUskUWWYiL95aM/9GMcx9JUA7WjEu0isJpYEsk5dL21R6cMQJtyO+1U/dHOARTcFtUJmWbQLDlQ+yNWdXOT3cxrOp+HGqMDUJ5jcxkhDToz/mbmcHXybQalm9FdwjxtkHO/rwVZiCT3J1PpzajL9e9cuUAZraNJz2lF4Rvqosxk= Received: from VI1P191MB0255.EURP191.PROD.OUTLOOK.COM (10.172.82.20) by VI1P191MB0191.EURP191.PROD.OUTLOOK.COM (10.172.81.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1404.22; Mon, 10 Dec 2018 08:52:31 +0000 Received: from VI1P191MB0255.EURP191.PROD.OUTLOOK.COM ([fe80::cc1:80a8:5ce5:9674]) by VI1P191MB0255.EURP191.PROD.OUTLOOK.COM ([fe80::cc1:80a8:5ce5:9674%2]) with mapi id 15.20.1404.025; Mon, 10 Dec 2018 08:52:31 +0000 From: Seraj Alijan To: "vkoul@kernel.org" CC: "dmaengine@vger.kernel.org" , "dan.j.williams@intel.com" , James Hartley , Sifan Naeem , Ed Blake , Seraj Mohammed Subject: [PATCH V4 1/5] dmaengine: dmatest: Add support for multi channel testing Thread-Topic: [PATCH V4 1/5] dmaengine: dmatest: Add support for multi channel testing Thread-Index: AQHUkGWvZE+ElkjEr0qJYfklgoz+DQ== Date: Mon, 10 Dec 2018 08:52:31 +0000 Message-ID: <1544431926-8662-2-git-send-email-seraj.alijan@sondrel.com> References: <1544431926-8662-1-git-send-email-seraj.alijan@sondrel.com> In-Reply-To: <1544431926-8662-1-git-send-email-seraj.alijan@sondrel.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: LNXP265CA0077.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:76::17) To VI1P191MB0255.EURP191.PROD.OUTLOOK.COM (2603:10a6:800:a7::20) authentication-results: spf=none (sender IP is ) smtp.mailfrom=seraj.mohammed@sondrel.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [195.88.9.101] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;VI1P191MB0191;6:EuWIt8a7tNXtQXjVgDVP2tSYauNU9FK4r5uFrhOYS3NpVt1BPbmWYbh+Jw3ssWFVQpBywFra9DLqJOy+mY/7kxIyKQuzEgg+ahGUGMGjvFvESeFOkcmyqC5E0LiXHqKXyqorOC3WbZk847btF3KC2OLHFeGxmYBcVwzxCLq+H/iLqiZ1fgPlYOwQf9nGMN5Wve6AQDpiup4BAa0lrYHB6Kcq8Y7a0wSK2M5hQdM3OJOBTyyLk0PhkFRczAoEfub+fWxLjqSbKgyKVqUuQ5AqlqJ3rAsWm32bemdxmYsKkRj5v3pM844x42WpRRMpB5aVvaYcc8oLDxMxPK8nptlRFZYQFfP5Zw294ADZm44RQMlyR8W/dpp1aQr1P96K4vCVWQj7PXbqBP/EAqjsOKXL73wr52niTSi8DG32QjTPNGnTNb9yf8d/XY3Kw7MWfbHsG1Y2xDRXbRLxe5TAhIodKg==;5:dXum0TisAYUeYMpSXQH3qVmG92i+cmmF/jJXSwx/lWHhQXTvE973lQq85iLuOIAVXVZk5tKpmKlC8LNYfAU7klfZt1gMJLU5AUQhvG6LxdRvmDk0Ek1jw7z821T+psx+1RrgyOXm2irWHQ1C3e5P4YDb7NH7fRa4U3v6qEnPHrc=;7:FTLeVlisjhzvzW2RHaT+w9YmC6TindZO3OutpcXYf0/0LnLoFJ+wsk/oll9VsiFAR4kW043LYw+aaiz+O+IwMaOzImDle3fzNsqWrHBkuP9zMr3U7wycWaEi0pSqf8tXVRh0Mgr1kdjZKlaIVgbmRQ== x-ms-office365-filtering-correlation-id: e034de46-5e51-462a-cad0-08d65e7cd221 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:VI1P191MB0191; x-ms-traffictypediagnostic: VI1P191MB0191: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(3230017)(999002)(6040522)(2401047)(5005006)(8121501046)(3002001)(3231472)(944501520)(52105112)(10201501046)(93006095)(93001095)(148016)(149066)(150057)(6041310)(20161123560045)(20161123558120)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095);SRVR:VI1P191MB0191;BCL:0;PCL:0;RULEID:;SRVR:VI1P191MB0191; x-forefront-prvs: 08828D20BC x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(979002)(366004)(346002)(39840400004)(136003)(396003)(376002)(189003)(199004)(5660300001)(5640700003)(6506007)(386003)(6436002)(6512007)(1730700003)(3846002)(8676002)(2906002)(81156014)(81166006)(53936002)(6486002)(76176011)(52116002)(486006)(68736007)(107886003)(446003)(11346002)(66066001)(2616005)(4326008)(476003)(99286004)(6116002)(36756003)(2501003)(186003)(26005)(6916009)(478600001)(256004)(25786009)(97736004)(14444005)(2351001)(14454004)(54906003)(8936002)(316002)(71190400001)(71200400001)(102836004)(106356001)(105586002)(7736002)(305945005)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1P191MB0191;H:VI1P191MB0255.EURP191.PROD.OUTLOOK.COM;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-antispam-message-info: fPjTOYqa+NQWkUCalsVUdNAHiwH1ORYqfJYgdBG1GFdhG6fATtVvmIR1ajf/FVdDvhwFCWGdaY4f+9f+fFkxid6dv1euBi6LBzZRwwP6YidIjr6y6SIfDJDbrF/aBsaGPBugF+7RhThNvWCQw5RlGKCFMXVoyFalRl/AUjuplCS78aa7tWnNcKJCTorj3agmlM9ntwb+jASJigkiqfzbA4iQPVe7inyZXqy2fpTU3Fo80YI4Hq51zv0yby4ptXcixVKjmLLIx372FiiwAL45TNeh5tw03UskyGFplRFv/DHITvBQJe7D0eOQvCaEBOAF spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: sondrel.com X-MS-Exchange-CrossTenant-Network-Message-Id: e034de46-5e51-462a-cad0-08d65e7cd221 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Dec 2018 08:52:31.7532 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4faa3872-698e-4896-80ec-148b916cb1ba X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1P191MB0191 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 28deaa0..d192772 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; @@ -884,7 +919,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; @@ -930,7 +965,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); @@ -975,7 +1010,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; @@ -998,6 +1033,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; @@ -1014,7 +1067,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 @@ -1022,11 +1075,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) @@ -1037,7 +1086,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); @@ -1055,18 +1105,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 + * "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; @@ -1074,7 +1231,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 Mon Dec 10 08:52:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seraj Alijan X-Patchwork-Id: 10720839 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 51ECB15A6 for ; Mon, 10 Dec 2018 08:52:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4361329CBB for ; Mon, 10 Dec 2018 08:52:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3779D29CCD; Mon, 10 Dec 2018 08:52:44 +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 CC66929CBB for ; Mon, 10 Dec 2018 08:52:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726554AbeLJIwn (ORCPT ); Mon, 10 Dec 2018 03:52:43 -0500 Received: from mail-eopbgr50076.outbound.protection.outlook.com ([40.107.5.76]:52480 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726531AbeLJIwn (ORCPT ); Mon, 10 Dec 2018 03:52:43 -0500 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=qGgiE3VA1yprUoZJznsp0yCd74RsdXqUvQ4qmyj8ySk=; b=NUm+lOv37qhXYjlqbUAVCyaWEaTnrM8aJfYqh95Q8V3gsgTFF0Tf0+23tKi0gWJlOTP9WHto17fh7KHuYpQcVGm8MLDFvceiU4VV4F19e+e+P+E/0Bt62s6/jJ/XUR/qDIlgn3U+E+ucvLQ0dB333Ct0kq1HMLXfNjywxcbdrPg= Received: from VI1P191MB0255.EURP191.PROD.OUTLOOK.COM (10.172.82.20) by VI1P191MB0191.EURP191.PROD.OUTLOOK.COM (10.172.81.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1404.22; Mon, 10 Dec 2018 08:52:34 +0000 Received: from VI1P191MB0255.EURP191.PROD.OUTLOOK.COM ([fe80::cc1:80a8:5ce5:9674]) by VI1P191MB0255.EURP191.PROD.OUTLOOK.COM ([fe80::cc1:80a8:5ce5:9674%2]) with mapi id 15.20.1404.025; Mon, 10 Dec 2018 08:52:34 +0000 From: Seraj Alijan To: "vkoul@kernel.org" CC: "dmaengine@vger.kernel.org" , "dan.j.williams@intel.com" , James Hartley , Sifan Naeem , Ed Blake , Seraj Mohammed Subject: [PATCH V4 2/5] dmaengine: dmatest: Use fixed point div to calculate iops Thread-Topic: [PATCH V4 2/5] dmaengine: dmatest: Use fixed point div to calculate iops Thread-Index: AQHUkGWxiP72sUQ9SEioj3XlufWc4g== Date: Mon, 10 Dec 2018 08:52:34 +0000 Message-ID: <1544431926-8662-3-git-send-email-seraj.alijan@sondrel.com> References: <1544431926-8662-1-git-send-email-seraj.alijan@sondrel.com> In-Reply-To: <1544431926-8662-1-git-send-email-seraj.alijan@sondrel.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: LNXP265CA0077.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:76::17) To VI1P191MB0255.EURP191.PROD.OUTLOOK.COM (2603:10a6:800:a7::20) authentication-results: spf=none (sender IP is ) smtp.mailfrom=seraj.mohammed@sondrel.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [195.88.9.101] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;VI1P191MB0191;6:uEsmwZmNOML63QWskX1UuN3MLD3jpgE99uBC+J4g2QoZhhgowvDQ8PPpRUT/LUZhUMpoD3B45605a38fXXhFJDHokpBS1t+U3c7n5j4JaX+Tw9GKvD2OHl831fWP6ZtAR4RdbZOIrdXjh9HDac9qkOIe3YZJUUTEMGDuKH+AfIi8/3sEo+oAzM+OcYm1ESLM8aSdpERp1c2SJkGlBIBRWgjIBsMCm6T4nUwv8EzS6dNIDw1VfXf84Ty/77MKW0DPRE3882CkIOzln/4zH6L9eWNMksd/REl0dqYxQ1571b1RtfSVzwwRwqfJwmThIpTgYtmRgbn4AFwUh/0/JSm8YRJtAhFRdnh5XrrJdO1Frbw12iH/QAkIu25Sr+lfWE0sima1YelV8hBP4aUgs9iP/dDFQvaLozZuDVy19vXnyj1IGx9gy7jK3QA+BbD9QUpF1OZst5IyLPo9zzq/uKmoFQ==;5:44/eq/VWyGd49U929uRQdyXQyO+4UnFzGh3iZQ49AeyTZvNhACsMXQCsPBzQnN/mssrlhlqAS9Mk3khvahbK0WlZGAdOBXEexl/UFV9DrpUDNDONiIDltFwLM/NdBXNOProx2T8Ur1hbiKeDOX3dhwq0T7e1TG+AIH1rBIeU+ds=;7:VZWAc2Kgblh0xmRJizz7k4166+YOGnBdrzeLnVmPWO1AkZusZXyflz8MYpKax0Wv0lNHP3jSKmGWtHU96pbOQm5SrC+DcZ+MGupe0KF+sP9dH78R+eTBhtWaKSB9/xSRCiM17fXWXNXzRPq5QMuzrQ== x-ms-office365-filtering-correlation-id: b5a2f95b-985c-46c5-d66b-08d65e7cd3c2 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:VI1P191MB0191; x-ms-traffictypediagnostic: VI1P191MB0191: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(3230017)(999002)(6040522)(2401047)(5005006)(8121501046)(3002001)(3231472)(944501520)(52105112)(10201501046)(93006095)(93001095)(148016)(149066)(150057)(6041310)(20161123560045)(20161123558120)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095);SRVR:VI1P191MB0191;BCL:0;PCL:0;RULEID:;SRVR:VI1P191MB0191; x-forefront-prvs: 08828D20BC x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(366004)(346002)(39840400004)(136003)(396003)(376002)(189003)(199004)(5660300001)(5640700003)(6506007)(386003)(6436002)(6512007)(1730700003)(3846002)(8676002)(2906002)(81156014)(81166006)(53936002)(6486002)(76176011)(52116002)(486006)(68736007)(575784001)(107886003)(446003)(11346002)(66066001)(2616005)(4326008)(476003)(99286004)(6116002)(36756003)(2501003)(186003)(26005)(6916009)(478600001)(256004)(25786009)(97736004)(14444005)(2351001)(14454004)(54906003)(8936002)(316002)(71190400001)(71200400001)(102836004)(106356001)(105586002)(7736002)(305945005);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1P191MB0191;H:VI1P191MB0255.EURP191.PROD.OUTLOOK.COM;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-antispam-message-info: tIjHjtDbPO4NfT0Q9SQbneSPlbH9eqRXzVgf0hEkflmjFUwu/e8E6DN7lCmFAUId1QFVnbDGb4Px3NOw2bJFRjiz5+gUNA0JTJezKNsbE+1LMHobHIi73MA33bv3vK/srQUweIIsYoIw3lt7q1Wl7nCZgfYtz+rWc3zCUgLiDYCnHGEps8El6kwduRpBMmxD7g/lDKPqMYf+kMeG+ECwpX9jpH63kDq10wCQbsVTs47ZKs+MYpaNgTobF9Db9F7tKlVnldh9YYMgUx99xPtDNlCJshLCPlsPhdIUgCdyeTBgmujNQW7ZdLOzW3i9USn9 spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: sondrel.com X-MS-Exchange-CrossTenant-Network-Message-Id: b5a2f95b-985c-46c5-d66b-08d65e7cd3c2 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Dec 2018 08:52:34.4033 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4faa3872-698e-4896-80ec-148b916cb1ba X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1P191MB0191 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 d192772..998344b 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; @@ -838,9 +848,10 @@ static int dmatest_func(void *data) err_free_coefs: 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 Mon Dec 10 08:52:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seraj Alijan X-Patchwork-Id: 10720841 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 65A8E1751 for ; Mon, 10 Dec 2018 08:52:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 576BE29CBB for ; Mon, 10 Dec 2018 08:52:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4BBB229CCD; Mon, 10 Dec 2018 08:52:46 +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 DD41929CBB for ; Mon, 10 Dec 2018 08:52:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726572AbeLJIwp (ORCPT ); Mon, 10 Dec 2018 03:52:45 -0500 Received: from mail-eopbgr50076.outbound.protection.outlook.com ([40.107.5.76]:52480 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726472AbeLJIwp (ORCPT ); Mon, 10 Dec 2018 03:52:45 -0500 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=FihYHAmY77wE9va8wKPRJR3SI8VUP1472zRlbbt3eVE=; b=Atp8SBysXMPqgqczSbewj4fLcwd4m3hJvwkvO9lcoGqemlW+FlLPi4MzbxuTjFvn9f/s3gwCt9BxLPACLtFooginI+Fege1IfzND/T0TPeL2SHXVdxxdqAuNIP2Eh0Ga83fL1fB+OnNPWBG1uuGfUhBpPTUVAvnhBs8bzb3bQtU= Received: from VI1P191MB0255.EURP191.PROD.OUTLOOK.COM (10.172.82.20) by VI1P191MB0191.EURP191.PROD.OUTLOOK.COM (10.172.81.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1404.22; Mon, 10 Dec 2018 08:52:37 +0000 Received: from VI1P191MB0255.EURP191.PROD.OUTLOOK.COM ([fe80::cc1:80a8:5ce5:9674]) by VI1P191MB0255.EURP191.PROD.OUTLOOK.COM ([fe80::cc1:80a8:5ce5:9674%2]) with mapi id 15.20.1404.025; Mon, 10 Dec 2018 08:52:37 +0000 From: Seraj Alijan To: "vkoul@kernel.org" CC: "dmaengine@vger.kernel.org" , "dan.j.williams@intel.com" , James Hartley , Sifan Naeem , Ed Blake , Seraj Mohammed Subject: [PATCH V4 3/5] dmaengine: dmatest: Add alignment parameter Thread-Topic: [PATCH V4 3/5] dmaengine: dmatest: Add alignment parameter Thread-Index: AQHUkGWzgdLxg8BdjE6JhiNejNO1vw== Date: Mon, 10 Dec 2018 08:52:37 +0000 Message-ID: <1544431926-8662-4-git-send-email-seraj.alijan@sondrel.com> References: <1544431926-8662-1-git-send-email-seraj.alijan@sondrel.com> In-Reply-To: <1544431926-8662-1-git-send-email-seraj.alijan@sondrel.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: LNXP265CA0077.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:76::17) To VI1P191MB0255.EURP191.PROD.OUTLOOK.COM (2603:10a6:800:a7::20) authentication-results: spf=none (sender IP is ) smtp.mailfrom=seraj.mohammed@sondrel.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [195.88.9.101] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;VI1P191MB0191;6:qcq4HaAMDBI+t/zXvNMMpAf+4JHDgRpBqxDCJ+vopefChxKtkys2i2LhHi45+qjSepQzLbN7wFmoqbxlNDBvgzrvmAOvxEIanCw+gFvQpeWSk3f713rRPcaiBE6lKKcmGT+dwYQslhed0Explgbq64Y4yleGAFEF9w1np6NGKLV+DLtLn+Q4zN4mtVNh12y52fhu69udL2QDcAJzw+AZ0v46t0IqwthcOsuZdC1w+W+ogDYumVa9PpWkuR94UOzGnGI8UVRocOpRB0GEaLCGNRHkOS+DmBPSDTUdkUfn8sgmMVOamlG6NCXseb/BY3305SUGj+xEzYyjRkPzRg4aYWYTI738H8+Ld3pwkn1L74E6RIuyRMfYvM/RpAfGihHZLOLqz+sQjrGPJFNk8Ph3vh59Bp8ORVCUCAmzNjYmRexs8I0+zPnUm+yheAYjpdI36696iTWV8CStWRvB4Om9Ow==;5:ufgWI7T5iJnM0KQ5QMgaP+olNtdWRo2u+IiBhti7p2HYSi3nWtzqsNc2MYNr23B/0t6fcM6JU27LsPwBZSYwDLz8GzOA+vSK1P/hVKnVVB28rz2dL3m2AcOZr3OPdSuldy9Zu7DFvuuprFpAcJO8OJ5hXSJMEsCs1t8qh7t6qQc=;7:OxaQGpEK3v7MVzvk404YVy7LRWLIZZXXygAR5mQdKKOMOfvj4NZ6p/QLgVhy0J1QR6HtTxRZdXXBpv1Dve7pHKUgXde51Zc1EoGqEz1RwzWdcrK7pgu1vRPzrHvEcNfLz+oV25H3JF9CcszgBKiO4Q== x-ms-office365-filtering-correlation-id: 513d83e5-3765-4cfe-b5f7-08d65e7cd551 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:VI1P191MB0191; x-ms-traffictypediagnostic: VI1P191MB0191: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(3230017)(999002)(6040522)(2401047)(5005006)(8121501046)(3002001)(3231472)(944501520)(52105112)(10201501046)(93006095)(93001095)(148016)(149066)(150057)(6041310)(20161123560045)(20161123558120)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095);SRVR:VI1P191MB0191;BCL:0;PCL:0;RULEID:;SRVR:VI1P191MB0191; x-forefront-prvs: 08828D20BC x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(366004)(346002)(39840400004)(136003)(396003)(376002)(189003)(199004)(5660300001)(5640700003)(6506007)(386003)(6436002)(6512007)(1730700003)(3846002)(8676002)(2906002)(81156014)(81166006)(53936002)(6486002)(76176011)(52116002)(486006)(68736007)(107886003)(446003)(11346002)(66066001)(2616005)(4326008)(476003)(99286004)(6116002)(36756003)(2501003)(186003)(26005)(6916009)(478600001)(256004)(25786009)(97736004)(14444005)(2351001)(14454004)(54906003)(8936002)(316002)(71190400001)(71200400001)(102836004)(106356001)(105586002)(7736002)(305945005);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1P191MB0191;H:VI1P191MB0255.EURP191.PROD.OUTLOOK.COM;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-antispam-message-info: GYgh5X2i2VV7Gv9iyY1TuzjKOslZPLBsxGdKKOshq9KEwY0EtVAovDjlyyKSK3DFzQWskT9CPEn/z/nokulS/Kua1yp9BTFEmbba4FPV3g5WLPM7ZtjF8UHz7DgAtyDB2Xt2XwdGfp2HHRimMLzwcHPIC5sH/RPtrlyPVBO69h8oUctGhjBU5iN572OJg4NWhVIATFJrEpBZGQqGo/6PTJ0P4nQuERX40pxBR4mdbTAit65VgS/LGqIzSwbBcmROJBvnq5oKc13SJX47DrPnSMv387T4+l5yMeN9B7aIlj4aPPl1m1QZzUMf3Q5HthYo spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: sondrel.com X-MS-Exchange-CrossTenant-Network-Message-Id: 513d83e5-3765-4cfe-b5f7-08d65e7cd551 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Dec 2018 08:52:37.0273 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4faa3872-698e-4896-80ec-148b916cb1ba X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1P191MB0191 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 998344b..6302ebe 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) @@ -1037,6 +1046,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 Mon Dec 10 08:52:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seraj Alijan X-Patchwork-Id: 10720843 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 0DAFB1751 for ; Mon, 10 Dec 2018 08:53:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EEF4329CCC for ; Mon, 10 Dec 2018 08:53:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DCDC329CBB; Mon, 10 Dec 2018 08:53:29 +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 7042029CBB for ; Mon, 10 Dec 2018 08:53:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726572AbeLJIx2 (ORCPT ); Mon, 10 Dec 2018 03:53:28 -0500 Received: from mail-eopbgr50076.outbound.protection.outlook.com ([40.107.5.76]:52480 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726567AbeLJIx1 (ORCPT ); Mon, 10 Dec 2018 03:53:27 -0500 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=4b69/4pC0mWLH/50vCTHMvlYGCtr4dSt9ttD7KK7lvw=; b=BdjU2y00+fpoX/KVOAHcgUM3HhviUJ5yPNOsBkOwNSCW3RSR3bYhKCRr6Re+UASelaSFh40h7Odkop9kV/zsAbtiqqbIc0FPWLC63JHfx0kja+nYf5wiM97RC43RFF4HG+NsEE9niKVNWI9r/G98dzkvguRavyJHHMM5bQqV5W0= Received: from VI1P191MB0255.EURP191.PROD.OUTLOOK.COM (10.172.82.20) by VI1P191MB0191.EURP191.PROD.OUTLOOK.COM (10.172.81.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1404.22; Mon, 10 Dec 2018 08:52:39 +0000 Received: from VI1P191MB0255.EURP191.PROD.OUTLOOK.COM ([fe80::cc1:80a8:5ce5:9674]) by VI1P191MB0255.EURP191.PROD.OUTLOOK.COM ([fe80::cc1:80a8:5ce5:9674%2]) with mapi id 15.20.1404.025; Mon, 10 Dec 2018 08:52:39 +0000 From: Seraj Alijan To: "vkoul@kernel.org" CC: "dmaengine@vger.kernel.org" , "dan.j.williams@intel.com" , James Hartley , Sifan Naeem , Ed Blake , Seraj Mohammed Subject: [PATCH V4 4/5] dmaengine: dmatest: Add transfer_size parameter Thread-Topic: [PATCH V4 4/5] dmaengine: dmatest: Add transfer_size parameter Thread-Index: AQHUkGW0QGuwtpgeQEOfHkiiOsp63A== Date: Mon, 10 Dec 2018 08:52:39 +0000 Message-ID: <1544431926-8662-5-git-send-email-seraj.alijan@sondrel.com> References: <1544431926-8662-1-git-send-email-seraj.alijan@sondrel.com> In-Reply-To: <1544431926-8662-1-git-send-email-seraj.alijan@sondrel.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: LNXP265CA0077.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:76::17) To VI1P191MB0255.EURP191.PROD.OUTLOOK.COM (2603:10a6:800:a7::20) authentication-results: spf=none (sender IP is ) smtp.mailfrom=seraj.mohammed@sondrel.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [195.88.9.101] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;VI1P191MB0191;6:FQ3O6LOz1280AE8MFI1TJRlBp2zoaoMLmRkbvajzfhOHifhPJ6sfWDKSOSdM0tBx/jcIYkLCfDBUaPrhXAUk9mgXq8a1mR+tSm4P9goC4wc6kCY5ctvrJ9BoWn7WsDTCgz/LAriJDCqGjr2nuk4OUUm8rd4tQmRUn6CtAxx5JOC90JJA5IcDxx+/PBzlPEqdV4BEQIAxJWb3oLFNl6qWvzM7omaAoHD691F1gXCiUm4/+BVqLuw72sJl4w2loB5grmjqw7m+oZYYSiMQFHfHihx/FK+9y4+zCQzRAKdfqcq6hGpwXBNBIRDOyNT55bfYHK+thkMtgLX73niHwF4cKRerrUSWAEOH0ID9Y0waC1lbfe/wvg5sa3Nr05AkPWnXcpDJXA6wxZ6CK8FzcG2H6IE4uirbfwrUu0zen1CEH2ZEEvMF3CXqY4KCigUyomyeqRcGBJWF4fyRltAjB/lAMg==;5:tjGiRsEhU2O3qiMP3bM2TKDiJbVz2/tW3mP4Fk9siseJ7dyRN1Kp1LtsqRS8a1npfH0Dwbb2IKhavGTAIdJrkqRaf0O1XfqVq2oRP7IW73wErxSp5jBXLR1vyElq/nNLf60JhInz29AlSadSWBXHRSFc/dYiAZrytJMEqjAyX58=;7:dBvOKuaHzgtQRHb6emAweovSrUwLDxcKAJdctT/8HdmyLoUpqSnF8rnU+5K/SazJIbCdp6bSTcQZ7WilNPlFSv7/PNn5YmHYb0fWqH3RPIMyXZZGHT7RboNaByJrYOX7Gm/0qqnfhQiBF3K4m+C1rw== x-ms-office365-filtering-correlation-id: 17699a03-1b1a-4bae-9e50-08d65e7cd6f0 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:VI1P191MB0191; x-ms-traffictypediagnostic: VI1P191MB0191: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(3230017)(999002)(6040522)(2401047)(5005006)(8121501046)(3002001)(3231472)(944501520)(52105112)(10201501046)(93006095)(93001095)(148016)(149066)(150057)(6041310)(20161123560045)(20161123558120)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095);SRVR:VI1P191MB0191;BCL:0;PCL:0;RULEID:;SRVR:VI1P191MB0191; x-forefront-prvs: 08828D20BC x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(366004)(346002)(39840400004)(136003)(396003)(376002)(189003)(199004)(5660300001)(5640700003)(6506007)(386003)(6436002)(6512007)(1730700003)(3846002)(8676002)(2906002)(81156014)(81166006)(53936002)(6486002)(76176011)(52116002)(486006)(68736007)(107886003)(446003)(11346002)(66066001)(2616005)(4326008)(476003)(99286004)(6116002)(36756003)(2501003)(186003)(26005)(6916009)(478600001)(256004)(25786009)(97736004)(14444005)(2351001)(14454004)(54906003)(8936002)(316002)(71190400001)(71200400001)(102836004)(106356001)(105586002)(7736002)(305945005);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1P191MB0191;H:VI1P191MB0255.EURP191.PROD.OUTLOOK.COM;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-antispam-message-info: W7qFYn3xFUC3j2RWAzOVeHoevK4NNpp335QIKKtLlIVpNv4uxgWL08ksP7QIFmUpJWUNFdb3Q6o22xmC5+dcjAOaz47zn9s8NxMuhUMOOdV0RjjntZjrMuHijkeyzyNXZdNM5exkgguo4K2BSgYShpN//n6ZiUMGqTIiG2uwxlDT4F0+jXu/DC7sQsQYGwNetczWrVKWRCZdg0phxOWDfB3OWrjYXcONZ+Tn+tvosizjwmtGaPrXrCGbwgTFqb9GE5gBolol9A8EdnrzwxZDW+0gebHIj5JbfpOKTXv/Qe1zAEHRG4KFeLMpD5RG7bZE spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: sondrel.com X-MS-Exchange-CrossTenant-Network-Message-Id: 17699a03-1b1a-4bae-9e50-08d65e7cd6f0 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Dec 2018 08:52:39.8255 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4faa3872-698e-4896-80ec-148b916cb1ba X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1P191MB0191 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 6302ebe..2eea4ef 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) total_tests++; - 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) { @@ -1047,6 +1062,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 Mon Dec 10 08:52:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seraj Alijan X-Patchwork-Id: 10720859 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 10C4A91E for ; Mon, 10 Dec 2018 08:55:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 01B2329C90 for ; Mon, 10 Dec 2018 08:55:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E9C5129CD4; Mon, 10 Dec 2018 08:55:45 +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 399B329C90 for ; Mon, 10 Dec 2018 08:55:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726572AbeLJIzn (ORCPT ); Mon, 10 Dec 2018 03:55:43 -0500 Received: from mail-eopbgr20076.outbound.protection.outlook.com ([40.107.2.76]:43088 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726531AbeLJIzm (ORCPT ); Mon, 10 Dec 2018 03:55:42 -0500 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=axnPeyhnA/VQdCzNRHwE0tURHhSrIsmYNQS274xsGAE=; b=g6G0D5m6/AI2+gksfUrxTMuzGHppEmPbzzoscAqEpBmDANMNN3GiR9LFh6Wc0P87G5sHU/XYmwrwC2qxMFuLG48hymbBrvojljsJoAV4z64eWQROtp2qdjd4fY5/o2763tohSX/GOkhgNpn/NXjK8r9HP81ESFtOry7lAl4mFKY= Received: from VI1P191MB0255.EURP191.PROD.OUTLOOK.COM (10.172.82.20) by VI1P191MB0045.EURP191.PROD.OUTLOOK.COM (10.172.11.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1404.19; Mon, 10 Dec 2018 08:52:42 +0000 Received: from VI1P191MB0255.EURP191.PROD.OUTLOOK.COM ([fe80::cc1:80a8:5ce5:9674]) by VI1P191MB0255.EURP191.PROD.OUTLOOK.COM ([fe80::cc1:80a8:5ce5:9674%2]) with mapi id 15.20.1404.025; Mon, 10 Dec 2018 08:52:42 +0000 From: Seraj Alijan To: "vkoul@kernel.org" CC: "dmaengine@vger.kernel.org" , "dan.j.williams@intel.com" , James Hartley , Sifan Naeem , Ed Blake , Seraj Mohammed Subject: [PATCH V4 5/5] dmaengine: Documentation: Add documentation for multi chan testing Thread-Topic: [PATCH V4 5/5] dmaengine: Documentation: Add documentation for multi chan testing Thread-Index: AQHUkGW2Mw3Pfp108kGrKVtXCO0U9A== Date: Mon, 10 Dec 2018 08:52:42 +0000 Message-ID: <1544431926-8662-6-git-send-email-seraj.alijan@sondrel.com> References: <1544431926-8662-1-git-send-email-seraj.alijan@sondrel.com> In-Reply-To: <1544431926-8662-1-git-send-email-seraj.alijan@sondrel.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: LNXP265CA0077.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:76::17) To VI1P191MB0255.EURP191.PROD.OUTLOOK.COM (2603:10a6:800:a7::20) authentication-results: spf=none (sender IP is ) smtp.mailfrom=seraj.mohammed@sondrel.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [195.88.9.101] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;VI1P191MB0045;6:V98eyMMXLl4+WfIMQIejxRuSwGXJPkO2oTkU734DPmIvnkEqajF9tyc2azlMF8ztSASOqkiaomgfceU8+mVGozHTE344XITsVCGZSE5LRAELhND/gprFGawGR8kdQFWA3Ee0T7cbvm8bYkNw2t+nIIDOqUtjWcCEF2Nfvj8LasNvlj8mU602UzTfAoQRnaKzDNVam58DjKJKacGn7xilpx07Ps0hdlJ4Br97SVGJ6CguM1e+Bk7jxEo1VH/FHUbyXmwjMbjKbC4fxVXitDZ0+wuQIlMN+NXOA5VtEpaTXUBw7xUSp+1Oy1bwJ68LvAs70Z7xUssy8AIvzsOtaM+5wfq/f0Zd2jx9c7hEicgQ3k2ETRK1lR7hEa8KMkJE1NtmtbumsiDpGzF8u4v9HmHY9JtMym8WssgC8ymWUqfrMsg2iMsFNUGnXljy4qgK5J2V0Rar/cYG057NuZdfUVN4pg==;5:2ULaLCMyyD3Tk8STjgG8ekCR0qXFlom1YK6BsJrrXZK25hLun9gg/jKO64shPkP2ZOCn527pKE6cPNCtG/9hTxE5mldtVqxg7qFPKg6yWzM395CgMSfUSdqp/brZ/c44WFDwaQhNPTSCdk4n8TaKmvTu7crQef9wJ7+r6eGKsCk=;7:HTBWsySBxyKXEW1Wvg0dr/3M70AAh0jWPufpIO/rRsGSwpwdBkMjR3tUehJXQcSiW8nKux/0HQ4o+QOsuIX+04Bc+mwtd6cbhzK6C7fR7KqOvS3oVacrHypXjBRqLjQI1p5AO1TWIjJyUkQOazVcdw== x-ms-office365-filtering-correlation-id: 86cf25a4-e7ba-47a4-1b7c-08d65e7cd875 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:VI1P191MB0045; x-ms-traffictypediagnostic: VI1P191MB0045: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3002001)(3231455)(999002)(944501520)(52105112)(148016)(149066)(150057)(6041310)(20161123564045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(201708071742011)(7699051)(76991095);SRVR:VI1P191MB0045;BCL:0;PCL:0;RULEID:;SRVR:VI1P191MB0045; x-forefront-prvs: 08828D20BC x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(136003)(396003)(39840400004)(366004)(346002)(376002)(199004)(189003)(26005)(25786009)(186003)(81166006)(8936002)(14444005)(36756003)(256004)(2616005)(1730700003)(11346002)(81156014)(446003)(2906002)(105586002)(8676002)(54906003)(106356001)(4326008)(2351001)(6116002)(99286004)(3846002)(97736004)(6916009)(6486002)(76176011)(53936002)(316002)(102836004)(478600001)(5640700003)(476003)(2501003)(107886003)(6506007)(386003)(52116002)(68736007)(7736002)(14454004)(6436002)(66066001)(575784001)(5660300001)(305945005)(6512007)(71200400001)(71190400001)(486006);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1P191MB0045;H:VI1P191MB0255.EURP191.PROD.OUTLOOK.COM;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: sondrel.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: PBb9m6Kd9Bl761ZnBO0bM3axCkoE3CvtyZsXQC/s8cOrlrYJBmGagJnw4YPFjnY1XhsPAVUWLimFd45Yt3RXxj30DT32v6n+W0+nX4tC1gfELV5k30wWP4r6lqP1ptkxWh7+0yhM6DcM/aTOTIpF4OdkxMPYDNRRnIszWKwQhgykEUPEaNaljK3G6zBKBFfgFY/uqGM67ow/Su+HDul/bvScY1Hllm1KQGr9XqKjG46CsKTCZmgC4Wf6v6Ct4GfWaiOYEvCEyhxfGmizqhHUL2dcUN3zVebvblXhW2qy0i9C0tlFkFveDVqGucvH8iJ8 spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: sondrel.com X-MS-Exchange-CrossTenant-Network-Message-Id: 86cf25a4-e7ba-47a4-1b7c-08d65e7cd875 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Dec 2018 08:52:42.3015 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4faa3872-698e-4896-80ec-148b916cb1ba X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1P191MB0045 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.