* Re: Disabling msix interrupts [not found] <063D6719AE5E284EB5DD2968C1650D6DB027C936@AcuExch.aculab.com> @ 2017-02-06 16:26 ` Alexander Duyck 2017-02-06 17:23 ` David Laight 0 siblings, 1 reply; 5+ messages in thread From: Alexander Duyck @ 2017-02-06 16:26 UTC (permalink / raw) To: David Laight; +Cc: netdev@vger.kernel.org, linux-pci@vger.kernel.org On Mon, Feb 6, 2017 at 7:33 AM, David Laight <David.Laight@aculab.com> wrote: > netdev probably isn't the right list for this, but I suspect people > reading it understand what happens. > > I'm fairly sure that an msix interrupt can get raised after > the kernel thinks it has masked it. > > When an msix interrupt is disabled I think msi_set_mask_bit() > (in drivers/pci/msi.c) is called to write a '1' to the card's > hardware MSIX mask register (the last 32bit word of the entry). > This function carefully reads back the mask register to flush > the write through the pcie bus. > Except it doesn't, it reads the 'address_lo' register instead! [1] Reading any register will force the write to be flushed as all PCI writes must be completed before a PCI read. For example in the Intel drivers we read register 0 to flush a write of any of the other registers. > While this will stop the hardware raising any more interrupts, > it could easily be in the process of raising one. > ie have read the mask, found it zero, read the address and > data, and be in the process of issuing the pcie write. > > The pcie write (to disable the interrupt) and readback are seen > by the hardware as (more or less) back to back transfers, so can > both easily overtake the request to raise the interrupt. I don't believe this is correct. On the PCI bus what you should see is the device aware that interrupts are disabled before the completion arrives and any MSI messages should arrive before the last read completion. > The pcie bus is also allowed to make a read completion tlp > overtake a write tlp. > Add in any host-side delays in raising the hardware interrupt > itself, and an interrupt could happen well after it was masked. That is only if relaxed ordering is enabled, which I am not sure is supported for MSI-X interrupts. That being said though I believe there are some platforms that could end up seeing a delay in handling the interrupt if for example the CPU the interrupt was delivered to was in a sleep state. > More worrying would be any code that tries to change the address > and data associated with an interrupt. > You'd need moderate guard times after the disable and before the > enable to ensure the hardware didn't raise an interrupt with > a mismatch of the old and new values. > > [1] Maybe I'll look at the order those cycles actually arrive in. > > David So I have thrown in my $.02 on this, and added the linux-pci mailing list. That is a much better place to bring this up rather than netdev. Thanks. - Alex ^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: Disabling msix interrupts 2017-02-06 16:26 ` Disabling msix interrupts Alexander Duyck @ 2017-02-06 17:23 ` David Laight 2017-02-06 19:14 ` David Miller 0 siblings, 1 reply; 5+ messages in thread From: David Laight @ 2017-02-06 17:23 UTC (permalink / raw) To: 'Alexander Duyck' Cc: netdev@vger.kernel.org, linux-pci@vger.kernel.org RnJvbTogQWxleGFuZGVyIA0KPiBTZW50OiAwNiBGZWJydWFyeSAyMDE3IDE2OjI3DQo+IFRvOiBE YXZpZCBMYWlnaHQNCj4gT24gTW9uLCBGZWIgNiwgMjAxNyBhdCA3OjMzIEFNLCBEYXZpZCBMYWln aHQgPERhdmlkLkxhaWdodEBhY3VsYWIuY29tPiB3cm90ZToNCj4gPiBuZXRkZXYgcHJvYmFibHkg aXNuJ3QgdGhlIHJpZ2h0IGxpc3QgZm9yIHRoaXMsIGJ1dCBJIHN1c3BlY3QgcGVvcGxlDQo+ID4g cmVhZGluZyBpdCB1bmRlcnN0YW5kIHdoYXQgaGFwcGVucy4NCj4gPg0KPiA+IEknbSBmYWlybHkg c3VyZSB0aGF0IGFuIG1zaXggaW50ZXJydXB0IGNhbiBnZXQgcmFpc2VkIGFmdGVyDQo+ID4gdGhl IGtlcm5lbCB0aGlua3MgaXQgaGFzIG1hc2tlZCBpdC4NCj4gPg0KPiA+IFdoZW4gYW4gbXNpeCBp bnRlcnJ1cHQgaXMgZGlzYWJsZWQgSSB0aGluayBtc2lfc2V0X21hc2tfYml0KCkNCj4gPiAoaW4g ZHJpdmVycy9wY2kvbXNpLmMpIGlzIGNhbGxlZCB0byB3cml0ZSBhICcxJyB0byB0aGUgY2FyZCdz DQo+ID4gaGFyZHdhcmUgTVNJWCBtYXNrIHJlZ2lzdGVyICh0aGUgbGFzdCAzMmJpdCB3b3JkIG9m IHRoZSBlbnRyeSkuDQo+ID4gVGhpcyBmdW5jdGlvbiBjYXJlZnVsbHkgcmVhZHMgYmFjayB0aGUg bWF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1cHQgd2l0 aA0KPiA+IGEgbWlzbWF0Y2ggb2YgdGhlIG9sZCBhbmQgbmV3IHZhbHVlcy4NCj4gPg0KPiA+IFsx XSBNYXliZSBJJ2xsIGxvb2sgYXQgdGhlIG9yZGVyIHRob3NlIGN5Y2xlcyBhY3R1YWxseSBhcnJp dmUgaW4uDQo+ID4NCj4gPiAgICAgICAgIERhdmlkDQo+IA0KPiBTbyBJIGhhdmUgdGhyb3duIGlu IG15ICQuMDIgb24gdGhpcywgYW5kIGFkZGVkIHRoZSBsaW51eC1wY2kgbWFpbGluZw0KPiBsaXN0 LiAgVGhhdCBpcyBhIG11Y2ggYmV0dGVyIHBsYWNlIHRvIGJyaW5nIHRoaXMgdXAgcmF0aGVyIHRo YW4NCj4gbmV0ZGV2Lg0KPiANCj4gVGhhbmtzLg0KPiANCj4gLSBBbGV4DQo= ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Disabling msix interrupts 2017-02-06 17:23 ` David Laight @ 2017-02-06 19:14 ` David Miller 2017-02-07 9:55 ` David Laight 0 siblings, 1 reply; 5+ messages in thread From: David Miller @ 2017-02-06 19:14 UTC (permalink / raw) To: David.Laight; +Cc: alexander.duyck, netdev, linux-pci From: David Laight <David.Laight@ACULAB.COM> Date: Mon, 6 Feb 2017 17:23:54 +0000 > Although the 'store buffer' on the sparc cpus I used to use would > let reads overtake writes. So you did have to read back the address > of the last write - not sure about modern sparc cpus. Never would any sparc cpu do so when any of the operations involved were to "side effect" locations, as PCI config space is. ^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: Disabling msix interrupts 2017-02-06 19:14 ` David Miller @ 2017-02-07 9:55 ` David Laight 2017-02-07 16:26 ` David Miller 0 siblings, 1 reply; 5+ messages in thread From: David Laight @ 2017-02-07 9:55 UTC (permalink / raw) To: 'David Miller' Cc: alexander.duyck@gmail.com, netdev@vger.kernel.org, linux-pci@vger.kernel.org From: David Miller > Sent: 06 February 2017 19:15 > From: David Laight <David.Laight@ACULAB.COM> > Date: Mon, 6 Feb 2017 17:23:54 +0000 > > > Although the 'store buffer' on the sparc cpus I used to use would > > let reads overtake writes. So you did have to read back the address > > of the last write - not sure about modern sparc cpus. > > Never would any sparc cpu do so when any of the operations involved > were to "side effect" locations, as PCI config space is. I guess they used non-zero ASI, and that forced the flush?? Normal uncached memory reads would overtake writes. (These were SuperSparc (Viking)). David ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Disabling msix interrupts 2017-02-07 9:55 ` David Laight @ 2017-02-07 16:26 ` David Miller 0 siblings, 0 replies; 5+ messages in thread From: David Miller @ 2017-02-07 16:26 UTC (permalink / raw) To: David.Laight; +Cc: alexander.duyck, netdev, linux-pci From: David Laight <David.Laight@ACULAB.COM> Date: Tue, 7 Feb 2017 09:55:47 +0000 > From: David Miller >> Sent: 06 February 2017 19:15 >> From: David Laight <David.Laight@ACULAB.COM> >> Date: Mon, 6 Feb 2017 17:23:54 +0000 >> >> > Although the 'store buffer' on the sparc cpus I used to use would >> > let reads overtake writes. So you did have to read back the address >> > of the last write - not sure about modern sparc cpus. >> >> Never would any sparc cpu do so when any of the operations involved >> were to "side effect" locations, as PCI config space is. > > I guess they used non-zero ASI, and that forced the flush?? > Normal uncached memory reads would overtake writes. > (These were SuperSparc (Viking)). On sun4m it was controlled by bits in the physical address. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-02-07 16:26 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <063D6719AE5E284EB5DD2968C1650D6DB027C936@AcuExch.aculab.com>
2017-02-06 16:26 ` Disabling msix interrupts Alexander Duyck
2017-02-06 17:23 ` David Laight
2017-02-06 19:14 ` David Miller
2017-02-07 9:55 ` David Laight
2017-02-07 16:26 ` David Miller
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).