qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: Gavin Shan <gwshan@linux.vnet.ibm.com>, qemu-devel@nongnu.org
Cc: alex.williamson@redhat.com
Subject: Re: [Qemu-devel] [RFC PATCH 1/2] VFIO: Drop vfio_container_do_ioctl()
Date: Tue, 26 Aug 2014 20:27:31 +1000	[thread overview]
Message-ID: <53FC6113.5030909@ozlabs.ru> (raw)
In-Reply-To: <1408528328-11560-2-git-send-email-gwshan@linux.vnet.ibm.com>

On 08/20/2014 07:52 PM, Gavin Shan wrote:
> The patch drops vfio_container_do_ioctl() and merges its logic to
> parent function call vfio_container_ioctl() so that the subsequent
> patches can reused the found VFIO group in vfio_container_ioctl().
> 
> Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
> ---
>  hw/misc/vfio.c | 33 +++++++++++++++------------------
>  1 file changed, 15 insertions(+), 18 deletions(-)
> 
> diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c
> index 7d5f1bb..1a3e7eb 100644
> --- a/hw/misc/vfio.c
> +++ b/hw/misc/vfio.c
> @@ -4419,8 +4419,8 @@ static void register_vfio_pci_dev_type(void)
>  
>  type_init(register_vfio_pci_dev_type)
>  
> -static int vfio_container_do_ioctl(AddressSpace *as, int32_t groupid,
> -                                   int req, void *param)
> +int vfio_container_ioctl(AddressSpace *as, int32_t groupid,
> +                         int req, void *param)
>  {
>      VFIOGroup *group;
>      VFIOContainer *container;
> @@ -4433,22 +4433,11 @@ static int vfio_container_do_ioctl(AddressSpace *as, int32_t groupid,
>      }
>  
>      container = group->container;
> -    if (group->container) {
> -        ret = ioctl(container->fd, req, param);
> -        if (ret < 0) {
> -            error_report("vfio: failed to ioctl container: ret=%d, %s",
> -                         ret, strerror(errno));
> -        }
> +    if (!container) {
> +        error_report("vfio: no container for group %d\n", groupid);
> +        goto out;
>      }
>  
> -    vfio_put_group(group);
> -
> -    return ret;
> -}
> -
> -int vfio_container_ioctl(AddressSpace *as, int32_t groupid,
> -                         int req, void *param)
> -{
>      /* We allow only certain ioctls to the container */
>      switch (req) {
>      case VFIO_CHECK_EXTENSION:
> @@ -4458,8 +4447,16 @@ int vfio_container_ioctl(AddressSpace *as, int32_t groupid,
>      default:
>          /* Return an error on unknown requests */
>          error_report("vfio: unsupported ioctl %X", req);
> -        return -1;
> +        goto out;
>      }
>  
> -    return vfio_container_do_ioctl(as, groupid, req, param);
> +    ret = ioctl(container->fd, req, param);
> +    if (ret < 0) {
> +        error_report("vfio: failed to ioctl container: ret=%d, %s",
> +                     ret, strerror(errno));
> +    }
> +
> +out:
> +    vfio_put_group(group);
> +    return ret;


Nack. We specifically separated an ioctl-filtering function and actual code
which does ioctl. I understand that you want to save on vfio_get_group()
calls for the next EEH patch but this is not a hot path anyway.




>  }
> 


-- 
Alexey

  reply	other threads:[~2014-08-26 10:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-20  9:52 [Qemu-devel] [RFC PATCH 0/2] Fix MSIx lost after PE reset Gavin Shan
2014-08-20  9:52 ` [Qemu-devel] [RFC PATCH 1/2] VFIO: Drop vfio_container_do_ioctl() Gavin Shan
2014-08-26 10:27   ` Alexey Kardashevskiy [this message]
2014-08-26 20:05     ` Alex Williamson
2014-08-20  9:52 ` [Qemu-devel] [RFC PATCH 2/2] VFIO: Clear stale MSIx table during EEH reset Gavin Shan
2014-08-26 10:25   ` Alexey Kardashevskiy
2014-08-26 20:25   ` Alex Williamson
2014-08-27 13:15     ` Gavin Shan
2014-08-27 13:29       ` Alex Williamson
2014-08-29  7:13         ` Gavin Shan
2014-08-26  0:58 ` [Qemu-devel] [RFC PATCH 0/2] Fix MSIx lost after PE reset Gavin Shan

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=53FC6113.5030909@ozlabs.ru \
    --to=aik@ozlabs.ru \
    --cc=alex.williamson@redhat.com \
    --cc=gwshan@linux.vnet.ibm.com \
    --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).