platform/core/system/dlog.git
13 months agoAdd log storage peeking 82/290682/2
Michal Bloch [Thu, 30 Mar 2023 11:41:32 +0000 (13:41 +0200)]
Add log storage peeking

Allows to "peek" at an entry without consuming it.

This is needed to be able to choose the best
storage to consume an entry from in the planned
multi-storage reader system.

Change-Id: Id62c6ff2cc4dac5d0fa925d6e01048da50bb2454
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
13 months agodlog_logger: pipe reader buffer param now a bitmask 57/290557/1
Michal Bloch [Fri, 24 Mar 2023 16:25:48 +0000 (17:25 +0100)]
dlog_logger: pipe reader buffer param now a bitmask

Internally only, no logic change. Multiple buffers are still rejected.

Change-Id: I556f91cb1346d80c0b8f04b70deca5875f32d417
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
13 months agodlog_logger: unify reader book-keeping 56/290556/1
Michal Bloch [Fri, 24 Mar 2023 17:46:20 +0000 (18:46 +0100)]
dlog_logger: unify reader book-keeping

Change-Id: I31d02853f4023b123f16e8469741fd62cba8d201
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
13 months agodlog_logger: get rid of Android Logger throttling 53/289853/3
Michal Bloch [Tue, 14 Mar 2023 16:33:56 +0000 (17:33 +0100)]
dlog_logger: get rid of Android Logger throttling

No longer needed now that each reader has its own thread,
since it won't starve other threads.

Change-Id: I90477fcd1510b9447027fc0f1bcfd67b45305514
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
13 months agoRelease 7.5.4 64/290364/1 accepted/tizen/unified/20230329.013219
Michal Bloch [Thu, 23 Mar 2023 15:36:24 +0000 (16:36 +0100)]
Release 7.5.4

Hide csharp API and add daemon multi-threading

Change-Id: I3e5557083ba2551d76a57080539de7e5491590cd

13 months agodlog_logger: simplify reader_logger 45/290145/2
Michal Bloch [Thu, 16 Mar 2023 12:22:01 +0000 (13:22 +0100)]
dlog_logger: simplify reader_logger

No longer uses the server abstraction

Change-Id: I6d60f6bd96c6f6c6460b418489cf39d9bac749b8
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
14 months agoHide dlog_print_{dotnet,native} from the header 25/289925/1
Michal Bloch [Wed, 15 Mar 2023 13:41:12 +0000 (14:41 +0100)]
Hide dlog_print_{dotnet,native} from the header

Change-Id: Ibcd9b7c2c7aaa0a96faaaf6cac4f870dc6d3434f
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
14 months agounit tests: fix a minor leak 01/289701/1
Michal Bloch [Mon, 13 Mar 2023 16:40:17 +0000 (17:40 +0100)]
unit tests: fix a minor leak

Change-Id: I021efcad0ee56fee4a1af8be568635a45ab6df7c
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
14 months agolog-redirect: don't put enormous vars on the stack 00/289700/1
Michal Bloch [Mon, 13 Mar 2023 14:25:32 +0000 (15:25 +0100)]
log-redirect: don't put enormous vars on the stack

Change-Id: I3e6df1c687d7d379f13078dbca7450cda34a97d5

14 months agodlog_logger: multi-thread logger readers 78/285378/7
Michal Bloch [Fri, 10 Feb 2023 17:39:40 +0000 (18:39 +0100)]
dlog_logger: multi-thread logger readers

Each Android Logger reader now has its own thread.
This means the daemon now has up to 5 threads, which
will make it more responsive and less likely to starve.

Future commits will introduce similar treatment for
pipe and memory readers if this change proves itself.

Change-Id: I197bf2905449109bdd7a497a571c89c366608b06
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
14 months agodlog_logger: add a dedicated signal handler thread 10/289210/6
Michal Bloch [Tue, 7 Mar 2023 16:14:56 +0000 (17:14 +0100)]
dlog_logger: add a dedicated signal handler thread

Change-Id: I026304f8023bd236d30f30bb356ccb99adbc4d52
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
14 months agodlog_logger: add a function for resizing log_compressed_storage 15/288915/11
Marek Szulc [Fri, 24 Feb 2023 09:29:03 +0000 (10:29 +0100)]
dlog_logger: add a function for resizing log_compressed_storage

Change-Id: I1a2631ac944ef7d1384245464c9a194e3eab535f

14 months agodlog_logger: build with -pthread 30/285130/8
Michal Bloch [Tue, 6 Dec 2022 13:25:01 +0000 (14:25 +0100)]
dlog_logger: build with -pthread

In preparation for multi-threading changes.
Also affects a dlog_logger-adjacent unit test.

Change-Id: I1aabef4640e96978c4b3f54d041048a42d44f7f3

14 months agodlog_logger: remove useless 'exiting' state 87/289087/1
Michal Bloch [Tue, 28 Feb 2023 17:57:38 +0000 (18:57 +0100)]
dlog_logger: remove useless 'exiting' state

