[dpdk-dev] [PATCH] eal/arm64: fix memory barrier macros

Thomas Monjalon thomas at monjalon.net
Tue Jan 16 01:21:28 CET 2018


16/01/2018 00:59, Thomas Monjalon:
> The macros dsb and dmb are defined as an instruction block with braces.
> As a consequence, when it is used in if/else without brace:
> 	if (cond)
> 		rte_mb();
> 	else
> 		statement;
> the added semicolon is parsed outside of if/else,
> so the "else" cannot match the "if":
> 	if (cond) {
> 		asm volatile("dsb sy" : : : "memory");
> 	}
> 	;
> 	else
> 		statement
> 
> The solution is either to use the "do { } while (0)" construct,
> or simply remove the braces because there is only one statement.
> 
> Fixes: 84733fd0d75e ("eal/arm64: fix memory barrier definition")

Just seen there is already a patch doing the same thing by Jia He:
	https://dpdk.org/patch/31896
This patch is in a series waiting for required changes.



More information about the dev mailing list