From: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
To: Tyler Retzlaff <roretzla@linux.microsoft.com>
Cc: dev@dpdk.org, anatoly.burakov@intel.com
Subject: Re: rte_memzone_reserve and invalid socket id
Date: Thu, 14 Apr 2022 22:03:10 +0300 [thread overview]
Message-ID: <20220414220310.4eebc1dc@sovereign> (raw)
In-Reply-To: <20220413075425.GA8292@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net>
2022-04-13 00:54 (UTC-0700), Tyler Retzlaff:
> On Mon, Mar 28, 2022 at 11:04:36PM -0700, Tyler Retzlaff wrote:
[...]
> > memzone3 = rte_memzone_reserve(TEST_MEMZONE_NAME("testzone3"), 1000,
> > 1, 0);
> > ^ socket_id (to repeat just make it invalid)
> >
> > the parameter documentation provided for reference.
> >
> > * @param socket_id
> > * The socket identifier in the case of
> > * NUMA. The value can be SOCKET_ID_ANY if there is no NUMA
> > * constraint for the reserved zone.
> >
> > of interest is should rte_memzone_reserve fail when provided a
> > completely invalid socket_id?
I think it should.
> >
> > when running with --no-huge it does not because when --no-huge the
> > socket_id no matter the value is silently re-mapped to SOCKET_ID_ANY
> > though without --no-huge if a completely garbage socket_id were provided
> > it seems the allocation would fail.
It's an implementation detail.
NUMA could be respected for --no-huge if there was a need.
> >
> > so you get different behavior for an invalid socket_id depending on
> > --no-huge vs with.
> >
> > if (!rte_eal_has_hugepages() && socket_id < RTE_MAX_NUMA_NODES)
> > socket_id = SOCKET_ID_ANY;
> >
> > the test later fails at this check. where it compares the memzone3
> > socket_id to what was used in the call to rte_memzone_reserve.
> >
> > if (memzone3 != NULL && memzone3->socket_id != 1)
> > return -1; ^ SOCKET_ID_ANY if --no-huge
> >
> > if the allocation had failed, the test would pass instead of failing at
> > this point.
> >
> > so what's wrong here? the test should be changed to expect different
> > behavior with --no-huge vs huge or should rte_memzone_reserve be
> > explicitly requiring SOCKET_ID_ANY instead of re-mapping invalid socket
> > id?
memzone3->socket_id == SOCKET_ID_ANY should not be possible,
because it's a specific selected socket ID.
Rather, the check should be relaxed depending on rte_eal_has_hugepages().
next prev parent reply other threads:[~2022-04-14 19:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-29 6:04 Tyler Retzlaff
2022-04-13 7:54 ` Tyler Retzlaff
2022-04-14 19:03 ` Dmitry Kozlyuk [this message]
2022-04-15 6:01 ` Tyler Retzlaff
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=20220414220310.4eebc1dc@sovereign \
--to=dmitry.kozliuk@gmail.com \
--cc=anatoly.burakov@intel.com \
--cc=dev@dpdk.org \
--cc=roretzla@linux.microsoft.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).