Re: [PATCH v4] PCI: Reduce warnings on possible RW1C corruption

From: Rob Herring
Date: Fri Aug 14 2020 - 13:45:27 EST


On Wed, Aug 5, 2020 at 10:15 PM Mark Tomlinson
<mark.tomlinson@xxxxxxxxxxxxxxxxxxx> wrote:
>
> For hardware that only supports 32-bit writes to PCI there is the
> possibility of clearing RW1C (write-one-to-clear) bits. A rate-limited
> messages was introduced by fb2659230120, but rate-limiting is not the
> best choice here. Some devices may not show the warnings they should if
> another device has just produced a bunch of warnings. Also, the number
> of messages can be a nuisance on devices which are otherwise working
> fine.
>
> This patch changes the ratelimit to a single warning per bus. This
> ensures no bus is 'starved' of emitting a warning and also that there
> isn't a continuous stream of warnings. It would be preferable to have a
> warning per device, but the pci_dev structure is not available here, and
> a lookup from devfn would be far too slow.
>
> Suggested-by: Bjorn Helgaas <helgaas@xxxxxxxxxx>
> Fixes: fb2659230120 ("PCI: Warn on possible RW1C corruption for sub-32 bit config writes")
> Signed-off-by: Mark Tomlinson <mark.tomlinson@xxxxxxxxxxxxxxxxxxx>
> ---
> changes in v4:
> - Use bitfield rather than bool to save memory (was meant to be in v3).
>
> drivers/pci/access.c | 9 ++++++---
> include/linux/pci.h | 1 +
> 2 files changed, 7 insertions(+), 3 deletions(-)

Reviewed-by: Rob Herring <robh@xxxxxxxxxx>