All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Jiachen Zhang <zhangjiachen.jaycee@bytedance.com>
Cc: virtio-fs@redhat.com, Xie Yongji <xieyongji@bytedance.com>,
	qemu-devel@nongnu.org, "Michael S . Tsirkin" <mst@redhat.com>
Subject: Re: [Virtio-fs] [RFC PATCH 9/9] virtiofsd: (work around) Comment qsort in inflight I/O tracking
Date: Thu, 4 Feb 2021 12:15:38 +0000	[thread overview]
Message-ID: <20210204121538.GH3039@work-vm> (raw)
In-Reply-To: <20201215162119.27360-10-zhangjiachen.jaycee@bytedance.com>

* Jiachen Zhang (zhangjiachen.jaycee@bytedance.com) wrote:
> This is a work around. The qsort function will malloc memory instead of use
> stack memory when the resubmit_num is larger than 64 (total size larger than
> 1024 Bytes). This will cause seccomp kill virtiofsd, so we comment qsort.
> This work around will not affect the correctness of inflight I/O tracking.
> 
> Signed-off-by: Jiachen Zhang <zhangjiachen.jaycee@bytedance.com>
> Signed-off-by: Xie Yongji <xieyongji@bytedance.com>

That's an odd hack!   Just follow the audit log to see what seccomp was
upset by and add the right syscall.

Dave

> ---
>  contrib/libvhost-user/libvhost-user.c | 18 ------------------
>  1 file changed, 18 deletions(-)
> 
> diff --git a/contrib/libvhost-user/libvhost-user.c b/contrib/libvhost-user/libvhost-user.c
> index 8c97013e59..c226d5d915 100644
> --- a/contrib/libvhost-user/libvhost-user.c
> +++ b/contrib/libvhost-user/libvhost-user.c
> @@ -1167,20 +1167,6 @@ vu_check_queue_msg_file(VuDev *dev, VhostUserMsg *vmsg)
>      return true;
>  }
>  
> -static int
> -inflight_desc_compare(const void *a, const void *b)
> -{
> -    VuVirtqInflightDesc *desc0 = (VuVirtqInflightDesc *)a,
> -                        *desc1 = (VuVirtqInflightDesc *)b;
> -
> -    if (desc1->counter > desc0->counter &&
> -        (desc1->counter - desc0->counter) < VIRTQUEUE_MAX_SIZE * 2) {
> -        return 1;
> -    }
> -
> -    return -1;
> -}
> -
>  static int
>  vu_check_queue_inflights(VuDev *dev, VuVirtq *vq)
>  {
> @@ -1236,10 +1222,6 @@ vu_check_queue_inflights(VuDev *dev, VuVirtq *vq)
>              }
>          }
>  
> -        if (vq->resubmit_num > 1) {
> -            qsort(vq->resubmit_list, vq->resubmit_num,
> -                  sizeof(VuVirtqInflightDesc), inflight_desc_compare);
> -        }
>          vq->counter = vq->resubmit_list[0].counter + 1;
>      }
>  
> -- 
> 2.20.1
> 
-- 
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK


WARNING: multiple messages have this Message-ID (diff)
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Jiachen Zhang <zhangjiachen.jaycee@bytedance.com>
Cc: virtio-fs@redhat.com, Xie Yongji <xieyongji@bytedance.com>,
	qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>,
	"Michael S . Tsirkin" <mst@redhat.com>
Subject: Re: [RFC PATCH 9/9] virtiofsd: (work around) Comment qsort in inflight I/O tracking
Date: Thu, 4 Feb 2021 12:15:38 +0000	[thread overview]
Message-ID: <20210204121538.GH3039@work-vm> (raw)
In-Reply-To: <20201215162119.27360-10-zhangjiachen.jaycee@bytedance.com>

* Jiachen Zhang (zhangjiachen.jaycee@bytedance.com) wrote:
> This is a work around. The qsort function will malloc memory instead of use
> stack memory when the resubmit_num is larger than 64 (total size larger than
> 1024 Bytes). This will cause seccomp kill virtiofsd, so we comment qsort.
> This work around will not affect the correctness of inflight I/O tracking.
> 
> Signed-off-by: Jiachen Zhang <zhangjiachen.jaycee@bytedance.com>
> Signed-off-by: Xie Yongji <xieyongji@bytedance.com>

That's an odd hack!   Just follow the audit log to see what seccomp was
upset by and add the right syscall.

Dave

> ---
>  contrib/libvhost-user/libvhost-user.c | 18 ------------------
>  1 file changed, 18 deletions(-)
> 
> diff --git a/contrib/libvhost-user/libvhost-user.c b/contrib/libvhost-user/libvhost-user.c
> index 8c97013e59..c226d5d915 100644
> --- a/contrib/libvhost-user/libvhost-user.c
> +++ b/contrib/libvhost-user/libvhost-user.c
> @@ -1167,20 +1167,6 @@ vu_check_queue_msg_file(VuDev *dev, VhostUserMsg *vmsg)
>      return true;
>  }
>  
> -static int
> -inflight_desc_compare(const void *a, const void *b)
> -{
> -    VuVirtqInflightDesc *desc0 = (VuVirtqInflightDesc *)a,
> -                        *desc1 = (VuVirtqInflightDesc *)b;
> -
> -    if (desc1->counter > desc0->counter &&
> -        (desc1->counter - desc0->counter) < VIRTQUEUE_MAX_SIZE * 2) {
> -        return 1;
> -    }
> -
> -    return -1;
> -}
> -
>  static int
>  vu_check_queue_inflights(VuDev *dev, VuVirtq *vq)
>  {
> @@ -1236,10 +1222,6 @@ vu_check_queue_inflights(VuDev *dev, VuVirtq *vq)
>              }
>          }
>  
> -        if (vq->resubmit_num > 1) {
> -            qsort(vq->resubmit_list, vq->resubmit_num,
> -                  sizeof(VuVirtqInflightDesc), inflight_desc_compare);
> -        }
>          vq->counter = vq->resubmit_list[0].counter + 1;
>      }
>  
> -- 
> 2.20.1
> 
-- 
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK



  reply	other threads:[~2021-02-04 12:15 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-15 16:21 [Virtio-fs] [RFC PATCH 0/9] Support for Virtio-fs daemon crash reconnection Jiachen Zhang
2020-12-15 16:21 ` Jiachen Zhang
2020-12-15 16:21 ` [Virtio-fs] [RFC PATCH 1/9] vhost-user-fs: Add support for reconnection of vhost-user-fs backend Jiachen Zhang
2020-12-15 16:21   ` Jiachen Zhang
2020-12-15 16:21 ` [Virtio-fs] [RFC PATCH 2/9] vhost: Add vhost-user message types for sending shared memory and file fds Jiachen Zhang
2020-12-15 16:21   ` Jiachen Zhang
2020-12-15 16:21 ` [Virtio-fs] [RFC PATCH 3/9] vhost-user-fs: Support virtiofsd crash reconnection Jiachen Zhang
2020-12-15 16:21   ` Jiachen Zhang
2020-12-15 16:21 ` [Virtio-fs] [RFC PATCH 4/9] libvhost-user: Add vhost-user message types for sending shared memory and file fds Jiachen Zhang
2020-12-15 16:21   ` Jiachen Zhang
2020-12-15 16:21 ` [Virtio-fs] [RFC PATCH 5/9] virtiofsd: Convert the struct lo_map array to a more flatten layout Jiachen Zhang
2020-12-15 16:21   ` Jiachen Zhang
2020-12-15 16:21 ` [Virtio-fs] [RFC PATCH 6/9] virtiofsd: Add two new options for crash reconnection Jiachen Zhang
2020-12-15 16:21   ` Jiachen Zhang
2021-02-04 12:08   ` [Virtio-fs] " Dr. David Alan Gilbert
2021-02-04 12:08     ` Dr. David Alan Gilbert
2021-02-04 14:16     ` [Virtio-fs] [External] " Jiachen Zhang
2021-02-04 14:16       ` Jiachen Zhang
2020-12-15 16:21 ` [Virtio-fs] [RFC PATCH 7/9] virtiofsd: Persist/restore lo_map and opened fds to/from QEMU Jiachen Zhang
2020-12-15 16:21   ` Jiachen Zhang
2020-12-15 16:21 ` [Virtio-fs] [RFC PATCH 8/9] virtiofsd: Ensure crash consistency after reconnection Jiachen Zhang
2020-12-15 16:21   ` Jiachen Zhang
2020-12-15 16:21 ` [Virtio-fs] [RFC PATCH 9/9] virtiofsd: (work around) Comment qsort in inflight I/O tracking Jiachen Zhang
2020-12-15 16:21   ` Jiachen Zhang
2021-02-04 12:15   ` Dr. David Alan Gilbert [this message]
2021-02-04 12:15     ` Dr. David Alan Gilbert
2021-02-04 14:20     ` [Virtio-fs] [External] " Jiachen Zhang
2021-02-04 14:20       ` Jiachen Zhang
2020-12-15 22:51 ` [Virtio-fs] [RFC PATCH 0/9] Support for Virtio-fs daemon crash reconnection no-reply
2020-12-15 22:51   ` no-reply
2020-12-16 15:36 ` [Virtio-fs] " Marc-André Lureau
2020-12-16 15:36   ` Marc-André Lureau
2020-12-18  9:39   ` [Virtio-fs] [External] " Jiachen Zhang
2020-12-18  9:39     ` Jiachen Zhang
2021-03-17 10:05     ` [Virtio-fs] " Stefan Hajnoczi
2021-03-17 10:05       ` Stefan Hajnoczi
2021-03-17 11:49       ` [Virtio-fs] " Christian Schoenebeck
2021-03-17 11:49         ` Christian Schoenebeck
2021-03-17 12:57         ` [Virtio-fs] " Jiachen Zhang
2021-03-17 12:57           ` Jiachen Zhang
2021-03-18 11:58           ` [Virtio-fs] " Christian Schoenebeck
2021-03-18 11:58             ` Christian Schoenebeck
2021-03-22 10:54             ` [Virtio-fs] " Stefan Hajnoczi
2021-03-22 10:54               ` Stefan Hajnoczi
2021-03-23 12:54               ` [Virtio-fs] " Christian Schoenebeck
2021-03-23 12:54                 ` Christian Schoenebeck
2021-03-23 14:25                 ` [Virtio-fs] " Stefan Hajnoczi
2021-03-23 14:25                   ` Stefan Hajnoczi
2021-03-17 12:32       ` [Virtio-fs] " Jiachen Zhang
2021-03-17 12:32         ` Jiachen Zhang
2021-03-22 11:00         ` [Virtio-fs] " Stefan Hajnoczi
2021-03-22 11:00           ` Stefan Hajnoczi
2021-03-22 20:13           ` [Virtio-fs] " Vivek Goyal
2021-03-22 20:13             ` Vivek Goyal
2021-03-23 13:45             ` Stefan Hajnoczi
2021-03-23 13:45               ` Stefan Hajnoczi
2021-05-10 14:38 ` [Virtio-fs] " Jiachen Zhang
2021-05-10 14:38   ` Jiachen Zhang
2021-05-13 15:17   ` [Virtio-fs] " Stefan Hajnoczi
2021-05-13 15:17     ` Stefan Hajnoczi

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=20210204121538.GH3039@work-vm \
    --to=dgilbert@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=virtio-fs@redhat.com \
    --cc=xieyongji@bytedance.com \
    --cc=zhangjiachen.jaycee@bytedance.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 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.