Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp155565rwb; Wed, 28 Sep 2022 00:23:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM47jwA+UjT2LmQvopmm+bCmPzgwmJRPptVGFqpkOzVhuVeCX7L9N3X6DxWjin1TKP7jAp/B X-Received: by 2002:a63:5c43:0:b0:439:f213:1555 with SMTP id n3-20020a635c43000000b00439f2131555mr27450441pgm.506.1664349831251; Wed, 28 Sep 2022 00:23:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664349831; cv=none; d=google.com; s=arc-20160816; b=PJdtPd+39wwwOCn1phXPVToilqyeYnMfZowIX9J01xOyybwUbbUbdmSFaYIXokKCMM TZDArEQSKUZ86Bc1ShM+tqYx2pHyVyKjvWZdUaE3ejn35bcavFZtDt5iRZGi6G+FGeFf TPewiwyqUcqsXAV5eqrftU4VYq/3/hLoa/JhNCUg2RePVj9IBNhh/2v6MdAdYZm+UBIK Pr9OmoYTNe4P3Bd/9QmNzRweTG/JJdWIjX1d+yccMp7yHdLG9lqVgaJDbsku2SjjyLYH eE4PBNyIDN1iWp9aXtA4rza8i3VCVkg41ZY4gX9+7fU2W3x58vrt28gnd78ln8mx0RV6 hpug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=YFu7nnk8kMBWwPl8IqyP7zFs+hVguPmywV5EeUtNqpw=; b=SI2Qpdz4fim7GELG/yuoXy6N0J6Dd9ZLRSEnKpVLKQXx+gt0qb0bDHoSYycb5phgjB Vv96sjMa2jE7heEKalEI/TMeXTRmOIkWE+XRtOe9WBffKWb/E2H5jb5omowoTlZWibS+ hesaroaoNN69YPYuO4SE8onti5jpYDU/IlEh+vxqLhIhbPa4gQpw3UtObT2GB92GgSWX 9PsZhFV4wT3j2HVhhqqUkKdGqSHUuGSaBIlw4RX5l46YCfOYONpYJ9ar/nDqWCgLhQ1y gvxi/45BZZqyPUVYVUicc69p4x4CvoQ5sW1WLnAetFGeT9x99rm9g2/7vCbFt6zGUqCk QyvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=4K2MfT1u; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="/f6kngUC"; 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=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k69-20020a638448000000b0040cf84add25si4221506pgd.878.2022.09.28.00.23.39; Wed, 28 Sep 2022 00:23:51 -0700 (PDT) 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=@linutronix.de header.s=2020 header.b=4K2MfT1u; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="/f6kngUC"; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231650AbiI1G57 (ORCPT + 99 others); Wed, 28 Sep 2022 02:57:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233302AbiI1G53 (ORCPT ); Wed, 28 Sep 2022 02:57:29 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01BF8861DA; Tue, 27 Sep 2022 23:57:24 -0700 (PDT) Date: Wed, 28 Sep 2022 06:57:21 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1664348242; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YFu7nnk8kMBWwPl8IqyP7zFs+hVguPmywV5EeUtNqpw=; b=4K2MfT1u5yqhpnlmZGdVIKOfHvpX0dVlS5F56tzzK4sOjgLqV8WZ8nXRUUbMLc9H5Sarv2 0CgMtD6SJJ9/EV8J8GpNto7MCE3QuPiIylp7vCXTcSOIPuugsEEsK+9FPuct40kBHcCqai ESItFhhd5KmmzIPhTxSE3/p6WlxR6w0GryG+uc4O3SsTtgUvox2SfalxNMT/dl83PW5HOo 3EPfcpmSlhBt2hlwxKrVhj0Og31wF2UoxtgN5iJQyYR3Ygyhl9ylN7ln07BP4G3HQBhA63 i/dONP5USHwZ7qWoSlUiOKpSjlqq1lDzTWXkTsvHIOgoOWnvnAeyLe6rmdraWA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1664348242; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YFu7nnk8kMBWwPl8IqyP7zFs+hVguPmywV5EeUtNqpw=; b=/f6kngUCsOvIdxGMSVM//dmP1l1Dfc+L6jRu4mBGIHb9IM5gvv3Mkz/svwhFtoCchv3LTs xmkwruj7Br2XrvAQ== From: "tip-bot2 for Namhyung Kim" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/core] perf: Use sample_flags for raw_data Cc: Namhyung Kim , "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20220921220032.2858517-2-namhyung@kernel.org> References: <20220921220032.2858517-2-namhyung@kernel.org> MIME-Version: 1.0 Message-ID: <166434824149.401.4361243714612738808.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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_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 The following commit has been merged into the perf/core branch of tip: Commit-ID: 838d9bb62d132ec3baf1b5aba2e95ef9a7a9a3cd Gitweb: https://git.kernel.org/tip/838d9bb62d132ec3baf1b5aba2e95ef9a7a9a3cd Author: Namhyung Kim AuthorDate: Wed, 21 Sep 2022 15:00:32 -07:00 Committer: Peter Zijlstra CommitterDate: Tue, 27 Sep 2022 22:50:24 +02:00 perf: Use sample_flags for raw_data Use the new sample_flags to indicate whether the raw data field is filled by the PMU driver. Although it could check with the NULL, follow the same rule with other fields. Remove the raw field from the perf_sample_data_init() to minimize the number of cache lines touched. Signed-off-by: Namhyung Kim Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20220921220032.2858517-2-namhyung@kernel.org --- arch/s390/kernel/perf_cpum_cf.c | 1 + arch/s390/kernel/perf_pai_crypto.c | 1 + arch/x86/events/amd/ibs.c | 1 + include/linux/perf_event.h | 5 ++--- kernel/events/core.c | 3 ++- 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/arch/s390/kernel/perf_cpum_cf.c b/arch/s390/kernel/perf_cpum_cf.c index f7dd3c8..f043a7f 100644 --- a/arch/s390/kernel/perf_cpum_cf.c +++ b/arch/s390/kernel/perf_cpum_cf.c @@ -664,6 +664,7 @@ static int cfdiag_push_sample(struct perf_event *event, raw.frag.data = cpuhw->stop; raw.size = raw.frag.size; data.raw = &raw; + data.sample_flags |= PERF_SAMPLE_RAW; } overflow = perf_event_overflow(event, &data, ®s); diff --git a/arch/s390/kernel/perf_pai_crypto.c b/arch/s390/kernel/perf_pai_crypto.c index b38b4ae..6826e2a 100644 --- a/arch/s390/kernel/perf_pai_crypto.c +++ b/arch/s390/kernel/perf_pai_crypto.c @@ -366,6 +366,7 @@ static int paicrypt_push_sample(void) raw.frag.data = cpump->save; raw.size = raw.frag.size; data.raw = &raw; + data.sample_flags |= PERF_SAMPLE_RAW; } overflow = perf_event_overflow(event, &data, ®s); diff --git a/arch/x86/events/amd/ibs.c b/arch/x86/events/amd/ibs.c index ce5720b..c29a006 100644 --- a/arch/x86/events/amd/ibs.c +++ b/arch/x86/events/amd/ibs.c @@ -781,6 +781,7 @@ fail: }, }; data.raw = &raw; + data.sample_flags |= PERF_SAMPLE_RAW; } /* diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index f4a1357..e9b151c 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -1028,7 +1028,6 @@ struct perf_sample_data { * minimize the cachelines touched. */ u64 sample_flags; - struct perf_raw_record *raw; u64 period; /* @@ -1040,6 +1039,7 @@ struct perf_sample_data { union perf_mem_data_src data_src; u64 txn; u64 addr; + struct perf_raw_record *raw; u64 type; u64 ip; @@ -1078,8 +1078,7 @@ static inline void perf_sample_data_init(struct perf_sample_data *data, u64 addr, u64 period) { /* remaining struct members initialized in perf_prepare_sample() */ - data->sample_flags = 0; - data->raw = NULL; + data->sample_flags = PERF_SAMPLE_PERIOD; data->period = period; if (addr) { diff --git a/kernel/events/core.c b/kernel/events/core.c index a91f74d..04e19a8 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -7332,7 +7332,7 @@ void perf_prepare_sample(struct perf_event_header *header, struct perf_raw_record *raw = data->raw; int size; - if (raw) { + if (raw && (data->sample_flags & PERF_SAMPLE_RAW)) { struct perf_raw_frag *frag = &raw->frag; u32 sum = 0; @@ -7348,6 +7348,7 @@ void perf_prepare_sample(struct perf_event_header *header, frag->pad = raw->size - sum; } else { size = sizeof(u64); + data->raw = NULL; } header->size += size;