[dpdk-dev] [PATCH v3 2/2] net/mlx5: remove unnecessary wmb for Memory Region cache

Slava Ovsiienko viacheslavo at nvidia.com
Tue May 18 12:17:54 CEST 2021


> -----Original Message-----
> From: Feifei Wang <feifei.wang2 at arm.com>
> Sent: Tuesday, May 18, 2021 11:51
> To: Matan Azrad <matan at nvidia.com>; Shahaf Shuler
> <shahafs at nvidia.com>; Slava Ovsiienko <viacheslavo at nvidia.com>
> Cc: dev at dpdk.org; nd at arm.com; Feifei Wang <feifei.wang2 at arm.com>;
> Ruifeng Wang <ruifeng.wang at arm.com>
> Subject: [PATCH v3 2/2] net/mlx5: remove unnecessary wmb for Memory
> Region cache
> 
> 'dev_gen' is a variable to trigger all cores to flush their local caches once the
> global MR cache has been rebuilt.
> 
> This is due to MR cache's R/W lock can maintain synchronization between
> threads:
> 
> 1. dev_gen and global cache updating ordering inside the lock protected
> section does not matter. Because other threads cannot take the lock until
> global cache has been updated. Thus, in out of order platform, even if other
> agents firstly observe updated dev_gen but global does not update, they
> also have to wait the lock. As a result, it is unnecessary to add a wmb
> between global cache rebuilding and updating the dev_gen to keep the
> memory store order.
> 
> 2. Store-Release of unlock provides the implicit wmb at the level visible by
> software. This makes 'rebuilding global cache' and 'updating dev_gen' be
> observed before local_cache starts to be updated by other agents. Thus,
> wmb after 'updating dev_gen' can be removed.
> 
> Suggested-by: Ruifeng Wang <ruifeng.wang at arm.com>
> Signed-off-by: Feifei Wang <feifei.wang2 at arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang at arm.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo at nvidia.com>

Thanks a lot for patience and cooperation.
With best regards,
Slava


More information about the dev mailing list