From patchwork Thu Apr 7 17:32:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 8777781 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8BE93C0553 for ; Thu, 7 Apr 2016 22:29:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B1433201ED for ; Thu, 7 Apr 2016 22:29:29 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0C1BD201EC for ; Thu, 7 Apr 2016 22:29:29 +0000 (UTC) Received: from localhost ([::1]:52516 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aoIQa-0001qv-DH for patchwork-qemu-devel@patchwork.kernel.org; Thu, 07 Apr 2016 18:29:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47520) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aoEvf-000619-AI for qemu-devel@nongnu.org; Thu, 07 Apr 2016 14:45:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aoEuv-0008Mu-WD for qemu-devel@nongnu.org; Thu, 07 Apr 2016 14:44:35 -0400 Received: from lists.gnu.org ([2001:4830:134:3::11]:44882) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aoEuv-0008Mp-SO for qemu-devel@nongnu.org; Thu, 07 Apr 2016 14:44:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56276) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aoEAI-0002g4-FJ for qemu-devel@nongnu.org; Thu, 07 Apr 2016 13:56:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aoDnR-0003X8-Lf for qemu-devel@nongnu.org; Thu, 07 Apr 2016 13:32:48 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:44629) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aoDnR-0003Wh-J1 for qemu-devel@nongnu.org; Thu, 07 Apr 2016 13:32:45 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id E36ED20DF0 for ; Thu, 7 Apr 2016 13:32:43 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute6.internal (MEProxy); Thu, 07 Apr 2016 13:32:43 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=braap.org; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=FsP79i9et91QPjpCV50877IL7wI=; b=lTcc6N rq/KlAujm5oZg800nixDlls+ASCTS1r9YJRw8U9WnxCL5rPoG+06u+Pf3evSJiys FGRxCVst0ByojEnmIbLyIRl/M4L17RfqIauC+pZYCcJH+iU5CDgEPiMcyGg07EuC t/+tGEMBh/KP84w6hrsglK0Oez9TSzLY6geUQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=FsP79i9et91QPjp CV50877IL7wI=; b=L9Su0z11kYXaUaRQ7KM1IpwJPTAEgIyG/BfTN29opu+PWuK 1+wzJGzBOq35GZ5c0/3trXF3vu2zhYE4X0Oe0fk6S20KdsqVurh+dSgwwgIgKWfC T5IY6AmvPdZ82eCqbwFjhZsXrvDgdVO/dwerSxB6So8UXQbr1glosaj2eNeQ= X-Sasl-enc: RB831RnHJbt9JmV3Rbu/pHWE9yJ6glK2+R+8pg1piRvL 1460050363 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id A53B0C0001E; Thu, 7 Apr 2016 13:32:43 -0400 (EDT) From: "Emilio G. Cota" To: QEMU Developers , MTTCG Devel Date: Thu, 7 Apr 2016 13:32:28 -0400 Message-Id: <1460050358-25025-4-git-send-email-cota@braap.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1460050358-25025-1-git-send-email-cota@braap.org> References: <1460050358-25025-1-git-send-email-cota@braap.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 Subject: [Qemu-devel] [PATCH v2 03/13] seqlock: remove optional mutex 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 , Peter Crosthwaite , Sergey Fedorov , Paolo Bonzini , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- cpus.c | 2 +- include/qemu/seqlock.h | 10 +--------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/cpus.c b/cpus.c index 8ae4777..7f550b9 100644 --- a/cpus.c +++ b/cpus.c @@ -611,7 +611,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)