Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp372506pxb; Wed, 27 Oct 2021 04:41:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzlAgw4igChcaRLnee4XzXsHNGm/wT0LqUzsGryoa3YChoWdxvWl6TtaC5TO5eG25HHOsZy X-Received: by 2002:a17:90b:38c6:: with SMTP id nn6mr5379554pjb.78.1635334912324; Wed, 27 Oct 2021 04:41:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635334912; cv=none; d=google.com; s=arc-20160816; b=YGJU51uQgEzIRDUl21l3n51y6t5nGYnjh6e4KahyCXp36l3R/kRrstdutWhkFEaHSv On447w7vQP0FlCenUl9zu+bha8wOxMY+VHrbjh6LBi5T5+TzmS/XtfxnyCPMs9u9LdOe DTZGWjLHPvidpeaqoQMDK5zFFsqyxfOiYe7AqRTRMOn5H6a+QXzhCdoqvmWg7NrheTcb KNhtXp/2yUJFrIY4WYHt4+bgNh26XOe2+q63urpO4dGjWOV7RtmnqoWziipnH5mQRhPr JCbjGlidzSiWWtHVI2GgLHJP5Qrl1awOzBrv8IOgZ5Xha8vRKdo5XO3j3B7eDmBif8j4 v1Vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=+E+vNGAYp4h15kmangBE/NmaVsJG3ss6NBEYvWGPlrc=; b=PP31F0tCT0S+CjHJ2ICn6+oJLv1CWj2a01puw5TBv3/WBgNVklgf5Rxot1yp1NZEji wBObBs4ZWUcIRbfZp7mbK9R1MitCYNRTs4275+hqreDeuM36L92qwHjCKbSWGfdC/LQ4 vcPy7pznBCzhKvErUr1Bralhy6r2d/q8Dda0oyBfyP5gEBSUwAJZEBtqjqtTxNxdde4O 5Kpg/F4/I5qZgbVOEoK9w97GxoBTM0DHrgzK5iqxMWjH+lZECCDYoRo1RyMG+AFyrrQJ uZ/ucJcqv2m+9pGyyyLIe7UHytbAUpi7h5lw+wJ9O8/oysykXXerOHq5bsE44Qw9rytC ZUEA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q16si4125947pjp.65.2021.10.27.04.41.35; Wed, 27 Oct 2021 04:41:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237533AbhJZWKV convert rfc822-to-8bit (ORCPT + 99 others); Tue, 26 Oct 2021 18:10:21 -0400 Received: from us-smtp-delivery-44.mimecast.com ([207.211.30.44]:57747 "EHLO us-smtp-delivery-44.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237339AbhJZWKR (ORCPT ); Tue, 26 Oct 2021 18:10:17 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-47--2cc785WMvKh1kmWmATw4g-1; Tue, 26 Oct 2021 18:07:47 -0400 X-MC-Unique: -2cc785WMvKh1kmWmATw4g-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AD978802B7A; Tue, 26 Oct 2021 22:07:45 +0000 (UTC) Received: from x1.com (unknown [10.22.32.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 02CE260BF1; Tue, 26 Oct 2021 22:07:03 +0000 (UTC) From: Daniel Bristot de Oliveira To: Steven Rostedt Cc: Tao Zhou , Daniel Bristot de Oliveira , Ingo Molnar , Tom Zanussi , Masami Hiramatsu , Juri Lelli , Clark Williams , John Kacur , Peter Zijlstra , Thomas Gleixner , Sebastian Andrzej Siewior , linux-rt-users@vger.kernel.org, linux-trace-devel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V6 02/20] trace/osnoise: Improve comments about barrier need for NMI callbacks Date: Wed, 27 Oct 2021 00:06:13 +0200 Message-Id: <17c9b30b50e304269f08be3cbf8ca8188d2ebf7e.1635284863.git.bristot@kernel.org> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=bristot@kernel.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kernel.org Content-Transfer-Encoding: 8BIT Content-Type: text/plain; charset=WINDOWS-1252 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org trace_osnoise_callback_enabled is used by ftrace_nmi_enter/exit() to know when to call the NMI callback. The barrier is used to avoid having callbacks enabled before the resetting date during the start or to touch the values after stopping the tracer. Cc: Steven Rostedt Cc: Ingo Molnar Cc: Tom Zanussi Cc: Masami Hiramatsu Cc: Juri Lelli Cc: Clark Williams Cc: John Kacur Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Sebastian Andrzej Siewior Cc: Daniel Bristot de Oliveira Cc: linux-rt-users@vger.kernel.org Cc: linux-trace-devel@vger.kernel.org Cc: linux-kernel@vger.kernel.org Suggested-by: Steven Rostedt Signed-off-by: Daniel Bristot de Oliveira --- kernel/trace/trace_osnoise.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c index 73f9609cba3d..f941a322ca89 100644 --- a/kernel/trace/trace_osnoise.c +++ b/kernel/trace/trace_osnoise.c @@ -1929,8 +1929,10 @@ static int __osnoise_tracer_start(struct trace_array *tr) retval = osnoise_hook_events(); if (retval) return retval; + /* - * Make sure NMIs see reseted values. + * Make sure that ftrace_nmi_enter/exit() see reset values + * before enabling trace_osnoise_callback_enabled. */ barrier(); trace_osnoise_callback_enabled = true; @@ -1965,6 +1967,10 @@ static void osnoise_tracer_stop(struct trace_array *tr) return; trace_osnoise_callback_enabled = false; + /* + * Make sure that ftrace_nmi_enter/exit() see + * trace_osnoise_callback_enabled as false before continuing. + */ barrier(); stop_per_cpu_kthreads(); -- 2.31.1