From 050273682e78409dd76bdfea2a24e17f63f94977 Mon Sep 17 00:00:00 2001 From: Prashanth Swaminathan <40780424+prashanthswami@users.noreply.github.com> Date: Mon, 8 Jan 2024 13:05:58 -0800 Subject: [PATCH 1/2] Adjust log levels of /proc/cpuinfo parsing (#209) There are a few steps in our parsing logic where we skip lines that don't match the expectations of the /proc/cpuinfo node. Reduce the log level of these lines to 'debug', as these are not generally errors and are noisy on systems that have unique cpuinfo key-value pairs. When parsing logic encounters a higher-than-expected processor number, increase the level to warning, to indicate that an error may have occurred in the parsing step. This does not fully address #19 but resolves the underlying noise reported. --- src/arm/linux/cpuinfo.c | 8 ++++---- src/x86/linux/cpuinfo.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/arm/linux/cpuinfo.c b/src/arm/linux/cpuinfo.c index 3f477e77..2afd6cba 100644 --- a/src/arm/linux/cpuinfo.c +++ b/src/arm/linux/cpuinfo.c @@ -742,7 +742,7 @@ static bool parse_line( } /* Skip line if no ':' separator was found. */ if (separator == line_end) { - cpuinfo_log_info( + cpuinfo_log_debug( "Line %.*s in /proc/cpuinfo is ignored: key/value separator ':' not found", (int)(line_end - line_start), line_start); @@ -758,7 +758,7 @@ static bool parse_line( } /* Skip line if key contains nothing but spaces. */ if (key_end == line_start) { - cpuinfo_log_info( + cpuinfo_log_debug( "Line %.*s in /proc/cpuinfo is ignored: key contains only spaces", (int)(line_end - line_start), line_start); @@ -774,7 +774,7 @@ static bool parse_line( } /* Value part contains nothing but spaces. Skip line. */ if (value_start == line_end) { - cpuinfo_log_info( + cpuinfo_log_debug( "Line %.*s in /proc/cpuinfo is ignored: value contains only spaces", (int)(line_end - line_start), line_start); @@ -918,7 +918,7 @@ static bool parse_line( } else if (new_processor_index > processor_index + 1) { /* Strange, but common: skipped * processor $(processor_index + 1) */ - cpuinfo_log_info( + cpuinfo_log_warning( "unexpectedly high processor number %" PRIu32 " following processor %" PRIu32 " in /proc/cpuinfo", new_processor_index, diff --git a/src/x86/linux/cpuinfo.c b/src/x86/linux/cpuinfo.c index ff90884e..7df72aba 100644 --- a/src/x86/linux/cpuinfo.c +++ b/src/x86/linux/cpuinfo.c @@ -99,7 +99,7 @@ static bool parse_line( } /* Skip line if no ':' separator was found. */ if (separator == line_end) { - cpuinfo_log_info( + cpuinfo_log_debug( "Line %.*s in /proc/cpuinfo is ignored: key/value separator ':' not found", (int)(line_end - line_start), line_start); @@ -115,7 +115,7 @@ static bool parse_line( } /* Skip line if key contains nothing but spaces. */ if (key_end == line_start) { - cpuinfo_log_info( + cpuinfo_log_debug( "Line %.*s in /proc/cpuinfo is ignored: key contains only spaces", (int)(line_end - line_start), line_start); @@ -131,7 +131,7 @@ static bool parse_line( } /* Value part contains nothing but spaces. Skip line. */ if (value_start == line_end) { - cpuinfo_log_info( + cpuinfo_log_debug( "Line %.*s in /proc/cpuinfo is ignored: value contains only spaces", (int)(line_end - line_start), line_start); @@ -177,7 +177,7 @@ static bool parse_line( } else if (new_processor_index > processor_index + 1) { /* Strange, but common: skipped * processor $(processor_index + 1) */ - cpuinfo_log_info( + cpuinfo_log_warning( "unexpectedly high processor number %" PRIu32 " following processor %" PRIu32 " in /proc/cpuinfo", new_processor_index, From 76cc10d627add77922dc24521b332a055a4d6d77 Mon Sep 17 00:00:00 2001 From: Prashanth Swaminathan <40780424+prashanthswami@users.noreply.github.com> Date: Mon, 8 Jan 2024 16:59:57 -0800 Subject: [PATCH 2/2] Run Bazel build in Github Actions (#213) As some clients rely on the Bazel build, add a workflow to verify at least one Bazel target (linux-x86). Also, perform some minor cleanup to comments and target branches in our workflow files. --- .bazelversion | 1 - .github/workflows/build.yml | 1 - .github/workflows/build_bazel.yml | 21 +++++++++++++++++++++ scripts/local-bazel-build.sh | 18 ++++++++++++++++++ scripts/local-build.sh | 4 +++- 5 files changed, 42 insertions(+), 3 deletions(-) delete mode 100644 .bazelversion create mode 100644 .github/workflows/build_bazel.yml create mode 100755 scripts/local-bazel-build.sh diff --git a/.bazelversion b/.bazelversion deleted file mode 100644 index 0062ac97..00000000 --- a/.bazelversion +++ /dev/null @@ -1 +0,0 @@ -5.0.0 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 06bce128..1407dc22 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,7 +3,6 @@ on: pull_request: push: branches: - - master - main permissions: diff --git a/.github/workflows/build_bazel.yml b/.github/workflows/build_bazel.yml new file mode 100644 index 00000000..84594726 --- /dev/null +++ b/.github/workflows/build_bazel.yml @@ -0,0 +1,21 @@ +name: Build using Bazel +on: + pull_request: + push: + branches: + - main + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} + cancel-in-progress: true +jobs: + bazel-linux-local: + runs-on: ubuntu-latest + timeout-minutes: 40 + steps: + - uses: actions/checkout@v2 + - name: Build + run: scripts/local-bazel-build.sh diff --git a/scripts/local-bazel-build.sh b/scripts/local-bazel-build.sh new file mode 100755 index 00000000..c2aeb322 --- /dev/null +++ b/scripts/local-bazel-build.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +# Copyright 2024 Google LLC + +set -e + +BAZEL_ARGS=() + +# Bazel-level configuration +# +# If editing these flags, make sure `local-build.sh` flags are updated. +BAZEL_ARGS+=("-c=\"opt\"") +BAZEL_ARGS+=("-copt=\"fpic\"") + +# User-specified Bazel arguments go last to allow overridding defaults +BAZEL_ARGS+=($@) + +# Build all targets +bazel build :all diff --git a/scripts/local-build.sh b/scripts/local-build.sh index 426a13bb..2be99e7b 100755 --- a/scripts/local-build.sh +++ b/scripts/local-build.sh @@ -13,6 +13,8 @@ mkdir -p build/local CMAKE_ARGS=() # CMake-level configuration +# +# If editing these flags, make sure `local-build-bazel.sh` flags are updated. CMAKE_ARGS+=("-DCMAKE_BUILD_TYPE=Release") CMAKE_ARGS+=("-DCMAKE_POSITION_INDEPENDENT_CODE=ON") @@ -22,7 +24,7 @@ then CMAKE_ARGS+=("-GNinja") fi -# Use-specified CMake arguments go last to allow overridding defaults +# User-specified CMake arguments go last to allow overridding defaults CMAKE_ARGS+=($@) cd build/local && cmake ../.. \