From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f194.google.com (mail-wr0-f194.google.com [209.85.128.194]) by dpdk.org (Postfix) with ESMTP id B8D3F58CE for ; Sat, 27 Jan 2018 15:53:52 +0100 (CET) Received: by mail-wr0-f194.google.com with SMTP id g21so2852163wrb.13 for ; Sat, 27 Jan 2018 06:53:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=nG6gqvNYEkDWAh8sTVF0Makh2+DffGmLYwEUkR8mOYA=; b=cr0Ye9AMRHjTDV8uT2TQkXPWVTq8q/ansC3pmK+e5cU0TffWb1Wkd7j4ku4jee/JUE MeWYC24okybuWNDULf2GIAP+i2nn2wuKbvstSuwPpzBMYbqceJ8jdQ/DDEdRnz4nEcgc 4FKlcqASmlpNOIJdzkQj17teEZtN2LEmoCjfk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=nG6gqvNYEkDWAh8sTVF0Makh2+DffGmLYwEUkR8mOYA=; b=G+rl762WwtHPN/1fzlhGuYkbGKwrJccj5q3zFmf0wLcpOCeJntLbt0Gbvd86MsljbH VQf9pKVxrOQjPEF2EHtmIQdnk3AkARddO9PhDt/cLO8CMsSzDmL4bTh2HkIlg0wEo7Si ZcOVwj4a3oEC6QND7v3QjKjc4Un3MSF9PFy3LcwFR2hODebKd4Xs3XP+KzdHhat+Ubw7 HGbdrvfKxGOxgq0xzPWJ5fbXTD9OX7eH/dnV16lguwFRH1wXiDRFuVt7tCP/NS56UPdo 0KTKWjKZ1fVT42cFzX9YNnKOsUNDKh8c1EuwTd1+HA5aBMTJBiwzir0sZ+UTHn4dtxz8 KoAA== X-Gm-Message-State: AKwxytdAdZGycNLAphg4h0Tp4MDkjS8rGg7I7vCdTC/vIGkgDkWpoRBe GuC2HI/yXyRc7MO+wnYKB4Acl6FEWqR5cmeAKqcoaA== X-Google-Smtp-Source: AH8x227/+HOF83l2eHZ0kJYhjqh3qDhFTxWDRHw/h5JgX8BunkzgVoCR5Y0HIKv7yrZbiwOFgUibesATx1eEdBT0TzY= X-Received: by 10.223.139.10 with SMTP id n10mr15448882wra.23.1517064832435; Sat, 27 Jan 2018 06:53:52 -0800 (PST) MIME-Version: 1.0 Received: by 10.223.167.10 with HTTP; Sat, 27 Jan 2018 06:53:32 -0800 (PST) In-Reply-To: References: From: Radoslaw Biernacki Date: Sat, 27 Jan 2018 15:53:32 +0100 Message-ID: To: Anatoly Burakov Cc: dev@dpdk.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH 1/2] test/memzone: add test for memzone count in eal mem config 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: , X-List-Received-Date: Sat, 27 Jan 2018 14:53:52 -0000 Looks OK. Following note is aside from the patch. Might be beneficial (in some rare cases) to add bailout recovery with goto's in test_memzone_basic() Just in case one of the rte_memzone_reserve() we should not make return -1, but instead a goto to below section where we call rte_memzone_free(). This way we would be able to free only the allocated memzones and prevent leaking out those memzones to other tests. Reviewed-by: Radoslaw Biernacki adoslaw.biernacki@linaro.com> On 26 January 2018 at 18:40, Anatoly Burakov wrote: > Ensure that memzone count in eal mem config is incremented and > decremented whenever memzones are allocated and freed. > > Signed-off-by: Anatoly Burakov > --- > test/test/test_memzone.c | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > > diff --git a/test/test/test_memzone.c b/test/test/test_memzone.c > index f6c9b56..00d340f 100644 > --- a/test/test/test_memzone.c > +++ b/test/test/test_memzone.c > @@ -841,6 +841,9 @@ test_memzone_basic(void) > const struct rte_memzone *memzone3; > const struct rte_memzone *memzone4; > const struct rte_memzone *mz; > + int memzone_cnt_after, memzone_cnt_expected; > + int memzone_cnt_before = > + rte_eal_get_configuration()-> > mem_config->memzone_cnt; > > memzone1 = rte_memzone_reserve("testzone1", 100, > SOCKET_ID_ANY, 0); > @@ -858,6 +861,18 @@ test_memzone_basic(void) > if (memzone1 == NULL || memzone2 == NULL || memzone4 == NULL) > return -1; > > + /* check how many memzones we are expecting */ > + memzone_cnt_expected = memzone_cnt_before + > + (memzone1 != NULL) + (memzone2 != NULL) + > + (memzone3 != NULL) + (memzone4 != NULL); > + > + memzone_cnt_after = > + rte_eal_get_configuration()-> > mem_config->memzone_cnt; > + > + if (memzone_cnt_after != memzone_cnt_expected) > + return -1; > + > + > rte_memzone_dump(stdout); > > /* check cache-line alignments */ > @@ -930,6 +945,11 @@ test_memzone_basic(void) > return -1; > } > > + memzone_cnt_after = > + rte_eal_get_configuration()-> > mem_config->memzone_cnt; > + if (memzone_cnt_after != memzone_cnt_before) > + return -1; > + > return 0; > } > > -- > 2.7.4 >