From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38959) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9uJn-0000CL-Ng for qemu-devel@nongnu.org; Mon, 06 Jun 2016 09:11:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b9uJj-0002zZ-IB for qemu-devel@nongnu.org; Mon, 06 Jun 2016 09:11:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39842) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9uJj-0002zT-CM for qemu-devel@nongnu.org; Mon, 06 Jun 2016 09:11:43 -0400 Date: Mon, 6 Jun 2016 07:11:41 -0600 From: Alex Williamson Message-ID: <20160606071141.31d2008e@ul30vt.home> In-Reply-To: <20160606050407.GB21254@pxdev.xzpeter.org> References: <1463847590-22782-1-git-send-email-bd.aviv@gmail.com> <1463847590-22782-2-git-send-email-bd.aviv@gmail.com> <57408FDB.1010000@web.de> <20160602084439.GB3477@pxdev.xzpeter.org> <20160602070046.761be49c@ul30vt.home> <5750313C.4000709@web.de> <20160606050407.GB21254@pxdev.xzpeter.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3 1/3] IOMMU: add VTD_CAP_CM to vIOMMU capability exposed to guest List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Xu Cc: Jan Kiszka , "Aviv B.D" , qemu-devel@nongnu.org, "Michael S. Tsirkin" On Mon, 6 Jun 2016 13:04:07 +0800 Peter Xu wrote: > On Thu, Jun 02, 2016 at 03:14:36PM +0200, Jan Kiszka wrote: > > On 2016-06-02 15:00, Alex Williamson wrote: > > > On Thu, 2 Jun 2016 16:44:39 +0800 > > > Peter Xu wrote: > [...] > > >> There should be more than one way to make it optional. Which is > > >> better? What I can think of: > > >> > > >> (Assume we have Marcel's "-device intel_iommu" working already) > > >> > > >> 1. Let the CM bit optional, or say, we need to specify something like > > >> "-device intel_iommu,cmbit=on" or we will disable CM bit. If we > > >> have CM disabled but with VFIO device, let QEMU raise error. > > >> > > >> 2. We automatically detect whether we need CM bit. E.g., if we have > > >> VFIO and vIOMMU both enabled, we automatically set the bit. Another > > >> case is maybe we would in the future support nested vIOMMU? If so, > > >> we can do the same thing for the nested feature. > > > > > > > > > Why do we need to support VT-d for guests that do not support CM=1? > > > The VT-d spec indicates that software should be written to handle both > > > caching modes (6.1). Granted this is a *should* and not a *must*, > > > but can't we consider guests that do not support CM=1 incompatible with > > > emulated VT-d? If CM=0 needs to be supported then we need to shadow > > > all of the remapping structures since vfio effectively becomes a cache > > > of the that would otherwise depend on the invalidation of both present > > > and non-present entries. What guests do not support CM=1? Thanks, > > > > - there is at least one guest that does not support CM=1 yet (Jailhouse) > > Besides the reason that there might have guests that do not support > CM=1, will there be performance considerations? When user's > configuration does not require CM capability (e.g., generic VM > configuration, without VFIO), shall we allow user to disable the CM > bit so that we can have better IOMMU performance (avoid extra and > useless invalidations)? With Alexey's proposed patch to have callback ops when the iommu notifier list adds its first entry and removes its last, any of the additional overhead to generate notifies when nobody is listening can be avoided. These same callbacks would be the ones that need to generate a hw_error if a notifier is added while running in CM=0. Thanks, Alex