Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2404508imu; Thu, 24 Jan 2019 12:10:58 -0800 (PST) X-Google-Smtp-Source: ALg8bN6AzT39CVk8ILK1CHkTJ+EWsV2fNxbG+l4jrwldeyFJ7hnFl0F6v0sr01Q64FcW2e21TSH8 X-Received: by 2002:a17:902:6b09:: with SMTP id o9mr7907388plk.208.1548360658256; Thu, 24 Jan 2019 12:10:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548360658; cv=none; d=google.com; s=arc-20160816; b=ntBWoQJ/9VlaDj03zmEoGpSkWQytTq+elvZGb9RlZBVFkUy+xbmS9xNhE+s1xYi7ac XI3lJU1ycqum9uKrVeOYH+xegxWk0wPOKBib2I1y12ozgtIFJYfq6TOxWBqeDq6QtiRV mB+l2+wsh4Tiuk3dccVFvTAHmjIIGrJMGJBSR1j2697EO7GJSstt8hh7mjupL985wQnX 72pfIjVC147/+xNe4Qi0aY4eA7gZJPhoTCu++BBZctOalfAPeerZL0VnKvcRkZtJca8N BF529r184UwxqsmC6Vu5Fa1YAY/+c069+JqP1J406JR7u9yv4fAOukeZ/eBgCzmEzZOi XnGw== 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=6QpDNLMhGH7K1oOkK3BZIoL4/+Tzjz1ibZhVspHlYIY=; b=YIGAom/HHgMpfvY5OAJfEkXCT3hL/XBosvAY/kWCh/LQvs9x0tgrDvapGeg3Ve8p05 xTwa8Y3zdD6IsyotX7xcquFEO/szDAi8dDqY4kNvklW68C9zJ0KC+o2Jfu+pmApyjEqP WESl7spOE/sJDunT+FPXREC+X5hQwJRdIqhb39NuF+FwKDT3nIlSy5w7jfrRoyl3WDnJ XVC7P7399ziqEyntrc0RrDHQhDTbY4Qd5kx77gW0LZjYgBpigORdFbMXowFnkKqFb8k1 253739RJWv/5O4BSIBmFed4C/Z6y8kySQ9xdS7IFboUsfQ4Y6QQ6ciU/Yrss4is7H/Gf T+mA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="G/sJm1cZ"; 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 z86si14047656pfl.209.2019.01.24.12.10.43; Thu, 24 Jan 2019 12:10:58 -0800 (PST) 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="G/sJm1cZ"; 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 S1730890AbfAXT2I (ORCPT + 99 others); Thu, 24 Jan 2019 14:28:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:54434 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730861AbfAXT2B (ORCPT ); Thu, 24 Jan 2019 14:28:01 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (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 CA154218A6; Thu, 24 Jan 2019 19:28:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548358081; bh=r3DJafyXJ38ed6QS9ewhIMRuYb5uLF9ukbfHqz6YxoI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G/sJm1cZhRmG+qUpkcDPtjBXjIyhv/H102gSf+pbVNWMubhN8U2QFFFaYGunLYgx6 DloNg1Hjd3DJttzzdXOdawkVfA5TgCF4DCt15XTCZYuGOsrIvBar9AvYK4ubpaySTB mcLJ+pMpfvQCexDR2TzOesIwpF/GsXLoOHFI9cgY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adrian Hunter , Arnaldo Carvalho de Melo , Jiri Olsa , Sasha Levin Subject: [PATCH 4.4 092/104] perf intel-pt: Fix error with config term "pt=0" Date: Thu, 24 Jan 2019 20:20:21 +0100 Message-Id: <20190124190205.010688831@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190124190154.968308875@linuxfoundation.org> References: <20190124190154.968308875@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 1c6f709b9f96366cc47af23c05ecec9b8c0c392d ] Users should never use 'pt=0', but if they do it may give a meaningless error: $ perf record -e intel_pt/pt=0/u uname Error: The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (intel_pt/pt=0/u). Fix that by forcing 'pt=1'. Committer testing: # perf record -e intel_pt/pt=0/u uname Error: The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (intel_pt/pt=0/u). /bin/dmesg | grep -i perf may provide additional information. # perf record -e intel_pt/pt=0/u uname pt=0 doesn't make sense, forcing pt=1 Linux [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.020 MB perf.data ] # Signed-off-by: Adrian Hunter Tested-by: Arnaldo Carvalho de Melo Cc: Jiri Olsa Link: http://lkml.kernel.org/r/b7c5b4e5-9497-10e5-fd43-5f3e4a0fe51d@intel.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/arch/x86/util/intel-pt.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tools/perf/arch/x86/util/intel-pt.c b/tools/perf/arch/x86/util/intel-pt.c index c53f78767568..df21da796fa7 100644 --- a/tools/perf/arch/x86/util/intel-pt.c +++ b/tools/perf/arch/x86/util/intel-pt.c @@ -471,10 +471,21 @@ static int intel_pt_validate_config(struct perf_pmu *intel_pt_pmu, struct perf_evsel *evsel) { int err; + char c; if (!evsel) return 0; + /* + * If supported, force pass-through config term (pt=1) even if user + * sets pt=0, which avoids senseless kernel errors. + */ + if (perf_pmu__scan_file(intel_pt_pmu, "format/pt", "%c", &c) == 1 && + !(evsel->attr.config & 1)) { + pr_warning("pt=0 doesn't make sense, forcing pt=1\n"); + evsel->attr.config |= 1; + } + err = intel_pt_val_config_term(intel_pt_pmu, "caps/cycle_thresholds", "cyc_thresh", "caps/psb_cyc", evsel->attr.config); -- 2.19.1