Received: by 10.213.65.68 with SMTP id h4csp825234imn; Wed, 4 Apr 2018 07:55:13 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/iZTxZKfJVCqsZJ3maUztDKM6olaFbWr4dF7AJM5IHnlVxHBJKmLB10aNI455PiosGDIeo X-Received: by 10.98.242.6 with SMTP id m6mr13997782pfh.170.1522853713051; Wed, 04 Apr 2018 07:55:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522853713; cv=none; d=google.com; s=arc-20160816; b=LGOHfCs6Bbyq0++u7dXRlbelRnj3TO8884maOv7omx4oQ+1kC8qlYRuPVworSinXck pF1o35FLIrTZemrMJX9ju3sQCFg2wD6pLfsQZene/4RD0gUBVPPdom+ZYm6yleOr933w vksXp9hb6f+sNyBRWCOSDbgaMFqDTEwgHBPkiymIaKKeRns8AEug0725yaeqbpN4jtZo aS/Cxt3N2WApK67p43wysbbemuWhmfqxt4gpClf9hVQkd4g8n+CW0ZGfAenkgLYl6sii skZBSer1zzGLlPVzIA/E91j4oKjhqgDs4A7m5O4afZR+VzBTTdCfZfiJaOXf/f3pJkp1 E4YQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=UIqTJhcgGRgrATamiwp/bfYlx1rphEu8bh9y/b6JtxI=; b=hJkwrkjEL+YYr4Vppb/ATeJE0S69N6KAcMDORayZTIWewg72KR73D8e/YB0jVsjTcV JXkdNpOXYbQRdGPU19YgUk1pq4j5/+K+Yz3uVRAdZD8WePGooBYOdhHggzMYP3ibwm4j TpNrU2pDhQwXJM1OSVugMbx6ocPrntAAyzps/dUdeQylh/GhkXvS6pD8wSqXuwi6MZH5 rz/+ZaoEJKNBJ9K5IVxc5ZUZ9KlEndnODGuhVJJf6qyDbc41ZdIlyn05UCFRdtXoSE2M xNaBxHr1kS3lek6Hmofcm46pF2qas1ScJzxTVRHBsu9y4NYuX/LtsB8WQjjTCOV7+xb4 H5uw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 34-v6si3322561pln.473.2018.04.04.07.54.58; Wed, 04 Apr 2018 07:55:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751368AbeDDOxq (ORCPT + 99 others); Wed, 4 Apr 2018 10:53:46 -0400 Received: from mga03.intel.com ([134.134.136.65]:6629 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751251AbeDDOxp (ORCPT ); Wed, 4 Apr 2018 10:53:45 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Apr 2018 07:53:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,406,1517904000"; d="scan'208";a="30655942" Received: from um.fi.intel.com (HELO localhost) ([10.237.72.212]) by orsmga007.jf.intel.com with ESMTP; 04 Apr 2018 07:53:42 -0700 From: Alexander Shishkin To: Peter Zijlstra , Ingo Molnar Cc: Arnaldo Carvalho de Melo , linux-kernel@vger.kernel.org, Will Deacon , Adrian Hunter , Alexander Shishkin , Markus Metzger Subject: [PATCH v2] perf: Suppress AUX/OVERWRITE records Date: Wed, 4 Apr 2018 17:53:23 +0300 Message-Id: <20180404145323.28651-1-alexander.shishkin@linux.intel.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180403173207.GA8921@arm.com> References: <20180403173207.GA8921@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It has been pointed out to me many times that it is useful to be able to switch off AUX records to save the bandwidth for records that actually matter, for example, in AUX overwrite mode. The usefulness of PERF_RECORD_AUX is in some of its flags, like the TRUNCATED flag that tells the decoder where exactly gaps in the trace are. The OVERWRITE flag, on the other hand will be set on every single record in overwrite mode. However, a PERF_RECORD_AUX[flags=OVERWRITE] is generated on every target task's sched_out, which over time adds up to a lot of useless information. If any folks out there have userspace that depends on a constant stream of OVERWRITE records for a good reason, they'll have to let us know. Signed-off-by: Alexander Shishkin Cc: Markus Metzger Cc: Adrian Hunter --- kernel/events/ring_buffer.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c index 6c6b3c48db71..c4edd8fbc5d9 100644 --- a/kernel/events/ring_buffer.c +++ b/kernel/events/ring_buffer.c @@ -458,10 +458,20 @@ void perf_aux_output_end(struct perf_output_handle *handle, unsigned long size) if (size || handle->aux_flags) { /* * Only send RECORD_AUX if we have something useful to communicate + * + * Note: the OVERWRITE records by themselves are not considered + * useful, as they don't communicate any *new* information, + * aside from the short-lived offset, that becomes history at + * the next event sched-in and therefore isn't useful. + * The userspace that needs to copy out AUX data in overwrite + * mode should know to use user_page::aux_head for the actual + * offset. So, from now on we don't output AUX records that + * have *only* OVERWRITE flag set. */ - perf_event_aux_event(handle->event, aux_head, size, - handle->aux_flags); + if (handle->aux_flags & ~(u64)PERF_AUX_FLAG_OVERWRITE) + perf_event_aux_event(handle->event, aux_head, size, + handle->aux_flags); } rb->user_page->aux_head = rb->aux_head; -- 2.16.3