From: "Jan Beulich" Subject: Re: [PATCH 2/2 V2] iommu/amd: Workaround for erratum 787 Date: Mon, 10 Jun 2013 10:47:43 +0100 Message-ID: <51B5BCDF02000078000DC94E@nat28.tlf.novell.com> References: <1370840751-11277-1-git-send-email-suravee.suthikulpanit@amd.com> <1370840751-11277-2-git-send-email-suravee.suthikulpanit@amd.com> <20130610093532.GA8802@ocelot.phlegethon.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20130610093532.GA8802@ocelot.phlegethon.org> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: suravee.suthikulpanit@amd.com, Tim Deegan Cc: xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org >>> On 10.06.13 at 11:35, Tim Deegan wrote: > At 00:05 -0500 on 10 Jun (1370822751), suravee.suthikulpanit@amd.com wrote: >> From: Suravee Suthikulpanit >> >> The IOMMU interrupt handling in bottom half must clear the PPR log interrupt >> and event log interrupt bits to re-enable the interrupt. This is done by >> writing 1 to the memory mapped register to clear the bit. Due to hardware > bug, >> if the driver tries to clear this bit while the IOMMU hardware also setting >> this bit, the conflict will result with the bit being set. If the interrupt >> handling code does not make sure to clear this bit, subsequent changes in > the >> event/PPR logs will no longer generating interrupts, and would result if >> buffer overflow. After clearing the bits, the driver must read back >> the register to verify. > > Is there a risk of livelock here? That is, if some device is causing a > lot of IOMMU faults, a CPU could get stuck in this loop re-enabling > interrupts as fast as they are raised. > > The solution suggested in the erratum seems better: if the bit is set > after clearing, process the interrupts again (i.e. run/schedule the > top-half handler). That way the bottom-half handler will definitely > terminate and the system can make some progress. That's what's being done really: The actual interrupt handler disables the interrupt sources, and the tasklet re-enables them (or at least is supposed to do so - patch 1 isn't really correct in the respect). The only thing that I think is wrong (but again already in patch 1) is that the status bit should get cleared before an interrupt source gets re-enabled. I started cleaning up patch 1 anyway, so I'll post a v3 once done. Jan