All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Emilio G. Cota" <cota@braap.org>
To: qemu-devel@nongnu.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Peter Crosthwaite" <crosthwaite.peter@gmail.com>,
	"Richard Henderson" <rth@twiddle.net>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Murilo Opsfelder Araujo" <muriloo@linux.ibm.com>
Subject: [Qemu-devel] [PATCH v2 09/12] cpus: access .qemu_icount with atomic64
Date: Mon, 10 Sep 2018 19:27:49 -0400	[thread overview]
Message-ID: <20180910232752.31565-10-cota@braap.org> (raw)
In-Reply-To: <20180910232752.31565-1-cota@braap.org>

Signed-off-by: Emilio G. Cota <cota@braap.org>
---
 cpus.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/cpus.c b/cpus.c
index 38dabb138d..f045416c94 100644
--- a/cpus.c
+++ b/cpus.c
@@ -252,8 +252,8 @@ void cpu_update_icount(CPUState *cpu)
 
     seqlock_write_lock(&timers_state.vm_clock_seqlock,
                        &timers_state.vm_clock_lock);
-    atomic_set__nocheck(&timers_state.qemu_icount,
-                        timers_state.qemu_icount + executed);
+    atomic_set_i64(&timers_state.qemu_icount,
+                   timers_state.qemu_icount + executed);
     seqlock_write_unlock(&timers_state.vm_clock_seqlock,
                          &timers_state.vm_clock_lock);
 }
@@ -270,8 +270,8 @@ static int64_t cpu_get_icount_raw_locked(void)
         /* Take into account what has run */
         cpu_update_icount(cpu);
     }
-    /* The read is protected by the seqlock, so __nocheck is okay.  */
-    return atomic_read__nocheck(&timers_state.qemu_icount);
+    /* The read is protected by the seqlock, but needs atomic64 to avoid UB */
+    return atomic_read_i64(&timers_state.qemu_icount);
 }
 
 static int64_t cpu_get_icount_locked(void)
-- 
2.17.1

  parent reply	other threads:[~2018-09-10 23:37 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-10 23:27 [Qemu-devel] [PATCH v2 00/12] i386 + x86_64 mttcg Emilio G. Cota
2018-09-10 23:27 ` [Qemu-devel] [PATCH v2 01/12] cacheinfo: add i/d cache_linesize_log Emilio G. Cota
2018-09-11 12:16   ` Richard Henderson
2018-09-11 12:57     ` Paolo Bonzini
2018-09-10 23:27 ` [Qemu-devel] [PATCH v2 02/12] util: add atomic64 Emilio G. Cota
2018-09-11 12:43   ` Richard Henderson
2018-09-11 20:43     ` Emilio G. Cota
2018-09-10 23:27 ` [Qemu-devel] [PATCH v2 03/12] tests: add atomic64-bench Emilio G. Cota
2018-09-10 23:27 ` [Qemu-devel] [PATCH v2 04/12] qsp: use atomic64 accessors Emilio G. Cota
2018-09-10 23:27 ` [Qemu-devel] [PATCH v2 05/12] test-rcu-list: access n_reclaims and n_nodes_removed with atomic64 Emilio G. Cota
2018-09-10 23:27 ` [Qemu-devel] [PATCH v2 06/12] atomic: fix comment s/x64_64/x86_64/ Emilio G. Cota
2018-09-11 12:50   ` Richard Henderson
2018-09-10 23:27 ` [Qemu-devel] [PATCH v2 07/12] cpus: initialize timers_state.vm_clock_lock Emilio G. Cota
2018-09-11 12:50   ` Richard Henderson
2018-09-10 23:27 ` [Qemu-devel] [PATCH v2 08/12] cpus: always call seqlock_write in cpu_update_icount Emilio G. Cota
2018-09-11 12:53   ` Richard Henderson
2018-09-11 12:55     ` Paolo Bonzini
2018-09-10 23:27 ` Emilio G. Cota [this message]
2018-09-10 23:27 ` [Qemu-devel] [PATCH v2 10/12] cpus: access .qemu_icount_bias with atomic64 Emilio G. Cota
2018-09-10 23:27 ` [Qemu-devel] [PATCH v2 11/12] target/i386/translate: use thread-local storage in !user-mode Emilio G. Cota
2018-09-11 12:57   ` Richard Henderson
2018-09-10 23:27 ` [Qemu-devel] [PATCH v2 12/12] configure: enable mttcg for i386 and x86_64 Emilio G. Cota
2018-09-11 12:58   ` Richard Henderson
2018-09-11 13:00 ` [Qemu-devel] [PATCH v2 00/12] i386 + x86_64 mttcg Paolo Bonzini

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=20180910232752.31565-10-cota@braap.org \
    --to=cota@braap.org \
    --cc=alex.bennee@linaro.org \
    --cc=crosthwaite.peter@gmail.com \
    --cc=ehabkost@redhat.com \
    --cc=muriloo@linux.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.