From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [RFC PATCH] fix select(2) race between main_loop_wait and qemu_aio_wait Date: Mon, 05 Mar 2012 18:55:56 +0100 Message-ID: <4F54FE2C.6030201@siemens.com> References: <1330936455-23802-1-git-send-email-pbonzini@redhat.com> <4F548263.1070905@siemens.com> <4F54CC8A.5010509@redhat.com> <4F54CE10.4040407@siemens.com> <4F54FA6D.2010100@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Cc: Paolo Bonzini , "qemu-devel@nongnu.org" , "kvm@vger.kernel.org" , "laurent@vivier.eu" , "anthony@codemonkey.ws" To: Avi Kivity Return-path: Received: from thoth.sbs.de ([192.35.17.2]:20972 "EHLO thoth.sbs.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753311Ab2CER4G (ORCPT ); Mon, 5 Mar 2012 12:56:06 -0500 In-Reply-To: <4F54FA6D.2010100@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 2012-03-05 18:39, Avi Kivity wrote: > On 03/05/2012 04:30 PM, Jan Kiszka wrote: >> On 2012-03-05 15:24, Avi Kivity wrote: >>>> Long-term, I'd like to cut out certain file descriptors from the main >>>> loop and process them completely in separate threads (for separate >>>> locking, prioritization etc.). Dunno how NBD works, but maybe it should >>>> be reworked like this already. >>> >>> Ideally qemu_set_fd_handler2() should be made thread local, and each >>> device thread would run a copy of the main loop, just working on >>> different data. >> >> qemu_set_fd_handler2 may not only be called over an iothread. Rather, we >> need an object and associated lock that is related to the io-path (i.e. >> frontend device + backend driver). That object has to be passed to >> services like qemu_set_fd_handler2. > > Not sure I like implicit lock-taking. In particular, how does it > interact with unregistering an fd_handler? I wasn't suggesting implicit lock taking, just decoupling from our infamous global lock. My point is that thread-local won't help here. Jan -- Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux