From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0D37C63777 for ; Thu, 26 Nov 2020 12:13:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 90CCE20DD4 for ; Thu, 26 Nov 2020 12:13:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="M3z7Ke/E" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389520AbgKZMNi (ORCPT ); Thu, 26 Nov 2020 07:13:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730660AbgKZMNi (ORCPT ); Thu, 26 Nov 2020 07:13:38 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB72DC0613D4 for ; Thu, 26 Nov 2020 04:13:37 -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=HWocZnV4J3w6J2B/yUONmu5RDnId0bFeRr8x3q+37yQ=; b=M3z7Ke/EX90uTN667IzGg8sIUm ec8f+zSY4mOD1osHWxks8ZM+HQZ2c/qwEiiE0FaNQThA/JYFu0htUdMTkT4To3TcIbutTMTtGDdNp 3oaiZdfN3rvVBAKfVK4ujqCqUHqwX+Lqp9e8/bVXTsKVPqCAbV5WgVDSo4IJtK6w5U/ohNjemI+gj VUrjfzaiSE8jR+7dwh90SFp/pEh8MU3hCnn+Md54Mj+gP42ZsJJ3ehgREGJvmF88lbbXMsh1mh5rG fI6rTD73XUeOEQLSzgq/Z4d9IWA3K0rOZ9202jcVS4tvJ7BduzAbjSvBpIBI/nKRmskBKa1r2RFJB Inrpa9yg==; 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 1kiG9S-0000Yx-0J; Thu, 26 Nov 2020 12:13:30 +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 3D84C306DD8; Thu, 26 Nov 2020 13:13:29 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 14BAC200D7A4E; Thu, 26 Nov 2020 13:13:29 +0100 (CET) Date: Thu, 26 Nov 2020 13:13:29 +0100 From: Peter Zijlstra To: Namhyung Kim Cc: Ingo Molnar , Alexander Shishkin , Thomas Gleixner , Borislav Petkov , "H. Peter Anvin" , LKML , x86@kernel.org, Stephane Eranian , John Sperbeck , "Lendacky, Thomas" , Kan Liang Subject: Re: [PATCH 1/2] perf/x86/intel: Fix a warning on x86_pmu_stop() with large PEBS Message-ID: <20201126121329.GJ3040@hirez.programming.kicks-ass.net> References: <20201126110922.317681-1-namhyung@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201126110922.317681-1-namhyung@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 26, 2020 at 08:09:21PM +0900, Namhyung Kim wrote: > The commit 3966c3feca3f ("x86/perf/amd: Remove need to check "running" > bit in NMI handler") introduced this. It seems x86_pmu_stop can be > called recursively (like when it losts some samples) like below: > > x86_pmu_stop > intel_pmu_disable_event (x86_pmu_disable) > intel_pmu_pebs_disable > intel_pmu_drain_pebs_nhm (x86_pmu_drain_pebs_buffer) > x86_pmu_stop > > While commit 35d1ce6bec13 ("perf/x86/intel/ds: Fix x86_pmu_stop > warning for large PEBS") fixed it for the normal cases, there's > another path to call x86_pmu_stop() recursively when a PEBS error was > detected (like two or more counters overflowed at the same time). > > Like in the Kan's previous fix, we can skip the interrupt accounting > for large PEBS, so check the iregs which is set for PMI only. > > Fixes: 3966c3feca3f ("x86/perf/amd: Remove need to check "running" bit in NMI handler") > Reported-by: John Sperbeck > Suggested-by: Peter Zijlstra > Cc: "Lendacky, Thomas" > Cc: Kan Liang > Signed-off-by: Namhyung Kim Thanks for both!