DPDK patches and discussions
 help / color / mirror / Atom feed
From: Joyce Kong <Joyce.Kong@arm.com>
To: David Marchand <david.marchand@redhat.com>
Cc: "Burakov, Anatoly" <anatoly.burakov@intel.com>,
	Olivier Matz <olivier.matz@6wind.com>,
	Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
	"Wang, Yipeng1" <yipeng1.wang@intel.com>,
	"Gobriel, Sameh" <sameh.gobriel@intel.com>,
	Bruce Richardson <bruce.richardson@intel.com>,
	Vladimir Medvedkin <vladimir.medvedkin@intel.com>,
	"Ananyev, Konstantin" <konstantin.ananyev@intel.com>,
	Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>,
	Ruifeng Wang <Ruifeng.Wang@arm.com>, dev <dev@dpdk.org>,
	nd <nd@arm.com>, dpdk stable <stable@dpdk.org>,
	Aaron Conole <aconole@redhat.com>
Subject: Re: [dpdk-dev] [PATCH v2] test/func_reentrancy: free memzones after creating test case
Date: Fri, 20 Aug 2021 07:57:36 +0000	[thread overview]
Message-ID: <AS8PR08MB69356DA82734E71A66CA09A692C19@AS8PR08MB6935.eurprd08.prod.outlook.com> (raw)
In-Reply-To: <CAJFAV8xUYgJ_BFEJ0yM6yjKW4k++qQHsv_8zdiTmkP7c0f91fA@mail.gmail.com>

> -----Original Message-----
> From: David Marchand <david.marchand@redhat.com>
> Sent: Tuesday, August 17, 2021 4:17 PM
> To: Joyce Kong <Joyce.Kong@arm.com>
> Cc: Burakov, Anatoly <anatoly.burakov@intel.com>; Olivier Matz
> <olivier.matz@6wind.com>; Andrew Rybchenko
> <andrew.rybchenko@oktetlabs.ru>; Wang, Yipeng1
> <yipeng1.wang@intel.com>; Gobriel, Sameh <sameh.gobriel@intel.com>;
> Bruce Richardson <bruce.richardson@intel.com>; Vladimir Medvedkin
> <vladimir.medvedkin@intel.com>; Ananyev, Konstantin
> <konstantin.ananyev@intel.com>; Honnappa Nagarahalli
> <Honnappa.Nagarahalli@arm.com>; Ruifeng Wang
> <Ruifeng.Wang@arm.com>; dev <dev@dpdk.org>; nd <nd@arm.com>; dpdk
> stable <stable@dpdk.org>; Aaron Conole <aconole@redhat.com>
> Subject: Re: [dpdk-dev] [PATCH v2] test/func_reentrancy: free memzones
> after creating test case
> 
> On Sat, Jul 31, 2021 at 2:04 PM Joyce Kong <joyce.kong@arm.com> wrote:
> >
> > Function reentrancy test limits maximum number of iterations
> > simultaneously, however it doesn't free the 'fr_test_once'
> > memzones after the fact, so introduce freeing 'fr_test_once'
> > in ring/mempool/hash/fbk/lpm_clean.
> >
> > Meanwhile, add the missing free for test case on main thread.
> >
> > Fixes: 104a92bd026f ("app: add reentrancy tests")
> > Fixes: 995eec619024 ("test: clean up memory for function reentrancy
> > test")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Joyce Kong <joyce.kong@arm.com>
> > Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> > Reviewed-by: Feifei Wang <feifei.wang2@arm.com>
> 
> This patch actually breaks the test (we are lucky, the failure happens often ;)).
> 
> 28/94 DPDK:fast-tests / func_reentrancy_autotest       FAIL
> 0.22s (exit status 255 or signal 127 SIGinvalid)
> 
> --- command ---
> 16:13:45 DPDK_TEST='func_reentrancy_autotest'
> /home-local/jenkins-local/jenkins-agent/workspace/Generic-Unit-Test-
> DPDK/dpdk/build/app/test/dpdk-test
> -l 0-15 --file-prefix=func_reentrancy_autotest
> --- stdout ---
> RTE>>func_reentrancy_autotest
> Func-ReEnt CASE 0: eal init once PASS
> ring create/lookup: common object allocated 2 times (should be 1) Func-
> ReEnt CASE 1: ring create/lookup FAIL Test Failed
> RTE>>
> --- stderr ---
> 
> 
> I guess, this is what happens:
> 
> main lcore                          worker lcore 1              ...
> worker lcore X
>                                     enters ring_create_lookup()
> 
> enters ring_create_lookup()
> rte_eal_wait_lcore(worker lcore 1);
>                                     leaves ring_create_lookup() ring_clean(worker lcore 1);
> 
> leaves ring_create_lookup()
> 
> There is no synchronisation point for the main lcore to know the worker
> lcores are finished invoking the func callback.
> With this patch, the "common" object is freed by the main lcore
> *potentially* before some workers start trying to create it.
> And we end up with multiple workers successfully creating this object, hence
> the obj_count being incremented.
> 
> 
> --
> David Marchand

I think add rte_eal_mp_wait_lcore() like below can ensure the lcores to free objects
after all func callback finished.
Shall do the change in next version.

	RTE_LCORE_FOREACH_WORKER(lcore_id) {
		if (cores == 1)
			break;
		cores--;
		rte_eal_remote_launch(pt_case->func, pt_case->arg, lcore_id);
	}
	rte_atomic32_set(&synchro, 1);
	if (pt_case->func(pt_case->arg) < 0)
		ret = -1;

+	rte_eal_mp_wait_lcore();

	cores = cores_save;
	RTE_LCORE_FOREACH_WORKER(lcore_id) {
		if (cores == 1)
			break;
		cores--;
-		if (rte_eal_wait_lcore(lcore_id) < 0)
-			ret = -1;
		if (pt_case->clean != NULL)
			pt_case->clean(lcore_id);
	}
	

  reply	other threads:[~2021-08-20  7:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-28  7:33 [dpdk-dev] [PATCH v1] " Joyce Kong
2021-07-30 11:27 ` Olivier Matz
2021-07-31  8:42   ` Joyce Kong
2021-07-31 12:03 ` [dpdk-dev] [PATCH v2] " Joyce Kong
2021-08-17  8:17   ` David Marchand
2021-08-20  7:57     ` Joyce Kong [this message]
2021-08-20  8:52       ` David Marchand
2021-08-23  2:25         ` Joyce Kong
2021-08-20  8:12 ` [dpdk-dev] [PATCH v3] test/func_reentrancy: free memzones after creating test Joyce Kong
2021-08-23  2:57 ` [dpdk-dev] [PATCH v4] " Joyce Kong
2021-09-16 15:04   ` Olivier Matz
2021-09-16 15:09     ` David Marchand

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=AS8PR08MB69356DA82734E71A66CA09A692C19@AS8PR08MB6935.eurprd08.prod.outlook.com \
    --to=joyce.kong@arm.com \
    --cc=Honnappa.Nagarahalli@arm.com \
    --cc=Ruifeng.Wang@arm.com \
    --cc=aconole@redhat.com \
    --cc=anatoly.burakov@intel.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=bruce.richardson@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=konstantin.ananyev@intel.com \
    --cc=nd@arm.com \
    --cc=olivier.matz@6wind.com \
    --cc=sameh.gobriel@intel.com \
    --cc=stable@dpdk.org \
    --cc=vladimir.medvedkin@intel.com \
    --cc=yipeng1.wang@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).