[PATCH v1 09/12] app/compress: use compiler atomic builtins for display sync
Joyce Kong
Joyce.Kong at arm.com
Thu Nov 11 09:13:39 CET 2021
> <snip>
>
> >
> > + exp = 0;
> > /* R E P O R T processing */
> > - if (rte_atomic16_test_and_set(&display_once)) {
> > + if (__atomic_compare_exchange_n(&display_once, &exp, 1, 0,
> > + __ATOMIC_RELAXED, __ATOMIC_RELAXED)) {
> I think we can re-organize the current code which will avoid using atomic
> operations on 'display_once'. How about the following code?
>
> rte_spinlock_lock(&print_spinlock);
> if (display_once != 1) {
> display_once = 1;
> printf("\nLegend for the table\n".....
> <all other printfs>
> }
> printf....
> printf....
> printf....
> rte_spinlock_unlock(&print_spinlock);
>
> Rest of the changes look fine.
>
Will send out the next version with the changes.
More information about the dev
mailing list