Change-Id: I45da2cbfec8fd0243c2e6bd9636559220709fda7
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
14 months agodlog_logger: flush readers on free 86/289086/1
Michal Bloch [Tue, 28 Feb 2023 18:04:08 +0000 (19:04 +0100)]
dlog_logger: flush readers on free

Change-Id: Ie0c431a107900843474e9b0f0557a23fc0eb3254

14 months agotests: less confusing logic 45/289045/2
Michal Bloch [Mon, 27 Feb 2023 16:04:57 +0000 (17:04 +0100)]
tests: less confusing logic

No logic change, but it no longer looks like the test
is somehow obtaining logs that got cleared earlier.

Change-Id: I0c9293d13dd948ec3f41236212d5d774431e5f9d
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
14 months agodlog_logger: extract some struct logger functions 41/289041/2
Michal Bloch [Fri, 24 Feb 2023 21:18:55 +0000 (22:18 +0100)]
dlog_logger: extract some struct logger functions

No logic change, just moving code around.

Change-Id: Ie1f95a4661c71839f75dedebf93eac4f94177d87
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
14 months agoRelease 7.5.3 96/288696/1 accepted/tizen/unified/20230222.161514
Michal Bloch [Tue, 21 Feb 2023 14:03:29 +0000 (15:03 +0100)]
Release 7.5.3

 * add extra 'dotnet' and 'native' sinks
 * preparatory refactoring for daemon multithreading
 * assorted fixes

Change-Id: Id24ada5453ccc43c793f3527e7d1f328a9b558cf
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
14 months agoAdd the 'dotnet' and 'native' extra libdlog sinks 96/288296/4
Michal Bloch [Mon, 20 Feb 2023 15:29:19 +0000 (16:29 +0100)]
Add the 'dotnet' and 'native' extra libdlog sinks

Including dlog_[v]print_{dotnet,native} interfaces.

Change-Id: Ie1692f8302dd42fa9d7f399b158c3190137406a9
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
14 months agoAdd the concept of extra redirectable sinks 24/288624/2
Michal Bloch [Mon, 20 Feb 2023 15:29:05 +0000 (16:29 +0100)]
Add the concept of extra redirectable sinks

These are a lot like buffers, but are listed separately due
to stakeholder decision. See the description in the header file.

Change-Id: Ib1e24c7f11ed2a76e6c227b01762e2ae73f0ac1e
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
14 months agoDisallow adapter sinks (kmsg, syslog) from printing 23/288623/1
Michal Bloch [Mon, 20 Feb 2023 13:05:07 +0000 (14:05 +0100)]
Disallow adapter sinks (kmsg, syslog) from printing

Change-Id: I211d7d7afa4b0d0698985ae9e56352eac1ee3fe2
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
14 months agoUse buffer traits over specific IDs 95/288295/4
Michal Bloch [Tue, 14 Feb 2023 18:11:45 +0000 (19:11 +0100)]
Use buffer traits over specific IDs

Change-Id: I07c52156ff93650a318089185d1b1f255519bb51

14 months agoBuffer traits: add `platform` 45/288445/1
Michal Bloch [Wed, 15 Feb 2023 15:54:17 +0000 (16:54 +0100)]
Buffer traits: add `platform`

Change-Id: I21fd715d5fc03478bfbd23affd3af8ef67f294dc
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
14 months agoExtract buffer trait functions from logcommon 44/288444/1
Michal Bloch [Wed, 15 Feb 2023 15:45:19 +0000 (16:45 +0100)]
Extract buffer trait functions from logcommon

Change-Id: If920b77c08d79b3d704ff2aba5cbf48a40845485
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
15 months agoFix tool behaviour for disabled platform logging 94/288294/1
Michal Bloch [Tue, 14 Feb 2023 18:07:29 +0000 (19:07 +0100)]
Fix tool behaviour for disabled platform logging

Now consistent with what libdlog does. It could be extracted
to a unified function, but that is not in the scope of this patch.

Change-Id: Ifec204ceaae6aa852c62e437f779c2ba9bda1494

15 months agodlog_logger: move epoll metadata functions to fd_entity.c 46/288146/1
Michal Bloch [Fri, 10 Feb 2023 18:17:01 +0000 (19:17 +0100)]
dlog_logger: move epoll metadata functions to fd_entity.c

This is where they belong. Add doxygen documentation (mostly pro forma).

Change-Id: Ibbf2cab10f3d3bc2cebd6d20d592d809474af738
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
15 months agodlog_logger: commonize reader epoll dispatch 45/288145/1
Michal Bloch [Fri, 10 Feb 2023 15:49:34 +0000 (16:49 +0100)]
dlog_logger: commonize reader epoll dispatch

 * behaviour change: reader_logger will now get removed if
   clock_gettime fails. This doesn't seem like a real concern.

 * amend commentary to reflect our recent advances in knowledge.

Change-Id: Ia4ea04703cd82cf816ef9d6f38f02344cabc4aec
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
15 months agodlog_logger: readers unregister themselves from epoll 05/287705/2
Michal Bloch [Wed, 8 Feb 2023 18:05:39 +0000 (19:05 +0100)]
dlog_logger: readers unregister themselves from epoll

Prevents mistakes (dangling FD and/or broken book-keeping),
and simplifies things (with more future potential as usual).

Removes a test that seems to have tried to do something
vaguely illegal with FD entities, this is no longer relevant.

Change-Id: I6130f0d1b725f1931bfe36f5947b84cc4b5798ec

15 months agodlog_logger: readers now remove themselves from lists 44/288144/1
Michal Bloch [Wed, 8 Feb 2023 12:55:04 +0000 (13:55 +0100)]
dlog_logger: readers now remove themselves from lists

Prevents mistakes (no longer need to call both reader_free and
list_remove when removing a reader) and allows further simplification.

Change-Id: Icf31d96ea665638965d079683d59263df47fc946

15 months agodlog_logger: writer_free uses foreach 43/288143/1
Michal Bloch [Fri, 10 Feb 2023 12:43:26 +0000 (13:43 +0100)]
dlog_logger: writer_free uses foreach

Mostly for consistency with all the other foreach that are
going to be introduced for readers in further patches.

Change-Id: Ied26532bd13ed9644126acab98501a35e1ae4afe
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
15 months agodlog_logger: readers keep their owning server 57/288057/1
Michal Bloch [Wed, 8 Feb 2023 14:00:31 +0000 (15:00 +0100)]
dlog_logger: readers keep their owning server

Will allow readers to unregister themselves from server structures
when they are cleaned up, which allows to prevent mistakes via RAII
and makes it possible to commonize more reader handling functions.

Change-Id: I1e2e5645b3106465a877ebf2b7385e83364dfb61

15 months agodlog_logger: cleanup config line handling 56/288056/1
Michal Bloch [Wed, 8 Feb 2023 12:54:09 +0000 (13:54 +0100)]
dlog_logger: cleanup config line handling

 * remove needless setting to NULL (already NULL and would leak otherwise).
 * remove a needless void cast (just makes the code less type safe)
 * remove a needless conditional-but-not-really removal wrapper (proper API exists for this)

Change-Id: Iebc4f3cd76c5aa7973f16dca9c33575e0c21445a
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
15 months agoptrs_list: make list_foreach self removal safe 21/287921/2
Michal Bloch [Tue, 7 Feb 2023 15:50:33 +0000 (16:50 +0100)]
ptrs_list: make list_foreach self removal safe

The function applied in list_foreach is now allowed to remove
the element on which it is being applied. This will allow us
to simplify various patterns such as "conditional removal that
always returns true" in the daemon.

Change-Id: Ia6e908a3085ad3aecbc6b5eacdcd077fdedaa8e6

15 months agoptrs_list: simplify remove_at implementation 20/287920/1
Michal Bloch [Tue, 7 Feb 2023 16:29:44 +0000 (17:29 +0100)]
ptrs_list: simplify remove_at implementation

Consider a table with memory layout like this:

[A]->[B]->[C]->[D]

Now, consider the removal of B. Intuitively it would result in:

[A]------>[C]->[D]

Which is what will happen now. Previously, what happened was:

[A]->[C]------>[D]

meaning B wasn't actually removed; rather, C was removed and
B took on the value of C. This was not only needlessly complex
but also made it difficult to implement "safe" iteration
that lets one remove the value being iterated on, which is
going to be implemented in a subsequent patch.

Change-Id: Icca3066ecd7c6a33b3eaf9655780c1ffc97ba722
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
15 months agodlog_logger: QoS contained by aggregation 99/287699/2
Michal Bloch [Thu, 2 Feb 2023 15:02:36 +0000 (16:02 +0100)]
dlog_logger: QoS contained by aggregation

The server struct in dlog_logger now contains a pointer
to the QoS module struct (aggregation) instead of being
a member field (composition).

This lets multiple server structs share the same QoS module.

Change-Id: I573318cb74f76374a3cd93ad03d89b7892b7dcb3
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
15 months agodlog_logger: refactor QoS distributions 25/287625/3
Michal Bloch [Wed, 1 Feb 2023 18:02:01 +0000 (19:02 +0100)]
dlog_logger: refactor QoS distributions

 * now there's a getter that returns the appropriate func,
   instead of it being parsed inside config preparation code

 * the func is now a member of the QoS module struct instead
   of being global (this is related to the plan of wrapping
   logger readers in the server struct, since that contains
   an object of type QoS module)

Change-Id: Ic08bc091079e280c891f78b1358d68d63b377669
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
15 months agodlog_logger: extract main loop iteration 68/287568/4
Michal Bloch [Tue, 31 Jan 2023 13:10:44 +0000 (14:10 +0100)]
dlog_logger: extract main loop iteration

Needed to intertwine two server structs in a single loop, which will
be introduced in a further patch. The aim is to encapsulate a reader
in its own server struct to maintain identical behaviour when moved
to a separate thread.

Also makes the code cleaner (small building blocks, etc).

Change-Id: Id60f30df617f30b65a6b121eabfd6ebeed4af6db
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
15 months agodlog_logger: reader_logger keeps dev FD directly 56/286856/3
Michal Bloch [Fri, 13 Jan 2023 18:34:04 +0000 (19:34 +0100)]
dlog_logger: reader_logger keeps dev FD directly

This is in preparation for the future change where each reader
operates from its own thread and manages the FD independently.

Change-Id: Ic2e1637ccfb2ca389a0c154cba1478da6559592f
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
15 months agodlog_logger: cull unused logger readers 55/286855/3
Michal Bloch [Fri, 13 Jan 2023 20:08:28 +0000 (21:08 +0100)]
dlog_logger: cull unused logger readers

This will avoid unnecessary resource usage, in particular
needless threads when the transition happens.

Change-Id: Ia2a057b964f1ab0e9cefc582214495d37984ed4c

15 months agodlogctl: adjust the buffer enable/disable display 75/286775/3
Michal Bloch [Thu, 22 Dec 2022 13:32:00 +0000 (14:32 +0100)]
dlogctl: adjust the buffer enable/disable display

Put each ENABLE/DISABLE in its own line for easy parsing.

Fix tests to use only the lines they were meant to use.
When stdout status was added to the same line, parsing
in tests became able to use either of the two statuses.

Change-Id: I4d05b9dbb9ac3899976f13ff7e3fc1ed756359ee
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
16 months agodlog_logger: remove reader logger sink FD entity 54/286854/1
Michal Bloch [Fri, 13 Jan 2023 18:48:27 +0000 (19:48 +0100)]
dlog_logger: remove reader logger sink FD entity

Reader logger uses internal sub-readers as sinks,
so it does not need a sink FD entity to manage it.

Change-Id: I87248d83b26384e8f37b3999132526b4cd25be4d

16 months agodlog_logger: code documentation 53/286853/1
Michal Bloch [Fri, 13 Jan 2023 18:31:45 +0000 (19:31 +0100)]
dlog_logger: code documentation

Prevent tears in the rain.

Change-Id: Ia6d5160064c2a5e08d99b3026f32da4d3b8fe556

16 months agotests: extract header to a separate file 23/286423/3
Michal Bloch [Thu, 5 Jan 2023 18:50:03 +0000 (19:50 +0100)]
tests: extract header to a separate file

Can be included by specific, focused tests in the future,
allowing to reduce the time it takes to test individual
features (since a lot of time is wasted waiting for other
irrelevant tests to run).

Change-Id: Id5046219726a7cdeb2177ea10ac36d46fa717923

16 months agolibdlog: extract dynamic config inotify check 62/286362/2
Michal Bloch [Wed, 4 Jan 2023 15:33:20 +0000 (16:33 +0100)]
libdlog: extract dynamic config inotify check

Opens up the possibility for another implementation.

Change-Id: I0ed92ef14a8e24d5389ade4e76e26f3d58d71b75
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
16 months agoFix gcno file path 65/286665/7 accepted/tizen/unified/20230207.165802
Marek Szulc [Tue, 10 Jan 2023 16:08:57 +0000 (17:08 +0100)]
Fix gcno file path

Change-Id: Iab6285dbdd7a6b86390161e9a2b69388b36130fd
Signed-off-by: Marek Szulc <m.szulc3@samsung.com>
16 months agoAdd integration test for log limiter 24/285024/8
Marek Szulc [Wed, 30 Nov 2022 15:15:55 +0000 (16:15 +0100)]
Add integration test for log limiter

Change-Id: I951ececa259bed4a7aa5b2806dcdcc5e3aa40e89

16 months agoRelease 7.5.2 60/285760/4 accepted/tizen/unified/20221221.165305
Michal Bloch [Mon, 19 Dec 2022 18:43:27 +0000 (19:43 +0100)]
Release 7.5.2

Fix lazy polling and add a null backend.

Change-Id: I1b856b536857c6d882576e7fab82aafeb17ddfae
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
16 months agodlog_logger: refactoring 76/285376/4
Michal Bloch [Fri, 9 Dec 2022 15:29:01 +0000 (16:29 +0100)]
dlog_logger: refactoring

Now there's a function that just handles system IO,
and another function that just parses data. This is
to make adapting the IO part to multi-threading easier.

Change-Id: Ia185928c092de94e617ec76a937e312d90cf7b3e
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
16 months agodlog_logger: extract a static var to a struct 94/285294/4
Michal Bloch [Thu, 8 Dec 2022 15:43:42 +0000 (16:43 +0100)]
dlog_logger: extract a static var to a struct

Change-Id: Ib9b254d2a679833659c558572cc6516030a6548c
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
16 months agodlog_logger: abstract (sub-)reader operations 29/285129/5
Michal Bloch [Tue, 6 Dec 2022 13:47:52 +0000 (14:47 +0100)]
dlog_logger: abstract (sub-)reader operations

