Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp176823pxu; Tue, 24 Nov 2020 23:26:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJxptrEWkuXCBIXK17vq2Zz2SwPBubKCaFpymBcynZMB1kX/tVVpRCW3WZMDwH1WW1fIdZD4 X-Received: by 2002:a17:906:7698:: with SMTP id o24mr1945944ejm.447.1606289189726; Tue, 24 Nov 2020 23:26:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606289189; cv=none; d=google.com; s=arc-20160816; b=jFvsgRG3Mtil6i1f0XhxVAXEc+COK+ncNyrbMRLf1de8NWV8tu2JBlbVnvhwI/evBM HA1VbPqEN4f1pJQ1BRB90UkjIbJO3Yh3qEs+hMvrJmH/zgIhMsUp/28Yebr5GDhinb3V RB5B1U/KFtYPct+wRXHhGwQ/FT9fxb+PRcWKMvBvEgOw8KD+bdVC8MHxiWkstY15Mhr8 SEqm3OY+XA84ruNxo8lyR/G2F7D4h9UIn+PMmaUkS5rrQnbOxA2h2k5dom4Tz5u/Bk+s fGygxNW3ScYq/DnOw/7XPKtc+xQHdo3R/x7t0ouTsqnF4zRzsHhg4V2rVniyYaFr53NJ z2wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=pZIqZIlGJn/OymPnQSp5KRFU9tOp32VwHQtRyplJ3/4=; b=CbBm1vnTtn/BdL8aXqm/D6Id605Pu/9441CDB95rI2l/n8TxoeeoSK2D4BUSFleGiE JKvFlVXAYoggDToYonrK283xWB0lEUOzoLzhY8+mMeRQ0XdJxL1kuwgVSraUHUe08LTM QUq0uuh16rtzgagZF6kcP0euF8YDrOnovxK6WQ8ET9HqX42QKFtZ7txTl5oe4nbbvpav +So869sbWpIGLn0aijgmmLY7N1vZQ1tkWRfhQ+oUxxwCtziBfJ6DSIc55CDVyVOe4+5E 8buicyc0CPSPGWdbeELSllZHs/ZKd7/JnqjKE0Op4+WQcufK76dpD7ZYNldRwCbqJ4Ne mKqg== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c2si260750edq.536.2020.11.24.23.26.06; Tue, 24 Nov 2020 23:26:29 -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; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727591AbgKYHWd (ORCPT + 99 others); Wed, 25 Nov 2020 02:22:33 -0500 Received: from mail-lf1-f44.google.com ([209.85.167.44]:35306 "EHLO mail-lf1-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727414AbgKYHWc (ORCPT ); Wed, 25 Nov 2020 02:22:32 -0500 Received: by mail-lf1-f44.google.com with SMTP id a9so1725302lfh.2 for ; Tue, 24 Nov 2020 23:22:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=pZIqZIlGJn/OymPnQSp5KRFU9tOp32VwHQtRyplJ3/4=; b=HRbPo/f7EzqtEssWsZatqok783hGC/PcC/OT1PauRrffUElRl4WMdzAxy8634DBEHr 1dDIcShymWmolFzubmM3KB7qHdT1jFEAr8BN3MPcF4DzYxzIPmyWFvcn2U8fsZGLJtzt hv+GLohOc0eE4vTAwmdDmCSbZ273ctIBFIBqGRhyzHPg7A62p++ClzGMeoOO3DZUyktv Jhf50V982hMghQj1olwtXPBS1QR20gZOZh0vKJFhnaCtdvPCz/F0fHWe1dQhZrjPap5m GcQvONtQkazkxbvTIcyDhjRvGfVkEfDZcfH/IQI9z5Cax/ugPqcQmL0MeL8tD6qxCn9j XOzw== X-Gm-Message-State: AOAM531oq7mv93+PEB5TAQM/1vstmfRl0ezewUISgBAjUMfxStHMLDFV LOyD/z7e4othMekeNaP5hil2MN6BU8Lui69dQcg= X-Received: by 2002:a19:a48:: with SMTP id 69mr755467lfk.5.1606288940978; Tue, 24 Nov 2020 23:22:20 -0800 (PST) MIME-Version: 1.0 References: <20201121025011.227781-1-namhyung@kernel.org> <20201123142321.GP3021@hirez.programming.kicks-ass.net> <20201124080951.GE2414@hirez.programming.kicks-ass.net> In-Reply-To: <20201124080951.GE2414@hirez.programming.kicks-ass.net> From: Namhyung Kim Date: Wed, 25 Nov 2020 16:22:09 +0900 Message-ID: Subject: Re: [RFC] perf/x86: Fix a warning on x86_pmu_stop() To: Peter Zijlstra Cc: Ingo Molnar , Borislav Petkov , Thomas Gleixner , "H. Peter Anvin" , x86@kernel.org, LKML , Stephane Eranian , Kan Liang , John Sperbeck , "Lendacky, Thomas" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 24, 2020 at 5:10 PM Peter Zijlstra wrote: > > 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); > } > That would work too and much simpler! Thanks, Namhyung