Skip to content

Commit

Permalink
Merge pull request #912 from BenFordTytherington/add-design-warnings-…
Browse files Browse the repository at this point in the history
…to-book

Add warnings to design pages in book
  • Loading branch information
Urhengulas authored Dec 19, 2024
2 parents a34dbcb + 0eb3993 commit 40ed0f6
Show file tree
Hide file tree
Showing 23 changed files with 45 additions and 0 deletions.
2 changes: 2 additions & 0 deletions book/src/acq-rel.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Acquire-release

> ⚠️ The design and implementation chapter is outdated ⚠️
One solution to the re-entrancy issue that's deadlock-free is to make the log macros *take* the logger and hold it until it's done with it.
In case of nesting any inner take attempt will silently fail.

Expand Down
2 changes: 2 additions & 0 deletions book/src/deserialization.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Deserialization

> ⚠️ The design and implementation chapter is outdated ⚠️
The host has received the log data (binary data).
How to make sense of it?

Expand Down
2 changes: 2 additions & 0 deletions book/src/design-format.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Single Format trait

> ⚠️ The design and implementation chapter is outdated ⚠️
`core::fmt` has several formatting traits, like `Hex` and `Bin`.
These appear as different formatting parameters, like `:x` and `:b`, in format strings and change how integers are formatted: `15` vs `0xF` vs `0b1111`.

Expand Down
2 changes: 2 additions & 0 deletions book/src/design-global-logger.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Global logger

> ⚠️ The design and implementation chapter is outdated ⚠️
The global logger needs to operate correctly (be memory safe and not interleave log data) in presence of race conditions and re-entrant invocations.
Race conditions can be avoided with mutexes but re-entrancy can occur even if mutexes are used and shouldn't result in deadlocks.
2 changes: 2 additions & 0 deletions book/src/design-timestamp.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Timestamp

> ⚠️ The design and implementation chapter is outdated ⚠️
`defmt::timestamp!` needs to be as efficient as possible, because it is implicitly invoked on every single log invocation.

The timestamp format string index is not transmitted over the wire.
Expand Down
2 changes: 2 additions & 0 deletions book/src/duplicates.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Dealing with duplicates

> ⚠️ The design and implementation chapter is outdated ⚠️
The linker hates it when it finds two symbol that have the same name.
For example, this is an error:

Expand Down
2 changes: 2 additions & 0 deletions book/src/eval-order.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Evaluation order

> ⚠️ The design and implementation chapter is outdated ⚠️
Consider this log invocation:

``` rust
Expand Down
2 changes: 2 additions & 0 deletions book/src/interning.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Interning

> ⚠️ The design and implementation chapter is outdated ⚠️
All string literals are interned in a custom ELF section.
This has proven to be the way that requires the less post-processing and implementation work.
It is not without downsides as we'll see.
Expand Down
2 changes: 2 additions & 0 deletions book/src/linker-sections.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Logging levels

> ⚠️ The design and implementation chapter is outdated ⚠️
`defmt` supports several logging levels.
To avoid serializing the logging level at runtime (that would reduce throughput), interned strings are clustered by logging level.

Expand Down
2 changes: 2 additions & 0 deletions book/src/log-frame.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Log frames

> ⚠️ The design and implementation chapter is outdated ⚠️
Each log statement produces one log frame.
Consider this log call:
(let's include the timestamp this time)
Expand Down
2 changes: 2 additions & 0 deletions book/src/lookup.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Lookup

> ⚠️ The design and implementation chapter is outdated ⚠️
We have so far looked at the string table using `nm`.
Programmatically the table can be found in the `.symtab` section.
Each [entry] in this table represents a symbol and each entry has:
Expand Down
2 changes: 2 additions & 0 deletions book/src/preemption.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Preemption

> ⚠️ The design and implementation chapter is outdated ⚠️
Preemption can also result in re-entrancy.
How to deal with it?
Assuming single-core systems there are two approaches:
Expand Down
2 changes: 2 additions & 0 deletions book/src/re-entrancy.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Re-entrancy

> ⚠️ The design and implementation chapter is outdated ⚠️
Where can re-entrancy occur?
Turns out that with global singletons it can occur about anywhere; you don't need interrupts (preemption) to cause re-entrancy.
See below:
Expand Down
2 changes: 2 additions & 0 deletions book/src/ser-array.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Arrays

> ⚠️ The design and implementation chapter is outdated ⚠️
For arrays (`{=[u8; N]}`) the length is not serialized.

``` rust
Expand Down
2 changes: 2 additions & 0 deletions book/src/ser-bitfield.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Bitfield

> ⚠️ The design and implementation chapter is outdated ⚠️
The integer argument is serialized in little endian format (`to_le_bytes`).

``` rust
Expand Down
1 change: 1 addition & 0 deletions book/src/ser-bool.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Bool

> ⚠️ The design and implementation chapter is outdated ⚠️
Booleans are compressed in bytes, bitflags-style.

Expand Down
2 changes: 2 additions & 0 deletions book/src/ser-format-slice.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Format Slices

> ⚠️ The design and implementation chapter is outdated ⚠️
`{=[?]}` will serialize the length (LEB128 compressed) first, then the first element will be serialized in (recursively) *tagged* format. The rest of elements will be serialized *untagged*.

"Tagged" means that the data will be preceded by the string indices that indicate how to format the data.
Expand Down
2 changes: 2 additions & 0 deletions book/src/ser-format.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Format

> ⚠️ The design and implementation chapter is outdated ⚠️
The untyped argument (`=?`) requires one level of indirection during serialization.

First let's see how a primitive implements the `Format` trait:
Expand Down
2 changes: 2 additions & 0 deletions book/src/ser-integers.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Integers

> ⚠️ The design and implementation chapter is outdated ⚠️
Integers will be serialized in little endian order using `to_le_bytes()`.
`usize` and `isize` values will be subject to LEB128 compression.

Expand Down
2 changes: 2 additions & 0 deletions book/src/ser-istr.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Interned strings

> ⚠️ The design and implementation chapter is outdated ⚠️
Let's ignore timestamps for now and also ignore how access to the global logger is synchronized.
This is the simplest case: logging a string literal with no formatting.

Expand Down
2 changes: 2 additions & 0 deletions book/src/ser-slices.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Slices

> ⚠️ The design and implementation chapter is outdated ⚠️
For slices (`{=[u8]}`) the length is LEB128 encoded and serialized first and then followed by the slice data.

``` rust
Expand Down
2 changes: 2 additions & 0 deletions book/src/ser-str.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Strings

> ⚠️ The design and implementation chapter is outdated ⚠️
Strings that are passed directly (i.e. not as indices of interned strings) as format string parameters (`{:str}`) must be prefixed with their LEB128 encoded length.
This behavior is analogous to that of Slices.

Expand Down
2 changes: 2 additions & 0 deletions book/src/serialization.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Serialization

> ⚠️ The design and implementation chapter is outdated ⚠️
In this section we'll see how log data is "put on the wire".

0 comments on commit 40ed0f6

Please sign in to comment.