[ovs-dev] [PATCH dpdk-latest 1/1] sparse: Fix __ATOMIC_* redefinition errors

David Marchand david.marchand at redhat.com
Thu Oct 22 07:03:03 UTC 2020


On Wed, Oct 21, 2020 at 3:53 PM Eli Britstein <elibr at nvidia.com> wrote:
> >>> I see the changes to the ACQ_REL and ATOMIC_RELAXED, but no mention of the atomic_add_fetch, for my own curiosity must the fetch atomic fetch and gather operations also be wrapped because of the sparse patch or is this more an effort future proof and keep the definitions uniform in OVS? Same query WRT the atomic load operation below.
> >> There is another recent patch:
> >> https://git.kernel.org/pub/scm/devel/sparse/sparse.git/commit/?id=7cdf84691f33e4fc6a0198e1a04137993f3a37ad
> >> This one introduces support for __atomic_add_fetch and friends.
> >> I didn't test it, though.
> > OTOH, __atomic_add_fetch is a builtin function, so, IIUC, ifndef will not work.
>
> I added ifndef as they have define in OVS. We can omit them at all as in
> the previous revert series, but we wanted to keep the option to work
> with old sparse versions.
>
> What do you suggest?

For rte_mbuf.h:
__ATOMIC_ACQ_REL
__ATOMIC_RELAXED
__atomic_add_fetch
__atomic_store_n

Added in sparse with:
cf8f1047 - builtin: add predefines for __ATOMIC_RELAXED & friends (3
days ago) <Luc Van Oostenryck>
7cdf8469 - builtin: add support for __atomic_add_fetch(), ... (3 days
ago) <Luc Van Oostenryck>
f42e2afa - builtin: add support for others generic atomic builtins (3
days ago) <Luc Van Oostenryck>

For rte_trace_point.h:
__ATOMIC_ACQUIRE
__atomic_load_n

Added in sparse with:
cf8f1047 - builtin: add predefines for __ATOMIC_RELAXED & friends (3
days ago) <Luc Van Oostenryck>
f42e2afa - builtin: add support for others generic atomic builtins (3
days ago) <Luc Van Oostenryck>

Checking for a single define is enough to protect all other defines,
since it was an atomic patch.
sparse reverting those builtins is unlikely and we can't detect them
at the preprocessing step: I would move all of this under a single
check on one of the defines.


-- 
David Marchand



More information about the dev mailing list