qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Nicolin Chen <nicolinc@nvidia.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: Cornelia Huck <cohuck@redhat.com>, <qemu-devel@nongnu.org>,
	<kwankhede@nvidia.com>, <avihaih@nvidia.com>, <shayd@nvidia.com>,
	<jgg@nvidia.com>
Subject: Re: [PATCH] vfio/common: Do not g_free in vfio_get_iommu_info
Date: Wed, 14 Sep 2022 13:16:26 -0700	[thread overview]
Message-ID: <YyI2mp0qUFD0loB+@Asurada-Nvidia> (raw)
In-Reply-To: <20220914140325.41bd470d.alex.williamson@redhat.com>

On Wed, Sep 14, 2022 at 02:03:25PM -0600, Alex Williamson wrote:

> > > > +        container->pgsizes = 4096;
> > >
> > > This might be a separate question/issue: I wonder if we should use
> > > "sysconf(_SC_PAGE_SIZE)" here instead of 4096.
> > >
> > > With a kernel using a larger page size, e.g. CONFIG_ARM64_64K_PAGES,
> > > the IO page size is likely to be 64K too. If the ioctl fails, this
> > > default 4K setup won't work.
> >
> > Perhaps, but IIRC this solution came about because we originally forgot
> > to expose the IOMMU_INFO flag to indicate the pgsize field was valid.
> > At the time we only supported 4K systems, so it made sense to provide
> > this default, though it is indeed dated.
> >
> > TBH, I don't really see why we should try to continue if the ioctl
> > itself fails, so maybe this should be:

OK. Makes sense to me.

> > diff --git a/hw/vfio/common.c b/hw/vfio/common.c
> > index ace9562a9ba1..ad188b7649e6 100644
> > --- a/hw/vfio/common.c
> > +++ b/hw/vfio/common.c
> > @@ -2111,29 +2111,31 @@ static int vfio_connect_container(VFIOGroup *group, AddressSpace *as,
> >      {
> >          struct vfio_iommu_type1_info *info;
> >
> > -        /*
> > -         * FIXME: This assumes that a Type1 IOMMU can map any 64-bit
> > -         * IOVA whatsoever.  That's not actually true, but the current
> > -         * kernel interface doesn't tell us what it can map, and the
> > -         * existing Type1 IOMMUs generally support any IOVA we're
> > -         * going to actually try in practice.
> > -         */
> >          ret = vfio_get_iommu_info(container, &info);
> > +        if (ret) {
> 
> Clearly untested,
> 
>                ret = -errno;
> 
> > +            error_setg_errno(errp, -ret, "Failed to get VFIO IOMMU info");
> > +            goto enable_discards_exit:;

There is a ":" in-between :)


      reply	other threads:[~2022-09-14 20:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-10  0:42 [PATCH] vfio/common: Do not g_free in vfio_get_iommu_info Nicolin Chen
2022-09-12 12:38 ` Cornelia Huck
2022-09-12 20:51   ` Nicolin Chen
2022-09-14 18:10     ` Alex Williamson
2022-09-14 18:30       ` Alex Williamson
2022-09-14 19:02       ` Nicolin Chen
2022-09-14 19:53         ` Alex Williamson
2022-09-14 20:03           ` Alex Williamson
2022-09-14 20:16             ` Nicolin Chen [this message]

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=YyI2mp0qUFD0loB+@Asurada-Nvidia \
    --to=nicolinc@nvidia.com \
    --cc=alex.williamson@redhat.com \
    --cc=avihaih@nvidia.com \
    --cc=cohuck@redhat.com \
    --cc=jgg@nvidia.com \
    --cc=kwankhede@nvidia.com \
    --cc=qemu-devel@nongnu.org \
    --cc=shayd@nvidia.com \
    /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).