Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp3269242lqo; Wed, 15 May 2024 05:05:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX9T3nU+iyIOCV4WXGOwmEInn9/woUNnQdM281nE809Kh6iD5BdH3tMyvO0+ztAwvI5MRmdfxbsA9kjXPw0LeyZIyQYeTF3Y5jN8L+xYg== X-Google-Smtp-Source: AGHT+IFGKk2ZmcFwLlxm66NZjK28beYbfvziLeWANK+SrxTSMrC1e1x7zOtlMiK6NsVBRrOnA2jA X-Received: by 2002:a17:902:7888:b0:1e4:2b90:758e with SMTP id d9443c01a7336-1ef43e27badmr180131495ad.39.1715774727037; Wed, 15 May 2024 05:05:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715774727; cv=pass; d=google.com; s=arc-20160816; b=Mb8NMatMIO0l9acE1xBP7Wg766qGArZKjFyvnvRA/3B09cn45BKpleEEBgc/PDpGdh vJpwkJ0BxPQoiadPwU2mWSoDGtpqhRHOeJbNTwAXFkJZLx/jNKbZws2NchOivLx+DuyP nfUufzUOoKcpvDv35cQGznEck20Vfsf/+5hSmemMB9qSVm9xvelwgakQXDoOUSm+QGLC GvARBWIKceoy8eZ4zuRyvs+Qt+6BFMYncjLiL58adx7dUSVM9l9f0tTI999VufChHVsA eQo3UG8Asy2eDgbnJR+mkBmNWVaECkmPkzMbZcYH8VFtC7GmcB+vi6xnWQ42EbI8MrHI VjTQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=LN7R/89hFiNKE7ZDOsR+E6btUpw/DgQgLlnRJEQx8kQ=; fh=miX1lHUOJ2hC2f5D1nRc+TyWYvSH+ISshfaXCO0iZcc=; b=xN5Dgjq5TFQQo4a+BVtl5z33+ZMIP7DPMYp+codFK9DIeb2lmcSlDgZnjworQkSjrs dptgwctuPQs3Pta75imCKqlTQ3uaXI6CA4StVwnlG6DUx1XsrwTXjMZQAIH/6QTULVVC M7cSSOkG9UXS6ANAzQk8CL867DoIHHA7XAoxp7RMZCmaTd4ZESnIbxFTtpOdetsRT/lm 6l2RxGY4IMfyJOU+4udA4abN/33ZjUqoJM80svKpUOShJZHv82shrYyESpkPv2EVbM+6 r7Bp1JApznPY02GueKgphc+tEtrJILAGOiMhKOZHhbb9nNzitgkiDiP50tO2l7sD467J EupA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=kheFWwti; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-179684-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179684-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d9443c01a7336-1ef0c14c794si134596535ad.483.2024.05.15.05.05.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 05:05:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-179684-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=kheFWwti; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-179684-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179684-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 47FCF281858 for ; Wed, 15 May 2024 09:00:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3799A59155; Wed, 15 May 2024 08:58:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="kheFWwti" Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6451A57CB5; Wed, 15 May 2024 08:58:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715763491; cv=none; b=n5N0eqXbM/UHpsr5QnF/f6M3p9SsFKDqf70esQkSiwx0lq4QXkVPaVhAGm0uk9B3NT+XLkF9qoVaGnyKMi/UXA7fsRL55b4Sq2AfFXcuQ3wMZa4agSZ5UzYsDvU4VwXfB1X9WbH2oiksKmzBr32gXm4tqU4fTsZ6FlBJ7K0eooM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715763491; c=relaxed/simple; bh=WxhNVJglXJ6bifS2+W6QqNp4SxMw1w+StWa+9MJ2u70=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=i7m0DlJybF+13Mkik/nvrFCwf1k0kHQ1bj8xtnlTSSO3tKNkcifU1VH37c74E/Ri4tjQEjNVWB/VwSCTM/0jINsen5qzfbV44I7xNdU8ya+vBxvD1glC+XAPNZX/WAR/i+AUe0jHAWfDGjZOcC3J+R4YooXm0VfR1SHLEVpNiwI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=kheFWwti; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=LN7R/89hFiNKE7ZDOsR+E6btUpw/DgQgLlnRJEQx8kQ=; b=kheFWwtiLwToB5Ja8OlBP3jaYi SxjYf45I3t5MbVXsSY+sz/7hLX9h2KLp6ECp9lF8CYolkN4XWvsTR6cAbTdRZUpJS1Ul9BpH8u+YH WR6Y9QZrSal5bja3nzexsfK/KnHnhkaJZbYfbAxrSsR/V9Bps1TvjMcXWYT8Ttqq8gUbYFKwLCNzD 7aNOlg0i9qUOpFyfJ/aZVuUGfaZfe/tx3EYZREXNwV7W1kfxgyRcdhsQXj0f0Rb2gxEQ7aCR+JBg4 pKNc8bzj6i6hPoASUbsJ2Wph9rqz8jgtv9c4czJiyRfm8wSAeFjoVMQ4k8wsdIiV4IPCh0Ks6UU74 9H2Wt0dg==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1s7ASR-0000000A8iI-3U4k; Wed, 15 May 2024 08:57:59 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 62178301105; Wed, 15 May 2024 10:57:55 +0200 (CEST) Date: Wed, 15 May 2024 10:57:55 +0200 From: Peter Zijlstra To: Yabin Cui Cc: Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org Subject: Re: [PATCH v4 1/3] perf/core: Save raw sample data conditionally based on sample type Message-ID: <20240515085755.GC40213@noisy.programming.kicks-ass.net> References: <20240510191423.2297538-1-yabinc@google.com> <20240510191423.2297538-2-yabinc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240510191423.2297538-2-yabinc@google.com> On Fri, May 10, 2024 at 12:14:21PM -0700, Yabin Cui wrote: > diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h > index d2a15c0c6f8a..9fc55193ff99 100644 > --- a/include/linux/perf_event.h > +++ b/include/linux/perf_event.h > @@ -1240,12 +1240,16 @@ static inline void perf_sample_save_callchain(struct perf_sample_data *data, > } > > static inline void perf_sample_save_raw_data(struct perf_sample_data *data, > + struct perf_event *event, > struct perf_raw_record *raw) > { > struct perf_raw_frag *frag = &raw->frag; > u32 sum = 0; > int size; > > + if (!(event->attr.sample_type & PERF_SAMPLE_RAW)) > + return; > + Should we add something like: if (WARN_ON_ONCE(data->sample_flags & PERF_SAMPLE_RAW)) return; ? And I suppose the same for all these other patches. > do { > sum += frag->size; > if (perf_raw_frag_last(frag))