Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[logging] Introduced log modules and categories selection #130

Open
wants to merge 21 commits into
base: master
Choose a base branch
from

Conversation

kkasperczyk-no
Copy link
Owner

@kkasperczyk-no kkasperczyk-no commented Dec 19, 2022

Currently it is possible to disable some part of logs based on their level, but not on their origin module (region). After
introducing specific log modules selection it would be convenient to make controlling those modules log categories
possible as well.

Summary of changes:

  • Added definitions for every existing log module that are by default set to 1, but can be ovewritten to 0.
  • Introduced IsModuleCategoryEnabled macro that returns category state (0/1) for specific log module.
  • To avoid creating dozens of new definitions for every module-category combination, IsModuleCategoryEnabled macro
    by default returns corresponding global category value (CHIP_DETAIL/PROGRESS/ERROR/AUTOMATION_LOGGING). If any
    category value was defined for specific module, it is used instead of global one.
  • To make macro magic work properly, it was necessary to change all kLogCategory_* constants case to upper.
  • Added filtering based on the mentioned definitions, so ChipInternalLog and ChipInternalLogByteSpan has definitions
    provided only if corresponding origin module is enabled and the specific category for this module is enabled.
  • Disabled some modules for nrfconnect platform that saved ~10,5k of flash.

bzbarsky-apple and others added 7 commits December 19, 2022 14:17
…hip#24137)

This will let us avoid generating incorrect backwards-compat shims for
things that get added after our big API update but have a name that
includes acronyms.
Adds ability to remove APIs in Darwin codegen.
* Remove the MfgSpecificPing command from Darwin API.

Except for the backwards-compat shims, of course.

The template refactorings are to reduce repetition and to enable
handling for removal and renaming of commands.

* Fix darwin-framework-tool compile.
Pulls in Darwin old name information.
…ject-chip#24163)

project-chip#23409 changed the key under
which we store group fabric info, which breaks reception of group messages if a
node updates from before that change to after that change.

We should just keep using the same key name, especially because sharing a single
storage key for all possible fabric lists (groups and whatever else will want to
store lists of fabric indices) does not necessarily make sense.

Fixes project-chip#24161
Copy link
Collaborator

@Damian-Nordic Damian-Nordic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, but note that there are tons of code like:

#if CHIP_DETAIL_LOGGING
...

which will not take advantage of the possibility to override enabled category for a given module. It's fine with me for now, but just saying.

examples/common/pigweed/RpcService.cpp Outdated Show resolved Hide resolved
@@ -63,6 +63,169 @@ enum LogModule
kLogModule_Max
};

/* Log modules enablers. Those definitions can be overwritten with 0 to disable
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these still needed? IsModuleCategoryEnabled allows one to effectively disable any module, right?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but you would need to do that by defining all possible log categories for this module 0. Actually I just realized that in the same way we can disable global log categories and nobody uses _CHIP_USE_LOGGING, which is quite weird for me.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, but it would simplify the configuration architecture. At least I think these macros should be taken into account in IsModuleCategoryEnabled so that one can easily cut off the code for log generation.

@kkasperczyk-no
Copy link
Owner Author

Looking good, but note that there are tons of code like

Ehh that will affect only case if CHIP_DETAIL_LOGGING is 0, but we want to set category to Progress for some module. But still it's sad, I don't have good idea how to tackle that without modifying dozen of files.

chirag-silabs and others added 13 commits December 22, 2022 09:11
* BLE bringup on the CCP board

* Restyle the PR
* Align naming in Identify cluster XML with the spec.

* Update ZAP files to the new naming.

* Regenerate generated files.
It's 4-5x faster for me this way.

Also sets ZAP_SKIP_REAL_VERSION so that once
project-chip/zap#876 merges we stop messing with the ZAP
repo just to run it.
* [Telink] Update Telink Docker image (Zephyr update)

* [Telink] update ZEPHYR_REVISION
* Make it work on Darwin.
* Pay attention to the wifi/thread command-line flags.
* Ensure we always have a sane network commissioning cluster set up
  (falling back to the Ethernet one if nothing else is enabled).

Fixes project-chip#23987
…p#24166)

Don't rely on d2i_X509 object reuse and fix double-free

The chip-cert tool is relying on OpenSSL's "object reuse" mode in
d2i_X509. d2i_X509 has a very bizarre type signature:

X509 *d2i_X509(X509 **out, const unsigned char **inp, long len);

The safest way to call this function is to pass NULL into out. The
function then straightforwardly hands you a new X509 on success, or
NULL on error. However, if out and *out are both NULL, OpenSSL tries
to reuse the existing X509 object.

This does not work, particular not in the way that chip-cert uses it.
When d2i_X509 fails, even in this mode, it will free what's at *out
and set *out to NULL. So when ReadCert's d2i_X509 call fails, it will
silently free the cert parameter. But the caller doesn't know this
and will double-free it!
Put Kconfig definitions shared between nRF Connect and
Telink platforms in the common Zephyr's Kconfig.
Group and reorder the config variables for easier search.

Signed-off-by: Damian Krolik <damian.krolik@nordicsemi.no>

Signed-off-by: Damian Krolik <damian.krolik@nordicsemi.no>
…ackgrounding the app on iOS (project-chip#24046)

* tv-casting-app: Making getDiscoveredCommissioner API synchronous

* iOS MatterTvCastingBridge: Generate spake2pSalt (and verifier) if required in CommissionableDataProviderImpl

* tv-casting-app/darwin: Stopping/restarting Matter server when app becomes inactive/active. Also, disabling BLE

* Addressing cliffamzn@'s feedback
Currently it is possible to disable some part of logs based on
their level, but not on their origin module (region). After
introducing specific log modules selection it would be
convenient to make controlling those modules log categories
possible as well.

Summary of changes:
* Added definitions for every existing log module that are by
default set to 1, but can be ovewritten to 0.
* Introduced IsModuleCategoryEnabled macro that returns
category state (0/1) for specific log module.
* To avoid creating dozens of new definitions for every
module-category combination, IsModuleCategoryEnabled macro
by default returns corresponding global category value
(CHIP_DETAIL/PROGRESS/ERROR/AUTOMATION_LOGGING). If any
category value was defined for specific module, it is used
instead of global one.
* Added filtering based on the mentioned definitions, so
ChipInternalLog and ChipInternalLogByteSpan has definitions
provided only if corresponding origin module is enabled and the
specific category for this module is enabled.

nRFConnect:
* Disabled some modules for nrfconnect platform that saved ~11,8k
of flash.
* Switched from using kconfig value to filer out logs levels
to relying on Matter logging layer filtering in Zephyr logging
implementation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.