Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1278095imu; Tue, 20 Nov 2018 14:56:00 -0800 (PST) X-Google-Smtp-Source: AFSGD/XkJOw2TCmNeDu69YKnfx9oipD+7cgpijw3Nt9Jha25Q2nKTQSi99ZRTNZSqlMPodh+gnsc X-Received: by 2002:a17:902:365:: with SMTP id 92mr3983732pld.327.1542754560030; Tue, 20 Nov 2018 14:56:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542754560; cv=none; d=google.com; s=arc-20160816; b=XQmfD0LPhJZNz7xub86ny0qukonuN3hgkjmo54zp3NWykX5bx1mD1M2Bspnr3UaSob I6miuqV7V3fGmMOBqlZRIHzklWeLwSIpxwf8PgzxocpgaVJ4G57kbNB6RgPy9pqkRF26 b6eD4eCK9BuLTldQYqBynuxCD9MZEo2TiqW6Vy+dkWKO84QGy7U1DUCd5KVMEdUemAdX ZiG9wstNV3qstxpdYUwONRvQ8EMcTNCsfPgWYiXcrt1bazXcQC70csS9/uBPNF+Mhrex tIvBbrDIYlSQgU8DFl6irVITfXueTAduLvjWzCeQEKf/nmi3CPqoiw3B712PP4RcyJmM xQ3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=BSQgXG3H5MeRMx5omD9LkjAz9YsRmsO6WgrkfVrvM/8=; b=GK5VDeL/KOpNpMQW/G4lOBVUQWHSNfvLrG3rbnHPMEbjyvXbpNRDJxHvsTGcOdG879 UzSXancnXGQrpQrSizNRxXHqQAPF7s1XQM9f54BzYtb/u4B156huiRGql8+tgrRx468U 7I3QVTUYOXYC09l+s2//N9TQ6h2/xXZ1ElzDgPvjGoPTQWjUZuBWGZmdKxn1tZkohyzh jSi3BqtN7FTTz0gfNB5Uj99Rv9uHUBWgPXtJbjT7/l3MATWkQeHjubgjWuSg6OjfXdvY P7+bJMpXuSZFxpZivsqJl+e3DUGpTtHGFaOHBtBCNRTEKCcPrijjsa6zz85Dz6S2r9Ci v+bA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=ETH0V3lL; 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 w2si6041918pgp.546.2018.11.20.14.55.44; Tue, 20 Nov 2018 14:55:59 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=ETH0V3lL; 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 S1726083AbeKUI5Z (ORCPT + 99 others); Wed, 21 Nov 2018 03:57:25 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:41692 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725940AbeKUI5Y (ORCPT ); Wed, 21 Nov 2018 03:57:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; 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:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=BSQgXG3H5MeRMx5omD9LkjAz9YsRmsO6WgrkfVrvM/8=; b=ETH0V3lLOPmZUW+a8NAr9hgsD MDZZMNFdy5vtbsNQMJTmMUfx2aIMngu57hwkTgqieez762EftMJ0dpHoqxYCjfaxaKTezVN3GppRu l6Ek411+iXkZYJN7emgSuaVMrEw7yViue70fs9Kyh5pMneU+OeH4noc2OEiVMCcqNNhEcqmVR409w upzqvmP9Ue6LGLI1bgyMA5rPoiXb7pdd69mHH//GV2QqpGY28zJiF6xvkp4665BWIyTlR2jq+6lvY TLT5f7IyhCo8sLxRnSWbqN56NUV5fkQJH7N0Uf+4rsumBO6BKuTPiQQMTtCv7IOu3zl/5CrHb8U+1 LXffwotUg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gPESv-0005WF-6H; Tue, 20 Nov 2018 22:25:53 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 0A2DE2029FD58; Tue, 20 Nov 2018 23:25:50 +0100 (CET) Date: Tue, 20 Nov 2018 23:25:50 +0100 From: Peter Zijlstra To: Andi Kleen Cc: Kyle Huey , Kan Liang , Ingo Molnar , Robert O'Callahan , Alexander Shishkin , Arnaldo Carvalho de Melo , Jiri Olsa , Linus Torvalds , Stephane Eranian , Thomas Gleixner , Vince Weaver , acme@kernel.org, open list Subject: Re: [REGRESSION] x86, perf: counter freezing breaks rr Message-ID: <20181120222549.GA2149@hirez.programming.kicks-ass.net> References: <20181120194129.GC13936@tassilo.jf.intel.com> <20181120201144.GD13936@tassilo.jf.intel.com> <20181120221642.GE2131@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181120221642.GE2131@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 20, 2018 at 11:16:42PM +0100, Peter Zijlstra wrote: > Ooh, so the thing does FREEZE_ON_OVERFLOW _not_ FREEZE_ON_PMI. Yes, that > can be a big difference. > > See, FREEZE_ON_PMI, as advertised by the name, should have no observable > effect on counters limited to USR. But something like FREEZE_ON_OVERFLOW > will loose everything between the overflow and the eventual PMI, and by > freezing early we can't even compensate for it anymore either, > introducing drift in the period. > > And I don't buy the over-count argument, the counter register shows how > far over you are; it triggers the overflow when we cross 0, it then > continues counting. So if you really care, you can throw away the > 'over-count' at PMI time. That doesn't make it more reliable. We don't > magically get pt_regs from earlier on or any other state. > > The only thing where it might make a difference is if you're running > multiple counters (groups in perf speak) and want to correlate the count > values. Then, and only then, does it matter. In fact, I'll argue FREEZE_ON_OVERFLOW is unfixably broken for independent counters, because while one counter overflows, we'll stall counting on all others until we've handled the PMI. Even though the PMI might not be for them and they very much want/need to continue counting.