Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp6549480ybx; Mon, 11 Nov 2019 10:47:04 -0800 (PST) X-Google-Smtp-Source: APXvYqzXghIp8NPVoIQtl8+MvzfHk3/efinM1jvAVfrtOCHj/fh+cgWQV/a9XJBclBKygmWtUDuy X-Received: by 2002:a17:907:36e:: with SMTP id rs14mr24481140ejb.330.1573498024476; Mon, 11 Nov 2019 10:47:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573498024; cv=none; d=google.com; s=arc-20160816; b=uAOMoNi7955SJt7o+uLpIkz7E7yx5Pgv4yGoEXHf/3RghsYJXG9VQvSR+IzNCUA8p/ qIT91tZQz6PD4umpmX6bLP8RWuJedXduwNbXy6YmiPo/vOzu8YxZlHUHunCNwHsOj0AS 55Dqgm+yZpCsrE6kbLvzTwKbxUFf13oz4QzQuly9NZoIvjLFaWWZzqs6kCSvaVDAgHh/ Kq2WzgRPdwdlI8YLLmCVgvC60fXaVuuqui4+LUxL870Wr8PN2Yx3Rbj9i9VItNOWOAWH rVZYwejd4KZ/zf/y2pybJPaq+kgB3Y9pXtPiNvww6lN8rb9m44H7zmH09a8yAKRkp3pQ hqJw== 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=u+iFV/dgBbnXbJQ/S9H6vccO2BkhoAbilnHKQo9Lw/w=; b=XX5/695bO+YTSJmYDHVByQ+CaFPpP2DDHEKNNLfEGVr38ZN2UdZRZZIjPJvCoM+cn4 GSQeNLPosKglxqGxQEUIc+ABx8dptMGcdx+2dkSm3/SfkPRKc+mZD0gk4hH0kO9DH1vk TcqtJyVvyzzAPf2hw44vuTiskftgYZ3bsNkHQztVBFYm0pJcvCMhNfs0AoTRIYDZ5UK7 QV9rul7jAu1I5JSYYk0FLv/zfMPBwi/RL18EugxrkGRe5gZNzp3HogaE5mR15CHx3cDY Frekx/WLzqfdw1EkttM8miAq06kV7lmUHpygF9doJhZFPDg/v5Vepg1PwTZcIqa8pXrV sdLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OVj2PJj+; 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 j44si13227838eda.345.2019.11.11.10.46.40; Mon, 11 Nov 2019 10:47:04 -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=OVj2PJj+; 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 S1729837AbfKKSpQ (ORCPT + 99 others); Mon, 11 Nov 2019 13:45:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:37212 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729835AbfKKSpO (ORCPT ); Mon, 11 Nov 2019 13:45:14 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 356BF204FD; Mon, 11 Nov 2019 18:45:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573497914; bh=2MUUxH0+/1Q/fC2bt8PDd6ElIdFFwK2lIWGBYTdCZt8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OVj2PJj+B/mz7NQQgjQikXoHSZblPq/jDLTX1s4phI1muBkkdisx+ng3Fx3+uHgq0 qoFj2O1aNmJPj89o4OJn2qJVw0zwl/mOS+1Vttxhd2e8HiGveXD5ekodNavpiJvMIp PdIG34QLjqr8zEIZPpubP+pf25S/d3ElkVzsxXxQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kim Phillips , "Peter Zijlstra (Intel)" , Alexander Shishkin , Arnaldo Carvalho de Melo , Arnaldo Carvalho de Melo , Borislav Petkov , "H. Peter Anvin" , Jiri Olsa , Linus Torvalds , Mark Rutland , Namhyung Kim , Stephane Eranian , Thomas Gleixner , Vince Weaver , Ingo Molnar , Sasha Levin Subject: [PATCH 4.19 095/125] perf/x86/amd/ibs: Fix reading of the IBS OpData register and thus precise RIP validity Date: Mon, 11 Nov 2019 19:28:54 +0100 Message-Id: <20191111181452.535755844@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191111181438.945353076@linuxfoundation.org> References: <20191111181438.945353076@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: Kim Phillips [ Upstream commit 317b96bb14303c7998dbcd5bc606bd8038fdd4b4 ] The loop that reads all the IBS MSRs into *buf stopped one MSR short of reading the IbsOpData register, which contains the RipInvalid status bit. Fix the offset_max assignment so the MSR gets read, so the RIP invalid evaluation is based on what the IBS h/w output, instead of what was left in memory. Signed-off-by: Kim Phillips Signed-off-by: Peter Zijlstra (Intel) Cc: Alexander Shishkin Cc: Arnaldo Carvalho de Melo Cc: Arnaldo Carvalho de Melo Cc: Borislav Petkov Cc: H. Peter Anvin Cc: Jiri Olsa Cc: Linus Torvalds Cc: Mark Rutland Cc: Namhyung Kim Cc: Stephane Eranian Cc: Thomas Gleixner Cc: Vince Weaver Fixes: d47e8238cd76 ("perf/x86-ibs: Take instruction pointer from ibs sample") Link: https://lkml.kernel.org/r/20191023150955.30292-1-kim.phillips@amd.com Signed-off-by: Ingo Molnar Signed-off-by: Sasha Levin --- arch/x86/events/amd/ibs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/events/amd/ibs.c b/arch/x86/events/amd/ibs.c index 80c6d84cad67b..fac0867907d4d 100644 --- a/arch/x86/events/amd/ibs.c +++ b/arch/x86/events/amd/ibs.c @@ -625,7 +625,7 @@ fail: if (event->attr.sample_type & PERF_SAMPLE_RAW) offset_max = perf_ibs->offset_max; else if (check_rip) - offset_max = 2; + offset_max = 3; else offset_max = 1; do { -- 2.20.1