From: "Jozwiak, TomaszX" <tomaszx.jozwiak@intel.com>
To: "Verma, Shally" <Shally.Verma@cavium.com>,
"dev@dpdk.org" <dev@dpdk.org>,
"Trahe, Fiona" <fiona.trahe@intel.com>,
"akhil.goyal@nxp.com" <akhil.goyal@nxp.com>
Subject: Re: [dpdk-dev] [PATCH v2 2/3] app/compress-perf: add performance measurement
Date: Wed, 7 Nov 2018 10:14:39 +0000 [thread overview]
Message-ID: <CA70B6012E3ADB4184D44E025E5FF01B4CCB826F@HASMSX112.ger.corp.intel.com> (raw)
In-Reply-To: <SN6PR07MB5152FC8B66E19855D64177E8F0CB0@SN6PR07MB5152.namprd07.prod.outlook.com>
> -----Original Message-----
> From: Verma, Shally [mailto:Shally.Verma@cavium.com]
> Sent: Tuesday, November 6, 2018 4:37 PM
> To: Jozwiak, TomaszX <tomaszx.jozwiak@intel.com>; dev@dpdk.org; Trahe,
> Fiona <fiona.trahe@intel.com>; akhil.goyal@nxp.com
> Subject: RE: [PATCH v2 2/3] app/compress-perf: add performance
> measurement
>
>
>
> >-----Original Message-----
> >From: Jozwiak, TomaszX <tomaszx.jozwiak@intel.com>
> >Sent: 06 November 2018 14:19
> >To: Verma, Shally <Shally.Verma@cavium.com>; dev@dpdk.org; Trahe,
> Fiona
> ><fiona.trahe@intel.com>; akhil.goyal@nxp.com
> >Subject: RE: [PATCH v2 2/3] app/compress-perf: add performance
> >measurement
> >
> >External Email
> >
> >> -----Original Message-----
> >> From: Verma, Shally [mailto:Shally.Verma@cavium.com]
> >> Sent: Monday, November 5, 2018 9:57 AM
> >> To: Jozwiak, TomaszX <tomaszx.jozwiak@intel.com>; dev@dpdk.org;
> >> Trahe, Fiona <fiona.trahe@intel.com>; akhil.goyal@nxp.com
> >> Subject: RE: [PATCH v2 2/3] app/compress-perf: add performance
> >> measurement
> >>
> >>
> >>
> >> >-----Original Message-----
> >> >From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
> >> >Sent: 02 November 2018 15:14
> >> >To: dev@dpdk.org; fiona.trahe@intel.com; tomaszx.jozwiak@intel.com;
> >> >Verma, Shally <Shally.Verma@cavium.com>; akhil.goyal@nxp.com
> >> >Subject: [PATCH v2 2/3] app/compress-perf: add performance
> >> measurement
> >> >
> >> >External Email
> >> >
> >> >Added performance measurement part into compression perf. test.
> >> >
> >> >Signed-off-by: De Lara Guarch, Pablo
> >> ><pablo.de.lara.guarch@intel.com>
> >> >Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
> >> >---
> >> > app/test-compress-perf/comp_perf_options_parse.c | 8 +-
> >> > app/test-compress-perf/main.c | 886
> >> ++++++++++++++++++++++-
> >> > 2 files changed, 883 insertions(+), 11 deletions(-)
> >> >
> >> >diff --git a/app/test-compress-perf/comp_perf_options_parse.c
> >> >b/app/test-compress-perf/comp_perf_options_parse.c
> >> >index bef4d2f..e5da3ad 100644
> >> >--- a/app/test-compress-perf/comp_perf_options_parse.c
> >> >+++ b/app/test-compress-perf/comp_perf_options_parse.c
> >> >@@ -431,10 +431,6 @@ parse_huffman_enc(struct comp_test_data
> >> *test_data, const char *arg)
> >> > {
> >> > "fixed",
> >> > RTE_COMP_HUFFMAN_FIXED
> >> >- },
> >> >- {
> >> >- "dynamic",
> >> >- RTE_COMP_HUFFMAN_DYNAMIC
> >> > }
> >> > };
> >> >
> >> >@@ -569,9 +565,9 @@ comp_perf_options_default(struct
> comp_test_data
> >> *test_data)
> >> > test_data->seg_sz = 2048;
> >> > test_data->burst_sz = 32;
> >> > test_data->pool_sz = 8192;
> >> >- test_data->max_sgl_segs = UINT16_MAX;
> >> >+ test_data->max_sgl_segs = 16;
> >> > test_data->num_iter = 10000;
> >> >- test_data->huffman_enc = RTE_COMP_HUFFMAN_DYNAMIC;
> >> >+ test_data->huffman_enc = RTE_COMP_HUFFMAN_FIXED;
> >> > test_data->test_op = COMPRESS_DECOMPRESS;
> >> > test_data->window_sz = -1;
> >> > test_data->level.min = 1;
> >> >diff --git a/app/test-compress-perf/main.c
> >> >b/app/test-compress-perf/main.c index f52b98d..e3f4bf6 100644
> >> >--- a/app/test-compress-perf/main.c
> >> >+++ b/app/test-compress-perf/main.c
> >> >@@ -5,14 +5,728 @@
> >> > #include <rte_malloc.h>
> >> > #include <rte_eal.h>
> >> > #include <rte_log.h>
> >> >+#include <rte_cycles.h>
> >> > #include <rte_compressdev.h>
> >> >
> >> > #include "comp_perf_options.h"
> >> >
> >> >+#define NUM_MAX_XFORMS 16
> >> >+#define NUM_MAX_INFLIGHT_OPS 512
> >> >+#define EXPANSE_RATIO 1.05
> >> >+#define MIN_ISAL_SIZE 8
> >> Can we avoid ISAL specific naming ?
> >
> >TJ: yes true :) will be fixed in V3
> >
> >
> >
> >
> >> >+
> >> >+#define DIV_CEIL(a, b) ((a) / (b) + ((a) % (b) != 0))
> >> >+
> >> >+/* Cleanup state machine */
> >> >+static enum cleanup_st {
> >> >+ ST_CLEAR = 0,
> >> >+ ST_TEST_DATA,
> >> >+ ST_COMPDEV,
> >> >+ ST_INPUT_DATA,
> >> >+ ST_MEMORY_ALLOC,
> >> >+ ST_PREPARE_BUF,
> >> >+ ST_DURING_TEST
> >> >+} cleanup = ST_CLEAR;
> >> >+
> >> >+static int
> >> >+param_range_check(uint16_t size, const struct rte_param_log2_range
> >> >+*range) {
> >> >+ unsigned int next_size;
> >> >+
> >> >+ /* Check lower/upper bounds */
> >> >+ if (size < range->min)
> >> >+ return -1;
> >> >+
> >> >+ if (size > range->max)
> >> >+ return -1;
> >> >+
> >> >+ /* If range is actually only one value, size is correct */
> >> >+ if (range->increment == 0)
> >> >+ return 0;
> >> >+
> >> >+ /* Check if value is one of the supported sizes */
> >> >+ for (next_size = range->min; next_size <= range->max;
> >> >+ next_size += range->increment)
> >> >+ if (size == next_size)
> >> >+ return 0;
> >> >+
> >> >+ return -1;
> >> >+}
> >> >+
> >> >+static int
> >> >+comp_perf_check_capabilities(struct comp_test_data *test_data) {
> >> >+ const struct rte_compressdev_capabilities *cap;
> >> >+
> >> >+ cap = rte_compressdev_capability_get(test_data->cdev_id,
> >> >+ RTE_COMP_ALGO_DEFLATE);
> >> >+
> >> >+ if (cap == NULL) {
> >> >+ RTE_LOG(ERR, USER1,
> >> >+ "Compress device does not support DEFLATE\n");
> >> >+ return -1;
> >> >+ }
> >> >+
> >> >+ uint64_t comp_flags = cap->comp_feature_flags;
> >> >+
> >> >+ /* Huffman enconding */
> >> >+ if (test_data->huffman_enc == RTE_COMP_HUFFMAN_FIXED &&
> >> >+ (comp_flags & RTE_COMP_FF_HUFFMAN_FIXED) == 0) {
> >> >+ RTE_LOG(ERR, USER1,
> >> >+ "Compress device does not supported Fixed Huffman\n");
> >> >+ return -1;
> >> >+ }
> >> >+
> >> >+ if (test_data->huffman_enc == RTE_COMP_HUFFMAN_DYNAMIC
> &&
> >> >+ (comp_flags & RTE_COMP_FF_HUFFMAN_DYNAMIC) == 0)
> {
> >> >+ RTE_LOG(ERR, USER1,
> >> >+ "Compress device does not supported Dynamic
> Huffman\n");
> >> >+ return -1;
> >> >+ }
> >> >+
> >> >+ /* Window size */
> >> >+ if (test_data->window_sz != -1) {
> >> >+ if (param_range_check(test_data->window_sz, &cap-
> >> >window_size)
> >> >+ < 0) {
> >> >+ RTE_LOG(ERR, USER1,
> >> >+ "Compress device does not support "
> >> >+ "this window size\n");
> >> >+ return -1;
> >> >+ }
> >> >+ } else
> >> >+ /* Set window size to PMD maximum if none was specified */
> >> >+ test_data->window_sz = cap->window_size.max;
> >> >+
> >> >+ /* Check if chained mbufs is supported */
> >> >+ if (test_data->max_sgl_segs > 1 &&
> >> >+ (comp_flags & RTE_COMP_FF_OOP_SGL_IN_SGL_OUT) ==
> 0) {
> >> >+ RTE_LOG(INFO, USER1, "Compress device does not support "
> >> >+ "chained mbufs. Max SGL segments set to 1\n");
> >> >+ test_data->max_sgl_segs = 1;
> >> >+ }
> >> >+
> >> >+ /* Level 0 support */
> >> >+ if (test_data->level.min == 0 &&
> >> >+ (comp_flags &
> >> >+ RTE_COMP_FF_NONCOMPRESSED_BLOCKS) ==
> >> 0) {
> >> >+ RTE_LOG(ERR, USER1, "Compress device does not support "
> >> >+ "level 0 (no compression)\n");
> >> >+ return -1;
> >> >+ }
> >> >+
> >> >+ return 0;
> >> >+}
> >> >+
> >> >+static int
> >> >+comp_perf_allocate_memory(struct comp_test_data *test_data) {
> >> >+ /* Number of segments for input and output
> >> >+ * (compression and decompression)
> >> >+ */
> >> >+ uint32_t total_segs = DIV_CEIL(test_data->input_data_sz,
> >> >+ test_data->seg_sz);
> >> >+ test_data->comp_buf_pool =
> >> rte_pktmbuf_pool_create("comp_buf_pool",
> >> >+ total_segs,
> >> >+ 0, 0, test_data->seg_sz + RTE_PKTMBUF_HEADROOM,
> >> >+ rte_socket_id());
> >> >+ if (test_data->comp_buf_pool == NULL) {
> >> >+ RTE_LOG(ERR, USER1, "Mbuf mempool could not be
> created\n");
> >> >+ return -1;
> >> >+ }
> >> >+
> >> >+ cleanup = ST_MEMORY_ALLOC;
> >> >+ test_data->decomp_buf_pool =
> >> rte_pktmbuf_pool_create("decomp_buf_pool",
> >> >+ total_segs,
> >> >+ 0, 0, test_data->seg_sz + RTE_PKTMBUF_HEADROOM,
> >> >+ rte_socket_id());
> >> >+ if (test_data->decomp_buf_pool == NULL) {
> >> >+ RTE_LOG(ERR, USER1, "Mbuf mempool could not be
> created\n");
> >> >+ return -1;
> >> >+ }
> >> Unless am missing to see it, you need to free pre-allocated memories
> >> here before return call for all failed cases.
> >
> >TJ: There's only one 'freeing stack' at the end of main application
> >function to avoid double freeing resources (which was previously n V1).
> >We have state machine for that stuff (static enum cleanup_st) to know
> what should be free and what has been allocated already.
> >In case you mean the state machine is set just after first alloc in line 136:
> >
> >cleanup = ST_MEMORY_ALLOC;
> >
> >so we know what should be free at the end of application running in line
> 891:
> >
> >end:
> > switch (cleanup) {
> >
> > case ST_DURING_TEST:
> > case ST_PREPARE_BUF:
> > free_bufs(test_data);
> > /* fallthrough */
> > case ST_MEMORY_ALLOC:
> > rte_free(test_data->decomp_bufs);
> Even if we are in this state but it doesn't guarantee all of the buffers in this
> state are allocated. So shouldn't every pointer be null-checked before?
> Thanks
> Shally
This check is inside free function already - not need to add double check.
Thx, Tomek
next prev parent reply other threads:[~2018-11-07 10:14 UTC|newest]
Thread overview: 76+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-01 13:27 [dpdk-dev] [PATCH 0/3] app: add initial version of compress-perf Tomasz Jozwiak
2018-10-01 13:27 ` [dpdk-dev] [PATCH 1/3] app/compress-perf: add parser Tomasz Jozwiak
2018-10-01 13:27 ` [dpdk-dev] [PATCH 2/3] app/compress-perf: add performance measurement Tomasz Jozwiak
2018-10-12 10:15 ` Verma, Shally
2018-10-15 15:10 ` Daly, Lee
2018-10-16 5:18 ` Verma, Shally
2018-10-17 14:33 ` Trahe, Fiona
2018-10-17 15:42 ` Verma, Shally
2018-10-17 16:45 ` Trahe, Fiona
2018-10-17 16:47 ` Verma, Shally
2018-11-30 14:43 ` Jozwiak, TomaszX
2018-12-02 6:39 ` Verma, Shally
2018-12-05 8:51 ` Jozwiak, TomaszX
2018-11-02 9:59 ` Jozwiak, TomaszX
2018-11-05 8:34 ` Verma, Shally
2018-11-06 8:04 ` Jozwiak, TomaszX
2018-11-06 8:15 ` Verma, Shally
2018-11-06 9:05 ` Jozwiak, TomaszX
2018-11-06 15:39 ` Verma, Shally
2018-11-07 10:18 ` Jozwiak, TomaszX
2018-11-10 0:54 ` Trahe, Fiona
2018-11-12 4:45 ` Verma, Shally
2018-10-01 13:27 ` [dpdk-dev] [PATCH 3/3] doc/guides/tools: add doc file Tomasz Jozwiak
2018-10-16 9:26 ` Kovacevic, Marko
2018-11-02 9:43 ` [dpdk-dev] [PATCH v2 0/3] add initial version of compress-perf Tomasz Jozwiak
2018-11-02 9:44 ` [dpdk-dev] [PATCH v2 1/3] app/compress-perf: add parser Tomasz Jozwiak
2018-11-05 8:40 ` Verma, Shally
2018-11-06 8:30 ` Jozwiak, TomaszX
2018-11-06 8:32 ` Verma, Shally
2018-11-02 9:44 ` [dpdk-dev] [PATCH v2 2/3] app/compress-perf: add performance measurement Tomasz Jozwiak
2018-11-05 8:56 ` Verma, Shally
2018-11-06 8:49 ` Jozwiak, TomaszX
2018-11-06 15:37 ` Verma, Shally
2018-11-07 10:14 ` Jozwiak, TomaszX [this message]
2018-11-02 9:44 ` [dpdk-dev] [PATCH v2 3/3] doc/guides/tools: add doc files Tomasz Jozwiak
2018-11-05 8:57 ` Verma, Shally
2018-11-06 8:51 ` Jozwiak, TomaszX
2018-11-02 11:04 ` [dpdk-dev] [PATCH v2 0/3] add initial version of compress-perf Bruce Richardson
2018-11-02 11:12 ` Jozwiak, TomaszX
2018-11-23 13:06 ` [dpdk-dev] [PATCH v3 0/5] " Tomasz Jozwiak
2018-11-23 13:06 ` [dpdk-dev] [PATCH v3 1/5] app/compress-perf: add parser Tomasz Jozwiak
2018-11-23 13:06 ` [dpdk-dev] [PATCH v3 2/5] app/compress-perf: add performance measurement Tomasz Jozwiak
2018-11-23 13:06 ` [dpdk-dev] [PATCH v3 3/5] doc/guides/tools: add doc files Tomasz Jozwiak
2018-11-23 14:52 ` Varghese, Vipin
2018-11-23 14:59 ` Jozwiak, TomaszX
2018-11-23 13:06 ` [dpdk-dev] [PATCH v3 4/5] app/compress-perf: add dynamic compression test Tomasz Jozwiak
2018-11-23 13:06 ` [dpdk-dev] [PATCH v3 5/5] app/compress-perf: code refactoring Tomasz Jozwiak
2018-11-23 14:27 ` [dpdk-dev] [PATCH v4 0/5] add initial version of compress-perf Tomasz Jozwiak
2018-11-23 14:27 ` [dpdk-dev] [PATCH v4 1/5] app/compress-perf: add parser Tomasz Jozwiak
2018-11-23 15:10 ` Varghese, Vipin
2018-11-23 15:24 ` Bruce Richardson
2018-11-23 15:42 ` Jozwiak, TomaszX
2018-11-23 14:27 ` [dpdk-dev] [PATCH v4 2/5] app/compress-perf: add performance measurement Tomasz Jozwiak
2018-11-23 14:27 ` [dpdk-dev] [PATCH v4 3/5] doc/guides/tools: add doc files Tomasz Jozwiak
2018-11-23 15:00 ` Varghese, Vipin
2018-11-23 15:12 ` Jozwiak, TomaszX
2018-11-23 15:26 ` Varghese, Vipin
2018-11-23 14:27 ` [dpdk-dev] [PATCH v4 4/5] app/compress-perf: add dynamic compression test Tomasz Jozwiak
2018-11-23 14:27 ` [dpdk-dev] [PATCH v4 5/5] app/compress-perf: code refactoring Tomasz Jozwiak
2018-12-05 8:47 ` [dpdk-dev] [PATCH v5 0/5] add initial version of compress-perf Tomasz Jozwiak
2018-12-05 8:47 ` [dpdk-dev] [PATCH v5 1/5] app/compress-perf: add parser Tomasz Jozwiak
2018-12-05 8:47 ` [dpdk-dev] [PATCH v5 2/5] app/compress-perf: add performance measurement Tomasz Jozwiak
2018-12-05 8:47 ` [dpdk-dev] [PATCH v5 3/5] doc/guides/tools: add doc files Tomasz Jozwiak
2018-12-05 8:47 ` [dpdk-dev] [PATCH v5 4/5] app/compress-perf: add dynamic compression test Tomasz Jozwiak
2018-12-05 8:47 ` [dpdk-dev] [PATCH v5 5/5] app/compress-perf: code refactoring Tomasz Jozwiak
2018-12-05 15:37 ` [dpdk-dev] [PATCH v5 0/5] add initial version of compress-perf Daly, Lee
2018-12-12 11:54 ` [dpdk-dev] [PATCH v6 " Tomasz Jozwiak
2018-12-17 11:11 ` Verma, Shally
2018-12-12 12:08 ` Tomasz Jozwiak
2018-12-12 12:08 ` [dpdk-dev] [PATCH v6 1/5] app/compress-perf: add parser Tomasz Jozwiak
2018-12-12 12:08 ` [dpdk-dev] [PATCH v6 2/5] app/compress-perf: add performance measurement Tomasz Jozwiak
2018-12-12 12:08 ` [dpdk-dev] [PATCH v6 3/5] doc/guides/tools: add doc files Tomasz Jozwiak
2018-12-12 12:08 ` [dpdk-dev] [PATCH v6 4/5] app/compress-perf: add dynamic compression test Tomasz Jozwiak
2018-12-12 12:08 ` [dpdk-dev] [PATCH v6 5/5] app/compress-perf: code refactoring Tomasz Jozwiak
2018-12-14 19:24 ` [dpdk-dev] [PATCH v6 0/5] add initial version of compress-perf Trahe, Fiona
2018-12-18 10:28 ` Akhil Goyal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CA70B6012E3ADB4184D44E025E5FF01B4CCB826F@HASMSX112.ger.corp.intel.com \
--to=tomaszx.jozwiak@intel.com \
--cc=Shally.Verma@cavium.com \
--cc=akhil.goyal@nxp.com \
--cc=dev@dpdk.org \
--cc=fiona.trahe@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).