Dwarves debugging tools
 help / color / mirror / Atom feed
* [PATCH v3 dwarves 0/2] Add function list comparison to github CI
@ 2025-07-10 16:16 Alan Maguire
  2025-07-10 16:16 ` [PATCH v3 dwarves 1/2] github CI: Do not build pahole as part of dwarves-ci setup Alan Maguire
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Alan Maguire @ 2025-07-10 16:16 UTC (permalink / raw)
  To: dwarves; +Cc: ihor.solodrai, Alan Maguire

As changes to pahole can generate different sets of functions for
vmlinux BTF, automate comparison between next branch and the series
CI is testing.  Build baseline (default 'next' branch) as part of
build-pahole.sh and build kernel with both test and baseline pahole,
using pfunct to generate function lists for comparison.
Example job here [1].

Patch 1 ensures that the baseline pahole is not built as part of
setup; patch 2 adds the baseline build and compare-functions job to
the dwarves-ci pipeline.

Changes since v2:

- altered patch 1 to not build pahole (pahole: 'none') during setup
  (Ihor, patch 1)
- do baseline build when building pahole via script, add compare
  functions to summary (Ihor, patch 2)

Changes since v1:

- fix rebuild to actually rebuild with baseline pahole (patch 2)

[1] https://github.com/alan-maguire/dwarves/actions/runs/16192185959

Alan Maguire (2):
  github CI: Do not build pahole as part of dwarves-ci setup
  github CI: Add comparison of generated BTF functions between baseline,
    change

 .github/scripts/build-pahole.sh      | 23 +++++++++++++++++++++
 .github/scripts/compare-functions.sh | 30 ++++++++++++++++++++++++++++
 .github/workflows/test.yml           |  4 ++--
 .github/workflows/vmtest.yml         |  4 ++++
 4 files changed, 59 insertions(+), 2 deletions(-)
 create mode 100755 .github/scripts/compare-functions.sh

-- 
2.43.5


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v3 dwarves 1/2] github CI: Do not build pahole as part of dwarves-ci setup
  2025-07-10 16:16 [PATCH v3 dwarves 0/2] Add function list comparison to github CI Alan Maguire
@ 2025-07-10 16:16 ` Alan Maguire
  2025-07-10 16:16 ` [PATCH v3 dwarves 2/2] github CI: Add comparison of generated BTF functions between baseline, change Alan Maguire
  2025-07-15 15:41 ` [PATCH v3 dwarves 0/2] Add function list comparison to github CI Ihor Solodrai
  2 siblings, 0 replies; 5+ messages in thread
From: Alan Maguire @ 2025-07-10 16:16 UTC (permalink / raw)
  To: dwarves; +Cc: ihor.solodrai, Alan Maguire

We build it during testing, no need to do it during setup.

Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
---
 .github/workflows/test.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index f11ebfe..ac28e92 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -20,12 +20,12 @@ jobs:
             runs_on: 'ubuntu-24.04'
             arch: 'x86_64'
             llvm-version: '18'
-            pahole: 'master'
+            pahole: 'none'
           - kernel: 'LATEST'
             runs_on: 'ubuntu-24.04-arm'
             arch: 'aarch64'
             llvm-version: '18'
-            pahole: 'tmp.master'
+            pahole: 'none'
     name: Linux ${{ matrix.kernel }}
     uses: ./.github/workflows/vmtest.yml
     with:
