All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	Kevin Tian <kevin.tian@intel.com>
Subject: Re: [PATCH 1/2] VT-d: install sync_cache hook on demand
Date: Thu, 16 Jul 2020 12:14:09 +0200	[thread overview]
Message-ID: <20200716101409.GK7191@Air-de-Roger> (raw)
In-Reply-To: <0036b69f-0d56-9ac4-1afa-06640c9007de@suse.com>

On Wed, Jul 15, 2020 at 12:03:57PM +0200, Jan Beulich wrote:
> Instead of checking inside the hook whether any non-coherent IOMMUs are
> present, simply install the hook only when this is the case.
> 
> To prove that there are no other references to the now dynamically
> updated ops structure (and hence that its updating happens early
> enough), make it static and rename it at the same time.
> 
> Note that this change implies that sync_cache() shouldn't be called
> directly unless there are unusual circumstances, like is the case in
> alloc_pgtable_maddr(), which gets invoked too early for iommu_ops to
> be set already (and therefore we also need to be careful there to
> avoid accessing vtd_ops later on, as it lives in .init).
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

I think this is slightly better than what we currently have:

Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>

I would however prefer if we also added a check to assert that
alloc_pgtable_maddr is never called before iommu_alloc. We could maybe
poison the .sync_cache field, and then either set to NULL or to
sync_cache in iommu_alloc?

Maybe I'm just overly paranoid with this.

Thanks.


  reply	other threads:[~2020-07-16 10:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-15 10:02 [PATCH 0/2] VT-d: XSA-321 follow-up Jan Beulich
2020-07-15 10:03 ` [PATCH 1/2] VT-d: install sync_cache hook on demand Jan Beulich
2020-07-16 10:14   ` Roger Pau Monné [this message]
2020-07-16 10:25     ` Jan Beulich
2020-07-16 10:34       ` Roger Pau Monné
2020-07-17  2:48   ` Tian, Kevin
2020-07-15 10:04 ` [PATCH 2/2] VT-d: use clear_page() in alloc_pgtable_maddr() Jan Beulich
2020-07-16 10:15   ` Roger Pau Monné
2020-07-17  2:49   ` Tian, Kevin

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=20200716101409.GK7191@Air-de-Roger \
    --to=roger.pau@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=kevin.tian@intel.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.