From patchwork Mon Sep 17 16:30:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 970691 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="yxtR4IhH"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="jj+r659+"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42DWyY230Zz9sfR for ; Tue, 18 Sep 2018 02:38:12 +1000 (AEST) Received: from localhost ([::1]:36465 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wXI-0003Q8-RL for incoming@patchwork.ozlabs.org; Mon, 17 Sep 2018 12:38:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40782) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wQd-0006Ey-Lo for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1wQZ-0001nm-8h for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:15 -0400 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:38151) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g1wQY-0001cp-SO for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:11 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id CED974F8; Mon, 17 Sep 2018 12:31:05 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 17 Sep 2018 12:31:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=iXdOs6GwMZoJYG wjdbdtQq3pTutYJKZguj9iVH1xmOU=; b=yxtR4IhHY3PmKbLK+yFpHkuWZ+31Vf TyMiZTbcy0hYQolBewzdUGnB1BguMoB883XMIoYSzVQr4cPL6C92hQ1r3vNkMc38 A+8O9SAftVOwoMAgorlAroN9hicmxjzB2r1otKmC8y2Zp+f3pOefJCNIUVF7W6Ny PwoISHw91Ij40= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=iXdOs6GwMZoJYGwjdbdtQq3pTutYJKZguj9iVH1xmOU=; b=jj+r659+ 5HM9hAAsn0gDmXLE+Pn4qu7IvmyP6WQMVMN7igTysh4WE6rLiDgU8i54z4Fx+PHe 0v8GyRnL4DVj4gqgFdMDyJzpaqrD7Gt4en0L+JLDVn8JDi7HPpShoxK5Em5QM5w4 VbUq/5xTQY0VNkTxEgmD8x9da2FmXF2Jpuq9+UEC6lbbliy32FHa9u6N2EQeCdj+ zl1myomoUOD5bM4co5ktMn+iyUUMh/kyzj95J+WMRQ7Bg9yZC8GuvwrkPgd2eNF0 7uT3mBL5m2pvAMylUqRl1ZlbM3JZGmy6weSmptVp/9KC3+E9Mg0VeY+fJ8zcD8TD UbXol838LYp49A== X-ME-Proxy: X-ME-Sender: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 98C57E4626; Mon, 17 Sep 2018 12:31:04 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Mon, 17 Sep 2018 12:30:29 -0400 Message-Id: <20180917163103.6113-2-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180917163103.6113-1-cota@braap.org> References: <20180917163103.6113-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.147.123.25 Subject: [Qemu-devel] [PATCH 01/35] tcg: access cpu->icount_decr.u16.high with atomics X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson , Peter Crosthwaite Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Consistently access u16.high with atomics to avoid undefined behaviour in MTTCG. Note that icount_decr.u16.low is only used in icount mode, so regular accesses to it are OK. Cc: Peter Crosthwaite Cc: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- accel/tcg/tcg-all.c | 2 +- accel/tcg/translate-all.c | 2 +- qom/cpu.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c index 56dbb56a16..3d25bdcc17 100644 --- a/accel/tcg/tcg-all.c +++ b/accel/tcg/tcg-all.c @@ -51,7 +51,7 @@ static void tcg_handle_interrupt(CPUState *cpu, int mask) if (!qemu_cpu_is_self(cpu)) { qemu_cpu_kick(cpu); } else { - cpu->icount_decr.u16.high = -1; + atomic_set(&cpu->icount_decr.u16.high, -1); if (use_icount && !cpu->can_do_io && (mask & ~old_mask) != 0) { diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 898c3bb3d1..f7784bbc2d 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -2352,7 +2352,7 @@ void cpu_interrupt(CPUState *cpu, int mask) { g_assert(qemu_mutex_iothread_locked()); cpu->interrupt_request |= mask; - cpu->icount_decr.u16.high = -1; + atomic_set(&cpu->icount_decr.u16.high, -1); } /* diff --git a/qom/cpu.c b/qom/cpu.c index 92599f3541..20ad54d43f 100644 --- a/qom/cpu.c +++ b/qom/cpu.c @@ -266,7 +266,7 @@ static void cpu_common_reset(CPUState *cpu) cpu->mem_io_pc = 0; cpu->mem_io_vaddr = 0; cpu->icount_extra = 0; - cpu->icount_decr.u32 = 0; + atomic_set(&cpu->icount_decr.u32, 0); cpu->can_do_io = 1; cpu->exception_index = -1; cpu->crash_occurred = false; From patchwork Mon Sep 17 16:30:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 970697 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="wVxVMWWu"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="FTtIUp5Q"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42DX295zMcz9sfR for ; Tue, 18 Sep 2018 02:41:21 +1000 (AEST) Received: from localhost ([::1]:36489 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1waN-00060H-75 for incoming@patchwork.ozlabs.org; Mon, 17 Sep 2018 12:41:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40783) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wQd-0006Ez-MQ for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1wQZ-0001o0-Bp for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:15 -0400 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:43007) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g1wQY-0001co-Vr for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:11 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id C2E334F2; Mon, 17 Sep 2018 12:31:05 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 17 Sep 2018 12:31:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=+SROB5hA3rG0AL pBnKGk3p/NpJhQ4MAgB/1olZhg/Qw=; b=wVxVMWWu0pbv/zWssSsHB5Q9v35CX4 VnkEGkaW5ZPASmRDiYTV9Py3NJyy2FZXadTN62GZKOhXJ6ASAhzrT5oiYejQmBUN fKQU/HzxQGfLbnKlqjfnhPc/GFLNcmx0LKmXYpqvYgPGf4tAnpBlEbiGu9g9G6lF OK18xMhZzdwsQ= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=+SROB5hA3rG0ALpBnKGk3p/NpJhQ4MAgB/1olZhg/Qw=; b=FTtIUp5Q UYdOE2Hjj+P18zWdwe801dNpeuj7SqKJUE7eRzyCZkPq4RXXhK+zMgLBQ7CDg/hB 94i62mjezc4Fn3VxjtkXsatmMNHcarvyDMgLdqFLjszRHtVF4d+X4UiRsqDUKCgY xp503qmMr6xCYzvip3kUVF5wi2z98jb/ms4EYAO4+b39jKp9BZrYhtcYPyvj0KOY NnN4825F9uMyzhS/YII8mS6GkZFVGKZXoDMtyhOdKAozvWHmMlR20ioRaLOosWiU X45FmzK/ogdAce6pq4nGgr9iXdai6mzNHDzS/sOovxoGOv75NnCrabGA2tRXk1CW Bd19uTg8Ji5w1Q== X-ME-Proxy: X-ME-Sender: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id CE6A6E49F7; Mon, 17 Sep 2018 12:31:04 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Mon, 17 Sep 2018 12:30:30 -0400 Message-Id: <20180917163103.6113-3-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180917163103.6113-1-cota@braap.org> References: <20180917163103.6113-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.147.123.25 Subject: [Qemu-devel] [PATCH 02/35] target/i386: use cpu_reset_interrupt X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Marcelo Tosatti , Eduardo Habkost , kvm@vger.kernel.org, Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini It will be changed to an atomic operation soon. Cc: Richard Henderson Cc: Eduardo Habkost Cc: Marcelo Tosatti Cc: kvm@vger.kernel.org Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- target/i386/hax-all.c | 4 ++-- target/i386/hvf/x86hvf.c | 8 ++++---- target/i386/kvm.c | 14 +++++++------- target/i386/seg_helper.c | 13 ++++++------- target/i386/svm_helper.c | 2 +- target/i386/whpx-all.c | 10 +++++----- 6 files changed, 25 insertions(+), 26 deletions(-) diff --git a/target/i386/hax-all.c b/target/i386/hax-all.c index d2e512856b..ae8b678db0 100644 --- a/target/i386/hax-all.c +++ b/target/i386/hax-all.c @@ -433,7 +433,7 @@ static int hax_vcpu_interrupt(CPUArchState *env) irq = cpu_get_pic_interrupt(env); if (irq >= 0) { hax_inject_interrupt(env, irq); - cpu->interrupt_request &= ~CPU_INTERRUPT_HARD; + cpu_reset_interrupt(cpu, CPU_INTERRUPT_HARD); } } @@ -483,7 +483,7 @@ static int hax_vcpu_hax_exec(CPUArchState *env) cpu->halted = 0; if (cpu->interrupt_request & CPU_INTERRUPT_POLL) { - cpu->interrupt_request &= ~CPU_INTERRUPT_POLL; + cpu_reset_interrupt(cpu, CPU_INTERRUPT_POLL); apic_poll_irq(x86_cpu->apic_state); } diff --git a/target/i386/hvf/x86hvf.c b/target/i386/hvf/x86hvf.c index 6c88939b96..3ac796b885 100644 --- a/target/i386/hvf/x86hvf.c +++ b/target/i386/hvf/x86hvf.c @@ -402,7 +402,7 @@ bool hvf_inject_interrupts(CPUState *cpu_state) if (cpu_state->interrupt_request & CPU_INTERRUPT_NMI) { if (!(env->hflags2 & HF2_NMI_MASK) && !(info & VMCS_INTR_VALID)) { - cpu_state->interrupt_request &= ~CPU_INTERRUPT_NMI; + cpu_reset_interrupt(cpu_state, CPU_INTERRUPT_NMI); info = VMCS_INTR_VALID | VMCS_INTR_T_NMI | NMI_VEC; wvmcs(cpu_state->hvf_fd, VMCS_ENTRY_INTR_INFO, info); } else { @@ -414,7 +414,7 @@ bool hvf_inject_interrupts(CPUState *cpu_state) (cpu_state->interrupt_request & CPU_INTERRUPT_HARD) && (EFLAGS(env) & IF_MASK) && !(info & VMCS_INTR_VALID)) { int line = cpu_get_pic_interrupt(&x86cpu->env); - cpu_state->interrupt_request &= ~CPU_INTERRUPT_HARD; + cpu_reset_interrupt(cpu_state, CPU_INTERRUPT_HARD); if (line >= 0) { wvmcs(cpu_state->hvf_fd, VMCS_ENTRY_INTR_INFO, line | VMCS_INTR_VALID | VMCS_INTR_T_HWINTR); @@ -440,7 +440,7 @@ int hvf_process_events(CPUState *cpu_state) } if (cpu_state->interrupt_request & CPU_INTERRUPT_POLL) { - cpu_state->interrupt_request &= ~CPU_INTERRUPT_POLL; + cpu_reset_interrupt(cpu_state, CPU_INTERRUPT_POLL); apic_poll_irq(cpu->apic_state); } if (((cpu_state->interrupt_request & CPU_INTERRUPT_HARD) && @@ -453,7 +453,7 @@ int hvf_process_events(CPUState *cpu_state) do_cpu_sipi(cpu); } if (cpu_state->interrupt_request & CPU_INTERRUPT_TPR) { - cpu_state->interrupt_request &= ~CPU_INTERRUPT_TPR; + cpu_reset_interrupt(cpu_state, CPU_INTERRUPT_TPR); hvf_cpu_synchronize_state(cpu_state); apic_handle_tpr_access_report(cpu->apic_state, env->eip, env->tpr_access_type); diff --git a/target/i386/kvm.c b/target/i386/kvm.c index 0b2a07d3a4..5dd66809b0 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -2709,7 +2709,7 @@ static int kvm_put_vcpu_events(X86CPU *cpu, int level) */ events.smi.pending = cs->interrupt_request & CPU_INTERRUPT_SMI; events.smi.latched_init = cs->interrupt_request & CPU_INTERRUPT_INIT; - cs->interrupt_request &= ~(CPU_INTERRUPT_INIT | CPU_INTERRUPT_SMI); + cpu_reset_interrupt(cs, CPU_INTERRUPT_INIT | CPU_INTERRUPT_SMI); } else { /* Keep these in cs->interrupt_request. */ events.smi.pending = 0; @@ -3005,7 +3005,7 @@ void kvm_arch_pre_run(CPUState *cpu, struct kvm_run *run) if (cpu->interrupt_request & (CPU_INTERRUPT_NMI | CPU_INTERRUPT_SMI)) { if (cpu->interrupt_request & CPU_INTERRUPT_NMI) { qemu_mutex_lock_iothread(); - cpu->interrupt_request &= ~CPU_INTERRUPT_NMI; + cpu_reset_interrupt(cpu, CPU_INTERRUPT_NMI); qemu_mutex_unlock_iothread(); DPRINTF("injected NMI\n"); ret = kvm_vcpu_ioctl(cpu, KVM_NMI); @@ -3016,7 +3016,7 @@ void kvm_arch_pre_run(CPUState *cpu, struct kvm_run *run) } if (cpu->interrupt_request & CPU_INTERRUPT_SMI) { qemu_mutex_lock_iothread(); - cpu->interrupt_request &= ~CPU_INTERRUPT_SMI; + cpu_reset_interrupt(cpu, CPU_INTERRUPT_SMI); qemu_mutex_unlock_iothread(); DPRINTF("injected SMI\n"); ret = kvm_vcpu_ioctl(cpu, KVM_SMI); @@ -3052,7 +3052,7 @@ void kvm_arch_pre_run(CPUState *cpu, struct kvm_run *run) (env->eflags & IF_MASK)) { int irq; - cpu->interrupt_request &= ~CPU_INTERRUPT_HARD; + cpu_reset_interrupt(cpu, CPU_INTERRUPT_HARD); irq = cpu_get_pic_interrupt(env); if (irq >= 0) { struct kvm_interrupt intr; @@ -3123,7 +3123,7 @@ int kvm_arch_process_async_events(CPUState *cs) /* We must not raise CPU_INTERRUPT_MCE if it's not supported. */ assert(env->mcg_cap); - cs->interrupt_request &= ~CPU_INTERRUPT_MCE; + cpu_reset_interrupt(cs, CPU_INTERRUPT_MCE); kvm_cpu_synchronize_state(cs); @@ -3153,7 +3153,7 @@ int kvm_arch_process_async_events(CPUState *cs) } if (cs->interrupt_request & CPU_INTERRUPT_POLL) { - cs->interrupt_request &= ~CPU_INTERRUPT_POLL; + cpu_reset_interrupt(cs, CPU_INTERRUPT_POLL); apic_poll_irq(cpu->apic_state); } if (((cs->interrupt_request & CPU_INTERRUPT_HARD) && @@ -3166,7 +3166,7 @@ int kvm_arch_process_async_events(CPUState *cs) do_cpu_sipi(cpu); } if (cs->interrupt_request & CPU_INTERRUPT_TPR) { - cs->interrupt_request &= ~CPU_INTERRUPT_TPR; + cpu_reset_interrupt(cs, CPU_INTERRUPT_TPR); kvm_cpu_synchronize_state(cs); apic_handle_tpr_access_report(cpu->apic_state, env->eip, env->tpr_access_type); diff --git a/target/i386/seg_helper.c b/target/i386/seg_helper.c index d1cbc6ebf0..0dd85329db 100644 --- a/target/i386/seg_helper.c +++ b/target/i386/seg_helper.c @@ -1323,7 +1323,7 @@ bool x86_cpu_exec_interrupt(CPUState *cs, int interrupt_request) #if !defined(CONFIG_USER_ONLY) if (interrupt_request & CPU_INTERRUPT_POLL) { - cs->interrupt_request &= ~CPU_INTERRUPT_POLL; + cpu_reset_interrupt(cs, CPU_INTERRUPT_POLL); apic_poll_irq(cpu->apic_state); /* Don't process multiple interrupt requests in a single call. This is required to make icount-driven execution deterministic. */ @@ -1337,18 +1337,18 @@ bool x86_cpu_exec_interrupt(CPUState *cs, int interrupt_request) if ((interrupt_request & CPU_INTERRUPT_SMI) && !(env->hflags & HF_SMM_MASK)) { cpu_svm_check_intercept_param(env, SVM_EXIT_SMI, 0, 0); - cs->interrupt_request &= ~CPU_INTERRUPT_SMI; + cpu_reset_interrupt(cs, CPU_INTERRUPT_SMI); do_smm_enter(cpu); ret = true; } else if ((interrupt_request & CPU_INTERRUPT_NMI) && !(env->hflags2 & HF2_NMI_MASK)) { cpu_svm_check_intercept_param(env, SVM_EXIT_NMI, 0, 0); - cs->interrupt_request &= ~CPU_INTERRUPT_NMI; + cpu_reset_interrupt(cs, CPU_INTERRUPT_NMI); env->hflags2 |= HF2_NMI_MASK; do_interrupt_x86_hardirq(env, EXCP02_NMI, 1); ret = true; } else if (interrupt_request & CPU_INTERRUPT_MCE) { - cs->interrupt_request &= ~CPU_INTERRUPT_MCE; + cpu_reset_interrupt(cs, CPU_INTERRUPT_MCE); do_interrupt_x86_hardirq(env, EXCP12_MCHK, 0); ret = true; } else if ((interrupt_request & CPU_INTERRUPT_HARD) && @@ -1359,8 +1359,7 @@ bool x86_cpu_exec_interrupt(CPUState *cs, int interrupt_request) !(env->hflags & HF_INHIBIT_IRQ_MASK))))) { int intno; cpu_svm_check_intercept_param(env, SVM_EXIT_INTR, 0, 0); - cs->interrupt_request &= ~(CPU_INTERRUPT_HARD | - CPU_INTERRUPT_VIRQ); + cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD | CPU_INTERRUPT_VIRQ); intno = cpu_get_pic_interrupt(env); qemu_log_mask(CPU_LOG_TB_IN_ASM, "Servicing hardware INT=0x%02x\n", intno); @@ -1380,7 +1379,7 @@ bool x86_cpu_exec_interrupt(CPUState *cs, int interrupt_request) qemu_log_mask(CPU_LOG_TB_IN_ASM, "Servicing virtual hardware INT=0x%02x\n", intno); do_interrupt_x86_hardirq(env, intno, 1); - cs->interrupt_request &= ~CPU_INTERRUPT_VIRQ; + cpu_reset_interrupt(cs, CPU_INTERRUPT_VIRQ); ret = true; #endif } diff --git a/target/i386/svm_helper.c b/target/i386/svm_helper.c index 342ece082f..c532639574 100644 --- a/target/i386/svm_helper.c +++ b/target/i386/svm_helper.c @@ -700,7 +700,7 @@ void do_vmexit(CPUX86State *env, uint32_t exit_code, uint64_t exit_info_1) env->hflags &= ~HF_SVMI_MASK; env->intercept = 0; env->intercept_exceptions = 0; - cs->interrupt_request &= ~CPU_INTERRUPT_VIRQ; + cpu_reset_interrupt(cs, CPU_INTERRUPT_VIRQ); env->tsc_offset = 0; env->gdt.base = x86_ldq_phys(cs, env->vm_hsave + offsetof(struct vmcb, diff --git a/target/i386/whpx-all.c b/target/i386/whpx-all.c index 57e53e1f1f..d9428dc987 100644 --- a/target/i386/whpx-all.c +++ b/target/i386/whpx-all.c @@ -728,14 +728,14 @@ static void whpx_vcpu_pre_run(CPUState *cpu) if (!vcpu->interruption_pending && cpu->interrupt_request & (CPU_INTERRUPT_NMI | CPU_INTERRUPT_SMI)) { if (cpu->interrupt_request & CPU_INTERRUPT_NMI) { - cpu->interrupt_request &= ~CPU_INTERRUPT_NMI; + cpu_reset_interrupt(cpu, CPU_INTERRUPT_NMI); vcpu->interruptable = false; new_int.InterruptionType = WHvX64PendingNmi; new_int.InterruptionPending = 1; new_int.InterruptionVector = 2; } if (cpu->interrupt_request & CPU_INTERRUPT_SMI) { - cpu->interrupt_request &= ~CPU_INTERRUPT_SMI; + cpu_reset_interrupt(cpu, CPU_INTERRUPT_SMI); } } @@ -758,7 +758,7 @@ static void whpx_vcpu_pre_run(CPUState *cpu) vcpu->interruptable && (env->eflags & IF_MASK)) { assert(!new_int.InterruptionPending); if (cpu->interrupt_request & CPU_INTERRUPT_HARD) { - cpu->interrupt_request &= ~CPU_INTERRUPT_HARD; + cpu_reset_interrupt(cpu, CPU_INTERRUPT_HARD); irq = cpu_get_pic_interrupt(env); if (irq >= 0) { new_int.InterruptionType = WHvX64PendingInterrupt; @@ -850,7 +850,7 @@ static void whpx_vcpu_process_async_events(CPUState *cpu) } if (cpu->interrupt_request & CPU_INTERRUPT_POLL) { - cpu->interrupt_request &= ~CPU_INTERRUPT_POLL; + cpu_reset_interrupt(cpu, CPU_INTERRUPT_POLL); apic_poll_irq(x86_cpu->apic_state); } @@ -868,7 +868,7 @@ static void whpx_vcpu_process_async_events(CPUState *cpu) } if (cpu->interrupt_request & CPU_INTERRUPT_TPR) { - cpu->interrupt_request &= ~CPU_INTERRUPT_TPR; + cpu_reset_interrupt(cpu, CPU_INTERRUPT_TPR); if (!cpu->vcpu_dirty) { whpx_get_registers(cpu); } From patchwork Mon Sep 17 16:30:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 970681 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="LO2tYLA1"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="rJV1GcFq"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42DWqy34TLz9sfR for ; Tue, 18 Sep 2018 02:32:30 +1000 (AEST) Received: from localhost ([::1]:36436 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wRn-0006Y0-Ub for incoming@patchwork.ozlabs.org; Mon, 17 Sep 2018 12:32:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40791) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wQd-0006F4-NN for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1wQZ-0001ne-7g for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:15 -0400 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:56109) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g1wQY-0001cq-Tr for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:11 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id D1D2B502; Mon, 17 Sep 2018 12:31:05 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 17 Sep 2018 12:31:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=AJgd5Go66ZLYsG k8Ak66EUP/IuHxGLlMJ6pvA4HdhH4=; b=LO2tYLA1WX3VKYw0PBw3oteJR1ru8d d/5J6zEY0SS1ryN7WlklP7iVigJ8EE0wXlCP585Ndtn3htmKIvw3nE1+ih8JovDW k0Yr6XEC7hKCAC8hUvn6UNybnMie4DyAuidgKlyJ3t1IEiq/9gbqYyixuGUX9O7F N9evDYI3WQaV4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=AJgd5Go66ZLYsGk8Ak66EUP/IuHxGLlMJ6pvA4HdhH4=; b=rJV1GcFq xnGq6h0IsxVslLeaFda97Ya6Gg1708KRvrKlcMN5IUjbmNTAAwHXMdhh903a9606 OMRo6YfsLoJozvUsOCWXuM1LXwZaigppeCKfx9YucRiVhVxmsLeMoZhQyMChfA0+ 4n6qXC5AQi1QKkcRY2ZM1QGUDpfgKx67/g7kG8ewyReRmb6pzUOjPzhzfvEk5lN7 V7lvClZJcKXTPXRPNs/sFGd8wAFVSkHo5oWNK6DWW17EtKRe8GmrsNj/jf7BCenj Rwxwwwv8YRAGWAAaCNgcRuQyy7Vf0TkEkZ5vZpDps0LLU6HItPdTVGII4Ysz8VHB kcc8BaE7wB4h9g== X-ME-Proxy: X-ME-Sender: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 144F8E4A3C; Mon, 17 Sep 2018 12:31:05 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Mon, 17 Sep 2018 12:30:31 -0400 Message-Id: <20180917163103.6113-4-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180917163103.6113-1-cota@braap.org> References: <20180917163103.6113-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.147.123.25 Subject: [Qemu-devel] [PATCH 03/35] target/openrisc: use cpu_reset_interrupt X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Stafford Horne Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini It will be changed to an atomic operation soon. Cc: Stafford Horne Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota Reviewed-by: Philippe Mathieu-Daudé --- target/openrisc/sys_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/openrisc/sys_helper.c b/target/openrisc/sys_helper.c index b66a45c1e0..235334704d 100644 --- a/target/openrisc/sys_helper.c +++ b/target/openrisc/sys_helper.c @@ -170,7 +170,7 @@ void HELPER(mtspr)(CPUOpenRISCState *env, target_ulong spr, target_ulong rb) env->ttmr = (rb & ~TTMR_IP) | ip; } else { /* Clear IP bit. */ env->ttmr = rb & ~TTMR_IP; - cs->interrupt_request &= ~CPU_INTERRUPT_TIMER; + cpu_reset_interrupt(cs, CPU_INTERRUPT_TIMER); } cpu_openrisc_timer_update(cpu); From patchwork Mon Sep 17 16:30:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 970683 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="cOTGIxaQ"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="DbobH3tG"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42DWv45pGlz9sfR for ; Tue, 18 Sep 2018 02:35:12 +1000 (AEST) Received: from localhost ([::1]:36443 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wUP-0000Kz-Qb for incoming@patchwork.ozlabs.org; Mon, 17 Sep 2018 12:35:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40786) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wQd-0006F1-Mg for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1wQa-0001pb-9I for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:15 -0400 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:38695) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g1wQZ-0001nq-Uo; Mon, 17 Sep 2018 12:31:12 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 7B171508; Mon, 17 Sep 2018 12:31:06 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 17 Sep 2018 12:31:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=MVaSxkbjD7BEYT QqeDYJsvjGECziPt0UqIHwEIfRDzw=; b=cOTGIxaQP4Za9/3ZZUeJgE8wRcQXyu ewz0gOGgOsV47ooQyo+9H/j3QLpqfXrEqKArpw+BamIDb4bNm7V2+Ee4edfHDoD3 GAfEQKmWK74LKt4FdVBKECaaH6bvcjPvKoSIJuW2g1ajr88u+xOF4e0fDYzhHHDZ 8MOFycE+uLA3s= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=MVaSxkbjD7BEYTQqeDYJsvjGECziPt0UqIHwEIfRDzw=; b=DbobH3tG EjfmvJqVAL0g3ddG3+Rw5u1hgmhVhTrkQIRR77ERlK9bYUznikAJE5umNAGVYGiZ 6t+htnEWGPbYF6VmlWJgWEBA+0XOzQPfjbu03S3z7aH9sJqDE4UESefuY2z60CH3 NQgFFJ6QaFyugyDWWtTzroF/FHkhuuRPB/D9THh/lAsZb5zaKRCwXYcVEE40pjux /poRj3YlDs+WHiyMQSU38ZupOYr1gGjsIVLIjO+hR6sq3v88c33wLiLDK9KwrK6k OKoQm57BSCZRnBWHmQbFcesh4hJhYSBQGSFrV7zITYuIUjTcYoXjvNGsNVmaDA8s EJmpq0LAwA8q0w== X-ME-Proxy: X-ME-Sender: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 4EFA6E4A3E; Mon, 17 Sep 2018 12:31:05 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Mon, 17 Sep 2018 12:30:32 -0400 Message-Id: <20180917163103.6113-5-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180917163103.6113-1-cota@braap.org> References: <20180917163103.6113-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.147.123.25 Subject: [Qemu-devel] [PATCH 04/35] target/ppc: use cpu_reset_interrupt X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , qemu-ppc@nongnu.org, Alexander Graf , David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini It will be changed to an atomic operation soon. Cc: David Gibson Cc: Alexander Graf Cc: qemu-ppc@nongnu.org Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota Acked-by: David Gibson Reviewed-by: Philippe Mathieu-Daudé --- target/ppc/excp_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index 0ec7ae1ad4..6ffa762033 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -880,7 +880,7 @@ bool ppc_cpu_exec_interrupt(CPUState *cs, int interrupt_request) if (interrupt_request & CPU_INTERRUPT_HARD) { ppc_hw_interrupt(env); if (env->pending_interrupts == 0) { - cs->interrupt_request &= ~CPU_INTERRUPT_HARD; + cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD); } return true; } From patchwork Mon Sep 17 16:30:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 970679 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="hb6GGY7e"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="LHA6/cTI"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42DWqc00k5z9sj1 for ; Tue, 18 Sep 2018 02:32:10 +1000 (AEST) Received: from localhost ([::1]:36432 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wRQ-0006Gq-Lm for incoming@patchwork.ozlabs.org; Mon, 17 Sep 2018 12:32:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40762) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wQd-0006Et-7J for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1wQZ-0001nW-6q for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:15 -0400 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:35179) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g1wQY-0001gF-ST; Mon, 17 Sep 2018 12:31:11 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 5BAE94B5; Mon, 17 Sep 2018 12:31:06 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 17 Sep 2018 12:31:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=TO6Kdf+49clkBB IPIQ+vgLJmpFwu5e5TqYwYblOEhO8=; b=hb6GGY7e6+CjfWP5xsrLepWbi0vpPz t4oVeRfX+Eg6CrOA7zaY1K0idRIIvqt19/aZ1+4Opnl4IYyzlM59SxKtWZkEigvu Gitics+XOlGbQDBN0zUw49wRAnwTZLGfAZpR4Q65vgoheYcHSfY6cFhbz056fY62 na6cEVMRjm3Co= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=TO6Kdf+49clkBBIPIQ+vgLJmpFwu5e5TqYwYblOEhO8=; b=LHA6/cTI 4zWgZWUf3mmAukuPIi6iaqDIIlYgBpznC2VAR6SmswHrvt9DntftNU0rs8Wl5+iZ QisdBwVvRV1IADyhjgBcM2qetRjQwmVBjaRXSEpBiCR5d7rQ4ZKDSLd4JgxytcEN GvFbS+F5YAS75BSiyWdqq3Tu3WISEI9dMS5J0D79CPLMBeaaQ5H1eyJ87sGDytfq la7vgZYVanXyQNEtBBB/buPK1b0JttstrEtCrsNnABzutSTGRhZ/p6VypMNa5ckK f4cvrpB1LPwTMuPl4QMqGY39gvJvnFyl4MjTvIWKfUEGnNtdznLTJdX2XLMCDbFs VdPO63M9sYRheg== X-ME-Proxy: X-ME-Sender: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 88D94E4121; Mon, 17 Sep 2018 12:31:05 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Mon, 17 Sep 2018 12:30:33 -0400 Message-Id: <20180917163103.6113-6-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180917163103.6113-1-cota@braap.org> References: <20180917163103.6113-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.147.123.25 Subject: [Qemu-devel] [PATCH 05/35] target/s390x: use cpu_reset_interrupt X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Hildenbrand , Cornelia Huck , Alexander Graf , qemu-s390x@nongnu.org, Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini It will be changed to an atomic operation soon. Cc: Cornelia Huck Cc: Richard Henderson Cc: Alexander Graf Cc: David Hildenbrand Cc: qemu-s390x@nongnu.org Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota Reviewed-by: David Hildenbrand Reviewed-by: Richard Henderson Reviewed-by: Cornelia Huck --- target/s390x/excp_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/s390x/excp_helper.c b/target/s390x/excp_helper.c index f0ce60cff2..f2b92d7cbc 100644 --- a/target/s390x/excp_helper.c +++ b/target/s390x/excp_helper.c @@ -444,7 +444,7 @@ try_deliver: /* we might still have pending interrupts, but not deliverable */ if (!env->pending_int && !qemu_s390_flic_has_any(flic)) { - cs->interrupt_request &= ~CPU_INTERRUPT_HARD; + cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD); } /* WAIT PSW during interrupt injection or STOP interrupt */ From patchwork Mon Sep 17 16:30:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 970686 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="YCg1vCdj"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="Jdd+RUKk"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42DWvW5ysqz9sj1 for ; Tue, 18 Sep 2018 02:35:35 +1000 (AEST) Received: from localhost ([::1]:36450 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wUn-0000db-CE for incoming@patchwork.ozlabs.org; Mon, 17 Sep 2018 12:35:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40776) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wQd-0006Ex-KU for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1wQZ-0001o3-Bu for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:15 -0400 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:40741) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g1wQY-0001g1-Tu for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:11 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 93053512; Mon, 17 Sep 2018 12:31:06 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 17 Sep 2018 12:31:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=JBabSxVHZo0sKW Mj0NXIaz0/iVZEj/FkHB5EHoz7idY=; b=YCg1vCdjxwbT0gFFpZY9dY2XoE1+YD F8LrjZ0ZXXlgTVqKE//MpuWL1etpiTCu5lPqhMUFZYxLUHAXgjH0drNwWUwL8pnP hCSS7AJf0FHaQ7BYCki404OzrQkl8KWfj5KVBLn1iAAIlJaMQ96uS5Ya4Ehe68v6 h6PTpCXTBJHS8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=JBabSxVHZo0sKWMj0NXIaz0/iVZEj/FkHB5EHoz7idY=; b=Jdd+RUKk HBBC3fC2ldG53oQkPkIpSlLo/4CTNhA1SLdUiR7MlLvrQq3mtAvJxZtAw3CVurh+ 3kOHBi/PVrs8VH4BdGkvY1vaxayqK1Lu8OZn+mEl5esmhh4SLjMiZJcCZlxJiInz c04+SAzP/V6VAJQ+GEvvomktkAG4soBNoaTja7VLn5/2v8Gth+JNojqJjJVn87lf lR/fgqHuLodey9Wi9jiS+HdEHK8yPOjNErvk+qQuW+k3oTVhQC7fTKrtA7O2wv+A 2kD80QKgtaDkS70JKtdD11ogpCL/jT3tsRe/YsSKNuRtB2blSffkRREvZ+OzIn84 GEftUOntOFn3hw== X-ME-Proxy: X-ME-Sender: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id B54A4E49EC; Mon, 17 Sep 2018 12:31:05 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Mon, 17 Sep 2018 12:30:34 -0400 Message-Id: <20180917163103.6113-7-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180917163103.6113-1-cota@braap.org> References: <20180917163103.6113-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.147.123.25 Subject: [Qemu-devel] [PATCH 06/35] exec: use cpu_reset_interrupt X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson , Peter Crosthwaite Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini It will be changed to an atomic operation soon. Cc: Peter Crosthwaite Cc: Richard Henderson Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- accel/tcg/cpu-exec.c | 6 +++--- exec.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 6bcb6d99bd..7ca00725ec 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -533,7 +533,7 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, interrupt_request &= ~CPU_INTERRUPT_SSTEP_MASK; } if (interrupt_request & CPU_INTERRUPT_DEBUG) { - cpu->interrupt_request &= ~CPU_INTERRUPT_DEBUG; + cpu_reset_interrupt(cpu, CPU_INTERRUPT_DEBUG); cpu->exception_index = EXCP_DEBUG; qemu_mutex_unlock_iothread(); return true; @@ -542,7 +542,7 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, /* Do nothing */ } else if (interrupt_request & CPU_INTERRUPT_HALT) { replay_interrupt(); - cpu->interrupt_request &= ~CPU_INTERRUPT_HALT; + cpu_reset_interrupt(cpu, CPU_INTERRUPT_HALT); cpu->halted = 1; cpu->exception_index = EXCP_HLT; qemu_mutex_unlock_iothread(); @@ -582,7 +582,7 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, interrupt_request = cpu->interrupt_request; } if (interrupt_request & CPU_INTERRUPT_EXITTB) { - cpu->interrupt_request &= ~CPU_INTERRUPT_EXITTB; + cpu_reset_interrupt(cpu, CPU_INTERRUPT_EXITTB); /* ensure that no TB jump will be modified as the program flow was changed */ *last_tb = NULL; diff --git a/exec.c b/exec.c index 6826c8337d..0b8e2420cf 100644 --- a/exec.c +++ b/exec.c @@ -776,7 +776,7 @@ static int cpu_common_post_load(void *opaque, int version_id) /* 0x01 was CPU_INTERRUPT_EXIT. This line can be removed when the version_id is increased. */ - cpu->interrupt_request &= ~0x01; + cpu_reset_interrupt(cpu, 0x01); tlb_flush(cpu); /* loadvm has just updated the content of RAM, bypassing the From patchwork Mon Sep 17 16:30:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 970680 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="O3hAEQiY"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="pMonHU+Q"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42DWqn0HGpz9sj1 for ; Tue, 18 Sep 2018 02:32:21 +1000 (AEST) Received: from localhost ([::1]:36435 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wRb-0006NJ-Tj for incoming@patchwork.ozlabs.org; Mon, 17 Sep 2018 12:32:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40784) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wQd-0006F0-MA for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1wQa-0001pR-75 for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:15 -0400 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:40579) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g1wQZ-0001nr-TS for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:12 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id C84B4514; Mon, 17 Sep 2018 12:31:06 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 17 Sep 2018 12:31:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=vbZfZvB5enU7Rt KO0PXcZWYkk9A0VxabXx08KxB0lBs=; b=O3hAEQiYjwGcJ3xcu6ikJmhYpyTkBj TLp2RJZuF4S6Q1M44K433AwNHN/eAVQ5gB5wcKBQTL8RqM/hdkdpghKw+ED1+kqx 9KwqvG2IgaPYw5dZqABas79iY9PO3ioIM6ukzdDixqXMVgBdsqIbkLM7rnTdp1BF y8cS+yaSfSOuI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=vbZfZvB5enU7RtKO0PXcZWYkk9A0VxabXx08KxB0lBs=; b=pMonHU+Q GdcNZjIpct283f5S3GOexPSsKJ25T66XNHT1jlfhhParPCCAxw1I9hYyC2qZ+qoL xQZVNZq7ei6WEpq7N4Str+1rL8SHLlWirJh/O+uOtN+whCDPWFTbQQpU7wuQqv3Z FoajhQeHxYnTvh45tUNvJZag2OxEgIL2oSXFCUzPw2ZK2hqUs29gtEc3LUp9e5Pj uXJ4UjHf04Ss6eMxD693ymxe7J0Zngl6ZuYMNk+NIv03FDvPEcs4iSlg6FqizELP V2ZcRdZ9P5SIn0BifU1aOWVXnb4KAs4Ec5wDPkvQN00uJgyzwTb26QSzU4onsI04 OkXeIXpP/UBTyg== X-ME-Proxy: X-ME-Sender: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 0B955E49CB; Mon, 17 Sep 2018 12:31:06 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Mon, 17 Sep 2018 12:30:35 -0400 Message-Id: <20180917163103.6113-8-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180917163103.6113-1-cota@braap.org> References: <20180917163103.6113-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.147.123.25 Subject: [Qemu-devel] [PATCH 07/35] target/alpha: access cpu->interrupt_request with atomics X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Cc: Richard Henderson Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- target/alpha/cpu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c index b08078e7fc..76001e66f1 100644 --- a/target/alpha/cpu.c +++ b/target/alpha/cpu.c @@ -42,10 +42,10 @@ static bool alpha_cpu_has_work(CPUState *cs) assume that if a CPU really wants to stay asleep, it will mask interrupts at the chipset level, which will prevent these bits from being set in the first place. */ - return cs->interrupt_request & (CPU_INTERRUPT_HARD - | CPU_INTERRUPT_TIMER - | CPU_INTERRUPT_SMP - | CPU_INTERRUPT_MCHK); + return atomic_read(&cs->interrupt_request) & (CPU_INTERRUPT_HARD + | CPU_INTERRUPT_TIMER + | CPU_INTERRUPT_SMP + | CPU_INTERRUPT_MCHK); } static void alpha_cpu_disas_set_info(CPUState *cpu, disassemble_info *info) From patchwork Mon Sep 17 16:30:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 970704 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="EcUYugOe"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="py6Msk5K"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42DX5s6fmPz9sfR for ; Tue, 18 Sep 2018 02:44:33 +1000 (AEST) Received: from localhost ([::1]:36503 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wdT-0008WJ-7V for incoming@patchwork.ozlabs.org; Mon, 17 Sep 2018 12:44:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40911) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wQg-0006Gt-Ek for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1wQf-0001xg-EC for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:18 -0400 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:38503) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g1wQa-0001oA-C9; Mon, 17 Sep 2018 12:31:12 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id DFA04515; Mon, 17 Sep 2018 12:31:06 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 17 Sep 2018 12:31:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=BvVnBhDDR1H4DQ KVvA7EIqJq573VYzYS0LWQrB3mODc=; b=EcUYugOejbtorYL9I6EV3KVrzGvM6e ph0Te0J+HEgKmyc5r3Mr4yPa5EdbbKvGtJYnCpQjwhT7cpVBAPyqBmHbxNXzYqUZ Y3R0yrilRT+UrPBRTQmwYn4MPNMe68aIXKm5qqpOG4R7YYoOm1yZdOZ7tU6w9kQp 8KcQcEelWNeHc= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=BvVnBhDDR1H4DQKVvA7EIqJq573VYzYS0LWQrB3mODc=; b=py6Msk5K RFDfJ3MG1hpOibAYOnAQO68EU4s2FVGBJvf/kSlrWFKY9w+lFO1r26l8aFDdI4gB c/hayJP1/6jb0T23n6sYj1OAgo6n/siDlgnhggdpLLP6tgMTJyMdg4nrG/X90AvL 08V5L4kVaZ2PPtJrnSJEef3p5YcMKK6YT/fXMxnuwgsiIWSWbDuZvzfjISSfcnTB IncOB8sAQecWYe61Jwm0+C85bibinkWvBnk6pCvLM3qj8AcGjQp8h+SqfJD89AhE 0A6pTMG5uxllTcIl38slnkKYrtYG5OVwWNLeiPQGWwPAbYT6A+xhgSOXqnDa+7W9 G4RhNvJg4sb1lA== X-ME-Proxy: X-ME-Sender: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 3E074E49C5; Mon, 17 Sep 2018 12:31:06 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Mon, 17 Sep 2018 12:30:36 -0400 Message-Id: <20180917163103.6113-9-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180917163103.6113-1-cota@braap.org> References: <20180917163103.6113-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.147.123.25 Subject: [Qemu-devel] [PATCH 08/35] target/arm: access cpu->interrupt_request with atomics X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , qemu-arm@nongnu.org, Peter Maydell Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Cc: Peter Maydell Cc: qemu-arm@nongnu.org Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota --- target/arm/cpu.c | 2 +- target/arm/helper.c | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 258ba6dcaa..e2c492efdf 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -49,7 +49,7 @@ static bool arm_cpu_has_work(CPUState *cs) ARMCPU *cpu = ARM_CPU(cs); return (cpu->power_state != PSCI_OFF) - && cs->interrupt_request & + && atomic_read(&cs->interrupt_request) & (CPU_INTERRUPT_FIQ | CPU_INTERRUPT_HARD | CPU_INTERRUPT_VFIQ | CPU_INTERRUPT_VIRQ | CPU_INTERRUPT_EXITTB); diff --git a/target/arm/helper.c b/target/arm/helper.c index 088f452716..22dbc42305 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -1293,12 +1293,13 @@ static void csselr_write(CPUARMState *env, const ARMCPRegInfo *ri, static uint64_t isr_read(CPUARMState *env, const ARMCPRegInfo *ri) { CPUState *cs = ENV_GET_CPU(env); + int interrupt_request = atomic_read(&cs->interrupt_request); uint64_t ret = 0; - if (cs->interrupt_request & CPU_INTERRUPT_HARD) { + if (interrupt_request & CPU_INTERRUPT_HARD) { ret |= CPSR_I; } - if (cs->interrupt_request & CPU_INTERRUPT_FIQ) { + if (interrupt_request & CPU_INTERRUPT_FIQ) { ret |= CPSR_F; } /* External aborts are not possible in QEMU so A bit is always clear */ @@ -8514,10 +8515,7 @@ void arm_cpu_do_interrupt(CPUState *cs) return; } - /* Hooks may change global state so BQL should be held, also the - * BQL needs to be held for any modification of - * cs->interrupt_request. - */ + /* Hooks may change global state so BQL should be held */ g_assert(qemu_mutex_iothread_locked()); arm_call_pre_el_change_hook(cpu); @@ -8532,7 +8530,7 @@ void arm_cpu_do_interrupt(CPUState *cs) arm_call_el_change_hook(cpu); if (!kvm_enabled()) { - cs->interrupt_request |= CPU_INTERRUPT_EXITTB; + atomic_or(&cs->interrupt_request, CPU_INTERRUPT_EXITTB); } } From patchwork Mon Sep 17 16:30:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 970684 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="IJWG85EU"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="jE8/oXQv"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42DWvR5d3Xz9sfR for ; Tue, 18 Sep 2018 02:35:31 +1000 (AEST) Received: from localhost ([::1]:36448 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wUj-0000aO-7H for incoming@patchwork.ozlabs.org; Mon, 17 Sep 2018 12:35:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40775) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wQd-0006Ew-K4 for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1wQa-0001pz-D8 for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:15 -0400 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:50483) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g1wQZ-0001ny-VM for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:12 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 2A27851F; Mon, 17 Sep 2018 12:31:07 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 17 Sep 2018 12:31:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=F3irTa7brhI8q+ 9QcI382em+dIAs5jC3T7t2dZ0jjIw=; b=IJWG85EU9Fi7lfGcB+ep1mO1unbx3B v7XFM2qcl4kMOm2Mv0KbdEGE4uIs+BGOdH0R5LCDUkIasm6bfn3ZCRB5moFPUBUS lNFeiAUONfP+EIfVbyLbn6yeqwuTlmSjHWDErVhbOflZDOnq6XOrivDNPE6sejLF 5ID/NNRAJD7UY= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=F3irTa7brhI8q+9QcI382em+dIAs5jC3T7t2dZ0jjIw=; b=jE8/oXQv AcvY3ipF6rHC6Lk9cO6qWnGFG+PfiHaICYdwxMfLjQzuTOyyjQDnNCAVh9vmI+1y fJc7uf1OO4CNhCfTPsfKXfbo6Dfs9Ecb4wI7J4lMBNV5JTWlSBfPMagn9FKpU3cX A2SJD6xX9sMQCems0336vgmqCSn0yywZdFV9RG+iwvx1/sKead9Mm1+jY9iP6wcz rdyMobA4sZFiCHVJcwCxJUzGHv4hMWrpksAvDOeheGxtDr0nZYlv0Bgsp6vvlR2b YU+6NO6IpR0r12MhIjfZBQ6BmeBqoz25EwAb/dBeME3S50bDkzgH6S2YSwXBvO8F g4itrgda9FQ3CA== X-ME-Proxy: X-ME-Sender: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 741B1E4A40; Mon, 17 Sep 2018 12:31:06 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Mon, 17 Sep 2018 12:30:37 -0400 Message-Id: <20180917163103.6113-10-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180917163103.6113-1-cota@braap.org> References: <20180917163103.6113-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.147.123.25 Subject: [Qemu-devel] [PATCH 09/35] target/cris: access cpu->interrupt_request with atomics X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , "Edgar E. Iglesias" Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Cc: "Edgar E. Iglesias" Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota Reviewed-by: Philippe Mathieu-Daudé --- target/cris/cpu.c | 3 ++- target/cris/helper.c | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/target/cris/cpu.c b/target/cris/cpu.c index a23aba2688..849e4718ba 100644 --- a/target/cris/cpu.c +++ b/target/cris/cpu.c @@ -37,7 +37,8 @@ static void cris_cpu_set_pc(CPUState *cs, vaddr value) static bool cris_cpu_has_work(CPUState *cs) { - return cs->interrupt_request & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_NMI); + return atomic_read(&cs->interrupt_request) & (CPU_INTERRUPT_HARD | + CPU_INTERRUPT_NMI); } /* CPUClass::reset() */ diff --git a/target/cris/helper.c b/target/cris/helper.c index d2ec349191..15bad34d44 100644 --- a/target/cris/helper.c +++ b/target/cris/helper.c @@ -116,8 +116,8 @@ int cris_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int size, int rw, if (r > 0) { qemu_log_mask(CPU_LOG_MMU, "%s returns %d irqreq=%x addr=%" VADDR_PRIx " phy=%x vec=%x" - " pc=%x\n", __func__, r, cs->interrupt_request, address, - res.phy, res.bf_vec, env->pc); + " pc=%x\n", __func__, r, atomic_read(&cs->interrupt_request), + address, res.phy, res.bf_vec, env->pc); } return r; } @@ -130,7 +130,7 @@ void crisv10_cpu_do_interrupt(CPUState *cs) D_LOG("exception index=%d interrupt_req=%d\n", cs->exception_index, - cs->interrupt_request); + atomic_read(&cs->interrupt_request)); if (env->dslot) { /* CRISv10 never takes interrupts while in a delay-slot. */ @@ -192,7 +192,7 @@ void cris_cpu_do_interrupt(CPUState *cs) D_LOG("exception index=%d interrupt_req=%d\n", cs->exception_index, - cs->interrupt_request); + atomic_read(&cs->interrupt_request)); switch (cs->exception_index) { case EXCP_BREAK: From patchwork Mon Sep 17 16:30:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 970692 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="t4RdqUZs"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="ZvSJozdY"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42DWyt55btz9sj1 for ; Tue, 18 Sep 2018 02:38:30 +1000 (AEST) Received: from localhost ([::1]:36469 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wXc-0003e5-4K for incoming@patchwork.ozlabs.org; Mon, 17 Sep 2018 12:38:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40790) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wQd-0006F3-NL for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1wQa-0001q5-Eh for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:15 -0400 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:53219) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g1wQa-0001oI-5r for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:12 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 727BC523; Mon, 17 Sep 2018 12:31:07 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 17 Sep 2018 12:31:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=JFvlIgEjSqequA akN8KxLS+0DpR/HCBNCXu+BYn9s8U=; b=t4RdqUZszbPofp8F5bEviXy7Yf50gJ 03GbrHOWvqsi1pmRp34UU7J7fWTmRJHH4e4UT5gRxbBedCOlBzVk3pHb2wRirsJ4 hytcUJMAngm/uNj9hxfzrlkafZzQxnIdJkCsASzMVSvnHW0oZJzIUgJItW0lFLvw HRgvFbkd0QH0A= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=JFvlIgEjSqequAakN8KxLS+0DpR/HCBNCXu+BYn9s8U=; b=ZvSJozdY LUJFbZSzcQKbhcr9Vrj0Uj6Rau661qR2olEslAm6eD7teOHthi3tjWcdRCmDvZAa YR7/a0R9YCCc8pHjaAS79bP1gRp+wQtvHXZQySF3OrVZwpqJb/fUlYpc0QUkQyF8 WNdAjquYFwWR17u2RFcg/O4LeCruvdpLfcNDGWYtVjvYaQV00yV4wgTTJLvX8uxL 2o+jyfyX02KZd4dP2ZXad45c6nS8ySisg7KeQVVZObDvO7HoIUWwHI1Bchm04Mxy 2RcawEt8nsiNk8GaB1VdM7Ob49ubCnHAq1w7HWjfjgZSpu49yKtQkS9IxtvdApWE Ah7t0xAGT6bCKQ== X-ME-Proxy: X-ME-Sender: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id B041DE49F7; Mon, 17 Sep 2018 12:31:06 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Mon, 17 Sep 2018 12:30:38 -0400 Message-Id: <20180917163103.6113-11-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180917163103.6113-1-cota@braap.org> References: <20180917163103.6113-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.147.123.25 Subject: [Qemu-devel] [PATCH 10/35] target/hppa: access cpu->interrupt_request with atomics X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Cc: Richard Henderson Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- target/hppa/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c index 00bf444620..fe10c1a86a 100644 --- a/target/hppa/cpu.c +++ b/target/hppa/cpu.c @@ -60,7 +60,7 @@ static void hppa_cpu_synchronize_from_tb(CPUState *cs, TranslationBlock *tb) static bool hppa_cpu_has_work(CPUState *cs) { - return cs->interrupt_request & CPU_INTERRUPT_HARD; + return atomic_read(&cs->interrupt_request) & CPU_INTERRUPT_HARD; } static void hppa_cpu_disas_set_info(CPUState *cs, disassemble_info *info) From patchwork Mon Sep 17 16:30:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 970693 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="VahaF3tc"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="uWWfdYN+"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42DWyx56lWz9sfR for ; Tue, 18 Sep 2018 02:38:33 +1000 (AEST) Received: from localhost ([::1]:36470 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wXf-0003gh-60 for incoming@patchwork.ozlabs.org; Mon, 17 Sep 2018 12:38:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40774) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wQd-0006Ev-KN for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1wQa-0001qW-MS for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:15 -0400 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:37221) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g1wQa-0001oK-BF for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:12 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id C903E528; Mon, 17 Sep 2018 12:31:07 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 17 Sep 2018 12:31:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=j9hsvzJFhqu1t3 56MXvX9tNnQpyp4xtxgE7CAt6NnmQ=; b=VahaF3tcAbej1qDWlkJqsmieiTtJqf tD3oS0WhBmLF6akG2LUsQEmz8YPQCIaCCulG0prSwnb4IpfcfMNC890icX4ho6qz 0EEWLKeiP379QDhw+vxwsoyjQz+NxohC/VkqP/3CvVLTBTFisWsVUZIm9pxHguDD bpACsEoLw9NXw= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=j9hsvzJFhqu1t356MXvX9tNnQpyp4xtxgE7CAt6NnmQ=; b=uWWfdYN+ YLZbRs34dG+4wjuNxup3osL2wEbJ0CUbHIUCnHphVPevJu0RfOT7+kC+L5gmw8dU XXoDMfDD3VPrGZC7ElztI/WuKMQl8FwMY6UW0XqavSnYIMpB6Qzd2T2BgLts69TH rzf4TMm3/AfH/7TqfmxBtCT4dVySCQjqNFxnPLLNUINu2ozPaIvhwdfkkkA/Yqfw KG5keK+iAdh8O94otHggG0qhYbTPeoUr36uowV37H1/fluA2XPBWI+I6MUBKQsbz nvhKcP2TZJZF4l0ATO4jG1WRd/1K/K16toAgNseHBbZXWn/S/POoYKM/WwFoAePF m8+OTubONaTn7g== X-ME-Proxy: X-ME-Sender: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id EC53DE4A42; Mon, 17 Sep 2018 12:31:06 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Mon, 17 Sep 2018 12:30:39 -0400 Message-Id: <20180917163103.6113-12-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180917163103.6113-1-cota@braap.org> References: <20180917163103.6113-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.147.123.25 Subject: [Qemu-devel] [PATCH 11/35] target/i386: access cpu->interrupt_request with atomics X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Marcelo Tosatti , Eduardo Habkost , kvm@vger.kernel.org, Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Cc: Richard Henderson Cc: Eduardo Habkost Cc: Marcelo Tosatti Cc: kvm@vger.kernel.org Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota --- target/i386/cpu.c | 7 ++++--- target/i386/helper.c | 4 ++-- target/i386/kvm.c | 44 +++++++++++++++++++++++----------------- target/i386/svm_helper.c | 4 ++-- 4 files changed, 33 insertions(+), 26 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index f24295e6e4..f98e6e4318 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -5433,15 +5433,16 @@ static bool x86_cpu_has_work(CPUState *cs) { X86CPU *cpu = X86_CPU(cs); CPUX86State *env = &cpu->env; + int interrupt_request = atomic_read(&cs->interrupt_request); - return ((cs->interrupt_request & (CPU_INTERRUPT_HARD | + return ((interrupt_request & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_POLL)) && (env->eflags & IF_MASK)) || - (cs->interrupt_request & (CPU_INTERRUPT_NMI | + (interrupt_request & (CPU_INTERRUPT_NMI | CPU_INTERRUPT_INIT | CPU_INTERRUPT_SIPI | CPU_INTERRUPT_MCE)) || - ((cs->interrupt_request & CPU_INTERRUPT_SMI) && + ((interrupt_request & CPU_INTERRUPT_SMI) && !(env->hflags & HF_SMM_MASK)); } diff --git a/target/i386/helper.c b/target/i386/helper.c index e695f8ba7a..ee9f24d853 100644 --- a/target/i386/helper.c +++ b/target/i386/helper.c @@ -1035,12 +1035,12 @@ void do_cpu_init(X86CPU *cpu) CPUState *cs = CPU(cpu); CPUX86State *env = &cpu->env; CPUX86State *save = g_new(CPUX86State, 1); - int sipi = cs->interrupt_request & CPU_INTERRUPT_SIPI; + int sipi = atomic_read(&cs->interrupt_request) & CPU_INTERRUPT_SIPI; *save = *env; cpu_reset(cs); - cs->interrupt_request = sipi; + atomic_mb_set(&cs->interrupt_request, sipi); memcpy(&env->start_init_save, &save->start_init_save, offsetof(CPUX86State, end_init_save) - offsetof(CPUX86State, start_init_save)); diff --git a/target/i386/kvm.c b/target/i386/kvm.c index 5dd66809b0..e40c8d5461 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -2707,8 +2707,10 @@ static int kvm_put_vcpu_events(X86CPU *cpu, int level) /* As soon as these are moved to the kernel, remove them * from cs->interrupt_request. */ - events.smi.pending = cs->interrupt_request & CPU_INTERRUPT_SMI; - events.smi.latched_init = cs->interrupt_request & CPU_INTERRUPT_INIT; + uint32_t interrupt_request = atomic_read(&cs->interrupt_request); + + events.smi.pending = interrupt_request & CPU_INTERRUPT_SMI; + events.smi.latched_init = interrupt_request & CPU_INTERRUPT_INIT; cpu_reset_interrupt(cs, CPU_INTERRUPT_INIT | CPU_INTERRUPT_SMI); } else { /* Keep these in cs->interrupt_request. */ @@ -2999,11 +3001,12 @@ void kvm_arch_pre_run(CPUState *cpu, struct kvm_run *run) { X86CPU *x86_cpu = X86_CPU(cpu); CPUX86State *env = &x86_cpu->env; + int interrupt_request = atomic_read(&cpu->interrupt_request); int ret; /* Inject NMI */ - if (cpu->interrupt_request & (CPU_INTERRUPT_NMI | CPU_INTERRUPT_SMI)) { - if (cpu->interrupt_request & CPU_INTERRUPT_NMI) { + if (interrupt_request & (CPU_INTERRUPT_NMI | CPU_INTERRUPT_SMI)) { + if (interrupt_request & CPU_INTERRUPT_NMI) { qemu_mutex_lock_iothread(); cpu_reset_interrupt(cpu, CPU_INTERRUPT_NMI); qemu_mutex_unlock_iothread(); @@ -3014,7 +3017,7 @@ void kvm_arch_pre_run(CPUState *cpu, struct kvm_run *run) strerror(-ret)); } } - if (cpu->interrupt_request & CPU_INTERRUPT_SMI) { + if (atomic_read(&cpu->interrupt_request) & CPU_INTERRUPT_SMI) { qemu_mutex_lock_iothread(); cpu_reset_interrupt(cpu, CPU_INTERRUPT_SMI); qemu_mutex_unlock_iothread(); @@ -3035,12 +3038,12 @@ void kvm_arch_pre_run(CPUState *cpu, struct kvm_run *run) * or (for userspace APIC, but it is cheap to combine the checks here) * pending TPR access reports. */ - if (cpu->interrupt_request & (CPU_INTERRUPT_INIT | CPU_INTERRUPT_TPR)) { - if ((cpu->interrupt_request & CPU_INTERRUPT_INIT) && + if (interrupt_request & (CPU_INTERRUPT_INIT | CPU_INTERRUPT_TPR)) { + if ((interrupt_request & CPU_INTERRUPT_INIT) && !(env->hflags & HF_SMM_MASK)) { cpu->exit_request = 1; } - if (cpu->interrupt_request & CPU_INTERRUPT_TPR) { + if (interrupt_request & CPU_INTERRUPT_TPR) { cpu->exit_request = 1; } } @@ -3048,11 +3051,12 @@ void kvm_arch_pre_run(CPUState *cpu, struct kvm_run *run) if (!kvm_pic_in_kernel()) { /* Try to inject an interrupt if the guest can accept it */ if (run->ready_for_interrupt_injection && - (cpu->interrupt_request & CPU_INTERRUPT_HARD) && + (interrupt_request & CPU_INTERRUPT_HARD) && (env->eflags & IF_MASK)) { int irq; cpu_reset_interrupt(cpu, CPU_INTERRUPT_HARD); + interrupt_request &= ~CPU_INTERRUPT_HARD; irq = cpu_get_pic_interrupt(env); if (irq >= 0) { struct kvm_interrupt intr; @@ -3072,7 +3076,7 @@ void kvm_arch_pre_run(CPUState *cpu, struct kvm_run *run) * interrupt, request an interrupt window exit. This will * cause a return to userspace as soon as the guest is ready to * receive interrupts. */ - if ((cpu->interrupt_request & CPU_INTERRUPT_HARD)) { + if (interrupt_request & CPU_INTERRUPT_HARD) { run->request_interrupt_window = 1; } else { run->request_interrupt_window = 0; @@ -3118,8 +3122,9 @@ int kvm_arch_process_async_events(CPUState *cs) { X86CPU *cpu = X86_CPU(cs); CPUX86State *env = &cpu->env; + int interrupt_request = atomic_read(&cs->interrupt_request); - if (cs->interrupt_request & CPU_INTERRUPT_MCE) { + if (interrupt_request & CPU_INTERRUPT_MCE) { /* We must not raise CPU_INTERRUPT_MCE if it's not supported. */ assert(env->mcg_cap); @@ -3142,7 +3147,7 @@ int kvm_arch_process_async_events(CPUState *cs) } } - if ((cs->interrupt_request & CPU_INTERRUPT_INIT) && + if ((interrupt_request & CPU_INTERRUPT_INIT) && !(env->hflags & HF_SMM_MASK)) { kvm_cpu_synchronize_state(cs); do_cpu_init(cpu); @@ -3152,20 +3157,20 @@ int kvm_arch_process_async_events(CPUState *cs) return 0; } - if (cs->interrupt_request & CPU_INTERRUPT_POLL) { + if (interrupt_request & CPU_INTERRUPT_POLL) { cpu_reset_interrupt(cs, CPU_INTERRUPT_POLL); apic_poll_irq(cpu->apic_state); } - if (((cs->interrupt_request & CPU_INTERRUPT_HARD) && + if (((interrupt_request & CPU_INTERRUPT_HARD) && (env->eflags & IF_MASK)) || - (cs->interrupt_request & CPU_INTERRUPT_NMI)) { + (interrupt_request & CPU_INTERRUPT_NMI)) { cs->halted = 0; } - if (cs->interrupt_request & CPU_INTERRUPT_SIPI) { + if (interrupt_request & CPU_INTERRUPT_SIPI) { kvm_cpu_synchronize_state(cs); do_cpu_sipi(cpu); } - if (cs->interrupt_request & CPU_INTERRUPT_TPR) { + if (interrupt_request & CPU_INTERRUPT_TPR) { cpu_reset_interrupt(cs, CPU_INTERRUPT_TPR); kvm_cpu_synchronize_state(cs); apic_handle_tpr_access_report(cpu->apic_state, env->eip, @@ -3179,10 +3184,11 @@ static int kvm_handle_halt(X86CPU *cpu) { CPUState *cs = CPU(cpu); CPUX86State *env = &cpu->env; + int interrupt_request = atomic_read(&cs->interrupt_request); - if (!((cs->interrupt_request & CPU_INTERRUPT_HARD) && + if (!((interrupt_request & CPU_INTERRUPT_HARD) && (env->eflags & IF_MASK)) && - !(cs->interrupt_request & CPU_INTERRUPT_NMI)) { + !(interrupt_request & CPU_INTERRUPT_NMI)) { cs->halted = 1; return EXCP_HLT; } diff --git a/target/i386/svm_helper.c b/target/i386/svm_helper.c index c532639574..e18e53c869 100644 --- a/target/i386/svm_helper.c +++ b/target/i386/svm_helper.c @@ -316,7 +316,7 @@ void helper_vmrun(CPUX86State *env, int aflag, int next_eip_addend) if (int_ctl & V_IRQ_MASK) { CPUState *cs = CPU(x86_env_get_cpu(env)); - cs->interrupt_request |= CPU_INTERRUPT_VIRQ; + atomic_or(&cs->interrupt_request, CPU_INTERRUPT_VIRQ); } /* maybe we need to inject an event */ @@ -674,7 +674,7 @@ void do_vmexit(CPUX86State *env, uint32_t exit_code, uint64_t exit_info_1) env->vm_vmcb + offsetof(struct vmcb, control.int_ctl)); int_ctl &= ~(V_TPR_MASK | V_IRQ_MASK); int_ctl |= env->v_tpr & V_TPR_MASK; - if (cs->interrupt_request & CPU_INTERRUPT_VIRQ) { + if (atomic_read(&cs->interrupt_request) & CPU_INTERRUPT_VIRQ) { int_ctl |= V_IRQ_MASK; } x86_stl_phys(cs, From patchwork Mon Sep 17 16:30:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 970717 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="bonpgmBe"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="C6R4xAkY"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42DXFW3xqwz9sfR for ; Tue, 18 Sep 2018 02:51:11 +1000 (AEST) Received: from localhost ([::1]:36548 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wjt-0005xq-5U for incoming@patchwork.ozlabs.org; Mon, 17 Sep 2018 12:51:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41135) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wQo-0006Qu-St for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1wQk-00027e-Hz for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:26 -0400 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:37671) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g1wQk-0001oO-5V for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:22 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id EF06752D; Mon, 17 Sep 2018 12:31:07 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 17 Sep 2018 12:31:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=R6YkdbRBWNDYxq +xQ7yYzUncIUlNaMbqKET0rSKULMk=; b=bonpgmBepQzKBKCQua/8/xR/43kF+H RBJBTcdteXelGT/pQ+ez74Mea1+9Il7LPWmmjKHZgoP+wNHmDLFj7Z4DUuRk08OO +zuWr/zCkzPAzoYtdWIcv9unt8kz4sLq09Fc4LnhKSYGptITsVp+MQx1dCZJO1gJ aX6UYNXUFfdaA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=R6YkdbRBWNDYxq+xQ7yYzUncIUlNaMbqKET0rSKULMk=; b=C6R4xAkY ZMeOmzqlgpq9O3VxKdWgM9qei9hJSkPUi8I1ZDZvj2yGs29lTwohsZinQpCONMQy hc6PH9mtDzc5WL19iwtxX3wTbnYr+KpUuv7jSbx9muHwQmfWdr+L2S0OvTaJsha5 nV76a5To+27fZpL3FiGnfOIrDdkGO+62on5gF3Ix8wkqb3LWAcGt94K7VeJ9mB+T KqFmBCbcBRhma/bSknPJoC1X02d7OHgahIWbJt1IXPPCZkzFMb54qCF3LjOVwAct 0vY+GISXG8p7JURrE98cdmDKOYVqV0MvlIy83vRgqqk4CxvwuKUXPfn0eg+Vxatg 9vUFjLFK82RPBA== X-ME-Proxy: X-ME-Sender: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 368D2E414C; Mon, 17 Sep 2018 12:31:07 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Mon, 17 Sep 2018 12:30:40 -0400 Message-Id: <20180917163103.6113-13-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180917163103.6113-1-cota@braap.org> References: <20180917163103.6113-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.147.123.25 Subject: [Qemu-devel] [PATCH 12/35] hax: access cpu->interrupt_request with atomics X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Eduardo Habkost , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" I am not familiar with hax, so I opted for the safe (and slow) route of performing probably many unnecessary atomic_reads. Cc: Richard Henderson Cc: Eduardo Habkost Signed-off-by: Emilio G. Cota Reviewed-by: Philippe Mathieu-Daudé --- target/i386/hax-all.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/target/i386/hax-all.c b/target/i386/hax-all.c index ae8b678db0..56f999d5ba 100644 --- a/target/i386/hax-all.c +++ b/target/i386/hax-all.c @@ -293,7 +293,7 @@ int hax_vm_destroy(struct hax_vm *vm) static void hax_handle_interrupt(CPUState *cpu, int mask) { - cpu->interrupt_request |= mask; + atomic_or(&cpu->interrupt_request, mask); if (!qemu_cpu_is_self(cpu)) { qemu_cpu_kick(cpu); @@ -427,7 +427,7 @@ static int hax_vcpu_interrupt(CPUArchState *env) * Unlike KVM, HAX kernel check for the eflags, instead of qemu */ if (ht->ready_for_interrupt_injection && - (cpu->interrupt_request & CPU_INTERRUPT_HARD)) { + (atomic_read(&cpu->interrupt_request) & CPU_INTERRUPT_HARD)) { int irq; irq = cpu_get_pic_interrupt(env); @@ -441,7 +441,7 @@ static int hax_vcpu_interrupt(CPUArchState *env) * interrupt, request an interrupt window exit. This will * cause a return to userspace as soon as the guest is ready to * receive interrupts. */ - if ((cpu->interrupt_request & CPU_INTERRUPT_HARD)) { + if (atomic_read(&cpu->interrupt_request) & CPU_INTERRUPT_HARD) { ht->request_interrupt_window = 1; } else { ht->request_interrupt_window = 0; @@ -482,19 +482,19 @@ static int hax_vcpu_hax_exec(CPUArchState *env) cpu->halted = 0; - if (cpu->interrupt_request & CPU_INTERRUPT_POLL) { + if (atomic_read(&cpu->interrupt_request) & CPU_INTERRUPT_POLL) { cpu_reset_interrupt(cpu, CPU_INTERRUPT_POLL); apic_poll_irq(x86_cpu->apic_state); } - if (cpu->interrupt_request & CPU_INTERRUPT_INIT) { + if (atomic_read(&cpu->interrupt_request) & CPU_INTERRUPT_INIT) { DPRINTF("\nhax_vcpu_hax_exec: handling INIT for %d\n", cpu->cpu_index); do_cpu_init(x86_cpu); hax_vcpu_sync_state(env, 1); } - if (cpu->interrupt_request & CPU_INTERRUPT_SIPI) { + if (atomic_read(&cpu->interrupt_request) & CPU_INTERRUPT_SIPI) { DPRINTF("hax_vcpu_hax_exec: handling SIPI for %d\n", cpu->cpu_index); hax_vcpu_sync_state(env, 0); @@ -503,6 +503,7 @@ static int hax_vcpu_hax_exec(CPUArchState *env) } do { + int interrupt_request; int hax_ret; if (cpu->exit_request) { @@ -553,8 +554,9 @@ static int hax_vcpu_hax_exec(CPUArchState *env) ret = -1; break; case HAX_EXIT_HLT: - if (!(cpu->interrupt_request & CPU_INTERRUPT_HARD) && - !(cpu->interrupt_request & CPU_INTERRUPT_NMI)) { + interrupt_request = atomic_read(&cpu->interrupt_request); + if (!(interrupt_request & CPU_INTERRUPT_HARD) && + !(interrupt_request & CPU_INTERRUPT_NMI)) { /* hlt instruction with interrupt disabled is shutdown */ env->eflags |= IF_MASK; cpu->halted = 1; From patchwork Mon Sep 17 16:30:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 970699 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="1e4NqkKX"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="BZwnsInE"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42DX3T6mWsz9sj1 for ; Tue, 18 Sep 2018 02:42:29 +1000 (AEST) Received: from localhost ([::1]:36494 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wbT-0006t6-Hu for incoming@patchwork.ozlabs.org; Mon, 17 Sep 2018 12:42:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41120) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wQo-0006Ql-RY for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1wQk-00027P-H2 for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:26 -0400 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:51257) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g1wQk-0001oQ-4W for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:22 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 450D7532; Mon, 17 Sep 2018 12:31:08 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 17 Sep 2018 12:31:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=U6zrKwsml3kRM+ sHAHK8IYvaKDshpBeSaAPubp6v8GE=; b=1e4NqkKXsxTB1aTf2pCePpRiDnKNks uswP+ZCKoHmaGtGoYAU6eSESFC0OggtCL0H5f1vk3YjlhOpD8NUBYKcDysmUgY1W XpvtvTxtRgZ2CK7Ynd5FVvYQdbSGSe0HUCfMY0R6GBijw/g+m59lhYfMIkwutTH7 w1cIJdGhr6Cq0= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=U6zrKwsml3kRM+sHAHK8IYvaKDshpBeSaAPubp6v8GE=; b=BZwnsInE wkBfPirBhuRYUVOjBlSosYAUMUzSnAqRW9KXjM15r/DhhCcUKOuS51J64w91fUAX vguQxKziUoPDxIGjZE1RwUimv9Q0a21qb/WxrOIh+aAQmHJhH33DX+zY87QMGb1s xpfMk+7lThChKJ6briOiyqCaObh2gO+/dKJO0gsEjLuSMlqdsPO1jdcBdJc9aIO7 I2hBXBvgHmC4lb/qYdNoVvuxuFf8n5gI6CxfofWQuQKwHC5l7LhayPJfus4j29y2 bto/XI1XYlUCZrem6LgRhlhj7l4saP8IEa3aC+K2lAZLU+SaLsqpPLG9ZCWKSVkM 8hzkJB79dEW1Xw== X-ME-Proxy: X-ME-Sender: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 77771E49C5; Mon, 17 Sep 2018 12:31:07 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Mon, 17 Sep 2018 12:30:41 -0400 Message-Id: <20180917163103.6113-14-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180917163103.6113-1-cota@braap.org> References: <20180917163103.6113-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.147.123.25 Subject: [Qemu-devel] [PATCH 13/35] hvf: access cpu->interrupt_request with atomics X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Eduardo Habkost , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" I am not familiar with hvf, so I opted for the safe (and slow) route of performing probably many unnecessary atomic_reads. Cc: Richard Henderson Cc: Eduardo Habkost Signed-off-by: Emilio G. Cota --- target/i386/hvf/hvf.c | 7 ++++--- target/i386/hvf/x86hvf.c | 22 +++++++++++----------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c index df69e6d0a7..9c49d3c318 100644 --- a/target/i386/hvf/hvf.c +++ b/target/i386/hvf/hvf.c @@ -251,7 +251,7 @@ void update_apic_tpr(CPUState *cpu) static void hvf_handle_interrupt(CPUState * cpu, int mask) { - cpu->interrupt_request |= mask; + atomic_or(&cpu->interrupt_request, mask); if (!qemu_cpu_is_self(cpu)) { qemu_cpu_kick(cpu); } @@ -713,10 +713,11 @@ int hvf_vcpu_exec(CPUState *cpu) ret = 0; switch (exit_reason) { case EXIT_REASON_HLT: { + int interrupt_request = atomic_read(&cpu->interrupt_request); macvm_set_rip(cpu, rip + ins_len); - if (!((cpu->interrupt_request & CPU_INTERRUPT_HARD) && + if (!((interrupt_request & CPU_INTERRUPT_HARD) && (EFLAGS(env) & IF_MASK)) - && !(cpu->interrupt_request & CPU_INTERRUPT_NMI) && + && !(interrupt_request & CPU_INTERRUPT_NMI) && !(idtvec_info & VMCS_IDT_VEC_VALID)) { cpu->halted = 1; ret = EXCP_HLT; diff --git a/target/i386/hvf/x86hvf.c b/target/i386/hvf/x86hvf.c index 3ac796b885..878714b99c 100644 --- a/target/i386/hvf/x86hvf.c +++ b/target/i386/hvf/x86hvf.c @@ -400,7 +400,7 @@ bool hvf_inject_interrupts(CPUState *cpu_state) }; } - if (cpu_state->interrupt_request & CPU_INTERRUPT_NMI) { + if (atomic_read(&cpu_state->interrupt_request) & CPU_INTERRUPT_NMI) { if (!(env->hflags2 & HF2_NMI_MASK) && !(info & VMCS_INTR_VALID)) { cpu_reset_interrupt(cpu_state, CPU_INTERRUPT_NMI); info = VMCS_INTR_VALID | VMCS_INTR_T_NMI | NMI_VEC; @@ -411,7 +411,7 @@ bool hvf_inject_interrupts(CPUState *cpu_state) } if (!(env->hflags & HF_INHIBIT_IRQ_MASK) && - (cpu_state->interrupt_request & CPU_INTERRUPT_HARD) && + (atomic_read(&cpu_state->interrupt_request) & CPU_INTERRUPT_HARD) && (EFLAGS(env) & IF_MASK) && !(info & VMCS_INTR_VALID)) { int line = cpu_get_pic_interrupt(&x86cpu->env); cpu_reset_interrupt(cpu_state, CPU_INTERRUPT_HARD); @@ -420,11 +420,11 @@ bool hvf_inject_interrupts(CPUState *cpu_state) VMCS_INTR_VALID | VMCS_INTR_T_HWINTR); } } - if (cpu_state->interrupt_request & CPU_INTERRUPT_HARD) { + if (atomic_read(&cpu_state->interrupt_request) & CPU_INTERRUPT_HARD) { vmx_set_int_window_exiting(cpu_state); } - return (cpu_state->interrupt_request - & (CPU_INTERRUPT_INIT | CPU_INTERRUPT_TPR)); + return atomic_read(&cpu_state->interrupt_request) + & (CPU_INTERRUPT_INIT | CPU_INTERRUPT_TPR); } int hvf_process_events(CPUState *cpu_state) @@ -434,25 +434,25 @@ int hvf_process_events(CPUState *cpu_state) EFLAGS(env) = rreg(cpu_state->hvf_fd, HV_X86_RFLAGS); - if (cpu_state->interrupt_request & CPU_INTERRUPT_INIT) { + if (atomic_read(&cpu_state->interrupt_request) & CPU_INTERRUPT_INIT) { hvf_cpu_synchronize_state(cpu_state); do_cpu_init(cpu); } - if (cpu_state->interrupt_request & CPU_INTERRUPT_POLL) { + if (atomic_read(&cpu_state->interrupt_request) & CPU_INTERRUPT_POLL) { cpu_reset_interrupt(cpu_state, CPU_INTERRUPT_POLL); apic_poll_irq(cpu->apic_state); } - if (((cpu_state->interrupt_request & CPU_INTERRUPT_HARD) && + if (((atomic_read(&cpu_state->interrupt_request) & CPU_INTERRUPT_HARD) && (EFLAGS(env) & IF_MASK)) || - (cpu_state->interrupt_request & CPU_INTERRUPT_NMI)) { + (atomic_read(&cpu_state->interrupt_request) & CPU_INTERRUPT_NMI)) { cpu_state->halted = 0; } - if (cpu_state->interrupt_request & CPU_INTERRUPT_SIPI) { + if (atomic_read(&cpu_state->interrupt_request) & CPU_INTERRUPT_SIPI) { hvf_cpu_synchronize_state(cpu_state); do_cpu_sipi(cpu); } - if (cpu_state->interrupt_request & CPU_INTERRUPT_TPR) { + if (atomic_read(&cpu_state->interrupt_request) & CPU_INTERRUPT_TPR) { cpu_reset_interrupt(cpu_state, CPU_INTERRUPT_TPR); hvf_cpu_synchronize_state(cpu_state); apic_handle_tpr_access_report(cpu->apic_state, env->eip, From patchwork Mon Sep 17 16:30:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 970718 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="XAMvm/10"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="GPfoCyC5"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42DXFt1R5Jz9sfR for ; Tue, 18 Sep 2018 02:51:30 +1000 (AEST) Received: from localhost ([::1]:36550 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wkB-0006EB-QJ for incoming@patchwork.ozlabs.org; Mon, 17 Sep 2018 12:51:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41133) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wQo-0006Qt-SQ for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1wQk-00028f-PX for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:26 -0400 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:55055) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g1wQk-0001oR-FE for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:22 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 83AFB53A; Mon, 17 Sep 2018 12:31:08 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 17 Sep 2018 12:31:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=aKGZlFokhmgqY6 5WFTOZA7QCDKI0QucVVq+XAIyQaMw=; b=XAMvm/10XcjK0lyJprO8zkwoh89epW G6DHN01BJ3tiEbUuOTzhqjkuEdT6Xm5prLzK6QUg7g8YklYoZfJ7ydBAZ30qQPb4 63Lv6zIJq5xv4YxOl9YG9fvZQDwnGxmINd2fMX/1kdbvzVLTJ/fM5mpkDiwzRMD4 wp2d56ZAljKac= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=aKGZlFokhmgqY65WFTOZA7QCDKI0QucVVq+XAIyQaMw=; b=GPfoCyC5 fFLPDTgd7upMo/NaQ3KdTjkLjMNU4VBatVOzE3kBVxpcD0+sT3uqynFtqo9H3D7Q jfNnq2/fBZJZgRl3lAxfBhDqI1qOEUDPtjitwVcdcFgj1gSc35VXy0FI3d9iER4E f6UIHvXFmk5k9KWEab3yjJs4jyJAPm7ag6vTJzIeMg+T6Oqj3yz9ma3cs8wrPOae Ps7U/DZc4nydeqN04q6aESh0lONf4pFpQPGu8SvdMOPGfeDztKn4cneUN2j6+wcf ew14WeYDKrqQVjqNI8C4WVdaDOTrvi5gZG8RWKMS67Z6m7lhLotXqVr9xEN3B9ev hEvWi1OhaKGT1w== X-ME-Proxy: X-ME-Sender: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id B1C4FE49EC; Mon, 17 Sep 2018 12:31:07 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Mon, 17 Sep 2018 12:30:42 -0400 Message-Id: <20180917163103.6113-15-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180917163103.6113-1-cota@braap.org> References: <20180917163103.6113-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.147.123.25 Subject: [Qemu-devel] [PATCH 14/35] whpx: access cpu->interrupt_request with atomics X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Eduardo Habkost , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" I am not familiar with whpx, so I opted for the safe (and slow) route of performing probably many unnecessary atomic_reads. Cc: Richard Henderson Cc: Eduardo Habkost Signed-off-by: Emilio G. Cota --- target/i386/whpx-all.c | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/target/i386/whpx-all.c b/target/i386/whpx-all.c index d9428dc987..e0af3f5760 100644 --- a/target/i386/whpx-all.c +++ b/target/i386/whpx-all.c @@ -690,12 +690,15 @@ static int whpx_handle_portio(CPUState *cpu, static int whpx_handle_halt(CPUState *cpu) { struct CPUX86State *env = (CPUArchState *)(cpu->env_ptr); + int interrupt_request; int ret = 0; qemu_mutex_lock_iothread(); - if (!((cpu->interrupt_request & CPU_INTERRUPT_HARD) && + interrupt_request = atomic_read(&cpu->interrupt_request); + + if (!((interrupt_request & CPU_INTERRUPT_HARD) && (env->eflags & IF_MASK)) && - !(cpu->interrupt_request & CPU_INTERRUPT_NMI)) { + !(interrupt_request & CPU_INTERRUPT_NMI)) { cpu->exception_index = EXCP_HLT; cpu->halted = true; ret = 1; @@ -718,6 +721,7 @@ static void whpx_vcpu_pre_run(CPUState *cpu) UINT32 reg_count = 0; WHV_REGISTER_VALUE reg_values[3]; WHV_REGISTER_NAME reg_names[3]; + int interrupt_request; memset(&new_int, 0, sizeof(new_int)); memset(reg_values, 0, sizeof(reg_values)); @@ -725,16 +729,17 @@ static void whpx_vcpu_pre_run(CPUState *cpu) qemu_mutex_lock_iothread(); /* Inject NMI */ + interrupt_request = atomic_read(&cpu->interrupt_request); if (!vcpu->interruption_pending && - cpu->interrupt_request & (CPU_INTERRUPT_NMI | CPU_INTERRUPT_SMI)) { - if (cpu->interrupt_request & CPU_INTERRUPT_NMI) { + interrupt_request & (CPU_INTERRUPT_NMI | CPU_INTERRUPT_SMI)) { + if (interrupt_request & CPU_INTERRUPT_NMI) { cpu_reset_interrupt(cpu, CPU_INTERRUPT_NMI); vcpu->interruptable = false; new_int.InterruptionType = WHvX64PendingNmi; new_int.InterruptionPending = 1; new_int.InterruptionVector = 2; } - if (cpu->interrupt_request & CPU_INTERRUPT_SMI) { + if (interrupt_request & CPU_INTERRUPT_SMI) { cpu_reset_interrupt(cpu, CPU_INTERRUPT_SMI); } } @@ -743,12 +748,13 @@ static void whpx_vcpu_pre_run(CPUState *cpu) * Force the VCPU out of its inner loop to process any INIT requests or * commit pending TPR access. */ - if (cpu->interrupt_request & (CPU_INTERRUPT_INIT | CPU_INTERRUPT_TPR)) { - if ((cpu->interrupt_request & CPU_INTERRUPT_INIT) && + interrupt_request = atomic_read(&cpu->interrupt_request); + if (interrupt_request & (CPU_INTERRUPT_INIT | CPU_INTERRUPT_TPR)) { + if ((interrupt_request & CPU_INTERRUPT_INIT) && !(env->hflags & HF_SMM_MASK)) { cpu->exit_request = 1; } - if (cpu->interrupt_request & CPU_INTERRUPT_TPR) { + if (interrupt_request & CPU_INTERRUPT_TPR) { cpu->exit_request = 1; } } @@ -757,7 +763,7 @@ static void whpx_vcpu_pre_run(CPUState *cpu) if (!vcpu->interruption_pending && vcpu->interruptable && (env->eflags & IF_MASK)) { assert(!new_int.InterruptionPending); - if (cpu->interrupt_request & CPU_INTERRUPT_HARD) { + if (interrupt_request & CPU_INTERRUPT_HARD) { cpu_reset_interrupt(cpu, CPU_INTERRUPT_HARD); irq = cpu_get_pic_interrupt(env); if (irq >= 0) { @@ -787,7 +793,7 @@ static void whpx_vcpu_pre_run(CPUState *cpu) /* Update the state of the interrupt delivery notification */ if (!vcpu->window_registered && - cpu->interrupt_request & CPU_INTERRUPT_HARD) { + atomic_read(&cpu->interrupt_request) & CPU_INTERRUPT_HARD) { reg_values[reg_count].DeliverabilityNotifications.InterruptNotification = 1; vcpu->window_registered = 1; @@ -840,8 +846,9 @@ static void whpx_vcpu_process_async_events(CPUState *cpu) struct CPUX86State *env = (CPUArchState *)(cpu->env_ptr); X86CPU *x86_cpu = X86_CPU(cpu); struct whpx_vcpu *vcpu = get_whpx_vcpu(cpu); + int interrupt_request; - if ((cpu->interrupt_request & CPU_INTERRUPT_INIT) && + if ((atomic_read(&cpu->interrupt_request) & CPU_INTERRUPT_INIT) && !(env->hflags & HF_SMM_MASK)) { do_cpu_init(x86_cpu); @@ -849,25 +856,26 @@ static void whpx_vcpu_process_async_events(CPUState *cpu) vcpu->interruptable = true; } - if (cpu->interrupt_request & CPU_INTERRUPT_POLL) { + if (atomic_read(&cpu->interrupt_request) & CPU_INTERRUPT_POLL) { cpu_reset_interrupt(cpu, CPU_INTERRUPT_POLL); apic_poll_irq(x86_cpu->apic_state); } - if (((cpu->interrupt_request & CPU_INTERRUPT_HARD) && + interrupt_request = atomic_read(&cpu->interrupt_request); + if (((interrupt_request & CPU_INTERRUPT_HARD) && (env->eflags & IF_MASK)) || - (cpu->interrupt_request & CPU_INTERRUPT_NMI)) { + (interrupt_request & CPU_INTERRUPT_NMI)) { cpu->halted = false; } - if (cpu->interrupt_request & CPU_INTERRUPT_SIPI) { + if (interrupt_request & CPU_INTERRUPT_SIPI) { if (!cpu->vcpu_dirty) { whpx_get_registers(cpu); } do_cpu_sipi(x86_cpu); } - if (cpu->interrupt_request & CPU_INTERRUPT_TPR) { + if (atomic_read(&cpu->interrupt_request) & CPU_INTERRUPT_TPR) { cpu_reset_interrupt(cpu, CPU_INTERRUPT_TPR); if (!cpu->vcpu_dirty) { whpx_get_registers(cpu); @@ -1350,7 +1358,7 @@ static void whpx_memory_init(void) static void whpx_handle_interrupt(CPUState *cpu, int mask) { - cpu->interrupt_request |= mask; + atomic_or(&cpu->interrupt_request, mask); if (!qemu_cpu_is_self(cpu)) { qemu_cpu_kick(cpu); From patchwork Mon Sep 17 16:30:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 970710 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="hgypLKhj"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="QWzbp8iz"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42DX9Z4zwqz9sfR for ; Tue, 18 Sep 2018 02:47:46 +1000 (AEST) Received: from localhost ([::1]:36525 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wga-0002oo-4M for incoming@patchwork.ozlabs.org; Mon, 17 Sep 2018 12:47:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41115) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wQo-0006QM-Mv for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1wQk-00027Y-Hf for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:26 -0400 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:43819) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g1wQk-0001oX-7M for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:22 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 9CE4053E; Mon, 17 Sep 2018 12:31:08 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 17 Sep 2018 12:31:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=w0cy4hsmapcYhH VY/b1z1GFmpJYFu9QioiFUQ5LbyGI=; b=hgypLKhjO8E/Z48msNGB/bZv+oyDZV GrorE1T/o3x047GgHnUlyWdRklrZLXFf+bmXn94NwrW4u7j812uauZH0zJio2t6v IHQTDegwxBLhWcETXmD5Jwi7lAJAcaLlA8fd3t4QVzCGQM7gK+oN6WdizOTGMXtr YaWpoVP9wb31s= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=w0cy4hsmapcYhHVY/b1z1GFmpJYFu9QioiFUQ5LbyGI=; b=QWzbp8iz cty3Esw/ytF81iPst76qFMv6+LVCDUmtFrWyb+UHoCkkd9yXE7akDLbVxzEJ5uay qc070GJySXFFy2vsE0UEx5fUoVH/AWZQSCYzQoEF5G77X0gtGFPV0vFnmI4VkaHx KQcmNiFx7XlxVm2G/RjVUhitCE3/Tb5/95GY+fobI91Mw1IjpQqlJkP4J/W4QxQx bP9sCbxtRZGkMvSVbnNte2Jal7RnT6rBrp/ubM1zk5OnsTpunz5Pq1OeloHWAdcB dpmAj4h7rO8HxsT76tETrzJ5bYRxWOEFKw0/sYO9da0UfNyek5LxbdwYFZhOHaP+ NLfB8htU3KpR8w== X-ME-Proxy: X-ME-Sender: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id E9921E4A40; Mon, 17 Sep 2018 12:31:07 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Mon, 17 Sep 2018 12:30:43 -0400 Message-Id: <20180917163103.6113-16-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180917163103.6113-1-cota@braap.org> References: <20180917163103.6113-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.147.123.25 Subject: [Qemu-devel] [PATCH 15/35] target/lm32: access cpu->interrupt_request with atomics X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Michael Walle Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Cc: Michael Walle Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota Reviewed-by: Philippe Mathieu-Daudé Acked-by: Michael Walle --- target/lm32/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/lm32/cpu.c b/target/lm32/cpu.c index b7499cb627..6c0178e1ea 100644 --- a/target/lm32/cpu.c +++ b/target/lm32/cpu.c @@ -101,7 +101,7 @@ static void lm32_cpu_init_cfg_reg(LM32CPU *cpu) static bool lm32_cpu_has_work(CPUState *cs) { - return cs->interrupt_request & CPU_INTERRUPT_HARD; + return atomic_read(&cs->interrupt_request) & CPU_INTERRUPT_HARD; } /* CPUClass::reset() */ From patchwork Mon Sep 17 16:30:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 970716 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="VSv3MxLg"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="Y2ht1P9R"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42DXFH4338z9sfR for ; Tue, 18 Sep 2018 02:50:58 +1000 (AEST) Received: from localhost ([::1]:36543 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wjg-0005k8-Gw for incoming@patchwork.ozlabs.org; Mon, 17 Sep 2018 12:50:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41122) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wQo-0006Qn-Ri for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1wQl-00029A-84 for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:26 -0400 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:43881) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g1wQk-0001pl-UC for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:23 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id EA66D507; Mon, 17 Sep 2018 12:31:08 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 17 Sep 2018 12:31:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=XCYMXs9Fea9GyP i+NjswNX3/WsPBsRrCOrM+P4+ZG6Y=; b=VSv3MxLgt9kupaIHU3yyXu2ivQAVaR 2ahMLJUCuhR2/touvBc1HvgbYZIr6I/XgVZyocjuC14+P+UY6d7e7Y6dY8HkBYGo 9PzRdmJvh5+QdpD8cKCZRv+5Dm7kfujJ9xdw+HgQ5bgORPSQggYZ33JdDQyYeLT1 cdY9W7pjLLoEM= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=XCYMXs9Fea9GyPi+NjswNX3/WsPBsRrCOrM+P4+ZG6Y=; b=Y2ht1P9R 203GJIsiYLYU0fkGanQSqNNK7GwKjBVugzalI5EcIxG3dtTJdNbXmSTSjMIIG6Jc jcfrS/PySzVj4Ovk3NbhdWf2c3MpVeGe7+WFqeUWPm3knheTds7xsDWsYds0dqy8 6HHhSGowq1c3YT6u16riVvCXoZb8vTNLiT9mkwV+Qi/Yjf8eubu+lt6qulvU2HCm xbZhIzlVXUfwDxyit37fuy5EFD4EBWzHfpQ3W05xErFzLhbNRfX8VvLVcKcaHpM/ mKCcTSNsASSmYwxoPOY0vLt8qvckrWDFk/6EFf/u8b77l+ANquv3qelFVnLmEyTI rYdzX9psyyT/Yg== X-ME-Proxy: X-ME-Sender: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 3B313E4A41; Mon, 17 Sep 2018 12:31:08 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Mon, 17 Sep 2018 12:30:44 -0400 Message-Id: <20180917163103.6113-17-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180917163103.6113-1-cota@braap.org> References: <20180917163103.6113-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.147.123.25 Subject: [Qemu-devel] [PATCH 16/35] target/m68k: access cpu->interrupt_request with atomics X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Laurent Vivier Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Cc: Laurent Vivier Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota Acked-by: Laurent Vivier Reviewed-by: Philippe Mathieu-Daudé --- target/m68k/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c index 582e3a73b3..4b15184a50 100644 --- a/target/m68k/cpu.c +++ b/target/m68k/cpu.c @@ -34,7 +34,7 @@ static void m68k_cpu_set_pc(CPUState *cs, vaddr value) static bool m68k_cpu_has_work(CPUState *cs) { - return cs->interrupt_request & CPU_INTERRUPT_HARD; + return atomic_read(&cs->interrupt_request) & CPU_INTERRUPT_HARD; } static void m68k_set_feature(CPUM68KState *env, int feature) From patchwork Mon Sep 17 16:30:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 970696 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="SPC+PFG/"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="c3aw+koV"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42DX275HpPz9sfR for ; Tue, 18 Sep 2018 02:41:19 +1000 (AEST) Received: from localhost ([::1]:36487 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1waL-0005zD-A8 for incoming@patchwork.ozlabs.org; Mon, 17 Sep 2018 12:41:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41123) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wQo-0006Qo-Rm for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1wQl-000297-7U for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:26 -0400 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:47491) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g1wQk-0001pn-V5 for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:23 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 301BF52A; Mon, 17 Sep 2018 12:31:09 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 17 Sep 2018 12:31:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=J75N9rPWUb4/da AUfvJ84Fkg0OuQDMVkYizg4JEIToE=; b=SPC+PFG/mwv06Ag7BmPDTsFoJhidVP jElr3fQVamuJg6b4EcZpx9uxe9+WPJzliWfc8Q2gj+/UN/ept1URUGI2oKwk5wGP O35kVBMJydJzWA9ipi+algjsIWJVthLg5seO9QmIN34+vVn4xh9wFdPidwmFGYbN mZj2Rp/MI3QLI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=J75N9rPWUb4/daAUfvJ84Fkg0OuQDMVkYizg4JEIToE=; b=c3aw+koV 3sauLoQYjDXi9Yj9+UUME+OVNyZTpcoWXBGlt300eEJ8kjKA9YEKvR8Kqu7AI08O XWxAhDZ7KA0Z+lhqTbE/qDdatGMg9Koj8XH1L2O7byZG34gqcoVqq2JajoS/pGNk pGh2ScB4F5ZL+rz2X6UanIumd9FXv7LIbpX6QJzKRTOlmEMibdgnZ1w3UA6D1MC6 rVkvfrBRMHvOwJoiDVuZq6c4DR+ooOZyUQ6SLOG6gg8hiK5ZxKt17dxwYJXiy6gM O1jPIIXPYWQyxlF1QacXToGnRqM7xXIR0xnUReiUN0H//rP1G5UbGCB8dTW4tD2/ Kej08zHbm+d6mg== X-ME-Proxy: X-ME-Sender: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 6EAA3E49C8; Mon, 17 Sep 2018 12:31:08 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Mon, 17 Sep 2018 12:30:45 -0400 Message-Id: <20180917163103.6113-18-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180917163103.6113-1-cota@braap.org> References: <20180917163103.6113-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.147.123.25 Subject: [Qemu-devel] [PATCH 17/35] target/microblaze: access cpu->interrupt_request with atomics X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , "Edgar E. Iglesias" Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Cc: "Edgar E. Iglesias" Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota Reviewed-by: Philippe Mathieu-Daudé --- target/microblaze/cpu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c index 9b546a2c18..c9cff79e38 100644 --- a/target/microblaze/cpu.c +++ b/target/microblaze/cpu.c @@ -84,7 +84,8 @@ static void mb_cpu_set_pc(CPUState *cs, vaddr value) static bool mb_cpu_has_work(CPUState *cs) { - return cs->interrupt_request & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_NMI); + return atomic_read(&cs->interrupt_request) & (CPU_INTERRUPT_HARD | + CPU_INTERRUPT_NMI); } #ifndef CONFIG_USER_ONLY From patchwork Mon Sep 17 16:30:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 970682 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="T7Qdoz1Y"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="UtQ4iA0q"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42DWr071vdz9sfR for ; Tue, 18 Sep 2018 02:32:32 +1000 (AEST) Received: from localhost ([::1]:36437 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wRq-0006d1-IW for incoming@patchwork.ozlabs.org; Mon, 17 Sep 2018 12:32:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40756) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wQd-0006Er-5J for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1wQZ-0001nM-2D for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:15 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:54581) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g1wQY-0001jV-RC for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:10 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 2C4E221A02; Mon, 17 Sep 2018 12:31:09 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 17 Sep 2018 12:31:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=+fpC6XFI1T10Ax e3Y9ywrFE0ldzOnO5n9Atk7tj63U8=; b=T7Qdoz1Y17zFteNT+GS4sK3uXFTHOO e0VfZ5rFdnQGEX2gu1RqLzsSk4tSYw+1QC5CjyObKm1DKPi/cH8qOzKnZYuhyCOo NsgxEzI5qBoIqed3L4h/lk+wHGeSfsB++eZpcHhz5dhAIOY4nrJ8PVWNSZKp2YcW wr34kTVno8OlA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=+fpC6XFI1T10Axe3Y9ywrFE0ldzOnO5n9Atk7tj63U8=; b=UtQ4iA0q Ah4d97DXvckolWNsPShpMIcBXOl+jTmggOjkTdV/i0AbMEBf4P7cyKukxiFKeofn yzDlif2OE++rsw1fQyXx1zZ3pM7rAWje+UBvQcfRkCI0z5rIyhzhrmLamqyIb1FK 7gfvTVFDOD9k1I7dgygZuVsj2rGECRw3ESW68fArsIvod9pW/hWUOEtIWN0wC4/U mBOfBXzoX0zoQLKlDToTyMI6JsrxAcHCqC/CQWUE2uTCE7aRv8Jd0JirH/hQXcfx PZFVVtNAl61ywqW1NgcU9EngxxhAEsdaMwE06wbfipDcBiZy9+HaG4+zcuUmxmL5 Oa3GBq+fIV6IzA== X-ME-Proxy: X-ME-Sender: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id AAD6BE4121; Mon, 17 Sep 2018 12:31:08 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Mon, 17 Sep 2018 12:30:46 -0400 Message-Id: <20180917163103.6113-19-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180917163103.6113-1-cota@braap.org> References: <20180917163103.6113-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.25 Subject: [Qemu-devel] [PATCH 18/35] target/mips: access cpu->interrupt_request with atomics X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Aleksandar Markovic , Aurelien Jarno , James Hogan Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Cc: Aurelien Jarno Cc: Aleksandar Markovic Cc: James Hogan Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota --- target/mips/cpu.c | 7 ++++--- target/mips/kvm.c | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/target/mips/cpu.c b/target/mips/cpu.c index 497706b669..8d07696825 100644 --- a/target/mips/cpu.c +++ b/target/mips/cpu.c @@ -56,11 +56,12 @@ static bool mips_cpu_has_work(CPUState *cs) MIPSCPU *cpu = MIPS_CPU(cs); CPUMIPSState *env = &cpu->env; bool has_work = false; + uint32_t interrupt_request = atomic_read(&cs->interrupt_request); /* Prior to MIPS Release 6 it is implementation dependent if non-enabled interrupts wake-up the CPU, however most of the implementations only check for interrupts that can be taken. */ - if ((cs->interrupt_request & CPU_INTERRUPT_HARD) && + if ((interrupt_request & CPU_INTERRUPT_HARD) && cpu_mips_hw_interrupts_pending(env)) { if (cpu_mips_hw_interrupts_enabled(env) || (env->insn_flags & ISA_MIPS32R6)) { @@ -72,7 +73,7 @@ static bool mips_cpu_has_work(CPUState *cs) if (env->CP0_Config3 & (1 << CP0C3_MT)) { /* The QEMU model will issue an _WAKE request whenever the CPUs should be woken up. */ - if (cs->interrupt_request & CPU_INTERRUPT_WAKE) { + if (interrupt_request & CPU_INTERRUPT_WAKE) { has_work = true; } @@ -82,7 +83,7 @@ static bool mips_cpu_has_work(CPUState *cs) } /* MIPS Release 6 has the ability to halt the CPU. */ if (env->CP0_Config5 & (1 << CP0C5_VP)) { - if (cs->interrupt_request & CPU_INTERRUPT_WAKE) { + if (interrupt_request & CPU_INTERRUPT_WAKE) { has_work = true; } if (!mips_vp_active(env)) { diff --git a/target/mips/kvm.c b/target/mips/kvm.c index 8e72850962..71fe3501a8 100644 --- a/target/mips/kvm.c +++ b/target/mips/kvm.c @@ -135,7 +135,7 @@ void kvm_arch_pre_run(CPUState *cs, struct kvm_run *run) qemu_mutex_lock_iothread(); - if ((cs->interrupt_request & CPU_INTERRUPT_HARD) && + if ((atomic_read(&cs->interrupt_request) & CPU_INTERRUPT_HARD) && cpu_mips_io_interrupts_pending(cpu)) { intr.cpu = -1; intr.irq = 2; From patchwork Mon Sep 17 16:30:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 970702 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="Z7p+Mkn2"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="d84T6LC3"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42DX5Q6hSNz9sfR for ; Tue, 18 Sep 2018 02:44:10 +1000 (AEST) Received: from localhost ([::1]:36501 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wd5-0008Eq-UK for incoming@patchwork.ozlabs.org; Mon, 17 Sep 2018 12:44:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41121) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wQo-0006Qm-Ri for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1wQl-00029J-8G for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:26 -0400 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:59901) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g1wQk-0001pr-VQ for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:23 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id B87B0540; Mon, 17 Sep 2018 12:31:09 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 17 Sep 2018 12:31:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=3eCypmL4ZtPLbx fRmPXjbBSrCYOL5Wg2FF9S+zXIj/w=; b=Z7p+Mkn2BOiJtYhQGGs586fJuCffsb InScqRXETLR5QCM2MgO+x3m3tgSeSKlKnp1l5VD6Gn63NoOm4gvn2/DAHclVClo8 WCjt1V5vOtjSuAw3K1Ly3ozgOpAfoM2T3M6XI1qldteOXXo5zSN3uEdvrQL7kQB8 zha1awqURPrrM= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=3eCypmL4ZtPLbxfRmPXjbBSrCYOL5Wg2FF9S+zXIj/w=; b=d84T6LC3 0tKNkv+NH0C+qoDYJEeOJQVftlNf09Okv3mJLy5hU5+j1m2b0wZbOFPN3k9aSl+5 /Tv4tKqtP0xS0QD4zwyk57Lr8SDOH3eFG8zmU0Ll052dx76EqKY6hfyvnw0x/H3N sr98/Ukkype6XQ90wrDbfcFxcZ6tmIXJtZ9CwmKTcYdkBg1NiTo91goempmf+7rr cTYGVGsMuCt626UcGwNqdGQcbIlEysINc/S0IlyFmbwN7PVU68x5+qH5cdkCfNFe pCjThkJxVtIMNAsb+8+A01WcxwWULg5gKuXgkY1Hsq9qq7+OTeRndePVHfHqJE2E JzxkyHsWTTYPqQ== X-ME-Proxy: X-ME-Sender: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id F143DE49C5; Mon, 17 Sep 2018 12:31:08 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Mon, 17 Sep 2018 12:30:47 -0400 Message-Id: <20180917163103.6113-20-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180917163103.6113-1-cota@braap.org> References: <20180917163103.6113-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.147.123.25 Subject: [Qemu-devel] [PATCH 19/35] target/moxie: access cpu->interrupt_request with atomics X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Anthony Green Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Cc: Anthony Green Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota Reviewed-by: Philippe Mathieu-Daudé --- target/moxie/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/moxie/cpu.c b/target/moxie/cpu.c index 8d67eb6727..f25144242b 100644 --- a/target/moxie/cpu.c +++ b/target/moxie/cpu.c @@ -33,7 +33,7 @@ static void moxie_cpu_set_pc(CPUState *cs, vaddr value) static bool moxie_cpu_has_work(CPUState *cs) { - return cs->interrupt_request & CPU_INTERRUPT_HARD; + return atomic_read(&cs->interrupt_request) & CPU_INTERRUPT_HARD; } static void moxie_cpu_reset(CPUState *s) From patchwork Mon Sep 17 16:30:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 970721 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="ahFEStg/"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="PkgwzMG5"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42DXJq1Hw3z9sfR for ; Tue, 18 Sep 2018 02:54:02 +1000 (AEST) Received: from localhost ([::1]:36560 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wmd-0008SY-NZ for incoming@patchwork.ozlabs.org; Mon, 17 Sep 2018 12:53:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41129) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wQo-0006Qs-SQ for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1wQl-00029S-95 for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:26 -0400 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:34861) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g1wQl-0001pu-00 for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:23 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id E7ACD542; Mon, 17 Sep 2018 12:31:09 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 17 Sep 2018 12:31:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=GNCn324QBJ/kXk VSW8Tr9aqFb0bjrr6D/Ea9kx2nEhc=; b=ahFEStg/c2UjRLtEOQrOjyLtHwm/bz jLXY+U7N4c3NJeJ56Cxw5yRvhSSHxO+EMFg0kW3j4T4SaSg/KJ3BMT1s55Hxqbg7 tpu/75ypv7RqYXB2oqmmfirIShuEGdma147HU/UVRKKn1bDG763EtSWOyqqWzeml JFtSdcys96El8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=GNCn324QBJ/kXkVSW8Tr9aqFb0bjrr6D/Ea9kx2nEhc=; b=PkgwzMG5 omwM9mEMCL+6ChyQSCp6o+y1hFI2HDvzxSQVt12bqyQ11lZOJ3LisK+krqNuMVJP IhOFRNp9v97rNUCZ05uAudWs6w2WqKU1BPHCKw3xZwN1Rqu4E1AsjfQb4D+IgiMQ co2pYCnfL3PJzEWt94nT8kvKZlLCQogSPRZiDV2Cj5n9xkkBGnte/zb7YDZm8AbQ kjWx/XQPOk0KMb5yoQwR2GOEoHpxfsp7ILedhMJF/DeYTQ5yhXGjWxN+fDG4FEYd iDQzOGcm2ln3oNEHw5ix0kgPV0PpBfXEnev/o/UKGWMHcTMgmGhJo1fFjvppMH2o /LrGD/Lw9Tk2Lg== X-ME-Proxy: X-ME-Sender: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 3D7D7E4121; Mon, 17 Sep 2018 12:31:09 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Mon, 17 Sep 2018 12:30:48 -0400 Message-Id: <20180917163103.6113-21-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180917163103.6113-1-cota@braap.org> References: <20180917163103.6113-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.147.123.25 Subject: [Qemu-devel] [PATCH 20/35] target/nios2: access cpu->interrupt_request with atomics X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marek Vasut , Paolo Bonzini , Chris Wulff Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Cc: Chris Wulff Cc: Marek Vasut Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota Reviewed-by: Philippe Mathieu-Daudé --- target/nios2/cpu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/nios2/cpu.c b/target/nios2/cpu.c index fbfaa2ce26..849eaaa392 100644 --- a/target/nios2/cpu.c +++ b/target/nios2/cpu.c @@ -36,7 +36,8 @@ static void nios2_cpu_set_pc(CPUState *cs, vaddr value) static bool nios2_cpu_has_work(CPUState *cs) { - return cs->interrupt_request & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_NMI); + return atomic_read(&cs->interrupt_request) & (CPU_INTERRUPT_HARD | + CPU_INTERRUPT_NMI); } /* CPUClass::reset() */ From patchwork Mon Sep 17 16:30:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 970705 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="iu4+3CBr"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="nNlQG6yD"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42DX6M42yWz9sfR for ; Tue, 18 Sep 2018 02:44:59 +1000 (AEST) Received: from localhost ([::1]:36508 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wdt-0000UC-1w for incoming@patchwork.ozlabs.org; Mon, 17 Sep 2018 12:44:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41126) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wQo-0006Qq-Ry for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1wQl-00029r-D6 for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:26 -0400 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:40449) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g1wQl-0001qD-41 for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:23 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 459AB54A; Mon, 17 Sep 2018 12:31:10 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 17 Sep 2018 12:31:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=gBkPUoExPLWQ6Y XgqZ2WLCUMEyEwfT7Hj474HYXb2BY=; b=iu4+3CBrG9oNUGAiWEH6AtzZjq+Y9a Y9lnucdeeBENkZLeKjAaKXA8Oct3r7mm5CtePL35R+1LRaUfeeSPc7XaagvmrQ8p EbrG3eGD1Fg/8ItuB7TAUHRaNzQ5NIqhOKySl4PTY0EZftYhycUVVmzSYJBG2L/2 626k0fmtisSb8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=gBkPUoExPLWQ6YXgqZ2WLCUMEyEwfT7Hj474HYXb2BY=; b=nNlQG6yD cWaBPPyTwqXwNMK0Aoz3Hm2cKT4GaQIpNO/e2F6ithNadbeZxzUGQPNlthBE664/ fSnDUDM7rZEAQFueLnO2sD66pAvPHFDqErQxmLWRSxcppO+juBfnT7iEGZzPGAAX usjS1tY7CjlT8vH5bdaEheg7yN0nvov0xH/8SVcn5pok62gxxvZGGsOGsd8vZGqI /jKIBWkgX4/u+jB6FtCayi50/qGhfB0no4Z1Au4TcHQmr6ThCModkcKUkfYCEYv7 H/U6HlUmToWVfNeQVTShwr3V8PywyHjtHx9WbJSbJfa2yxBJYtcgvG37UOq1uxRy /AHBQbeidVXq5Q== X-ME-Proxy: X-ME-Sender: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 7626EE49EC; Mon, 17 Sep 2018 12:31:09 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Mon, 17 Sep 2018 12:30:49 -0400 Message-Id: <20180917163103.6113-22-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180917163103.6113-1-cota@braap.org> References: <20180917163103.6113-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.147.123.25 Subject: [Qemu-devel] [PATCH 21/35] target/openrisc: access cpu->interrupt_request with atomics X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Stafford Horne Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Cc: Stafford Horne Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota Reviewed-by: Philippe Mathieu-Daudé --- hw/openrisc/cputimer.c | 2 +- target/openrisc/cpu.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/openrisc/cputimer.c b/hw/openrisc/cputimer.c index 850f88761c..4d1b638025 100644 --- a/hw/openrisc/cputimer.c +++ b/hw/openrisc/cputimer.c @@ -102,7 +102,7 @@ static void openrisc_timer_cb(void *opaque) CPUState *cs = CPU(cpu); cpu->env.ttmr |= TTMR_IP; - cs->interrupt_request |= CPU_INTERRUPT_TIMER; + atomic_or(&cs->interrupt_request, CPU_INTERRUPT_TIMER); } switch (cpu->env.ttmr & TTMR_M) { diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c index fb7cb5c507..269c947f05 100644 --- a/target/openrisc/cpu.c +++ b/target/openrisc/cpu.c @@ -32,8 +32,8 @@ static void openrisc_cpu_set_pc(CPUState *cs, vaddr value) static bool openrisc_cpu_has_work(CPUState *cs) { - return cs->interrupt_request & (CPU_INTERRUPT_HARD | - CPU_INTERRUPT_TIMER); + return atomic_read(&cs->interrupt_request) & (CPU_INTERRUPT_HARD | + CPU_INTERRUPT_TIMER); } static void openrisc_disas_set_info(CPUState *cpu, disassemble_info *info) From patchwork Mon Sep 17 16:30:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 970725 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="vpC8G7Pv"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="qkzfAqvs"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42DXNH641Nz9sfR for ; Tue, 18 Sep 2018 02:57:03 +1000 (AEST) Received: from localhost ([::1]:36586 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wpZ-0002ZA-Eh for incoming@patchwork.ozlabs.org; Mon, 17 Sep 2018 12:57:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41319) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wR0-0006bN-F3 for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1wQv-0002ct-JD for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:37 -0400 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:55279) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g1wQv-0001qF-5q; Mon, 17 Sep 2018 12:31:33 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 63A7E54B; Mon, 17 Sep 2018 12:31:10 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 17 Sep 2018 12:31:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=DYXSELIhOnJIB7 cPToGKI8cVq8y3XY7NX/hFu+ANjXY=; b=vpC8G7PvwRmNUPhN9SF0kJ3B3hPZsI J1SnbcLSwdQCc3SoJ7YOzK23++4byzBFyr0FGKP9S4ygR/jMzAr2cuRFAB1b9ZVs Kv37nEF7AhGaImE3Lx4HtS5YXw13+T/55uAsiUDnK0HGJBvsbAOfKZSy0KIKVSuH YKj14yZVU8Bm4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=DYXSELIhOnJIB7cPToGKI8cVq8y3XY7NX/hFu+ANjXY=; b=qkzfAqvs aL26qquO+ibYkUIEexytVc5rFOWQa84p945R1qQunwgtziYzKXpSNaIAs4mOxyTo EDu0prDG6NcUjWhB+No6zE8O34CSLK+RMyQfeRu1rslhjjbg/yjph7FSVGeJUMJ1 NdmYRzoDXf/puHsbMoaNRqf8pBlxIohJsJtd2ZoGzcGoUpmV6wYx8TD2mk2lDUkN kpt3Uzpbkds/b8agkUXQJkL7GKHbQTl0XDskAvKz0CbZBkEWsFDPXRPFtIU6UPXu Fv76gZnYT8cdvYRI2bIgGyl87X9s+m/25JGYdMFNqRSWiQRHhVdD1VGlHMPa/IiB khcdtWYCZVkNAA== X-ME-Proxy: X-ME-Sender: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id B0DBAE49C7; Mon, 17 Sep 2018 12:31:09 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Mon, 17 Sep 2018 12:30:50 -0400 Message-Id: <20180917163103.6113-23-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180917163103.6113-1-cota@braap.org> References: <20180917163103.6113-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.147.123.25 Subject: [Qemu-devel] [PATCH 22/35] target/ppc: access cpu->interrupt_request with atomics X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , qemu-ppc@nongnu.org, Alexander Graf , David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Cc: David Gibson Cc: Alexander Graf Cc: qemu-ppc@nongnu.org Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota Acked-by: David Gibson --- hw/ppc/ppc.c | 2 +- target/ppc/excp_helper.c | 3 ++- target/ppc/kvm.c | 4 ++-- target/ppc/translate_init.inc.c | 17 ++++++++++------- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c index ec4be25f49..ad0cfb2f7c 100644 --- a/hw/ppc/ppc.c +++ b/hw/ppc/ppc.c @@ -91,7 +91,7 @@ void ppc_set_irq(PowerPCCPU *cpu, int n_IRQ, int level) LOG_IRQ("%s: %p n_IRQ %d level %d => pending %08" PRIx32 "req %08x\n", __func__, env, n_IRQ, level, - env->pending_interrupts, CPU(cpu)->interrupt_request); + env->pending_interrupts, atomic_read(&CPU(cpu)->interrupt_request)); if (locked) { qemu_mutex_unlock_iothread(); diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index 6ffa762033..70ac10e23b 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -753,7 +753,8 @@ static void ppc_hw_interrupt(CPUPPCState *env) qemu_log_mask(CPU_LOG_INT, "%s: %p pending %08x req %08x me %d ee %d\n", __func__, env, env->pending_interrupts, - cs->interrupt_request, (int)msr_me, (int)msr_ee); + atomic_read(&cs->interrupt_request), + (int)msr_me, (int)msr_ee); #endif /* External reset */ if (env->pending_interrupts & (1 << PPC_INTERRUPT_RESET)) { diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index 9211ee2ee1..8214738c20 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -1336,7 +1336,7 @@ void kvm_arch_pre_run(CPUState *cs, struct kvm_run *run) * interrupt, reset, etc) in PPC-specific env->irq_input_state. */ if (!cap_interrupt_level && run->ready_for_interrupt_injection && - (cs->interrupt_request & CPU_INTERRUPT_HARD) && + (atomic_read(&cs->interrupt_request) & CPU_INTERRUPT_HARD) && (env->irq_input_state & (1<env; - if (!(cs->interrupt_request & CPU_INTERRUPT_HARD) && (msr_ee)) { + if (!(atomic_read(&cs->interrupt_request) & CPU_INTERRUPT_HARD) && msr_ee) { cs->halted = 1; cs->exception_index = EXCP_HLT; } diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.inc.c index d920d3e538..3ed8298bc7 100644 --- a/target/ppc/translate_init.inc.c +++ b/target/ppc/translate_init.inc.c @@ -8442,11 +8442,12 @@ static bool ppc_pvr_match_power7(PowerPCCPUClass *pcc, uint32_t pvr) static bool cpu_has_work_POWER7(CPUState *cs) { + uint32_t interrupt_request = atomic_read(&cs->interrupt_request); PowerPCCPU *cpu = POWERPC_CPU(cs); CPUPPCState *env = &cpu->env; if (cs->halted) { - if (!(cs->interrupt_request & CPU_INTERRUPT_HARD)) { + if (!(interrupt_request & CPU_INTERRUPT_HARD)) { return false; } if ((env->pending_interrupts & (1u << PPC_INTERRUPT_EXT)) && @@ -8470,7 +8471,7 @@ static bool cpu_has_work_POWER7(CPUState *cs) } return false; } else { - return msr_ee && (cs->interrupt_request & CPU_INTERRUPT_HARD); + return msr_ee && (interrupt_request & CPU_INTERRUPT_HARD); } } @@ -8596,11 +8597,12 @@ static bool ppc_pvr_match_power8(PowerPCCPUClass *pcc, uint32_t pvr) static bool cpu_has_work_POWER8(CPUState *cs) { + uint32_t interrupt_request = atomic_read(&cs->interrupt_request); PowerPCCPU *cpu = POWERPC_CPU(cs); CPUPPCState *env = &cpu->env; if (cs->halted) { - if (!(cs->interrupt_request & CPU_INTERRUPT_HARD)) { + if (!(interrupt_request & CPU_INTERRUPT_HARD)) { return false; } if ((env->pending_interrupts & (1u << PPC_INTERRUPT_EXT)) && @@ -8632,7 +8634,7 @@ static bool cpu_has_work_POWER8(CPUState *cs) } return false; } else { - return msr_ee && (cs->interrupt_request & CPU_INTERRUPT_HARD); + return msr_ee && (interrupt_request & CPU_INTERRUPT_HARD); } } @@ -8788,11 +8790,12 @@ static bool ppc_pvr_match_power9(PowerPCCPUClass *pcc, uint32_t pvr) static bool cpu_has_work_POWER9(CPUState *cs) { + uint32_t interrupt_request = atomic_read(&cs->interrupt_request); PowerPCCPU *cpu = POWERPC_CPU(cs); CPUPPCState *env = &cpu->env; if (cs->halted) { - if (!(cs->interrupt_request & CPU_INTERRUPT_HARD)) { + if (!(interrupt_request & CPU_INTERRUPT_HARD)) { return false; } /* External Exception */ @@ -8825,7 +8828,7 @@ static bool cpu_has_work_POWER9(CPUState *cs) } return false; } else { - return msr_ee && (cs->interrupt_request & CPU_INTERRUPT_HARD); + return msr_ee && (interrupt_request & CPU_INTERRUPT_HARD); } } @@ -10269,7 +10272,7 @@ static bool ppc_cpu_has_work(CPUState *cs) PowerPCCPU *cpu = POWERPC_CPU(cs); CPUPPCState *env = &cpu->env; - return msr_ee && (cs->interrupt_request & CPU_INTERRUPT_HARD); + return msr_ee && (atomic_read(&cs->interrupt_request) & CPU_INTERRUPT_HARD); } /* CPUClass::reset() */ From patchwork Mon Sep 17 16:30:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 970730 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="0pzNnjnn"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="itvVZbeI"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42DXSB7091z9sfR for ; Tue, 18 Sep 2018 03:00:26 +1000 (AEST) Received: from localhost ([::1]:36612 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wsq-0005bc-Kb for incoming@patchwork.ozlabs.org; Mon, 17 Sep 2018 13:00:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41315) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wR0-0006bK-F3 for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1wQv-0002cy-JH for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:37 -0400 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:33429) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g1wQv-0001qK-7Y; Mon, 17 Sep 2018 12:31:33 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id BC83E555; Mon, 17 Sep 2018 12:31:10 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 17 Sep 2018 12:31:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=CHm9RDZIYx06CI rTWKHLhWV0s5HNxL2oojA0lwe/WRk=; b=0pzNnjnn6LZyrGvJzFLriUajDKYA2p 2usaz75ImS6oNlKzLCA9PCc6FSmwnWcBoC6d5pxNMoXapV1BK9WD79DGuE/flQWl RjZgSkpQ+uYwVwhu0aRbRc79dCgC6hBcj/HE9JBBJIIBe3+VVBin0A8qAXbvPjX2 jGFJS8uZnVcuA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=CHm9RDZIYx06CIrTWKHLhWV0s5HNxL2oojA0lwe/WRk=; b=itvVZbeI W2jXLFmudQlmML++see1ogIw2VgEzdAIqxl6gjyEny/f1o94WYgO6snnypCNzfho MUzjruRg97jl4QffQDLEeHQMUDPnteaVaAqydvvrevgfOqQBtZ6Q4FOhy0YRYNNe ma1d3hw08Vd6vaxI4Ty/DUoynXNy13K8n+AsXHbwdflWWbSgumPRAD5lR6goX/8c A0qrYet0NMH/uo4kOPd5F3dTb5fOrRYfTfvKTpNSWs1aWTqJUL+69gRG7N3lZUH+ BzGL+dX4Fw8RQBcjvd2k+wFCyuIQ24Ua/8I3gtXjR0Fla/89gCbDyiXzmre5O1p0 rPjXVcFGFFly0A== X-ME-Proxy: X-ME-Sender: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id ECE2AE414C; Mon, 17 Sep 2018 12:31:09 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Mon, 17 Sep 2018 12:30:51 -0400 Message-Id: <20180917163103.6113-24-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180917163103.6113-1-cota@braap.org> References: <20180917163103.6113-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.147.123.25 Subject: [Qemu-devel] [PATCH 23/35] target/s390x: access cpu->interrupt_request with atomics X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Hildenbrand , Cornelia Huck , Alexander Graf , Christian Borntraeger , qemu-s390x@nongnu.org, Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Cc: Cornelia Huck Cc: Christian Borntraeger Cc: Alexander Graf Cc: Richard Henderson Cc: David Hildenbrand Cc: qemu-s390x@nongnu.org Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota Reviewed-by: David Hildenbrand Reviewed-by: Cornelia Huck --- hw/intc/s390_flic.c | 2 +- target/s390x/cpu.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/intc/s390_flic.c b/hw/intc/s390_flic.c index 5f8168f0f0..bce07c8a1e 100644 --- a/hw/intc/s390_flic.c +++ b/hw/intc/s390_flic.c @@ -189,7 +189,7 @@ static void qemu_s390_flic_notify(uint32_t type) CPU_FOREACH(cs) { S390CPU *cpu = S390_CPU(cs); - cs->interrupt_request |= CPU_INTERRUPT_HARD; + atomic_or(&cs->interrupt_request, CPU_INTERRUPT_HARD); /* ignore CPUs that are not sleeping */ if (s390_cpu_get_state(cpu) != S390_CPU_STATE_OPERATING && diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index 8ed4823d6e..d4c93abc29 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -65,7 +65,7 @@ static bool s390_cpu_has_work(CPUState *cs) return false; } - if (!(cs->interrupt_request & CPU_INTERRUPT_HARD)) { + if (!(atomic_read(&cs->interrupt_request) & CPU_INTERRUPT_HARD)) { return false; } From patchwork Mon Sep 17 16:30:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 970711 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="00aLZuqC"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="b1D9mKKX"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42DX9r3WnQz9sfR for ; Tue, 18 Sep 2018 02:48:00 +1000 (AEST) Received: from localhost ([::1]:36528 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wgn-00030w-Qk for incoming@patchwork.ozlabs.org; Mon, 17 Sep 2018 12:47:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41127) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wQo-0006Qr-SE for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1wQl-0002Ae-JI for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:26 -0400 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:35653) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g1wQl-0001qL-99 for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:23 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id D1F92559; Mon, 17 Sep 2018 12:31:10 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 17 Sep 2018 12:31:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=U55KPyctr2mt+v Z3lYdfZNe58eKAjn0rRrHIADtku2k=; b=00aLZuqCEk7ByIBukxy580VFQTkJVg WQqbLmPrwfuBRnt1D/dTq9egU1SXXU2inTsndmelQBagdXECwbqkOtvn+X/g6qga jnV0u8gYB/KATVE5uX042WQEniWuqmftR0ncgO7ZqIwKEnC/5Km8zDVVbKSh7ec3 RSgbtBAPChR3w= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=U55KPyctr2mt+vZ3lYdfZNe58eKAjn0rRrHIADtku2k=; b=b1D9mKKX 1DvZ9i9ULcaXmQb+AAelXsF9uyKs3YmR5W6A3O7eArztooVYuxffsdYD83HyUXtD A+Q2m71oIy1wADecIWIzCyd1u/neGRJWp0f2Y1pKlgfbwj2nWBAB/ok8jZ/h/pGK lm13DIo7B7tvSD/bmK1g/ucF829DBdmf6k/ZkSRsuzysPACwZd+qPdqkVY4JjadN dVZqbB7gC6RESx/bxgbQbHMSC6cw+vCBo6OHQG6oxHZXZd3d94WrZM4u+W8AjVKJ FLoULLqVcXucCygLdF85PUhcNHKDI1pIhzOiXcGSfg6gbv0drRjzZC8C5t5a9I+M PuM06f7JIQBbBA== X-ME-Proxy: X-ME-Sender: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 32661E4626; Mon, 17 Sep 2018 12:31:10 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Mon, 17 Sep 2018 12:30:52 -0400 Message-Id: <20180917163103.6113-25-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180917163103.6113-1-cota@braap.org> References: <20180917163103.6113-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.147.123.25 Subject: [Qemu-devel] [PATCH 24/35] target/sh4: access cpu->interrupt_request with atomics X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Cc: Aurelien Jarno Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota Reviewed-by: Philippe Mathieu-Daudé --- target/sh4/cpu.c | 2 +- target/sh4/helper.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c index b9f393b7c7..892a023c5c 100644 --- a/target/sh4/cpu.c +++ b/target/sh4/cpu.c @@ -45,7 +45,7 @@ static void superh_cpu_synchronize_from_tb(CPUState *cs, TranslationBlock *tb) static bool superh_cpu_has_work(CPUState *cs) { - return cs->interrupt_request & CPU_INTERRUPT_HARD; + return atomic_read(&cs->interrupt_request) & CPU_INTERRUPT_HARD; } /* CPUClass::reset() */ diff --git a/target/sh4/helper.c b/target/sh4/helper.c index 2ff0cf4060..c699b8c0a1 100644 --- a/target/sh4/helper.c +++ b/target/sh4/helper.c @@ -83,7 +83,7 @@ void superh_cpu_do_interrupt(CPUState *cs) { SuperHCPU *cpu = SUPERH_CPU(cs); CPUSH4State *env = &cpu->env; - int do_irq = cs->interrupt_request & CPU_INTERRUPT_HARD; + int do_irq = atomic_read(&cs->interrupt_request) & CPU_INTERRUPT_HARD; int do_exp, irq_vector = cs->exception_index; /* prioritize exceptions over interrupts */ From patchwork Mon Sep 17 16:30:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 970706 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="zBbWaTNF"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="NXnQmlR1"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42DX6l0YY4z9sfR for ; Tue, 18 Sep 2018 02:45:19 +1000 (AEST) Received: from localhost ([::1]:36511 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1weC-0000ks-LZ for incoming@patchwork.ozlabs.org; Mon, 17 Sep 2018 12:45:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41142) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wQo-0006Qx-Tn for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1wQl-0002B8-Q9 for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:26 -0400 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:42085) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g1wQl-0001qg-GV for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:23 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 3BB424FB; Mon, 17 Sep 2018 12:31:11 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 17 Sep 2018 12:31:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=LAtnK4Vd0SrZjQ lnV4Z/oudPnyZQDCKx7KR9W5Dyqh0=; b=zBbWaTNFe8fChyaW4fI3bQkKsrR4it cGTz/BKwpjICGZ4Dyjtqw/49q4g9HIZtjvqcMR8k4L6RxMf39G8LkIpwfjomTruN j+M6gjJsQZ7PeuzU0ohlpb1qqeMyniNrSzB5bRwUyNpiFdK2kbdO/F7clRpx9BSr OHePlyed+ZdtM= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=LAtnK4Vd0SrZjQlnV4Z/oudPnyZQDCKx7KR9W5Dyqh0=; b=NXnQmlR1 kOssNOZap6VtRLZHGSG5U4fNQTnCCWIMiXV48DezMQaJa0HxuSo3gagGBCZRFLaW Goi8EfKoHE8CaTCEhnKcei4FBSWkpBjvQbn5WBFe55GtTRHRP0JMMBbTzvmYqYxr jaayVhQOwYxD16AozTHhQMSCDsU/JG//AY9j+VShrJFZsiVIklI2QBXJjZ/jTTsj sv4Bfp2j24ZcGiqXU9A+/qgzyvSuSflCMTVk9mXjW+T9/gy46DweXMX+P3Q7jVs3 bYoPnNqy91qa+LVcqyMk0Sy+kdsXRs5rZ+kkjFfUiYD5DLaunYevUn8zRX9XOVAd rn/rjtC2MPj9eg== X-ME-Proxy: X-ME-Sender: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 6D795E49C8; Mon, 17 Sep 2018 12:31:10 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Mon, 17 Sep 2018 12:30:53 -0400 Message-Id: <20180917163103.6113-26-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180917163103.6113-1-cota@braap.org> References: <20180917163103.6113-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.147.123.25 Subject: [Qemu-devel] [PATCH 25/35] target/sparc: access cpu->interrupt_request with atomics X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Mark Cave-Ayland , Artyom Tarasenko Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Cc: Mark Cave-Ayland Cc: Artyom Tarasenko Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota Reviewed-by: Philippe Mathieu-Daudé --- target/sparc/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index 0f090ece54..cac7e18fc7 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -709,7 +709,7 @@ static bool sparc_cpu_has_work(CPUState *cs) SPARCCPU *cpu = SPARC_CPU(cs); CPUSPARCState *env = &cpu->env; - return (cs->interrupt_request & CPU_INTERRUPT_HARD) && + return (atomic_read(&cs->interrupt_request) & CPU_INTERRUPT_HARD) && cpu_interrupts_enabled(env); } From patchwork Mon Sep 17 16:30:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 970709 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="a6ohTpCW"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="Vw4B0K3y"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42DX8l2G45z9sfR for ; Tue, 18 Sep 2018 02:47:03 +1000 (AEST) Received: from localhost ([::1]:36522 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wfs-0002Jm-S2 for incoming@patchwork.ozlabs.org; Mon, 17 Sep 2018 12:47:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41139) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wQo-0006Qv-Sr for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1wQl-0002BD-Q6 for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:26 -0400 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:46921) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g1wQl-0001qh-Gt for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:23 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 7BCEB4F8; Mon, 17 Sep 2018 12:31:11 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 17 Sep 2018 12:31:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=XOPptgPDd8Ymni lD5H+LO1n6bKRL3qkzlwJGlcWrNEg=; b=a6ohTpCWY1dwfVcDWQbf/dA1nx1Ykm ZzmsmYMe19UcTTQ0lZgFAPOYuVyBUqig7LEMuOd5xNnaXlIxEzntFztC7jnKFtPD LJ53h3jwK89QFN0EEQmZHyucWXj+yyhl+fTn2eAb+Ck/zzTfdSVBI5R43NmrxuZR LXBOZv79zHWDY= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=XOPptgPDd8YmnilD5H+LO1n6bKRL3qkzlwJGlcWrNEg=; b=Vw4B0K3y tPXGlFtfXPYg7xSnzSsEbzBPZ8AplvVGQQNpEvevBKslkCUAE3CbLrXiiZhd0YZE OVp+xzRLuGKKaatZ7zOPEN6+1vtKfhn7uiBgxXDkUM8gkJQ88huMjuGOMYZu7mNi QlVdRTr2bZ5VzN70z76l1cWIxWQYiP/NHvjl/JbageRjo+M9sLlA1ZnKmGQhOuP6 xzclWyU1srGueeaB5iqa19MP3L/ft8ipAd/pohHWjkJrP2CFUFutYmrRPvwCfxBt TtSUGmp2LDjkMf+Y7z3koZiFuSijOug17dLvnNd5wLBPIBjCAVoPaNjiu2c64GOD 4AiN2Ii/eeR96Q== X-ME-Proxy: X-ME-Sender: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id AB86EE4121; Mon, 17 Sep 2018 12:31:10 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Mon, 17 Sep 2018 12:30:54 -0400 Message-Id: <20180917163103.6113-27-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180917163103.6113-1-cota@braap.org> References: <20180917163103.6113-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.147.123.25 Subject: [Qemu-devel] [PATCH 26/35] target/unicore32: access cpu->interrupt_request with atomics X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Guan Xuetao Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Cc: Guan Xuetao Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota Reviewed-by: Philippe Mathieu-Daudé --- target/unicore32/cpu.c | 2 +- target/unicore32/softmmu.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/target/unicore32/cpu.c b/target/unicore32/cpu.c index 68f978d80b..4e4ee2ee78 100644 --- a/target/unicore32/cpu.c +++ b/target/unicore32/cpu.c @@ -29,7 +29,7 @@ static void uc32_cpu_set_pc(CPUState *cs, vaddr value) static bool uc32_cpu_has_work(CPUState *cs) { - return cs->interrupt_request & + return atomic_read(&cs->interrupt_request) & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_EXITTB); } diff --git a/target/unicore32/softmmu.c b/target/unicore32/softmmu.c index 00c7e0d028..d84ef67d0d 100644 --- a/target/unicore32/softmmu.c +++ b/target/unicore32/softmmu.c @@ -119,7 +119,7 @@ void uc32_cpu_do_interrupt(CPUState *cs) /* The PC already points to the proper instruction. */ env->regs[30] = env->regs[31]; env->regs[31] = addr; - cs->interrupt_request |= CPU_INTERRUPT_EXITTB; + atomic_or(&cs->interrupt_request, CPU_INTERRUPT_EXITTB); } static int get_phys_addr_ucv2(CPUUniCore32State *env, uint32_t address, From patchwork Mon Sep 17 16:30:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 970724 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="UlbWsqIY"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="P0Rd7ol8"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42DXN83TYMz9sfR for ; Tue, 18 Sep 2018 02:56:56 +1000 (AEST) Received: from localhost ([::1]:36584 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wpS-0002Rh-3e for incoming@patchwork.ozlabs.org; Mon, 17 Sep 2018 12:56:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41119) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wQo-0006Qj-RL for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1wQl-0002Ax-PP for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:26 -0400 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:37259) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g1wQl-0001qk-FD for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:23 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id A42A0502; Mon, 17 Sep 2018 12:31:11 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 17 Sep 2018 12:31:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=gXWIp9F4gCOJoi UjXjy/SXTaBlFm1x/QOrAJ+lbbrXo=; b=UlbWsqIYg4/ScjbAD6IuUWpaCuKZOx gieZaapnM6LSxRy2gc0bsuMcaarR4NscPa26wu57k27RvJDy4/4XEH4doJ3X3xmM wZqF6Nluxn8RanCjuf93PmljDLfqeK3V4FaM0WI1JiLq0AEIMSOYv2SAQiUHa9Gj kVNxqN49V0JjM= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=gXWIp9F4gCOJoiUjXjy/SXTaBlFm1x/QOrAJ+lbbrXo=; b=P0Rd7ol8 Xxg2tMYvEjpU+x0kIKlIVELlffz/mi5d2cYOisy8glcn8TwtGLCkrQ2LRZwg2Hlp rn6GG/j6NmZOO9viNtd+Ahe6QPa+Y0cxd7JgUsnIrc1q5TTrgD9xX4kj3y+O/cuJ 4AvEjvvo6OjZdmbbyjBXWIQAX225ErAAd+q2PTQ031TGNmUCw5/f2xKY7DT8koXP NVush2ZHZ/UxyZirC7xqmb1d7DZW6d3cTsUB2asSVpKcuUmEdHSvrYLrNn5jmwC7 qoRFXWtrdSk5AQ53T+SeB5q4R6mE3qioTtOP7eMbOMW0zbgUIugE+X9UGeVuHp/E zo4gE6CxBZrDzg== X-ME-Proxy: X-ME-Sender: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id E44E3E49CB; Mon, 17 Sep 2018 12:31:10 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Mon, 17 Sep 2018 12:30:55 -0400 Message-Id: <20180917163103.6113-28-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180917163103.6113-1-cota@braap.org> References: <20180917163103.6113-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.147.123.25 Subject: [Qemu-devel] [PATCH 27/35] hw/sparc64: access cpu->interrupt_request with atomics X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Mark Cave-Ayland , Artyom Tarasenko Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Cc: Mark Cave-Ayland Cc: Artyom Tarasenko Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota Reviewed-by: Philippe Mathieu-Daudé --- hw/sparc64/sparc64.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/sparc64/sparc64.c b/hw/sparc64/sparc64.c index 408388945e..d7be7a2fb2 100644 --- a/hw/sparc64/sparc64.c +++ b/hw/sparc64/sparc64.c @@ -56,7 +56,7 @@ void cpu_check_irqs(CPUSPARCState *env) /* The bit corresponding to psrpil is (1<< psrpil), the next bit is (2 << psrpil). */ if (pil < (2 << env->psrpil)) { - if (cs->interrupt_request & CPU_INTERRUPT_HARD) { + if (atomic_read(&cs->interrupt_request) & CPU_INTERRUPT_HARD) { trace_sparc64_cpu_check_irqs_reset_irq(env->interrupt_index); env->interrupt_index = 0; cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD); @@ -87,7 +87,7 @@ void cpu_check_irqs(CPUSPARCState *env) break; } } - } else if (cs->interrupt_request & CPU_INTERRUPT_HARD) { + } else if (atomic_read(&cs->interrupt_request) & CPU_INTERRUPT_HARD) { trace_sparc64_cpu_check_irqs_disabled(pil, env->pil_in, env->softint, env->interrupt_index); env->interrupt_index = 0; From patchwork Mon Sep 17 16:30:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 970712 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="pSvUjx0w"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="OHWRSdb4"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42DXBD2jSPz9sfR for ; Tue, 18 Sep 2018 02:48:20 +1000 (AEST) Received: from localhost ([::1]:36530 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wh7-0003bK-OF for incoming@patchwork.ozlabs.org; Mon, 17 Sep 2018 12:48:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41118) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wQo-0006Qh-RL for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1wQl-0002BL-Qu for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:26 -0400 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:53639) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g1wQl-0001qm-CL for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:23 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id D843F536; Mon, 17 Sep 2018 12:31:11 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 17 Sep 2018 12:31:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=CQs0jtIvoqX44H vh8iJ48dyFTmAHSgPQM3njTh9rXI0=; b=pSvUjx0wjgvwbyNj5A7rQC6EaiMeX7 tMjRlBVPaVAFeNg83N2y1BSHJx1ecK2OIrvTDbWBmuTNxSrhHh2S4hUS6ocAfkXX 3dWA8gwH90EJgSP9obSJQBCg0MgKb0dv7H5GRYHVmoT76U0us19jCqtJqwzyQ5s6 H3bfNyLmgzrL4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=CQs0jtIvoqX44Hvh8iJ48dyFTmAHSgPQM3njTh9rXI0=; b=OHWRSdb4 WVhhlzoo3cL2eo94kG8T2s7PvMcDMXwCNbOnXclJB1dwJDyYUi7/KK52cRpNIgI8 NHJSeOMAZdR1AIR8dXUse1Zl679QwZe8P/khlq1sis8bYesfE1hOQtkLHRSrZfDd coVn7OAhnoyHkIxWTddD5Q/bxz+HzrMaN8d+qR+KpEAX3PKOLdmWzZqhzwEYYAvC C8ga7tg3BrzvRxAMynNIau54V6l15y8xnzMPKN3by+tCEmUZYIEcVR1aVCbPc+ql 44qIgnkP9ie0NmlQivENo/+vxcHNoGZJrdYu74EMCFbKA9f1u00I5CV4alPBrFHS OC6Qs5pPU7g+cw== X-ME-Proxy: X-ME-Sender: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 357F6E49C7; Mon, 17 Sep 2018 12:31:11 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Mon, 17 Sep 2018 12:30:56 -0400 Message-Id: <20180917163103.6113-29-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180917163103.6113-1-cota@braap.org> References: <20180917163103.6113-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.147.123.25 Subject: [Qemu-devel] [PATCH 28/35] exec: access cpu->interrupt_request with atomics X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson , Peter Crosthwaite Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Cc: Peter Crosthwaite Cc: Richard Henderson Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- accel/tcg/cpu-exec.c | 6 +++--- accel/tcg/tcg-all.c | 3 +-- accel/tcg/translate-all.c | 2 +- qom/cpu.c | 6 +++--- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 7ca00725ec..2383763f9b 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -426,7 +426,7 @@ static inline bool cpu_handle_halt(CPUState *cpu) { if (cpu->halted) { #if defined(TARGET_I386) && !defined(CONFIG_USER_ONLY) - if ((cpu->interrupt_request & CPU_INTERRUPT_POLL) + if ((atomic_read(&cpu->interrupt_request) & CPU_INTERRUPT_POLL) && replay_interrupt()) { X86CPU *x86_cpu = X86_CPU(cpu); qemu_mutex_lock_iothread(); @@ -527,7 +527,7 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, if (unlikely(atomic_read(&cpu->interrupt_request))) { int interrupt_request; qemu_mutex_lock_iothread(); - interrupt_request = cpu->interrupt_request; + interrupt_request = atomic_read(&cpu->interrupt_request); if (unlikely(cpu->singlestep_enabled & SSTEP_NOIRQ)) { /* Mask out external interrupts for this step. */ interrupt_request &= ~CPU_INTERRUPT_SSTEP_MASK; @@ -579,7 +579,7 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, } /* The target hook may have updated the 'cpu->interrupt_request'; * reload the 'interrupt_request' value */ - interrupt_request = cpu->interrupt_request; + interrupt_request = atomic_read(&cpu->interrupt_request); } if (interrupt_request & CPU_INTERRUPT_EXITTB) { cpu_reset_interrupt(cpu, CPU_INTERRUPT_EXITTB); diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c index 3d25bdcc17..69ad44bd54 100644 --- a/accel/tcg/tcg-all.c +++ b/accel/tcg/tcg-all.c @@ -41,8 +41,7 @@ static void tcg_handle_interrupt(CPUState *cpu, int mask) int old_mask; g_assert(qemu_mutex_iothread_locked()); - old_mask = cpu->interrupt_request; - cpu->interrupt_request |= mask; + old_mask = atomic_fetch_or(&cpu->interrupt_request, mask); /* * If called from iothread context, wake the target cpu in diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index f7784bbc2d..364757c677 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -2351,7 +2351,7 @@ void dump_opcount_info(FILE *f, fprintf_function cpu_fprintf) void cpu_interrupt(CPUState *cpu, int mask) { g_assert(qemu_mutex_iothread_locked()); - cpu->interrupt_request |= mask; + atomic_or(&cpu->interrupt_request, mask); atomic_set(&cpu->icount_decr.u16.high, -1); } diff --git a/qom/cpu.c b/qom/cpu.c index 20ad54d43f..e2dfbde7c4 100644 --- a/qom/cpu.c +++ b/qom/cpu.c @@ -103,7 +103,7 @@ void cpu_reset_interrupt(CPUState *cpu, int mask) if (need_lock) { qemu_mutex_lock_iothread(); } - cpu->interrupt_request &= ~mask; + atomic_and(&cpu->interrupt_request, ~mask); if (need_lock) { qemu_mutex_unlock_iothread(); } @@ -261,7 +261,7 @@ static void cpu_common_reset(CPUState *cpu) log_cpu_state(cpu, cc->reset_dump_flags); } - cpu->interrupt_request = 0; + atomic_set(&cpu->interrupt_request, 0); cpu->halted = 0; cpu->mem_io_pc = 0; cpu->mem_io_vaddr = 0; @@ -395,7 +395,7 @@ static vaddr cpu_adjust_watchpoint_address(CPUState *cpu, vaddr addr, int len) static void generic_handle_interrupt(CPUState *cpu, int mask) { - cpu->interrupt_request |= mask; + atomic_or(&cpu->interrupt_request, mask); if (!qemu_cpu_is_self(cpu)) { qemu_cpu_kick(cpu); From patchwork Mon Sep 17 16:30:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 970714 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="14jA0Bbj"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="Oo9dE8ue"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42DXDW6nGQz9sj1 for ; Tue, 18 Sep 2018 02:50:19 +1000 (AEST) Received: from localhost ([::1]:36539 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wj3-0005Gc-Fb for incoming@patchwork.ozlabs.org; Mon, 17 Sep 2018 12:50:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41321) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wR0-0006bP-F7 for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1wQv-0002dM-UB for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:37 -0400 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:50613) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g1wQv-00027z-Li for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:33 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 268813B6; Mon, 17 Sep 2018 12:31:12 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 17 Sep 2018 12:31:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=h6wPpCmKIfuPoD kgP/9maLzHowZnSqbjbqyRHUmI+ew=; b=14jA0BbjPQo8tyTq08R7/9vVeS7W2m jMhfQzfZA30+zNqzlwLh0LKsCTw25XF1ElNMPS/QYaHBjrlcsA6Imvd7oA+5SLFA if9I3AwDrTRSfp8dODVqHHxmkyanowPAM859VfuTOHefDPMr7Fmg4w35Y/lSuOGq jDiwjbCWYpzGA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=h6wPpCmKIfuPoDkgP/9maLzHowZnSqbjbqyRHUmI+ew=; b=Oo9dE8ue NkFvXWIQHKr26uqzQhkuRh0orpyS9HGjVQigxYAIfoymjV2eBRmJxvUKaMyectMS L3dajq956Pf3n0KGBQmMmcWtJ+lYhGpgj0P1bk+kIgOeOkggM4e196dXkW1bSqZC IJx+yijyuUakjcZ94pesP/W3kYfhPDEtHAmDtqhh8cC+QEPJAYeFVw5aGH1hBBio O+8AsOH8fxoss+8moRVw8bRr0XmqjrEZU3TineNxy2GuSnIUE1BBXxJRhaaPE25z bo2fW1S+6r5M5XNr/gInogZvOSgH3Q680lv0rxoKMqemwFYlqKrM8KoaqjjCDKuv lHTXMsDIm5sANA== X-ME-Proxy: X-ME-Sender: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 6BE02E4626; Mon, 17 Sep 2018 12:31:11 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Mon, 17 Sep 2018 12:30:57 -0400 Message-Id: <20180917163103.6113-30-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180917163103.6113-1-cota@braap.org> References: <20180917163103.6113-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.147.123.25 Subject: [Qemu-devel] [PATCH 29/35] exec: drop BQL from cpu_reset_interrupt X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson , Peter Crosthwaite Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Now that cpu->interrupt_request is accessed with atomics, we can drop the BQL around cpu_reset_interrupt, which is a step towards not taking the BQL mandatorily in cpu_exec_interrupt. Cc: Peter Crosthwaite Cc: Richard Henderson Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- qom/cpu.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/qom/cpu.c b/qom/cpu.c index e2dfbde7c4..6afe428069 100644 --- a/qom/cpu.c +++ b/qom/cpu.c @@ -94,19 +94,9 @@ static void cpu_common_get_memory_mapping(CPUState *cpu, error_setg(errp, "Obtaining memory mappings is unsupported on this CPU."); } -/* Resetting the IRQ comes from across the code base so we take the - * BQL here if we need to. cpu_interrupt assumes it is held.*/ void cpu_reset_interrupt(CPUState *cpu, int mask) { - bool need_lock = !qemu_mutex_iothread_locked(); - - if (need_lock) { - qemu_mutex_lock_iothread(); - } atomic_and(&cpu->interrupt_request, ~mask); - if (need_lock) { - qemu_mutex_unlock_iothread(); - } } void cpu_exit(CPUState *cpu) From patchwork Mon Sep 17 16:30:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 970722 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="haye0H2m"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="tjbTk32o"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42DXK40NjTz9sfR for ; Tue, 18 Sep 2018 02:54:16 +1000 (AEST) Received: from localhost ([::1]:36563 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wmr-0000At-J7 for incoming@patchwork.ozlabs.org; Mon, 17 Sep 2018 12:54:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41320) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wR0-0006bO-FM for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1wQv-0002dB-Sf for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:37 -0400 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:53707) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g1wQv-000282-KL for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:33 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 5090855B; Mon, 17 Sep 2018 12:31:12 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 17 Sep 2018 12:31:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=nJUoqieWNnLd20 TVnSJBgWOs3oX93EtL7iCQ8XhQkM0=; b=haye0H2mBK4OF7VJZmT+gsEWvfn6V2 G0yUYSawotjDyaB1CK0fBrHj7DP58/SlSaw7xr5SeGdu3HpSW2MYiXVXB7RD7u7u xUITED4e57+C93oDCxz+PMQF6RAiYA3tjtO8Gy75UzI6aDQoYPJzLGJ7LKG6yVgl 5tJKnxzo7+2bk= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=nJUoqieWNnLd20TVnSJBgWOs3oX93EtL7iCQ8XhQkM0=; b=tjbTk32o 07p3Dvi/PMRRwCdYcNkJWt+/xCVJ2Reh/0gAa96yddjJyziCbbLj0xhBLcBBABwf mZ2RU2yJBKl2eN7L8QaI7SIIBRKZF6g0lvL0shyYZfZftsgKj2mOfvi04e0Wt40p kke3iRsythoFot/IgqIp/gb9YwiaiWriuZ9i8tcE1hogSVQ0gqNTm/t7HcHg+xbm 54iYAuEa4SYSsW9SMYzjjiSm02qt2TMd6BE5veOBTNOYKeSqjfqYj6aiZ2NEA/ig vc40FW028GKD5n4NlXkdNZHXQ0oMxFqYlUBcRA5+L04TxCVnpLogJVmM7l89QvG+ 3yfEC04/S36Srg== X-ME-Proxy: X-ME-Sender: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 9D571E414C; Mon, 17 Sep 2018 12:31:11 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Mon, 17 Sep 2018 12:30:58 -0400 Message-Id: <20180917163103.6113-31-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180917163103.6113-1-cota@braap.org> References: <20180917163103.6113-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.147.123.25 Subject: [Qemu-devel] [PATCH 30/35] tcg: drop BQL assertion from tcg_handle_interrupt X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson , Peter Crosthwaite Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Cc: Peter Crosthwaite Cc: Richard Henderson Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- accel/tcg/tcg-all.c | 1 - 1 file changed, 1 deletion(-) diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c index 69ad44bd54..8b8b9ab05c 100644 --- a/accel/tcg/tcg-all.c +++ b/accel/tcg/tcg-all.c @@ -39,7 +39,6 @@ unsigned long tcg_tb_size; static void tcg_handle_interrupt(CPUState *cpu, int mask) { int old_mask; - g_assert(qemu_mutex_iothread_locked()); old_mask = atomic_fetch_or(&cpu->interrupt_request, mask); From patchwork Mon Sep 17 16:30:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 970728 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="n0Cs5oli"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="fueMFHL/"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42DXPr4bZ2z9sfR for ; Tue, 18 Sep 2018 02:58:24 +1000 (AEST) Received: from localhost ([::1]:36592 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wqs-0003xY-Ao for incoming@patchwork.ozlabs.org; Mon, 17 Sep 2018 12:58:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41318) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wR0-0006bM-F5 for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1wQv-0002d4-Ri for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:37 -0400 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:53461) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g1wQv-000285-K2 for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:33 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 97AB851F; Mon, 17 Sep 2018 12:31:12 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 17 Sep 2018 12:31:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=w2A0CO7O7beoCC 7QQHsmRYNwUcQVmmoIN/9dB6rj5Ho=; b=n0Cs5olioonEUn681FuvAlrpAajIsN wT3egymFv17JwtaRVrDzeA6ijxL9WMayCe5/854Kr/8DxCUMo7TE7Q4vMn4Ifx6D nGkB6XrEvPZmBvLp/SR0BdCMooARdy+GwnZyWVKLa0RRaOvjA3EViRYRB3jhkgt6 fKPx1CefelDQU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=w2A0CO7O7beoCC7QQHsmRYNwUcQVmmoIN/9dB6rj5Ho=; b=fueMFHL/ Y0U3e1y4M8AWKbmutHCgnpK6aQOMLPpeIWzT+sNBbYTzffCfQ9wesUPe0nP+BFrd O9N0/nP/K5dhvXT0WOovIEZGmapf7x4G2o7EgACVtUe7vOPTVq6NfJH8Wd/umBtz heWZ4qFcuv9YJ9myqYgoun8EiczdGoOxKkfksjrl1SWkk/L1shfDdLAPkzYkBJk/ QGOh22gCbFnJGa9rtUMzm29zuazfy8YQUBwoFwDFUEQKhtK23iYwubEITiu4IUyh nQIQYDUtYZlJLeXO2CoTP6yoCr7KGAVaKc8ZtRAbwlU4l27hc6gv2gSoIEKVIAfc lTiT7yn/f9Ulqw== X-ME-Proxy: X-ME-Sender: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id D2394E49C8; Mon, 17 Sep 2018 12:31:11 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Mon, 17 Sep 2018 12:30:59 -0400 Message-Id: <20180917163103.6113-32-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180917163103.6113-1-cota@braap.org> References: <20180917163103.6113-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.147.123.25 Subject: [Qemu-devel] [PATCH 31/35] translate-all: drop BQL assertion from cpu_interrupt X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson , Peter Crosthwaite Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This patch explicitly drops the BQL assertion from the user-mode version; previous patches have taken care of softmmu's cpu_interrupt. Cc: Peter Crosthwaite Cc: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- accel/tcg/translate-all.c | 1 - 1 file changed, 1 deletion(-) diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 364757c677..911436a8d7 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -2350,7 +2350,6 @@ void dump_opcount_info(FILE *f, fprintf_function cpu_fprintf) void cpu_interrupt(CPUState *cpu, int mask) { - g_assert(qemu_mutex_iothread_locked()); atomic_or(&cpu->interrupt_request, mask); atomic_set(&cpu->icount_decr.u16.high, -1); } From patchwork Mon Sep 17 16:31:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 970729 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="JPrZ9idE"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="kRKNOdqe"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42DXQt49Bqz9sj1 for ; Tue, 18 Sep 2018 02:59:18 +1000 (AEST) Received: from localhost ([::1]:36595 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wrk-0004jW-3W for incoming@patchwork.ozlabs.org; Mon, 17 Sep 2018 12:59:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41316) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wR0-0006bL-F6 for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1wQv-0002dG-TU for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:37 -0400 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:40931) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g1wQv-000287-Lw for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:33 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id D0D00508; Mon, 17 Sep 2018 12:31:12 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 17 Sep 2018 12:31:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=4G+OwN0ryq4OH1 Lyn0mclEG6xDeM6ufrdpAJS8PXT04=; b=JPrZ9idE5m+3u5pl3peyXscGpLDcUe fwkZkvBalciTsroBO34FAwgA3EIItJiXi6YXRCPiW3kVPsLWM2LAESVJbKlAlfYq Zy7Fjz+jBXWzJvvgjo1g2oh9hxB9ka/EG++M/NGHEv40376EZFpLMGYdRdAkdemn qUEu6TyzMjzPs= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=4G+OwN0ryq4OH1Lyn0mclEG6xDeM6ufrdpAJS8PXT04=; b=kRKNOdqe hxNcTqQ5T+kKlep/VRFFfFR6r6gl1JA++6LlPKwxdnAiBLM/BWepOF271utgnQzi p4XnlGZgftczkBhDbAiHHoOsoP54k56nPib8pmK2akfd4xoChFrPwVETTdA6CWDe zcGpgDO4bwu6We+2z8o3M1KiH9sC+vkfy/1VRdzFrt+5rUsmAYdg+ZenAAYlVczy Ss1M7NsKOVETbltNXBibo0gcAue3c8fPIntaHmpTdbijlIht0bFl3qmE3E2FE1E+ CktHb269ikdsG5zaGIPD1JF7M9wCc/HBkxzlqVTCuXExECVfOja7jFrkdXDR/s+v t7/95aeWATWb8g== X-ME-Proxy: X-ME-Sender: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 15BBBE4121; Mon, 17 Sep 2018 12:31:12 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Mon, 17 Sep 2018 12:31:00 -0400 Message-Id: <20180917163103.6113-33-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180917163103.6113-1-cota@braap.org> References: <20180917163103.6113-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.147.123.25 Subject: [Qemu-devel] [PATCH 32/35] target/i386/kvm: do not acquire the BQL to call cpu_reset_interrupt X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Marcelo Tosatti , Eduardo Habkost , kvm@vger.kernel.org, Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini It's not needed anymore. Cc: Marcelo Tosatti Cc: Richard Henderson Cc: Eduardo Habkost Cc: kvm@vger.kernel.org Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- target/i386/kvm.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/target/i386/kvm.c b/target/i386/kvm.c index e40c8d5461..41c4830be8 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -3007,9 +3007,7 @@ void kvm_arch_pre_run(CPUState *cpu, struct kvm_run *run) /* Inject NMI */ if (interrupt_request & (CPU_INTERRUPT_NMI | CPU_INTERRUPT_SMI)) { if (interrupt_request & CPU_INTERRUPT_NMI) { - qemu_mutex_lock_iothread(); cpu_reset_interrupt(cpu, CPU_INTERRUPT_NMI); - qemu_mutex_unlock_iothread(); DPRINTF("injected NMI\n"); ret = kvm_vcpu_ioctl(cpu, KVM_NMI); if (ret < 0) { @@ -3018,9 +3016,7 @@ void kvm_arch_pre_run(CPUState *cpu, struct kvm_run *run) } } if (atomic_read(&cpu->interrupt_request) & CPU_INTERRUPT_SMI) { - qemu_mutex_lock_iothread(); cpu_reset_interrupt(cpu, CPU_INTERRUPT_SMI); - qemu_mutex_unlock_iothread(); DPRINTF("injected SMI\n"); ret = kvm_vcpu_ioctl(cpu, KVM_SMI); if (ret < 0) { From patchwork Mon Sep 17 16:31:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 970731 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="Lz09YT7G"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="X0OMZYxP"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42DXTK0HXxz9sfR for ; Tue, 18 Sep 2018 03:01:24 +1000 (AEST) Received: from localhost ([::1]:36623 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wtl-0006HG-B1 for incoming@patchwork.ozlabs.org; Mon, 17 Sep 2018 13:01:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41413) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wRA-0006ku-BQ for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1wR6-0002oV-78 for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:48 -0400 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:36133) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g1wR5-000288-LK; Mon, 17 Sep 2018 12:31:44 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 0AD06515; Mon, 17 Sep 2018 12:31:12 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 17 Sep 2018 12:31:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=VBw3rs8i9Ep5By +D5iIiQkWbt8WbGdKV8YbUT9qWBLc=; b=Lz09YT7G79G6gvXe2n6Nt/39vYMJ8i B4oOVERw5fkJdiWGxTgg3sxgj2LX3/xHGHUbZX8lCFH+yUurfCUXFh35+g/f9j54 0Vhx0Y5z79mgrBT1dncLkXwLgdTjNuNW+vq/SACz4WPJOEQfZhIaWhZvibnOVike Cw9S6xKSVguOA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=VBw3rs8i9Ep5By+D5iIiQkWbt8WbGdKV8YbUT9qWBLc=; b=X0OMZYxP pd43AauG3+NTwfe0PUqWAuQbDrs9k3Gbl0XiAZo5ZmkY+YPA6OtTbJSwpAiC9Rq/ m9RCdFwpem3ciIf4g4mfbYSS5g40LIIvnuEXWGidcbfTW8VYVdAqCXt/946nz9ud 5sbvbUztoWp0eiIjDZlsv5RR5u8Bpsnyusr8vqa4fcWZLBz5rWaTfpB0+ldf3uCJ KG14Q8rOFqBIXU4sgSKbEy4nQwf5jL3HVvU15yEGjgWTM0ZPVR/dTOFtm1vipMBl IlglYH/pBYSRyUxKTEeYuOAZiLOSkquYk7wg0upy3YftfZWLGpICK5eXGySP0+Ny LhHono9GcLzWLw== X-ME-Proxy: X-ME-Sender: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 4F051E49C5; Mon, 17 Sep 2018 12:31:12 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Mon, 17 Sep 2018 12:31:01 -0400 Message-Id: <20180917163103.6113-34-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180917163103.6113-1-cota@braap.org> References: <20180917163103.6113-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.147.123.25 Subject: [Qemu-devel] [PATCH 33/35] target/ppc: do not acquire the BQL to call cpu_interrupt X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , qemu-ppc@nongnu.org, Alexander Graf , David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" It's not needed anymore. Cc: David Gibson Cc: Alexander Graf Cc: qemu-ppc@nongnu.org Signed-off-by: Emilio G. Cota Acked-by: David Gibson --- target/ppc/helper_regs.h | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/target/ppc/helper_regs.h b/target/ppc/helper_regs.h index 5efd18049e..801eba83e7 100644 --- a/target/ppc/helper_regs.h +++ b/target/ppc/helper_regs.h @@ -101,13 +101,7 @@ static inline void hreg_compute_hflags(CPUPPCState *env) static inline void cpu_interrupt_exittb(CPUState *cs) { - if (!qemu_mutex_iothread_locked()) { - qemu_mutex_lock_iothread(); - cpu_interrupt(cs, CPU_INTERRUPT_EXITTB); - qemu_mutex_unlock_iothread(); - } else { - cpu_interrupt(cs, CPU_INTERRUPT_EXITTB); - } + cpu_interrupt(cs, CPU_INTERRUPT_EXITTB); } static inline int hreg_store_msr(CPUPPCState *env, target_ulong value, From patchwork Mon Sep 17 16:31:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 970698 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="V9xJKZ+K"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="blCjPF1q"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42DX2f6x1wz9sfR for ; Tue, 18 Sep 2018 02:41:46 +1000 (AEST) Received: from localhost ([::1]:36492 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wam-0006Hz-EZ for incoming@patchwork.ozlabs.org; Mon, 17 Sep 2018 12:41:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40944) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wQh-0006IS-Mr for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1wQg-0001zO-AT for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:19 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:52667) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g1wQb-0001r3-Bf; Mon, 17 Sep 2018 12:31:13 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 1E43121C24; Mon, 17 Sep 2018 12:31:13 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 17 Sep 2018 12:31:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=Ut/+pHtOZtdCXd OQp4BVjkn7ndqIM1yGLNjjk5kK6wE=; b=V9xJKZ+KIRZ2qhbEe8Z35JXNwS70bf ihMynnnPvtNn4mMDE/WzldoLF1+si747gYnSNuWcrn3ulRVLLM5wk8H/D8og8CMc JNw98COFXRVWiaDYdmcAGHkSFozrH1BSdCaMzB2s/rcDzAnxJyyhf4lEgkf5YM/f tv4TpuZvqhaVI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=Ut/+pHtOZtdCXdOQp4BVjkn7ndqIM1yGLNjjk5kK6wE=; b=blCjPF1q pbW5cP9HSa1oAanCd19N/U3YRVSlGC3w8Nxoe5VaujABETrxwd9gw0zpgmJkq47M D0EW5cT4TJSANefVqsZFL/7yDp4sa/iGFAD6oX1GZIKt61Hcpf8P0dhxKfhkX7S2 6xCZDrLM0/2IRiSfRPmkwBsU/KiZsPibWv8kICa4ZswHXFv2DQ2PItXV6ZO5ruom HG5Hez/8/B5z/VF9bCFNvMN0x3Tw7uhMG/9vw0tGfM6qGJWghIZWTR8kDVdvzh2H A9+f/mbsNCTNm47a19uBGwXIOTtEnZdHehpUsouWt8fi2HqjHaXPHnUWIi3W4OA2 GZP184DyfDk01A== X-ME-Proxy: X-ME-Sender: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 84AC2E49C7; Mon, 17 Sep 2018 12:31:12 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Mon, 17 Sep 2018 12:31:02 -0400 Message-Id: <20180917163103.6113-35-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180917163103.6113-1-cota@braap.org> References: <20180917163103.6113-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.25 Subject: [Qemu-devel] [PATCH 34/35] exec: push BQL down to cpu->do_interrupt X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Cornelia Huck , kvm@vger.kernel.org, David Hildenbrand , James Hogan , Anthony Green , Mark Cave-Ayland , "Edgar E. Iglesias" , Guan Xuetao , Marek Vasut , Alexander Graf , Christian Borntraeger , Richard Henderson , Artyom Tarasenko , Eduardo Habkost , qemu-s390x@nongnu.org, qemu-arm@nongnu.org, Stafford Horne , David Gibson , Chris Wulff , Peter Crosthwaite , Marcelo Tosatti , Laurent Vivier , Michael Walle , qemu-ppc@nongnu.org, Aleksandar Markovic , Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini cpu->do_interrupt can now be called with BQL held (from cpu->cpu_exec_interrupt) or without (from cpu_handle_exception). Only a few targets rely on global device state in cc->do_interrupt; add checks to those targets to acquire the BQL if not already held. Cc: Aleksandar Markovic Cc: Alexander Graf Cc: Anthony Green Cc: Artyom Tarasenko Cc: Aurelien Jarno Cc: Christian Borntraeger Cc: Chris Wulff Cc: Cornelia Huck Cc: David Gibson Cc: David Hildenbrand Cc: "Edgar E. Iglesias" Cc: Eduardo Habkost Cc: Guan Xuetao Cc: James Hogan Cc: kvm@vger.kernel.org Cc: Laurent Vivier Cc: Marcelo Tosatti Cc: Marek Vasut Cc: Mark Cave-Ayland Cc: Michael Walle Cc: Peter Crosthwaite Cc: Peter Maydell Cc: qemu-arm@nongnu.org Cc: qemu-ppc@nongnu.org Cc: qemu-s390x@nongnu.org Cc: Richard Henderson Cc: Stafford Horne Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota Acked-by: David Gibson Reviewed-by: David Hildenbrand Reviewed-by: Cornelia Huck --- accel/tcg/cpu-exec.c | 2 -- target/arm/helper.c | 28 ++++++++++++++++++++++++++-- target/ppc/excp_helper.c | 8 +++++++- target/s390x/excp_helper.c | 14 +++++++++++++- target/sh4/helper.c | 14 +++++++++++++- target/xtensa/helper.c | 16 ++++++++++++++-- 6 files changed, 73 insertions(+), 9 deletions(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 2383763f9b..b649e3d772 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -497,9 +497,7 @@ static inline bool cpu_handle_exception(CPUState *cpu, int *ret) #else if (replay_exception()) { CPUClass *cc = CPU_GET_CLASS(cpu); - qemu_mutex_lock_iothread(); cc->do_interrupt(cpu); - qemu_mutex_unlock_iothread(); cpu->exception_index = -1; } else if (!replay_has_interrupt()) { /* give a chance to iothread in replay mode */ diff --git a/target/arm/helper.c b/target/arm/helper.c index 22dbc42305..548278da14 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -7644,7 +7644,8 @@ gen_invep: return false; } -void arm_v7m_cpu_do_interrupt(CPUState *cs) +/* call with the BQL held */ +static void arm_v7m_cpu_do_interrupt_locked(CPUState *cs) { ARMCPU *cpu = ARM_CPU(cs); CPUARMState *env = &cpu->env; @@ -7828,6 +7829,17 @@ void arm_v7m_cpu_do_interrupt(CPUState *cs) v7m_exception_taken(cpu, lr, false, ignore_stackfaults); } +void arm_v7m_cpu_do_interrupt(CPUState *cs) +{ + if (qemu_mutex_iothread_locked()) { + arm_v7m_cpu_do_interrupt_locked(cs); + } else { + qemu_mutex_lock_iothread(); + arm_v7m_cpu_do_interrupt_locked(cs); + qemu_mutex_unlock_iothread(); + } +} + /* Function used to synchronize QEMU's AArch64 register set with AArch32 * register set. This is necessary when switching between AArch32 and AArch64 * execution state. @@ -8482,8 +8494,9 @@ static inline bool check_for_semihosting(CPUState *cs) * Do any appropriate logging, handle PSCI calls, and then hand off * to the AArch64-entry or AArch32-entry function depending on the * target exception level's register width. + * Call with the BQL held. */ -void arm_cpu_do_interrupt(CPUState *cs) +static void arm_cpu_do_interrupt_locked(CPUState *cs) { ARMCPU *cpu = ARM_CPU(cs); CPUARMState *env = &cpu->env; @@ -8534,6 +8547,17 @@ void arm_cpu_do_interrupt(CPUState *cs) } } +void arm_cpu_do_interrupt(CPUState *cs) +{ + if (qemu_mutex_iothread_locked()) { + arm_cpu_do_interrupt_locked(cs); + } else { + qemu_mutex_lock_iothread(); + arm_cpu_do_interrupt_locked(cs); + qemu_mutex_unlock_iothread(); + } +} + /* Return the exception level which controls this address translation regime */ static inline uint32_t regime_el(CPUARMState *env, ARMMMUIdx mmu_idx) { diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index 70ac10e23b..8b2cc48cad 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -742,7 +742,13 @@ void ppc_cpu_do_interrupt(CPUState *cs) PowerPCCPU *cpu = POWERPC_CPU(cs); CPUPPCState *env = &cpu->env; - powerpc_excp(cpu, env->excp_model, cs->exception_index); + if (qemu_mutex_iothread_locked()) { + powerpc_excp(cpu, env->excp_model, cs->exception_index); + } else { + qemu_mutex_lock_iothread(); + powerpc_excp(cpu, env->excp_model, cs->exception_index); + qemu_mutex_unlock_iothread(); + } } static void ppc_hw_interrupt(CPUPPCState *env) diff --git a/target/s390x/excp_helper.c b/target/s390x/excp_helper.c index f2b92d7cbc..931c0103c8 100644 --- a/target/s390x/excp_helper.c +++ b/target/s390x/excp_helper.c @@ -378,7 +378,8 @@ static void do_mchk_interrupt(CPUS390XState *env) load_psw(env, mask, addr); } -void s390_cpu_do_interrupt(CPUState *cs) +/* call with the BQL held */ +static void s390_cpu_do_interrupt_locked(CPUState *cs) { QEMUS390FLICState *flic = QEMU_S390_FLIC(s390_get_flic()); S390CPU *cpu = S390_CPU(cs); @@ -457,6 +458,17 @@ try_deliver: } } +void s390_cpu_do_interrupt(CPUState *cs) +{ + if (qemu_mutex_iothread_locked()) { + s390_cpu_do_interrupt_locked(cs); + } else { + qemu_mutex_lock_iothread(); + s390_cpu_do_interrupt_locked(cs); + qemu_mutex_unlock_iothread(); + } +} + bool s390_cpu_exec_interrupt(CPUState *cs, int interrupt_request) { if (interrupt_request & CPU_INTERRUPT_HARD) { diff --git a/target/sh4/helper.c b/target/sh4/helper.c index c699b8c0a1..6c508cd006 100644 --- a/target/sh4/helper.c +++ b/target/sh4/helper.c @@ -79,7 +79,8 @@ int cpu_sh4_is_cached(CPUSH4State * env, target_ulong addr) #define MMU_DADDR_ERROR_READ (-12) #define MMU_DADDR_ERROR_WRITE (-13) -void superh_cpu_do_interrupt(CPUState *cs) +/* call with the BQL held */ +static void superh_cpu_do_interrupt_locked(CPUState *cs) { SuperHCPU *cpu = SUPERH_CPU(cs); CPUSH4State *env = &cpu->env; @@ -211,6 +212,17 @@ void superh_cpu_do_interrupt(CPUState *cs) } } +void superh_cpu_do_interrupt(CPUState *cs) +{ + if (qemu_mutex_iothread_locked()) { + superh_cpu_do_interrupt_locked(cs); + } else { + qemu_mutex_lock_iothread(); + superh_cpu_do_interrupt_locked(cs); + qemu_mutex_unlock_iothread(); + } +} + static void update_itlb_use(CPUSH4State * env, int itlbnb) { uint8_t or_mask = 0, and_mask = (uint8_t) - 1; diff --git a/target/xtensa/helper.c b/target/xtensa/helper.c index c9a6132700..ecafecdd3f 100644 --- a/target/xtensa/helper.c +++ b/target/xtensa/helper.c @@ -26,6 +26,7 @@ */ #include "qemu/osdep.h" +#include "qemu/main-loop.h" #include "qemu/units.h" #include "cpu.h" #include "exec/exec-all.h" @@ -251,8 +252,8 @@ static void handle_interrupt(CPUXtensaState *env) } } -/* Called from cpu_handle_interrupt with BQL held */ -void xtensa_cpu_do_interrupt(CPUState *cs) +/* Call with the BQL held */ +static void xtensa_cpu_do_interrupt_locked(CPUState *cs) { XtensaCPU *cpu = XTENSA_CPU(cs); CPUXtensaState *env = &cpu->env; @@ -305,6 +306,17 @@ void xtensa_cpu_do_interrupt(CPUState *cs) } check_interrupts(env); } + +void xtensa_cpu_do_interrupt(CPUState *cs) +{ + if (qemu_mutex_iothread_locked()) { + xtensa_cpu_do_interrupt_locked(cs); + } else { + qemu_mutex_lock_iothread(); + xtensa_cpu_do_interrupt_locked(cs); + qemu_mutex_unlock_iothread(); + } +} #else void xtensa_cpu_do_interrupt(CPUState *cs) { From patchwork Mon Sep 17 16:31:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 970694 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="t0k38ogx"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="SmlTA+CQ"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42DX0C509Lz9sj1 for ; Tue, 18 Sep 2018 02:39:39 +1000 (AEST) Received: from localhost ([::1]:36473 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wYj-0004XC-78 for incoming@patchwork.ozlabs.org; Mon, 17 Sep 2018 12:39:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40946) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wQh-0006Ib-RC for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1wQg-0001zI-9m for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:19 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:50525) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g1wQb-0001rC-Mg; Mon, 17 Sep 2018 12:31:13 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 5FB7D21C08; Mon, 17 Sep 2018 12:31:13 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 17 Sep 2018 12:31:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=hP3BNXg9fUYlH9 mrXcVwqXX3Jxaadm+2okW5WxgMl58=; b=t0k38ogxl8BXY3m2tREnHvB25lJWSx g7zD1EqEH2hkI/NKCUwrakORm783Rps0I45j5wns6R49X48sUQJ3hZbond7xAnLf qL07P//HmjW35o6l33xGtF5FyBMvVCeLHeQRqTwnKb/qr81BtmQDfXTNX0+zt1zC uh9twUe6DNil0= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=hP3BNXg9fUYlH9mrXcVwqXX3Jxaadm+2okW5WxgMl58=; b=SmlTA+CQ rAfSw6VLqvmOKbJubMF5E4CKJC//QJYrNksBWjBGbfw9zjAxmenfbkPFcOOiHxX+ /O5wOFm9kQ0QPvVIatmAW1+M4brmrmYOQ5SzHLr5TMEhhTYa55atqT1ofm22nuvV cTDkf/r4TG++b/N63ZDp9atkxQWtxa3FxNAAMtOcxeVWKhxrrZ6qRIvJq8+tr2Sg RaOK4TkdyyFcb+LH5eiwXtYH3wVkmF1Qxk2gvnQPIofvpzK3NuhkGhkg0UzTiXaL TSoy27LT51X8/8erpZr7jlajZamvoOEP0FPeNeE4KHqvA17kPazQaGtNz7Su9hDx eb/ii1gbjnRQXg== X-ME-Proxy: X-ME-Sender: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id D5505E49EC; Mon, 17 Sep 2018 12:31:12 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Mon, 17 Sep 2018 12:31:03 -0400 Message-Id: <20180917163103.6113-36-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180917163103.6113-1-cota@braap.org> References: <20180917163103.6113-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.25 Subject: [Qemu-devel] [PATCH 35/35] exec: push BQL down to cpu->cpu_exec_interrupt X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Cornelia Huck , kvm@vger.kernel.org, David Hildenbrand , James Hogan , Anthony Green , Mark Cave-Ayland , "Edgar E. Iglesias" , Guan Xuetao , Marek Vasut , Alexander Graf , Christian Borntraeger , Richard Henderson , Artyom Tarasenko , Eduardo Habkost , qemu-s390x@nongnu.org, qemu-arm@nongnu.org, Stafford Horne , David Gibson , Chris Wulff , Peter Crosthwaite , Marcelo Tosatti , Laurent Vivier , Michael Walle , qemu-ppc@nongnu.org, Aleksandar Markovic , Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Most interrupt requests do not need to take the BQL, and in fact most architectures do not need it at all. Push the BQL acquisition down to target code. Cc: Aleksandar Markovic Cc: Alexander Graf Cc: Anthony Green Cc: Artyom Tarasenko Cc: Aurelien Jarno Cc: Christian Borntraeger Cc: Chris Wulff Cc: Cornelia Huck Cc: David Gibson Cc: David Hildenbrand Cc: "Edgar E. Iglesias" Cc: Eduardo Habkost Cc: Guan Xuetao Cc: James Hogan Cc: kvm@vger.kernel.org Cc: Laurent Vivier Cc: Marcelo Tosatti Cc: Marek Vasut Cc: Mark Cave-Ayland Cc: Michael Walle Cc: Peter Crosthwaite Cc: Peter Maydell Cc: qemu-arm@nongnu.org Cc: qemu-ppc@nongnu.org Cc: qemu-s390x@nongnu.org Cc: Richard Henderson Cc: Stafford Horne Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota Acked-by: David Gibson --- docs/devel/multi-thread-tcg.txt | 7 +++++-- accel/tcg/cpu-exec.c | 9 +-------- target/arm/cpu.c | 15 ++++++++++++++- target/i386/seg_helper.c | 3 +++ target/ppc/excp_helper.c | 2 ++ target/s390x/excp_helper.c | 3 +++ 6 files changed, 28 insertions(+), 11 deletions(-) diff --git a/docs/devel/multi-thread-tcg.txt b/docs/devel/multi-thread-tcg.txt index 782bebc28b..422de4736b 100644 --- a/docs/devel/multi-thread-tcg.txt +++ b/docs/devel/multi-thread-tcg.txt @@ -231,8 +231,11 @@ BQL. Currently ARM targets serialise all ARM_CP_IO register accesses and also defer the reset/startup of vCPUs to the vCPU context by way of async_run_on_cpu(). -Updates to interrupt state are also protected by the BQL as they can -often be cross vCPU. +The CPUClass callbacks cpu_exec_interrupt and do_interrupt are invoked +without BQL protection. Accesses to the interrupt controller from +the vCPU thread, for example while processing CPU_INTERRUPT_HARD, must +either call qemu_mutex_lock_iothread/qemu_mutex_unlock_iothread or use +a separate mutex. Memory Consistency ================== diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index b649e3d772..f5e08e79d1 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -524,7 +524,7 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, if (unlikely(atomic_read(&cpu->interrupt_request))) { int interrupt_request; - qemu_mutex_lock_iothread(); + interrupt_request = atomic_read(&cpu->interrupt_request); if (unlikely(cpu->singlestep_enabled & SSTEP_NOIRQ)) { /* Mask out external interrupts for this step. */ @@ -533,7 +533,6 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, if (interrupt_request & CPU_INTERRUPT_DEBUG) { cpu_reset_interrupt(cpu, CPU_INTERRUPT_DEBUG); cpu->exception_index = EXCP_DEBUG; - qemu_mutex_unlock_iothread(); return true; } if (replay_mode == REPLAY_MODE_PLAY && !replay_has_interrupt()) { @@ -543,7 +542,6 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, cpu_reset_interrupt(cpu, CPU_INTERRUPT_HALT); cpu->halted = 1; cpu->exception_index = EXCP_HLT; - qemu_mutex_unlock_iothread(); return true; } #if defined(TARGET_I386) @@ -554,14 +552,12 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, cpu_svm_check_intercept_param(env, SVM_EXIT_INIT, 0, 0); do_cpu_init(x86_cpu); cpu->exception_index = EXCP_HALTED; - qemu_mutex_unlock_iothread(); return true; } #else else if (interrupt_request & CPU_INTERRUPT_RESET) { replay_interrupt(); cpu_reset(cpu); - qemu_mutex_unlock_iothread(); return true; } #endif @@ -585,9 +581,6 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, the program flow was changed */ *last_tb = NULL; } - - /* If we exit via cpu_loop_exit/longjmp it is reset in cpu_exec */ - qemu_mutex_unlock_iothread(); } /* Finally, check if we need to exit to the main loop. */ diff --git a/target/arm/cpu.c b/target/arm/cpu.c index e2c492efdf..246ea13d8f 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -347,7 +347,8 @@ static void arm_cpu_reset(CPUState *s) hw_watchpoint_update_all(cpu); } -bool arm_cpu_exec_interrupt(CPUState *cs, int interrupt_request) +/* call with the BQL held */ +static bool arm_cpu_exec_interrupt_locked(CPUState *cs, int interrupt_request) { CPUClass *cc = CPU_GET_CLASS(cs); CPUARMState *env = cs->env_ptr; @@ -401,6 +402,16 @@ bool arm_cpu_exec_interrupt(CPUState *cs, int interrupt_request) return ret; } +bool arm_cpu_exec_interrupt(CPUState *cs, int interrupt_request) +{ + bool ret; + + qemu_mutex_lock_iothread(); + ret = arm_cpu_exec_interrupt_locked(cs, interrupt_request); + qemu_mutex_unlock_iothread(); + return ret; +} + #if !defined(CONFIG_USER_ONLY) || !defined(TARGET_AARCH64) static bool arm_v7m_cpu_exec_interrupt(CPUState *cs, int interrupt_request) { @@ -409,6 +420,7 @@ static bool arm_v7m_cpu_exec_interrupt(CPUState *cs, int interrupt_request) CPUARMState *env = &cpu->env; bool ret = false; + qemu_mutex_lock_iothread(); /* ARMv7-M interrupt masking works differently than -A or -R. * There is no FIQ/IRQ distinction. Instead of I and F bits * masking FIQ and IRQ interrupts, an exception is taken only @@ -422,6 +434,7 @@ static bool arm_v7m_cpu_exec_interrupt(CPUState *cs, int interrupt_request) cc->do_interrupt(cs); ret = true; } + qemu_mutex_unlock_iothread(); return ret; } #endif diff --git a/target/i386/seg_helper.c b/target/i386/seg_helper.c index 0dd85329db..2fdfbd3c37 100644 --- a/target/i386/seg_helper.c +++ b/target/i386/seg_helper.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qemu/main-loop.h" #include "cpu.h" #include "qemu/log.h" #include "exec/helper-proto.h" @@ -1324,7 +1325,9 @@ bool x86_cpu_exec_interrupt(CPUState *cs, int interrupt_request) #if !defined(CONFIG_USER_ONLY) if (interrupt_request & CPU_INTERRUPT_POLL) { cpu_reset_interrupt(cs, CPU_INTERRUPT_POLL); + qemu_mutex_lock_iothread(); apic_poll_irq(cpu->apic_state); + qemu_mutex_unlock_iothread(); /* Don't process multiple interrupt requests in a single call. This is required to make icount-driven execution deterministic. */ return true; diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index 8b2cc48cad..57acba2a80 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -885,10 +885,12 @@ bool ppc_cpu_exec_interrupt(CPUState *cs, int interrupt_request) CPUPPCState *env = &cpu->env; if (interrupt_request & CPU_INTERRUPT_HARD) { + qemu_mutex_lock_iothread(); ppc_hw_interrupt(env); if (env->pending_interrupts == 0) { cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD); } + qemu_mutex_unlock_iothread(); return true; } return false; diff --git a/target/s390x/excp_helper.c b/target/s390x/excp_helper.c index 931c0103c8..f2a93abf01 100644 --- a/target/s390x/excp_helper.c +++ b/target/s390x/excp_helper.c @@ -480,10 +480,13 @@ bool s390_cpu_exec_interrupt(CPUState *cs, int interrupt_request) the parent EXECUTE insn. */ return false; } + qemu_mutex_lock_iothread(); if (s390_cpu_has_int(cpu)) { s390_cpu_do_interrupt(cs); + qemu_mutex_unlock_iothread(); return true; } + qemu_mutex_unlock_iothread(); if (env->psw.mask & PSW_MASK_WAIT) { /* Woken up because of a floating interrupt but it has already * been delivered. Go back to sleep. */