From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753081AbdLSWHS (ORCPT ); Tue, 19 Dec 2017 17:07:18 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:43543 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751551AbdLSWHR (ORCPT ); Tue, 19 Dec 2017 17:07:17 -0500 Date: Tue, 19 Dec 2017 23:07:09 +0100 From: Peter Zijlstra To: "Liang, Kan" Cc: mingo@redhat.com, acme@kernel.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, jolsa@redhat.com, eranian@google.com, ak@linux.intel.com Subject: Re: [PATCH 2/4] perf/x86/intel: fix event update for auto-reload Message-ID: <20171219220709.sq7kwvg7l2ojltvr@hirez.programming.kicks-ass.net> References: <1513596891-12362-1-git-send-email-kan.liang@linux.intel.com> <1513596891-12362-3-git-send-email-kan.liang@linux.intel.com> <20171219185810.d4yqz6qwqmx3f5o5@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 19, 2017 at 03:08:58PM -0500, Liang, Kan wrote: > > This all looks very wrong... In auto reload we should never call > > intel_pmu_save_and_restore() in the first place I think. > > > > Things like x86_perf_event_update() and x86_perf_event_set_period() > > simply _cannot_ do the right thing when we auto reload the counter. > > > > I think it should be OK to call it in first place. > For x86_perf_event_update(), the reload_times will tell if it's auto reload. > Both period_left and event->count are carefully recalculated for auto > reload. How does prev_count make sense when we've already reloaded a bunch of times? > For x86_perf_event_set_period(), there is nothing special needed for auto > reload. The period is fixed. The period_left from x86_perf_event_update() is > already handled. Hurm.. I see. But rather than make an ever bigger trainwreck of things, I'd rather you just write a special purpose intel_pmu_save_and_restart() just for AUTO_RELOAD.