Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1319470yba; Wed, 24 Apr 2019 20:01:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqzirUUgmI8DXLcAubKv4/WN2zVW0bbGYWA+eNybZaZ44u5w+xMfZk8KjtsrbkNW4Wzu21Lu X-Received: by 2002:aa7:9392:: with SMTP id t18mr37350659pfe.45.1556161276606; Wed, 24 Apr 2019 20:01:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556161276; cv=none; d=google.com; s=arc-20160816; b=bhxvBvlmNdopJl7QADxgj8jLDOvP4Wn9S0yjdsaeYWBVZW8bNlatSkVatgAOlfkFan wYL2oeeU2CkxxzsjRELuY27TKU2qEPI3hqw//sedBq4SSEx7xkePSyMIGR66ULs36rRH M9whr2foo87qyZxsUgT/+LHqMzDevxBJWqu9qEKds0WuP76hOmmFZcrqvIDp3mwcHf/E N7vWCmoAo6oKJoGD/XF4dIedTrTSbzmi6PfuZiZaSd/xUSxiVERy9CHTmR/ES51J5K3T LaoTdXTpC/9wN7LShhJNZxvS+3GtP/ETLFS3VwE4Sa3a3LNz5eQ7YiZ50A1ISuPyaxLZ yzOA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rSwHCCGqdSrSnVPcoZ2JBFuni1KBBgBI16zFkRgEJjE=; b=o96XXJftU9JBxfzUN3QGWt5R2ReM3+vEhct+368EcvIGregmX2DXars4rYx5ZIcjSD t4SiP//jLccjZtEpzU7uN30g7z4lK1HcdOqZW72kEWw1/rEdmifgkvMxl/2ORiqXFvvz V/ZPyNeKD8kztqB2v8k8tdta+dl+Yb7WORqUUy7+LQhA/GZjWReI31R4zqVKsytQ6/Ll z8OTAFFP4QwdJE1SfMqnqbO/moJUa7aRYPNfCKG1jtDCVX5LUe+bPe2DckXUFGRmWTGw pRdfTJwyX9Jfo+GTFdQoS2+Z6DPwmeL0AIlZ0S/+RaCm5dzmQRp3FAaRoXf/v01W0Iyu 1Kng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Z4j5PNOi; 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 a15si6294776pfr.50.2019.04.24.20.01.01; Wed, 24 Apr 2019 20:01:16 -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; dkim=pass header.i=@kernel.org header.s=default header.b=Z4j5PNOi; 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 S2392386AbfDXRiU (ORCPT + 99 others); Wed, 24 Apr 2019 13:38:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:37412 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392373AbfDXRiQ (ORCPT ); Wed, 24 Apr 2019 13:38:16 -0400 Received: from localhost (62-193-50-229.as16211.net [62.193.50.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7134A20675; Wed, 24 Apr 2019 17:38:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556127495; bh=FufMNJrseEIrEfH6YgA9Rr8so//dfXiyy9iQqeqqQw0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z4j5PNOiZzTRFerTsPzpytlHbaKrZrF/gBHrWZLHd4BwuLHibc/BShtxQfRsLAyQh +FL+Q9iv+QIsp5H66T8RsLZU8NPxwOA7zo/g6wyhzFtDOWOdjdDq8kHH7jDknBrxtl 6woGECPHYcH8U0odAc49fKyRAC+T62oYb0KHo4v8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ben Gainey , Alexander Shishkin , "Peter Zijlstra (Intel)" , Arnaldo Carvalho de Melo , Jiri Olsa , Linus Torvalds , Stephane Eranian , Thomas Gleixner , Vince Weaver , Ingo Molnar Subject: [PATCH 5.0 111/115] perf/ring_buffer: Fix AUX record suppression Date: Wed, 24 Apr 2019 19:10:47 +0200 Message-Id: <20190424170931.165049663@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190424170924.797924502@linuxfoundation.org> References: <20190424170924.797924502@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alexander Shishkin commit 339bc4183596e1f68c2c98a03b87aa124107c317 upstream. The following 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. Reported-by: Ben Gainey Tested-by: Ben Gainey Signed-off-by: Alexander Shishkin Signed-off-by: Peter Zijlstra (Intel) Cc: Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Stephane Eranian Cc: Thomas Gleixner Cc: Vince Weaver Fixes: 1627314fb54a33e ("perf: Suppress AUX/OVERWRITE records") Link: https://lkml.kernel.org/r/20190329091338.29999-1-alexander.shishkin@linux.intel.com Signed-off-by: Ingo Molnar Signed-off-by: Greg Kroah-Hartman --- kernel/events/ring_buffer.c | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) --- a/kernel/events/ring_buffer.c +++ b/kernel/events/ring_buffer.c @@ -456,24 +456,21 @@ void perf_aux_output_end(struct perf_out 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))