From patchwork Sun Sep 30 08:13:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 147859 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp2668385lji; Sun, 30 Sep 2018 02:05:00 -0700 (PDT) X-Google-Smtp-Source: ACcGV60jdJU33DWI3bmkwmX3vO/6gGCJLyTaDPuSjdfT2CCIQ5ZkFyIeN6/UuGF75A/MIpbcSXq4 X-Received: by 2002:a37:29d8:: with SMTP id p85-v6mr4514948qkp.159.1538298300019; Sun, 30 Sep 2018 02:05:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538298300; cv=none; d=google.com; s=arc-20160816; b=FiyU6C+MK8KZx9V3vGKqu+JAiXlAMoHZiXSCfhUuTfK1tXySweTC5bObvrFcO1bXAb fbJeA/AYO/K9XoMldNgxJJRt5LZwaAfF+9EMiswQGhysITtiSNrsLnao6qGmI3qW2+pq SpbEk8RcGOkOI7ubDkG330P4NR6Hb/o97o7fmqpfiB9v1Ep0urKxs+YBeGhmBbePk8Z/ 64kz7eE3GCb9H2DX4Rg58OLZexdBkWsA0HXPnISuvpuOvmlvpkDR2TJh+elB8E5syQ58 4/epy05bb0UKh1cScmRMdYtmn4UxVAUxhFpvzlgb0DvUL8VQkR7elv5l9wud6Urpoe0Q d1EQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=5hC7REoGT9ZHv4x/d6StiZypiS4LYaMNfKwS1CuqqzE=; b=hiYr4BLjhOYeLJUiAz/bHN8mlelyKb+Zm5cCcb2VWw//2A7ZQ+RvpV3Ett19VGqdpk i/oY5Plj4JFFRyFdZ/m/jejcr/LR1OUG1lJmm/LeSGING1hhQd8yVVW8IzvsNA2QuseI byoDRkGGwdYCFcoU9yUGf9FiHq+eaRxuwhk77WmDrhflLaSyelloWToyF26TZPZXHZTv Tuh30LPfCDZpFCS35ejYbgiQYs+Ess80kx3O7hndXNnr7oxNAQqHBdrggDoimTWJOjTN VcJcDO387AFExeOoUAcGRKAULbmnBwhbC3LfA9ijvkzQbHRm+c7AZUa0XIDBu99Zu1A0 N8mQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=UrXkIcJY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id o14-v6si1691356qvl.177.2018.09.30.02.04.59 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 30 Sep 2018 02:05:00 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=UrXkIcJY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:54505 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g6Xet-0000wq-Gu for patch@linaro.org; Sun, 30 Sep 2018 05:04:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41930) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g6WsJ-0003C9-4I for qemu-devel@nongnu.org; Sun, 30 Sep 2018 04:14:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g6WsF-0001Jc-92 for qemu-devel@nongnu.org; Sun, 30 Sep 2018 04:14:46 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:33810) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g6WsC-0001Hb-Uh for qemu-devel@nongnu.org; Sun, 30 Sep 2018 04:14:41 -0400 Received: by mail-wm1-x32e.google.com with SMTP id z25-v6so827785wmf.1 for ; Sun, 30 Sep 2018 01:14:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5hC7REoGT9ZHv4x/d6StiZypiS4LYaMNfKwS1CuqqzE=; b=UrXkIcJYDoT2ZGD7D2GxJz91MdFDKY63ZqzVyyu6LMvvB74PZmQbeNVoCqmJblt6yz Rn5K6JefYHQxyLb6qEScXivTwPqALBnzKoF0+z8wrRp7eXHhUynVd5UnwcyqTAMEJNPP CEhB3Kriji59qHr0Ca0JiFAJjTWpnVIs/VIeJfGjHrqVskSelPkzumaYe+Zag0vS/zbc va6On8ldrxh4iEUTBvP8rTNEVo2Fe6y9N5V0ZHDXJriORmCG42JqyXB9kZg4oAOvITLk +0vp+xM2YpAtZZMQrw31D5cHOGDly0RQUvHFq5Mpr8rQWR8bxDBdUyP8WMeaFcGlMB2B 1mag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=5hC7REoGT9ZHv4x/d6StiZypiS4LYaMNfKwS1CuqqzE=; b=lVhjMRYtJC3T6PQHJaBCzeLPnFr2RlRT3DpPxNtkhLhUW89kLwSpA94evZo+Z2Z/tq YNJlTSW1HIkRgDbU8wZOS06u7Ws44jh3+oYtiNpdZ48BaeH0BXfO0NzpKitoccvxp+XT g1aZ9FIPdJP/w2a6ZcHVvatJgXm96WSXFZpPBw9b8u+Ae8OuwTOGtrzzyH+2JzQupeBF mSytzXcILuIBHg4n/2n5lFZVJxArot+0cEhslqqycZ9liym7Gq4qTPgKqaeu7joVQKCX VnZGMxWjt6aqtzrkBvMe63Reqn+uc5jaUo9g3ijtowTO/GvvQtk+phbV3ux2g8cw/axK +lDg== X-Gm-Message-State: ABuFfog00LHG0hU6v+dqO14CkO9/Al0IM/DErpC4YDyNRMRa7xzHiNXW qlWBqBawXDdWFnlkAUZOPowVDiw1 X-Received: by 2002:a1c:6a08:: with SMTP id f8-v6mr6079860wmc.49.1538295279436; Sun, 30 Sep 2018 01:14:39 -0700 (PDT) Received: from 640k.lan (94-36-187-248.adsl-ull.clienti.tiscali.it. [94.36.187.248]) by smtp.gmail.com with ESMTPSA id u76-v6sm11369194wmd.10.2018.09.30.01.14.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 30 Sep 2018 01:14:38 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Sun, 30 Sep 2018 10:13:16 +0200 Message-Id: <1538295197-23704-79-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1538295197-23704-1-git-send-email-pbonzini@redhat.com> References: <1538295197-23704-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32e Subject: [Qemu-devel] [PULL 78/79] cpus: fix TCG kick timer leak 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: =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Alex Bennée This is an alternative fix to Marc-André's original patch. Reported-by: Marc-André Lureau Suggested-by: Paolo Bonzini Signed-off-by: Alex Bennée Message-Id: <20180927171724.30128-1-alex.bennee@linaro.org> Signed-off-by: Paolo Bonzini --- cpus.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- 1.8.3.1 diff --git a/cpus.c b/cpus.c index 68f08f5..361678e 100644 --- a/cpus.c +++ b/cpus.c @@ -983,6 +983,8 @@ static void start_tcg_kick_timer(void) if (!tcg_kick_vcpu_timer && CPU_NEXT(first_cpu)) { tcg_kick_vcpu_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, kick_tcg_thread, NULL); + } + if (tcg_kick_vcpu_timer && !timer_pending(tcg_kick_vcpu_timer)) { timer_mod(tcg_kick_vcpu_timer, qemu_tcg_next_kick()); } } @@ -990,9 +992,8 @@ static void start_tcg_kick_timer(void) static void stop_tcg_kick_timer(void) { assert(!mttcg_enabled); - if (tcg_kick_vcpu_timer) { + if (tcg_kick_vcpu_timer && timer_pending(tcg_kick_vcpu_timer)) { timer_del(tcg_kick_vcpu_timer); - tcg_kick_vcpu_timer = NULL; } }