Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756018Ab3HAN6F (ORCPT ); Thu, 1 Aug 2013 09:58:05 -0400 Received: from mail-wi0-f176.google.com ([209.85.212.176]:59340 "EHLO mail-wi0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755441Ab3HAN6D (ORCPT ); Thu, 1 Aug 2013 09:58:03 -0400 Date: Thu, 1 Aug 2013 15:57:59 +0200 From: Frederic Weisbecker To: Jiri Olsa Cc: Peter Zijlstra , LKML , Namhyung Kim , Ingo Molnar , Arnaldo Carvalho de Melo , Stephane Eranian Subject: Re: [PATCH 2/8] perf: Sanitize get_callchain_buffer() Message-ID: <20130801135757.GF431@somewhere> References: <1374539466-4799-1-git-send-email-fweisbec@gmail.com> <1374539466-4799-3-git-send-email-fweisbec@gmail.com> <20130801130146.GE1032@krava.brq.redhat.com> <20130801132833.GA431@somewhere> <20130801133217.GH1032@krava.brq.redhat.com> <20130801134931.GD431@somewhere> <20130801135401.GK1032@krava.brq.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130801135401.GK1032@krava.brq.redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1227 Lines: 36 On Thu, Aug 01, 2013 at 03:54:01PM +0200, Jiri Olsa wrote: > On Thu, Aug 01, 2013 at 03:49:36PM +0200, Frederic Weisbecker wrote: > > On Thu, Aug 01, 2013 at 03:32:17PM +0200, Jiri Olsa wrote: > > > On Thu, Aug 01, 2013 at 03:28:34PM +0200, Frederic Weisbecker wrote: > > > > > > SNIP > > > > > > > > also for following case: > > > > > > > > > > count = atomic_inc_return(&nr_callchain_events); > > > > > if (WARN_ON_ONCE(count < 1)) { > > > > > err = -EINVAL; > > > > > goto exit; > > > > > } > > > > > > > > > > seems like it screws the count > > > > > > > > I'm not sure what you mean here. You mean that it could be negative when the dec is done > > > > outside the lock? > > > > > > yes > > > > > > > I don't understand why. > > ah ok, with the count being 0 the nr_callchain_events still > increments right? then it's ok.. Yep. But I still need to move the dec into the lock though. Thanks for catching this! -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/