Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756283AbeAJObG (ORCPT + 1 other); Wed, 10 Jan 2018 09:31:06 -0500 Received: from mga02.intel.com ([134.134.136.20]:11402 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756104AbeAJObF (ORCPT ); Wed, 10 Jan 2018 09:31:05 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,340,1511856000"; d="scan'208";a="20494184" Subject: Re: [RESEND PATCH V2 1/4] perf/x86/intel: fix event update for auto-reload To: Jiri Olsa Cc: kan.liang@intel.com, peterz@infradead.org, mingo@redhat.com, acme@kernel.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, eranian@google.com, ak@linux.intel.com References: <1515424516-143728-1-git-send-email-kan.liang@intel.com> <1515424516-143728-2-git-send-email-kan.liang@intel.com> <20180110102249.GA18942@krava> From: "Liang, Kan" Message-ID: <220174ff-5880-909a-f25d-1de1a8d15369@linux.intel.com> Date: Wed, 10 Jan 2018 09:31:01 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180110102249.GA18942@krava> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On 1/10/2018 5:22 AM, Jiri Olsa wrote: > On Mon, Jan 08, 2018 at 07:15:13AM -0800, kan.liang@intel.com wrote: > > SNIP > >> There is nothing need to do in x86_perf_event_set_period(). Because it >> is fixed period. The period_left is already adjusted. >> >> Signed-off-by: Kan Liang >> --- >> arch/x86/events/intel/ds.c | 69 ++++++++++++++++++++++++++++++++++++++++++++-- >> 1 file changed, 67 insertions(+), 2 deletions(-) >> >> diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c >> index 3674a4b..cc1f373 100644 >> --- a/arch/x86/events/intel/ds.c >> +++ b/arch/x86/events/intel/ds.c >> @@ -1251,17 +1251,82 @@ get_next_pebs_record_by_bit(void *base, void *top, int bit) >> return NULL; >> } >> >> +/* >> + * Specific intel_pmu_save_and_restart() for auto-reload. >> + */ >> +static int intel_pmu_save_and_restart_reload(struct perf_event *event, >> + u64 reload_val, >> + int reload_times) >> +{ >> + struct hw_perf_event *hwc = &event->hw; >> + int shift = 64 - x86_pmu.cntval_bits; >> + u64 prev_raw_count, new_raw_count; >> + u64 delta; >> + >> + if ((reload_times == 0) || (reload_val == 0)) >> + return intel_pmu_save_and_restart(event); > > why is this check needed? AFAICS __intel_pmu_pebs_event is > called only if reload_times != 0 and reload_val is always > non zero for sampling > Here is a sanity check for reload_times and reload_val. Right, usually they are non zero. I think it should not bring any issues. Right? If so, I think we may still keep it? Thanks, Kan