DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ruifeng Wang <Ruifeng.Wang@arm.com>
To: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>,
	Harry van Haaren <harry.van.haaren@intel.com>,
	Jerin Jacob <jerin.jacob@caviumnetworks.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, "stable@dpdk.org" <stable@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] eal: fix lcore state bug
Date: Wed, 29 Apr 2020 03:11:00 +0000	[thread overview]
Message-ID: <HE1PR0801MB20256DBE2654CFFBEA510B489EAD0@HE1PR0801MB2025.eurprd08.prod.outlook.com> (raw)
In-Reply-To: <20200428012139.32196-1-l.wojciechow@partner.samsung.com>


> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Lukasz Wojciechowski
> Sent: Tuesday, April 28, 2020 9:22 AM
> To: Harry van Haaren <harry.van.haaren@intel.com>; Jerin Jacob
> <jerin.jacob@caviumnetworks.com>
> Cc: dev@dpdk.org; l.wojciechow@partner.samsung.com; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH] eal: fix lcore state bug
>
> The rte_service_lcore_reset_all function stops execution of services on all
> lcores and switches them back from ROLE_SERVICE to ROLE_RTE.
> However the thread loop for slave lcores (eal_thread_loop) distincts these
> roles to set lcore state after processing delegated function.
> It sets WAIT state for ROLE_SERVICE, but FINISHED for ROLE_RTE.
> So changing the role to RTE before stopping work in slave lcores causes lcores
> to end in FINISHED state. That is why the rte_eal_lcore_wait must be run
> after rte_service_lcore_reset_all to bring back lcores to launchable (WAIT)
> state.
> This has been fixed in test app and clarified in API documentation.
>
> Setting the state to WAIT in rte_service_runner_func is premature as the
> rte_service_runner_func function is still a part of the lcore function
> delegated to slave lcore. The state is overwritten anyway in slave lcore
> thread loop. This premature setting state to WAIT might however cause
> rte_eal_lcore_wait, that was called by the application, to return before slave
> lcore thread set the FINISHED state. That's why it is removed from librte_eal
> rte_service_runner_func function.
>
> Bugzilla ID: 464
> Fixes: 21698354c832 ("service: introduce service cores concept")
> Fixes: f038a81e1c56 ("service: add unit tests")
> Cc: harry.van.haaren@intel.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
> ---
>  app/test/test_service_cores.c        | 1 +
>  lib/librte_eal/common/rte_service.c  | 2 --
> lib/librte_eal/include/rte_service.h | 4 ++++
>  3 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/app/test/test_service_cores.c b/app/test/test_service_cores.c
> index a922c7ddc..2a4978e29 100644
> --- a/app/test/test_service_cores.c
> +++ b/app/test/test_service_cores.c
> @@ -114,6 +114,7 @@ unregister_all(void)
>  }
>
>  rte_service_lcore_reset_all();
> +rte_eal_mp_wait_lcore();
>
>  return TEST_SUCCESS;
>  }
> diff --git a/lib/librte_eal/common/rte_service.c
> b/lib/librte_eal/common/rte_service.c
> index 70d17a5d7..018876199 100644
> --- a/lib/librte_eal/common/rte_service.c
> +++ b/lib/librte_eal/common/rte_service.c
> @@ -458,8 +458,6 @@ rte_service_runner_func(void *arg)
>  rte_smp_rmb();
>  }
>
> -lcore_config[lcore].state = WAIT;
> -
>  return 0;
>  }
>
> diff --git a/lib/librte_eal/include/rte_service.h
> b/lib/librte_eal/include/rte_service.h
> index d8701dd4c..acdda8c54 100644
> --- a/lib/librte_eal/include/rte_service.h
> +++ b/lib/librte_eal/include/rte_service.h
> @@ -300,6 +300,10 @@ int32_t rte_service_lcore_count(void);
>   * from duty, just unmaps all services / cores, and stops() the service cores.
>   * The runstate of services is not modified.
>   *
> + * The cores that are stopped with this call, are in FINISHED state and
> + * the application must take care of bringing them back to a launchable state:
> + * e.g. call *rte_eal_lcore_wait* on the lcore_id.
> + *
>   * @retval 0 Success
>   */
>  int32_t rte_service_lcore_reset_all(void);
> --
> 2.17.1

Tested-by: Ruifeng Wang <ruifeng.wang@arm.com>

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

  reply	other threads:[~2020-04-29  3:11 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20200428012204eucas1p120a84e501d0d64145c21476cd2562f36@eucas1p1.samsung.com>
2020-04-28  1:21 ` Lukasz Wojciechowski
2020-04-29  3:11   ` Ruifeng Wang [this message]
2020-04-29 15:07   ` Phil Yang
2020-04-29 21:32     ` Lukasz Wojciechowski
2020-04-30  2:54       ` Phil Yang
2020-04-30  9:06         ` Lukasz Wojciechowski
2020-05-08 16:12         ` Van Haaren, Harry
2020-05-08 17:04           ` Lukasz Wojciechowski
2020-05-18 18:25   ` Lukasz Wojciechowski
2020-05-18 18:39     ` David Marchand
2020-05-18 18:43       ` Lukasz Wojciechowski
2020-05-20 11:40         ` Van Haaren, Harry
2020-05-20 12:47           ` Lukasz Wojciechowski
     [not found]   ` <CGME20200708133748eucas1p2dbe34d8605d8f618559daee9cbeaa73d@eucas1p2.samsung.com>
2020-07-08 13:37     ` [dpdk-dev] [PATCH v2] " Lukasz Wojciechowski
2020-07-08 14:52       ` Van Haaren, Harry
2020-07-08 17:10         ` David Marchand
2020-07-08 19:37           ` Lukasz Wojciechowski

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=HE1PR0801MB20256DBE2654CFFBEA510B489EAD0@HE1PR0801MB2025.eurprd08.prod.outlook.com \
    --to=ruifeng.wang@arm.com \
    --cc=dev@dpdk.org \
    --cc=harry.van.haaren@intel.com \
    --cc=jerin.jacob@caviumnetworks.com \
    --cc=l.wojciechow@partner.samsung.com \
    --cc=stable@dpdk.org \
    /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).