linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcin Niesluchowski <m.niesluchow@samsung.com>
To: Richard Weinberger <richard@nod.at>
Cc: "linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"open list:ABI/API" <linux-api@vger.kernel.org>,
	Jonathan Corbet <corbet@lwn.net>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Petr Mladek <pmladek@suse.cz>, Tejun Heo <tj@kernel.org>,
	Kay Sievers <kay@vrfy.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Joe Perches <joe@perches.com>,
	Karol Lewandowski <k.lewandowsk@samsung.com>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Subject: Re: [RFC 0/8] Additional kmsg devices
Date: Wed, 08 Jul 2015 10:30:03 +0200	[thread overview]
Message-ID: <559CDF8B.2090000@samsung.com> (raw)
In-Reply-To: <5596A80D.5040109@nod.at>

On 07/03/2015 05:19 PM, Richard Weinberger wrote:
> Am 03.07.2015 um 17:09 schrieb Marcin Niesluchowski:
>>> Why can't you just make sure that your target has a working
>>> syslogd/rsyslogd/journald/whatever?
>>> All can be done perfectly fine in userspace.
>> * Message credibility: Lets imagine simple service which collects logs via unix sockets. There is no reliable way of identifying logging process. getsockopt() with SO_PEERCRED
>> option would give pid form cred structure, but according to manual it may not be of actual logging process:
>>    "The returned credentials are those that were in effect at the time of the call to connect(2) or socketpair(2)."
>>        - select(7)
> This interface can be improved. Should be easy.

What kind of improvement do you have in mind?

>> * Early userspace tool: Helpful especially for embeded systems.
> This is what we do already. In early user space spawn your logger as early as possible.
> "embedded Linux is special" is not an excuse btw. ;)

I would say "embedded Linux is real use case"instead of "special". What 
I meant that it does only require one ioctl and no additional resources 
are needed.

>> * Reliability: Userspace service may be killed due to out of memory (OOM). This is kernel cyclic buffer, which size can be specified differently according to situation.
> This is what we have /proc/<pid>/oom_adj and /proc/<pid>/oom_score_adj for.

You are right, but additional resources and complexity is required.

>> * Possibility of using it with pstore: This code could be extended to log additional buffers to persistent storage same way main (kmsg) log buffer is.
> pstorefs and friends?

pstore filesystem is used to access already stored kernel data (e.g. 
kmsg buffer). But does not provide mechanism of storing userspace memory.

>> * Use case of attaching file descriptor to stdout/stderr: Especially in early userspace.
> You can redirect these also in userspace.

True for that, but as I said in my first argument there is no 
possibility of logging process identification in case of sockets.


>> * Performance: Those services mentioned by You are weeker solutions in that case. Especially systemd-journald is much too heavy soulution.
> Do you have numbers? I agree systemd-journald is heavy wight. But it is by far not the only logging daemon we have...

I compared write operations on kmsg buffervia write/read operations on 
socketon SOCK_STREAM socket and sendmsg/recv on SOCK_DGRAM socket. 
Compared toSOCK_STREAM socket it was about 39% slowerbut compared 
toSOCK_DGRAM socket it was about 326% faster.syslogfor example uses 
SOCK_DGRAM sockets.In all cases there were 2^20 (1048576) write/sendmsg 
operations of 2^8 (256) bytes.

Best Regards,
Marcin Niesluchowski

  parent reply	other threads:[~2015-07-08  8:30 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-03 10:49 [RFC 0/8] Additional kmsg devices Marcin Niesluchowski
     [not found] ` <1435920595-30879-1-git-send-email-m.niesluchow-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-07-03 10:49   ` [RFC 1/8] printk: move code regarding log message storing format Marcin Niesluchowski
2015-07-03 10:49   ` [RFC 2/8] printk: add one function for storing log in proper format Marcin Niesluchowski
2015-07-03 10:49   ` [RFC 7/8] kmsg: add ioctl for adding and deleting kmsg* devices Marcin Niesluchowski
2015-07-03 10:49   ` [RFC 8/8] kmsg: add ioctl for kmsg* devices operating on buffers Marcin Niesluchowski
2015-07-03 10:49 ` [RFC 3/8] kmsg: introduce additional kmsg devices support Marcin Niesluchowski
2015-07-08 11:10   ` Petr Mladek
2015-07-03 10:49 ` [RFC 4/8] kmsg: add function for adding and deleting additional buffers Marcin Niesluchowski
2015-07-03 10:49 ` [RFC 5/8] kmsg: device support in mem class Marcin Niesluchowski
     [not found]   ` <1435920595-30879-6-git-send-email-m.niesluchow-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-07-03 15:39     ` Greg Kroah-Hartman
2015-07-03 10:49 ` [RFC 6/8] kmsg: add predefined _PID, _TID, _COMM keywords to kmsg* log dict Marcin Niesluchowski
2015-07-03 11:21 ` [RFC 0/8] Additional kmsg devices Richard Weinberger
     [not found]   ` <CAFLxGvxvaePEyCpLrB1cjNn4bvnCwt-_HE3zcT-6diMYNOraBw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-07-03 15:09     ` Marcin Niesluchowski
     [not found]       ` <5596A58F.7090208-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-07-03 16:57         ` Andy Lutomirski
2015-07-07 13:11       ` Petr Mladek
2015-07-07 17:10         ` Karol Lewandowski
2015-07-08 10:45           ` Petr Mladek
     [not found]       ` <5596A80D.5040109@nod.at>
2015-07-08  8:30         ` Marcin Niesluchowski [this message]
     [not found]           ` <559CE110.70503@nod.at>
2015-07-08 11:17             ` Bartlomiej Zolnierkiewicz

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=559CDF8B.2090000@samsung.com \
    --to=m.niesluchow@samsung.com \
    --cc=akpm@linux-foundation.org \
    --cc=b.zolnierkie@samsung.com \
    --cc=corbet@lwn.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=joe@perches.com \
    --cc=k.lewandowsk@samsung.com \
    --cc=kay@vrfy.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmladek@suse.cz \
    --cc=richard@nod.at \
    --cc=tj@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).