Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp182126pxu; Tue, 24 Nov 2020 23:39:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJxkFmdR1NlRMXtIkyi+O5SmsE+PEwFccKwl5bOjCq4YSJlP0D6n52gay5m+IF6V9T9vX8P6 X-Received: by 2002:aa7:d711:: with SMTP id t17mr2226239edq.83.1606289943481; Tue, 24 Nov 2020 23:39:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606289943; cv=none; d=google.com; s=arc-20160816; b=hQB1NbHrkAWNMjneTxQAjXXnKRzfeORwY9V5pzx5pWBjs2HEYAHN6wkcfBV1lboal5 mUg5QdASVxZAdwZ5vX7bgJXHyaNBofInooIGkuxPnK/nnfDyDHZVrlwjrPfXdPye1xdu eEORadudVt9up4QFidaPB6RjcbZo6UKttYmAxSLan5U6RUTBpEcoTLloL4FMdlyEiPeK Mfc/nkAmE6xARBsxQ4jIFOzRYYks7gsIUNDiS7ZrMmRdlnuVQ7MPFxwJupJ5QqZ7SIeS PUl5FtOnrYGauT9B28KC+jYUxiv11ftVMvxUQ9tilgNsd1dfYwn8I5Pe8bTpc4ZxfoWD Q3oA== 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=c+b1e14nMThTTnbxa3kx91xDxtOtG1x9augxAZM+Ejw=; b=vyMHDxxJaA/2ZO/qb7lzJhaYMZSbE+ZWil6wloiJ02/e24EFot+uUFLI4MPt70zdey b7EMGDwCxhZertkETEZZdN6BPXO9KbKhL4FboQV/4lNre2zK2rLzrXaQuhfiTkT+T4AN 5BN56WTLKbxF98muBIwG2is2vfr31NUQFzT7NUAqRPku+Bqa4Xs2vlBBgvEolIXeKf0o jMsPOWfv4Ov5zmOWTNFCFJ5iW40Skw8+LyEl7GlhGj7H32X0INmOfKvOA5MzG/LnVSUj r61sZfI/pw5ijUK8G6gNOB4Q1LVYel79AGvPORiniSRbyPdm7lHh8PNLItZf+SZG21x8 Q/zA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=rYDWtjSs; 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 zc3si803842ejb.158.2020.11.24.23.38.40; Tue, 24 Nov 2020 23:39:03 -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=casper.20170209 header.b=rYDWtjSs; 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 S1727519AbgKYHhC (ORCPT + 99 others); Wed, 25 Nov 2020 02:37:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726124AbgKYHhC (ORCPT ); Wed, 25 Nov 2020 02:37:02 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FB28C0613D4 for ; Tue, 24 Nov 2020 23:37:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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; bh=c+b1e14nMThTTnbxa3kx91xDxtOtG1x9augxAZM+Ejw=; b=rYDWtjSsjL0FtGSIEQHua96/Jt F8YYHbESjZLcu2mRVmtdJhegQKpng52Fd1lT3lPX1rRiSBvb1sEyjlqsmckj9hiMiN2O8Q25ZkD4x WuWBQZTX9uyPNHnAu2hplEW16NyGGiffGaTfNgK7yZ+JhkLKtXJtJP0+1KcJg5K4HHH36ubCMuGFy LB919xrbH80j3jaVgR5dXZ9gUSQgrM4gRdrfip9JHoWF7RyvLG5Q0uPTg+83rfMDz6sa26dDa0Woi 8selwbLQxQkhlI3uBzq4srWOoVnRRwoNa36SxvI0vAqLzd8oVFizWVqSr8MAcUbUKBpZblIDKLg7k bS96rWxQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1khpM8-0002me-If; Wed, 25 Nov 2020 07:36:48 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id BC7283012DF; Wed, 25 Nov 2020 08:36:46 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 9EFFB2009B1B4; Wed, 25 Nov 2020 08:36:46 +0100 (CET) Date: Wed, 25 Nov 2020 08:36:46 +0100 From: Peter Zijlstra To: Stephane Eranian Cc: Namhyung Kim , Ingo Molnar , Borislav Petkov , Thomas Gleixner , "H. Peter Anvin" , x86 , LKML , Kan Liang , John Sperbeck , "Lendacky, Thomas" , Andi Kleen Subject: Re: [RFC] perf/x86: Fix a warning on x86_pmu_stop() Message-ID: <20201125073646.GL2414@hirez.programming.kicks-ass.net> References: <20201121025011.227781-1-namhyung@kernel.org> <20201123142321.GP3021@hirez.programming.kicks-ass.net> <20201124080951.GE2414@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 24, 2020 at 12:19:34AM -0800, Stephane Eranian wrote: > Hi, > > Another remark on the PEBS drainage code, it seems to me like a test > is not quite correct: > intel_pmu_drain_pebs_nhm() > { > ... > if (p->status != (1ULL << bit)) { > for_each_set_bit(i, (unsigned long *)&pebs_status, size) > error[i]++; > continue; > } > > The kernel cannot disambiguate when 2+ PEBS counters overflow at the > same time. This is what the comment for this code suggests. > However, I see the comparison is done with the unfiltered p->status > which is a copy of IA32_PERF_GLOBAL_STATUS at the time of > the sample. This register contains more than the PEBS counter overflow > bits. It also includes many other bits which could also be set. > > Shouldn't this test use pebs_status instead (which covers only the > PEBS counters)? Hmm, yes, think so.