Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp331925lqt; Thu, 6 Jun 2024 05:13:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVTjMdjecBpVB/+D8uwPyS8OvZvJYTzQ/DzicmtAntkPkR6xA7+MaW2ZtcaozrQaPaOifbJdVfjErw+lwdB/kO+3RisKYswENGNlnw8Cg== X-Google-Smtp-Source: AGHT+IEo536+sjPrHKl5SKIiqzE6YUsuPn93cejWrrh3JIHSP804l3ic4Z/3+MvW6PV/J3Cp2qfr X-Received: by 2002:a67:b107:0:b0:48b:8ff3:9ddd with SMTP id ada2fe7eead31-48c04a67c38mr5437819137.34.1717676037313; Thu, 06 Jun 2024 05:13:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717676037; cv=pass; d=google.com; s=arc-20160816; b=kHekVIf6vOD8h5c8g3+Ym4Vm8tKTCG+cZFRoMspq3PFIyucVG4aRx6b6411V01lHKR ZIopI/0DelqWVPl6vpySMg5Ls4UfB6lqFebGD8FHbVz4c97P0YgX9E0xVlGCHiG8oz0j dI6iODIK9X/OgDQeJn/OIsc3U+eBFVs3+Jfvqf0VyqWnYafrkQulqUpYAC7v/qn8ZSC/ 8rZjTQfwcTAZe/1kt3ZSCqvhaoo2aFj+zs0Xn/70tBbeTioAzGy9C7+iuobio7wq2IBg N6ee2Trp444tywATwUMoPF1sCNynXOmiBRRvxFT/WcuVltg0haWY7608SM3L+SP747Ve DAZw== 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=CHXDbZs+ikE5D6i/67upOQtu2716SVCbl2VNA/C+mao=; fh=mTYg3JJ8i2GBNLFt8qb4bgYwOyk0kmrOzICLbi6qJ1c=; b=vcsrVDOhK9PqNg0Cvy9tKNu+yad5nK4YlRz391Ud1Y6xPJlfZrhdBPhqb/RfeXNmqv 6+ROQHNkr1mXfj9Ucgtj3cH1RfmJpPYzpLadug2zz54S+jyR3EUBppAhgRBiTQQpgg9L V1caSY37Ck46vf5GKirY+LZ19eoSmAv4jkmvkhvTgVkW1Mi7RVOs19Dd5+TVY9IZDqet jB/EoS7cARmwQ80Z+8xk4mmzKL2d3s35Tx5CNLVPkmn44fv2j+WtfoOW+3/3eEcQQw5E A4ol/cUPPPIDKGdMbFTGNOB+NbNINU55s1qxqns70XePYoZUojROKA/YSJjb3t6YrVDr CKvA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-204246-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204246-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id ada2fe7eead31-48c1a11d261si171432137.215.2024.06.06.05.13.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 05:13:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-204246-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-204246-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204246-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 0C2431C248D1 for ; Thu, 6 Jun 2024 12:13:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D1DD019755A; Thu, 6 Jun 2024 12:11:02 +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 5825C195F27 for ; Thu, 6 Jun 2024 12:11:01 +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=1717675861; cv=none; b=rWlytpwh8ewySoFO2n5cNSfyTmn4P3Kw5TAk9gHwxbTWd/8HKk0UZmpw2sjBcviWvKyi/5o9qORdCrArJgm+qTuIiBuXwyGkHNKQyKtGJb6QQVRSCIlxLwyJmGDmyKft9VaB0b4oFkYfrdRoQYNfetWvCTt2ZAaWgJoAYm1gpIw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717675861; c=relaxed/simple; bh=H4J/vOPaYGRMPo4WfrxbkfzY1t5g0RPt7rHCPw01rI8=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=diSz4rRUzwh2DEwVXvd/1hLrlGW+6384KsXZMQka++Fm2vlsuv2qBb12r6k9ahRzZqoIcgC/13rCA7ycla9ij9p/pESLAkSVPb2/ZitGmPi/obO8Aywo0WKlreefoE4Kq5Uk+HhyBdlrhCGsTSBmedftE7GBbWt+FnfRFMFngKc= 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 0E6AFC4DE0B; Thu, 6 Jun 2024 12:11:01 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1sFBxR-00000000nLK-23op; Thu, 06 Jun 2024 08:11:05 -0400 Message-ID: <20240606121105.350727218@goodmis.org> User-Agent: quilt/0.68 Date: Thu, 06 Jun 2024 08:10:10 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton Subject: [for-next][PATCH 06/15] ftrace: Convert "inc" parameter to bool in ftrace_hash_rec_update_modify() References: <20240606121004.857581251@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 parameter "inc" in the function ftrace_hash_rec_update_modify() is boolean. Change it to be such. Also add documentation to what the function does. Link: https://lore.kernel.org/linux-trace-kernel/20240605180409.021080462@goodmis.org Cc: Mark Rutland Cc: Mathieu Desnoyers Cc: Andrew Morton Acked-by: Masami Hiramatsu (Google) Signed-off-by: Steven Rostedt (Google) --- kernel/trace/ftrace.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 4140d0ce25f1..256b5e07c39a 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -1883,7 +1883,24 @@ static bool ftrace_hash_rec_enable(struct ftrace_ops *ops) return __ftrace_hash_rec_update(ops, true); } -static void ftrace_hash_rec_update_modify(struct ftrace_ops *ops, int inc) +/* + * This function will update what functions @ops traces when its filter + * changes. + * + * The @inc states if the @ops callbacks are going to be added or removed. + * When one of the @ops hashes are updated to a "new_hash" the dyn_ftrace + * records are update via: + * + * ftrace_hash_rec_disable_modify(ops); + * ops->hash = new_hash + * ftrace_hash_rec_enable_modify(ops); + * + * 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, bool inc) { struct ftrace_ops *op; @@ -1907,12 +1924,12 @@ static void ftrace_hash_rec_update_modify(struct ftrace_ops *ops, int inc) static void ftrace_hash_rec_disable_modify(struct ftrace_ops *ops) { - ftrace_hash_rec_update_modify(ops, 0); + ftrace_hash_rec_update_modify(ops, false); } static void ftrace_hash_rec_enable_modify(struct ftrace_ops *ops) { - ftrace_hash_rec_update_modify(ops, 1); + ftrace_hash_rec_update_modify(ops, true); } /* -- 2.43.0