Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2990618imu; Sun, 9 Dec 2018 14:28:16 -0800 (PST) X-Google-Smtp-Source: AFSGD/XZ7bH8HRh6rvQrNysXRE2b6i1j/KfsSdxgHd2tNz/91mr4tUS6EV5bkLoj7gAjoD4znVzt X-Received: by 2002:a17:902:47aa:: with SMTP id r39mr9807603pld.219.1544394496540; Sun, 09 Dec 2018 14:28:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544394496; cv=none; d=google.com; s=arc-20160816; b=J23orzY4qhkKzskYefjaOXI5pAGt1IzRFKE/M5HGizKvNa6icl7P6wK17ClNzewLPC nmOmK1Q/zxMZN7V5eTt6w+iAAOpKrwgwgvZs/s9zsx9mTLtLr9N6HJ/XBN0rsWnx+/OV 147K8j8i0vt4Ttu8IWOvTLEiY1sW988YRDH991KdkyRFizpZ0osYiy+Ut2H+yyzhuRok BAFkihZNyUwi9unAlxDYqWdtO5boVYRNb6jppKfWu4PlgDh73IZPWKou6z0/8KBXs1V/ 3UCn2RvWIL/FRgJdncznHIJm1cYo7MSj59XsWIYoH/I67xPeCVwynLpR1X+OmAjryoMQ ERRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=qEFxm9FhY2Pp9o8oWwQwK/JyPhiFtiiOP+AwbWDQN04=; b=cx/Klp9XoWAYrv6AaylQBfAZm2q275QFweNZP/GbFEgbFjgfTQfl0DNXo2O+V+Ct3v e4/xVov/YJi+AQzu2fkEybRmKutmtX5Cf3SmiQztIUV44VCplZrj6gn7GvuyRKRrKhOW AV9NKhIjECbYN9WLf9Ry9DBkzbXPEnOEVXbaAKNzRfSi5d9+/9S+KV27aHzOxaoJD4G2 r94qJi9SRd5V6QiuuhTqmGRL1YeCWM7odD9k8FPJlVcIxg/1C0V1nTiI3np1otmeS0qf Jnjw71Y8yFdG5DPzPXo3AXuVQwoJ1GhC0W2OI4j52qNDVCXns3T9D+cSazIZakUSBiq2 1RZA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m61si8535729plb.154.2018.12.09.14.28.01; Sun, 09 Dec 2018 14:28:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728758AbeLIWZk (ORCPT + 99 others); Sun, 9 Dec 2018 17:25:40 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:34842 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726432AbeLIVzP (ORCPT ); Sun, 9 Dec 2018 16:55:15 -0500 Received: from pub.yeoldevic.com ([81.174.156.145] helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gW72d-0002ib-VF; Sun, 09 Dec 2018 21:55:12 +0000 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1gW72b-0003KS-H2; Sun, 09 Dec 2018 21:55:09 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Steven Rostedt (VMware)" , "Erica Bugden" Date: Sun, 09 Dec 2018 21:50:33 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) X-Patchwork-Hint: ignore Subject: [PATCH 3.16 091/328] tracing: Do not call start/stop() functions when tracing_on does not change In-Reply-To: X-SA-Exim-Connect-IP: 81.174.156.145 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.62-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: "Steven Rostedt (VMware)" commit f143641bfef9a4a60c57af30de26c63057e7e695 upstream. Currently, when one echo's in 1 into tracing_on, the current tracer's "start()" function is executed, even if tracing_on was already one. This can lead to strange side effects. One being that if the hwlat tracer is enabled, and someone does "echo 1 > tracing_on" into tracing_on, the hwlat tracer's start() function is called again which will recreate another kernel thread, and make it unable to remove the old one. Link: http://lkml.kernel.org/r/1533120354-22923-1-git-send-email-erica.bugden@linutronix.de Fixes: 2df8f8a6a897e ("tracing: Fix regression with irqsoff tracer and tracing_on file") Reported-by: Erica Bugden Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Ben Hutchings --- kernel/trace/trace.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -6180,7 +6180,9 @@ rb_simple_write(struct file *filp, const if (buffer) { mutex_lock(&trace_types_lock); - if (val) { + if (!!val == tracer_tracing_is_on(tr)) { + val = 0; /* do nothing */ + } else if (val) { tracer_tracing_on(tr); if (tr->current_trace->start) tr->current_trace->start(tr);