From: Paul Durrant <Paul.Durrant@citrix.com>
To: 'Julien Grall' <julien.grall@arm.com>, 'Jan Beulich' <jbeulich@suse.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>, Wei Liu <wl@xen.org>,
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>,
Ian Jackson <Ian.Jackson@citrix.com>,
"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>,
Roger Pau Monne <roger.pau@citrix.com>
Subject: Re: [Xen-devel] [PATCH 5/6] iommu: tidy up iommu_us_hap_pt() and need_iommu_pt_sync() macros
Date: Wed, 14 Aug 2019 12:35:57 +0000 [thread overview]
Message-ID: <3e0736f5abb2460a865cc250e9b1b5a9@AMSPEX02CL03.citrite.net> (raw)
In-Reply-To: <bcfe1bab-fe1f-f6ae-52c9-8fa50b878963@arm.com>
> -----Original Message-----
[snip]
> >>>>>>> +/* Are we using the domain P2M table as its IOMMU pagetable? */
> >>>>>>> +#define iommu_use_hap_pt(d) \
> >>>>>>> + (hap_enabled(d) && is_iommu_enabled(d) && iommu_hap_pt_share)
> >>>>>>
> >>>>>> Does this build for Arm, seeing that there's no hap_enabled()
> >>>>>> definition there? Or have I missed its addition earlier in this
> >>>>>> series?
> >>>>>
> >>>>> It moved to common code sched.h in an earlier patch.
> >>>>
> >>>> I went through the series and didn't find where hap_enabled() is defined for Arm
> >>>> in this series. Do you mind pointing the exact patch?
> >>>>
> >>>
> >>> Sorry, I wasn't clear... The change is in my other series, "use stashed domain create flags",
> which
> >> is a pre-requisite for this series (as called out in the cover letter). The change is made in patch
> #2
> >> of that series: https://lists.xenproject.org/archives/html/xen-devel/2019-07/msg02256.html.
> >>
> >> Oh. I understand this adds benefits as the implementation is now common. But the
> >> downside is hap_enabled() will now require evaluation on Arm even it is
> >> evaluates to true... This will prevent the compiler to remove any non-HAP code
> >> paths (assuming there are any in the common code).
> >
> > There was one in the common iommu code that thus required a #ifdef for ARM.
>
> Any CONFIG_{ARM, X86} feels an abuse of common code. So I am always in favor of
> dropping them :). My concern is that a few of the helpers will likely return a
> single value for any architecture by x86. But that's a different problem...
>
> >
> >>
> >> Furthermore, 2 parts of the iommu_use_hap_pt() condition will always returning
> >> always true. But as they are non-constant, so they will always be evaluated.
> >>
> >> It is also probably going to confuse developer as they may think non-HAP is
> >> supported on Arm. You can't find easily that both hap_enabled(...) and
> >> iommu_hap_pt_share will always evaluate to true.
> >>
> >> So aside the common implementation, what is the real gain for Arm?
> >
> > There's no real gain for ARM, the gain is in the reduction in ifdef-ery and thus tidiness of code. I
> could put back some ifdefs if you'd prefer, or I could just put a comment stating that
> iommu_use_hap_pt() will always be true for ARM. Which would you prefer?
>
> Looking at the patch #6, iommu_use_hap_pt() is reimplemented with:
>
> #define iommu_use_hap_pt(d) (dom_iommu(d)->hap_pt_share)
>
> You also have a comment mentioning Arm systems in the same patch.
>
> So I would be happy with this patch assuming that patch #6 does not change.
>
Ok, thanks. I'll see about adding a patch for arch specific defs of things like is_hvm_domain() and is_pv_domain(), and hap_enabled().
Paul
_______________________________________________
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-14 12:36 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
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 [this message]
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=3e0736f5abb2460a865cc250e9b1b5a9@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=jbeulich@suse.com \
--cc=julien.grall@arm.com \
--cc=konrad.wilk@oracle.com \
--cc=roger.pau@citrix.com \
--cc=sstabellini@kernel.org \
--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).