Received: by 10.223.185.116 with SMTP id b49csp719911wrg; Wed, 21 Feb 2018 05:56:41 -0800 (PST) X-Google-Smtp-Source: AH8x22495pDNjUgRpqcHcU2TXKrllBM4qnU7uWZ/+NY7s0P9n4Nmpg8rqACePgtdER1TfviiEE3x X-Received: by 10.98.242.6 with SMTP id m6mr3393298pfh.230.1519221401498; Wed, 21 Feb 2018 05:56:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519221401; cv=none; d=google.com; s=arc-20160816; b=Tkqp7zscUgBjGBumxF5J550Lnm9vJs5QZjlq0fMjm1ELBpzDtDASAlxzKsFXyyUdet T7emK/xr4pRNfoWQGKTF4Lco247f6hQdLFeiR8PvqWZyh4sdPSgp+9PcpAP7gG+gDSni H4Wq39L8itvBVL1QQNjLP6lP9S+PbrAtIvJ7j+Qe1BnF3mxWumtzD1JsVO9jrY8emsWy DvpO9zow6a2ZAK/YdFAE8rqKncIMlwSULzBAX8nIcQT4CjarDrxiy9R9OKLK9/SDoHyZ zDBxrkA4hBSeombUv2jYe2+IAxFd7EV45hpLAiT6oOFctsTlfE8Bj3+0bpKOAXdX0CCM G0Mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=dFl76Qj3ohixM0siKfLwUQWcy7elL/zw7eFi0OvsVDQ=; b=hVn5/5ypqvxrcz0tZ1VPDYlQ6hmWf9CJ9S9IXl0uE5860KHDVWNfP09bSebJ1zP7yO 8YbQxnj6hmfim8Tr9LaSlvF4LOGWa712SFB3Zo7itqKIuePe8EuH6UI0sztjEXgyd60b PpfBopDH5j13IjdrA2zA07st6T4rA/zamvjKOQo6T7FbZSkkw0iVXDvgcPaBUZsPuMnj S0ddRDuV/Z3kx8/vjuR0U39WVgeLEmUITjTuboRYVFtaQanfn8nmSEowVV/rYAoUlsCO QVdp/75df1KnhIP6hcpQLj7YeIIB9/T0yQuQdAJQCv3IoM0ayI24PMxeGU4Nt6st0x5a YqZg== ARC-Authentication-Results: i=1; mx.google.com; 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 z9si5265962pgs.529.2018.02.21.05.56.27; Wed, 21 Feb 2018 05:56:41 -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; 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 S937124AbeBUNoK (ORCPT + 99 others); Wed, 21 Feb 2018 08:44:10 -0500 Received: from mga04.intel.com ([192.55.52.120]:64978 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936663AbeBUNoH (ORCPT ); Wed, 21 Feb 2018 08:44:07 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Feb 2018 05:43:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,543,1511856000"; d="scan'208";a="176944773" Received: from linux.intel.com ([10.54.29.200]) by orsmga004.jf.intel.com with ESMTP; 21 Feb 2018 05:43:49 -0800 Received: from [10.254.74.132] (kliang2-mobl1.ccr.corp.intel.com [10.254.74.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by linux.intel.com (Postfix) with ESMTPS id 8DA035802E4; Wed, 21 Feb 2018 05:43:48 -0800 (PST) Subject: Re: [PATCH V4 1/5] perf/x86/intel: Fix event update for auto-reload To: Peter Zijlstra Cc: mingo@redhat.com, linux-kernel@vger.kernel.org, acme@kernel.org, tglx@linutronix.de, jolsa@redhat.com, eranian@google.com, ak@linux.intel.com References: <1518474035-21006-1-git-send-email-kan.liang@linux.intel.com> <1518474035-21006-2-git-send-email-kan.liang@linux.intel.com> <20180221103247.GL25181@hirez.programming.kicks-ass.net> From: "Liang, Kan" Message-ID: Date: Wed, 21 Feb 2018 08:43:47 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180221103247.GL25181@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/21/2018 5:32 AM, Peter Zijlstra wrote: > On Mon, Feb 12, 2018 at 02:20:31PM -0800, kan.liang@linux.intel.com wrote: >> @@ -1389,8 +1456,22 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs) >> >> ds->pebs_index = ds->pebs_buffer_base; >> >> - if (unlikely(base >= top)) >> + if (unlikely(base >= top)) { >> + /* >> + * The drain_pebs() could be called twice in a short period >> + * for auto-reload event in pmu::read(). There are no >> + * overflows have happened in between. >> + * It needs to call intel_pmu_save_and_restart_reload() to >> + * update the event->count for this case. >> + */ >> + for_each_set_bit(bit, (unsigned long *)&cpuc->pebs_enabled, >> + x86_pmu.max_pebs_events) { >> + event = cpuc->events[bit]; >> + if (event->hw.flags & PERF_X86_EVENT_AUTO_RELOAD) >> + intel_pmu_save_and_restart_reload(event, 0); >> + } >> return; >> + } >> >> for (at = base; at < top; at += x86_pmu.pebs_record_size) { >> struct pebs_record_nhm *p = at; > > Is there a reason you didn't do intel_pmu_drain_pebs_core() ? > Right, I forgot that the drain_pebs_core() also has auto_reload support. Sorry for that. I will re-send all patches. Thanks, Kan > > --- a/arch/x86/events/intel/ds.c > +++ b/arch/x86/events/intel/ds.c > @@ -1435,8 +1435,11 @@ static void intel_pmu_drain_pebs_core(st > return; > > n = top - at; > - if (n <= 0) > + if (n <= 0) { > + if (event->hw.flags & PERF_X86_EVENT_AUTO_RELOAD) > + intel_pmu_save_and_restart_reload(event, 0); > return; > + } > > __intel_pmu_pebs_event(event, iregs, at, top, 0, n); > } >