Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp2508033pxb; Thu, 3 Feb 2022 08:04:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJyyTwh9QItK5kLWPaoX2aNpMxsUIfuuimUY+fRrrma8OkNmjemvtrSfsooaS1ysuxqVHh0G X-Received: by 2002:a17:903:244d:: with SMTP id l13mr35496790pls.142.1643904282213; Thu, 03 Feb 2022 08:04:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643904282; cv=none; d=google.com; s=arc-20160816; b=aH7KvMza6J8Cz7a4w/BYFVZmcUyGITq3oR8ueBKU3Ni+zdvwCbCKG50cSwAlP/2vCP l8PYpib3RkQma+yuaOZIhdUFclvpAByW7qZ5ZJzanNTUYsj4HltWY4upVdx+bdl5mbTz pE6cDUXibLObf7QhwbV10ccj66n/CqhckM6sLntBLvUUNOjnVnuMMkmrTCwgWJuKVbrk HIQlGwrosO3l8K60zvDzYPXW2+3I7E/+DFAKL2etuzX5WKdnWqVHq99yekVG1rf6g8EH fipojneTvAZjl/32JTZ2OTZY1v7AVFP7SKNQ1UJF+Vrsdg64Mg7tXanJqIQ89EK2k9D+ ifjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=aufiJNeqKbWG5qejECq+w0euY/Y/TTYgy2GYR/nn4yU=; b=D650zUw5vSLUXbj5AuYO75yu4xA2GYGbBpPeDam42ERSwUlLt56sb4WiXxfUKKFBfQ vntCbzYeKMcQ87Th1X9ou2b+Bu6ZvfTn96DMOutgYfBWJqg+2DB1Z0VZEHrihife/+hu tXGuXeP1jyRXATUDpmiz109ledqCitpCVg1gXdcPyYLx9Cvmcf9mAwfOmrtogU5+Uk2Y kIRy5Mg6kN6oo5varpTu/pTlUyRkH0Rv7GOOvBITVntVFckhkHPV/3h/JaDy6QueVpTE IszAT7u32nlPTrClPXmXu+N7KaLG6OccoGF7VrTf8oAa07qdiGHZFVTb9qWqzB1lmqXm WPZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=dAV1ViQY; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=hsGOaKjD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 27si8433617pjd.93.2022.02.03.08.04.24; Thu, 03 Feb 2022 08:04:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=dAV1ViQY; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=hsGOaKjD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351274AbiBCOe2 (ORCPT + 99 others); Thu, 3 Feb 2022 09:34:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351246AbiBCOdk (ORCPT ); Thu, 3 Feb 2022 09:33:40 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B7A3C061760; Thu, 3 Feb 2022 06:33:37 -0800 (PST) Date: Thu, 03 Feb 2022 14:33:34 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1643898815; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aufiJNeqKbWG5qejECq+w0euY/Y/TTYgy2GYR/nn4yU=; b=dAV1ViQYWGcasYUxJM5jFSadY2YKvjU4D71h/ms9ZCJhZkt0chw1aKiEdsKifS2pCp4Gej GuEgHdcDL9ITaImdeHo2LZ7NehR+t7pPlNT61ym2n/981VXj39tcMEosP6QIhuq3nHLcaB gtUwVvs06Q5KjUWMCpvyGvjD9ugnNJIBijQrUi80yHF6LvfkYYp9LqQ8/XkOQi7a2kUhRO 4yThg2PRV89/RF7T2wD29Cb8TnvDSlUIG/YMkYcB2GjKnrIAe8SjrYNoobaTeXQp7LVKrG j/Mp6a368EV7cCJ7vBBZZSl77nNJdAq0mvVQau4rE5OmBQkLq9MPp+yWfaVS5Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1643898815; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aufiJNeqKbWG5qejECq+w0euY/Y/TTYgy2GYR/nn4yU=; b=hsGOaKjDKeZmvolfvytVTjFCj4BIQuDS4f4p449PyyaXsSXkDatYt8kineTvQVzvzcpXVH 5CjqnSas9IBMsgCw== From: "tip-bot2 for Peter Zijlstra" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/urgent] x86/perf: Default set FREEZE_ON_SMI for all Cc: Kyle Huey , Andrew Cooper , "Peter Zijlstra (Intel)" , stable@kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: References: MIME-Version: 1.0 Message-ID: <164389881472.16921.5992719744302822334.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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: a01994f5e5c79d3a35e5e8cf4252c7f2147323c3 Gitweb: https://git.kernel.org/tip/a01994f5e5c79d3a35e5e8cf4252c7f2147323c3 Author: Peter Zijlstra AuthorDate: Thu, 27 Jan 2022 12:32:51 +01:00 Committer: Peter Zijlstra CommitterDate: Wed, 02 Feb 2022 13:11:39 +01:00 x86/perf: Default set FREEZE_ON_SMI for all Kyle reported that rr[0] has started to malfunction on Comet Lake and later CPUs due to EFI starting to make use of CPL3 [1] and the PMU event filtering not distinguishing between regular CPL3 and SMM CPL3. Since this is a privilege violation, default disable SMM visibility where possible. Administrators wanting to observe SMM cycles can easily change this using the sysfs attribute while regular users don't have access to this file. [0] https://rr-project.org/ [1] See the Intel white paper "Trustworthy SMM on the Intel vPro Platform" at https://bugzilla.kernel.org/attachment.cgi?id=300300, particularly the end of page 5. Reported-by: Kyle Huey Suggested-by: Andrew Cooper Signed-off-by: Peter Zijlstra (Intel) Cc: stable@kernel.org Link: https://lkml.kernel.org/r/YfKChjX61OW4CkYm@hirez.programming.kicks-ass.net --- arch/x86/events/intel/core.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index c914340..a3c7ca8 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -4703,6 +4703,19 @@ static __initconst const struct x86_pmu intel_pmu = { .lbr_read = intel_pmu_lbr_read_64, .lbr_save = intel_pmu_lbr_save, .lbr_restore = intel_pmu_lbr_restore, + + /* + * SMM has access to all 4 rings and while traditionally SMM code only + * ran in CPL0, 2021-era firmware is starting to make use of CPL3 in SMM. + * + * Since the EVENTSEL.{USR,OS} CPL filtering makes no distinction + * between SMM or not, this results in what should be pure userspace + * counters including SMM data. + * + * This is a clear privilege issue, therefore globally disable + * counting SMM by default. + */ + .attr_freeze_on_smi = 1, }; static __init void intel_clovertown_quirk(void)