[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.1.10.0809291548390.8145@gandalf.stny.rr.com>
Date: Mon, 29 Sep 2008 15:54:56 -0400 (EDT)
From: Steven Rostedt <rostedt@...dmis.org>
To: Mathieu Desnoyers <mathieu.desnoyers@...ymtl.ca>
cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>,
linux-kernel@...r.kernel.org, Martin Bligh <mbligh@...gle.com>,
prasad@...ux.vnet.ibm.com,
Linus Torvalds <torvalds@...ux-foundation.org>,
Thomas Gleixner <tglx@...utronix.de>, od@...e.com,
"Frank Ch. Eigler" <fche@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>, hch@....de,
David Wilder <dwilder@...ibm.com>,
Tom Zanussi <zanussi@...cast.net>
Subject: Re: [RFC PATCH] LTTng relay buffer allocation, read, write
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists