qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: gabriel@kerneis.info, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] coroutine: add ./configure --disable-coroutine-pool
Date: Wed, 11 Sep 2013 17:24:55 +0200	[thread overview]
Message-ID: <20130911152455.GL2305@dhcp-200-207.str.redhat.com> (raw)
In-Reply-To: <1378910555-24753-1-git-send-email-stefanha@redhat.com>

Am 11.09.2013 um 16:42 hat Stefan Hajnoczi geschrieben:
> The 'gthread' coroutine backend was written before the freelist (aka
> pool) existed in qemu-coroutine.c.
> 
> This means that every thread is expected to exit when its coroutine
> terminates.  It is not possible to reuse threads from a pool.
> 
> This patch automatically disables the pool when 'gthread' is used.  This
> allows the 'gthread' backend to work again (for example,
> tests/test-coroutine completes successfully instead of hanging).
> 
> I considered implementing thread reuse but I don't want quirks like CPU
> affinity differences due to coroutine threads being recycled.  The
> 'gthread' backend is a reference backend and it's therefore okay to skip
> the pool optimization.
> 
> Note this patch also makes it easy to toggle the pool for benchmarking
> purposes:
> 
>   ./configure --with-coroutine-backend=ucontext \
>               --disable-coroutine-pool
> 
> Reported-by: Gabriel Kerneis <gabriel@kerneis.info>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
>  configure        | 24 ++++++++++++++++++++++++
>  qemu-coroutine.c | 34 +++++++++++++++++++---------------
>  2 files changed, 43 insertions(+), 15 deletions(-)
> 
> diff --git a/configure b/configure
> index e989609..5cf6341 100755
> --- a/configure
> +++ b/configure
> @@ -235,6 +235,7 @@ guest_agent=""
>  want_tools="yes"
>  libiscsi=""
>  coroutine=""
> +coroutine_pool=""
>  seccomp=""
>  glusterfs=""
>  glusterfs_discard="no"
> @@ -875,6 +876,10 @@ for opt do
>    ;;
>    --with-coroutine=*) coroutine="$optarg"
>    ;;
> +  --disable-coroutine-pool) coroutine_pool="no"
> +  ;;
> +  --enable-coroutine-pool) coroutine_pool="yes"
> +  ;;
>    --disable-docs) docs="no"
>    ;;
>    --enable-docs) docs="yes"
> @@ -1161,6 +1166,8 @@ echo "  --disable-seccomp        disable seccomp support"
>  echo "  --enable-seccomp         enables seccomp support"
>  echo "  --with-coroutine=BACKEND coroutine backend. Supported options:"
>  echo "                           gthread, ucontext, sigaltstack, windows"
> +echo "  --disable-coroutine-pool disable coroutine freelist (worse performance)"
> +echo "  --enable-coroutine-pool  enable coroutine freelist (better performance)"
>  echo "  --enable-glusterfs       enable GlusterFS backend"
>  echo "  --disable-glusterfs      disable GlusterFS backend"
>  echo "  --enable-gcov            enable test coverage analysis with gcov"
> @@ -3279,6 +3286,17 @@ else
>    esac
>  fi
>  
> +if test "$coroutine_pool" = ""; then
> +  if test "$coroutine" = "gthread"; then
> +    coroutine_pool=no
> +  else
> +    coroutine_pool=yes
> +  fi
> +fi
> +if test "$coroutine" = "gthread" -a "$coroutine_pool" = "yes"; then
> +  error_exit "'gthread' coroutine backend does not support pool (use --disable-coroutine-pool)"
> +fi
> +
>  ##########################################
>  # check if we have open_by_handle_at
>  
> @@ -3644,6 +3662,7 @@ echo "libiscsi support  $libiscsi"
>  echo "build guest agent $guest_agent"
>  echo "seccomp support   $seccomp"
>  echo "coroutine backend $coroutine"
> +echo "coroutine pool    $coroutine_pool"
>  echo "GlusterFS support $glusterfs"
>  echo "virtio-blk-data-plane $virtio_blk_data_plane"
>  echo "gcov              $gcov_tool"
> @@ -3999,6 +4018,11 @@ if test "$rbd" = "yes" ; then
>  fi
>  
>  echo "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak
> +if test "$coroutine_pool" = "yes" ; then
> +  echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak
> +else
> +  echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak
> +fi

Doesn't work.

In config-host.make we do get:

    CONFIG_COROUTINE_POOL=0

But when config-host.h is generated from it, I assume it's only checked
if the variable is defined, so we end up with:

    #define CONFIG_COROUTINE_POOL 1

That is, you never really disable the pool.

Kevin

  parent reply	other threads:[~2013-09-11 15:25 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-11 14:42 [Qemu-devel] [PATCH] coroutine: add ./configure --disable-coroutine-pool Stefan Hajnoczi
2013-09-11 14:56 ` Gabriel Kerneis
2013-09-11 15:24 ` Kevin Wolf [this message]
2013-09-11 15:32   ` Gabriel Kerneis
2013-09-11 15:38     ` Kevin Wolf
2013-09-12  8:42       ` Stefan Hajnoczi
2013-09-27  5:20 ` Stefan Weil
2013-09-27  9:11   ` Stefan Hajnoczi
2013-09-27 16:49     ` Stefan Weil
2013-09-30  9:06       ` Stefan Hajnoczi
2013-10-01  5:51         ` Stefan Weil
2013-10-01  7:29           ` Gabriel Kerneis
2013-10-01 16:44             ` Stefan Weil
2013-10-02  8:54               ` Stefan Hajnoczi
2013-10-02 21:15                 ` Stefan Weil
2013-10-04  7:30                   ` Stefan Hajnoczi
2013-10-01  7:21         ` Paolo Bonzini

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=20130911152455.GL2305@dhcp-200-207.str.redhat.com \
    --to=kwolf@redhat.com \
    --cc=gabriel@kerneis.info \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.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).