From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <users-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 6E1C9437A1
	for <public@inbox.dpdk.org>; Wed, 27 Dec 2023 05:56:07 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 2E1934029C;
	Wed, 27 Dec 2023 05:56:07 +0100 (CET)
Received: from mail-il1-f173.google.com (mail-il1-f173.google.com
 [209.85.166.173])
 by mails.dpdk.org (Postfix) with ESMTP id 277464027A
 for <users@dpdk.org>; Wed, 27 Dec 2023 05:56:05 +0100 (CET)
Received: by mail-il1-f173.google.com with SMTP id
 e9e14a558f8ab-35fe994dab5so18131635ab.0
 for <users@dpdk.org>; Tue, 26 Dec 2023 20:56:05 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1703652964;
 x=1704257764; darn=dpdk.org; 
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:subject:cc:to:from:date:from:to:cc:subject:date
 :message-id:reply-to;
 bh=+jfMsHDgvqmOT+v5lFCS09nIGYhJrazLBP1Hcy/a02I=;
 b=YUKVOzI1sTTyVIlfEODoKor2yJKUWZI0mbka9VFk6ckvpL1E367KEV5ol7CfCt/tIH
 j5l+qjGcRYFqLkMHF5/2QynkSrGKZ+Hfk/ixTSk/0qc6pPOwYYwgCrfn18WgxOAOCH8N
 M57B0wmsFkQRklPoKq831XieLOIXlSWunw4rTWGnQtO2+5rgSuKlTgQN3czLb/i2B0Lr
 LuE/NNwe5D7EkDhKOhD8oFQYJqDSFAXjCFYrDKvS6F1uramGQgqyT042hvVqyBRSzq+j
 Ai0hc0QBJ8sHEOOFDHomAw36gYGbg7YfEAXHj3FK7pCUD1SyRwPfuZgppjnlSqw2hkve
 4QiQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1703652964; x=1704257764;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=+jfMsHDgvqmOT+v5lFCS09nIGYhJrazLBP1Hcy/a02I=;
 b=oWhEpI/GA3c5dCsrO3DqxCRRCdnOA0YogzzYE2EhWmU2vSKVj40uZ0KJLHSGRJJjMU
 aygLNGrX3JWBrohmLifmzx/TkriRKP3rA4kkmElzxxdDhNTvtPMeNa8qoqD6w2Dfu3hR
 7l6gVy1zryyP0bdO3z9ChWSDvf5pAh55G3D62L2bpF/wGj3kdJfHJmjDMWjklhKiNVhL
 TkrSjK+ABh2KC8l5GvAGFNzeRVSy8HeJe2lcVaTNzjsK8+DI0fXW46LjAsoQ4nV8mJzt
 MbWU1XZpQyMxT9RzV7vvOK80RK1eWvBWbXcXft0GVU+4nTWY3Roym5yfpWg1roIFR/Pc
 zMmw==
X-Gm-Message-State: AOJu0YwDHWvnFekEV0QJ/ZxB6NBS/guppowNz0fC3wo1lBspLL9gs1e+
 0S5+q8/TeRKPoiHXAYzTk0X1W1Z2IyTrZKx6TH8bz/iMv+U=
X-Google-Smtp-Source: AGHT+IFLxL2vpc6WTAlDyggkFUSXig+D3unSgf0Tchugi4fMezG7pXtWychhzz+yNKozogmIGHOj2A==
X-Received: by 2002:a05:6e02:1a4a:b0:35f:f891:b5e1 with SMTP id
 u10-20020a056e021a4a00b0035ff891b5e1mr10341467ilv.23.1703652964567; 
 Tue, 26 Dec 2023 20:56:04 -0800 (PST)
Received: from hermes.local (204-195-123-141.wavecable.com. [204.195.123.141])
 by smtp.gmail.com with ESMTPSA id
 x7-20020a170902ec8700b001d08e08003esm10934091plg.174.2023.12.26.20.56.04
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 26 Dec 2023 20:56:04 -0800 (PST)
Date: Tue, 26 Dec 2023 20:56:02 -0800
From: Stephen Hemminger <stephen@networkplumber.org>
To: "Nicolson Ken (=?UTF-8?B?44OL44Kz44Or44K944OzIOOCseODsw==?=)"
 <ken.nicolson@jp.panasonic.com>
Cc: "users@dpdk.org" <users@dpdk.org>
Subject: Re: Detecting if rte_eal_init() has already been called
Message-ID: <20231226205602.56496841@hermes.local>
In-Reply-To: <OSZPR01MB774835807CDC015C94EDB655BC9FA@OSZPR01MB7748.jpnprd01.prod.outlook.com>
References: <OSZPR01MB774835807CDC015C94EDB655BC9FA@OSZPR01MB7748.jpnprd01.prod.outlook.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-BeenThere: users@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK usage discussions <users.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/users>,
 <mailto:users-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/users/>
List-Post: <mailto:users@dpdk.org>
List-Help: <mailto:users-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/users>,
 <mailto:users-request@dpdk.org?subject=subscribe>
Errors-To: users-bounces@dpdk.org

On Wed, 27 Dec 2023 03:54:12 +0000
Nicolson Ken (=E3=83=8B=E3=82=B3=E3=83=AB=E3=82=BD=E3=83=B3 =E3=82=B1=E3=83=
=B3) <ken.nicolson@jp.panasonic.com> wrote:

> Hi all,
>=20
> I'm loading two semi-independent DPDK-ready shared libraries into a maste=
r process. If both call rte_eal_init() I get a fatal error about calling it=
 a second time. I tried the rte_eal_primary_proc_alive(NULL) API, but that =
failed to detect that the other library had already called rte_eal_init().
>=20
> I feel there should be a simple rte_eal_is_inited()-like API somewhere, b=
ut I cannot find it.
>=20
> Note, I cannot easily change the master process as it is a third-party to=
ol that knows nothing about DPDK. For now I am just relying on the order of=
 loading the libraries and skipping rte_eal_init() on the second.
>=20
> Thanks,
> Ken

Libraries should not be calling rte_eal_init()!
Even if you fix the init side, the shutdown cleanup handling would be impac=
ted.

Maybe introduce an initializer and destructor in one place would be a worka=
round