From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C9DC642C5C; Thu, 8 Jun 2023 12:42:55 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BAF7C40EE3; Thu, 8 Jun 2023 12:42:55 +0200 (CEST) Received: from mail-ua1-f43.google.com (mail-ua1-f43.google.com [209.85.222.43]) by mails.dpdk.org (Postfix) with ESMTP id 642F0406B5 for ; Thu, 8 Jun 2023 12:42:54 +0200 (CEST) Received: by mail-ua1-f43.google.com with SMTP id a1e0cc1a2514c-786470fd7a3so161283241.3 for ; Thu, 08 Jun 2023 03:42:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686220973; x=1688812973; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=LLmHySaTvdnP7v9but2Lvt3yhZ+XsQS+OYdm+65kjrM=; b=T5aTdtIbLY0afQ73hATcpYmxGBaQH3+Dnz4Y6F6lceB9XbkbJ4ab4Eyq/slEDEbPcu 2vPgoTUJKClFhaK36flyWK9NeLTiinEWDAHkXUwlJ6BtS5z4Pm77MxttLlL0NCmsmV37 ygujK+DNqoFjCVnCzo37Dpj+c+3gWfEbCpyTeuWXqV5y7eN10sNRTZy1fbhQUIYSp93t lp/OJtZAIphAMag2PMpPc3yvu49tdMBpBQoX0Ywn3a44v+qJiRKxGrk9pOtgJI0yvvxQ wxLQ7Cc2qtYl4GaA3OxZxFLfu5BMbHrBoFn488w3XvtYEaUHNheMzZVAqkVdNaxi/ZZw ARHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686220973; x=1688812973; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LLmHySaTvdnP7v9but2Lvt3yhZ+XsQS+OYdm+65kjrM=; b=aSCIk/lf1/E/BqzZkU2kNzx01Rd/gpMQCFlKUcb4C8rWZ34e/8FDZmC24vfc6eRvP9 zqAUIfqQ1VE0Dhfl+RxKTSy3TqbmnpvLrmx088FgfJGxt/Eo/Cyju2iRKiqcThjQ6pPJ yWIiJPRdRldpz1ba91xi+x8u/axwABgjx0S6v3mNMvGX9UOnh/y4e/CdcKUWhuRD0uYu GseXpiNpt5vjLf8hUbwxL0j6PTDhxi93Tfq218TcAhW2WhuR1ozaQbg7YX3ueroI7UKz bup75DcRUuYXOgWDbnekOgmx3s3Ga3uccv4NLZnpoch+dBqpeHfgQVIwh+TYV7q+vt+Q 4GKg== X-Gm-Message-State: AC+VfDwgB2kj10JBeZcP/XnvqURMT1NSJuG7UWOP7RGrukg4RTtIxZza ZBT2Y/tIr6OM2mqpsAwStaCYQI/hf5LhfO5gUSQ= X-Google-Smtp-Source: ACHHUZ7qZjl6vQZgRU5A2nMGoqEXzDkuhKaDa/nQDQrn+hymiyPW6U2ETfSMxjLUGExO3+dj34/y38+ZFU2NDr8XY44= X-Received: by 2002:a67:f993:0:b0:43b:34ff:5b4a with SMTP id b19-20020a67f993000000b0043b34ff5b4amr1517903vsq.28.1686220973511; Thu, 08 Jun 2023 03:42:53 -0700 (PDT) MIME-Version: 1.0 References: <20230607035144.1214492-1-zhirun.yan@intel.com> <20230608095759.1800617-1-zhirun.yan@intel.com> <20230608095759.1800617-14-zhirun.yan@intel.com> In-Reply-To: <20230608095759.1800617-14-zhirun.yan@intel.com> From: Jerin Jacob Date: Thu, 8 Jun 2023 16:12:27 +0530 Message-ID: Subject: Re: [PATCH v10 13/16] graph: enable graph multicore dispatch scheduler model To: Zhirun Yan Cc: dev@dpdk.org, jerinj@marvell.com, kirankumark@marvell.com, ndabilpuram@marvell.com, stephen@networkplumber.org, pbhagavatula@marvell.com, cunming.liang@intel.com, haiyue.wang@intel.com, mattias.ronnblom@ericsson.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Thu, Jun 8, 2023 at 3:35=E2=80=AFPM Zhirun Yan wr= ote: > > This patch enables to chose new scheduler model. Must define > RTE_GRAPH_MODEL_SELECT before including rte_graph_worker.h > to enable specific model choosing. > > Signed-off-by: Haiyue Wang > Signed-off-by: Cunming Liang > Signed-off-by: Zhirun Yan Acked-by: Jerin Jacob > --- > doc/guides/prog_guide/graph_lib.rst | 71 ++++++++++++++++++++++++++--- > lib/graph/rte_graph_worker.h | 13 ++++++ > 2 files changed, 77 insertions(+), 7 deletions(-) > > diff --git a/doc/guides/prog_guide/graph_lib.rst b/doc/guides/prog_guide/= graph_lib.rst > index 1cfdc86433..017cc25fd3 100644 > --- a/doc/guides/prog_guide/graph_lib.rst > +++ b/doc/guides/prog_guide/graph_lib.rst > @@ -189,13 +189,70 @@ In the above example, A graph object will be create= d with ethdev Rx > node of port 0 and queue 0, all ipv4* nodes in the system, > and ethdev tx node of all ports. > > -Multicore graph processing > -~~~~~~~~~~~~~~~~~~~~~~~~~~ > -In the current graph library implementation, specifically, > -``rte_graph_walk()`` and ``rte_node_enqueue*`` fast path API functions > -are designed to work on single-core to have better performance. > -The fast path API works on graph object, So the multi-core graph > -processing strategy would be to create graph object PER WORKER. > +Graph models > +~~~~~~~~~~~~ > +There are two different kinds of graph walking models. User can select t= he model using > +``rte_graph_worker_model_set()`` API. If the application decides to use = only one model, > +the fast path check can be avoided by defining the model with RTE_GRAPH_= MODEL_SELECT. > +For example: > + > +.. code-block:: console > + > +#define RTE_GRAPH_MODEL_SELECT RTE_GRAPH_MODEL_RTC > +#include "rte_graph_worker.h" > + > +RTC (Run-To-Completion) > +^^^^^^^^^^^^^^^^^^^^^^^ > +This is the default graph walking model. Specifically, ``rte_graph_walk_= rtc()`` and > +``rte_node_enqueue*`` fast path API functions are designed to work on si= ngle-core to > +have better performance. The fast path API works on graph object, So the= multi-core > +graph processing strategy would be to create graph object PER WORKER. > + > +Example: > + > +Graph: node-0 -> node-1 -> node-2 @Core0. > + > +.. code-block:: diff > + > + + - - - - - - - - - - - - - - - - - - - - - + > + ' Core #0 ' > + ' ' > + ' +--------+ +---------+ +--------+ ' > + ' | Node-0 | --> | Node-1 | --> | Node-2 | ' > + ' +--------+ +---------+ +--------+ ' > + ' ' > + + - - - - - - - - - - - - - - - - - - - - - + > + > +Dispatch model > +^^^^^^^^^^^^^^ > +The dispatch model enables a cross-core dispatching mechanism which empl= oys > +a scheduling work-queue to dispatch streams to other worker cores which > +being associated with the destination node. > + > +Use ``rte_graph_model_mcore_dispatch_lcore_affinity_set()`` to set lcore= affinity > +with the node. > +Each worker core will have a graph repetition. Use ``rte_graph_clone()``= to clone > +graph for each worker and use``rte_graph_model_mcore_dispatch_core_bind(= )`` to > +bind graph with the worker core. > + > +Example: > + > +Graph topo: node-0 -> Core1; node-1 -> node-2; node-2 -> node-3. > +Config graph: node-0 @Core0; node-1/3 @Core1; node-2 @Core2. > + > +.. code-block:: diff > + > + + - - - - - -+ +- - - - - - - - - - - - - + + - - - - - -+ > + ' Core #0 ' ' Core #1 ' ' Core #2 ' > + ' ' ' ' ' ' > + ' +--------+ ' ' +--------+ +--------+ ' ' +--------+ ' > + ' | Node-0 | - - - ->| Node-1 | | Node-3 |<- - - - | Node-2 | ' > + ' +--------+ ' ' +--------+ +--------+ ' ' +--------+ ' > + ' ' ' | ' ' ^ ' > + + - - - - - -+ +- - -|- - - - - - - - - - + + - - -|- - -+ > + | | > + + - - - - - - - - - - - - - - - - + > + > > In fast path > ~~~~~~~~~~~~ > diff --git a/lib/graph/rte_graph_worker.h b/lib/graph/rte_graph_worker.h > index 5b58f7bda9..6685600813 100644 > --- a/lib/graph/rte_graph_worker.h > +++ b/lib/graph/rte_graph_worker.h > @@ -11,6 +11,7 @@ extern "C" { > #endif > > #include "rte_graph_model_rtc.h" > +#include "rte_graph_model_mcore_dispatch.h" > > /** > * Perform graph walk on the circular buffer and invoke the process func= tion > @@ -25,7 +26,19 @@ __rte_experimental > static inline void > rte_graph_walk(struct rte_graph *graph) > { > +#if defined(RTE_GRAPH_MODEL_SELECT) && (RTE_GRAPH_MODEL_SELECT =3D=3D RT= E_GRAPH_MODEL_RTC) > rte_graph_walk_rtc(graph); > +#elif defined(RTE_GRAPH_MODEL_SELECT) && (RTE_GRAPH_MODEL_SELECT =3D=3D = RTE_GRAPH_MODEL_MCORE_DISPATCH) > + rte_graph_walk_mcore_dispatch(graph); > +#else > + switch (rte_graph_worker_model_no_check_get(graph)) { > + case RTE_GRAPH_MODEL_MCORE_DISPATCH: > + rte_graph_walk_mcore_dispatch(graph); > + break; > + default: > + rte_graph_walk_rtc(graph); > + } > +#endif > } > > #ifdef __cplusplus > -- > 2.37.2 >