From: Tim Deegan Subject: Re: RE: IOMMU faults Date: Fri, 17 Jun 2011 09:06:31 +0100 Message-ID: <20110617080631.GK17634@whitby.uk.xensource.com> References: <20110616092509.GH17634@whitby.uk.xensource.com> <987664A83D2D224EAE907B061CE93D5301E73707BF@orsmsx505.amr.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Return-path: Content-Disposition: inline In-Reply-To: <987664A83D2D224EAE907B061CE93D5301E73707BF@orsmsx505.amr.corp.intel.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "Kay, Allen M" Cc: Wei Wang , Jean, xen-devel@lists.xensource.com, Guyader List-Id: xen-devel@lists.xenproject.org At 12:21 -0700 on 16 Jun (1308226873), Kay, Allen M wrote: > > - The Intel IOMMU fault handler prints quite a lot of info in interrupt > > context, making it easier to livelock. Still I think the general > > problem applies on AMD too. > > Someone at Intel looked into implementing measured rate printing in vt-d fault handler. He encountered some complications. I remember it had to do with measured rate printing not enabled by default (?). For now, I think having it print out only for debug case sounds simple enough. I will submit a patch for it. > That's great, thanks. > > - Domain destruction re-assigns passed though cards to dom0, but the > > cards don't seem to get reset. So there's nothing to stop a card > > battering away at DMA in the meantime. That seems like a problem > > independent of livelock, actually. > > >From reading the code in libxl, it seems libxl__device_pci_reset() is called by both libxl__device_pci_add() and do_pci_remove(). Isn't do_pci_remove() called when the pass through device is reassigned to dom0 during a domain teardown? Libxl could be too late, though. When a domain is destroyed, its iommu tables get torn down in Xen. So if it has active devices: - they can start raising IOMMU faults immediately, and in some circumstances libxl might never get to run. - since deassign is implemented as "assign to dom0" they might start DMAing over dom0 memory. If we can rely on the dom0 tools always completely resetting a domains's devices before calling domctl_destroydomain, that should never happen. That seems a bit fragile, though I guess dom0 can shoot itself in the foot in enough other ways. I prefer Jean's reset-in-xen approach; it's only a few hundred lines of code and we could reuse some of it for resetting badly-behaved cards from the IOMMU fault handler. Tim. -- Tim Deegan Principal Software Engineer, Xen Platform Team Citrix Systems UK Ltd. (Company #02937203, SL9 0BG)