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 0DED1A0C45; Tue, 19 Oct 2021 00:57:01 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8A85340683; Tue, 19 Oct 2021 00:57:00 +0200 (CEST) Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) by mails.dpdk.org (Postfix) with ESMTP id B25BB40142 for ; Tue, 19 Oct 2021 00:56:58 +0200 (CEST) Received: by mail-pj1-f49.google.com with SMTP id ls18-20020a17090b351200b001a00250584aso538763pjb.4 for ; Mon, 18 Oct 2021 15:56:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VxHPQYB16eyiH4OL5UO2hAGWZXlABjjIw9Ok/RpAWfc=; b=UtE2UwdHjcbNwZqsDS18GyZok8ERqDL5UhvU/CphhxFmbr+QYVYj6eLxm0ZOUyZBul dtZjbb1ZfU0mcSCsbZHOer0xbZ4r4PkSf5p/BGCVYi7C5bEMakO1Nqzzz1ujpL1ZA1T+ AF/JMqzVhlzaYsxvMRvcBPFz9DIe+2phJKu5FSL64BpNnOiXxajZyVI4MotQg0NvgTse iR2UxRcRSQYV8NTG+ZVATCJcDSAwguhuTIglquj6lOVHcGRSNyFviBsDUTlB9VrouNMs eEBUxj7wddNu1g6l2EhiGu/UFq8LbSHkTM78jgvMgLmHBsvspUbq7SeEFmlG1dd/7UNk FNWQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=VxHPQYB16eyiH4OL5UO2hAGWZXlABjjIw9Ok/RpAWfc=; b=JtzUo2Jm9D04tTEFo0CQO5ytoknt3WZJYRn9Yj052W+qb5GIFkaVnk/FPpbZGipsf3 PkVyybOe2Hu+/+ekvRKneSSD1XFpZpQ5zlQx7daqUxOKy32I2oRHRI2hvkQ0kms/TpEp +hXduCvFMuuU+5gapElRStoHgBkpyhGTIHFwPNmaP9gU4epeKDqCanMh3jKQJbKXEgIS F86SO+Xo5emdAsp/jjeeoi8M9eNnBIHOlfzQI3n6zJITD6LNdOaB1UyvHDwFVXqSAFYA zP1/hd3HPlRUbkXhOCczMwdnjSR6q1hBI6jp6VjESKZUiXLERZtnHxGCVrNeViY8HAB1 Ue1g== X-Gm-Message-State: AOAM531yAintR2ZPQAR4g1UAA2InnTK2w4Z/Pce3rLv42crfMi4S7rG4 ty1Fm/IN1cXy2GY0gQ9Evlg3Zg== X-Google-Smtp-Source: ABdhPJzYB3H7JdBOpi9lR9u3o2d+CreT2SiTmv0+QyVE0MpAVa26gTbD8pikbOhws8ARYw77vbtZzQ== X-Received: by 2002:a17:90b:4a92:: with SMTP id lp18mr2073191pjb.47.1634597817813; Mon, 18 Oct 2021 15:56:57 -0700 (PDT) Received: from hermes.local (204-195-33-123.wavecable.com. [204.195.33.123]) by smtp.gmail.com with ESMTPSA id mi8sm484720pjb.20.2021.10.18.15.56.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Oct 2021 15:56:57 -0700 (PDT) Date: Mon, 18 Oct 2021 15:56:54 -0700 From: Stephen Hemminger To: Harman Kalra Cc: , Thomas Monjalon , Ray Kinsella , , Message-ID: <20211018155654.0d3ffbed@hermes.local> In-Reply-To: <20211018193707.123559-3-hkalra@marvell.com> References: <20210826145726.102081-1-hkalra@marvell.com> <20211018193707.123559-1-hkalra@marvell.com> <20211018193707.123559-3-hkalra@marvell.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v3 2/7] eal/interrupts: implement get set APIs 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" On Tue, 19 Oct 2021 01:07:02 +0530 Harman Kalra wrote: > + /* Detect if DPDK malloc APIs are ready to be used. */ > + mem_allocator = rte_malloc_is_ready(); > + if (mem_allocator) > + intr_handle = rte_zmalloc(NULL, sizeof(struct rte_intr_handle), > + 0); > + else > + intr_handle = calloc(1, sizeof(struct rte_intr_handle)); This is problematic way to do this. The reason to use rte_malloc vs malloc should be determined by usage. If the pointer will be shared between primary/secondary process then it has to be in hugepages (ie rte_malloc). If it is not shared then then use regular malloc. But what you have done is created a method which will be a latent bug for anyone using primary/secondary process. Either: intr_handle is not allowed to be used in secondary. Then always use malloc(). Or. intr_handle can be used by both primary and secondary. Then always use rte_malloc(). Any code path that allocates intr_handle before pool is ready is broken.