Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp1329249ybb; Fri, 29 Mar 2019 02:14:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqxRyo15kCWTzJkHwLV837d4UhO6X9zHhRxZx1FJcLVRBsNkRfdbkYYNlgADd/LU1MHpjZwq X-Received: by 2002:a63:2106:: with SMTP id h6mr44281959pgh.441.1553850891482; Fri, 29 Mar 2019 02:14:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553850891; cv=none; d=google.com; s=arc-20160816; b=E7sYOPtCJQL7wstjZkFbY7AwC/FJOWmZx9Zl07pojXgEYiZY+yOSf4qUsMi94cwoHF eqobp4DxTqyiIVeifRh4fRd5WV4UlRnY5DfGjAhh9ngtqPgKaKlq5eS6LfPPC5QjXuZi onOusVTRBaWRZKPwVVHV439V8v19NwwPLisCxBs/Jn32PM5z/ZIXyVjKfAzIs1LyQbEq PHpzWGK1LnTI+2GAD3pIqm5rCIyy0JI/xHGyZteVYyUpLRVD4seDVxhie9zIEmy5gsQv 9UV9MC3fF+qzkAzJfYwobSAneWcZAjRuoEhfEMeGIaFzuv59YwJtYlUBTFJOKOCuQnS4 qLiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=tCrxDSR7wy6CxQVdB3Y0W8VQW1onrHmTfYAg3m9fe6Y=; b=iMT+Oor0F7C604Yy5BrzJkBXmKEp5xzcgAW9FvjxNQhYnjkoPuw1iymKCtmUnVoEOa UwiSAviMp6vyBej78+7p05zVpDO45Qq0yEhx6vdxrHDTHAESbolqRDjA3d9pPjhL4PJa CuD5f0ddRdERhff81YgeiO4R5N0KoQGYNlQhnWj7gL/BBqqS+QkNg6VPdInzoZKGCPzu yhF4zLnksms2tQnmvp3Yi1uLsICJHmhzzhj0UdGsyDmtl/XYJWNXnEy+kyx0vpiWNypF dg6Lbe8lFz14mTkLHl2hvg76cm8y3GRAk6LgR961FmB40fbb7q1v3K3SgpABQhGE8/9q MOgA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 4si1461357plb.395.2019.03.29.02.14.35; Fri, 29 Mar 2019 02:14:51 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729270AbfC2JNt (ORCPT + 99 others); Fri, 29 Mar 2019 05:13:49 -0400 Received: from mga14.intel.com ([192.55.52.115]:21775 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728046AbfC2JNs (ORCPT ); Fri, 29 Mar 2019 05:13:48 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Mar 2019 02:13:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,284,1549958400"; d="scan'208";a="156901087" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by fmsmga004.fm.intel.com with ESMTP; 29 Mar 2019 02:13:45 -0700 From: Alexander Shishkin To: Peter Zijlstra Cc: Arnaldo Carvalho de Melo , Ingo Molnar , linux-kernel@vger.kernel.org, jolsa@redhat.com, Alexander Shishkin , Ben Gainey , stable@vger.kernel.org Subject: [PATCH] perf: Fix AUX record suppression Date: Fri, 29 Mar 2019 11:13:38 +0200 Message-Id: <20190329091338.29999-1-alexander.shishkin@linux.intel.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit 1627314fb54a33e ("perf: Suppress AUX/OVERWRITE records") has an unintended side-effect of also suppressing all AUX records with no flags and non-zero size, so all the regular records in the full trace mode. This breaks some use cases for people. Fix this by restoring "regular" AUX records. Signed-off-by: Alexander Shishkin Fixes: 1627314fb54a33e ("perf: Suppress AUX/OVERWRITE records") Reported-by: Ben Gainey Tested-by: Ben Gainey CC: stable@vger.kernel.org # v4.20+ --- kernel/events/ring_buffer.c | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c index 678ccec60d8f..626256dc26c1 100644 --- a/kernel/events/ring_buffer.c +++ b/kernel/events/ring_buffer.c @@ -455,24 +455,21 @@ void perf_aux_output_end(struct perf_output_handle *handle, unsigned long size) rb->aux_head += 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. - */ - - if (handle->aux_flags & ~(u64)PERF_AUX_FLAG_OVERWRITE) - perf_event_aux_event(handle->event, aux_head, 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. + */ + if (size || (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; if (rb_need_aux_wakeup(rb)) -- 2.20.1