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 A38DEA0524; Thu, 6 May 2021 17:34:32 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1E75D410EE; Thu, 6 May 2021 17:34:32 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 6AEFE410DB for ; Thu, 6 May 2021 17:34:29 +0200 (CEST) IronPort-SDR: N2RDte+MetzU7uMB4wiLEQHn3eeIwmKE4MBkqRVqW9YFsWQpYJGH2mNsefTPQhCTanw5PuyTGi +PuzjlWXRd4Q== X-IronPort-AV: E=McAfee;i="6200,9189,9976"; a="178740912" X-IronPort-AV: E=Sophos;i="5.82,277,1613462400"; d="scan'208";a="178740912" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2021 08:34:26 -0700 IronPort-SDR: 69g1n1+LT6nxB4O8jGLrUCNmejp5Gf+a2Oqg9dbAY5JZSCQ5hNHTVieqIWsJNK0iDvvCmcld3T KDi7P/mLKkBw== X-IronPort-AV: E=Sophos;i="5.82,277,1613462400"; d="scan'208";a="532624741" Received: from bricha3-mobl.ger.corp.intel.com ([10.252.21.150]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-SHA; 06 May 2021 08:34:25 -0700 Date: Thu, 6 May 2021 16:34:21 +0100 From: Bruce Richardson To: "Burakov, Anatoly" Cc: dev@dpdk.org, Harry van Haaren Message-ID: References: <20210506150908.797110-1-bruce.richardson@intel.com> <18d300a4-f8f2-06b9-894e-91cd899bf933@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <18d300a4-f8f2-06b9-894e-91cd899bf933@intel.com> Subject: Re: [dpdk-dev] [PATCH] raw/ioat: fix bus requiring virtual addressing when no devs 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 Thu, May 06, 2021 at 04:27:03PM +0100, Burakov, Anatoly wrote: > On 06-May-21 4:09 PM, Bruce Richardson wrote: > > If after a bus scan, there are no devices using a particular bus, then > > that bus should not be taken into account when deciding whether DPDK > > should be run in VA or PA addressing mode. This becomes an issue when > > the DSA bus driver code is used on a system without an IOMMU. The PCI > > bus correctly reports that it only works in PA mode, while the DSA bus - > > also correctly - reports that it works only in VA mode. The difference > > is that there will be no devices found in a scan for the DSA bus, since > > the kernel driver can only present those to userspace in the presence of > > an IOMMU. > > > > While we could change DSA instance to always report that it does not > > care about the addressing mode, this would imply that it could be used > > with DPDK in PA mode which is not the case. Therefore, this patch > > changes the driver to report DC (don't care) in the case where no > > devices are present, and VA otherwise. > > > > NOTE: this addressing mode use of VA-only applies only in the case of > > using DSA through the idxd kernel driver. The use of DSA though vfio-pci > > is unaffected and works as with other PCI devices. > > > > Fixes: b7aaf417f936 ("raw/ioat: add bus driver for device scanning automatically") > > > > Reported-by: Harry van Haaren > > Signed-off-by: Bruce Richardson > > --- > > This would be a good opportunity to start a discussion on a "proper" fix for > this, because while this hack is acceptable being so close to release, IMO > we need a more general solution. Maybe a bus API reporting number of scanned > devices would be nice to have, as EAL will then be able to ignore the > opinion of those buses who don't have any devices. > > The "number of devices" is a bit of a fluid concept, as number of scanned > devices may not be the same as number of *probed* devices, and there's also > hotplug. However, i think that we can ignore all that, because we care about > initialization only - any other issues can be addressed by forcing > --iova-mode by the user, as we cannot really do anything about hotplug or > devices that fail to probe. > > Thoughts? > Perhaps rather than just "number of devices" we should have buses report whether they are relevant or not. For example, there are a number of SoC-specific bus drivers in DPDK, which are presumably only relevant on particular SoCs. Similarly here for the DSA bus, the presence of the devices is a useful proxy for relevance - especially since it doesn't support hotplug - but if we had a way to report relevance/non-relevance DSA could just report itself as not-relevant in case where there is no IOMMU enabled on the system, or when the "idxd" kernel driver is not present, for example, and then have EAL skip even asking about PA/VA support /Bruce