From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8702BA0350; Mon, 29 Jun 2020 17:41:58 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C05FF1BF80; Mon, 29 Jun 2020 17:41:57 +0200 (CEST) Received: from mail-pg1-f193.google.com (mail-pg1-f193.google.com [209.85.215.193]) by dpdk.org (Postfix) with ESMTP id 927A41BF7D for ; Mon, 29 Jun 2020 17:41:56 +0200 (CEST) Received: by mail-pg1-f193.google.com with SMTP id w2so7670045pgg.10 for ; Mon, 29 Jun 2020 08:41:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7PqHrP0J7OZzbMDmpkeGdEb8ZY/q7e7mzeIsZlYNOps=; b=CR+KVICUtCSw3KL3gOGsaZUACwGqFVqg7aEL62lRQkJgkZRAURfsmT5sohJkQjvOcV +kReJzj7ZYoRfdZ06aNSuNndFzxmv5qdIo7fHuN4dBdGOuqmG8HGC53bUAeI/UwfqEgd JAgkDZFQo9jg0JPSjLA0tvTlUAriuOM0sAc8YtaFX+2CawrA73dmTQICQG3MMV+4Wq5H klqQ8wm+YHup19PMicVn0XR+AW+8jlFVKgaq8JUx/cHYm7rXmSASGTk15SHny19ErUqd trhw+AMqSczER84Bdl57724jkd8jfr5QyWMnaHyWIMjvGhfmwcTzfDg/bLjFDABjl2tb rilA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7PqHrP0J7OZzbMDmpkeGdEb8ZY/q7e7mzeIsZlYNOps=; b=c3ucBV/ilfWpyHrUYcq380+NwRVp51aBuPnbqq4F1q+wK6MTApUiLV2ioAYNMFbd8S 9bROrjq4NPjia+HzSamF0Q4gPtRvJuHUxonP21snbzv59o/CPDYZfKguwT+vIgtCsUyH lq5zREcjCgDntBPjcMxp+ryNPBqvRPt3+qV9Y7GwuDQh3usgsdySdqiHHj3URrfCP2Fb /NogA0+gy+H/kdfgLyiX+Lxa573bXGUG3wf9otPc4Tg1372dnU4Ghp5YGX22mdzhcj8O MVPkSewcdh9NDTOLYzWpBtxC7ESOKQ3D7mXsPc6xEtZ26IdFtGhjGf5ivMJ3UGGLWTW8 7wUQ== X-Gm-Message-State: AOAM531Z9iXvoOs4LS5/vhjuE9c3QKWmwjPkCGpkPmznNeV5PIO5fCNL lK2NV4au6bSXS4ZgAF2kphfLvg== X-Google-Smtp-Source: ABdhPJyOPeTGW+iOESx6NVP2NZd0TnAGoSXVfjEMeV1Iue150H1ye87Iv4EBkaUm4biYkqSyH4cIEg== X-Received: by 2002:a62:2702:: with SMTP id n2mr15757662pfn.189.1593445315380; Mon, 29 Jun 2020 08:41:55 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id b4sm130488pfo.137.2020.06.29.08.41.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jun 2020 08:41:55 -0700 (PDT) Date: Mon, 29 Jun 2020 08:41:46 -0700 From: Stephen Hemminger To: Bruce Richardson Cc: dev@dpdk.org Message-ID: <20200629084146.6951685c@hermes.lan> In-Reply-To: <20200629091910.GB572@bricha3-MOBL.ger.corp.intel.com> References: <20200626145957.722089-1-bruce.richardson@intel.com> <20200626100542.1c87c2c9@hermes.lan> <20200629091158.GA572@bricha3-MOBL.ger.corp.intel.com> <20200629091910.GB572@bricha3-MOBL.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] eal: don't use default library path for static binaries 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" On Mon, 29 Jun 2020 10:19:10 +0100 Bruce Richardson wrote: > On Mon, Jun 29, 2020 at 10:11:58AM +0100, Bruce Richardson wrote: > > On Fri, Jun 26, 2020 at 10:05:42AM -0700, Stephen Hemminger wrote: > > > On Fri, 26 Jun 2020 15:59:57 +0100 > > > Bruce Richardson wrote: > > > > > > > When using statically linked DPDK binaries, the EAL checks the default PMD > > > > path and tries to load any drivers there, despite the fact that all drivers > > > > are normally linked into the binary. This behaviour can cause issues if > > > > the PMD path and lib dir is configured to a non-standard location which is > > > > not in the ld.so.conf paths, e.g. a build with prefix set to a home > > > > directory location. In a case such as this, EAL will try and > > > > (unnecessarily) load the .so driver files but that load will fail as their > > > > dependent libraries, such as ethdev, for example, will not be found. > > > > > > > > Because of this, it is better if statically linked DPDK apps do not load > > > > drivers from the standard paths automatically. The user can always have > > > > this behaviour by explicitly specifying the path using -d flag, if so > > > > desired. > > > > > > > > Not loading the libraries automatically can also prevent potential issues > > > > with a user building and running a statically-linked DPDK binary based off > > > > a private copy of DPDK, while there exists on the same machine a > > > > system-wide installation of DPDK in the default locations. Without this > > > > change, the system-installed drivers will be loaded to the binary alongside > > > > the statically-linked drivers, which is not what the user would have > > > > intended. > > > > > > > > To detect whether we are in a statically or dynamically linked binary, we > > > > can have EAL try to get a dlopen handle to its own shared library, by > > > > calling dlopen with the RTLD_NOLOAD flag. This will return NULL if there is > > > > no such shared lib loaded i.e. the code is executing from a static library, > > > > or a handle to the lib if it is loaded. > > > > > > > > Signed-off-by: Bruce Richardson > > > > > > But what if the majority of the DPDK is statically linked but the > > > application wants also load a dynamically linked driver? > > > > > They use the -d flag as now. The only change here is that we don't > > *automatically* (and silently) attempt to load all drivers from a system > > location when you have a static binary. > > I'd also make a couple of additional points: > 1. If you have a static app and you have extra drivers in your EAL_PMD_PATH > directory you have no way of preventing the loading of them. > > 2. Since all DPDK apps try to load all files in that directory, all one has > to do is put a non-loadable file into the DPDK PMD directory and suddenly > all DPDK apps on the system will fail to run. [Patchset > http://patches.dpdk.org/project/dpdk/list/?series=10553 will also help > here] > > 3. Since this is a behaviour change, perhaps it needs to be deferred to > 20.11? Ideally I think we should fix this now, because I think the current > behaviour doesn't make sense and causes more problems than it solves, but > if it needs to be deferred, so be it. Thanks, just trying to poke the corners of this change. Please make sure the documentation and web site match the behavior. Acked-by: Stephen Hemminger