-- 
2.43.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v3 dwarves 2/2] github CI: Add comparison of generated BTF functions between baseline, change
  2025-07-10 16:16 [PATCH v3 dwarves 0/2] Add function list comparison to github CI Alan Maguire
  2025-07-10 16:16 ` [PATCH v3 dwarves 1/2] github CI: Do not build pahole as part of dwarves-ci setup Alan Maguire
@ 2025-07-10 16:16 ` Alan Maguire
  2025-07-15 15:41 ` [PATCH v3 dwarves 0/2] Add function list comparison to github CI Ihor Solodrai
  2 siblings, 0 replies; 5+ messages in thread
From: Alan Maguire @ 2025-07-10 16:16 UTC (permalink / raw)
  To: dwarves; +Cc: ihor.solodrai, Alan Maguire

Sometimes changes can be introduced that modify the set of functions
encoded in BTF, or change aspects of that encoding.  Add a non-fatal
comparison job to compare between the change and the base branch,
by default the "next" branch.  Update the build-pahole.sh script to build
baseline.

Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
---
 .github/scripts/build-pahole.sh      | 23 +++++++++++++++++++++
 .github/scripts/compare-functions.sh | 30 ++++++++++++++++++++++++++++
 .github/workflows/vmtest.yml         |  4 ++++
 3 files changed, 57 insertions(+)
 create mode 100755 .github/scripts/compare-functions.sh

diff --git a/.github/scripts/build-pahole.sh b/.github/scripts/build-pahole.sh
index 64f9eea..7a37771 100755
--- a/.github/scripts/build-pahole.sh
+++ b/.github/scripts/build-pahole.sh
@@ -4,8 +4,16 @@
 # Copyright (c) 2025, Oracle and/or its affiliates.
 #
 
+function restore() {
+	git checkout $SHA
+	git submodule update
+}
+
 GITHUB_WORKSPACE=${GITHUB_WORKSPACE:-$(dirname $0)/../..}
+BASELINE=${BASELINE:-next}
+
 cd $GITHUB_WORKSPACE
+git log --oneline -1
 git config --global --add safe.directory $GITHUB_WORKSPACE
 git submodule update --init
 mkdir -p build
@@ -15,3 +23,18 @@ cmake -DGIT_SUBMODULE=OFF -DBUILD_SHARED_LIBS=OFF ..
 make -j$((4*$(nproc))) all
 make DESTDIR=../install install
 
+# save sha to restore after building baseline
+cd $GITHUB_WORKSPACE
+export SHA=$(git log --format="%h" -1)
+trap restore EXIT
+
+git fetch origin ${BASELINE}:${BASELINE}
+git checkout ${BASELINE}
+git log --oneline -1
+git submodule update
+mkdir -p build.$BASELINE
+cd build.$BASELINE
+pwd
+cmake -DGIT_SUBMODULE=OFF -DBUILD_SHARED_LIBS=OFF ..
+make -j$((4*$(nproc))) all
+make DESTDIR=../install.$BASELINE install
diff --git a/.github/scripts/compare-functions.sh b/.github/scripts/compare-functions.sh
new file mode 100755
index 0000000..cbe6596
--- /dev/null
+++ b/.github/scripts/compare-functions.sh
@@ -0,0 +1,30 @@
+#!/usr/bin/bash
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Copyright (c) 2025, Oracle and/or its affiliates.
+#
+
+GITHUB_WORKSPACE=${GITHUB_WORKSPACE:-$(pwd)}
+REPO_TARGET=${GITHUB_WORKSPACE}/.kernel
+VMLINUX=${GITHUB_WORKSPACE}/.kernel/vmlinux
+BASELINE=${BASELINE:-next}
+GITHUB_STEP_SUMMARY=${GITHUB_STEP_SUMMARY:-/dev/null}
+
+export PATH=${GITHUB_WORKSPACE}/install/usr/local/bin:${PATH}
+which pahole
+pahole --version
+cd $REPO_TARGET
+pfunct --all --format_path=btf $VMLINUX > functions
+
+rm -f vmlinux vmlinux.o
+
+# now use baseline branch of pahole for comparison
+export PATH=${GITHUB_WORKSPACE}/install.${BASELINE}/usr/local/bin:${PATH}
+export PAHOLE=${GITHUB_WORKSPACE}/install.${BASELINE}/usr/local/bin/pahole
+which pahole
+pahole --version
+make oldconfig
+make -j $((4*$(nproc))) all
+pfunct --all --format_path=btf $VMLINUX > functions.${BASELINE}
+echo "### Compare vmlinux BTF functions generated with this change vs baseline (none means no differences)." | tee -a $GITHUB_STEP_SUMMARY
+diff functions.${BASELINE} functions | tee -a $GITHUB_STEP_SUMMARY
diff --git a/.github/workflows/vmtest.yml b/.github/workflows/vmtest.yml
index 0f66eed..54bb92e 100644
--- a/.github/workflows/vmtest.yml
+++ b/.github/workflows/vmtest.yml
@@ -60,3 +60,7 @@ jobs:
         shell: bash
         run: .github/scripts/run-selftests.sh
 
+      - name: Compare functions generated
+        shell: bash
+        run: .github/scripts/compare-functions.sh
+
-- 
2.43.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v3 dwarves 0/2] Add function list comparison to github CI
  2025-07-10 16:16 [PATCH v3 dwarves 0/2] Add function list comparison to github CI Alan Maguire
  2025-07-10 16:16 ` [PATCH v3 dwarves 1/2] github CI: Do not build pahole as part of dwarves-ci setup Alan Maguire
  2025-07-10 16:16 ` [PATCH v3 dwarves 2/2] github CI: Add comparison of generated BTF functions between baseline, change Alan Maguire
@ 2025-07-15 15:41 ` Ihor Solodrai
  2025-07-21 11:35   ` Alan Maguire
  2 siblings, 1 reply; 5+ messages in thread
From: Ihor Solodrai @ 2025-07-15 15:41 UTC (permalink / raw)
  To: Alan Maguire, dwarves

On 7/10/25 9:16 AM, Alan Maguire wrote:
> As changes to pahole can generate different sets of functions for
> vmlinux BTF, automate comparison between next branch and the series
> CI is testing.  Build baseline (default 'next' branch) as part of
> build-pahole.sh and build kernel with both test and baseline pahole,
> using pfunct to generate function lists for comparison.
> Example job here [1].
> 
> Patch 1 ensures that the baseline pahole is not built as part of
> setup; patch 2 adds the baseline build and compare-functions job to
> the dwarves-ci pipeline.
> 
> Changes since v2:
> 
> - altered patch 1 to not build pahole (pahole: 'none') during setup
>    (Ihor, patch 1)
> - do baseline build when building pahole via script, add compare
>    functions to summary (Ihor, patch 2)

Acked-by: Ihor Solodrai <ihor.solodrai@linux.dev>

Thanks!

> 
> Changes since v1:
> 
> - fix rebuild to actually rebuild with baseline pahole (patch 2)
> 
> [1] https://github.com/alan-maguire/dwarves/actions/runs/16192185959
> 
> Alan Maguire (2):
>    github CI: Do not build pahole as part of dwarves-ci setup
>    github CI: Add comparison of generated BTF functions between baseline,
>      change
> 
>   .github/scripts/build-pahole.sh      | 23 +++++++++++++++++++++
>   .github/scripts/compare-functions.sh | 30 ++++++++++++++++++++++++++++
>   .github/workflows/test.yml           |  4 ++--
>   .github/workflows/vmtest.yml         |  4 ++++
>   4 files changed, 59 insertions(+), 2 deletions(-)
>   create mode 100755 .github/scripts/compare-functions.sh
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v3 dwarves 0/2] Add function list comparison to github CI
  2025-07-15 15:41 ` [PATCH v3 dwarves 0/2] Add function list comparison to github CI Ihor Solodrai
