From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36597) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cUVWh-0008DF-Of for qemu-devel@nongnu.org; Fri, 20 Jan 2017 04:30:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cUVWe-0003Qx-Lj for qemu-devel@nongnu.org; Fri, 20 Jan 2017 04:30:31 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42726) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cUVWe-0003QG-Fh for qemu-devel@nongnu.org; Fri, 20 Jan 2017 04:30:28 -0500 Date: Fri, 20 Jan 2017 17:30:24 +0800 From: Peter Xu Message-ID: <20170120093024.GN4914@pxdev.xzpeter.org> References: <1484276800-26814-1-git-send-email-peterx@redhat.com> <1484276800-26814-2-git-send-email-peterx@redhat.com> <20170120085457.GI4914@pxdev.xzpeter.org> <20170120091143.GK4914@pxdev.xzpeter.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH RFC v3 01/14] IOMMU: add option to enable VTD_CAP_CM to vIOMMU capility exposoed to guest List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Tian, Kevin" Cc: "qemu-devel@nongnu.org" , "Lan, Tianyu" , "mst@redhat.com" , "jan.kiszka@siemens.com" , "jasowang@redhat.com" , "alex.williamson@redhat.com" , "bd.aviv@gmail.com" On Fri, Jan 20, 2017 at 09:20:01AM +0000, Tian, Kevin wrote: > > From: Peter Xu [mailto:peterx@redhat.com] > > Sent: Friday, January 20, 2017 5:12 PM > > > > On Fri, Jan 20, 2017 at 08:59:01AM +0000, Tian, Kevin wrote: > > > > [...] > > > > > > > Also for hot-add > > > > > device path, some check of caching mode is required. If not set, > > > > > should we fail hot-add operation? I don't think we have such physical > > > > > platform with some devices behind IOMMU while others not. > > > > > > > > Could you explain in what case will we fail a hot plug? > > > > > > > > > > user enables intel-iommu, but don't set caching mode. > > > > > > Then later user hot-add a PCI device to the VM. Guest will assume > > > newly assigned device also behind the default vIOMMU, and thus > > > needs to setup IOVA mappings, which is then broken... > > > > Is the newly added device a vfio-pci device? If so, we should hit > > this and VM will stops to work: > > > > if (!s->cache_mode_enabled && new & IOMMU_NOTIFIER_MAP) { > > error_report("We need to set cache_mode=1 for intel-iommu to enable " > > "device assignment with IOMMU protection."); > > exit(1); > > } > > sorry I didn't found this code. In which code path is it hit? It's in patch 14/14 of this series. > > > > > I admit this is not user-friendly, and a better way may be that we > > disallow the hot-plug in that case, telling the user about the error, > > rather than crashing the VM. But, I think that can be a patch outside > > this series, considering (again) that this only affects advanced > > users. > > > > Crashing VM is bad.... but anyway, I'll leave maintainer to decide > whether they'd like it fixed now or later. :-) Sure. Thanks, -- peterx