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

Re: [Xen-devel] [PATCH v4 12/12] AMD/IOMMU: miscellaneous DTE handling adjustments


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <JBeulich@xxxxxxxx>
  • Date: Tue, 30 Jul 2019 14:10:29 +0000
  • Accept-language: en-US
  • 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-SenderADCheck; bh=lOkg42hpgNIzlA3hJUWbns3pme4vrbbvXcj/5JLTV98=; b=TnJbHewtxxlaWtsmGy7k1HWVW5dVmCoJxfBTVQ04S1Uyt8EAuFnzGoVmZj9jQcZSilBB7rSHLlAoFnyeoTGmUr0V6cn86wxMSiRbFpCeNMwMxDq4B3KwgO6/Yk6COmqOn6hZoKr47fQsCDKsVlDYk+jz+Ai960D6davj1u3jbXTt2tjaxgRkhLZxpKZ4rxO/171YPPNIV171iKX8UjfqKbxPYAGahjBkR/rswxov+tjvmj1uISjlp7vPr/s3HIp8YCwdLML2PGXYyRGBjEIUyBXjLThPA3C1YgFgqKte+Th0VRoiqs4kj2r37w+H0oRH6ShJe7zMqyIEkAt/rllBqg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PIyDBabhFMuZLdbMWcA1R04C+I7rIGYThPhfmYkBhVdk+Yp2N8+7jeu8xS7mYxa+9ExxTMan0BCjxkOWp1L2X2XBqBF8JOtuktGpBiw2a0l2vqUXqZmFoWv1AHhowOORGww/T20fESfvJlCmL2K/iS9K/SS2npmOVrBhymc/tFH3D1VMTg8zJkpk9Pdv1P4x+dv1e1P+iJ9HFPhwPEDdGKAnadvQdbqtZATnPgxF9sgjmFgosR2+7YKl/zX9dxxfFGs6bxk55SEUMm+fiQft/f7fIHZAiWcN4mH47mzcxtUQ8d5P6gWDoleenCHp6GxZLH7Jfs//+Mdk3UyRrofx+A==
  • Authentication-results: spf=none (sender IP is ) smtp.mailfrom=JBeulich@xxxxxxxx;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Brian Woods <brian.woods@xxxxxxx>, Suravee Suthikulpanit <suravee.suthikulpanit@xxxxxxx>
  • Delivery-date: Tue, 30 Jul 2019 14:22:01 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHVQu2XKpCU3Gukp0iLV5jWvAWoa6bjM23FgAAHxwA=
  • Thread-topic: [PATCH v4 12/12] AMD/IOMMU: miscellaneous DTE handling adjustments

On 30.07.2019 15:42, Andrew Cooper wrote:
> On 25/07/2019 14:33, Jan Beulich wrote:
>> --- a/xen/include/asm-x86/hvm/svm/amd-iommu-defs.h
>> +++ b/xen/include/asm-x86/hvm/svm/amd-iommu-defs.h
>> @@ -107,57 +107,60 @@
>>    #define IOMMU_DEV_TABLE_INT_CONTROL_FORWARDED     0x1
>>    #define IOMMU_DEV_TABLE_INT_CONTROL_TRANSLATED    0x2
>>    
>> +/* For now we always allocate maximum possible interrupt remapping tables. 
>> */
> 
> /* For now, we always allocate the maximum.  2048 remap entries. */
> 
> ?

Sure, done.

>> +#define IOMMU_INTREMAP_LENGTH                       0xB
> 
> Also, LENGTH isn't an appropriate name.  This is actually the order of
> the number of entries.  As you're already changing the name, how about
> s/LENGTH/ORDER/ here?

I did consider this (and will change), but I didn't change it right
away because of the resulting inconsistency on this line

     dte->int_tab_len = IOMMU_INTREMAP_ORDER;

I had taken "length" to mean "encoded length" here, not "actual length".

> If so, Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

Thanks.

> [Not related to this patch...]
> 
> It has always occurred to me that we allocate silly quantities of memory
> for interrupt remapping tables.  If I've done my sums right, for Intel
> we allocate 64k entries per IOMMU (256k RAM), whereas for AMD we
> allocate 2048 entries per PCI function (32k RAM, now with the larger
> format).

Right, that's another thing I wanted to look into as a follow-on. I
too did notice this. Depending what you mean by "PCI function" it
may actually be worse than what you describe: It's not per PCI
function of present devices, but per PCI function enumerated by the
ACPI tables. On my box this means everything from 00:00.0 to
ff:1f.7, which amounts to almost 2Gb if I'm not mistaken ("almost"
because of some aliasing of devices, where only one table gets
allocated for all the aliases).

> The largest Intel system I've encountered (interrupt wise) is a few
> thousand interrupts, split fairly evenly across the root-complex IOMMUs
> (the PCH IOMMU not, because its mostly legacy IO behind there).
> 
> For individual functions, I have never encountered a PCI function with
> more than a dozen interrupts or so, so I think in practice we can get
> away with allocating a 4k (32 entry) interrupt remap table in all cases.

That's clearly a possibility. (I think you meant 256 entries per 4k
though.)

> It would probably make sense to default to allocating less space, and
> providing a command line option to allocate max.  Alternatively, we
> could work this out as we walk the PCI topology, as it is encoded in
> standards compliant ways in config space.

To be honest, first of all I'd like to avoid allocating tables for
devices which don't even exist.

Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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