From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753320AbYI2TzR (ORCPT ); Mon, 29 Sep 2008 15:55:17 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751904AbYI2TzD (ORCPT ); Mon, 29 Sep 2008 15:55:03 -0400 Received: from hrndva-omtalb.mail.rr.com ([71.74.56.123]:37626 "EHLO hrndva-omtalb.mail.rr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751478AbYI2TzB (ORCPT ); Mon, 29 Sep 2008 15:55:01 -0400 Date: Mon, 29 Sep 2008 15:54:56 -0400 (EDT) From: Steven Rostedt X-X-Sender: rostedt@gandalf.stny.rr.com To: Mathieu Desnoyers cc: Peter Zijlstra , linux-kernel@vger.kernel.org, Martin Bligh , prasad@linux.vnet.ibm.com, Linus Torvalds , Thomas Gleixner , od@suse.com, "Frank Ch. Eigler" , Andrew Morton , hch@lst.de, David Wilder , Tom Zanussi Subject: Re: [RFC PATCH] LTTng relay buffer allocation, read, write In-Reply-To: Message-ID: References: <20080927134012.GA11930@Krystal> <1222535419.16700.300.camel@lappy.programming.kicks-ass.net> <20080929155004.GA11029@Krystal> <20080929183833.GA17490@Krystal> User-Agent: Alpine 1.10 (DEB 962 2008-03-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 29 Sep 2008, Steven Rostedt wrote: > We do not need to worry about SMP for writes. > That is, if you reserve data and atomically push the head forward > if the head goes past the end of page, One, you check if your > start of head (head - length) is still on the page. If it is > you add your padding (you already reserved it), then you atomically > push the head forward. Then you start the process again. > If the start of the head (head - length) is not on the page, that > means that an IRQ or NMI came in and pushed it before you. I forgot to mention one important detail. The "head" index will stay on the page frame. That way we do not need to figure out which head_page we are on. We grab the head_page, we atomically (local_inc_return) the head pointer on that page. If the return value is still on the page, we succeeded. We can also increment a value on this page frame that will prevent recording if we somehow overflowed the buffer before relinquishing the stack. That is reserve_event() IRQ-> reserve_event(); [...] IRQ->reserve_event() came back to original head! Here we do not have a big enough buffer, and this is just stupid ;-) We would drop packets in this case, and should drop the guy on his head who came up with the too small buffer. -- Steve