EM-ODP 4.4.0
Event Machine on ODP
Loading...
Searching...
No Matches
em_atomic_group.h File Reference
#include <stdint.h>
#include <odp_api.h>
#include <event_machine.h>
#include "em_atomic_group_types.h"
#include "em_mem.h"
#include "em_queue_types.h"
#include "misc/list.h"
#include "misc/objpool.h"
Include dependency graph for em_atomic_group.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define invalid_atomic_group(atomic_group)    ((unsigned int)agrp_hdl2idx((atomic_group)) >= EM_MAX_ATOMIC_GROUPS)
 

Functions

em_status_t atomic_group_init (atomic_group_tbl_t *const atomic_group_tbl, atomic_group_pool_t *const atomic_group_pool)
 
em_atomic_group_t atomic_group_alloc (void)
 
em_status_t atomic_group_free (em_atomic_group_t atomic_group)
 
void atomic_group_remove_queue (queue_elem_t *const q_elem)
 
void atomic_group_dispatch (odp_event_t odp_evtbl[], const int num_events, queue_elem_t *q_elem)
 
void atomic_group_release (void)
 
unsigned int atomic_group_count (void)
 
void print_atomic_group_info (void)
 
void print_atomic_group_queues (em_atomic_group_t ag)
 
void print_ag_elem_info (void)
 

Detailed Description

EM internal atomic group functions

Definition in file em_atomic_group.h.

Macro Definition Documentation

◆ invalid_atomic_group

#define invalid_atomic_group (   atomic_group)     ((unsigned int)agrp_hdl2idx((atomic_group)) >= EM_MAX_ATOMIC_GROUPS)

Definition at line 56 of file em_atomic_group.h.

Function Documentation

◆ atomic_group_alloc()

em_atomic_group_t atomic_group_alloc ( void  )

Dynamic atomic group allocation

Definition at line 119 of file em_atomic_group.c.

◆ atomic_group_count()

unsigned int atomic_group_count ( void  )

Definition at line 171 of file em_atomic_group.c.

◆ atomic_group_dispatch()

void atomic_group_dispatch ( odp_event_t  odp_evtbl[],
const int  num_events,
queue_elem_t *const  q_elem 
)

Dispatch function for events from queues belonging to an atomic group.

Atomicity across the queues of an atomic group is guaranteed by letting only one core dispatch the group's events at a time, serialized by the per-group dispatch lock.

Fast path: when the lock is free and the internal stash is empty, take the lock and dispatch the just-scheduled events directly. They have already been scheduled and, with an empty stash, are the head of the atomic group FIFO - pushing them through the stash only to immediately pull them back out is pure overhead. Events that other cores stash while this core dispatches are drained afterwards by ag_dispatch_loop().

Slow path (lock held elsewhere or stash non-empty): enqueue the events into the group's internal stash - this can run in parallel on several cores - then try to become the single dispatching core.

Parameters
odp_evtblEvents received from the scheduler from an AG queue
num_eventsNumber of events received
q_elemQueue element, queue is part of the atomic group

Definition at line 644 of file em_atomic_group.c.

◆ atomic_group_free()

em_status_t atomic_group_free ( em_atomic_group_t  atomic_group)

Definition at line 136 of file em_atomic_group.c.

◆ atomic_group_init()

em_status_t atomic_group_init ( atomic_group_tbl_t *const  atomic_group_tbl,
atomic_group_pool_t *const  atomic_group_pool 
)

Atomic group inits done at global init (once at startup on one core)

Definition at line 68 of file em_atomic_group.c.

◆ atomic_group_release()

void atomic_group_release ( void  )

Release the atomic group dispatch lock.

Called by em_atomic_processing_end() if 'locm->event_burst_cnt == 0' since the atomic context can only be dropped for the last event (or last set of events in the case of EO multircv).

Definition at line 540 of file em_atomic_group.c.

◆ atomic_group_remove_queue()

void atomic_group_remove_queue ( queue_elem_t *const  q_elem)

Called by em_queue_delete() to remove the queue from the atomic group list

Definition at line 154 of file em_atomic_group.c.

◆ print_ag_elem_info()

void print_ag_elem_info ( void  )

Definition at line 838 of file em_atomic_group.c.

◆ print_atomic_group_info()

void print_atomic_group_info ( void  )

Print information about all atomic groups

Definition at line 696 of file em_atomic_group.c.

◆ print_atomic_group_queues()

void print_atomic_group_queues ( em_atomic_group_t  ag)

Print information about all queues of the given atomic group

Definition at line 767 of file em_atomic_group.c.