From: Paul Durrant <Paul.Durrant@citrix.com>
To: 'Jan Beulich' <jbeulich@suse.com>
Cc: Petre Pircalabu <ppircalabu@bitdefender.com>,
Stefano Stabellini <sstabellini@kernel.org>, Wei Liu <wl@xen.org>,
Razvan Cojocaru <rcojocaru@bitdefender.com>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
Andrew Cooper <Andrew.Cooper3@citrix.com>,
"Tim \(Xen.org\)" <tim@xen.org>,
George Dunlap <George.Dunlap@citrix.com>,
Julien Grall <julien.grall@arm.com>,
Tamas K Lengyel <tamas@tklengyel.com>,
Ian Jackson <Ian.Jackson@citrix.com>,
Alexandru Isaila <aisaila@bitdefender.com>,
"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
VolodymyrBabchuk <Volodymyr_Babchuk@epam.com>,
Roger Pau Monne <roger.pau@citrix.com>
Subject: Re: [Xen-devel] [PATCH 3/6] remove late (on-demand) construction of IOMMU page tables
Date: Mon, 12 Aug 2019 15:41:36 +0000 [thread overview]
Message-ID: <0134b70d04b942b4b3ce65fd2340ff0c@AMSPEX02CL03.citrite.net> (raw)
In-Reply-To: <1383f85e-bc08-c0be-bb02-f68b76ac1be5@suse.com>
> -----Original Message-----
> From: Jan Beulich <jbeulich@suse.com>
> Sent: 07 August 2019 11:32
> To: Paul Durrant <Paul.Durrant@citrix.com>
> Cc: xen-devel@lists.xenproject.org; Julien Grall <julien.grall@arm.com>; Alexandru Isaila
> <aisaila@bitdefender.com>; Petre Pircalabu <ppircalabu@bitdefender.com>; Razvan Cojocaru
> <rcojocaru@bitdefender.com>; Andrew Cooper <Andrew.Cooper3@citrix.com>; Roger Pau Monne
> <roger.pau@citrix.com>; VolodymyrBabchuk <Volodymyr_Babchuk@epam.com>; George Dunlap
> <George.Dunlap@citrix.com>; Ian Jackson <Ian.Jackson@citrix.com>; Stefano Stabellini
> <sstabellini@kernel.org>; Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>; Tamas K Lengyel
> <tamas@tklengyel.com>; Tim (Xen.org) <tim@xen.org>; Wei Liu <wl@xen.org>
> Subject: Re: [Xen-devel] [PATCH 3/6] remove late (on-demand) construction of IOMMU page tables
>
> On 30.07.2019 15:44, Paul Durrant wrote:
> > NOTE: This patch will cause a small amount of extra resource to be used
> > to accommodate IOMMU page tables that may never be used, since the
> > per-domain IOMMU flag enable flag is currently set to the value
> > of the global iommu_enable flag. A subsequent patch will add an
> > option to the toolstack to allow it to be turned off if there is
> > no intention to assign passthrough hardware to the domain.
>
> In particular if the default of this is going to be "true" (I
> didn't look at that patch yet, but the wording above makes me
> assume so), in auto-ballooning mode without shared page tables
> more memory should imo be ballooned out of Dom0 now. It has
> always been a bug that IOMMU page tables weren't accounted for,
> but it would become even more prominent then.
Ultimately, once the whole series is applied, then nothing much should change for those specifying passthrough h/w in an xl.cfg. The main difference will be that h/w cannot be passed through to a domain that was not originally created with IOMMU pagetables.
With patches applied up to this point then, yes, every domain will get IOMMU page tables. I guess I'll take a look at the auto-ballooning code and see what needs to be done.
>
> > --- a/xen/arch/x86/hvm/mtrr.c
> > +++ b/xen/arch/x86/hvm/mtrr.c
> > @@ -783,7 +783,8 @@ HVM_REGISTER_SAVE_RESTORE(MTRR, hvm_save_mtrr_msr, hvm_load_mtrr_msr, 1,
> >
> > void memory_type_changed(struct domain *d)
> > {
> > - if ( (has_iommu_pt(d) || cache_flush_permitted(d)) && d->vcpu && d->vcpu[0] )
> > + if ( (is_iommu_enabled(d) || cache_flush_permitted(d)) && d->vcpu &&
> > + d->vcpu[0] )
>
> As a really minor comment - I think it wouldn't be bad for both
> d->vcpu references to end up on the same line.
Ok.
>
> > @@ -625,8 +548,7 @@ static void iommu_dump_p2m_table(unsigned char key)
> > ops = iommu_get_ops();
> > for_each_domain(d)
> > {
> > - if ( is_hardware_domain(d) ||
> > - dom_iommu(d)->status < IOMMU_STATUS_initialized )
> > + if ( !is_iommu_enabled(d) )
> > continue;
>
> Why do you drop the hwdom check here?
Because is_iommu_enabled() for the h/w domain will always be true if iommu_enabled is true, so no need for a special case.
>
> > --- a/xen/include/asm-arm/iommu.h
> > +++ b/xen/include/asm-arm/iommu.h
> > @@ -21,7 +21,7 @@ struct arch_iommu
> > };
> >
> > /* Always share P2M Table between the CPU and the IOMMU */
> > -#define iommu_use_hap_pt(d) (has_iommu_pt(d))
> > +#define iommu_use_hap_pt(d) (is_iommu_enabled(d))
>
> I'd suggest dropping the stray outer pair of parentheses at the
> same time.
Ok, will do.
Paul
>
> Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2019-08-13 6:54 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-30 13:44 [Xen-devel] [PATCH 0/6] per-domain IOMMU control Paul Durrant
2019-07-30 13:44 ` [Xen-devel] [PATCH 1/6] domain: introduce XEN_DOMCTL_CDF_iommu Paul Durrant
2019-08-07 9:21 ` Jan Beulich
2019-08-12 12:22 ` Paul Durrant
2019-07-30 13:44 ` [Xen-devel] [PATCH 2/6] use is_iommu_enabled() where appropriate Paul Durrant
2019-08-07 9:55 ` Jan Beulich
2019-08-07 10:22 ` Julien Grall
2019-08-12 14:53 ` Paul Durrant
2019-07-30 13:44 ` [Xen-devel] [PATCH 3/6] remove late (on-demand) construction of IOMMU page tables Paul Durrant
2019-08-01 8:05 ` Alexandru Stefan ISAILA
2019-08-07 10:31 ` Jan Beulich
2019-08-12 15:41 ` Paul Durrant [this message]
2019-08-12 16:26 ` Paul Durrant
2019-08-14 9:39 ` Paul Durrant
2019-08-27 7:48 ` Jan Beulich
2019-08-29 9:33 ` Paul Durrant
2019-08-29 9:52 ` Jan Beulich
2019-08-29 10:20 ` Paul Durrant
2019-08-29 10:33 ` Jan Beulich
2019-08-27 7:47 ` Jan Beulich
2019-08-27 7:45 ` Jan Beulich
2019-08-29 9:28 ` Paul Durrant
2019-07-30 13:44 ` [Xen-devel] [PATCH 4/6] make passthrough/pci.c:deassign_device() static Paul Durrant
2019-08-06 15:54 ` Jan Beulich
2019-08-14 9:42 ` Paul Durrant
2019-07-30 13:44 ` [Xen-devel] [PATCH 5/6] iommu: tidy up iommu_us_hap_pt() and need_iommu_pt_sync() macros Paul Durrant
2019-08-07 10:41 ` Jan Beulich
2019-08-14 10:13 ` Paul Durrant
2019-08-14 10:20 ` Julien Grall
2019-08-14 10:27 ` Paul Durrant
2019-08-14 10:44 ` Julien Grall
2019-08-14 11:11 ` Paul Durrant
2019-08-14 12:28 ` Julien Grall
2019-08-14 12:35 ` Paul Durrant
2019-08-27 7:53 ` Jan Beulich
2019-07-30 13:44 ` [Xen-devel] [PATCH 6/6] introduce a 'passthrough' configuration option to xl.cfg Paul Durrant
2019-08-07 12:12 ` Jan Beulich
2019-08-14 10:40 ` Paul Durrant
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=0134b70d04b942b4b3ce65fd2340ff0c@AMSPEX02CL03.citrite.net \
--to=paul.durrant@citrix.com \
--cc=Andrew.Cooper3@citrix.com \
--cc=George.Dunlap@citrix.com \
--cc=Ian.Jackson@citrix.com \
--cc=Volodymyr_Babchuk@epam.com \
--cc=aisaila@bitdefender.com \
--cc=jbeulich@suse.com \
--cc=julien.grall@arm.com \
--cc=konrad.wilk@oracle.com \
--cc=ppircalabu@bitdefender.com \
--cc=rcojocaru@bitdefender.com \
--cc=roger.pau@citrix.com \
--cc=sstabellini@kernel.org \
--cc=tamas@tklengyel.com \
--cc=tim@xen.org \
--cc=wl@xen.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).