DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Mattias Rönnblom" <mattias.ronnblom@ericsson.com>
To: <jerinj@marvell.com>
Cc: "Jerin Jacob" <jerinjacobk@gmail.com>,
	hofors@lysator.liu.se, dev@dpdk.org, Van@dpdk.org,
	Haaren@dpdk.org, Harry <harry.van.haaren@intel.com>,
	"Mattias Rönnblom" <mattias.ronnblom@ericsson.com>
Subject: [RFC v3 0/3] Add event dispatcher
Date: Mon, 22 May 2023 11:16:25 +0200	[thread overview]
Message-ID: <20230522091628.96236-1-mattias.ronnblom@ericsson.com> (raw)
In-Reply-To: <20210409113223.65260-1-mattias.ronnblom@ericsson.com>

The purpose of the event dispatcher is to decouple different parts of
an application (e.g., processing pipeline stages), sharing the same
underlying event device.

The event dispatcher replaces the conditional logic (often, a switch
statement) that typically follows an event device dequeue operation,
where events are dispatched to different parts of the application
based on event meta data, such as the queue id or scheduling type.

The concept is similar to a UNIX file descriptor event loop library.
Instead of tying callback functions to fds as for example libevent
does, the event dispatcher relies on application-supplied matching
callback functions to decide where to deliver events.

An event dispatcher is configured to dequeue events from a specific
event device, and ties into the service core framework, to do its (and
the application's) work.

The event dispatcher provides a convenient way for an eventdev-based
application to use service cores for application-level processing, and
thus for sharing those cores with other DPDK services.

Although the event dispatcher adds some overhead, experience suggests
that the net effect on the application (both syntetic benchmarks and
more real-world applications) seems to be positive, except for small
dequeue sizes. This is likely due to improved temporal locality, and
will very greatly. The overhead seems to be ~10 cc/event on a large
core, with a handful of handlers.

Outstanding questions:
 o Explore an option where the callbacks (and callback data) are per lcore.
   More complicated, but more performant for deployments where all
   dispatcher lcores are not used for the same purpose.
 o Reshuffle the handler order in runtime, in such a way that the
   most-often-matched handler is tried first.
 o Consider adding possibility to express simple match functions
   (e..queue_id == 7) without a match callback.
 o Consider runtime reconfiguration.
 o Consider moving dispatcher id allocation from app to DPDK. Avoids
   app-level coordination, but makes the API inconsistent with other
   Eventdev APIs.
 o Should the events delivered to the application in the process callback
   be marked 'const' or not ('const' now, but prohibits reuse for TX).
 o Consider allowing the application setting the process callback to NULL,
   signalling to the dispatcher that processing will occur already at the
   time of the match call. May provide some slight performance benefits
   for applications where the averagenumber of events supplied per process
   function call is very small.

RFC v3:
 o Change from int16_t to int for ids. No particular gain in using
   int16_t over int.
 o Introduce rte_event_dispatcher_start()/stop() to make API consistent
   with the other Eventdev services.
 o Unit tests added.
 o Programming guide added.
 o Added dispatcher statistics.
 o Abandonded the promise to run the match functions in order. This is
   to allow for future performance optimization (i.e., reorder match
   functions so that often-matched functions are checked first).
 o Introduced event_port_id and event_dev_id in the deliver
   callback, to simplify for applications to follow the Eventdev
   API requirements to enqueue forward-type events on the same
   event port as the original events were dequeued.
 o Mark delivered events as constant.
 o Introduce optional callback called by the dispatcher when a full
   batch of events has been distributed to the various handlers. This
   is useful in cases when an event output buffer is shared among
   several handlers.
 o Fixed bug where consumer unregistration would invalidate other
   registration ids.

RFC v2:
 o Introduced a match callback, allowing the application layer to
   route events to callbacks not only based on queue id (like in v1),
   but on arbitrary event meta data or payload.
 o The fallback was removed, since it now easily can be achieved with a
   match function always returning true.
 o The dispatcher now rearranges the batch of dequeued events from the
   event device, in such a way to minimize the number of deliver calls
   made. This is done primariy to improved application cache locality.

Mattias Rönnblom (3):
  eventdev: introduce event dispatcher
  test: add event dispatcher test suite
  doc: add event dispatcher programming guide

 app/test/meson.build                       |   1 +
 app/test/test_event_dispatcher.c           | 814 +++++++++++++++++++++
 doc/api/doxy-api-index.md                  |   1 +
 doc/guides/prog_guide/event_dispatcher.rst | 423 +++++++++++
 doc/guides/prog_guide/index.rst            |   1 +
 lib/eventdev/meson.build                   |   2 +
 lib/eventdev/rte_event_dispatcher.c        | 670 +++++++++++++++++
 lib/eventdev/rte_event_dispatcher.h        | 440 +++++++++++
 lib/eventdev/version.map                   |  12 +
 9 files changed, 2364 insertions(+)
 create mode 100644 app/test/test_event_dispatcher.c
 create mode 100644 doc/guides/prog_guide/event_dispatcher.rst
 create mode 100644 lib/eventdev/rte_event_dispatcher.c
 create mode 100644 lib/eventdev/rte_event_dispatcher.h

-- 
2.34.1


  reply	other threads:[~2023-05-22  9:31 UTC|newest]

Thread overview: 102+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-18 18:30 [dpdk-dev] [RFC] eventdev: introduce " Mattias Rönnblom
2021-02-22 15:28 ` Luca Boccassi
2021-02-26  7:48   ` Mattias Rönnblom
2021-02-25 12:32 ` Jerin Jacob
2021-02-26  8:01   ` Mattias Rönnblom
2021-03-07 13:04     ` Jerin Jacob
2021-03-15 14:44       ` Mattias Rönnblom
2021-03-15 15:00         ` Van Haaren, Harry
2021-03-22  9:50           ` Mattias Rönnblom
2021-04-09 11:32             ` [dpdk-dev] [RFC v2] " Mattias Rönnblom
2023-05-22  9:16               ` Mattias Rönnblom [this message]
2023-05-22  9:16                 ` [RFC v3 1/3] " Mattias Rönnblom
2023-06-09  7:08                   ` [RFC v4 0/3] Add " Mattias Rönnblom
2023-06-09  7:08                     ` [RFC v4 1/3] eventdev: introduce " Mattias Rönnblom
2023-06-09 14:34                       ` Stephen Hemminger
2023-06-09 17:51                         ` Mattias Rönnblom
2023-06-14 17:25                       ` [PATCH 0/3] Add " Mattias Rönnblom
2023-06-14 17:25                         ` [PATCH 1/3] eventdev: introduce " Mattias Rönnblom
2023-06-14 18:13                           ` Stephen Hemminger
2023-06-15  6:07                             ` Mattias Rönnblom
2023-06-16  7:40                           ` [PATCH v2 0/3] Add " Mattias Rönnblom
2023-06-16  7:40                             ` [PATCH v2 1/3] eventdev: introduce " Mattias Rönnblom
2023-08-18  6:09                               ` Jerin Jacob
2023-08-22  8:42                                 ` Mattias Rönnblom
2023-08-22 12:32                                   ` Jerin Jacob
2023-08-24 11:17                                     ` Mattias Rönnblom
2023-08-25  7:27                                       ` Jerin Jacob
2023-09-01 10:53                                 ` Mattias Rönnblom
2023-09-01 10:56                                   ` Jerin Jacob
2023-09-04 13:03                               ` [PATCH v3 0/3] Add dispatcher library Mattias Rönnblom
2023-09-04 13:03                                 ` [PATCH v3 1/3] lib: introduce " Mattias Rönnblom
2023-09-17 16:46                                   ` Naga Harish K, S V
2023-09-19  9:20                                     ` Mattias Rönnblom
2023-09-20  9:11                                       ` Naga Harish K, S V
2023-09-20  9:32                                     ` Jerin Jacob
2023-09-21  5:59                                       ` Naga Harish K, S V
2023-09-21  7:23                                         ` Jerin Jacob
2023-09-19 10:58                                   ` Jerin Jacob
2023-09-21 16:47                                     ` Mattias Rönnblom
2023-09-21 17:47                                       ` Jerin Jacob
2023-09-21 18:36                                   ` Jerin Jacob
2023-09-22  6:32                                     ` Mattias Rönnblom
2023-09-22  7:38                                   ` [PATCH v4 0/3] Add " Mattias Rönnblom
2023-09-22  7:38                                     ` [PATCH v4 1/3] lib: introduce " Mattias Rönnblom
2023-09-25  7:11                                       ` Mattias Rönnblom
2023-09-25  7:59                                         ` Bruce Richardson
2023-09-26 18:28                                         ` Jerin Jacob
2023-09-27  8:13                                           ` Bruce Richardson
2023-09-28  7:44                                             ` Mattias Rönnblom
2023-10-03 17:31                                             ` Jerin Jacob
2023-09-28  7:30                                       ` [PATCH v5 0/3] Add " Mattias Rönnblom
2023-09-28  7:30                                         ` [PATCH v5 1/3] lib: introduce " Mattias Rönnblom
2023-10-05  8:36                                           ` David Marchand
2023-10-05 10:08                                             ` Mattias Rönnblom
2023-10-06  8:46                                               ` David Marchand
2023-10-06  9:03                                                 ` Thomas Monjalon
2023-10-09 17:40                                                   ` Mattias Rönnblom
2023-10-09 16:49                                                 ` Mattias Rönnblom
2023-10-11 14:57                                                   ` David Marchand
2023-10-11 20:51                                                     ` Mattias Rönnblom
2023-10-09 18:17                                           ` [PATCH v6 0/3] Add " Mattias Rönnblom
2023-10-09 18:17                                             ` [PATCH v6 1/3] lib: introduce " Mattias Rönnblom
2023-10-11  7:16                                               ` [PATCH v7 0/3] Add " Mattias Rönnblom
2023-10-11  7:16                                                 ` [PATCH v7 1/3] lib: introduce " Mattias Rönnblom
2023-10-12  8:50                                                   ` [PATCH v8 0/3] Add " Mattias Rönnblom
2023-10-12  8:50                                                     ` [PATCH v8 1/3] lib: introduce " Mattias Rönnblom
2023-10-12  8:50                                                     ` [PATCH v8 2/3] test: add dispatcher test suite Mattias Rönnblom
2023-10-12  8:50                                                     ` [PATCH v8 3/3] doc: add dispatcher programming guide Mattias Rönnblom
2023-10-12 12:48                                                     ` [PATCH v8 0/3] Add dispatcher library David Marchand
2023-10-11  7:16                                                 ` [PATCH v7 2/3] test: add dispatcher test suite Mattias Rönnblom
2023-10-11  7:17                                                 ` [PATCH v7 3/3] doc: add dispatcher programming guide Mattias Rönnblom
2023-10-09 18:17                                             ` [PATCH v6 2/3] test: add dispatcher test suite Mattias Rönnblom
2023-10-10 11:56                                               ` David Marchand
2023-10-11  6:28                                                 ` Mattias Rönnblom
2023-10-11  7:26                                                   ` David Marchand
2023-10-10 14:02                                               ` David Marchand
2023-10-11  6:45                                                 ` Mattias Rönnblom
2023-10-09 18:17                                             ` [PATCH v6 3/3] doc: add dispatcher programming guide Mattias Rönnblom
2023-10-10 13:31                                               ` David Marchand
2023-10-11  6:38                                                 ` Mattias Rönnblom
2023-09-28  7:30                                         ` [PATCH v5 2/3] test: add dispatcher test suite Mattias Rönnblom
2023-10-05  8:36                                           ` David Marchand
2023-10-05 11:25                                             ` Mattias Rönnblom
2023-10-06  8:52                                               ` David Marchand
2023-10-09 17:16                                                 ` Mattias Rönnblom
2023-09-28  7:30                                         ` [PATCH v5 3/3] doc: add dispatcher programming guide Mattias Rönnblom
2023-10-05  8:36                                           ` David Marchand
2023-10-05 11:33                                             ` Mattias Rönnblom
2023-09-22  7:38                                     ` [PATCH v4 2/3] test: add dispatcher test suite Mattias Rönnblom
2023-09-22  7:38                                     ` [PATCH v4 3/3] doc: add dispatcher programming guide Mattias Rönnblom
2023-09-04 13:03                                 ` [PATCH v3 2/3] test: add dispatcher test suite Mattias Rönnblom
2023-09-04 13:03                                 ` [PATCH v3 3/3] doc: add dispatcher programming guide Mattias Rönnblom
2023-09-06 19:32                                 ` [PATCH v3 0/3] Add dispatcher library Stephen Hemminger
2023-09-06 20:28                                   ` Mattias Rönnblom
2023-06-16  7:40                             ` [PATCH v2 2/3] test: add event dispatcher test suite Mattias Rönnblom
2023-06-16  7:40                             ` [PATCH v2 3/3] doc: add event dispatcher programming guide Mattias Rönnblom
2023-06-14 17:25                         ` [PATCH 2/3] test: add event dispatcher test suite Mattias Rönnblom
2023-06-14 17:25                         ` [PATCH 3/3] doc: add event dispatcher programming guide Mattias Rönnblom
2023-06-09  7:08                     ` [RFC v4 2/3] test: add event dispatcher test suite Mattias Rönnblom
2023-06-09  7:08                     ` [RFC v4 3/3] doc: add event dispatcher programming guide Mattias Rönnblom
2023-05-22  9:16                 ` [RFC v3 2/3] test: add event dispatcher test suite Mattias Rönnblom
2023-05-22  9:16                 ` [RFC v3 3/3] doc: add event dispatcher programming guide Mattias Rönnblom

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=20230522091628.96236-1-mattias.ronnblom@ericsson.com \
    --to=mattias.ronnblom@ericsson.com \
    --cc=Haaren@dpdk.org \
    --cc=Van@dpdk.org \
    --cc=dev@dpdk.org \
    --cc=harry.van.haaren@intel.com \
    --cc=hofors@lysator.liu.se \
    --cc=jerinj@marvell.com \
    --cc=jerinjacobk@gmail.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).