APPLIED: [PATCH][focal:linux-azure] net: mana: Add rmb after checking owner bits

Tim Gardner tim.gardner at canonical.com
Tue Nov 29 18:52:16 UTC 2022


On 10/27/22 10:09 AM, Tim Gardner wrote:
> From: Haiyang Zhang <haiyangz at microsoft.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/1994987
> 
> commit 6fd2c68da55c552f86e401ebe40c4a619025ef69 upstream.
> 
> Per GDMA spec, rmb is necessary after checking owner_bits, before
> reading EQ or CQ entries.
> 
> Add rmb in these two places to comply with the specs.
> 
> Cc: stable at vger.kernel.org
> Fixes: ca9c54d2d6a5 ("net: mana: Add a driver for Microsoft Azure Network Adapter (MANA)")
> Reported-by: Sinan Kaya <Sinan.Kaya at microsoft.com>
> Signed-off-by: Haiyang Zhang <haiyangz at microsoft.com>
> Reviewed-by: Dexuan Cui <decui at microsoft.com>
> Link: https://lore.kernel.org/r/1662928805-15861-1-git-send-email-haiyangz@microsoft.com
> Signed-off-by: Jakub Kicinski <kuba at kernel.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
> (cherry picked from commit 71075d7d463281fd43cebf3a10170503a1c72995 linux-5.15.y)
> Signed-off-by: Tim Gardner <tim.gardner at canonical.com>
> ---
>   drivers/net/ethernet/microsoft/mana/gdma_main.c | 10 ++++++++++
>   1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/net/ethernet/microsoft/mana/gdma_main.c b/drivers/net/ethernet/microsoft/mana/gdma_main.c
> index 2f87bf90f8ec..6308ed90b60d 100644
> --- a/drivers/net/ethernet/microsoft/mana/gdma_main.c
> +++ b/drivers/net/ethernet/microsoft/mana/gdma_main.c
> @@ -365,6 +365,11 @@ static void mana_gd_process_eq_events(void *arg)
>   			break;
>   		}
>   
> +		/* Per GDMA spec, rmb is necessary after checking owner_bits, before
> +		 * reading eqe.
> +		 */
> +		rmb();
> +
>   		mana_gd_process_eqe(eq);
>   
>   		eq->head++;
> @@ -1131,6 +1136,11 @@ static int mana_gd_read_cqe(struct gdma_queue *cq, struct gdma_comp *comp)
>   	if (owner_bits != new_bits)
>   		return -1;
>   
> +	/* Per GDMA spec, rmb is necessary after checking owner_bits, before
> +	 * reading completion info
> +	 */
> +	rmb();
> +
>   	comp->wq_num = cqe->cqe_info.wq_num;
>   	comp->is_sq = cqe->cqe_info.is_sq;
>   	memcpy(comp->cqe_data, cqe->cqe_data, GDMA_COMP_DATA_SIZE);
Applied to focal linux-azure:master-next. Thanks.

-rtg
-- 
-----------
Tim Gardner
Canonical, Inc




More information about the kernel-team mailing list