linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* pcie-uniphier: race condition in masking/unmasking interrupts
@ 2021-08-18 11:38 Pali Rohár
  2021-08-19 10:01 ` Kunihiko Hayashi
  0 siblings, 1 reply; 2+ messages in thread
From: Pali Rohár @ 2021-08-18 11:38 UTC (permalink / raw)
  To: Kunihiko Hayashi; +Cc: Marc Zyngier, linux-pci, linux-kernel

Hello!

Marc pointed during review of pci-aardvark patches one issue which I see
that is available also in the current pcie-uniphier.c driver.

When masking or unmasking interrupts there is read-modify-write sequence
for PCL_RCV_INTX_MASK_SHIFT register without any locking:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/pci/controller/dwc/pcie-uniphier.c?h=v5.13#n171

So when trying to mask/unmask two interrupts at the same time there is
race condition as updating that PCL_RCV_INTX_MASK_SHIFT register is not
atomic.

Could you look at it?

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: pcie-uniphier: race condition in masking/unmasking interrupts
  2021-08-18 11:38 pcie-uniphier: race condition in masking/unmasking interrupts Pali Rohár
@ 2021-08-19 10:01 ` Kunihiko Hayashi
  0 siblings, 0 replies; 2+ messages in thread
From: Kunihiko Hayashi @ 2021-08-19 10:01 UTC (permalink / raw)
  To: Pali Rohár; +Cc: Marc Zyngier, linux-pci, linux-kernel

Hi Pali,

On 2021/08/18 20:38, Pali Rohár wrote:
> Hello!
> 
> Marc pointed during review of pci-aardvark patches one issue which I see
> that is available also in the current pcie-uniphier.c driver.
> 
> When masking or unmasking interrupts there is read-modify-write sequence
> for PCL_RCV_INTX_MASK_SHIFT register without any locking:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/pci/controller/dwc/pcie-uniphier.c?h=v5.13#n171
> 
> So when trying to mask/unmask two interrupts at the same time there is
> race condition as updating that PCL_RCV_INTX_MASK_SHIFT register is not
> atomic.
> 
> Could you look at it?
Thank you for pointing out.
I'll update the mask/unmask/ack operations to avoid race condition.

Thank you,

---
Best Regards
Kunihiko Hayashi

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-19 10:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-18 11:38 pcie-uniphier: race condition in masking/unmasking interrupts Pali Rohár
2021-08-19 10:01 ` Kunihiko Hayashi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).