From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 377F1A04B5; Wed, 28 Oct 2020 21:37:44 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1CF175946; Wed, 28 Oct 2020 21:37:43 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by dpdk.org (Postfix) with ESMTP id 4A906593A for ; Wed, 28 Oct 2020 21:37:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603917459; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ta1Fjobv/nBW3kvJmC8M9tix1E/NRnLecqDDevoEi/Q=; b=EswWpS54/5f2TcAeNETImSeXc3hSSDr+tFbhcNvRmtfySJT1bIG1BPfmOsGFrv9rq3Z73U UfhEZnWQRYnnyHsKgvZLasazd3G1ehHC3x8PiCKKMZPeG5w/5WH+YJu1+BR2WX40U6Qcd4 XG6XfHej9h8+xFgHX2zBKvxga/+p52Y= Received: from mail-oi1-f199.google.com (mail-oi1-f199.google.com [209.85.167.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-380-qde9_EHDOq6lauyc9OI8ZQ-1; Wed, 28 Oct 2020 16:37:37 -0400 X-MC-Unique: qde9_EHDOq6lauyc9OI8ZQ-1 Received: by mail-oi1-f199.google.com with SMTP id 204so118727oid.21 for ; Wed, 28 Oct 2020 13:37:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=Ta1Fjobv/nBW3kvJmC8M9tix1E/NRnLecqDDevoEi/Q=; b=lhN+mkYplI72wXYv6E/tSf1P8hSmTOaUG5RWxw/bnIbMGrnQE/6I8DRdkRry/ARh9R nl3Oj5jAgcAt7ZCxhF2+rtWFfGccFnVzW6pQPWIVowBFk5vd/3x22XnFvIQanTBnq5mJ KvkJvaIwhz/ECZ4B02B4SqCHteSsL/u0k5ZgFKBc7tOYStTtB/R/L6qiwiNFUJEAlqSj lNjrNNH3ghBLF/g96kDKsRRezpl+qoMoAwNETJKfXQ/Gtrm+scFMFdyW4pFKrBV1Ctlh rYZgxCUj3fIH5mF/N5TpRHwT2jT5/JOgWLXDr3Qc/OjNyqxlFD6hAUOmAsF1t08XpQG9 YDQg== X-Gm-Message-State: AOAM530dIUwWZLAOhttaQMGTp1yA/VpJJZpGFVE+dsgfPwDzU1oh2hNe LFVijkWrkpUTqcn9BB9KCxaw5CjRy6rjCGzmT3PLV8XzWHAPf2+I3JW3zOdZphEU2zRDPuoCMeQ GLSQ= X-Received: by 2002:a4a:3bd6:: with SMTP id s205mr614693oos.76.1603917457068; Wed, 28 Oct 2020 13:37:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQy69sUL6KO4Q/8BzM8kgtLk1QVmscnZDzj/m4ojWH1yX5FeHsXeOFAtAU5QEmxREavWX49w== X-Received: by 2002:a4a:3bd6:: with SMTP id s205mr614666oos.76.1603917456610; Wed, 28 Oct 2020 13:37:36 -0700 (PDT) Received: from trix.remote.csb (075-142-250-213.res.spectrum.com. [75.142.250.213]) by smtp.gmail.com with ESMTPSA id l23sm141450otk.68.2020.10.28.13.37.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 28 Oct 2020 13:37:36 -0700 (PDT) To: "Chautru, Nicolas" , "dev@dpdk.org" , "akhil.goyal@nxp.com" Cc: "david.marchand@redhat.com" References: <1603496581-35966-1-git-send-email-nicolas.chautru@intel.com> <1603496581-35966-2-git-send-email-nicolas.chautru@intel.com> <33fb2ef0-5609-fd5e-4bc2-b21350946a41@redhat.com> From: Tom Rix Message-ID: <1f2889d4-d1c9-4552-74c9-939bdfb5beaf@redhat.com> Date: Wed, 28 Oct 2020 13:37:34 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=trix@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US Subject: Re: [dpdk-dev] [PATCH v5 1/7] app/bbdev: add explicit ut for latency vs validation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 10/26/20 10:30 AM, Chautru, Nicolas wrote: >> -----Original Message----- >> From: Tom Rix >> Sent: Monday, October 26, 2020 5:56 AM >> To: Chautru, Nicolas ; dev@dpdk.org; >> akhil.goyal@nxp.com >> Cc: david.marchand@redhat.com >> Subject: Re: [PATCH v5 1/7] app/bbdev: add explicit ut for latency vs >> validation >> >> >> On 10/23/20 4:42 PM, Nicolas Chautru wrote: >>> Adding explicit different ut when testing for validation or latency >>> (early termination enabled or not). >>> >>> Signed-off-by: Nicolas Chautru >>> Acked-by: Aidan Goddard >>> Acked-by: Dave Burley >>> --- >>> app/test-bbdev/test_bbdev_perf.c | 92 >>> ++++++++++++++++++++++++++++++++++++++-- >> Should update the copyright. >>> 1 file changed, 88 insertions(+), 4 deletions(-) >>> >>> diff --git a/app/test-bbdev/test_bbdev_perf.c >>> b/app/test-bbdev/test_bbdev_perf.c >>> index 6e5535d..3554a77 100644 >>> --- a/app/test-bbdev/test_bbdev_perf.c >>> +++ b/app/test-bbdev/test_bbdev_perf.c >>> @@ -3999,12 +3999,14 @@ typedef int (test_case_function)(struct >> active_device *ad, >>> return i; >>> } >>> >>> +/* Test case for latency/validation for LDPC Decoder */ >>> static int >>> latency_test_ldpc_dec(struct rte_mempool *mempool, >>> struct test_buffers *bufs, struct rte_bbdev_dec_op *ref_op, >>> int vector_mask, uint16_t dev_id, uint16_t queue_id, >>> const uint16_t num_to_process, uint16_t burst_sz, >>> - uint64_t *total_time, uint64_t *min_time, uint64_t >> *max_time) >>> + uint64_t *total_time, uint64_t *min_time, uint64_t >> *max_time, >>> + bool disable_et) >>> { >>> int ret = TEST_SUCCESS; >>> uint16_t i, j, dequeued; >>> @@ -4026,7 +4028,7 @@ typedef int (test_case_function)(struct >> active_device *ad, >>> "rte_bbdev_dec_op_alloc_bulk() failed"); >>> >>> /* For latency tests we need to disable early termination */ >>> - if (check_bit(ref_op->ldpc_dec.op_flags, >>> + if (disable_et && check_bit(ref_op->ldpc_dec.op_flags, >>> >> RTE_BBDEV_LDPC_ITERATION_STOP_ENABLE)) >>> ref_op->ldpc_dec.op_flags -= >>> >> RTE_BBDEV_LDPC_ITERATION_STOP_ENABLE; >> Bit clearing is usually done with &= ~() > This is the coding style for rest of the file hence sticking to it. > >>> @@ -4248,7 +4250,7 @@ typedef int (test_case_function)(struct >> active_device *ad, >>> TEST_ASSERT_NOT_NULL(op_type_str, "Invalid op type: %u", >> op_type); >>> printf("+ ------------------------------------------------------- +\n"); >>> - printf("== test: validation/latency\ndev: %s, burst size: %u, num ops: >> %u, op type: %s\n", >>> + printf("== test: latency\ndev: %s, burst size: %u, num ops: %u, op >>> +type: %s\n", >>> info.dev_name, burst_sz, num_to_process, >> op_type_str); >>> if (op_type == RTE_BBDEV_OP_TURBO_DEC) @@ -4270,7 +4272,83 >> @@ >>> typedef int (test_case_function)(struct active_device *ad, >>> iter = latency_test_ldpc_dec(op_params->mp, bufs, >>> op_params->ref_dec_op, op_params- >>> vector_mask, >>> ad->dev_id, queue_id, num_to_process, >>> + burst_sz, &total_time, &min_time, >> &max_time, >>> + true); >>> + else >>> + iter = latency_test_enc(op_params->mp, bufs, >>> + op_params->ref_enc_op, >>> + ad->dev_id, queue_id, >>> + num_to_process, burst_sz, >> &total_time, >>> + &min_time, &max_time); >> This is a repeat of RTE_BBDEV_OP_TURBO_ENC. >> >> Do not need both. > Fair enough. That is part of previous code but can simplify. > >> If the point is to have a else and not fail when the op_type is unknown, then >> >> remove the earlier all and comment the else something like >> >> else /* RTE_BBDEC_OP_TURBO_ENC */ >> >>> + >>> + if (iter <= 0) >>> + return TEST_FAILED; >>> + >>> + printf("Operation latency:\n" >>> + "\tavg: %lg cycles, %lg us\n" >>> + "\tmin: %lg cycles, %lg us\n" >>> + "\tmax: %lg cycles, %lg us\n", >>> + (double)total_time / (double)iter, >>> + (double)(total_time * 1000000) / (double)iter / >>> + (double)rte_get_tsc_hz(), (double)min_time, >>> + (double)(min_time * 1000000) / >> (double)rte_get_tsc_hz(), >>> + (double)max_time, (double)(max_time * 1000000) / >>> + (double)rte_get_tsc_hz()); >> Could remove a tab from the last 9 lines for better alignment with printf > I am unsure I follow. The recommended spacing is 2 tabs for continuation and unsure how the alignment would be better. > I typically only reduce to 1 tab only if I have to (80 chars limit becoming cumbersome with nested statements). This is just an observation i don't want to get into the weeds with whitespace issues. > >>> + >>> + return TEST_SUCCESS; >>> +} >>> + >>> +static int >>> +validation_test(struct active_device *ad, >>> + struct test_op_params *op_params) >>> +{ >>> + int iter; >>> + uint16_t burst_sz = op_params->burst_sz; >>> + const uint16_t num_to_process = op_params->num_to_process; >>> + const enum rte_bbdev_op_type op_type = test_vector.op_type; >>> + const uint16_t queue_id = ad->queue_ids[0]; >>> + struct test_buffers *bufs = NULL; >>> + struct rte_bbdev_info info; >>> + uint64_t total_time, min_time, max_time; >>> + const char *op_type_str; >>> + >>> + total_time = max_time = 0; >>> + min_time = UINT64_MAX; >>> + >>> + TEST_ASSERT_SUCCESS((burst_sz > MAX_BURST), >>> + "BURST_SIZE should be <= %u", MAX_BURST); >>> + >>> + rte_bbdev_info_get(ad->dev_id, &info); >>> + bufs = &op_params- >>> q_bufs[GET_SOCKET(info.socket_id)][queue_id]; >>> + >>> + op_type_str = rte_bbdev_op_type_str(op_type); >>> + TEST_ASSERT_NOT_NULL(op_type_str, "Invalid op type: %u", >> op_type); >>> + >>> + printf("+ ------------------------------------------------------- +\n"); >>> + printf("== test: validation\ndev: %s, burst size: %u, num ops: %u, op >> type: %s\n", >>> + info.dev_name, burst_sz, num_to_process, >> op_type_str); >>> + >>> + if (op_type == RTE_BBDEV_OP_TURBO_DEC) >>> + iter = latency_test_dec(op_params->mp, bufs, >>> + op_params->ref_dec_op, op_params- >>> vector_mask, >>> + ad->dev_id, queue_id, num_to_process, >>> burst_sz, &total_time, &min_time, >> &max_time); >>> + else if (op_type == RTE_BBDEV_OP_TURBO_ENC) >>> + iter = latency_test_enc(op_params->mp, bufs, >>> + op_params->ref_enc_op, ad->dev_id, >> queue_id, >>> + num_to_process, burst_sz, &total_time, >>> + &min_time, &max_time); >>> + else if (op_type == RTE_BBDEV_OP_LDPC_ENC) >>> + iter = latency_test_ldpc_enc(op_params->mp, bufs, >>> + op_params->ref_enc_op, ad->dev_id, >> queue_id, >>> + num_to_process, burst_sz, &total_time, >>> + &min_time, &max_time); >>> + else if (op_type == RTE_BBDEV_OP_LDPC_DEC) >>> + iter = latency_test_ldpc_dec(op_params->mp, bufs, >>> + op_params->ref_dec_op, op_params- >>> vector_mask, >>> + ad->dev_id, queue_id, num_to_process, >>> + burst_sz, &total_time, &min_time, >> &max_time, >>> + false); >> This 'false' is the only change from f latency_test. >> >> These should be refactored to a common function. Then use a #define or >> similar wrapper for calling with/without this flag. > Fair enough. Thanks. I will push an update later today. Thanks.  This was the only serious thing in the patchset. Tom > >> Tom >> >>> else >>> iter = latency_test_enc(op_params->mp, bufs, >>> op_params->ref_enc_op, >>> @@ -4930,6 +5008,12 @@ typedef int (test_case_function)(struct >>> active_device *ad, } >>> >>> static int >>> +validation_tc(void) >>> +{ >>> + return run_test_case(validation_test); } >>> + >>> +static int >>> interrupt_tc(void) >>> { >>> return run_test_case(throughput_test); @@ -4960,7 +5044,7 @@ >> typedef >>> int (test_case_function)(struct active_device *ad, >>> .setup = testsuite_setup, >>> .teardown = testsuite_teardown, >>> .unit_test_cases = { >>> - TEST_CASE_ST(ut_setup, ut_teardown, latency_tc), >>> + TEST_CASE_ST(ut_setup, ut_teardown, validation_tc), >>> TEST_CASES_END() /**< NULL terminate unit test array */ >>> } >>> };