From patchwork Wed Jan 18 06:05:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namhyung Kim X-Patchwork-Id: 44987 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2171333wrn; Tue, 17 Jan 2023 22:22:58 -0800 (PST) X-Google-Smtp-Source: AMrXdXuVYP2F6wIwDoMV/LpQIH9lbzCo5tT6Q+EwE61xCc3H58HF0q2qSGqTN6Gkcp3cf5DvvUrL X-Received: by 2002:a17:90b:698:b0:226:ad9f:92c6 with SMTP id m24-20020a17090b069800b00226ad9f92c6mr27775969pjz.32.1674022978290; Tue, 17 Jan 2023 22:22:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674022978; cv=none; d=google.com; s=arc-20160816; b=WMGTbDbyBdgcuEY33/c9fbvfF2yoCGHAnMGA4xc2pzXLe16LFOOWaIIEBW2qRoY+ai ZqQKaep3Ruu4l7DK9mEG1X84wm6+Rw/TiFDLjl9uK8JbOzruE0XoKMHrvw+T3jNTfzTM t7XYHSWoBbMCc7hsg/jq7jB7vYMVQImq0wnIMPlosAmwUOsFD9TD3TgY7a9VBSuDFa10 p2QxDi1/Lmtgm3TYJ9H8o585dXLs4Nz92z97lqhs0UYXDVQxD+9Z+cJlMji1fxjh6Kd0 xUvCfFZYuj8sBHNgKP5sF9yQfgmHsTrUR66ATYf7OW2nM/RlNNJ2ymK480UTccUKjCFC NgLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from:sender :dkim-signature; bh=G8Zh73XBwb5RMlMiLWpYbNBMevrlhNdfAXS0S1zywoE=; b=mDV/pJszbT0sRJK+98dM/1Pm7KGdWKdSmNpaDtPvN4eq3rHvG0qMnErzwzfwpI9+R4 fBAA/46EThR3Yi9C4kkorhIJx56XhnWt+mvluW9TlMLwWqQparLvseQM/xFA/5jQu1eY 6sN5vZogJ8MXgjEvFXe5xOzRpJvosTLdiOFLP+krUoIstlcZJxAxI6Yx2mOKAyCYOE+l 7EWAmUOnutgC09CvkkSsV7LG/o9jGeoSk/SK+zisGv2jGf52s0iWf2SdOj9UQzxaUcha AC6ciQamvs2pm0d/8ryDCvlrH5laykQU3NFAeTlBpSGzMcFuKn+XMkKApYkcz9c80Cz9 hy6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=BtwVgukY; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d8-20020a17090ab30800b0021a005518d0si1205107pjr.50.2023.01.17.22.22.43; Tue, 17 Jan 2023 22:22:58 -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=@gmail.com header.s=20210112 header.b=BtwVgukY; 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 S229682AbjARGVh (ORCPT + 99 others); Wed, 18 Jan 2023 01:21:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229654AbjARGSW (ORCPT ); Wed, 18 Jan 2023 01:18:22 -0500 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DE8A1D921; Tue, 17 Jan 2023 22:06:21 -0800 (PST) Received: by mail-pj1-x102b.google.com with SMTP id d8so3576686pjc.3; Tue, 17 Jan 2023 22:06:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=G8Zh73XBwb5RMlMiLWpYbNBMevrlhNdfAXS0S1zywoE=; b=BtwVgukY8p2esH90r+fFnX1sw/xNf3PzZDpleVXeJjNvYBea8dbKTD5knI16ZPYgok oWn2fv24+g5U8shpZzCUvHcGQU/61rPmRCn9+RfJ85ha/rMs3/KosTyQVgV7NtrmyCz9 k0NtzMhxCIPQA9rL3f3cKv4MdNW7MzBGeEZf6HWSeogLiXicdsFcOly6Ywmq6L1TuMJG NgEl5ocR60OBqguMRShxpuyN+LS7xyEX+uO4TYUyfI8n92g67XLuUVs/F5eWkkkkilZB V4p+vpsyyHfWexwQcDIf13zJQKJT3g/x0gCQyEZzkJfC/9eLVI6H25KIajRv/tGPCvFH y38w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=G8Zh73XBwb5RMlMiLWpYbNBMevrlhNdfAXS0S1zywoE=; b=LiCoUyz5/UQtCXdByEOVEyWfTrecc+QWrDluUWQ12AFSt/JzDj5v1X1ChROOfRTbYx Ba5CDXcMR1g4aDdOy1pmmTrqPbzKiJgh+sXJQSXFgLwknloF05RtwRziaq8wDTnCWvim rymU+tCsg695RMyTVR4QdKgozee418FiLakAaA+a/XlQoChgq7gklRL4A+wLqURrS7n0 moWjkNtUKh7Y0wCLnQu/ID4BkS9OKGNob0oi2D9TRBcgTm6YHj+hacY2wKDR6wzPpD47 6mc1wmRVFlUJgRzA+ctHSK7sMjkRLzKgyfgnjHpoUPrqXUTVi9Foo93R19DHjDXN00+X fzPA== X-Gm-Message-State: AFqh2kqIzgMK/HP5IdJIda5uwa+KkN8gnL9xABDqhkCMrliPPHi2MYfM ES1PNz1RwpM2wNxhm/5vy1dMjREWO+A= X-Received: by 2002:a05:6a20:b925:b0:9d:efbf:8156 with SMTP id fe37-20020a056a20b92500b0009defbf8156mr29465355pzb.31.1674021969212; Tue, 17 Jan 2023 22:06:09 -0800 (PST) Received: from balhae.hsd1.ca.comcast.net ([2601:647:6780:ff0:3749:9eb3:dfb5:f449]) by smtp.gmail.com with ESMTPSA id b126-20020a62cf84000000b00574e84ed847sm10990180pfg.24.2023.01.17.22.06.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Jan 2023 22:06:08 -0800 (PST) Sender: Namhyung Kim From: Namhyung Kim To: Peter Zijlstra , Ingo Molnar Cc: Mark Rutland , Alexander Shishkin , Arnaldo Carvalho de Melo , Jiri Olsa , LKML , Song Liu , bpf@vger.kernel.org Subject: [PATCH 6/8] perf/core: Do not pass header for sample id init Date: Tue, 17 Jan 2023 22:05:57 -0800 Message-Id: <20230118060559.615653-7-namhyung@kernel.org> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog In-Reply-To: <20230118060559.615653-1-namhyung@kernel.org> References: <20230118060559.615653-1-namhyung@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755340318359218201?= X-GMAIL-MSGID: =?utf-8?q?1755340318359218201?= The only thing it does for header in __perf_event_header__init_id() is to update the header size with event->id_header_size. We can do this outside and get rid of the argument for the later change. Acked-by: Jiri Olsa Acked-by: Song Liu Tested-by: Jiri Olsa Signed-off-by: Namhyung Kim --- kernel/events/core.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/kernel/events/core.c b/kernel/events/core.c index 1384137a90f7..9cc55122188f 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -7061,14 +7061,12 @@ static void perf_aux_sample_output(struct perf_event *event, PERF_SAMPLE_ID | PERF_SAMPLE_STREAM_ID | \ PERF_SAMPLE_CPU | PERF_SAMPLE_IDENTIFIER) -static void __perf_event_header__init_id(struct perf_event_header *header, - struct perf_sample_data *data, +static void __perf_event_header__init_id(struct perf_sample_data *data, struct perf_event *event, u64 sample_type) { data->type = event->attr.sample_type; data->sample_flags |= data->type & PERF_SAMPLE_ID_ALL; - header->size += event->id_header_size; if (sample_type & PERF_SAMPLE_TID) { /* namespace issues */ @@ -7095,8 +7093,10 @@ void perf_event_header__init_id(struct perf_event_header *header, struct perf_sample_data *data, struct perf_event *event) { - if (event->attr.sample_id_all) - __perf_event_header__init_id(header, data, event, event->attr.sample_type); + if (event->attr.sample_id_all) { + header->size += event->id_header_size; + __perf_event_header__init_id(data, event, event->attr.sample_type); + } } static void __perf_event__output_id_sample(struct perf_output_handle *handle, @@ -7584,7 +7584,7 @@ void perf_prepare_sample(struct perf_event_header *header, u64 filtered_sample_type; header->type = PERF_RECORD_SAMPLE; - header->size = sizeof(*header) + event->header_size; + header->size = sizeof(*header) + event->header_size + event->id_header_size; header->misc = 0; header->misc |= perf_misc_flags(regs); @@ -7602,7 +7602,7 @@ void perf_prepare_sample(struct perf_event_header *header, PERF_SAMPLE_REGS_USER); filtered_sample_type &= ~data->sample_flags; - __perf_event_header__init_id(header, data, event, filtered_sample_type); + __perf_event_header__init_id(data, event, filtered_sample_type); if (filtered_sample_type & PERF_SAMPLE_IP) { data->ip = perf_instruction_pointer(regs);