Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp3445817ybg; Mon, 28 Oct 2019 12:58:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqwpigftftkA/08kxxZCn1eS7PbOS5l/o2Hq+L4WzMU94TV5bgsJtqNhhb9h/E2Udt88zpao X-Received: by 2002:aa7:cd01:: with SMTP id b1mr21565716edw.122.1572292734493; Mon, 28 Oct 2019 12:58:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572292734; cv=none; d=google.com; s=arc-20160816; b=yV4PaffisBa9uZPGBqk7gcCiiokgSMloZBsjqsPMTYBDLxL38OHOASDEfjTE9vskc0 DzGvLxglCsxfI9hlKNahrwF46/ZP42T2RxFaqvukM9+J2UitYEBYZrmpyKmArd67lCjK mbenttO5zFCmFekb3w8AZrRwD1Dm9YIjfp/NpNxxUUuaWGKX/kde4U00QQzx98G8ld6c 3EMj+cJP45jkYhvJE3wkJVPXYqn8BWsy3ePzXIsrLT5M/ocj6CVrReUsb/UvgeIWb3Sk hO0xUJP4SdwPpCGEyiu9lAEHtTZPHANsa2IKMYbemJUMIOwl3jkIpIjRkKvLh2uylc/D Hhgw== 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 :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=4hyBLC4Gf0okvX/QjEcgnC2VFT0eR+DjHlLLFSBIsys=; b=VJXOqePfU9GJKLTO+i7vpM6pd0XHx6QKuzni7prPM/SFpJBzaNR9bwxktwGHjmqBDY 6TcmsM2Q/io5pmS28Y6+or9W7hR8H9aj9T14z7vlQedRExzMN7qj17AJn2S08NyWyrfz +whal/yzRZl9CRO9/vl9T4R3gJOu8sIoGe08MBD94KwpxQLoCKmVyHQbR+vgLKHoxP2c HZE3NGqxR81auoKQilyjAxp7r27jkFZAQ6wjNHlkfffc3GvfXNE7znjplLcdl5OB9iK5 conLj+QyTOYLWwbh8KoTdi8NLzuof9YcTPZG4mkuIHTFzwSkTlou+dyvbkpvmjS7UetA wwvw== 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 k10si7585018ede.132.2019.10.28.12.58.31; Mon, 28 Oct 2019 12:58:54 -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 S2388543AbfJ1LmE (ORCPT + 99 others); Mon, 28 Oct 2019 07:42:04 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:44334 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729074AbfJ1LmE (ORCPT ); Mon, 28 Oct 2019 07:42:04 -0400 Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1iP3PA-0001G6-KO; Mon, 28 Oct 2019 12:41:48 +0100 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id 3E2311C0482; Mon, 28 Oct 2019 12:41:48 +0100 (CET) Date: Mon, 28 Oct 2019 11:41:47 -0000 From: "tip-bot2 for Kim Phillips" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/urgent] perf/x86/amd/ibs: Handle erratum #420 only on the affected CPU family (10h) Cc: 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 , linux-kernel@vger.kernel.org In-Reply-To: <20191023150955.30292-2-kim.phillips@amd.com> References: <20191023150955.30292-2-kim.phillips@amd.com> MIME-Version: 1.0 Message-ID: <157226290796.29376.14857339901992201975.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the perf/urgent branch of tip: Commit-ID: e431e79b60603079d269e0c2a5177943b95fa4b6 Gitweb: https://git.kernel.org/tip/e431e79b60603079d269e0c2a5177943b95fa4b6 Author: Kim Phillips AuthorDate: Wed, 23 Oct 2019 10:09:55 -05:00 Committer: Ingo Molnar CommitterDate: Mon, 28 Oct 2019 11:02:00 +01:00 perf/x86/amd/ibs: Handle erratum #420 only on the affected CPU family (10h) This saves us writing the IBS control MSR twice when disabling the event. I searched revision guides for all families since 10h, and did not find occurrence of erratum #420, nor anything remotely similar: so we isolate the secondary MSR write to family 10h only. Also unconditionally update the count mask for IBS Op implementations that have read & writeable current count (CurCnt) fields in addition to the MaxCnt field. These bits were reserved on prior implementations, and therefore shouldn't have negative impact. 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: c9574fe0bdb9 ("perf/x86-ibs: Implement workaround for IBS erratum #420") Link: https://lkml.kernel.org/r/20191023150955.30292-2-kim.phillips@amd.com Signed-off-by: Ingo Molnar --- arch/x86/events/amd/ibs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/x86/events/amd/ibs.c b/arch/x86/events/amd/ibs.c index 98ba21a..26c3635 100644 --- a/arch/x86/events/amd/ibs.c +++ b/arch/x86/events/amd/ibs.c @@ -377,7 +377,8 @@ static inline void perf_ibs_disable_event(struct perf_ibs *perf_ibs, struct hw_perf_event *hwc, u64 config) { config &= ~perf_ibs->cnt_mask; - wrmsrl(hwc->config_base, config); + if (boot_cpu_data.x86 == 0x10) + wrmsrl(hwc->config_base, config); config &= ~perf_ibs->enable_mask; wrmsrl(hwc->config_base, config); } @@ -553,7 +554,8 @@ static struct perf_ibs perf_ibs_op = { }, .msr = MSR_AMD64_IBSOPCTL, .config_mask = IBS_OP_CONFIG_MASK, - .cnt_mask = IBS_OP_MAX_CNT, + .cnt_mask = IBS_OP_MAX_CNT | IBS_OP_CUR_CNT | + IBS_OP_CUR_CNT_RAND, .enable_mask = IBS_OP_ENABLE, .valid_mask = IBS_OP_VAL, .max_period = IBS_OP_MAX_CNT << 4,