Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932530AbbGGRMd (ORCPT ); Tue, 7 Jul 2015 13:12:33 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:18325 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932378AbbGGRMY (ORCPT ); Tue, 7 Jul 2015 13:12:24 -0400 X-AuditID: cbfec7f4-f79c56d0000012ee-ce-559c08744be0 Message-id: <559C0820.3060805@samsung.com> Date: Tue, 07 Jul 2015 19:10:56 +0200 From: Karol Lewandowski Organization: Samsung Poland R&D Center User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.7.0 MIME-version: 1.0 To: Petr Mladek , Marcin Niesluchowski Cc: Richard Weinberger , "linux-doc@vger.kernel.org" , LKML , "open list:ABI/API" , Jonathan Corbet , Greg Kroah-Hartman , Tejun Heo , Kay Sievers , Andrew Morton , Joe Perches , Bartlomiej Zolnierkiewicz , Kyungmin Park Subject: Re: [RFC 0/8] Additional kmsg devices References: <1435920595-30879-1-git-send-email-m.niesluchow@samsung.com> <5596A58F.7090208@samsung.com> <20150707131124.GI32664@pathway.suse.cz> In-reply-to: <20150707131124.GI32664@pathway.suse.cz> Content-type: text/plain; charset=utf-8 Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrGIsWRmVeSWpSXmKPExsVy+t/xq7olHHNCDZZu1rWYs34Nm8XGGetZ LZ4caGe0aF68ns1i9v3HLBa3Vj1nt7h1eRWLxebvHWwWC9uWsFhc3jWHzeLQ2R8sFv8ff2W1 +DBxA5vFr+VHGR34PHbOusvusXmFlsemVZ1sHidm/Gbx2D93DbvH4r7JrB5fVl1j9ujbsorR Y/2WqywenzfJeXxc7xnAHcVlk5Kak1mWWqRvl8CVcbDvDHPBbIWKCfe2MzUwPpDsYuTkkBAw kTj9dDYThC0mceHeerYuRi4OIYGljBLXn99khnCeM0q8fX6HsYuRg4NXQEti5m99kAYWAVWJ 3rv3WEBsNgEjiW+HNjCD2PwC6hLvtj0FGyoqECIxa+9TVhCbV0BQ4sdkiHoRgVCJCc1vweYz C7SxSNw8vIQNJCEsoCex+8wjVojFNxklFk6ZBdbNKWAq8XDSCjaQI5iBNkyZkgsSZhaQl9i8 5i3zBEbBWUh2zEKomoWkagEj8ypG0dTS5ILipPRcQ73ixNzi0rx0veT83E2MkNj7soNx8TGr Q4wCHIxKPLw3JGaHCrEmlhVX5h5ilOBgVhLhfXMSKMSbklhZlVqUH19UmpNafIhRmoNFSZx3 7q73IUIC6YklqdmpqQWpRTBZJg5OqQbGdX2HAnbdmek1639wfctECwceZ07WRcviHl7cnZ9f aFf6/O/Xz1sYhI8nrbJkf7I8LiWt/y//SwOuNxs8zkyf98WsTsZkW46/w0OJU/HNr81zFM9w 8VtH83gum/mvZ7fZseSyBcuzOHU3LV7oyan/1OX1lMusuvGPHod0Xk5yKgn6/63e45WbEktx RqKhFnNRcSIATfhawLkCAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4269 Lines: 104 On 2015-07-07 15:11, Petr Mladek wrote: > On Fri 2015-07-03 17:09:03, Marcin Niesluchowski wrote: >> On 07/03/2015 01:21 PM, Richard Weinberger wrote: >>> On Fri, Jul 3, 2015 at 12:49 PM, Marcin Niesluchowski >>> wrote: >>>> Dear All, >>>> >>>> This series of patches extends kmsg interface with ability to dynamicaly >>>> create (and destroy) kmsg-like devices which can be used by user space >>>> for logging. Logging to kernel has number of benefits, including but not >>>> limited to - always available, requiring no userspace, automatically >>>> rotating and low overhead. >>>> >>>> User-space logging to kernel cyclic buffers was already successfully used >>>> in android logger concept but it had certain flaws that this commits try >>>> to address: >>>> * drops hardcoded number of devices and static paths in favor for dynamic >>>> configuration by ioctl interface in userspace >>>> * extends existing driver instead of creating completely new one >>> So, now we start moving syslogd into kernel land because userspace is >>> too broken to provide >>> decent logging? >>> >>> I can understand the systemd is using kmsg if no other logging service >>> is available >>> but I really don't think we should encourage other programs to do so. >>> >>> 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) >> >> * Early userspace tool: Helpful especially for embeded systems. >> >> * 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. > But then many services will fight for the space in the kernel ring > buffer. Yes. Please note however that problems you describe are also valid for /dev/kmsg today. User space has used (one) writeable kmsg for some time already - which has caused number of interesting problems caused by the fact that messages from different domains (kernel, userspace) are written to one place (ie. systemd "debug" problem). One of the goals is to avoid this particular problem and let userspace create, destroy and user their own buffers at will. > We will need a mechanism to guarantee a space for each service. We preserve semantics of kmsg, so I don't see why we would need to give any more guarantees that what was provided there. > We will need priorities to throttle various services various ways. Appropriate buffer size will throttle messages automatically - I don't think we need anything more than that. See also below. > It will be easier to lost messages. Ability to lose messages is one of the goals - if we exceed buffer size and there are no one actively reading buffers this is what we want to happen. Say we have one buffer where debug messages go - we are not at all interested in the content and are very happy to lose these... unless in the case of crash, where we will have all of it dumped to persistent storage by pstore (this is when content might be interesting and helpful). This is just one of many possible scenarios. > It might be harder to get the important messages on the console when > the system is going down. Messages from additional buffers are not intended to be written to console. > It will be harder to handle continuous lines. I don't see how it would be different from what we have today. > I am not sure that we want to go this way. This is why this thread has RFC tag anyway :^) Thanks -- Karol Lewandowski, Samsung R&D Institute Poland -- 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/