From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755567AbcEYR7x (ORCPT ); Wed, 25 May 2016 13:59:53 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:48826 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754293AbcEYR7w (ORCPT ); Wed, 25 May 2016 13:59:52 -0400 Date: Wed, 25 May 2016 19:59:47 +0200 From: Peter Zijlstra To: Andy Lutomirski Cc: linux-kernel@vger.kernel.org, Steven Rostedt , Ingo Molnar Subject: Re: [PATCH] tracing: Choose static tp_printk buffer by explicit nesting count Message-ID: <20160525175947.GS3205@twins.programming.kicks-ass.net> References: <08104c3c8b9b8091fdcc6b4ca2c8c5dcc9dfd77d.1464130297.git.luto@kernel.org> <20160525131640.GG3192@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160525131640.GG3192@twins.programming.kicks-ass.net> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 25, 2016 at 03:16:40PM +0200, Peter Zijlstra wrote: > On Tue, May 24, 2016 at 03:52:28PM -0700, Andy Lutomirski wrote: > > + struct trace_buffer_struct *buffer = this_cpu_ptr(trace_percpu_buffer); > > > > + if (!buffer || buffer->nesting >= 4) > > return NULL; > > This is buggy fwiw; you need to unconditionally increment > buffer->nesting to match the unconditional decrement. > > Otherwise 5 'increments' and 5 decrements will land you at -1. Urgh, never mind me; if you don't dec when returning NULL this should work out fine. My head really aint working right today.