From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LdmK2-0008IT-PK for qemu-devel@nongnu.org; Sun, 01 Mar 2009 09:07:14 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LdmK0-0008IH-7B for qemu-devel@nongnu.org; Sun, 01 Mar 2009 09:07:13 -0500 Received: from [199.232.76.173] (port=54273 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LdmK0-0008IE-0z for qemu-devel@nongnu.org; Sun, 01 Mar 2009 09:07:12 -0500 Received: from yw-out-1718.google.com ([74.125.46.155]:22691) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LdmJz-0003A5-Lc for qemu-devel@nongnu.org; Sun, 01 Mar 2009 09:07:11 -0500 Received: by yw-out-1718.google.com with SMTP id 6so1209371ywa.82 for ; Sun, 01 Mar 2009 06:07:09 -0800 (PST) Message-ID: <49AA968B.7000802@codemonkey.ws> Date: Sun, 01 Mar 2009 08:07:07 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] Re: [PATCH] Fix freezing bug in curses console References: <20090228212116.GL20640@shareable.org> <20090301113635.GA10538@redhat.com> <200903011303.38741.paul@codesourcery.com> In-Reply-To: <200903011303.38741.paul@codesourcery.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paul Brook Cc: Matthew Bloch , qemu-devel@nongnu.org, kvm@vger.kernel.org Paul Brook wrote: >>>> I think it still suffers from the same race condition so today it >>>> wouldn't work. You could fix the bottom half scheduling though so that >>>> you could safely schedule a bottom half from a signal handler (using >>>> roughly the same trick). >>>> >>> Fwiw, it's perfectly sensible to have a single pipe which is shared by >>> all signal handlers, just used to say "check for work flags set". >>> >> And if you need the main loop to be able to distinguish signals coming >> out of the pipe, then just write the signum into the pipe as a byte, >> instead of a single dummy byte. Or even write the whole 'siginfo_t' >> struct passed to the signal handler, and read it out in sizeof(siginfo_t) >> sized chunks for processing. >> > > I don't think this will works. If the pipe buffer gets full the write will > either block or you'll loose signals. > > When using the pipe as a simple semaphore all you care about is the presence > or absence of data. It doesn't matter if subsequent writes loose data (e.g. > by not retrying a nonblocking write) as long as a write to an empty pipe > succeeds. > Yup. You need to use a global flag to distinguish the type of signal. Regards, Anthony Liguori > Paul > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html >