Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp6393941rwl; Mon, 9 Jan 2023 07:50:36 -0800 (PST) X-Google-Smtp-Source: AMrXdXshiUos+JtFxPnovAfJR7YekIBboOwTnaUh+VNECjhiyuNNTN7mZY2XBJjHK8ju3M+Ae5hx X-Received: by 2002:a05:6402:1245:b0:498:3bb9:941 with SMTP id l5-20020a056402124500b004983bb90941mr6266250edw.19.1673279435971; Mon, 09 Jan 2023 07:50:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673279435; cv=none; d=google.com; s=arc-20160816; b=qxKdz+5OrurxvLtidekJ0b/Kcu7u6Lgna6X4chS9bc3BCKr3bB5g2ZI0P1AiSXWuIG 26NqA2w6IsQlXh/fIQwFIfXNMMYEF/RLPWdXFV5zif7swu8OqRn1l6wL0frNi4zDHPtZ u+jxFa4aj1pc5mV7C9Cf2xmA/RIHJ59U/1gH1RdeiocYkfI2Blz+oSNEUymnP8h2/Hva fOkQJNeireqX6JUnsy8cq95xMt3pqTeSWwRFX1M6HlDzoCmKi9ftWGcVDQJUVv7TC3tI NFQ7nTNhO14EoP2zX0CZO3estVkdESKfsSLjdfoerb/7Fstf99gjMUqKks4h3d+ooSir Z2uQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=krH/ZGDPP6NhVo3jGUBgaoNASgAnql+qEXGShgZdm3M=; b=W7Tloq/eDzA7/pVWaSRgteg5tn+eZoCtuCtwS0No7KFCK8EmeVO38IuMd1Zzdf5X1A VR84pj6FtyUxX61vAoYUvSMkIvz/Ds6CojB9XmZOYFbFTxUDVKib/QeV6ssbnw60oElj SZd4RNgaKdTuWk8ZekSt1yUwCnNndP6Nq1qzBhATML3xUCPwWicHqz8HJqU+1a9jL8mV YnxBmckgCPdU5np+UrZTqLmx9ajAaTY9sC238hCnfYawKVXRuFfptDnDI7wpnC9Q+VeN PIcLMNhq1Wa44Qp/QPOJPxbArZHJM88hw/7fSXH74BbY/zltjpTaTYz8Pzz/4YghRWZz R7GA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nXLxlMiB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d2-20020aa7d5c2000000b004844fcb5435si8688990eds.313.2023.01.09.07.50.23; Mon, 09 Jan 2023 07:50:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nXLxlMiB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S235184AbjAIPld (ORCPT + 53 others); Mon, 9 Jan 2023 10:41:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237035AbjAIPka (ORCPT ); Mon, 9 Jan 2023 10:40:30 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58DFC26CD; Mon, 9 Jan 2023 07:38:08 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EA1606119C; Mon, 9 Jan 2023 15:38:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25459C433D2; Mon, 9 Jan 2023 15:38:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673278687; bh=7myYQ1O115vx5+6y13iy7L0NzEU0V3HzwHUsg+NH+y8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=nXLxlMiBSkNwxh8n8nZ1vVZtKrpWP6cKV3BEKLs5ZLhbBbUVBTtwGfbjczACpvhNo r3k9Wb1pNjhJU5ENdo4xVolEVy2AXQ0a6vFKyFT6CWQ5es6LGXPBVOQM43ZeGt4Szi CTrALVeDCveynhJWg8+SHWpKkYyIFocQ/GRdIodwJFfLQftY7PT24K+PQzEjBcYl3Q S7PJPciKGxoRx3CCU2AcQrOyg8LW1JJxDniFUiOQW3rHMTta7x5excEB2BlQOhziMv izWiXuQXYHROlwEynDBXcnLe48RQYBjgJfbOJAzfzk12Lmoczra+Icq/k7rwD5D7HE NFQKH6qdiMZNw== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 6BB8640468; Mon, 9 Jan 2023 12:38:04 -0300 (-03) Date: Mon, 9 Jan 2023 12:38:04 -0300 From: Arnaldo Carvalho de Melo To: James Clark Cc: Leo Yan , Ravi Bangoria , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Vlastimil Babka , Hyeonggon Yoo <42.hyeyoo@gmail.com>, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] perf kmem: Support legacy tracepoints Message-ID: References: <20230108062400.250690-1-leo.yan@linaro.org> <14dd06c2-39f8-ccb5-ce59-f3a1e45c94d0@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <14dd06c2-39f8-ccb5-ce59-f3a1e45c94d0@arm.com> X-Url: http://acmel.wordpress.com X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Mon, Jan 09, 2023 at 03:11:47PM +0000, James Clark escreveu: > > > On 08/01/2023 06:23, Leo Yan wrote: > > Commit 11e9734bcb6a ("mm/slab_common: unify NUMA and UMA version of > > tracepoints") removed tracepoints 'kmalloc_node' and > > 'kmem_cache_alloc_node', these two tracepoints have disappeared in the > > latest kernel, but we also need to consider the tool should be backward > > compatible with old kernels. > > > > If detects the tracepoint "kmem:kmalloc_node" is existed on a system, > > this patch enables the legacy tracepoints, otherwise, it will ignore > > them for the new kernels. > > > > Reported-by: Ravi Bangoria > > Fixes: 11e9734bcb6a ("mm/slab_common: unify NUMA and UMA version of tracepoints") > > Signed-off-by: Leo Yan > > --- > > tools/perf/builtin-kmem.c | 29 ++++++++++++++++++++++++++--- > > 1 file changed, 26 insertions(+), 3 deletions(-) > > > > diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c > > index e20656c431a4..50a3df5dc18a 100644 > > --- a/tools/perf/builtin-kmem.c > > +++ b/tools/perf/builtin-kmem.c > > @@ -1824,6 +1824,19 @@ static int parse_line_opt(const struct option *opt __maybe_unused, > > return 0; > > } > > > > +static bool slab_legacy_tp_is_exposed(void) > > +{ > > + /* > > + * The tracepoints "kmem:kmalloc_node" and > > + * "kmem:kmem_cache_alloc_node" have been removed on the latest > > + * kernel, if the tracepoint "kmem:kmalloc_node" is existed it > > + * means the tool is running on an old kernel, we need to > > + * rollback to support these legacy tracepoints. > > + */ > > + return IS_ERR(trace_event__tp_format("kmem", "kmalloc_node")) ? > > + false : true; > > +} > > + > > static int __cmd_record(int argc, const char **argv) > > { > > const char * const record_args[] = { > > @@ -1831,22 +1844,28 @@ static int __cmd_record(int argc, const char **argv) > > }; > > const char * const slab_events[] = { > > "-e", "kmem:kmalloc", > > - "-e", "kmem:kmalloc_node", > > "-e", "kmem:kfree", > > "-e", "kmem:kmem_cache_alloc", > > - "-e", "kmem:kmem_cache_alloc_node", > > "-e", "kmem:kmem_cache_free", > > }; > > + const char * const slab_legacy_events[] = { > > + "-e", "kmem:kmalloc_node", > > + "-e", "kmem:kmem_cache_alloc_node", > > + }; > > Reviewed-by: James Clark > > This fixes the error with mem:kmalloc_node for me. > > I was thinking that it might be best to add all events to the list > conditionally instead of just the legacy ones. That way, the same error > won't happen in the future. But maybe it's best to have an explicit > error again in case the breaking change was unintentional so it's fine > as it is I think. Just applied this, the changes you brains stormed may come as later patches, thanks, - Arnaldo