From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_NEOMUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7329C04AA7 for ; Mon, 13 May 2019 12:14:28 +0000 (UTC) Received: from dpdk.org (dpdk.org [92.243.14.124]) by mail.kernel.org (Postfix) with ESMTP id 81DB320879 for ; Mon, 13 May 2019 12:14:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 81DB320879 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=6wind.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 784F44C9C; Mon, 13 May 2019 14:14:27 +0200 (CEST) Received: from mail.droids-corp.org (zoll.droids-corp.org [94.23.50.67]) by dpdk.org (Postfix) with ESMTP id C43803253 for ; Mon, 13 May 2019 14:14:26 +0200 (CEST) Received: from lfbn-lil-1-768-100.w81-254.abo.wanadoo.fr ([81.254.99.100] helo=droids-corp.org) by mail.droids-corp.org with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hQ9tH-0001dq-9t; Mon, 13 May 2019 14:17:12 +0200 Received: by droids-corp.org (sSMTP sendmail emulation); Mon, 13 May 2019 14:14:24 +0200 Date: Mon, 13 May 2019 14:14:24 +0200 From: Olivier Matz To: "Eads, Gage" Cc: "dev@dpdk.org" , "arybchenko@solarflare.com" Message-ID: <20190513121424.7u7nwp5ziq4nhcjs@platinum> References: <9184057F7FC11744A2107296B6B8EB1E68CB4370@fmsmsx101.amr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9184057F7FC11744A2107296B6B8EB1E68CB4370@fmsmsx101.amr.corp.intel.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [dpdk-dev] Mempool handler ops index allocation issue 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 Gage, On Thu, May 09, 2019 at 10:19:55PM +0000, Eads, Gage wrote: > Hi all, > > I ran into a problem with a multi-process application, in which two processes assigned the same mempool handler ops index to *different* handlers. This happened because the two processes supplied the -d EAL arguments in different order, e.g.: > > sudo ./appA -dlibrte_mempool_bucket.so -dlibrte_mempool_ring.so --proc-type primary & > sudo ./appB -dlibrte_mempool_ring.so -dlibrte_mempool_bucket.so --proc-type secondary & > > The dynamic load order matters because the ops indexes are assigned in the order the library ctors are run. This can result in the different processes trying to use different handlers for the same mempool. > > I'm not aware of any requirement that the EAL argument order should match across processes, so I don't think this is a user error. This could also happen in static libraries if they linked the libraries in a different order - but that shouldn't occur if both applications are following the rules for building an external application (https://doc.dpdk.org/guides/prog_guide/dev_kit_build_system.html#building-external-applications). > > If you agree that this is an issue, I see a couple possible resolutions: > > > 1. Add a note/warning to the mempool handlers section of the user guide (https://doc.dpdk.org/guides/prog_guide/mempool_lib.html#mempool-handlers) > > 2. Modify rte_mempool_register_ops() so that built-in handlers (ring, stack, etc.) have fixed IDs. E.g. ring is always 0, stack is always 1, etc. These handlers could be identified by their name string. User-registered mempools would still be susceptible to this problem, though. > > Thoughts? Alternatives? What about this: - add a new table in a named memory zone that stores the association between mempool_ops id and name (but not the ops pointers) of the primary process. - change rte_mempool_register_ops() to have a specific behavior in case of a secondary process: lookup in that table to get the id associated to the name (fail if not found). On the other hand, using secondary processes always looked a bit dangerous to me (for several reasons), so adding a note in the programmer's guide (your proposal 1) is also fine to me. Thanks, Olivier