From patchwork Fri Mar 12 02:45:50 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 85178 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o2C2pAmS031020 for ; Fri, 12 Mar 2010 02:51:10 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755918Ab0CLCvF (ORCPT ); Thu, 11 Mar 2010 21:51:05 -0500 Received: from mx1.redhat.com ([209.132.183.28]:64505 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755912Ab0CLCvB (ORCPT ); Thu, 11 Mar 2010 21:51:01 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o2C2oq2v021309 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 11 Mar 2010 21:50:53 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o2C2oq0Y008441; Thu, 11 Mar 2010 21:50:52 -0500 Received: from amt.cnet (vpn-10-50.rdu.redhat.com [10.11.10.50]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o2C2oofP017596; Thu, 11 Mar 2010 21:50:51 -0500 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id 9552D68AC5A; Thu, 11 Mar 2010 23:49:52 -0300 (BRT) Received: (from marcelo@localhost) by amt.cnet (8.14.3/8.14.3/Submit) id o2C2nq8P032748; Thu, 11 Mar 2010 23:49:52 -0300 Message-Id: <20100312024808.111854028@redhat.com> User-Agent: quilt/0.47-1 Date: Thu, 11 Mar 2010 23:45:50 -0300 From: Marcelo Tosatti To: kvm@vger.kernel.org, qemu-devel@nongnu.org Cc: avi@redhat.com, anthony@codemonkey.ws, amit.shah@redhat.com, Marcelo Tosatti Subject: [patch 1/2] Pass QEMUIOWorker to qemu_notify_event References: <20100312024549.787893344@redhat.com> Content-Disposition: inline; filename=qemu-io-worker X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Fri, 12 Mar 2010 02:51:10 +0000 (UTC) Index: qemu-ioworker/async.c =================================================================== --- qemu-ioworker.orig/async.c +++ qemu-ioworker/async.c @@ -180,7 +180,7 @@ void qemu_bh_schedule(QEMUBH *bh) bh->scheduled = 1; bh->idle = 0; /* stop the currently executing CPU to execute the BH ASAP */ - qemu_notify_event(); + qemu_notify_event(main_io_worker); } void qemu_bh_cancel(QEMUBH *bh) Index: qemu-ioworker/hw/mac_dbdma.c =================================================================== --- qemu-ioworker.orig/hw/mac_dbdma.c +++ qemu-ioworker/hw/mac_dbdma.c @@ -655,7 +655,7 @@ void DBDMA_register_channel(void *dbdma, void DBDMA_schedule(void) { - qemu_notify_event(); + qemu_notify_event(main_io_worker); } static void Index: qemu-ioworker/hw/virtio-net.c =================================================================== --- qemu-ioworker.orig/hw/virtio-net.c +++ qemu-ioworker/hw/virtio-net.c @@ -359,7 +359,7 @@ static void virtio_net_handle_rx(VirtIOD /* We now have RX buffers, signal to the IO thread to break out of the * select to re-poll the tap file descriptor */ - qemu_notify_event(); + qemu_notify_event(main_io_worker); } static int virtio_net_can_receive(VLANClientState *nc) Index: qemu-ioworker/qemu-common.h =================================================================== --- qemu-ioworker.orig/qemu-common.h +++ qemu-ioworker/qemu-common.h @@ -234,11 +234,17 @@ typedef uint64_t pcibus_t; void cpu_save(QEMUFile *f, void *opaque); int cpu_load(QEMUFile *f, void *opaque, int version_id); +typedef struct QEMUIOWorker { + void *opaque; +} QEMUIOWorker; + /* Force QEMU to stop what it's doing and service IO */ void qemu_service_io(void); /* Force QEMU to process pending events */ -void qemu_notify_event(void); +void qemu_notify_event(QEMUIOWorker *worker); + +extern QEMUIOWorker *main_io_worker; /* Unblock cpu */ void qemu_cpu_kick(void *env); Index: qemu-ioworker/vl.c =================================================================== --- qemu-ioworker.orig/vl.c +++ qemu-ioworker/vl.c @@ -274,6 +274,9 @@ uint8_t qemu_uuid[16]; static QEMUBootSetHandler *boot_set_handler; static void *boot_set_opaque; +QEMUIOWorker iothread_worker; +QEMUIOWorker *main_io_worker = &iothread_worker; + #ifdef SIGRTMIN #define SIG_IPI (SIGRTMIN+4) #else @@ -885,7 +888,7 @@ void qemu_mod_timer(QEMUTimer *ts, int64 } /* Interrupt execution to force deadline recalculation. */ if (use_icount) - qemu_notify_event(); + qemu_notify_event(main_io_worker); } } @@ -1062,7 +1065,7 @@ static void host_alarm_handler(int host_ } #endif timer_alarm_pending = 1; - qemu_notify_event(); + qemu_notify_event(main_io_worker); } } @@ -2928,7 +2931,7 @@ static int ram_load(QEMUFile *f, void *o void qemu_service_io(void) { - qemu_notify_event(); + qemu_notify_event(main_io_worker); } /***********************************************************/ @@ -3180,26 +3183,26 @@ void qemu_system_reset_request(void) } else { reset_requested = 1; } - qemu_notify_event(); + qemu_notify_event(main_io_worker); } void qemu_system_shutdown_request(void) { shutdown_requested = 1; - qemu_notify_event(); + qemu_notify_event(main_io_worker); } void qemu_system_powerdown_request(void) { powerdown_requested = 1; - qemu_notify_event(); + qemu_notify_event(main_io_worker); } #ifdef CONFIG_IOTHREAD static void qemu_system_vmstop_request(int reason) { vmstop_requested = reason; - qemu_notify_event(); + qemu_notify_event(main_io_worker); } #endif @@ -3341,7 +3344,7 @@ void qemu_cpu_kick(void *env) return; } -void qemu_notify_event(void) +void qemu_notify_event(QEMUIOWorker *worker) { CPUState *env = cpu_single_env; @@ -3727,7 +3730,7 @@ void qemu_init_vcpu(void *_env) tcg_init_vcpu(env); } -void qemu_notify_event(void) +void qemu_notify_event(QEMUIOWorker *worker) { qemu_event_increment(); }