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

FW/logging: refactor log_{platform_,}message #154

Commits on Feb 22, 2023

  1. FW/logging: remove unnecessary fflush()

    Our logging FILE* are opened in unbuffered mode.
    
    Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
    thiagomacieira committed Feb 22, 2023
    Configuration menu
    Copy the full SHA
    72753b4 View commit details
    Browse the repository at this point in the history
  2. FW/logging: use atomics for the message count and data size

    log_data() is probably only used by tests, so there's no race problem
    there. But log_message() may be used on the main thread's messaging,
    which could cause a race condition.
    
    Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
    thiagomacieira committed Feb 22, 2023
    Configuration menu
    Copy the full SHA
    6bbdce1 View commit details
    Browse the repository at this point in the history
  3. FW/logging: refactor log_{platform_,}message

    This merges the two functions for the most part and makes them use a
    single writev() call to write the content.
    
    This was originally done to fix opendcdiag#153, but that fails because the Linux
    kernel does not guarantee atomicity of write() calls and I wouldn't care
    to make a guess what other OSes do. If we want to have
    log_platform_message() be thread-safe, we'll need to insert a mutex.
    
    Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
    thiagomacieira committed Feb 22, 2023
    Configuration menu
    Copy the full SHA
    f3e920f View commit details
    Browse the repository at this point in the history