Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935375AbbGHIa0 (ORCPT ); Wed, 8 Jul 2015 04:30:26 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:35300 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933936AbbGHIaH (ORCPT ); Wed, 8 Jul 2015 04:30:07 -0400 X-AuditID: cbfec7f4-f79c56d0000012ee-97-559cdf8c41f2 Message-id: <559CDF8B.2090000@samsung.com> Date: Wed, 08 Jul 2015 10:30:03 +0200 From: Marcin Niesluchowski User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-version: 1.0 To: Richard Weinberger Cc: "linux-doc@vger.kernel.org" , LKML , "open list:ABI/API" , Jonathan Corbet , Greg Kroah-Hartman , Petr Mladek , Tejun Heo , Kay Sievers , Andrew Morton , Joe Perches , Karol Lewandowski , Bartlomiej Zolnierkiewicz Subject: Re: [RFC 0/8] Additional kmsg devices References: <1435920595-30879-1-git-send-email-m.niesluchow@samsung.com> <5596A58F.7090208@samsung.com> <5596A80D.5040109@nod.at> In-reply-to: <5596A80D.5040109@nod.at> Content-type: text/plain; charset=utf-8; format=flowed Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprEIsWRmVeSWpSXmKPExsVy+t/xa7o99+eEGhzYYmkxZ/0aNouNM9az Wjw50M5o0bx4PZvF7PuPWSwaP81ltri16jm7xebvHWwWC9uWsFhc3jUHyPq/mcli8s43jBa/ lh9ldOD12LSqk83jxIzfLB77565h91jcN5nV4+a8Qo8vq64xe/RtWcXocWbBEXaPz5vkPD6u 9wzgiuKySUnNySxLLdK3S+DKaN82h6ngo2jF6zsbmRsYXwl2MXJySAiYSJxqOsMOYYtJXLi3 nq2LkYtDSGApo8SGuxsYIZwXjBKHNy5gAaniFdCS2DR1MxOIzSKgKtE35zAbiM0mYCrRtmwP 2CRRgQiJt5dPMkHUC0r8mHwPrFdEQF3i3cupYBuYBX4wS7RdvgiWEBbQk9h95hErxLZTjBLX ZnwCcjg4OAXUJM4e0QWpYRYwk/jy8jArhC0vsXnNW+YJjAKzkOyYhaRsFpKyBYzMqxhFU0uT C4qT0nMN9YoTc4tL89L1kvNzNzFCYurLDsbFx6wOMQpwMCrx8HrEzAkVYk0sK67MPcQowcGs JMK76wJQiDclsbIqtSg/vqg0J7X4EKM0B4uSOO/cXe9DhATSE0tSs1NTC1KLYLJMHJxSDYx9 Kvtl7E1zV9Qmf3ynFrXOMHfBopiItf/2rhE9PsH0ltXnzuNB8z2dKgQF826eKmR/N2O5Q/Kf da8j9x0Iq5jHdv/cuseiwfa/flyvfiIif1b7662A1ay72CYZZLNnXCmb2cQW++Py9K0GddcC 9f35/7aGxMkrp317d91Lb2fa/FvGR1+/XPhViaU4I9FQi7moOBEAunbYQqUCAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2995 Lines: 56 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//oom_adj and /proc//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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/