From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=48272 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PKyex-0005vE-NK for qemu-devel@nongnu.org; Tue, 23 Nov 2010 14:36:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PKyeh-0006s0-CW for qemu-devel@nongnu.org; Tue, 23 Nov 2010 14:36:09 -0500 Received: from mail-px0-f173.google.com ([209.85.212.173]:62519) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PKyeh-0006qV-7i for qemu-devel@nongnu.org; Tue, 23 Nov 2010 14:35:55 -0500 Received: by pxi16 with SMTP id 16so2353614pxi.4 for ; Tue, 23 Nov 2010 11:35:54 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <1290530963-3448-1-git-send-email-aliguori@us.ibm.com> References: <1290530963-3448-1-git-send-email-aliguori@us.ibm.com> From: Blue Swirl Date: Tue, 23 Nov 2010 19:35:33 +0000 Message-ID: Subject: Re: [Qemu-devel] [PATCH] qemu-kvm: response to SIGUSR1 to start/stop a VCPU (v2) Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Chris Wright , qemu-devel@nongnu.org, kvm@vger.kernel.org, Avi Kivity On Tue, Nov 23, 2010 at 4:49 PM, Anthony Liguori wrot= e: > qemu-kvm vcpu threads don't response to SIGSTOP/SIGCONT. =C2=A0Instead of= teaching > them to respond to these signals (which cannot be trapped), use SIGUSR1 t= o > approximate the behavior of SIGSTOP/SIGCONT. > > The purpose of this is to implement CPU hard limits using an external too= l that > watches the CPU consumption and stops the VCPU as appropriate. > > This provides a more elegant solution in that it allows the VCPU thread t= o > release qemu_mutex before going to sleep. > > This current implementation uses a single signal. =C2=A0I think this is t= oo racey > in the long term so I think we should introduce a second signal. =C2=A0If= two signals > get coalesced into one, it could confuse the monitoring tool into giving = the > VCPU the inverse of it's entitlement. > > It might be better to simply move this logic entirely into QEMU to make t= his > more robust--the question is whether we think this is a good long term fe= ature > to carry in QEMU? > +static __thread int sigusr1_wfd; While OpenBSD finally updated the default compiler to 4.2.1 from 3.x series, thread local storage is still not supported: $ cat thread.c static __thread int sigusr1_wfd; $ gcc thread.c -c thread.c:1: error: thread-local storage not supported for this target $ gcc -v Reading specs from /usr/lib/gcc-lib/sparc64-unknown-openbsd4.8/4.2.1/specs Target: sparc64-unknown-openbsd4.8 Configured with: OpenBSD/sparc64 system compiler Thread model: posix gcc version 4.2.1 20070719