From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5CFC9A0C4E; Fri, 15 Oct 2021 15:19:31 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1E4C8411CB; Fri, 15 Oct 2021 15:19:31 +0200 (CEST) Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) by mails.dpdk.org (Postfix) with ESMTP id C72E2410F1 for ; Fri, 15 Oct 2021 15:19:29 +0200 (CEST) Received: by mail-wm1-f42.google.com with SMTP id a140-20020a1c7f92000000b0030d8315b593so2950252wmd.5 for ; Fri, 15 Oct 2021 06:19:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=crAj3rfmaoNorOj9Htsgfz8otise2z8kvoUR8zD5Mj4=; b=g597ts4c+WCSocARMPmycOA7Yhq5y8MQImM7IcGx/12sMITaKnGZKKDCalm6zPLuRV nOOpfZUmEYNh2A8QVuxFfvKptfeKIsHamS8jUOZOADdUOhC35p/DFqU5QqZEfroVT6v1 u3jXPNf608cHaBCUUVHjIheh1TM13o2rnMnt0ohHj/R0VJ8ULVz5tVJk08XyUGqgBQZm tqO0IMDwZaa8WX9DpKAy1Akz9ZMD4qCx+HbEDLZ/m7d6UVoSBAVnDPiC/RrRKrGYwpIH CgMFF6r/cey7ntk65wBSxzOPBmo06NDEoYQgedb/iBCKScJEyuQh9I/Gg1x6PWmfcTxj YeIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=crAj3rfmaoNorOj9Htsgfz8otise2z8kvoUR8zD5Mj4=; b=aTSY8/jJDTkLTquZaw4iXKEWf7JL5B8+aHgQDy6kJIMpDItY/KN0ZPeFEmIhQmrlzh Z2iJjqAnoNAzdzF4PXpdtU13ivjJEJk3uXd2aQ6G9Bezhq4wPhu36NpjmONY/fVYAeBL HLooiyq0Zv35kF2xyR6HDnGA2VFRbIXe7Z8i8psfzXZrEIcw6m5q+0d5qkga5GagSQnh wp9AxXqzeV3HZuhmtuowy5WcRLeQs6w5H2nnRdahwW+mDu3B6Af4YeOzxGd3shP8VYZ6 4X8+WWe0jxHvMTwC5lujvmtD8qR7KC9CBPdtY2hsSo5l3uQgrQlnwCPhuNPx80ahz3wS bIkQ== X-Gm-Message-State: AOAM530o7IMDcp19S6b1WP0X/Tp9hwfZTLpIgYzPb1ry+cB3UCR4mB+M ksbGqe809P4MJROlULG1PXEz4A== X-Google-Smtp-Source: ABdhPJyi0nlyK0ZqBcL2/fv5+NEQ/hJ3AqrX7HD2ZHgEmClhJdrMbewWEToMr5o+T6qoDWnKyPOJYg== X-Received: by 2002:a05:600c:b41:: with SMTP id k1mr26246165wmr.4.1634303969511; Fri, 15 Oct 2021 06:19:29 -0700 (PDT) Received: from 6wind.com ([2a01:e0a:5ac:6460:c065:401d:87eb:9b25]) by smtp.gmail.com with ESMTPSA id q14sm10409912wmq.4.2021.10.15.06.19.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Oct 2021 06:19:28 -0700 (PDT) Date: Fri, 15 Oct 2021 15:19:28 +0200 From: Olivier Matz To: Dmitry Kozlyuk Cc: dev@dpdk.org, Andrew Rybchenko , Matan Azrad Message-ID: References: <20211012000409.2751908-1-dkozlyuk@nvidia.com> <20211013110131.2909604-1-dkozlyuk@nvidia.com> <20211013110131.2909604-3-dkozlyuk@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211013110131.2909604-3-dkozlyuk@nvidia.com> Subject: Re: [dpdk-dev] [PATCH v4 2/4] mempool: add non-IO flag X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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 Dmitry, On Wed, Oct 13, 2021 at 02:01:29PM +0300, Dmitry Kozlyuk wrote: > Mempool is a generic allocator that is not necessarily used for device > IO operations and its memory for DMA. Add MEMPOOL_F_NON_IO flag to mark > such mempools automatically if their objects are not contiguous > or IOVA are not available. Components can inspect this flag > in order to optimize their memory management. > Discussion: https://mails.dpdk.org/archives/dev/2021-August/216654.html > > Signed-off-by: Dmitry Kozlyuk > Acked-by: Matan Azrad > --- > app/test/test_mempool.c | 76 ++++++++++++++++++++++++++ > doc/guides/rel_notes/release_21_11.rst | 3 + > lib/mempool/rte_mempool.c | 2 + > lib/mempool/rte_mempool.h | 5 ++ > 4 files changed, 86 insertions(+) > > diff --git a/app/test/test_mempool.c b/app/test/test_mempool.c > index bc0cc9ed48..15146dd737 100644 > --- a/app/test/test_mempool.c > +++ b/app/test/test_mempool.c > @@ -672,6 +672,74 @@ test_mempool_events_safety(void) > return 0; > } > > +static int > +test_mempool_flag_non_io_set_when_no_iova_contig_set(void) > +{ > + struct rte_mempool *mp; > + int ret; > + > + mp = rte_mempool_create_empty("empty", MEMPOOL_SIZE, > + MEMPOOL_ELT_SIZE, 0, 0, > + SOCKET_ID_ANY, MEMPOOL_F_NO_IOVA_CONTIG); > + RTE_TEST_ASSERT_NOT_NULL(mp, "Cannot create mempool: %s", > + rte_strerror(rte_errno)); > + rte_mempool_set_ops_byname(mp, rte_mbuf_best_mempool_ops(), NULL); > + ret = rte_mempool_populate_default(mp); > + RTE_TEST_ASSERT(ret > 0, "Failed to populate mempool: %s", > + rte_strerror(rte_errno)); > + RTE_TEST_ASSERT(mp->flags & MEMPOOL_F_NON_IO, > + "NON_IO flag is not set when NO_IOVA_CONTIG is set"); > + rte_mempool_free(mp); > + return 0; > +} One comment that also applies to the previous patch. Using RTE_TEST_ASSERT_*() is convenient to test a condition, display an error message and return on error in one operation. But here it can cause a leak on test failure. I don't know what is the best approach to solve the issue. Having equivalent test macros that do "goto fail" instead of "return -1" would help here. I mean something like: RTE_TEST_ASSERT_GOTO_*(cond, label, fmt, ...) What do you think?