Received: by 2002:a05:6500:1b41:b0:1fb:d597:ff75 with SMTP id cz1csp382716lqb; Tue, 4 Jun 2024 14:29:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVJ1Bmw7vw91yGnrKrMobsz5oImiotGEWcEAYT9oGRY+M/SWf0HyyIJ4cmVHQPwPdNWowgcI8V+4Sqxpq2kELlTQcBgQoeVOcjkg7n46w== X-Google-Smtp-Source: AGHT+IGf35E2zIVwwRqZRRi4yRtVNkgDEaQReggfLtH6PcfqqWRT+yscnluw/wBvzTUnXCwwaD9B X-Received: by 2002:a50:d781:0:b0:578:72d4:e3b0 with SMTP id 4fb4d7f45d1cf-57a8bcb4d09mr460794a12.36.1717536562782; Tue, 04 Jun 2024 14:29:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717536562; cv=pass; d=google.com; s=arc-20160816; b=wOHcHQ4uWX0kPiH/VJgg8t/xrcwNIZqbLc9MJelzjsHZBWthOSvYV+l8oimPt1Yij5 LjPwtLa9tP770rXgNMbGsTasL6E5I6kBfnbGgBOeSDWEY1K/hfPIICUm/SUSdEkETezu JHyO0Y3jhMtscQsN6FBM4M6Sl4zqO0bKKBWsk8BdiZIjrZs9GUs308VQNe1sf41pTuqz lCqgzvMHUcjXT2j/alYWWmnCius6IhY45J+sz1sHWC1ApxYt/Fqi4IjmN3/zsE+9nlOs jeHH8ZKlijztqGVK06vtwn9eVoIgoagxLLtHDy9OPh04z2xjKqhmZtQ0eo+/Nf6Eu80q VjgQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:subject:cc:to:from:date:user-agent:message-id; bh=urILCF4abiSIAX9mU+Z2Gj+BWw/CshxSxmTBJK/+eKk=; fh=mjDKelfe6UwtrbrQsWTm6mHxXqJJm1yC7XMGoQRRIY8=; b=vv/kTg14FAdu8CKSZtJIQmK+LCRQffEdHZmIwvt78CYVRZ3r0dIh0JZQPR0nBeeSQN F2CHnM41bAngeSc4MWAo/6NGBwlhascQxWRAdqkCH7F9t9MgccIjo7bbP9nR8+/F/RYa 7Vl11jw1EpDBECT6RBIqKFQ/IpIDM6O3h5sPGcnWbJ1JFMKVaI2/wz+CvTZCk9lQp4T9 kV/bHngV8D9OozN0Xazy+QJjzo3GLaLqW6OR31TqSVSGGFsGhVvNtlXsTYHBLNWnoWNt NloAmMbZukyFNqSh63jsIq73SGWmmUTu3wFfXKpzKDqcbDpvY1ll4SWFXrXhTjsvUd/h EDhw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-201401-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201401-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57a7863aab0si1532758a12.17.2024.06.04.14.29.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 14:29:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-201401-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-201401-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201401-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 81B0F1F21DB6 for ; Tue, 4 Jun 2024 21:29:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 314E614D2B6; Tue, 4 Jun 2024 21:28:55 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9A07A14C59C; Tue, 4 Jun 2024 21:28:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717536534; cv=none; b=mMerd3EdSvw/nhsKJLyjrwWWsMk3uSjkZNOqS5K76fMfl1eL880bFFywc9Sh49MHKO7KwecKzQNFzePzxMV6AVNH9c0Al3iup/Jw+9kIu8TI85zW2GZ8ibTre2q6T1Gr/+VyDbc/LeLB8aydhVMLucbyaqii3CvieRPrfx2bB80= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717536534; c=relaxed/simple; bh=VP452e+SSltPUNQ60WPUoVTjGYlGi4NsAMEX2G4U0oQ=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=sdcSazpmHIG29QKu81dJekjtoMmh2C5ED4q9/E6HRzB/nmXTujVAlIxfy9eR6GrlBOUny22WOmA3qW2p0OW2kqUDTFW05GYICmJLDLrizR07pbVJOakz0Yy1dbSbuecBGoqscZd7NLodmX0C6CFTH0/jKrWubK5GrXw0Ot21vh0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B391C4AF0E; Tue, 4 Jun 2024 21:28:54 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1sEbiB-00000000bEo-0nHJ; Tue, 04 Jun 2024 17:28:55 -0400 Message-ID: <20240604212855.046127611@goodmis.org> User-Agent: quilt/0.68 Date: Tue, 04 Jun 2024 17:28:21 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton Subject: [PATCH 4/5] ftrace: Convert "filter_hash" and "inc" to bool in ftrace_hash_rec_update_modify() References: <20240604212817.384103202@goodmis.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 From: "Steven Rostedt (Google)" The parameters "filter_hash" and "inc" in the function ftrace_hash_rec_update_modify() are boolean. Change them to be such. Also add documentation to what the function does. Signed-off-by: Steven Rostedt (Google) --- kernel/trace/ftrace.c | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index de652201c86c..021024164938 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -1915,8 +1915,31 @@ static bool ftrace_hash_rec_enable(struct ftrace_ops *ops) return __ftrace_hash_rec_update(ops, true, 1); } +/* + * This function will update what functions @ops traces when its filter + * changes. @filter_hash is set to true when modifying the filter_hash + * and set to false when modifying the notrace_hash. + * + * For example, if the user does: echo schedule > set_ftrace_filter + * that would call: ftrace_hash_rec_update_modify(ops, true, true); + * + * For: echo schedule >> set_ftrace_notrace + * That would call: ftrace_hash_rec_enable(ops, false, true); + * + * The @inc states if the @ops callbacks are going to be added or removed. + * The dyn_ftrace records are update via: + * + * ftrace_hash_rec_disable_modify(ops, filter_hash); + * ops->hash = new_hash + * ftrace_hash_rec_enable_modify(ops, filter_hash); + * + * Where the @ops is removed from all the records it is tracing using + * its old hash. The @ops hash is updated to the new hash, and then + * the @ops is added back to the records so that it is tracing all + * the new functions. + */ static void ftrace_hash_rec_update_modify(struct ftrace_ops *ops, - int filter_hash, int inc) + bool filter_hash, bool inc) { struct ftrace_ops *op; @@ -1939,15 +1962,15 @@ static void ftrace_hash_rec_update_modify(struct ftrace_ops *ops, } static void ftrace_hash_rec_disable_modify(struct ftrace_ops *ops, - int filter_hash) + bool filter_hash) { - ftrace_hash_rec_update_modify(ops, filter_hash, 0); + ftrace_hash_rec_update_modify(ops, filter_hash, false); } static void ftrace_hash_rec_enable_modify(struct ftrace_ops *ops, - int filter_hash) + bool filter_hash) { - ftrace_hash_rec_update_modify(ops, filter_hash, 1); + ftrace_hash_rec_update_modify(ops, filter_hash, true); } /* -- 2.43.0