From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Jean Tourrilhes <jt@labs.hpe.com>
Cc: dpdk-dev <dev@dpdk.org>,
David Marchand <david.marchand@redhat.com>,
Thomas Monjalon <thomas@monjalon.net>
Subject: Re: [dpdk-dev] [PATCH v3] mempool: Add sanity check when secondary link-in less mempools than primary
Date: Fri, 11 Jan 2019 21:58:02 +0000 [thread overview]
Message-ID: <c6c1407b-256e-dbc1-bade-a208cdfed957@intel.com> (raw)
In-Reply-To: <20161110232540.GA18054@labs.hpe.com>
On 11/10/2016 11:25 PM, jt at labs.hpe.com (Jean Tourrilhes) wrote:
> If the mempool ops the caller wants to use is not registered, the
> library will segfault in an obscure way when trying to use that
> mempool. It's better to catch it early and warn the user.
>
> If the primary and secondary process were build using different build
> systems, the list of constructors included by the linker in each
> binary might be different. Mempools are registered via constructors, so
> the linker magic will directly impact which mempools are registered with
> the primary and the secondary.
> DPDK currently assumes that the secondary has a superset of the
> mempools registered at the primary, and they are in the same order
> (same index in primary and secondary). In some build scenario, the
> secondary might not initialise any mempools at all.
>
> This would also catch cases where there is a bug in the mempool
> registration, or some memory corruptions, but this has not been
> observed.
>
> Signed-off-by: Jean Tourrilhes <jt at labs.hpe.com>
Hi Jean,
There is no comment on the patch for a long time, more than two years, updating
patch status as rejected, if it is still relevant please let us know.
Sorry for any inconvenience caused.
For record, patch: https://patches.dpdk.org/patch/17000/
> ---
> lib/librte_mempool/rte_mempool.c | 23 +++++++++++++++++++++++
> 1 file changed, 23 insertions(+)
>
> diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
> index e94e56f..bbb6723 100644
> --- a/lib/librte_mempool/rte_mempool.c
> +++ b/lib/librte_mempool/rte_mempool.c
> @@ -1273,6 +1273,29 @@ rte_mempool_lookup(const char *name)
> return NULL;
> }
>
> + /* Sanity check : secondary may have initialised less mempools
> + * than primary due to linker and constructor magic. Or maybe
> + * there is a mempool corruption or bug. In any case, we can't
> + * go on, we will segfault in an obscure way.
> + * This does not detect the cases where the constructor order
> + * is different between primary and secondary or where the
> + * index points to the wrong ops. This would require more
> + * extensive changes, and is much less likely. Jean II */
> + if (mp->ops_index >= (int32_t) rte_mempool_ops_table.num_ops) {
> + unsigned i;
> + /* Dump list of mempool ops for further investigation.
> + * In most cases, list is empty... */
> + for (i = 0; i < rte_mempool_ops_table.num_ops; i++) {
> + RTE_LOG(ERR, EAL, "Registered mempool[%d] is %s\n",
> + i, rte_mempool_ops_table.ops[i].name);
> + }
> + /* Do not dump mempool list itself, it will segfault. */
> + rte_panic("Cannot find ops for mempool, ops_index %d, "
> + "num_ops %d - maybe due to build process or "
> + "linker configuration\n",
> + mp->ops_index, rte_mempool_ops_table.num_ops);
> + }
> +
> return mp;
> }
>
>
prev parent reply other threads:[~2019-01-11 21:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-10 23:25 Jean Tourrilhes
2019-01-11 21:58 ` Ferruh Yigit [this message]
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=c6c1407b-256e-dbc1-bade-a208cdfed957@intel.com \
--to=ferruh.yigit@intel.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=jt@labs.hpe.com \
--cc=thomas@monjalon.net \
/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).