Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp472645lqr; Wed, 5 Jun 2024 11:09:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUeE7cyMs8s5lYBjIM58OFpOLQRCRF7/cLDHAmB7XnhV6T535JO68hcT4ZNnlvzyxmgpXrQA0PHaeIovEq0L780TAX2hcrOMSBJAu0xGg== X-Google-Smtp-Source: AGHT+IFecvn5908B8uvXN3TSlFFI9Gxd0OTWN748SqPCeS4GoXUETbQCCBV/FvVHXxmQqJk3gV0b X-Received: by 2002:a05:6122:2091:b0:4df:1d07:5ffa with SMTP id 71dfb90a1353d-4eb3a3e7d2dmr4416442e0c.3.1717610963543; Wed, 05 Jun 2024 11:09:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717610963; cv=pass; d=google.com; s=arc-20160816; b=y4YCruYC3ZZgZ/q1dKcPH5F399C3PR0C2gDLmUsxAATuB56A3qZCGfnNBlf4230I7J 7xzpiiIjhn38wWst4du38p+keOPr0HKkODfx9DGUOf4s7GlR13hl1FRGliWy4EMRdFlG KK5Q7kEHO9EAkr3VpuVcocpi9zmUGeEnTsINuXrUFGl0tafdsad7RZkkUpXPLznxsF7b 49dFipOAmHgVQZVntT8ZYd0zD6TYU9dVpOkp/qsUffco1PVe2i0KxTgtayNTeoFrisrf GxbBrn3+eMssB+MOK/p/B07jFDjGCh70lU3afN2tsHwdVqHK7s3kONAVSrp+znTtHi7g xQnA== 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=HvxD3Buo4eGTKYWSy1Q52aj0BOEmvGJoC9caRZ+6PTE=; fh=mjDKelfe6UwtrbrQsWTm6mHxXqJJm1yC7XMGoQRRIY8=; b=dj2PTkJzEw4srAvx2gOIu3bd+geP7BmklH6DgQ0UC2ZVCEYZPihO8igDgvFTvbD0VR 656l6odqZR0hrdbLjVg+tWFaS10RL1peX71Lk7zS15GE2PtLylbLd+ZUT+7qW9WWQUKV gCXzvOYkHDFKqBQcCMpGSGCo04w5mJ5/cjVsFo/fbjZrs+OTwPgy0L+Yd/RbCEMDR3ci Z/dyX+HK02ym3YzD9a4gErOqt0qpBQHSg92uZv68RonM/fH1gAJCVFhWPLpk0BK4DkOQ 2CBtswT54FHQWnBcB1pX9PShj9MV1oTYFhbERDMC1dwfaNotZ/XrC+lAfrVbwzJ3YLNl GPGA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-203031-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203031-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 71dfb90a1353d-4eb0140fda0si2174324e0c.240.2024.06.05.11.09.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 11:09:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-203031-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-203031-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203031-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 3AB361C22A78 for ; Wed, 5 Jun 2024 18:09:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2044B13AD13; Wed, 5 Jun 2024 18:04:07 +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 8D59C15E90; Wed, 5 Jun 2024 18:04:06 +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=1717610646; cv=none; b=Vb1hzeHlb1tCk+S/c9CgAK/apZbsTAt/UFvNzhEOrxXxrsaA32CdaIuWuo4M2H6EuNFCdqxyndfJJiJpi4IBeDbtA5iDEUbtKnK8Taw17yskGgyqqdsIDaHT1aBObxFLTUO+KKkKkbWfVkG2vYBL7zaqGUWwzj9X7fXwPxERpl0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610646; c=relaxed/simple; bh=8b6Nwx0UjbrwVWPwGaSh+tM70eZBD8B/BLULcHoCfEY=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=UJnVCK7q10snQKehmU9gFKLQQcTy9srFezlgOX5Wrd+I/lIt8oOO3MReDpnI+1DqZ+uYuKhWDU5zZurQYP3k8C3aebxS9MNVa/XVc3vGIpr1K8GLYXvVEXEl27FOTlgYiDEdQmKcQqtpHfIlAGFRnVlGM5y0QaF8YlcMsH1QbKY= 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 4DC70C3277B; Wed, 5 Jun 2024 18:04:06 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1sEuzZ-00000000hYU-0fGU; Wed, 05 Jun 2024 14:04:09 -0400 Message-ID: <20240605180409.021080462@goodmis.org> User-Agent: quilt/0.68 Date: Wed, 05 Jun 2024 14:03:38 -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 v2 4/5] ftrace: Convert "inc" parameter to bool in ftrace_hash_rec_update_modify() References: <20240605180334.090848865@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. 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 1a2444199740..83f23f8fc26d 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -1882,7 +1882,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; @@ -1906,12 +1923,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