qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Eric Auger <eric.auger@redhat.com>
Cc: peter.maydell@linaro.org, mst@redhat.com, qemu-devel@nongnu.org,
	alex.williamson@redhat.com, qemu-arm@nongnu.org,
	pbonzini@redhat.com, eric.auger.pro@gmail.com
Subject: Re: [PATCH v2 0/5] Allow memory_region_register_iommu_notifier() to fail
Date: Fri, 20 Sep 2019 14:16:28 +0800	[thread overview]
Message-ID: <20190920061628.GD12858@xz-x1> (raw)
In-Reply-To: <20190919121845.29520-1-eric.auger@redhat.com>

On Thu, Sep 19, 2019 at 02:18:40PM +0200, Eric Auger wrote:
> This series allows the memory_region_register_iommu_notifier()
> to fail. As of now, when a MAP notifier is attempted to be
> registered along with SMMUv3, Intel iommu without caching mode
> or AMD IOMMU, we exit in the IOMMU MR notify_flag_changed()
> callback. In case of VFIO assigned device hotplug, this could be
> handled more nicely directly within the VFIO code, simply rejecting
> the hotplug without exiting. This is what the series achieves
> by handling the memory_region_register_iommu_notifier() returned
> value.

Could I ask what's the code path for ARM when the hot plug failed?  Is
that vfio_realize() then vfio_connect_container() will fail with this?

    if (container->error) {
        ret = container->error;
        error_setg_errno(errp, -ret,
                         "memory listener initialization failed for container");
        goto listener_release_exit;
    }

If so, I would again suggest you to use Error** in patch 1.  IMHO we
can let vfio_listener_region_add() to be the first one to use the
Error** so that instead of this:

    /*
     * On the initfn path, store the first error in the container so we
     * can gracefully fail.  Runtime, there's not much we can do other
     * than throw a hardware error.
     */
    if (!container->initialized) {
        if (!container->error) {
            container->error = ret;
        }
    } else {
        hw_error("vfio: DMA mapping failed, unable to continue");
    }

We can also cache the Error** into container and return to user if the
user is using QMP which should be better than the int number (or
again, maybe return both errors?).  IIUC error_report() will not work
for QMP.

Regards,

-- 
Peter Xu


  parent reply	other threads:[~2019-09-20  6:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-19 12:18 [Qemu-devel] [PATCH v2 0/5] Allow memory_region_register_iommu_notifier() to fail Eric Auger
2019-09-19 12:18 ` [Qemu-devel] [PATCH v2 1/5] memory: allow " Eric Auger
2019-09-19 12:18 ` [Qemu-devel] [PATCH v2 2/5] vfio/common: Handle memory_region_register_iommu_notifier() failure Eric Auger
2019-09-19 12:18 ` [Qemu-devel] [PATCH v2 3/5] exec: assert on " Eric Auger
2019-09-19 12:18 ` [Qemu-devel] [PATCH v2 4/5] vhost: " Eric Auger
2019-09-19 12:18 ` [Qemu-devel] [PATCH v2 5/5] amd_iommu: Let amdvi_iommu_notify_flag_changed() fail Eric Auger
2019-09-20  6:16 ` Peter Xu [this message]
2019-09-20  7:05   ` [PATCH v2 0/5] Allow memory_region_register_iommu_notifier() to fail Auger Eric

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=20190920061628.GD12858@xz-x1 \
    --to=peterx@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=eric.auger.pro@gmail.com \
    --cc=eric.auger@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.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).