From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752340AbdIMKk3 (ORCPT ); Wed, 13 Sep 2017 06:40:29 -0400 Received: from mga02.intel.com ([134.134.136.20]:23370 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752306AbdIMKk2 (ORCPT ); Wed, 13 Sep 2017 06:40:28 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,387,1500966000"; d="scan'208";a="899814070" From: Alexander Shishkin To: Will Deacon Cc: Peter Zijlstra , Ingo Molnar , linux-kernel@vger.kernel.org Subject: Re: [PATCH] perf/aux: Only update aux_wakeup in non-overwrite mode In-Reply-To: <20170912223732.GD10675@arm.com> References: <20170906160811.16510-1-alexander.shishkin@linux.intel.com> <20170912223732.GD10675@arm.com> User-Agent: Notmuch/0.23.7 (http://notmuchmail.org) Emacs/25.1.1 (x86_64-pc-linux-gnu) Date: Wed, 13 Sep 2017 13:34:03 +0300 Message-ID: <87fubqx4ys.fsf@ashishki-desk.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Will Deacon writes: > Hi Alexander, > > On Wed, Sep 06, 2017 at 07:08:11PM +0300, Alexander Shishkin wrote: >> Commit d9a50b0256 ("perf/aux: Ensure aux_wakeup represents most recent >> wakeup index") changed aux wakeup position calculation to rounddown(), >> which causes a division-by-zero in AUX overwrite mode (aka "snapshot >> mode"). >> >> The zero denominator results from the fact that perf record doesn't set >> aux_watermark to anything, in which case the kernel will set it to half >> the AUX buffer size, but only for non-overwrite mode. In the overwrite >> mode aux_watermark stays zero. >> >> The good news is that, AUX overwrite mode, wakeups don't happen and >> related bookkeeping is not relevant, so we can simply forego the whole >> wakeup updates. >> >> Signed-off-by: Alexander Shishkin >> --- >> kernel/events/ring_buffer.c | 20 +++++++++++++++----- >> 1 file changed, 15 insertions(+), 5 deletions(-) > > Damn, sorry about that. How did you spot the problem? A normal perf record with -S should trigger it, I don't remember what exactly I was doing at that moment. But no worries, we all missed it the first time around. :) > Anyway, I think the code is much better with this factored out: > > Acked-by: Will Deacon Thanks!