On 2022-04-03 19:37, Honnappa Nagarahalli wrote:
+ * Example usage:
+ * @code{.c}
+ * #define MAX_Y_LEN (16)
+ * // Application-defined example data structure, protected by a seqlock.
+ * struct config {
+ * rte_seqlock_t lock;
+ * int param_x;
+ * char param_y[MAX_Y_
>
>
> +__rte_experimental
> +static inline void
> +rte_seqlock_write_lock(rte_seqlock_t *seqlock) {
> + uint32_t sn;
> +
> + /* to synchronize with other writers */
> + rte_spinlock_lock(&seqlock->lock);
> +
> + sn = seqlock->sn + 1;
> >>> The load
+__rte_experimental
+static inline void
+rte_seqlock_write_lock(rte_seqlock_t *seqlock) {
+ uint32_t sn;
+
+ /* to synchronize with other writers */
+ rte_spinlock_lock(&seqlock->lock);
+
+ sn = seqlock->sn + 1;
>>> The load of seqlock->sn could use
(Now using macOS Mail program in plain text mode, hope this works)
> On 2 Apr 2022, at 21:31, Honnappa Nagarahalli
> wrote:
>
>
>
>>> +__rte_experimental
>>> +static inline bool
>>> +rte_seqlock_read_tryunlock(const rte_seqlock_t *seqlock, uint32_t
>>> +*begin_sn) {
>>> + uint32_t end_sn;
>
>
> >> + * Example usage:
> >> + * @code{.c}
> >> + * #define MAX_Y_LEN (16)
> >> + * // Application-defined example data structure, protected by a seqlock.
> >> + * struct config {
> >> + * rte_seqlock_t lock;
> >> + * int param_x;
> >> + * char param_y[MAX_Y_LEN];
> >>
> >> a/app/test/test_seqlock.c b/app/test/test_seqlock.c new file mode
> >> 100644 index 00..54fadf8025
> >> --- /dev/null
> >> +++ b/app/test/test_seqlock.c
> >> @@ -0,0 +1,202 @@
> >> +/* SPDX-License-Identifier: BSD-3-Clause
> >> + * Copyright(c) 2022 Ericsson AB
> >> + */
> >> +
> >>
On 2022-04-02 20:15, Ola Liljedahl wrote:
On 4/1/22 17:07, Mattias Rönnblom wrote:
+
+/**
+ * End a read-side critical section.
+ *
+ * A call to this function marks the end of a read-side critical
+ * section, for @p seqlock. The application must supply the sequence
+ * number produced by the c
I missed some of your comments.
On 2022-04-02 02:21, Honnappa Nagarahalli wrote:
+ * Example usage:
+ * @code{.c}
+ * #define MAX_Y_LEN (16)
+ * // Application-defined example data structure, protected by a seqlock.
+ * struct config {
+ * rte_seqlock_t lock;
+ * int param_x;
;
konstantin.anan...@intel.com; m...@smartsharesystems.com;
step...@networkplumber.org; Mattias Rönnblom
; Ola Liljedahl
Subject: [PATCH v3] eal: add seqlock
A sequence lock (seqlock) is synchronization primitive which allows for data-
race free, low-overhead, high-frequency reads, especially for data
> >
> > > > +__rte_experimental
> > > > +static inline bool
> > > > +rte_seqlock_read_tryunlock(const rte_seqlock_t *seqlock, uint32_t
> > > > +*begin_sn) {
> > > > + uint32_t end_sn;
> > > > +
> > > > + /* make sure the data loads happens before the sn load */
> > > > + rte_atom
> From: Honnappa Nagarahalli [mailto:honnappa.nagaraha...@arm.com]
> Sent: Saturday, 2 April 2022 21.31
>
>
>
> > > +__rte_experimental
> > > +static inline bool
> > > +rte_seqlock_read_tryunlock(const rte_seqlock_t *seqlock, uint32_t
> > > +*begin_sn) {
> > > + uint32_t end_sn;
> > > +
> > > +
>
> > > +__rte_experimental
> > > +static inline bool
> > > +rte_seqlock_read_tryunlock(const rte_seqlock_t *seqlock, uint32_t
> > > +*begin_sn) {
>
> Did anyone object to adding the __attribute__((warn_unused_result))?
>
> Otherwise, I think you should add it.
+1
> > +__rte_experimental
> > +static inline bool
> > +rte_seqlock_read_tryunlock(const rte_seqlock_t *seqlock, uint32_t
> > +*begin_sn) {
> > + uint32_t end_sn;
> > +
> > + /* make sure the data loads happens before the sn load */
> > + rte_atomic_thread_fence(__ATOMIC_ACQUIRE);
> > +
> > +
On 4/1/22 17:07, Mattias Rönnblom wrote:
+
+/**
+ * End a read-side critical section.
+ *
+ * A call to this function marks the end of a read-side critical
+ * section, for @p seqlock. The application must supply the sequence
+ * number produced by the corresponding rte_seqlock_read_lock() (or,
+
> From: Honnappa Nagarahalli [mailto:honnappa.nagaraha...@arm.com]
> Sent: Saturday, 2 April 2022 02.22
>
> > From: Mattias Rönnblom
> > Sent: Friday, April 1, 2022 10:08 AM
> >
> > diff --git a/lib/eal/include/rte_seqlock.h
> > b/lib/eal/include/rte_seqlock.h new file
> Other lock implementation
tin.anan...@intel.com; m...@smartsharesystems.com;
> step...@networkplumber.org; Mattias Rönnblom
> ; Ola Liljedahl
> Subject: [PATCH v3] eal: add seqlock
>
> A sequence lock (seqlock) is synchronization primitive which allows for data-
> race free, low-overhead, high-frequency read
A sequence lock (seqlock) is synchronization primitive which allows
for data-race free, low-overhead, high-frequency reads, especially for
data structures shared across many cores and which are updated with
relatively infrequently.
A seqlock permits multiple parallel readers. The variant of seqloc
17 matches
Mail list logo