Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp7603488rwl; Tue, 10 Jan 2023 03:05:26 -0800 (PST) X-Google-Smtp-Source: AMrXdXvNhZA2Wv6qvGMuBhAHdfcMBv+nN5jyLS6f43FeSZK7uQLORl0YpNsMQYJ3iTkX9QuLPa4N X-Received: by 2002:a17:90a:bc8b:b0:226:c966:28a7 with SMTP id x11-20020a17090abc8b00b00226c96628a7mr18418969pjr.14.1673348725956; Tue, 10 Jan 2023 03:05:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673348725; cv=none; d=google.com; s=arc-20160816; b=mjWDN8zkoBm4ap98pT/4U/6xY5dVzks5BFXwV8NJo7wH8AS7R6y5xHnYpuGaUseCQx I6EQb5TmcB4zpWQYgxHNSa0U3Pg/TdQlYPOvVxbafDYYL/+vG0QlC0UA3lAZEmJxzu3T yvtmnbP5deAE9by4jkN3/dRxabzCAFeaNiVIBKM7w5bMSYFeQ+Ub5U95zNYOPSum62bJ AQ6jX/cwBQi6xb2gzKVJnxnNQnHfycNPQ8ZV43Yhjb3Oi4ehphELo7FEKAFHEvRqDhuH bgA4xNSDq/Ri2jhGNN9M8odvJoe0anSz7AO9yTiERn4H5MVE4hY4+/8IHZVlhmaKaB6v P3sg== 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=TogT4Ztt7q4ZysT3AFT1rk+GzjsAIPFhnae9QZmezhE=; b=v/pcJ1Fw6yCl8yUP7+DpIsT4cmt2v/YAYroShYk0bS8HAjzyo5Yvf8l7oz5oROI/3T T3AD/7l6B3MGq4XazYREvIU9dd8WWxwKVddxMppq+x+5R1+eO51g5gusM5mymhyhLRcy cpR2QJBIKd48HUFWHVV48huFleoybGfsLPMnGO9lOSuL5pDuv4/vs5LCxuBtycA7f0LO c6DTiy07vIk9NOScJiJlp+CpRwV2nQ0pjLh5Kh8bvx5ZyERVTTAJw3KotE7PoAoxXMKP y9XeiFePz8fhBf9izx0w6CzuzdG058EufjwKDYndWqdmUIBUGYGlcSeyd7mclan//JZg Fk5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=M3Inx9zC; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ip10-20020a17090b314a00b002267d43a713si12091287pjb.125.2023.01.10.03.05.19; Tue, 10 Jan 2023 03:05:25 -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=@infradead.org header.s=desiato.20200630 header.b=M3Inx9zC; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238345AbjAJK4o (ORCPT + 53 others); Tue, 10 Jan 2023 05:56:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237882AbjAJK4j (ORCPT ); Tue, 10 Jan 2023 05:56:39 -0500 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28556202; Tue, 10 Jan 2023 02:55:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=TogT4Ztt7q4ZysT3AFT1rk+GzjsAIPFhnae9QZmezhE=; b=M3Inx9zClV1a15sUXMSqSUMu3O J1u+fjbAfKS21OB5+BUgZJHTEbcHslZOtgu8/gDjg95ya69gg6tiYKTPyuD2nOE5JO6t5UdvUgOGb XqPjVQUfVFx3Cc5okP5rKUPXw/u80kOOCQGNCIYza7owNnn1n3tF0XUAa0HjQ+vWziDVlIiQBjVit ketlZHqRI3IR+XItjANwuMlqlidEOzYf71uUGeU4dy0s2aVAJMXlqY27piyFDB3NP5khQq51YAiag ggBDL8Y7wkV+HsDCmGjHm22DgUZMuJbFeoV3faJeGYWUKuXgMB4iYcVX3ZYWkcf05oQf8Am0UqgbO UKKuIiYw==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1pFCI2-0036Y5-2Q; Tue, 10 Jan 2023 10:55:35 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id CC470300033; Tue, 10 Jan 2023 11:55:41 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id BD839201ABB68; Tue, 10 Jan 2023 11:55:41 +0100 (CET) Date: Tue, 10 Jan 2023 11:55:41 +0100 From: Peter Zijlstra To: Namhyung Kim Cc: Ingo Molnar , LKML , Arnaldo Carvalho de Melo , Jiri Olsa , Kan Liang , Ravi Bangoria , bpf@vger.kernel.org Subject: Re: [PATCH 2/3] perf/core: Set data->sample_flags in perf_prepare_sample() Message-ID: References: <20221229204101.1099430-1-namhyung@kernel.org> <20221229204101.1099430-2-namhyung@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE 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 On Mon, Jan 09, 2023 at 12:21:25PM -0800, Namhyung Kim wrote: > > However; inspired by your next patch; we can do something like so: > > > > if (filtered_sample_type & PERF_SAMPLE_CALLCHAIN) { > > data->callchain = perf_callchain(event, regs); > > data->sample_flags |= PERF_SAMPLE_CALLCHAIN; > > > > data->size += (1 + data->callchain->nr) * sizeof(u64); > > } > > This is fine as long as all other places (like in PMU drivers) set the > callchain update the sample data size accordingly. If not, we can get > the callchain but the data size will be wrong. Good point, maybe add a helper there to ensure that code doesn't duplicate/diverge?