Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3536889pxb; Mon, 24 Jan 2022 11:40:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJxk4H+LDcIcCsoQdogmq3d6vTfWlcggin8MalhfOPI4U9UUA7kGvLa0CNaiHHJLuVv2w7co X-Received: by 2002:a17:902:6901:b0:149:4e89:2d45 with SMTP id j1-20020a170902690100b001494e892d45mr15226720plk.22.1643053248401; Mon, 24 Jan 2022 11:40:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643053248; cv=none; d=google.com; s=arc-20160816; b=zp/tclZr4YffVGo4jZaJvOTlT7qgFInQXVP+9NB+uMOb3370NgX9OWyHpHjMEnSfaZ PgDOWJAi4NDvDPqtPRuEda2gne8+Nx1ryLHmtygV2cXZaMkKEskLp7yOLwMNg56sUR3u Bwo7XYiq77QpEiH/5PzFtqr3svOev7FJmtrz8JALprDio89emVzxmrcIvGSwwUbw8dsY f3GrMCcchn5xHey/4TiEgfXhJ7lsc+TIOEyeXEg9/WezOu48AlAl2wJ7bDmCU+FNj9c2 Np17pdfC6tO9Bu0UzLexUaHtOsnVrNbtgFnCC1Z7HFXBOH816IAQFXECd2XHJcDiWYrN caUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=DSa7jeW9P4lNLLrfrfHT/zJUZL/sXm6OhiC7qNBM8w4=; b=T1bkDYKmlCbSIcAXd6fK4ctWT8UnW9wu8w9LJAfzm9zp+DdO3JGTjPIWxpDHuYYru7 Ghzhcg+IMJT7DJ3q0glBy4D7JMvqw+T+WMdjeKzalod8XloocIth5KN+DehTCal3y6o1 pS5py9T1Q2YDPI2XcMUu8kD3P1I27c1guo8ZHviOT8hUcjqbH9bpJjG9JN5FUHcOKtKQ ClDA3lpb8dAgHCD4i5UmTqyt5H9abdRanxZy7YX7wh6/Ne3QLmfudrYlGcebf6fxhRMz izPVnPg8QnFeAwg2cMZQSh6sAT5iLDWP6FjbXjm5PsICkl7e8SdBu6uijbhNOfTDp3/L WZ6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=NUBgWZuj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x25si15324161pgu.493.2022.01.24.11.40.36; Mon, 24 Jan 2022 11:40:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=NUBgWZuj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244305AbiAXRQj (ORCPT + 99 others); Mon, 24 Jan 2022 12:16:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244253AbiAXRQg (ORCPT ); Mon, 24 Jan 2022 12:16:36 -0500 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D7E7C06173B; Mon, 24 Jan 2022 09:16:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=DSa7jeW9P4lNLLrfrfHT/zJUZL/sXm6OhiC7qNBM8w4=; b=NUBgWZujFXvoL7DzLqV7A+5FRa xuK3c6RIvRpVEfkXWUflBmensb2bfz+/Gvmov/NjfsFEl0/GHaBuKKW4+iByQ4f0xGqLZsSrazXyZ rHNhf5OncD+4efuucKMbf/9mMTGHcle4HAyDbU6oYPM4Y14TVwedjIAAB6VHVicUPprucaTw7e62r 0TCU2IfZp5FSL3+7tdgjeh2xWMJTS0OPsrwcHkgKuNwibsF9u6gvWoER4mxPp5iiFrReEOdHn5B2N 38h5Nx3mjaXlZ0cjkoPtUG0lWucqKNSEnUItr7exQCqNOlcgf+tsQKXFpZxAJA4Y9tkCrRxpiRjI0 49gQaoew==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nC2x2-003D8g-QG; Mon, 24 Jan 2022 17:16:20 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 3FDF6300222; Mon, 24 Jan 2022 18:16:19 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 28E652B54C677; Mon, 24 Jan 2022 18:16:19 +0100 (CET) Date: Mon, 24 Jan 2022 18:16:19 +0100 From: Peter Zijlstra To: "Liang, Kan" Cc: Kyle Huey , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, "H. Peter Anvin" , x86@kernel.org, Dave Hansen , Borislav Petkov , Thomas Gleixner , Namhyung Kim , Jiri Olsa , Alexander Shishkin , Mark Rutland , Arnaldo Carvalho de Melo , Ingo Molnar , Robert O'Callahan , Keno Fischer , Andi Kleen Subject: Re: [PATCH] x86/perf: Default freeze_on_smi on for Comet Lake and later. Message-ID: References: <20220122072644.92292-1-khuey@kylehuey.com> <3c35dc76-c187-8d3f-7fc9-75de32e7cbf6@linux.intel.com> <3bfa617e-007c-ebc3-8c71-0bcb83b24794@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3bfa617e-007c-ebc3-8c71-0bcb83b24794@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 24, 2022 at 12:03:10PM -0500, Liang, Kan wrote: > > > On 1/24/2022 11:30 AM, Peter Zijlstra wrote: > > On Mon, Jan 24, 2022 at 11:00:56AM -0500, Liang, Kan wrote: > > > > > > > > > On 1/24/2022 7:21 AM, Peter Zijlstra wrote: > > > > On Fri, Jan 21, 2022 at 11:26:44PM -0800, Kyle Huey wrote: > > > > > Beginning in Comet Lake, Intel extended the concept of privilege rings to > > > > > SMM.[0] A side effect of this is that events caused by execution of code > > > > > in SMM are now visible to performance counters with IA32_PERFEVTSELx.USR > > > > > set. > > > > > > > > > > rr[1] depends on exact counts of performance events for the user space > > > > > tracee, so this change in behavior is fatal for us. It is, however, easily > > > > > corrected by setting IA32_DEBUGCTL.FREEZE_WHILE_SMM to 1 (visible in sysfs > > > > > as /sys/devices/cpu/freeze_on_smi). While we can and will tell our users to > > > > > set freeze_on_smi manually when appropriate, because observing events in > > > > > SMM is rarely useful to anyone, we propose to change the default value of > > > > > this switch. > > > > > > + Andi > > > > > > From we heard many times from sophisticated customers, they really hate > > > blind spots. They want to see everything. That's why we set freeze_on_smi to > > > 0 as default. I think the patch breaks the principle. > > > > Well, USR really, as in *REALLY* should not be counting SMM. That's just > > plain broken. > > > > For the USR only case, the bit could be set. > > > There's maybe an argument to include it in OS, but USR is ring-3. > > But we don't have an option for the USR only case. The changing will impact > the SYS case as well. Personally, maybe it's better to let the user apace > app control the bit as needed rather than changing the default kernel value > for all cases. The bit is system wide, you can't sanely control it per counter. The change that made USR include SMM is insane and broken.