From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33796) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b6NrA-0008QC-TD for qemu-devel@nongnu.org; Fri, 27 May 2016 15:55:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b6Nr6-0005oV-N0 for qemu-devel@nongnu.org; Fri, 27 May 2016 15:55:39 -0400 Received: from mail-lf0-x243.google.com ([2a00:1450:4010:c07::243]:34593) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b6Nr6-0005o3-4o for qemu-devel@nongnu.org; Fri, 27 May 2016 15:55:36 -0400 Received: by mail-lf0-x243.google.com with SMTP id 65so9366594lfq.1 for ; Fri, 27 May 2016 12:55:35 -0700 (PDT) References: <1464138802-23503-1-git-send-email-cota@braap.org> <1464138802-23503-3-git-send-email-cota@braap.org> From: Sergey Fedorov Message-ID: <5748A635.7040808@gmail.com> Date: Fri, 27 May 2016 22:55:33 +0300 MIME-Version: 1.0 In-Reply-To: <1464138802-23503-3-git-send-email-cota@braap.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH v6 02/15] seqlock: remove optional mutex List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Emilio G. Cota" , QEMU Developers , MTTCG Devel Cc: =?UTF-8?Q?Alex_Benn=c3=a9e?= , Paolo Bonzini , Richard Henderson On 25/05/16 04:13, Emilio G. Cota wrote: > This option is unused; besides, it bloats the struct when not needed. > Let's just let writers define their own locks elsewhere. > > Reviewed-by: Alex Bennée > Reviewed-by: Richard Henderson > Signed-off-by: Emilio G. Cota Reviewed-by: Sergey Fedorov > --- > cpus.c | 2 +- > include/qemu/seqlock.h | 10 +--------- > 2 files changed, 2 insertions(+), 10 deletions(-) > > diff --git a/cpus.c b/cpus.c > index cbeb1f6..dd86da5 100644 > --- a/cpus.c > +++ b/cpus.c > @@ -619,7 +619,7 @@ int cpu_throttle_get_percentage(void) > > void cpu_ticks_init(void) > { > - seqlock_init(&timers_state.vm_clock_seqlock, NULL); > + seqlock_init(&timers_state.vm_clock_seqlock); > vmstate_register(NULL, 0, &vmstate_timers, &timers_state); > throttle_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL_RT, > cpu_throttle_timer_tick, NULL); > diff --git a/include/qemu/seqlock.h b/include/qemu/seqlock.h > index 70b01fd..e673482 100644 > --- a/include/qemu/seqlock.h > +++ b/include/qemu/seqlock.h > @@ -19,22 +19,17 @@ > typedef struct QemuSeqLock QemuSeqLock; > > struct QemuSeqLock { > - QemuMutex *mutex; > unsigned sequence; > }; > > -static inline void seqlock_init(QemuSeqLock *sl, QemuMutex *mutex) > +static inline void seqlock_init(QemuSeqLock *sl) > { > - sl->mutex = mutex; > sl->sequence = 0; > } > > /* Lock out other writers and update the count. */ > static inline void seqlock_write_lock(QemuSeqLock *sl) > { > - if (sl->mutex) { > - qemu_mutex_lock(sl->mutex); > - } > ++sl->sequence; > > /* Write sequence before updating other fields. */ > @@ -47,9 +42,6 @@ static inline void seqlock_write_unlock(QemuSeqLock *sl) > smp_wmb(); > > ++sl->sequence; > - if (sl->mutex) { > - qemu_mutex_unlock(sl->mutex); > - } > } > > static inline unsigned seqlock_read_begin(QemuSeqLock *sl)