From: "Alex Bennée" <alex.bennee@linaro.org>
To: "Emilio G. Cota" <cota@braap.org>
Cc: qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
Richard Henderson <richard.henderson@linaro.org>
Subject: Re: [Qemu-devel] [RFC v4 57/71] accel/tcg: convert to cpu_interrupt_request
Date: Wed, 31 Oct 2018 16:46:33 +0000 [thread overview]
Message-ID: <87y3ae5aja.fsf@linaro.org> (raw)
In-Reply-To: <20181025144644.15464-57-cota@braap.org>
Emilio G. Cota <cota@braap.org> writes:
> Signed-off-by: Emilio G. Cota <cota@braap.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
> ---
> accel/tcg/cpu-exec.c | 15 ++++++++-------
> accel/tcg/tcg-all.c | 12 +++++++++---
> accel/tcg/translate-all.c | 2 +-
> 3 files changed, 18 insertions(+), 11 deletions(-)
>
> diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
> index f37c9b1e94..d590f1f6c0 100644
> --- a/accel/tcg/cpu-exec.c
> +++ b/accel/tcg/cpu-exec.c
> @@ -428,7 +428,7 @@ static inline bool cpu_handle_halt_locked(CPUState *cpu)
>
> if (cpu_halted(cpu)) {
> #if defined(TARGET_I386) && !defined(CONFIG_USER_ONLY)
> - if ((cpu->interrupt_request & CPU_INTERRUPT_POLL)
> + if ((cpu_interrupt_request(cpu) & CPU_INTERRUPT_POLL)
> && replay_interrupt()) {
> X86CPU *x86_cpu = X86_CPU(cpu);
>
> @@ -540,16 +540,17 @@ static inline bool cpu_handle_interrupt(CPUState *cpu,
> */
> atomic_mb_set(&cpu->icount_decr.u16.high, 0);
>
> - if (unlikely(atomic_read(&cpu->interrupt_request))) {
> + if (unlikely(cpu_interrupt_request(cpu))) {
> int interrupt_request;
> +
> qemu_mutex_lock_iothread();
> - interrupt_request = cpu->interrupt_request;
> + interrupt_request = cpu_interrupt_request(cpu);
> if (unlikely(cpu->singlestep_enabled & SSTEP_NOIRQ)) {
> /* Mask out external interrupts for this step. */
> 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;
> @@ -558,7 +559,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_set(cpu, 1);
> cpu->exception_index = EXCP_HLT;
> qemu_mutex_unlock_iothread();
> @@ -595,10 +596,10 @@ 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 = cpu_interrupt_request(cpu);
> }
> 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/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c
> index 3d25bdcc17..4e2fe70350 100644
> --- a/accel/tcg/tcg-all.c
> +++ b/accel/tcg/tcg-all.c
> @@ -39,10 +39,16 @@ 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 = cpu->interrupt_request;
> - cpu->interrupt_request |= mask;
> + if (!cpu_mutex_locked(cpu)) {
> + cpu_mutex_lock(cpu);
> + old_mask = cpu_interrupt_request(cpu);
> + cpu_interrupt_request_or(cpu, mask);
> + cpu_mutex_unlock(cpu);
> + } else {
> + old_mask = cpu_interrupt_request(cpu);
> + cpu_interrupt_request_or(cpu, 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 356dcd0948..038d82fdb5 100644
> --- a/accel/tcg/translate-all.c
> +++ b/accel/tcg/translate-all.c
> @@ -2340,7 +2340,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;
> + cpu_interrupt_request_or(cpu, mask);
> atomic_set(&cpu->icount_decr.u16.high, -1);
> }
--
Alex Bennée
next prev parent reply other threads:[~2018-10-31 16:46 UTC|newest]
Thread overview: 173+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-25 14:45 [Qemu-devel] [RFC v4 01/71] cpu: convert queued work to a QSIMPLEQ Emilio G. Cota
2018-10-25 14:45 ` [Qemu-devel] [RFC v4 02/71] cpu: rename cpu->work_mutex to cpu->lock Emilio G. Cota
2018-10-29 15:22 ` Alex Bennée
2018-10-25 14:45 ` [Qemu-devel] [RFC v4 03/71] cpu: introduce cpu_mutex_lock/unlock Emilio G. Cota
2018-10-26 14:40 ` Richard Henderson
2018-10-29 15:54 ` Alex Bennée
2018-10-25 14:45 ` [Qemu-devel] [RFC v4 04/71] cpu: make qemu_work_cond per-cpu Emilio G. Cota
2018-10-26 14:45 ` Richard Henderson
2018-10-30 12:27 ` Alex Bennée
2018-10-25 14:45 ` [Qemu-devel] [RFC v4 05/71] cpu: move run_on_cpu to cpus-common Emilio G. Cota
2018-10-29 16:34 ` Alex Bennée
2018-10-29 21:39 ` Emilio G. Cota
2018-10-30 8:28 ` Paolo Bonzini
2018-10-30 12:23 ` Alex Bennée
2018-10-25 14:45 ` [Qemu-devel] [RFC v4 06/71] cpu: introduce process_queued_cpu_work_locked Emilio G. Cota
2018-10-29 16:35 ` Alex Bennée
2018-10-25 14:45 ` [Qemu-devel] [RFC v4 07/71] tcg-runtime: define helper_cpu_halted_set Emilio G. Cota
2018-10-26 14:57 ` Richard Henderson
2018-10-25 14:45 ` [Qemu-devel] [RFC v4 08/71] ppc: convert to helper_cpu_halted_set Emilio G. Cota
2018-10-26 14:57 ` Richard Henderson
2018-10-31 11:35 ` Alex Bennée
2018-10-25 14:45 ` [Qemu-devel] [RFC v4 09/71] cris: " Emilio G. Cota
2018-10-26 14:58 ` Richard Henderson
2018-10-31 11:42 ` Alex Bennée
2018-10-25 14:45 ` [Qemu-devel] [RFC v4 10/71] hppa: " Emilio G. Cota
2018-10-26 14:58 ` Richard Henderson
2018-10-31 11:43 ` Alex Bennée
2018-10-25 14:45 ` [Qemu-devel] [RFC v4 11/71] m68k: " Emilio G. Cota
2018-10-26 14:59 ` Richard Henderson
2018-10-31 11:43 ` Alex Bennée
2018-10-31 12:27 ` Laurent Vivier
2018-10-25 14:45 ` [Qemu-devel] [RFC v4 12/71] alpha: " Emilio G. Cota
2018-10-26 15:00 ` Richard Henderson
2018-10-31 11:45 ` Alex Bennée
2018-10-25 14:45 ` [Qemu-devel] [RFC v4 13/71] microblaze: " Emilio G. Cota
2018-10-26 15:00 ` Richard Henderson
2018-10-31 11:47 ` Alex Bennée
2018-10-25 14:45 ` [Qemu-devel] [RFC v4 14/71] cpu: define cpu_halted helpers Emilio G. Cota
2018-10-31 12:04 ` Alex Bennée
2018-10-25 14:45 ` [Qemu-devel] [RFC v4 15/71] tcg-runtime: convert to cpu_halted_set Emilio G. Cota
2018-10-26 15:01 ` Richard Henderson
2018-10-31 11:56 ` Alex Bennée
2018-10-25 14:45 ` [Qemu-devel] [RFC v4 16/71] arm: convert to cpu_halted Emilio G. Cota
2018-10-31 12:15 ` Alex Bennée
2018-10-25 14:45 ` [Qemu-devel] [RFC v4 17/71] ppc: " Emilio G. Cota
2018-10-26 15:02 ` Richard Henderson
2018-10-25 14:45 ` [Qemu-devel] [RFC v4 18/71] sh4: " Emilio G. Cota
2018-10-31 13:54 ` Alex Bennée
2018-10-31 16:26 ` Emilio G. Cota
2018-10-31 16:38 ` Alex Bennée
2018-10-25 14:45 ` [Qemu-devel] [RFC v4 19/71] i386: " Emilio G. Cota
2018-10-31 14:20 ` Alex Bennée
2018-10-25 14:45 ` [Qemu-devel] [RFC v4 20/71] lm32: " Emilio G. Cota
2018-10-31 14:20 ` Alex Bennée
2018-10-25 14:45 ` [Qemu-devel] [RFC v4 21/71] m68k: " Emilio G. Cota
2018-10-31 12:29 ` Laurent Vivier
2018-10-31 16:14 ` Alex Bennée
2018-10-25 14:45 ` [Qemu-devel] [RFC v4 22/71] mips: " Emilio G. Cota
2018-10-31 14:22 ` Alex Bennée
2018-10-25 14:45 ` [Qemu-devel] [RFC v4 23/71] riscv: " Emilio G. Cota
2018-10-26 15:03 ` Richard Henderson
2018-10-25 14:45 ` [Qemu-devel] [RFC v4 24/71] s390x: " Emilio G. Cota
2018-10-31 16:13 ` Alex Bennée
2018-10-31 16:38 ` Emilio G. Cota
2018-10-31 16:56 ` Alex Bennée
2018-11-09 13:47 ` Cornelia Huck
2018-10-25 14:45 ` [Qemu-devel] [RFC v4 25/71] sparc: " Emilio G. Cota
2018-10-31 16:13 ` Alex Bennée
2018-10-25 14:45 ` [Qemu-devel] [RFC v4 26/71] xtensa: " Emilio G. Cota
2018-10-31 16:13 ` Alex Bennée
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 27/71] gdbstub: " Emilio G. Cota
2018-10-31 16:14 ` Alex Bennée
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 28/71] openrisc: " Emilio G. Cota
2018-10-31 16:14 ` Alex Bennée
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 29/71] cpu-exec: " Emilio G. Cota
2018-10-26 15:04 ` Richard Henderson
2018-10-31 16:16 ` Alex Bennée
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 30/71] cpu: define cpu_interrupt_request helpers Emilio G. Cota
2018-10-26 15:07 ` Richard Henderson
2018-10-31 16:21 ` Alex Bennée
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 31/71] ppc: use cpu_reset_interrupt Emilio G. Cota
2018-10-31 16:21 ` Alex Bennée
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 32/71] exec: " Emilio G. Cota
2018-10-26 15:07 ` Richard Henderson
2018-10-31 16:33 ` Alex Bennée
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 33/71] i386: " Emilio G. Cota
2018-10-31 16:34 ` Alex Bennée
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 34/71] s390x: " Emilio G. Cota
2018-10-31 16:34 ` Alex Bennée
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 35/71] openrisc: " Emilio G. Cota
2018-10-31 16:35 ` Alex Bennée
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 36/71] arm: convert to cpu_interrupt_request Emilio G. Cota
2018-10-26 13:39 ` Alex Bennée
2018-10-26 16:31 ` Emilio G. Cota
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 37/71] i386: " Emilio G. Cota
2018-10-26 15:08 ` Richard Henderson
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 38/71] i386/kvm: " Emilio G. Cota
2018-10-26 15:10 ` Richard Henderson
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 39/71] i386/hax-all: " Emilio G. Cota
2018-10-26 15:11 ` Richard Henderson
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 40/71] i386/whpx-all: " Emilio G. Cota
2018-10-26 15:12 ` Richard Henderson
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 41/71] i386/hvf: convert to cpu_request_interrupt Emilio G. Cota
2018-10-26 15:12 ` Richard Henderson
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 42/71] ppc: convert to cpu_interrupt_request Emilio G. Cota
2018-10-26 15:45 ` Richard Henderson
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 43/71] sh4: " Emilio G. Cota
2018-10-31 16:36 ` Alex Bennée
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 44/71] cris: " Emilio G. Cota
2018-10-31 16:36 ` Alex Bennée
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 45/71] hppa: " Emilio G. Cota
2018-10-31 16:36 ` Alex Bennée
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 46/71] lm32: " Emilio G. Cota
2018-10-31 16:36 ` Alex Bennée
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 47/71] m68k: " Emilio G. Cota
2018-10-31 12:32 ` Laurent Vivier
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 48/71] mips: " Emilio G. Cota
2018-10-26 15:45 ` Richard Henderson
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 49/71] nios: " Emilio G. Cota
2018-10-31 16:37 ` Alex Bennée
2018-10-31 16:38 ` Alex Bennée
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 50/71] s390x: " Emilio G. Cota
2018-10-31 16:39 ` Alex Bennée
2018-11-09 13:49 ` Cornelia Huck
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 51/71] alpha: " Emilio G. Cota
2018-10-31 16:39 ` Alex Bennée
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 52/71] moxie: " Emilio G. Cota
2018-10-31 16:39 ` Alex Bennée
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 53/71] sparc: " Emilio G. Cota
2018-10-31 16:40 ` Alex Bennée
2018-10-31 16:42 ` Alex Bennée
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 54/71] openrisc: " Emilio G. Cota
2018-10-31 16:43 ` Alex Bennée
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 55/71] unicore32: " Emilio G. Cota
2018-10-31 16:44 ` Alex Bennée
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 56/71] microblaze: " Emilio G. Cota
2018-10-31 16:44 ` Alex Bennée
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 57/71] accel/tcg: " Emilio G. Cota
2018-10-26 15:48 ` Richard Henderson
2018-10-31 16:46 ` Alex Bennée [this message]
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 58/71] cpu: call .cpu_has_work with the CPU lock held Emilio G. Cota
2018-10-26 15:48 ` Richard Henderson
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 59/71] cpu: introduce cpu_has_work_with_iothread_lock Emilio G. Cota
2018-10-26 15:51 ` Richard Henderson
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 60/71] ppc: convert to cpu_has_work_with_iothread_lock Emilio G. Cota
2018-10-26 15:53 ` Richard Henderson
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 61/71] mips: " Emilio G. Cota
2018-10-26 15:54 ` Richard Henderson
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 62/71] s390x: " Emilio G. Cota
2018-10-26 15:54 ` Richard Henderson
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 63/71] riscv: " Emilio G. Cota
2018-10-26 15:54 ` Richard Henderson
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 64/71] sparc: " Emilio G. Cota
2018-10-26 15:54 ` Richard Henderson
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 65/71] xtensa: " Emilio G. Cota
2018-10-26 15:54 ` Richard Henderson
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 66/71] cpu: protect most CPU state with cpu->lock Emilio G. Cota
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 67/71] cpus-common: release BQL earlier in run_on_cpu Emilio G. Cota
2018-10-26 15:59 ` Richard Henderson
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 68/71] cpu: add async_run_on_cpu_no_bql Emilio G. Cota
2018-10-26 16:00 ` Richard Henderson
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 69/71] cputlb: queue async flush jobs without the BQL Emilio G. Cota
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 70/71] cpus-common: move exclusive_idle higher in the file Emilio G. Cota
2018-10-26 16:06 ` Richard Henderson
2018-10-29 15:21 ` Alex Bennée
2018-10-25 14:46 ` [Qemu-devel] [RFC v4 71/71] cpus-common: wait on the CPU lock for exclusive work completion Emilio G. Cota
2018-10-29 15:31 ` Alex Bennée
2018-10-25 15:11 ` [Qemu-devel] [RFC v4 00/71] per-CPU locks Emilio G. Cota
2018-10-27 9:14 ` [Qemu-devel] [Qemu-arm] " Alex Bennée
2018-10-29 15:47 ` Emilio G. Cota
2018-10-29 16:00 ` Alex Bennée
2018-10-29 15:39 ` [Qemu-devel] [RFC v4 01/71] cpu: convert queued work to a QSIMPLEQ Alex Bennée
2018-10-29 15:55 ` Emilio G. Cota
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y3ae5aja.fsf@linaro.org \
--to=alex.bennee@linaro.org \
--cc=cota@braap.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).