@ 2025-07-21 11:35   ` Alan Maguire
  0 siblings, 0 replies; 5+ messages in thread
From: Alan Maguire @ 2025-07-21 11:35 UTC (permalink / raw)
  To: Ihor Solodrai, dwarves

On 15/07/2025 16:41, Ihor Solodrai wrote:
> On 7/10/25 9:16 AM, Alan Maguire wrote:
>> As changes to pahole can generate different sets of functions for
>> vmlinux BTF, automate comparison between next branch and the series
>> CI is testing.  Build baseline (default 'next' branch) as part of
>> build-pahole.sh and build kernel with both test and baseline pahole,
>> using pfunct to generate function lists for comparison.
>> Example job here [1].
>>
>> Patch 1 ensures that the baseline pahole is not built as part of
>> setup; patch 2 adds the baseline build and compare-functions job to
>> the dwarves-ci pipeline.
>>
>> Changes since v2:
>>
>> - altered patch 1 to not build pahole (pahole: 'none') during setup
>>    (Ihor, patch 1)
>> - do baseline build when building pahole via script, add compare
>>    functions to summary (Ihor, patch 2)
> 
> Acked-by: Ihor Solodrai <ihor.solodrai@linux.dev>
> 
> Thanks!
>

Applied the series to the "next" branch of

https://git.kernel.org/pub/scm/devel/pahole/pahole.git/

Thank you!

Alan

>>
>> Changes since v1:
>>
>> - fix rebuild to actually rebuild with baseline pahole (patch 2)
>>
>> [1] https://github.com/alan-maguire/dwarves/actions/runs/16192185959
>>
>> Alan Maguire (2):
>>    github CI: Do not build pahole as part of dwarves-ci setup
>>    github CI: Add comparison of generated BTF functions between baseline,
>>      change
>>
>>   .github/scripts/build-pahole.sh      | 23 +++++++++++++++++++++
>>   .github/scripts/compare-functions.sh | 30 ++++++++++++++++++++++++++++
>>   .github/workflows/test.yml           |  4 ++--
>>   .github/workflows/vmtest.yml         |  4 ++++
>>   4 files changed, 59 insertions(+), 2 deletions(-)
>>   create mode 100755 .github/scripts/compare-functions.sh
>>
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-07-21 11:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-10 16:16 [PATCH v3 dwarves 0/2] Add function list comparison to github CI Alan Maguire
2025-07-10 16:16 ` [PATCH v3 dwarves 1/2] github CI: Do not build pahole as part of dwarves-ci setup Alan Maguire
2025-07-10 16:16 ` [PATCH v3 dwarves 2/2] github CI: Add comparison of generated BTF functions between baseline, change Alan Maguire
2025-07-15 15:41 ` [PATCH v3 dwarves 0/2] Add function list comparison to github CI Ihor Solodrai
2025-07-21 11:35   ` Alan Maguire

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox