Re: [PATCH RFC v3 00/11] scsi: ufs: Remove overzealous memory barriers

From: Konrad Dybcio
Date: Thu Dec 21 2023 - 14:15:00 EST


On 21.12.2023 20:09, Andrew Halaney wrote:
> This is an RFC because I'm not all the confident in this topic. UFS has
> a lot of mb() variants used, most with comments saying "ensure this
> takes effect before continuing". mb()'s aren't really the way to
> guarantee that, a read back is the best method.
>
> Some of these though I think could go a step further and remove the mb()
> variant without a read back. As far as I can tell there's no real reason
> to ensure it takes effect in most cases (there's no delay() or anything
> afterwards, and eventually another readl()/writel() happens which is by
> definition ordered).
If I understand this correctly - and I'm no expert - it's probably good
practice to read it back in critical places, so that if the code around
it changes, the most crucial writes arrive when expected.

Konrad