All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: NeilBrown <neilb@suse.de>
Cc: Tim Bird <tim.bird@am.sony.com>, Greg KH <gregkh@suse.de>,
	linux-embedded <linux-embedded@vger.kernel.org>,
	linux kernel <linux-kernel@vger.kernel.org>,
	john stultz <johnstul@us.ibm.com>,
	Brian Swetland <swetland@google.com>,
	Kay Sievers <kay.sievers@vrfy.org>,
	Lennart Poettering <lennart@poettering.net>
Subject: Re: RFC: android logger feedback request
Date: Thu, 22 Dec 2011 14:59:04 +0000	[thread overview]
Message-ID: <201112221459.04701.arnd@arndb.de> (raw)
In-Reply-To: <20111222122026.3a0fae36@notabene.brown>

On Thursday 22 December 2011, NeilBrown wrote:
> If you created a 'logbuf' filesystem that used libfs to provide a single
> directory in which privileged processes could create files then you wouldn't
> need the kernel to "know" the allowed logs: radio, events, main, system.
> The size could be set by ftruncate() (by privileged used again) rather than
> being hardcoded.
> 
> You would defined 'read' and 'write' much like you currently do to create a list of
> datagrams in a circular buffer and replace the ioctls by more standard
> interfaces:
> 
> LOGGER_GET_LOG_BUG_SIZE would use 'stat' and the st_blocks field
> LOGGER_GET_LOG_LEN would use 'stat' and the st_size field
> LOGGER_GET_NEXT_ENTRY_LEN could use the FIONREAD ioctl
> LOGGER_FLUSH_LOG could use ftruncate
> 
> The result would be much the same amount of code, but an interface which has
> fewer details hard-coded and is generally more versatile and accessible.

I like the idea and was going to suggest something very similar, but I wonder
if we could take the approach even further:

* Remove all kernel code for this and use a user space library together
  with tmpfs
* prepopulate the tmpfs at boot time with all the log buffers in the right
  size, and set the maximum file system size so that they cannot grow further.
* Have minimal formatting in the log buffer: A few bytes header (ring buffer
  start and end)
* Mandate that user space must use mmap and atomic operations to reserve space
  in the log and write to the files.
* Provide a tool to get the log data out of the buffer again in a race-free way.

Since any program that is allowed to write to the buffer can overwrite all
existing information in it anyway, I think we don't actually need any kernel
help in maintaining consistency of the contents either -- the reader will
simply discard any data. The main thing we would not be able to guarantee
without kernel help is proving the origin of individual messages, but I'm
not sure if that is a design goal.

	Arnd

  parent reply	other threads:[~2011-12-22 14:59 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-21 22:59 RFC: android logger feedback request Tim Bird
2011-12-21 23:19 ` Greg KH
2011-12-22  0:18   ` john stultz
2011-12-22  0:27     ` Greg KH
2011-12-22  0:47       ` john stultz
2011-12-22  1:09         ` john stultz
2011-12-22  0:42     ` Tim Bird
2011-12-22  0:49       ` john stultz
2011-12-22  1:00         ` john stultz
2011-12-22  0:36   ` Tim Bird
2011-12-22  0:51     ` Greg KH
2011-12-22  1:32       ` Tim Bird
2011-12-22  1:47         ` Greg KH
2011-12-22  2:12           ` Tim Bird
2011-12-22  3:44             ` Kay Sievers
2011-12-22  3:45             ` Greg KH
2011-12-22  3:47             ` Greg KH
2011-12-22  4:12               ` Kay Sievers
2011-12-22  4:22                 ` Brian Swetland
2011-12-22  4:43                   ` Kay Sievers
2011-12-22  4:43                     ` Kay Sievers
2011-12-22  4:47                   ` david
2011-12-22  4:58                     ` Brian Swetland
2011-12-22  4:58                       ` Brian Swetland
2011-12-22  5:07                       ` david
2011-12-22  5:21                       ` david
2011-12-22 13:40                   ` Lennart Poettering
2011-12-22  4:49                 ` david
2011-12-22  2:34           ` Kay Sievers
2011-12-22  2:34             ` Kay Sievers
2011-12-22  1:20     ` NeilBrown
2011-12-22  1:49       ` Greg KH
2011-12-22  2:14       ` Tim Bird
2011-12-22  2:34       ` Brian Swetland
2011-12-22  3:49         ` Greg KH
2011-12-22  4:36           ` Kay Sievers
2011-12-22  4:36             ` Kay Sievers
2011-12-22  5:01         ` david
2011-12-22  4:52       ` david
2011-12-22  5:06         ` Brian Swetland
2011-12-22  5:14           ` david
2011-12-22  5:25             ` Brian Swetland
2011-12-22  6:09               ` Greg KH
2011-12-23 15:22                 ` Alan Cox
2011-12-23 16:29                   ` Greg KH
2011-12-22  7:05           ` NeilBrown
2012-01-06 20:56             ` Tim Bird
2012-01-06 20:56               ` Tim Bird
2012-01-06 21:20               ` Greg KH
2012-01-06 22:41                 ` Tim Bird
2012-01-06 23:17                   ` Greg KH
2012-01-06 23:35                   ` Greg KH
2011-12-22 14:59       ` Arnd Bergmann [this message]
2011-12-22 15:13         ` Kay Sievers
2011-12-22  4:42     ` david
2011-12-22  0:59 ` David Brown
2011-12-29  0:39 ` Andrew Morton
2012-01-04 15:34   ` Geunsik Lim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201112221459.04701.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=gregkh@suse.de \
    --cc=johnstul@us.ibm.com \
    --cc=kay.sievers@vrfy.org \
    --cc=lennart@poettering.net \
    --cc=linux-embedded@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=swetland@google.com \
    --cc=tim.bird@am.sony.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.