[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 3/8] x86/iommu: iommu_igfx, iommu_qinval and iommu_snoop are VT-d specific


  • To: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 13 Jan 2023 09:41:40 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=F9UyZXk1/Uh5BjNg7NaKvy6tFD19k2rx/NbURI4rtbI=; b=d5WA9enZNoY1hrGVcRU46kk5NXXVqRattLUdqWknT2vob8Ko2/KAOkNyLKwDZ3dNiXQ+YdZy/61UtPW2FmZ9cg1lpGEnL9Mp5L7+UXL6oS0oInyDSFmbc6AEy2JlYar1O2qvrBgc2W801EWCLwc2HwncpZHX77/2i55I93vZSMjQT71RHKoH8gZ1WoDXzsJR3OD1qwj8mSUJ4XBqM+PhdxAKJ8ap0buK78JzybI9b7ALyRBV3SZj7sEXiyLKmK+flVKE6c1Sr8yupSggNgfZHkXKYNLE/XP7VFECKi9ZpJFaXccfDGd5aQ9ihFg51TQhfs+pGYpNDJ9GBLKSOrfusw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eBzUvhJ/cTh5erRbmioa7r3g3z58OW4XuRMnKQIsqydkLnUnJY0ZRZfg9n9P73CfNLOIqKenAW/Fgwns2kBYi/loHwnVxbFkRmhkQzlEgkbUvg+rSpfvonNJzAAMUjnJERRE/Y/uaA6IdXuQnBx6WMKGSMryfvOvQvh3r1cZPGoMM4uWel7REc8wgsaxMHieDZ0OePZCMAKNMFhiCgG+DvbsNIPoGLD/AxvyPo9ti34XPHf6LPTVbs6tB3xSmKXZYi1STOYjHm1kMRA6yuY4VzUELdoYSuNJ1/OyI+XptFcdfTWzY3kAsIL2IPKtUZo7c1QOwF3eenJcDhCRw3cmrw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Paul Durrant <paul@xxxxxxx>, Roger Pau Monne <roger.pau@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Xenia Ragiadakou <burzalodowa@xxxxxxxxx>
  • Delivery-date: Fri, 13 Jan 2023 08:41:51 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 12.01.2023 19:24, Andrew Cooper wrote:
> On 12/01/2023 3:43 pm, Xenia Ragiadakou wrote:
>>
>> On 1/12/23 13:49, Xenia Ragiadakou wrote:
>>>
>>> On 1/12/23 13:31, Jan Beulich wrote:
>>>> On 04.01.2023 09:44, Xenia Ragiadakou wrote:
>>>>
>>>>> --- a/xen/include/xen/iommu.h
>>>>> +++ b/xen/include/xen/iommu.h
>>>>> @@ -74,9 +74,13 @@ extern enum __packed iommu_intremap {
>>>>>      iommu_intremap_restricted,
>>>>>      iommu_intremap_full,
>>>>>   } iommu_intremap;
>>>>> -extern bool iommu_igfx, iommu_qinval, iommu_snoop;
>>>>>   #else
>>>>>   # define iommu_intremap false
>>>>> +#endif
>>>>> +
>>>>> +#ifdef CONFIG_INTEL_IOMMU
>>>>> +extern bool iommu_igfx, iommu_qinval, iommu_snoop;
>>>>> +#else
>>>>>   # define iommu_snoop false
>>>>>   #endif
>>>>
>>>> Do these declarations really need touching? In patch 2 you didn't move
>>>> amd_iommu_perdev_intremap's either.
>>>
>>> Ok, I will revert this change (as I did in v2 of patch 2) since it is
>>> not needed.
>>
>> Actually, my patch was altering the current behavior by defining
>> iommu_snoop as false when !INTEL_IOMMU.
>>
>> IIUC, there is no control over snoop behavior when using the AMD
>> iommu. Hence, iommu_snoop should evaluate to true for AMD iommu.
>> However, when using the INTEL iommu the user can disable it via the
>> "iommu" param, right?
>>
>> If that's the case then iommu_snoop needs to be moved from vtd/iommu.c
>> to x86/iommu.c and iommu_snoop assignment via iommu param needs to be
>> guarded by CONFIG_INTEL_IOMMU.
>>
> 
> Pretty much everything Xen thinks it knows about iommu_snoop is broken.
> 
> AMD IOMMUs have had this capability since the outset, but it's the FC
> bit (Force Coherent).  On Intel, the capability is optional, and
> typically differs between IOMMUs in the same system.
> 
> Treating iommu_snoop as a single global is buggy, because (when
> available) it's always a per-SBDF control.  It is used to take a TLP and
> force it to be coherent even when the device was trying to issue a
> non-coherent access.
> 
> Intel systems typically have a dedicated IOMMU for the IGD, which always
> issues coherent accesses (its memory access happens as an adjunct to the
> LLC, not as something that communicates with the memory controller
> directly), so the IOMMU doesn't offer snoop control, and Xen "levels"
> this down to "the system can't do snoop control".
> 
> 
> Xen is very confused when it comes to cacheability correctness.  I still
> have a pile of post-XSA-402 work pending, and it needs to start with
> splitting Xen's idea of "domain can use reduced cacheability" from
> "domain has a device", and work incrementally from there.
> 
> But in terms of snoop_control, it's strictly necessary for the cases
> where the guest kernel thinks it is using reduced cacheability, but it
> isn't because of something the hypervisor has done.  But beyond that,
> forcing snoop behind the back of a guest which is using reduced
> cacheability is just a waste of performance.

I guess I agree with most/all you say, but that's all orthogonal to
Xenia's work (and also to the patch I'm about to send to address the
one issue that I've spotted while reviewing Xenia's patch).

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.