All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <JBeulich@suse.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	Brian Woods <brian.woods@amd.com>,
	Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Subject: Re: [Xen-devel] [PATCH v4 12/12] AMD/IOMMU: miscellaneous DTE handling adjustments
Date: Tue, 30 Jul 2019 14:10:29 +0000	[thread overview]
Message-ID: <74b2b0e6-bba5-2ad6-bde7-a29a3515c6eb@suse.com> (raw)
In-Reply-To: <974f714e-7866-d2e5-7517-5e28d01ba999@citrix.com>

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@citrix.com>

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@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2019-07-30 14:22 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-25 13:19 [Xen-devel] [PATCH v4 00/12] x86: AMD x2APIC support / AMD IOMMU improvements Jan Beulich
2019-07-25 13:29 ` [Xen-devel] [PATCH v4 01/12] AMD/IOMMU: use bit field for extended feature register Jan Beulich
2019-07-30  9:14   ` [Xen-devel] Ping: " Jan Beulich
2019-07-30 16:35   ` [Xen-devel] " Woods, Brian
2019-07-25 13:29 ` [Xen-devel] [PATCH v4 02/12] AMD/IOMMU: use bit field for control register Jan Beulich
2019-07-25 13:30 ` [Xen-devel] [PATCH v4 03/12] AMD/IOMMU: use bit field for IRTE Jan Beulich
2019-07-25 13:30 ` [Xen-devel] [PATCH v4 04/12] AMD/IOMMU: pass IOMMU to {get, free, update}_intremap_entry() Jan Beulich
2019-07-25 13:31 ` [Xen-devel] [PATCH v4 05/12] AMD/IOMMU: introduce 128-bit IRTE non-guest-APIC IRTE format Jan Beulich
2019-07-30 10:13   ` Andrew Cooper
2019-07-30 16:36   ` Woods, Brian
2019-07-25 13:31 ` [Xen-devel] [PATCH v4 06/12] AMD/IOMMU: split amd_iommu_init_one() Jan Beulich
2019-07-25 13:31 ` [Xen-devel] [PATCH v4 07/12] AMD/IOMMU: allow enabling with IRQ not yet set up Jan Beulich
2019-07-25 13:32 ` [Xen-devel] [PATCH v4 08/12] AMD/IOMMU: adjust setup of internal interrupt for x2APIC mode Jan Beulich
2019-07-25 13:32 ` [Xen-devel] [PATCH v4 09/12] AMD/IOMMU: enable x2APIC mode when available Jan Beulich
2019-07-25 13:33 ` [Xen-devel] [PATCH v4 10/12] AMD/IOMMU: correct IRTE updating Jan Beulich
2019-07-25 14:04   ` Woods, Brian
2019-07-25 13:33 ` [Xen-devel] [PATCH v4 11/12] AMD/IOMMU: don't needlessly log headers when dumping IRTs Jan Beulich
2019-07-30 10:25   ` Andrew Cooper
2019-07-30 16:36   ` Woods, Brian
2019-07-25 13:33 ` [Xen-devel] [PATCH v4 12/12] AMD/IOMMU: miscellaneous DTE handling adjustments Jan Beulich
2019-07-30 13:42   ` Andrew Cooper
2019-07-30 14:10     ` Jan Beulich [this message]
2019-08-06 19:41   ` Woods, Brian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=74b2b0e6-bba5-2ad6-bde7-a29a3515c6eb@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=brian.woods@amd.com \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.