Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp8297410rwl; Tue, 10 Jan 2023 11:30:03 -0800 (PST) X-Google-Smtp-Source: AMrXdXtNk+y1+VOZEjesVDFNWchflRHwNY0nZsXkx5NQWhtP65mv1WZp4inB4hfLIymXQQskgKYq X-Received: by 2002:a05:6a20:d2c6:b0:af:7233:5bfc with SMTP id ir6-20020a056a20d2c600b000af72335bfcmr100979748pzb.8.1673379002926; Tue, 10 Jan 2023 11:30:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673379002; cv=none; d=google.com; s=arc-20160816; b=zWRUS4gWrjEvnOrqspsyEtJtPJ28+kTSAZUWrLeHFW0eMiaAlKvJcU1SHEnBVaMdjH c9af2Fva0hyhl7E2zACDDXnK4ugXDVwngcPX50QonkVzVOuB+y2OKMN9T2i9BWkQX42W 7xRPF6EOGt09P1mG3/8dvnu5rtSQzGK1Lku4UM1iPYBD7cL6O5u88NJKqZ+khMWYbYN7 d4mV3mUJ2VYGSMAbCRI4JNX19DFzFauPFRQeEjil4eVU5+/5H8R6uJMOxKNwsG5jTHBP 9onaAJnal9lZBrqwx5lgt6Q27eXP3I4dI/ii4EbaoQrubGUnHArR1N/WCRZuQr6JHwjr Z9tA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=KO5oCqwQNxlo3PsacBQG8HGR8FuKe5qev8tcfYySGtc=; b=Hndc5iVce3elIYO4beFSl3KM/aA0qTyHqVMhm8eKwBZgA8Y/ioOBnlMg0w2wftkfus EEjj/Q4j2i21zEl9h0utIRVbA3JBFh6qJJvgireh39BmtaEE05Obe+KaTtBVhlu3oSP2 y9gZGviX/Yp0BT1RWlSqkF5Ym0oUigTlTfY+fEB4/Ysa/OB04fiR3easSg3foVdb0D59 1cnd4ksyURLxJJ8EktyYBVpgnY7N1A7OdpjfQefcecSZMT6ljHqIZ5irZY9mex1GFpeA 9qUDchGR40tD3jIeRpEa41DcKirsLIzRrNZhBzKuNCecfuVtULCDoeQA5OERWPt/7eYs 8Xtw== ARC-Authentication-Results: i=1; mx.google.com; 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 w11-20020a63160b000000b004769410323fsi12727763pgl.820.2023.01.10.11.29.56; Tue, 10 Jan 2023 11:30:02 -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; 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 S239535AbjAJTCW (ORCPT + 53 others); Tue, 10 Jan 2023 14:02:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239485AbjAJTBz (ORCPT ); Tue, 10 Jan 2023 14:01:55 -0500 Received: from mail-io1-f53.google.com (mail-io1-f53.google.com [209.85.166.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 491E4C2C; Tue, 10 Jan 2023 11:01:54 -0800 (PST) Received: by mail-io1-f53.google.com with SMTP id p66so6616043iof.1; Tue, 10 Jan 2023 11:01:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=KO5oCqwQNxlo3PsacBQG8HGR8FuKe5qev8tcfYySGtc=; b=SCejT9Jjziz1Rw5zHs25T3KqwBUTVHiojTOmhUxJxXUUexaaylCR/Qxsy1vYy/fCPn RaOr0MPoXLhMX5Cd0sxyPYk7Q+yLW3w2lwUo2otHaA94Bt4ZRWzRcZfaiAuDn0IF6pFQ XGo7Z47rLzblCeI0MIVn0NYCisJdPEFagXbO4HGLAwZeVWLJ2lThnED6SjITcHs+uxh3 up8Ycg3/dSW+WduNGg6caKgyUOO+LHeY6TZtR0yoRLgU/sDPbZOqHfwg+LdRMq5yxHTl aizw1dfxzuXBro3ScRF5q6dNViQDpKWZbT9M23LFtWYo/TGzz+waeUxokX6KF2yZ3Cki 3gZw== X-Gm-Message-State: AFqh2kp00gKn549GFzstF7bwEbyqK8V8hR3m4sKlGyz4VIxqu6WTZAXB JnMRc1313dPn28t/LrYRTa3KnUDaEWo4dshsqMw= X-Received: by 2002:a6b:a16:0:b0:6e3:28c5:e8ee with SMTP id z22-20020a6b0a16000000b006e328c5e8eemr6555797ioi.140.1673377313445; Tue, 10 Jan 2023 11:01:53 -0800 (PST) MIME-Version: 1.0 References: <20221229204101.1099430-1-namhyung@kernel.org> <20221229204101.1099430-2-namhyung@kernel.org> In-Reply-To: From: Namhyung Kim Date: Tue, 10 Jan 2023 11:01:42 -0800 Message-ID: Subject: Re: [PATCH 2/3] perf/core: Set data->sample_flags in perf_prepare_sample() To: Peter Zijlstra Cc: Ingo Molnar , LKML , Arnaldo Carvalho de Melo , Jiri Olsa , Kan Liang , Ravi Bangoria , bpf@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no 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 Tue, Jan 10, 2023 at 2:55 AM Peter Zijlstra wrote: > > 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? Sure, will do. Thanks, Namhyung