Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp40459pxu; Tue, 24 Nov 2020 17:57:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJzbAOUHGwPNZ+lWFkH2n2qJF/HCy6Dl4qjcaFJRkPpWfgf3Fc7dSdrsY2xziCVvhi//kcLt X-Received: by 2002:a17:906:2581:: with SMTP id m1mr1178729ejb.28.1606269437392; Tue, 24 Nov 2020 17:57:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606269437; cv=none; d=google.com; s=arc-20160816; b=LNy7E+a/0svCmNFiSP3vhpOKiMmrQzWjAtOH3UhhM0DDPakc1UNTl4KFzgt6Gj8wqp A3+vohDH9m3sT+HgtJJhDFSZth9npz1N9LsqS+pkahXyTcIZHR0PGwmvVxDUaGU3gma2 wazxrIrDFGGfaEA1YE+NWreOqqQAw40m2DLdICEHlMnH1thnVbzvRibjmqR9aAwZqo3G ewskJQ0HckDFbFOExYCv4i8EznPRSWgpBRNL5eENrLF6yzblgSwLwYuTr+3CC2cTEg/L bF05rhRqhqmpp5j0QSsYQF5A3z9vOGuyP/u5CN1O94QwnqdSgwydwDfBX72p5WRqcOYV wvbw== 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=Sg0d2W9lIZVXaKPXvUC0vCuRKlWPQr9QqT8INz/yg80=; b=g3Pn3TuTNsRq5QVv3jtBvso0fIjk2y912yHBYnGU9GH8FzKl40piugU+3djaamLqR4 RNp2NuchKrfXgCqiLaGz4LXF5+Eyw3/vili2sPs1Xse/YefHblx1eYEtEdvgjJVSP80h KxOF7rtC9BjyCct5z8Fl1w9wNX19gjFfmws9wBg9POutvU0tRdODdTVTYQw3eGz1xrCM AzgnqaCDST/0bLCBCXgeU0Ea2gB6QXOzzCVQd3OZSNsUIM5wm9M6Sxm4pBHYiesdF0OG FehN+kNTIIllYNwdtnE5dYj9VMVkqYbEZ97DfWLsi9DjdampdbpfYdwMb58ZFXzpv+0Q stYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b="c1/dYbhk"; 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 m14si416496ejr.448.2020.11.24.17.56.54; Tue, 24 Nov 2020 17:57:17 -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=merlin.20170209 header.b="c1/dYbhk"; 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 S1730311AbgKXIKE (ORCPT + 99 others); Tue, 24 Nov 2020 03:10:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728177AbgKXIKE (ORCPT ); Tue, 24 Nov 2020 03:10:04 -0500 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06AC3C0613CF for ; Tue, 24 Nov 2020 00:10:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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=Sg0d2W9lIZVXaKPXvUC0vCuRKlWPQr9QqT8INz/yg80=; b=c1/dYbhkt2kl4iCUCaPRlDv/BD eb17+dtyYYfTsjz1A6gFDluM6K0jG/17YKBXAAU1x/uHFzYexx22Yc/yLHTiT5BV4N9wJ2vmTMO/h /hVqveDUbfGzfcNU2NQKvzVCHx+UCG4JHnaQOVlwyVmti1VjbYkB4xnm5SdBoftSD/CL8CbCEETg2 oadbfXEfUY8pmzK93wCsQDTwN7NFDJ9WHuJEvlB9DStMttmVItGBw6YKWLCeKvNaAlZ9rRA6r9mav 6I2+YUJZtqnyBhm7E7o6sSfdsRaKnLqbTcL7wA0ApniYgDc7bmvPPPulvYK5hDai02Wql64PXpiSb DmsLP5Vw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1khTOd-0000ZJ-9N; Tue, 24 Nov 2020 08:09:55 +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 72D7E304D28; Tue, 24 Nov 2020 09:09:51 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 5E1BF20222D66; Tue, 24 Nov 2020 09:09:51 +0100 (CET) Date: Tue, 24 Nov 2020 09:09:51 +0100 From: Peter Zijlstra To: Namhyung Kim Cc: Ingo Molnar , Borislav Petkov , Thomas Gleixner , "H. Peter Anvin" , x86@kernel.org, LKML , Stephane Eranian , Kan Liang , John Sperbeck , "Lendacky, Thomas" Subject: Re: [RFC] perf/x86: Fix a warning on x86_pmu_stop() Message-ID: <20201124080951.GE2414@hirez.programming.kicks-ass.net> References: <20201121025011.227781-1-namhyung@kernel.org> <20201123142321.GP3021@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 02:01:39PM +0900, Namhyung Kim wrote: > Yes, it's not about __intel_pmu_pebs_event(). I'm looking at > intel_pmu_drain_pebs_nhm() specifically. There's code like > > /* log dropped samples number */ > if (error[bit]) { > perf_log_lost_samples(event, error[bit]); > > if (perf_event_account_interrupt(event)) > x86_pmu_stop(event, 0); > } > > if (counts[bit]) { > __intel_pmu_pebs_event(event, iregs, base, > top, bit, counts[bit], > setup_pebs_fixed_sample_data); > } > > There's a path to x86_pmu_stop() when an error bit is on. That would seem to suggest you try something like this: diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c index 31b9e58b03fe..8c6ee8be8b6e 100644 --- a/arch/x86/events/intel/ds.c +++ b/arch/x86/events/intel/ds.c @@ -1945,7 +1945,7 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs, struct perf_sample_d if (error[bit]) { perf_log_lost_samples(event, error[bit]); - if (perf_event_account_interrupt(event)) + if (iregs && perf_event_account_interrupt(event)) x86_pmu_stop(event, 0); }