From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34427) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMyMG-0004uV-TY for qemu-devel@nongnu.org; Thu, 28 Aug 2014 07:59:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XMyM7-0002gr-Mw for qemu-devel@nongnu.org; Thu, 28 Aug 2014 07:59:16 -0400 Received: from e06smtp12.uk.ibm.com ([195.75.94.108]:50801) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMyM7-0002gd-FI for qemu-devel@nongnu.org; Thu, 28 Aug 2014 07:59:07 -0400 Received: from /spool/local by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 28 Aug 2014 12:59:03 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id C789A17D8047 for ; Thu, 28 Aug 2014 13:00:56 +0100 (BST) Received: from d06av09.portsmouth.uk.ibm.com (d06av09.portsmouth.uk.ibm.com [9.149.37.250]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id s7SBx11p43384846 for ; Thu, 28 Aug 2014 11:59:01 GMT Received: from d06av09.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av09.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s7SBx0sw014191 for ; Thu, 28 Aug 2014 05:59:01 -0600 From: Jens Freimann Date: Thu, 28 Aug 2014 13:58:50 +0200 Message-Id: <1409227132-55354-4-git-send-email-jfrei@linux.vnet.ibm.com> In-Reply-To: <1409227132-55354-1-git-send-email-jfrei@linux.vnet.ibm.com> References: <1409227132-55354-1-git-send-email-jfrei@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 3/5] s390x/kvm: execute sigp orders on the target vcpu thread List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Christian Borntraeger , Alexander Graf , Cornelia Huck Cc: David Hildenbrand , Jens Freimann , qemu-devel@nongnu.org From: David Hildenbrand All sigp orders that can result in ioctls on the target vcpu should be executed on the associated vcpu thread. Reviewed-by: Cornelia Huck Acked-by: Christian Borntraeger Signed-off-by: David Hildenbrand Signed-off-by: Jens Freimann --- target-s390x/kvm.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c index a32d91a..421ff43 100644 --- a/target-s390x/kvm.c +++ b/target-s390x/kvm.c @@ -916,23 +916,30 @@ static int handle_diag(S390CPU *cpu, struct kvm_run *run, uint32_t ipb) return r; } -static int kvm_s390_cpu_start(S390CPU *cpu) +static void sigp_cpu_start(void *arg) { + CPUState *cs = arg; + S390CPU *cpu = S390_CPU(cs); + s390_add_running_cpu(cpu); - qemu_cpu_kick(CPU(cpu)); DPRINTF("DONE: KVM cpu start: %p\n", &cpu->env); - return 0; } -int kvm_s390_cpu_restart(S390CPU *cpu) +static void sigp_cpu_restart(void *arg) { + CPUState *cs = arg; + S390CPU *cpu = S390_CPU(cs); struct kvm_s390_irq irq = { .type = KVM_S390_RESTART, }; kvm_s390_vcpu_interrupt(cpu, &irq); s390_add_running_cpu(cpu); - qemu_cpu_kick(CPU(cpu)); +} + +int kvm_s390_cpu_restart(S390CPU *cpu) +{ + run_on_cpu(CPU(cpu), sigp_cpu_restart, CPU(cpu)); DPRINTF("DONE: KVM cpu restart: %p\n", &cpu->env); return 0; } @@ -980,10 +987,12 @@ static int handle_sigp(S390CPU *cpu, struct kvm_run *run, uint8_t ipa1) switch (order_code) { case SIGP_START: - cc = kvm_s390_cpu_start(target_cpu); + run_on_cpu(CPU(target_cpu), sigp_cpu_start, CPU(target_cpu)); + cc = 0; break; case SIGP_RESTART: - cc = kvm_s390_cpu_restart(target_cpu); + run_on_cpu(CPU(target_cpu), sigp_cpu_restart, CPU(target_cpu)); + cc = 0; break; case SIGP_SET_ARCH: *statusreg &= 0xffffffff00000000UL; -- 1.9.3