In preparation for future work.

Change-Id: I6e38452f41b030a4677a0d45a069350308160701

16 months agominiz: get rid of unused code 33/285433/3
Michal Bloch [Mon, 12 Dec 2022 17:54:44 +0000 (18:54 +0100)]
miniz: get rid of unused code

Slightly improves compile time and makes maintenance easier.

Change-Id: I5fa293286f81d5ff309f37a6cd1a4c5538383bde
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
16 months agolibdlog: implement a null backend 00/285500/7
Michal Bloch [Tue, 13 Dec 2022 16:28:02 +0000 (17:28 +0100)]
libdlog: implement a null backend

Set via 'backend=null' config entry, drops logs.

Note that backend-independent features (like limiter)
need to be disabled separately; a conf file is provided.

Change-Id: Id0afe298960ae8a57d72b0eba3b4cdb33811e7f0
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
16 months agodlog_logger: lazy poll only for Logger backend 57/285757/6
Michal Bloch [Mon, 19 Dec 2022 17:06:32 +0000 (18:06 +0100)]
dlog_logger: lazy poll only for Logger backend

The delay makes sense for Android Logger because it only reads logs
from an "external" (from the daemon's PoV) storage so they aren't
going anywhere, and it's good not to waste resources trying to read
them at boot time.

Meanwhile for the Pipe backend it is important for the daemon to
actively listen to clients who might be trying to write logs, since
in that case the daemon is the storage (so logs need to be written
immediately, for example for crash report reasons) and also the
implementation requires it (since pipes otherwise get clogged).

Change-Id: I215438459c334698b4f3c195f6fce69ab7454f9c
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
17 months agodlog_logger: remove duplicate code 28/285128/1
Michal Bloch [Tue, 6 Dec 2022 13:46:28 +0000 (14:46 +0100)]
dlog_logger: remove duplicate code

Change-Id: I218b74301576afdd18cb61dcf0be4a05b85c9208

17 months agoRelease 7.5.1 accepted/tizen/unified/20221206.100436
Michal Bloch [Fri, 2 Dec 2022 14:47:44 +0000 (15:47 +0100)]
Release 7.5.1

ID caching + compression framework

Change-Id: Ide7ba9e5b9129fe7d3770d9b56fdb3802cc86030

17 months agolibdlog: thread-local cache for pid/tid 87/284787/4
Michal Bloch [Wed, 23 Nov 2022 15:15:22 +0000 (16:15 +0100)]
libdlog: thread-local cache for pid/tid

Expand the thread-local pid/tid caching from the zero-copy backend
to all of them. This avoids a syscall or two per log, saving a lot
of performance.

Change-Id: I964b4bb79e400833c47adf5e0fc527f2aaa5e9c4
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
17 months agoDistribute compression benchmark onto target 58/284658/2
Michal Bloch [Tue, 22 Nov 2022 16:57:38 +0000 (17:57 +0100)]
Distribute compression benchmark onto target

Change-Id: If1b5f239e237901d89e2d2e914a2edb9b5d31660
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
17 months agoAdd miniz to the daemon framework 82/284482/3
Michal Bloch [Tue, 22 Nov 2022 11:54:43 +0000 (12:54 +0100)]
Add miniz to the daemon framework

Change-Id: If4b899546504659e320719ecb28286453b658e81

17 months agoAdd a compression framework to the daemon 81/284481/2
Michal Bloch [Tue, 22 Nov 2022 11:53:46 +0000 (12:53 +0100)]
Add a compression framework to the daemon

Currently only adds fastlz. Miniz to be added later.

Change-Id: I8703d45a2a5253a5823968fb81b5a9074a747a1c
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
18 months agoCompression buffer size spec: bytes -> kilobytes 46/283946/1
Michal Bloch [Fri, 4 Nov 2022 19:21:17 +0000 (20:21 +0100)]
Compression buffer size spec: bytes -> kilobytes

As in, `dlog_logger_conf_foo=dlogutil -r 123 -b main -m bar` now
creates a buffer for 123 KB whereas previously it was 123 bytes.

Fixes an inconsistency where for files (-f) this already meant
kilobytes, and makes the default sensible (1 KB -> 1 MB).

Change-Id: I1553c29051b674a91613921a5d4eec4f0dd09d4b
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
18 months agoRelease 7.5.0 66/283566/2 accepted/tizen/unified/20221102.172734
Karol Lewandowski [Fri, 28 Oct 2022 12:58:11 +0000 (14:58 +0200)]
Release 7.5.0

Support the rewritten zero-copy backend

Change-Id: I8be6f987dd1d7c7d81b3648bdf94ecc32db22e9f

18 months agoAdd tests for the miniz compression library 67/281067/17
Marek Szulc [Thu, 8 Sep 2022 14:18:55 +0000 (16:18 +0200)]
Add tests for the miniz compression library

Change-Id: Ic6c9a3ee7c9e97ee492eeed9f71aa738c81db21a
Signed-off-by: Marek Szulc <m.szulc3@samsung.com>
18 months agoAdd miniz compression library 56/282956/3
Marek Szulc [Thu, 13 Oct 2022 16:55:21 +0000 (18:55 +0200)]
Add miniz compression library

From https://github.com/richgel999/miniz

Change-Id: I139388170a7440afe588eaaa85246af1ebc088d2

18 months agoAdd benchmark framework for testing compression algos 64/283564/1
Marek Szulc [Mon, 26 Sep 2022 11:31:56 +0000 (13:31 +0200)]
Add benchmark framework for testing compression algos

Most tests originally come from test_fastlz_pos.c

Change-Id: Ie8fec39be15959ae0565701627f12d8093c29f22
Signed-off-by: Marek Szulc <m.szulc3@samsung.com>
18 months agoAdd a timespec handling helper 01/282801/4
Michal Bloch [Tue, 11 Oct 2022 11:32:30 +0000 (13:32 +0200)]
Add a timespec handling helper

Change-Id: I24657e243fc51ef2e284fd192bce1b205294adb0
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
18 months agoEnable tests for zero-copy backend 98/282798/5
Mateusz Majewski [Wed, 7 Sep 2022 12:57:16 +0000 (14:57 +0200)]
Enable tests for zero-copy backend

Change-Id: I963d42019ae4f1106cc9dc24f288b59539ee3103

18 months agoStore ze->len in a variable 26/283326/2
Mateusz Majewski [Mon, 24 Oct 2022 08:50:13 +0000 (10:50 +0200)]
Store ze->len in a variable

This is needed since ze is a pointer to shared memory and can change at
any time. Therefore, when load_single_device tries to do bound checks
for ze->len, they become invalid immediately, since the ze->len variable
contents can change right after the check.

Change-Id: Iaa169af3180000cd8a797e1753d569f7cb3ddbbf

18 months agoEnsure the timestamp always increases in zero-copy libdlog 01/283301/2
Mateusz Majewski [Fri, 21 Oct 2022 13:08:12 +0000 (15:08 +0200)]
Ensure the timestamp always increases in zero-copy libdlog

The kernel guarantees that it won't decrease, but if function is
executed in quick repetition it might happen that we get the same value
twice in a row. This is unacceptable, since the timestamp is the only
thing we rely on in order to sort the messages.

This mirrors a similar change in the kernel module, see 282866. In the
kernel the issue has been more visible since the kernel might split the
messages in a quite arbitrary way. In userspace the issue has been
harder to notice, but with Marek's changes increasing the performance it
has become more urgent.

Change-Id: I993529a2f8e7f8e477733c929232b10fb981eaba

18 months agozlogger: use dynamic mappings for each client 56/281156/14
Marek Szyprowski [Wed, 14 Sep 2022 08:16:43 +0000 (10:16 +0200)]
zlogger: use dynamic mappings for each client

Change-Id: I7cdf81ab79445d9121728dbecd140af8042fbc84
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
18 months agozlogger: use cache for gettid() to reduce logging hot path overhead 72/283172/5
Marek Szyprowski [Wed, 19 Oct 2022 15:48:35 +0000 (17:48 +0200)]
zlogger: use cache for gettid() to reduce logging hot path overhead

Use thread local variable to cache gettid() calls and clear it with
pthread_atfork() hook. This reduces the logging hot path overhead by
avoiding any kernel calls.

On RPi4 this reduced a test message logging time (averaged) from 2.2us
to 0.8us.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I8ed74a4442d76183f2403861ac3c428fd9b5b051

18 months agozlogger: don't call get_time() twice 58/283058/2
Marek Szyprowski [Mon, 17 Oct 2022 10:08:19 +0000 (12:08 +0200)]
zlogger: don't call get_time() twice

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I1e57a2dae628b0fc4aa2d2a954bfc6ad269ba09f

19 months agoFix dlogutil -t in zero-copy backend 96/282796/1
Mateusz Majewski [Tue, 11 Oct 2022 13:16:50 +0000 (15:16 +0200)]
Fix dlogutil -t in zero-copy backend

The removed code block looks sensible. However, this is actually done
somewhere else (compare the Android Logger backend, which works in a
similar way and doesn't really handle the dump value).

Change-Id: I68161e26bda09833f2a1c20870fa8f4f72c9acaa

19 months agoFix redirection check for zero-copy logger 83/282783/1
Mateusz Majewski [Tue, 11 Oct 2022 10:21:22 +0000 (12:21 +0200)]
Fix redirection check for zero-copy logger

Change-Id: Ieaf450b09b0058551148841153838d8a5aa291f8

19 months agoHotfix release 7.0.11
Michal Bloch [Mon, 10 Oct 2022 10:39:42 +0000 (12:39 +0200)]
Hotfix release 7.0.11

Fix zero-copy sorting

Change-Id: Ia2afa31554cba7fdbefe0cb4c710bd70ca381408

19 months agoFix zero copy sorting 67/282667/2
Mateusz Majewski [Fri, 7 Oct 2022 13:20:01 +0000 (15:20 +0200)]
Fix zero copy sorting

Otherwise, the multiplication overflows since sec_sent_mono is 32 bit
and NSEC_PER_SEC is kinda big.

Change-Id: I1b4ce376bad39792929142feb7c3a05308188112

19 months agoAdd timer and string test to test_fastlz_pos/neg.c 66/281066/19
Marek Szulc [Thu, 8 Sep 2022 14:13:50 +0000 (16:13 +0200)]
Add timer and string test to test_fastlz_pos/neg.c

Change-Id: Idd8d64ceb08430ab7fef52a854a0b15ce4fe29b3
Signed-off-by: Marek Szulc <m.szulc3@samsung.com>
19 months agoRelease 7.0.10 69/281769/1 accepted/tizen_7.0_unified_hotfix tizen_7.0_hotfix accepted/tizen/7.0/unified/20221110.062910 accepted/tizen/7.0/unified/hotfix/20221116.105708 accepted/tizen/unified/20220923.052703 tizen_7.0_m2_release
Michal Bloch [Wed, 21 Sep 2022 20:27:48 +0000 (22:27 +0200)]
Release 7.0.10

Adds the clear option to the zero-copy backend
and the default dlogutil format config option.

Change-Id: I31bb1ab6439e1aecea79fd21c5a7212d169d33d3

19 months agoAdd util_default_format configuration option 74/281474/7
Mateusz Majewski [Mon, 19 Sep 2022 09:42:09 +0000 (11:42 +0200)]
Add util_default_format configuration option

Change-Id: I6b3368007ca6546b5e6cf7cc340d27651354317d

19 months agoAdd clear operation to zero copy libdlogutil 66/281766/1
Mateusz Majewski [Wed, 7 Sep 2022 12:32:20 +0000 (14:32 +0200)]
Add clear operation to zero copy libdlogutil

Change-Id: If22bd2e78ec0ffe41f79d886c579e7615cddbba2

19 months agoAdd package to explicitly enable zero-copy dlog backend 70/281670/3 accepted/tizen/unified/20220921.022916
Karol Lewandowski [Tue, 20 Sep 2022 10:33:51 +0000 (12:33 +0200)]
Add package to explicitly enable zero-copy dlog backend

Change-Id: If977fd867e7459523bb384877cee6ff117146471

19 months agoActually store the block number in the thread-local 79/281679/1
Mateusz Majewski [Tue, 20 Sep 2022 12:39:40 +0000 (14:39 +0200)]
Actually store the block number in the thread-local

Change-Id: Ia5788deca19364199f397b51a9914aa63955ee9b

19 months agoRelease 7.0.8 95/281495/1
Karol Lewandowski [Mon, 19 Sep 2022 12:24:49 +0000 (14:24 +0200)]
Release 7.0.8

Change-Id: I2d75370c199830ee492d9baa4b7c98fccd6f1eef

19 months agoDo not allow overriding DLOG_CONFIG_PATH for setuid programs 94/281494/1
Karol Lewandowski [Mon, 19 Sep 2022 11:46:00 +0000 (13:46 +0200)]
Do not allow overriding DLOG_CONFIG_PATH for setuid programs

Unprivileged process could try to redirect logs to unused backend
potentially hiding malicious attemps to break into the program.

Change-Id: I4161467c2ff9014c048a1c9d6220a792d468187e

20 months agozlogger: correct calculation of buffer map/offset 40/281340/2
Marek Szyprowski [Thu, 15 Sep 2022 11:31:36 +0000 (13:31 +0200)]
zlogger: correct calculation of buffer map/offset

Fix calculation of buffer map & offset for the non-2KB buffer case.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I753f34b105439af4b7c5db13b5c08a7918aa4d02

20 months agoRelease 7.0.7 accepted/tizen/unified/20220917.094322 accepted/tizen/unified/20220919.013235
Michal Bloch [Thu, 15 Sep 2022 11:40:39 +0000 (13:40 +0200)]
Release 7.0.7

Integrate zlogutil into (lib)dlogutil

Change-Id: Ia3146a435b56575229958889a3842934fa37129b

20 months agoIntegrate zlogutil into libdlogutil 10/280910/3
Michal Bloch [Fri, 26 Aug 2022 15:54:18 +0000 (17:54 +0200)]
Integrate zlogutil into libdlogutil

Change-Id: I910ba8eda65721afc1a687b4d76b927587cde09b
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
20 months agoRelease 7.0.6 06/280906/1 accepted/tizen/unified/20220908.124823 submit/tizen/20220906.135332
Karol Lewandowski [Tue, 6 Sep 2022 13:39:32 +0000 (15:39 +0200)]
Release 7.0.6

Change-Id: Ia0fba0db16c7bbf743bba15df0b1f5880faf6475

20 months agoMake log-redirect-stdout refuse to redirect logs if they are disabled 43/280743/3
Mateusz Majewski [Fri, 2 Sep 2022 11:44:58 +0000 (13:44 +0200)]
Make log-redirect-stdout refuse to redirect logs if they are disabled

This is sometimes needed for integration tests to work.

Change-Id: I5c829b45442276982d053111142bb87e998d4712

20 months agoBring dlog-logger.conf.alias closer to dlog-logger.conf.test 42/280742/2
Mateusz Majewski [Fri, 2 Sep 2022 10:15:00 +0000 (12:15 +0200)]
Bring dlog-logger.conf.alias closer to dlog-logger.conf.test

Otherwise, the aliasing test will fail if a logger daemon is not running
outside of the tests.

Change-Id: Ic62909639ad0ea5fca3a8e0690f70bf194b3fa38

20 months agoHack in a graceful shutdown of the daemon in the zero-copy backend 13/280713/2
Mateusz Majewski [Fri, 2 Sep 2022 09:12:00 +0000 (11:12 +0200)]
Hack in a graceful shutdown of the daemon in the zero-copy backend

Change-Id: Ia01d41469b14895c0de5435a30bb290610ba9c47

20 months agoEnsure proper access rights for zlogger device 15/280815/1
Karol Lewandowski [Mon, 5 Sep 2022 10:31:40 +0000 (12:31 +0200)]
Ensure proper access rights for zlogger device

Change-Id: Ie3e9e4ee492df5a7a051ad4754f7a80290db17c3

20 months agoAdd zero-copy backend support to log-redirect-stdout 06/280606/1 submit/tizen/20220902.191720
Mateusz Majewski [Thu, 1 Sep 2022 06:34:57 +0000 (08:34 +0200)]
Add zero-copy backend support to log-redirect-stdout

Change-Id: I7e54084e89a1f0dfe0b94fc497d71e50492cb3e9

20 months agoAdd Zlogutil for reading zero-copy backend logs 34/278734/13
Michal Bloch [Tue, 19 Jul 2022 17:20:33 +0000 (19:20 +0200)]
Add Zlogutil for reading zero-copy backend logs

Change-Id: Iffaa7bbfcf8329e1e7888efd88cd13a7ba15f493
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
20 months agoAdd a zero-copy backend 33/278733/14
Michal Bloch [Thu, 23 Jun 2022 14:51:54 +0000 (16:51 +0200)]
Add a zero-copy backend

This is the initial implementation of a zero-copy backend,
also known as 'zlog' in various places.

Many facilities (logutil, stdout redirection etc) are to be
implemented in further commits, only writing is supported
so far.

It aims to minimize the cost of writing logs above all else.
When it comes to perf, it's pushin' it to the max, rollin' deep, baby.

Some traits:
 + limited syscalls (one per N logs)
 + no needless copies (writes directly to destination)
 - no way to monitor logs efficiently (which also has
   consequences for features like QoS)
 - kernel-based and somewhat convoluted

Change-Id: I183ca7ee29aaeb6d24b2c5da96fc353f2c298d3e
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
20 months agoReuse -m for memory compression mode 38/280038/2
Michal Bloch [Mon, 22 Aug 2022 10:56:14 +0000 (12:56 +0200)]
Reuse -m for memory compression mode

Previously known as --compress.
Monitor mode is now done via --monitor.

Change-Id: If88daa7da4e9a222c8c674beb4f79c03c5a3bff0
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
20 months agoReduce max logger request length 94/279394/2
Michal Bloch [Mon, 8 Aug 2022 11:37:34 +0000 (13:37 +0200)]
Reduce max logger request length

Change-Id: I243e1c7ca10e5c2a5f0e383e9b01c3731fe64bf5
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
21 months agoRelease 7.0.5 03/278903/4 accepted/tizen/unified/20220805.131749 submit/tizen/20220804.182348
Michal Bloch [Wed, 27 Jul 2022 17:28:30 +0000 (19:28 +0200)]
Release 7.0.5

Container warning logs pid/tid; minor optimisations

Change-Id: I158010e1209f08c9d96b482cb4c093604b86948d
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
21 months agoLess harsh thread cancellation prevention 90/277090/7
Michal Bloch [Wed, 29 Jun 2022 18:33:49 +0000 (20:33 +0200)]
Less harsh thread cancellation prevention

No longer disables cancels when lockless to save 2 syscalls.

Change-Id: Id5408a0558d7c359ac5b86bb8a9d9d1a228fdead
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
21 months agoFix insufficient test dir rights 44/279144/1
Michal Bloch [Tue, 2 Aug 2022 11:33:47 +0000 (13:33 +0200)]
Fix insufficient test dir rights

Change-Id: Ie2799cce6d9fd0d3a2b269f20978edaff8dcbae0
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
21 months agolib: avoid a needless rw-lock if possible 01/278901/3
Michal Bloch [Tue, 26 Jul 2022 13:51:17 +0000 (15:51 +0200)]
lib: avoid a needless rw-lock if possible

Change-Id: Ic65ed823f3453cf270d7a373e384b9553f44ca0c
Signed-off-by: Michal Bloch <m.bloch@samsung.com>