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 A9DCDA0487 for ; Sun, 30 Jun 2019 23:02:58 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B76651BA9E; Sun, 30 Jun 2019 23:02:56 +0200 (CEST) Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182]) by dpdk.org (Postfix) with ESMTP id 635101BA9A for ; Sun, 30 Jun 2019 23:02:55 +0200 (CEST) Received: by mail-lj1-f182.google.com with SMTP id k18so10905138ljc.11 for ; Sun, 30 Jun 2019 14:02:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=x+OMSU+QKgvbdaCUw3MfUIuus0NXdj64rdps6Y4ZJYY=; b=Wtl3jC1srf8hnPq6+FuqYpnv38qrTTDXdG6Cd5KYQ502YRqoc2w2B2vSA736pA38zC Pa84YbCHbJI2n0JRASsNSwF7UVcfZCIIwgma5dkgtWR5MXNL5j2zUsx5FHxvp+TE3uvV lqr9HcYakY2fuqKJe7F7e5clVg/63tRZFSZUhrbH2CqMB0T33ol+k/rV+BweLVuIS007 wRW/pgeMFOnKCrupx3gLCDKrPojgQ1DprRJB0Sn60adIB5Wn/vjiuEgd9ogJlYQHvjZR hAaBw5u1ywx8Z9ikkvC6On9V01aAsDWDULXKCgkY5+rffst39fwiqMYloDo3gcaC3w8R HVvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=x+OMSU+QKgvbdaCUw3MfUIuus0NXdj64rdps6Y4ZJYY=; b=FTw434n3v5LWTAaq9rD93bdzZ1TQB/R1sJptA16B/zqGI4ZzjCAo/UIZ8LXWPMInSl q84De+cV99zA6oLukcc0X+cnxXDQSdjZrerQBn/w1N3gCWGaRT7lpQa0MC5VUyvBZIMK xCUHPTJDNGw0jtOgxP/OsT64gq2vs6CEB/96qPR23Y/7w+sW8J2dNx8zF8k+/WbNXgbB OMJpWpdXMedrLHnhLj5822MPhqDGC7Veswruz2tEK2o6syPRYi012lg4R7NnMpHqqSzo Ek2w1wYBc8ZoEXqNBQ6uFtn0NZ3EUSIO3xIy60d1jzI3bk/SaGp0h/a7GkxfzSLWJR5f abBg== X-Gm-Message-State: APjAAAWMkqzpkR76P1IPmbYr8UxBf/D1NkRhnKffz9sUZVg4ZfqYeBuH EtpMtgdqFyR5zMCqh8fNa9c= X-Google-Smtp-Source: APXvYqx55/Dy2iWECImEwv/Kp8S9HdV9nChctDA6nGC6jDYIlb8IILI3tiwe0sdM9guDxWIe3+BauQ== X-Received: by 2002:a2e:9610:: with SMTP id v16mr11679195ljh.229.1561928574752; Sun, 30 Jun 2019 14:02:54 -0700 (PDT) Received: from [192.168.10.101] (user-94-254-233-31.play-internet.pl. [94.254.233.31]) by smtp.gmail.com with ESMTPSA id v21sm2849495lje.10.2019.06.30.14.02.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 30 Jun 2019 14:02:54 -0700 (PDT) To: Shally Verma , "dev@dpdk.org" , "fiona.trahe@intel.com" , "arturx.trybula@intel.com" References: <1561566633-12329-1-git-send-email-tjozwiakgm@gmail.com> <1561674337-22086-1-git-send-email-tjozwiakgm@gmail.com> <1561674337-22086-4-git-send-email-tjozwiakgm@gmail.com> From: Tomasz Jozwiak Message-ID: <1b1a4fb3-f44d-2118-4175-c3771aac0d98@gmail.com> Date: Sun, 30 Jun 2019 23:02:52 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.1 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [EXT] [PATCH v4 3/6] app/test-compress-perf: add verification test case 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" Hi Shally, Thx for the review. My comments below: > >> -----Original Message----- >> From: Tomasz Jozwiak >> Sent: Friday, June 28, 2019 3:56 AM >> To: dev@dpdk.org; fiona.trahe@intel.com; tjozwiakgm@gmail.com; Shally >> Verma ; arturx.trybula@intel.com >> Subject: [EXT] [PATCH v4 3/6] app/test-compress-perf: add verification test >> case >> >> External Email >> >> ---------------------------------------------------------------------- >> From: Tomasz Jozwiak > ... > >> diff --git a/app/test-compress-perf/comp_perf_test_verify.c b/app/test- >> compress-perf/comp_perf_test_verify.c >> index 28a0fe8..c2aab70 100644 >> --- a/app/test-compress-perf/comp_perf_test_verify.c >> +++ b/app/test-compress-perf/comp_perf_test_verify.c >> @@ -8,14 +8,48 @@ >> #include >> >> #include "comp_perf_test_verify.h" >> +#include "comp_perf_test_common.h" >> + >> +void >> +cperf_verify_test_destructor(void *arg) { >> + if (arg) { >> + comp_perf_free_memory(&((struct cperf_verify_ctx *)arg)- >>> mem); >> + rte_free(arg); >> + } >> +} >> + >> +void * >> +cperf_verify_test_constructor(uint8_t dev_id, uint16_t qp_id, >> + struct comp_test_data *options) >> +{ >> + struct cperf_verify_ctx *ctx = NULL; >> + >> + ctx = rte_malloc(NULL, sizeof(struct cperf_verify_ctx), 0); >> + > Better just return from here [Tomek]. Yes you right. we wasn't able to allocate 'cperf_verify_ctx struct', so we don't need to call destructor here. I assume there's the same issue in benchmark patch - will align both in V5. Thx. > >> + if (ctx != NULL) { >> + ctx->mem.dev_id = dev_id; >> + ctx->mem.qp_id = qp_id; >> + ctx->options = options; >> + >> + if (!comp_perf_allocate_memory(ctx->options, &ctx->mem) >> && >> + !prepare_bufs(ctx->options, &ctx->mem)) >> + return ctx; > What if condition fails on comp_per_allocate_memory(), then it will go to verify_test_destructor(), so comp_perf_free_memory() check if mem != NULL before calling actual free? [Tomek] I mean it's ok. Please take in to account that we was able to allocate 'cperf_verify_ctx struct' - cause ctx != NULL here. that means 'mem struct' inside 'cperf_verify_ctx struct' exists for sure: struct cperf_verify_ctx { *struct cperf_mem_resources mem;*     struct comp_test_data *options;     int silent;     size_t comp_data_sz;     size_t decomp_data_sz;     double ratio; }; and all fields inside 'struct cperf_mem_resources mem' are zeroed. We don't need to check mem != NULL before free, because in this place mem != NULL for sure. Also it's ok to call 'rte_free', 'rte_mempool_free' and 'rte_pktmbuf_free' with NULL ptr. as a argument because the check is inside all of these functions. Thx for the comments. -- Tomek