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 C680C46130; Fri, 24 Jan 2025 19:18:11 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D8E8B42DC9; Fri, 24 Jan 2025 19:17:31 +0100 (CET) Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by mails.dpdk.org (Postfix) with ESMTP id E4750427E5 for ; Fri, 24 Jan 2025 19:17:24 +0100 (CET) Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-21669fd5c7cso43748775ad.3 for ; Fri, 24 Jan 2025 10:17:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1737742644; x=1738347444; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=F3bIn/d1N16rdlLN2NLsU1uSkVbqKA+eN9u/q92Mt5Y=; b=MjFIbmV4IyR6+UEl8o5Jq2WA0qwKroXznxSeBIkH132nk9ZZWJFSwmsQZml+AoM/ct gcbxfq4TuEUpwFO1WNPO+rnJX9ejSp4INqo9Mc/8cUtERp+TmSEcl2MANjZXe0Rtn4q6 aXN0ZE2bhUEsyk9iWgKnZsXe8/3uEJV14ye+zbK47D8N/hVUM3EBKKVYyvd6T/SJnQwG bj+RdzsAXzrmUS/wyZX1hDA6SIrCFotwbuhdIzNDacxGdGpNcqKP34fQgp8IXTpZvhqu BTdaVR2cdkUQSVL9MdUwQJNu9+MGl5Tyhlc0g2yOqyz8LWoXVUcXRKADcWOkfK8HLStj 2fbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737742644; x=1738347444; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=F3bIn/d1N16rdlLN2NLsU1uSkVbqKA+eN9u/q92Mt5Y=; b=ZAdT0NKa61kZnd5BkD4Oq83JpcbnFqPm+fssezuHyR7msJTkjTu1heNzlqRj+ZNwdX /XC5sgrkZnR/wjY4KzcT5zLt5Zeej0PxxQ0zHzi96052TC4O117XWLBZNLlA03rL++Yz QbLHEf4nzlMgHwHJIoUgraXPr8Syak5RYk1yLkq9S8sILwdx8U9AaD2MBOJxpCCwgFvo 6mul6Cn7rDZEY0S/DIWeyH9b8gHHW3BUvmmnksewn/roy51sKh5T87vTQVqfZ46W5/K5 iGx+2vcVdqLmpEmE1DzB1JECPzxG9NNqwF/eRvA893ScGg5Nd79FQbCnDSnomuzjcsgu dNHQ== X-Gm-Message-State: AOJu0YzAOWkYRC0JDaVNIT/8CW96Vn2bTHR8gUBnTIY1k02IJ/wR6AuD P95v1L+1cm86nKQPX2PsivUIgIehul15Q0MZXunDNzmUUAvwAXn5s69ENZi92PSEyCMCbs59BiC E X-Gm-Gg: ASbGnctNcmL4FDRpzRa94IO2FSWd0O14XKbdG82IKsfSjzPOaZ8oLha2H229Rc0ACgZ mc2iu1Q7b7MK/qy/OjMatr4q+P6sU3SX7iFYwA+h9lygwuYe3WKdSYdHM/VQK6XuVvqaA8uobjz fSHj3oo3zwL1o2Xy0iulk9lR3v2MxqSLHROBItYxqfA8cnPRsms3boo3TIRORX/hZxIiO0id1+1 d16IhX0Ksxg80b1BvoDGLF8YkTq6yZM/YJ6b89DpTvdMlwrXZl5af1yWttPYSaS/fgpc28T0MYc l6W3ac6LGDMMksVDigqK+/ecKtbkUpaJSsEkmh1Cjr24X9TJN3irtHkIPel7VMpUdR6N X-Google-Smtp-Source: AGHT+IG51eszCDA9ha3mwW9Pi14I3FnqR7hXzK8/6F9DMumL6E/3yDSMw+GI792Dhx7rIilw4n28fQ== X-Received: by 2002:a05:6a20:734a:b0:1e1:9f57:eab4 with SMTP id adf61e73a8af0-1eb2148c309mr44437831637.16.1737742644192; Fri, 24 Jan 2025 10:17:24 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72f8a6b2ed8sm2184477b3a.41.2025.01.24.10.17.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 10:17:23 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Jerin Jacob Subject: [PATCH v4 10/16] eventdev: add allocation function attributes Date: Fri, 24 Jan 2025 10:15:01 -0800 Message-ID: <20250124181704.86567-11-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250124181704.86567-1-stephen@networkplumber.org> References: <20250110170603.538756-1-stephen@networkplumber.or> <20250124181704.86567-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Use function attributes to catch cases where eventdev is allocated but not freed correctly. Signed-off-by: Stephen Hemminger --- lib/eventdev/rte_event_ring.h | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/lib/eventdev/rte_event_ring.h b/lib/eventdev/rte_event_ring.h index 5769da269e..a8f308e4d6 100644 --- a/lib/eventdev/rte_event_ring.h +++ b/lib/eventdev/rte_event_ring.h @@ -247,7 +247,18 @@ int rte_event_ring_init(struct rte_event_ring *r, const char *name, unsigned int count, unsigned int flags); -/* + +/** + * De-allocate all memory used by the ring. + * + * @param r + * Pointer to ring to created with rte_event_ring_create(). + * If r is NULL, no operation is performed. + */ +void +rte_event_ring_free(struct rte_event_ring *r); + +/** * Create an event ring structure * * This function allocates memory and initializes an event ring inside that @@ -288,8 +299,8 @@ rte_event_ring_init(struct rte_event_ring *r, const char *name, * - ENOMEM - no appropriate memory area found in which to create memzone */ struct rte_event_ring * -rte_event_ring_create(const char *name, unsigned int count, int socket_id, - unsigned int flags); +rte_event_ring_create(const char *name, unsigned int count, int socket_id, unsigned int flags) + __rte_malloc __rte_dealloc(rte_event_ring_free, 1); /** * Search for an event ring based on its name @@ -304,16 +315,6 @@ rte_event_ring_create(const char *name, unsigned int count, int socket_id, struct rte_event_ring * rte_event_ring_lookup(const char *name); -/** - * De-allocate all memory used by the ring. - * - * @param r - * Pointer to ring to created with rte_event_ring_create(). - * If r is NULL, no operation is performed. - */ -void -rte_event_ring_free(struct rte_event_ring *r); - /** * Return the size of the event ring. * -- 2.45.2