Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp196343lqr; Wed, 5 Jun 2024 03:22:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUeOZ1lTRK9UNQ7JbFdGiRQOqDIWJI++pYnVvnYUuE2PAyL65tCw5z1Ey6dJkycMpssLDAbk/72TOYy7782MIv2DPw7/LI2hx+36SEW4g== X-Google-Smtp-Source: AGHT+IHAZiH08I/S4Y5rdtVTSOr4CwBNNxfYwxMkQkEZULL3qjxLQhaSD2csXdNPltBYmniuSO5s X-Received: by 2002:a05:6358:2810:b0:19c:277f:ef37 with SMTP id e5c5f4694b2df-19c6cb1924emr248183055d.28.1717582975563; Wed, 05 Jun 2024 03:22:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717582975; cv=pass; d=google.com; s=arc-20160816; b=A+LaPEYuaFIJbLereSMzH/j+eEpB8ZXkgzOXVIasgMRlUD9HFilO+tat9zRg5Ow/n4 1CE8eS3IxKB7zdY16N1cHri2TkqZy4EeN8CbBOkubg19iAtCQaNaIXDDEbl6BGe5LgOT dsN5G2gxwf1DG4anqpR4vJKMdfGFZvyeFdjuevVlVWT0QbiVuHwFT/ol9050IUPOAsFW E6OmRDXWBHmCzCtWpSLMtZFqWO1xprRHBAGe3omD3JByhrZD5njMQJw/ZdBedbmQE5YP Zq/BF52sV8g1BxQEhxBUKsrLvsvIoaUL5Ky/XU5ffSWgLk/uQ02wD7jhJ1BxYYI+bE3I C5rA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=ru0gdkbiXhuoVyhDygjwaKutxRnnatdm5n2RJJbjRII=; fh=D7vGFCemkZDU34ZWTdMMgxTv/fBH8o6Jqms0Kr1Z2d4=; b=fBm9MR273t1dOhUdAs4GlEAF8ie8Qbl43rbTqg+WPsYhR9XDY28Y1P5iX73vO/GoJt 8Xu/hPejsE/ntfx1diTfsVbcccDDe6dm4qibseVtS3nDeI6nppsPw4wJCx9SLWUgdCb6 we20weHJjPnGBywOJvxwZL62OxPx0JvKkYj5veGDyQB91gRnV8jnMKCN+TJFHUmnYS3H HtYjbu5ej+c+8OhTzLEAcr4TCFvyD5X56PYSuWz7bt7yeDcULEjLcwc/s7sEDcXIh5mc obM101/VQc83iM6Nt5fvV4FY381ZdocG8q35R/dCM4hWYStMf+9YX8adni7mx6ubs7jC 2lag==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-202190-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202190-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6c35d973335si9689880a12.880.2024.06.05.03.22.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 03:22:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202190-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-202190-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202190-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 30894282E22 for ; Wed, 5 Jun 2024 10:22:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7F66B190492; Wed, 5 Jun 2024 10:22:49 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7038D1946D2; Wed, 5 Jun 2024 10:22:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717582969; cv=none; b=pBsujgHsRFjDCVNHmzGGFnHlthGvOwjmgtgXduPdw7z8gD2oqHHWFB9M7yW+Hs9kOJCIarXQjkCNpzg7KyztD8E94WWsmckJOnUeBdU8aMsp3xaSXF/3APAJCJ2UA+nEGXNw6pSHfSCb3biDTzeUDhbltiuPyYVGSmim6nZYAQM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717582969; c=relaxed/simple; bh=dFL1wIIssPf14bjH7g0WUoNEoezNOPiZY06hXBSjm/E=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=tm5GyfP2HQ5rz5liYpbfPw/4let42PtS7ChjGWDtuugF9ZHmWToS3nuE7w09uG2cRUoC1IEfQey4gCSntUka8Pu/HqwS4pNVu5kmTKkSXdF8xE7jR+lv5aEivnsJtaVB2gy06PYzOUZ4UTmZuiQOpVVHPu/AJM9guFzMm164aJA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DCAD6339; Wed, 5 Jun 2024 03:23:10 -0700 (PDT) Received: from J2N7QTR9R3 (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4ED253F792; Wed, 5 Jun 2024 03:22:45 -0700 (PDT) Date: Wed, 5 Jun 2024 11:22:42 +0100 From: Mark Rutland To: Steven Rostedt Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Masami Hiramatsu , Mathieu Desnoyers , Andrew Morton Subject: Re: [PATCH 4/5] ftrace: Convert "filter_hash" and "inc" to bool in ftrace_hash_rec_update_modify() Message-ID: References: <20240604212817.384103202@goodmis.org> <20240604212855.046127611@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=us-ascii Content-Disposition: inline In-Reply-To: <20240604212855.046127611@goodmis.org> On Tue, Jun 04, 2024 at 05:28:21PM -0400, Steven Rostedt wrote: > 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) Aside from the issue with forward declarations that need to be updated, this looks good to me, so with that fixed: Acked-by: Mark Rutland Mark. > --- > 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 > >