Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2327694imm; Fri, 7 Sep 2018 14:44:39 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaJiJPQsoZfmNGTpqTjZAgxq807KJV3XzT/OMrhYuiJKqIxsLgYX2VGR0RljTQUvgBMWRMA X-Received: by 2002:a62:6283:: with SMTP id w125-v6mr10783493pfb.108.1536356679696; Fri, 07 Sep 2018 14:44:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536356679; cv=none; d=google.com; s=arc-20160816; b=qJlZ/6Y3wJ+eZ6AaqWNqqVrsTL1F+Vbw76CFC+CZW53CTvD569YiS8iY//xvvNqfwP jjzJ+1SSjlCQtgf5pYJ3zdISU2uG1/EmmuFJrWXaPySklo16/+LOi5oXKxDRRMUiQ2GG t88qRksOXLNavQMwuIrdFyHZem/CuF4iNC7bRME19jBy+eryJk4An9BVZ9RG1kdMOcKx yDIYxfmLQ6LYKr6Gg7WsGYc2aXhEbhimWP4gQCkOaWzMH3IAp/L4oLAyTN9eteaWo902 YJ4mhtmPMxfTOp0J1cvyFFoazkij6JB02BTm2EZIwstTaXqAEPJVF5Wv3veKoCaDqkdS HO0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from; bh=BsWN5slI1iMiadL+dscx0HkgFaRUAZnT5VUh6OaABsU=; b=J03tnIlFqVuLR+PfdHIcj6Qt+xqrCRHzaDVjQF4vY+h3EibkCmLLHYcaD6jhehZc/C 3LJTNexxF3ZqwnCyw3fpzacj3plIe69BxTL5J6guoiuWNrJ2diERTJ9w52R7Xi9TZcOx ySWh32xLp10eEo8uk1Ydb/BImaJEtxoJeaWp5Qu+FdDwmFCJwmxE1xPuCTpxVKmpeYUH zsRzMU57gyL7F48D9euTA1dQ36Nwrrs+ev82b8DdpH+v2C4PeBAxIlAD785cQCXBkysM ntr/7dQ8uOV0m2K5UdIiBkQaJHN9WkVphLDkb8u2GAnnAfL+/Dc286WboEJIc9NDHpT6 2okg== 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 d127-v6si9395374pfa.189.2018.09.07.14.44.24; Fri, 07 Sep 2018 14:44:39 -0700 (PDT) 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 S1730723AbeIHCZu (ORCPT + 99 others); Fri, 7 Sep 2018 22:25:50 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:56662 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729174AbeIHCZt (ORCPT ); Fri, 7 Sep 2018 22:25:49 -0400 Received: from localhost (ip-213-127-74-90.ip.prioritytelecom.net [213.127.74.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 56C3CBBF; Fri, 7 Sep 2018 21:42:54 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Erica Bugden , "Steven Rostedt (VMware)" Subject: [PATCH 3.18 10/29] tracing: Do not call start/stop() functions when tracing_on does not change Date: Fri, 7 Sep 2018 23:10:31 +0200 Message-Id: <20180907210910.324126875@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180907210909.523240901@linuxfoundation.org> References: <20180907210909.523240901@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable 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 Cc: stable@vger.kernel.org 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: Greg Kroah-Hartman --- kernel/trace/trace.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -6209,7 +6209,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);