Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp492509pxb; Mon, 25 Oct 2021 12:18:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzyPkqhdhPXqfrDgQo+YRLnBqye23ks/RckFB13V6z+0LRFEAhRs38qOuKnIijgHyHmVVbF X-Received: by 2002:a17:90b:1649:: with SMTP id il9mr23229109pjb.167.1635189521973; Mon, 25 Oct 2021 12:18:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635189521; cv=none; d=google.com; s=arc-20160816; b=kOIWuI3D+V1enCAmwcewSJL6FSCewnP4FAp9pUjB0wuWBc2zx9Ee+m8L/91I/jtJMj /HilLviOURD9HOZzxF5ix0UK58XNPApoluYfegJHjYw7yR9i3pPM1OH3vkaeNJplrynL ijlkg0r7dwEZbs3LeJxKxS7N79J7jz+lpmA5G7qcG4y+J9iuL2uy0CHpiETGzfnT2+I4 AHdMDg29Yrha6rCbOaWXF6YA8LOhFX7J//+L0fPtE7fcPIXJyqhExHUrn2TvXEorEtnM hcE5Gc/Le2nUpv/NXxX4AoF5MP/Q0r7eUaxGM8pQ3Wu6HLOYVDgzdZA0CvtL1RgXxN+W ydJg== 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=VoIzts261xfndr6ou7Q8zjMXM6riwNdztIx9FrZPNiZrmEUpn1ohvYjI0dD9e4qeIX +4AfFWEmnHQPat7NPmWcrESYArWuzax19OkdNl5igWqxPOoJZZrv8sSYVrpKW96riy0S aEu5gltFqh3/xMvZ7O+y7oyxBJ2SHSaByu/Vy82+xxl0sTQCjvyy9jlcr7Ieg5lrFfLU Ae6x6E0lvbTnlK1T21EI6DL4G/TS9kH2O9fG4I3g7Cp/6d58t9pcPsvJoHWSxPoYhmm2 nazJr/Mx7cTfMXAEcBH7SeJLjYZ8nbUvNCYUEzKy1Vyf49DN+eRyx6UJoNHIHb1/082H 4fAA== 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 x2si23533116pgh.479.2021.10.25.12.18.25; Mon, 25 Oct 2021 12:18:41 -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 S234080AbhJYRnb convert rfc822-to-8bit (ORCPT + 99 others); Mon, 25 Oct 2021 13:43:31 -0400 Received: from us-smtp-delivery-44.mimecast.com ([207.211.30.44]:38089 "EHLO us-smtp-delivery-44.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233805AbhJYRn2 (ORCPT ); Mon, 25 Oct 2021 13:43:28 -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-505-mA-2AK5BMHWWTiv_JF7z6A-1; Mon, 25 Oct 2021 13:41:02 -0400 X-MC-Unique: mA-2AK5BMHWWTiv_JF7z6A-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5FE77802682; Mon, 25 Oct 2021 17:41:00 +0000 (UTC) Received: from x1.com (unknown [10.22.9.145]) by smtp.corp.redhat.com (Postfix) with ESMTP id EFF075C1A1; Mon, 25 Oct 2021 17:40:56 +0000 (UTC) From: Daniel Bristot de Oliveira To: Steven Rostedt Cc: 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 V5 02/20] trace/osnoise: Improve comments about barrier need for NMI callbacks Date: Mon, 25 Oct 2021 19:40:27 +0200 Message-Id: <17c9b30b50e304269f08be3cbf8ca8188d2ebf7e.1635181938.git.bristot@kernel.org> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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