DPDK patches and discussions
 help / color / mirror / Atom feed
From: Anatoly Burakov <anatoly.burakov@intel.com>
To: dev@dpdk.org
Cc: John McNamara <john.mcnamara@intel.com>,
	Marko Kovacevic <marko.kovacevic@intel.com>,
	przemyslawx.lal@intel.com, kuralamudhan.ramakrishnan@intel.com,
	ivan.coughlan@intel.com, tiwei.bie@intel.com,
	ray.kinsella@intel.com, maxime.coquelin@redhat.com,
	stable@dpdk.org
Subject: [dpdk-dev] [PATCH v2 1/5] mem: fix error code for segment fd API for external segs
Date: Tue, 11 Dec 2018 16:43:28 +0000	[thread overview]
Message-ID: <cc09e602c7d5166f1a87606485dba8d54f74ba5e.1544546363.git.anatoly.burakov@intel.com> (raw)
In-Reply-To: <cover.1544546363.git.anatoly.burakov@intel.com>
In-Reply-To: <cover.1544546363.git.anatoly.burakov@intel.com>

Segment fd API does not support getting segment fd's from
externally allocated memory, so return proper error code
on any attempts to do so. This changes API behavior, so
document the change as well.

Fixes: 5282bb1c3695 ("mem: allow memseg lists to be marked as external")
Cc: stable@dpdk.org

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---

Notes:
    The API is experimental, no deprecation notice needed.

 doc/guides/rel_notes/release_19_02.rst    |  6 ++++++
 lib/librte_eal/common/eal_common_memory.c | 12 ++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/doc/guides/rel_notes/release_19_02.rst b/doc/guides/rel_notes/release_19_02.rst
index a94fa86a7..ade41b9c8 100644
--- a/doc/guides/rel_notes/release_19_02.rst
+++ b/doc/guides/rel_notes/release_19_02.rst
@@ -84,6 +84,12 @@ API Changes
    =========================================================
 
 
+* eal: segment fd API on Linux now sets error code to ``ENOTSUP`` in more cases
+  where segment fd API is not expected to be supported:
+
+  - On attempt to get segment fd for an externally allocated memory segment
+
+
 ABI Changes
 -----------
 
diff --git a/lib/librte_eal/common/eal_common_memory.c b/lib/librte_eal/common/eal_common_memory.c
index d47ea4938..999ba24b4 100644
--- a/lib/librte_eal/common/eal_common_memory.c
+++ b/lib/librte_eal/common/eal_common_memory.c
@@ -704,6 +704,12 @@ rte_memseg_get_fd_thread_unsafe(const struct rte_memseg *ms)
 		return -1;
 	}
 
+	/* segment fd API is not supported for external segments */
+	if (msl->external) {
+		rte_errno = ENOTSUP;
+		return -1;
+	}
+
 	ret = eal_memalloc_get_seg_fd(msl_idx, seg_idx);
 	if (ret < 0) {
 		rte_errno = -ret;
@@ -754,6 +760,12 @@ rte_memseg_get_fd_offset_thread_unsafe(const struct rte_memseg *ms,
 		return -1;
 	}
 
+	/* segment fd API is not supported for external segments */
+	if (msl->external) {
+		rte_errno = ENOTSUP;
+		return -1;
+	}
+
 	ret = eal_memalloc_get_seg_fd_offset(msl_idx, seg_idx, offset);
 	if (ret < 0) {
 		rte_errno = -ret;
-- 
2.17.1

  parent reply	other threads:[~2018-12-11 16:43 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-13 17:54 [dpdk-dev] [PATCH 19.02 0/2] Allow using virtio without hugepages Anatoly Burakov
2018-11-13 17:54 ` [dpdk-dev] [PATCH 19.02 1/2] memalloc: allow setting up segment list fd's Anatoly Burakov
2018-11-13 17:54 ` [dpdk-dev] [PATCH 19.02 2/2] mem: use memfd for no-huge mode Anatoly Burakov
2018-11-28  4:57   ` Tiwei Bie
2018-11-28  9:11     ` Burakov, Anatoly
2018-12-11 16:43 ` [dpdk-dev] [PATCH v2 0/5] Allow using virtio without hugepages Anatoly Burakov
2018-12-13  4:53   ` Tiwei Bie
2018-12-13 11:43   ` [dpdk-dev] [PATCH v3 0/5] Allow using virtio-user " Anatoly Burakov
2018-12-20 22:01     ` Thomas Monjalon
2018-12-13 11:43   ` [dpdk-dev] [PATCH v3 1/5] mem: fix error code for segment fd API for external segs Anatoly Burakov
2018-12-14  9:15     ` Maxime Coquelin
2018-12-13 11:43   ` [dpdk-dev] [PATCH v3 2/5] memalloc: check for memfd support in segment fd API Anatoly Burakov
2018-12-14  9:19     ` Maxime Coquelin
2018-12-13 11:43   ` [dpdk-dev] [PATCH v3 3/5] memalloc: allow setting up segment list fd's Anatoly Burakov
2018-12-14 10:03     ` Maxime Coquelin
2018-12-13 11:43   ` [dpdk-dev] [PATCH v3 4/5] mem: use memfd for no-huge mode Anatoly Burakov
2018-12-13 11:59     ` Burakov, Anatoly
2018-12-14 10:06     ` Maxime Coquelin
2018-12-13 11:43   ` [dpdk-dev] [PATCH v3 5/5] test: add segment fd API test Anatoly Burakov
2018-12-14 10:09     ` Maxime Coquelin
2018-12-11 16:43 ` Anatoly Burakov [this message]
2018-12-11 16:43 ` [dpdk-dev] [PATCH v2 2/5] memalloc: check for memfd support in segment fd API Anatoly Burakov
2018-12-11 16:43 ` [dpdk-dev] [PATCH v2 3/5] memalloc: allow setting up segment list fd's Anatoly Burakov
2018-12-11 16:43 ` [dpdk-dev] [PATCH v2 4/5] mem: use memfd for no-huge mode Anatoly Burakov
2018-12-13  4:59   ` Tiwei Bie
2018-12-13 11:36     ` Burakov, Anatoly
2018-12-11 16:43 ` [dpdk-dev] [PATCH v2 5/5] test: add segment fd API test Anatoly Burakov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cc09e602c7d5166f1a87606485dba8d54f74ba5e.1544546363.git.anatoly.burakov@intel.com \
    --to=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=ivan.coughlan@intel.com \
    --cc=john.mcnamara@intel.com \
    --cc=kuralamudhan.ramakrishnan@intel.com \
    --cc=marko.kovacevic@intel.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=przemyslawx.lal@intel.com \
    --cc=ray.kinsella@intel.com \
    --cc=stable@dpdk.org \
    --cc=tiwei.bie@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).