Re: [dpdk-dev] [PATCH v3 2/2] net/mlx5: remove unnecessary wmb for Memory Region cache
From: Slava Ovsiienko <hidden>
Date: 2021-05-18 10:17:59
-----Original Message----- From: Feifei Wang <redacted> Sent: Tuesday, May 18, 2021 11:51 To: Matan Azrad <redacted>; Shahaf Shuler [off-list ref]; Slava Ovsiienko [off-list ref] Cc: dev@dpdk.org; nd@arm.com; Feifei Wang <redacted>; Ruifeng Wang [off-list ref] 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 <redacted> Signed-off-by: Feifei Wang <redacted> Reviewed-by: Ruifeng Wang <redacted>
Acked-by: Viacheslav Ovsiienko <redacted> Thanks a lot for patience and cooperation. With best regards, Slava