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

Bartlomiej Zolnierkiewicz bartlomiej.zolnierkiewicz at canonical.com
Thu Nov 10 17:42:34 UTC 2022


Acked-by: Bartlomiej Zolnierkiewicz <bartlomiej.zolnierkiewicz at canonical.com>

On Thu, Oct 27, 2022 at 6:10 PM Tim Gardner <tim.gardner at canonical.com> 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);
> --
> 2.34.1



More information about the kernel-team mailing list