DPDK patches and discussions
 help / color / mirror / Atom feed
From: Khadem Ullah <14pwcse1224@uetpeshawar.edu.pk>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: Aman Singh <aman.deep.singh@intel.com>,
	Anatoly Burakov <anatoly.burakov@intel.com>,
	 Ajit Khaparde <ajit.khaparde@broadcom.com>,
	Lijun Ou <oulijun@huawei.com>,
	 Ferruh Yigit <ferruh.yigit@amd.com>,
	Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
	dev@dpdk.org,  dpdk stable <stable@dpdk.org>
Subject: Re: [PATCH v2] app/testpmd: stop secondary process fwd_lcores during primary teardown
Date: Fri, 12 Sep 2025 10:59:43 +0500	[thread overview]
Message-ID: <CA++2-x76rDc-jF3goTY55mf_7oxxFNsNE36nDFfC+n=DMq9L4w@mail.gmail.com> (raw)
In-Reply-To: <CA++2-x5zZJaa_FcX8dzg13Pvmh1gSosmg-xmzAQVL2d51Yrisw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4108 bytes --]

On Fri, Sep 12, 2025 at 8:27 AM Khadem Ullah <14pwcse1224@uetpeshawar.edu.pk>
wrote:

> Hi Stephen,
>
> On Fri, Sep 12, 2025, 04:51 Stephen Hemminger <stephen@networkplumber.org>
> wrote:
>
>>
>> Ok, the Windows #ifdef was confusing me then looked more closely.
>> This patch is adding a set of rings so that primary and secondary
>> can communicate, the adding one command.
>>
>> The idea is good, but there is a better way to handle this.
>> There already exists a way for primary and secondary to communicate
>> through the mp service. This is used for hotplug and pdump and probably
>> other things as well.
>>
> Yeah, agree. Testpmd have also hutplug callbacks, I have tried that too,
> but it is in lower layer to call any stopping fwd_engines.
>
>>
>> The communication can be either way, for example I proposed patches
>> to pdump so that primary can tell secondary to participate.
>>
>>
>> https://patchwork.dpdk.org/project/dpdk/patch/20250814165307.12786-7-stephen@networkplumber.org/
>>
>> This of testpmd can be done in similar way.
>> The handler in secondary should be able to act same as
>> when SIGINT is received. Set the flag f_exit which will cause the main
>> loop to exit.
>>
>> This can then happen immediately, and the proc monitor alarm function
>> is only then needed to handle when primary process crashes.
>>
> Yeah, we can try that, my only concern is that if it can handle and stop
> any numbers of secondary processes fwd_engines as the current solution can
> stop.
>
> Please check the __handle_primary_request in
https://elixir.bootlin.com/dpdk/v25.07/source/lib/eal/common/hotplug_mp.c#L225
,
testpmd is calling this api during hutplug callbacks.
I had tried a similar one as proposed in pdump but could not call
stop_packet_forwarding from this lower layer as given below.
There is only eal_bus_cleanup(), and local_dev_remove support. We only left
with the ring solution
to used if for IPC as in
https://elixir.bootlin.com/dpdk/v25.07/source/examples/multi_process/simple_mp/main.c#L75


git diff
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 0f58a31eb5..9155453efa 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -72,6 +72,7 @@
 #endif
 #ifdef RTE_NET_MLX5
 #include "mlx5_testpmd.h"
+#include "hotplug_mp.h"
 #endif

 #include "testpmd.h"
@@ -3634,6 +3635,11 @@ pmd_test_exit(void)
                        printf("\nStopping port %d...\n", pt_id);
                        fflush(stdout);
                        stop_port(pt_id);
+                       printf("Stopping secondary process...\n");
+                       struct eal_dev_mp_req req;
+                       memset(&req, 0, sizeof(req));
+                       req.t = ETH_REQ_STOP; //EAL_DEV_REQ_TYPE_DETACH;
+                       eal_dev_hotplug_request_to_secondary(&req);
                }
                RTE_ETH_FOREACH_DEV(pt_id) {
                        printf("\nShutting down port %d...\n", pt_id);
diff --git a/lib/eal/common/hotplug_mp.c b/lib/eal/common/hotplug_mp.c
index 17089ca3db..d324db428f 100644
--- a/lib/eal/common/hotplug_mp.c
+++ b/lib/eal/common/hotplug_mp.c
@@ -239,6 +239,11 @@ static void __handle_primary_request(void *param)
        memset(&mp_resp, 0, sizeof(mp_resp));

        switch (req->t) {
+       case ETH_REQ_STOP:
+               printf("__handle_secondary_request called "
+                       "for secondary processes fwd_engine stopping...\n");
+               //eal_bus_cleanup();
+               break;
        case EAL_DEV_REQ_TYPE_ATTACH:
        case EAL_DEV_REQ_TYPE_DETACH_ROLLBACK:
                ret = local_dev_probe(req->devargs, &dev);
diff --git a/lib/eal/common/hotplug_mp.h b/lib/eal/common/hotplug_mp.h
index 7221284286..7a46285994 100644
--- a/lib/eal/common/hotplug_mp.h
+++ b/lib/eal/common/hotplug_mp.h
@@ -19,6 +19,7 @@ enum eal_dev_req_type {
        EAL_DEV_REQ_TYPE_DETACH,
        EAL_DEV_REQ_TYPE_ATTACH_ROLLBACK,
        EAL_DEV_REQ_TYPE_DETACH_ROLLBACK,
+       ETH_REQ_STOP,
 };

[-- Attachment #2: Type: text/html, Size: 5872 bytes --]

      reply	other threads:[~2025-09-12  5:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-10 11:02 [PATCH] " Khadem Ullah
2025-09-10 17:34 ` Stephen Hemminger
2025-09-10 18:16   ` Khadem Ullah
2025-09-11 10:25 ` [PATCH v2] " Khadem Ullah
2025-09-11 17:53   ` Stephen Hemminger
2025-09-11 18:51     ` Khadem Ullah
2025-09-11 19:00     ` Khadem Ullah
2025-09-11 19:23     ` Khadem Ullah
2025-09-11 23:50   ` Stephen Hemminger
2025-09-12  3:27     ` Khadem Ullah
2025-09-12  5:59       ` Khadem Ullah [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='CA++2-x76rDc-jF3goTY55mf_7oxxFNsNE36nDFfC+n=DMq9L4w@mail.gmail.com' \
    --to=14pwcse1224@uetpeshawar.edu.pk \
    --cc=ajit.khaparde@broadcom.com \
    --cc=aman.deep.singh@intel.com \
    --cc=anatoly.burakov@intel.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    --cc=oulijun@huawei.com \
    --cc=stable@dpdk.org \
    --cc=stephen@networkplumber.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).