<feed xmlns='http://www.w3.org/2005/Atom'>
<title>system_core/logd/LogAudit.cpp, branch replicant-6.0</title>
<subtitle>system/core
</subtitle>
<link rel='alternate' type='text/html' href='https://git.replicant.us/replicant/system_core/'/>
<entry>
<title>logd: optimize code hotspots</title>
<updated>2015-11-01T12:29:12+00:00</updated>
<author>
<name>Mark Salyzyn</name>
<email>salyzyn@google.com</email>
</author>
<published>2015-10-02T16:22:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/replicant/system_core/commit/?id=75e80775d98d1d6e4fd3e6f3a8059a23413e031e'/>
<id>75e80775d98d1d6e4fd3e6f3a8059a23413e031e</id>
<content type='text'>
Discovered that we had a few libc hotspots. Adjust code to generally
reduce or nullify the number of calls to malloc, free, strlen,
strcmp, strncmp, memcmp &amp; strncasecmp. Total gain looks to be about
3% of logd's processing time. malloc still contributes to 3%, but all
others are now total 0.5%.

Bug: 23685592
Change-Id: Ife721121667969260cdb8b055524ae90f5911278
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Discovered that we had a few libc hotspots. Adjust code to generally
reduce or nullify the number of calls to malloc, free, strlen,
strcmp, strncmp, memcmp &amp; strncasecmp. Total gain looks to be about
3% of logd's processing time. malloc still contributes to 3%, but all
others are now total 0.5%.

Bug: 23685592
Change-Id: Ife721121667969260cdb8b055524ae90f5911278
</pre>
</div>
</content>
</entry>
<entry>
<title>logd: klogd deal with nuls in dmesg</title>
<updated>2015-11-01T12:29:12+00:00</updated>
<author>
<name>Mark Salyzyn</name>
<email>salyzyn@google.com</email>
</author>
<published>2015-09-04T18:37:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/replicant/system_core/commit/?id=0d139dd7bb2d85c8a9b7e41f9898c1e44215e3ab'/>
<id>0d139dd7bb2d85c8a9b7e41f9898c1e44215e3ab</id>
<content type='text'>
Switch to using string and length in all transactions, treating
trailing nuls the same as spaces.

ToDo: change dumpstate (bugreport) to use logcat -b printable _regardless_

Bug: 23517551
Change-Id: I42162365e6bf8ed79d356e7b689a673902116fdb
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Switch to using string and length in all transactions, treating
trailing nuls the same as spaces.

ToDo: change dumpstate (bugreport) to use logcat -b printable _regardless_

Bug: 23517551
Change-Id: I42162365e6bf8ed79d356e7b689a673902116fdb
</pre>
</div>
</content>
</entry>
<entry>
<title>logd: serialize accesses to stats helpers</title>
<updated>2015-06-25T15:34:06+00:00</updated>
<author>
<name>Mark Salyzyn</name>
<email>salyzyn@google.com</email>
</author>
<published>2015-06-24T23:22:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/replicant/system_core/commit/?id=5803b79528b40adab466fbd4edf98d5c94802b53'/>
<id>5803b79528b40adab466fbd4edf98d5c94802b53</id>
<content type='text'>
(cherry pick from commit ed777e9eece54bf899f1a77a83f8b702970de686)

Quick low-risk to resolve possible hash table corruption.
Resolved an unlikely path memory leak.

ToDo: replace lock with nested lock so no lock
      helpers are required.

Bug: 22068332
Change-Id: I303ab06608502c7d61d42f111a9c43366f184d0c
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
(cherry pick from commit ed777e9eece54bf899f1a77a83f8b702970de686)

Quick low-risk to resolve possible hash table corruption.
Resolved an unlikely path memory leak.

ToDo: replace lock with nested lock so no lock
      helpers are required.

Bug: 22068332
Change-Id: I303ab06608502c7d61d42f111a9c43366f184d0c
</pre>
</div>
</content>
</entry>
<entry>
<title>logd: Cleanup</title>
<updated>2015-05-13T16:22:56+00:00</updated>
<author>
<name>Mark Salyzyn</name>
<email>salyzyn@google.com</email>
</author>
<published>2015-05-12T22:21:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/replicant/system_core/commit/?id=66091f11f427587bf810d89b0f64be556e1cd168'/>
<id>66091f11f427587bf810d89b0f64be556e1cd168</id>
<content type='text'>
(cherry pick from commit 7718778793b106498b931dd708a466cf3a6f6a0f)

- Android Coding Standard for Constructors
- Side effects NONE

Change-Id: I2cda9dd73f3ac3ab58f394015cb810820093d47b
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
(cherry pick from commit 7718778793b106498b931dd708a466cf3a6f6a0f)

- Android Coding Standard for Constructors
- Side effects NONE

Change-Id: I2cda9dd73f3ac3ab58f394015cb810820093d47b
</pre>
</div>
</content>
</entry>
<entry>
<title>logd: Add klogd</title>
<updated>2015-05-13T16:22:45+00:00</updated>
<author>
<name>Mark Salyzyn</name>
<email>salyzyn@google.com</email>
</author>
<published>2014-10-15T15:49:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/replicant/system_core/commit/?id=a1aacb71f387c91d5fe383b8aaa5b0be2ec9cd3c'/>
<id>a1aacb71f387c91d5fe383b8aaa5b0be2ec9cd3c</id>
<content type='text'>
(cherry pick from commit ae4d928d816e30dbe57c2c321b0f0759d0567b3f)

- Add a klogd to collect the kernel logs and place them into a
  new kernel log buffer
- Parse priority, tag and message from the kernel log messages.
- Turn off pruning for worst UID for the kernel log buffer
- Sniff for 'PM: suspend exit', 'PM: suspend enter' and
  'Suspended for' messages and correct the internal definition
  time correction against monotonic dynamically.
- Discern if we have monotonic or real time (delineation 1980) in
  audit messages.
- perform appropriate math to correct the timestamp to be real time
- filter out any external sources of kernel logging

Change-Id: I8d4c7c5ac19f1f3218079ee3a05a50e2ca55f60d
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
(cherry pick from commit ae4d928d816e30dbe57c2c321b0f0759d0567b3f)

- Add a klogd to collect the kernel logs and place them into a
  new kernel log buffer
- Parse priority, tag and message from the kernel log messages.
- Turn off pruning for worst UID for the kernel log buffer
- Sniff for 'PM: suspend exit', 'PM: suspend enter' and
  'Suspended for' messages and correct the internal definition
  time correction against monotonic dynamically.
- Discern if we have monotonic or real time (delineation 1980) in
  audit messages.
- perform appropriate math to correct the timestamp to be real time
- filter out any external sources of kernel logging

Change-Id: I8d4c7c5ac19f1f3218079ee3a05a50e2ca55f60d
</pre>
</div>
</content>
</entry>
<entry>
<title>logd: propagate ::log status</title>
<updated>2015-04-16T02:43:28+00:00</updated>
<author>
<name>Mark Salyzyn</name>
<email>salyzyn@google.com</email>
</author>
<published>2015-02-09T16:21:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/replicant/system_core/commit/?id=202e153f94a0957185ae4b4bed4c5356513e4322'/>
<id>202e153f94a0957185ae4b4bed4c5356513e4322</id>
<content type='text'>
Add a return value for the ::log() methods, this allows
us to optimize the wakeup for the readers to only occur
when the log message is actually placed.

This is for a future where we may dedupe identical log
messages, filter out log messages, and certainly if we
filter the messages out with an internal logd check of
__android_log_is_loggable().

Change-Id: I763b2a7c29502ab7fa0a5d5022c7b60244fcfde4
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add a return value for the ::log() methods, this allows
us to optimize the wakeup for the readers to only occur
when the log message is actually placed.

This is for a future where we may dedupe identical log
messages, filter out log messages, and certainly if we
filter the messages out with an internal logd check of
__android_log_is_loggable().

Change-Id: I763b2a7c29502ab7fa0a5d5022c7b60244fcfde4
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge "logd: syscall optimization"</title>
<updated>2015-04-15T14:45:24+00:00</updated>
<author>
<name>Mark Salyzyn</name>
<email>salyzyn@google.com</email>
</author>
<published>2015-04-15T14:45:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/replicant/system_core/commit/?id=56c6575da72653c3ffd79baf1b431574d6f7e1ea'/>
<id>56c6575da72653c3ffd79baf1b431574d6f7e1ea</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>logd: Don't embed a flexible array member within another struct</title>
<updated>2015-04-07T17:12:20+00:00</updated>
<author>
<name>Nick Kralevich</name>
<email>nnk@google.com</email>
</author>
<published>2015-04-07T08:25:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/replicant/system_core/commit/?id=58ba58a97c8ec56b2c2a32d6cda19a3a57e3cccf'/>
<id>58ba58a97c8ec56b2c2a32d6cda19a3a57e3cccf</id>
<content type='text'>
C (but not C++) has a concept of a flexible array member, which
is documented at https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html .
Using a flexible array member indicates that the structure is
really a header for a variable length object.

In logd's case, the variable length structure android_event_string_t
was embedded within another structure called
android_log_event_string_t. This makes gcc's __builtin_object_size()
function really confused. When compiling with C++,
__builtin_object_size(android_log_event_string_t.payload.data, 1)
would return 0, whereas if you compiled the code with C, the same
call would (properly) return -1.

Code which does automatic bounds checking, such as the proposed
patch at https://android-review.googlesource.com/145411 , will
cause problems for logd if this syntax is used.

Don't try to embed a variable length structure within another
structure. This doesn't appear to be valid C nor C++, and
while it's worked, it seems problematic.

Instead, inline the structure so it's one big happy structure.

Change-Id: I8ac02b7142a4f6560f5f80df2effcf720f9896fc
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
C (but not C++) has a concept of a flexible array member, which
is documented at https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html .
Using a flexible array member indicates that the structure is
really a header for a variable length object.

In logd's case, the variable length structure android_event_string_t
was embedded within another structure called
android_log_event_string_t. This makes gcc's __builtin_object_size()
function really confused. When compiling with C++,
__builtin_object_size(android_log_event_string_t.payload.data, 1)
would return 0, whereas if you compiled the code with C, the same
call would (properly) return -1.

Code which does automatic bounds checking, such as the proposed
patch at https://android-review.googlesource.com/145411 , will
cause problems for logd if this syntax is used.

Don't try to embed a variable length structure within another
structure. This doesn't appear to be valid C nor C++, and
while it's worked, it seems problematic.

Instead, inline the structure so it's one big happy structure.

Change-Id: I8ac02b7142a4f6560f5f80df2effcf720f9896fc
</pre>
</div>
</content>
</entry>
<entry>
<title>logd: syscall optimization</title>
<updated>2015-04-01T19:41:59+00:00</updated>
<author>
<name>Mark Salyzyn</name>
<email>salyzyn@google.com</email>
</author>
<published>2015-03-17T14:56:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/replicant/system_core/commit/?id=e3aeeeeccc260c29ca5907a444f8d746bcc2f8a5'/>
<id>e3aeeeeccc260c29ca5907a444f8d746bcc2f8a5</id>
<content type='text'>
- prset(PR_SET_NAME) call once
- No need to call getuid(), should be AID_LOGD

Change-Id: I4dde0b178bc84e711b355cd7677b0dbf905a0634
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
- prset(PR_SET_NAME) call once
- No need to call getuid(), should be AID_LOGD

Change-Id: I4dde0b178bc84e711b355cd7677b0dbf905a0634
</pre>
</div>
</content>
</entry>
<entry>
<title>logd: report reinit</title>
<updated>2015-03-12T20:38:53+00:00</updated>
<author>
<name>Mark Salyzyn</name>
<email>salyzyn@google.com</email>
</author>
<published>2015-03-12T19:25:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/replicant/system_core/commit/?id=ccbadc6be015553357a4c50de48dea46cb1adcba'/>
<id>ccbadc6be015553357a4c50de48dea46cb1adcba</id>
<content type='text'>
Bug: 19681572
Change-Id: I343b9d108f064f87df79512a0fdf1b35513c3136
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Bug: 19681572
Change-Id: I343b9d108f064f87df79512a0fdf1b35513c3136
</pre>
</div>
</content>
</entry>
</feed>
