Skip to content

Set unique names for subpackages in kernel-rt spec #13084

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

Open
wants to merge 15 commits into
base: 3.0-dev
Choose a base branch
from

Conversation

harshitgupta1337
Copy link
Contributor

@harshitgupta1337 harshitgupta1337 commented Mar 24, 2025

Merge Checklist

All boxes should be checked before merging the PR (just tick any boxes which don't apply to this PR)

  • The toolchain has been rebuilt successfully (or no changes were made to it)
  • The toolchain/worker package manifests are up-to-date
  • Any updated packages successfully build (or no packages were changed)
  • Packages depending on static components modified in this PR (Golang, *-static subpackages, etc.) have had their Release tag incremented.
  • Package tests (%check section) have been verified with RUN_CHECK=y for existing SPEC files, or added to new SPEC files
  • All package sources are available
  • cgmanifest files are up-to-date and sorted (./cgmanifest.json, ./toolkit/scripts/toolchain/cgmanifest.json, .github/workflows/cgmanifest.json)
  • LICENSE-MAP files are up-to-date (./LICENSES-AND-NOTICES/SPECS/data/licenses.json, ./LICENSES-AND-NOTICES/SPECS/LICENSES-MAP.md, ./LICENSES-AND-NOTICES/SPECS/LICENSE-EXCEPTIONS.PHOTON)
  • All source files have up-to-date hashes in the *.signatures.json files
  • sudo make go-tidy-all and sudo make go-test-coverage pass
  • Documentation has been updated to match any changes to the build system
  • Ready to merge

Summary

Currently, the subpackages python3-perf and bpftools are being built both by the kernel-rt and kernel specs. However, they have the same name - irrespective of which spec file they are built from. This causes the python3-perf RPM built against kernel-rt source-code to override the RPM built against kernel source-code (same for bpftools RPM).

Change Log
  • Rename the bpftool and python3-perf subpackages to be kernel-specific in each of the kernel type's spec file.
  • Each of these kernel-specific subpackages will all Provide a dependency with same name as the subpackage's name under default kernel rpm. E.g., Provides: python3-perf for the subpkg python3-perf-rt, etc.
  • To ensure that the subpackage RPM being installed was built against the OS's kernel, add Conflicts with other kernel types in the spec files.
Does this affect the toolchain?

YES

Test Methodology

The proposed changes were tested by ensuring that when an image is built with a given kernel variant and tuned is to be installed, the right variant of the python3-perf subpackage is installed (depending on which kernel is on the image).

  • RPMs of different kernel specs (in both SPECS and SPECS-EXTENDED) and tuned were built.
    https://dev.azure.com/mariner-org/mariner/_build/results?buildId=834792&view=results
  • The built RPMs were used to build a modified version of the imageconfigs/core-efi.json image with included tuned package as well along with the original ones. The default kernel for the image was set to one of kernel, kernel-rt, kernel-ipe and kernel-lpg-innovate. In each case, when the tuned package was installed, the toolkit installed the correct variant of the python3-perf package based on the kernel type.
cd azurelinux/toolkit

# Fetch the packages built in the buddy build pipeline and populate the build environment
az pipelines runs artifact download --artifact-name drop_buddy_build_amd64_build_amd64 --run-id 834792 --path ./
sudo make hydrate-rpms PACKAGE_ARCHIVE=./build-artifacts/rpms.tar.gz

# Run for different kernel variants
for kernel in kernel kernel-rt kernel-ipe kernel-lpg-innovate; do
      cfg=./imageconfigs/core-efi-${kernel}.json
      # Update the default kernel in the kernel config
      cat imageconfigs/core-efi.json | jq ".SystemConfigs[0].KernelOptions.default=\"${kernel}\"" > $cfg
      sudo make image REBUILD_TOOLS=y REBUILD_PACKAGES=n \
              REBUILD_TOOLCHAIN=n QUICK_REBUILD=n DAILY_BUILD_ID=lkg CONFIG_FILE=$cfg
      # Rename the logfile
      sudo mv /home/ubuntu/git/azurelinux/build/logs/imggen/imager.log imager-${kernel}.log
done

After the above script is run, upon inspection of the imager-kernel-rt.log file, it contains the following logs, indicating that python3-perf-rt package was installed as a dependency for tuned.

time="2025-06-12T19:24:38-07:00" level=debug msg="Executing: [tdnf install --releasever=3.0 --assumeno --nogpgcheck tuned --installroot /installroot]"
time="2025-06-12T19:24:38-07:00" level=debug msg="Error(1032) : Operation aborted."
time="2025-06-12T19:24:38-07:00" level=debug msg="Added installedPackages entry for: hdparm-9.65-1.azl3.x86_64"
time="2025-06-12T19:24:38-07:00" level=debug msg="Added installedPackages entry for: libXau-1.0.11-1.azl3.x86_64"
time="2025-06-12T19:24:38-07:00" level=debug msg="Added installedPackages entry for: libX11-common-1.8.7-1.azl3.noarch"
time="2025-06-12T19:24:38-07:00" level=debug msg="Added installedPackages entry for: brotli-1.1.0-2.azl3.x86_64"
time="2025-06-12T19:24:38-07:00" level=debug msg="Added installedPackages entry for: gobject-introspection-1.78.1-1.azl3.x86_64"
time="2025-06-12T19:24:38-07:00" level=debug msg="Added installedPackages entry for: pixman-0.43.2-1.azl3.x86_64"
time="2025-06-12T19:24:38-07:00" level=debug msg="Added installedPackages entry for: libxcb-1.16-1.azl3.x86_64"
time="2025-06-12T19:24:38-07:00" level=debug msg="Added installedPackages entry for: libpng-1.6.40-1.azl3.x86_64"
time="2025-06-12T19:24:38-07:00" level=debug msg="Added installedPackages entry for: libXrender-0.9.11-1.azl3.x86_64"
time="2025-06-12T19:24:38-07:00" level=debug msg="Added installedPackages entry for: libXext-1.3.5-1.azl3.x86_64"
time="2025-06-12T19:24:38-07:00" level=debug msg="Added installedPackages entry for: libX11-1.8.7-1.azl3.x86_64"
time="2025-06-12T19:24:38-07:00" level=debug msg="Added installedPackages entry for: freetype-2.13.2-1.azl3.x86_64"
time="2025-06-12T19:24:38-07:00" level=debug msg="Added installedPackages entry for: fontconfig-2.14.2-1.azl3.x86_64"
time="2025-06-12T19:24:38-07:00" level=debug msg="Added installedPackages entry for: dmidecode-3.6-1.azl3.x86_64"
time="2025-06-12T19:24:38-07:00" level=debug msg="Added installedPackages entry for: libtraceevent-1.8.2-1.azl3.x86_64"
time="2025-06-12T19:24:38-07:00" level=debug msg="Added installedPackages entry for: python3-gobject-base-3.46.0-1.azl3.x86_64"
time="2025-06-12T19:24:38-07:00" level=debug msg="Added installedPackages entry for: python3-cairo-1.24.0-1.azl3.x86_64"
time="2025-06-12T19:24:38-07:00" level=debug msg="Added installedPackages entry for: cairo-gobject-1.18.0-1.azl3.x86_64"
time="2025-06-12T19:24:38-07:00" level=debug msg="Added installedPackages entry for: cairo-1.18.0-1.azl3.x86_64"
time="2025-06-12T19:24:38-07:00" level=debug msg="Added installedPackages entry for: duktape-2.7.0-1.azl3.x86_64"
time="2025-06-12T19:24:38-07:00" level=debug msg="Added installedPackages entry for: virt-what-1.25-1.azl3.x86_64"
time="2025-06-12T19:24:38-07:00" level=debug msg="Added installedPackages entry for: python3-schedutils-0.6-13.azl3.x86_64"
time="2025-06-12T19:24:38-07:00" level=debug msg="Added installedPackages entry for: python3-pyudev-0.24.1-1.azl3.noarch"
time="2025-06-12T19:24:38-07:00" level=debug msg="Added installedPackages entry for: python3-perf-rt-6.6.85.1-2.azl3.x86_64"
time="2025-06-12T19:24:38-07:00" level=debug msg="Added installedPackages entry for: python3-linux-procfs-0.6.1-9.azl3.noarch"
time="2025-06-12T19:24:38-07:00" level=debug msg="Added installedPackages entry for: python3-gobject-3.46.0-1.azl3.x86_64"
time="2025-06-12T19:24:38-07:00" level=debug msg="Added installedPackages entry for: python3-decorator-5.1.1-2.azl3.noarch"
time="2025-06-12T19:24:38-07:00" level=debug msg="Added installedPackages entry for: python3-dbus-1.2.16-3.azl3.x86_64"
time="2025-06-12T19:24:38-07:00" level=debug msg="Added installedPackages entry for: polkit-123-2.azl3.x86_64"
time="2025-06-12T19:24:38-07:00" level=debug msg="Added installedPackages entry for: ethtool-6.4-2.azl3.x86_64"
time="2025-06-12T19:24:38-07:00" level=debug msg="Added installedPackages entry for: tuned-2.21.0-2.azl3.noarch"

@microsoft-github-policy-service microsoft-github-policy-service bot added Packaging specs-extended PR to fix SPECS-EXTENDED 3.0-dev PRs Destined for AzureLinux 3.0 labels Mar 24, 2025
@harshitgupta1337 harshitgupta1337 marked this pull request as ready for review March 24, 2025 23:13
@harshitgupta1337 harshitgupta1337 requested review from a team as code owners March 24, 2025 23:13
@@ -36,7 +36,7 @@ Requires: python3-configobj
Requires: python3-dbus
Requires: python3-decorator
Requires: python3-linux-procfs
Requires: python3-perf
Requires: (python3-perf or python3-perf-rt)
Copy link
Contributor

Choose a reason for hiding this comment

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

@dmcilvaney what is our graph's behavior for this kind of "or" for one package built in specs and another built in specs-extended, but we're only building our core specs?

Copy link
Contributor

@dmcilvaney dmcilvaney Mar 27, 2025

Choose a reason for hiding this comment

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

I'll double check, but I believe it takes the pessimistic approach and ensures both are built. I'll need to figure out what the scheduler picks though.

So, if one is simply not available (ie extended), it may cause an unresolved package issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

I also queued off a buddy build for tuned and it does have an "unresolved dependency" failure on python3-perf-rt missing, even though tuned went ahead and was built.

https://dev.azure.com/mariner-org/mariner/_build/results?buildId=773389&view=logs&j=bac295d9-f2e0-5165-e63e-e76f383e1a27&t=11f6dde0-e75e-52b2-fbf0-d83a00678fa3

Copy link
Contributor

@christopherco christopherco left a comment

Choose a reason for hiding this comment

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

Change currently causes a build failure. Evaluating alternatives

@@ -36,7 +36,7 @@ Requires: python3-configobj
Requires: python3-dbus
Requires: python3-decorator
Requires: python3-linux-procfs
Requires: python3-perf
Requires: (python3-perf or python3-perf-rt)
Copy link
Contributor

Choose a reason for hiding this comment

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

@rlmenge @harshitgupta1337 have you evaluated if we could keep this as Requires: python3-perf and instead do a Provides: python3-perf from within the various kernel specs?

If that method works, it would be more sustainable than always needing to keep this Requires: (<package> or <package2> ...) method for each kernel package added or removed

Copy link
Contributor Author

@harshitgupta1337 harshitgupta1337 Mar 28, 2025

Choose a reason for hiding this comment

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

I agree that the method you propose would be a more sustainable method of managing this dependency of tuned.
However, if we do that - and then try installing tuned from a system running kernel-rt, how would we enforce the selection of python3-perf-rt (part of kernel-rt.spec) and not python3-perf (part of kernel.spec) ?
In the PR created by @rlmenge (#5897 ), each kernel spec has a conflict with every other kernel spec - could be a solution by enforcing that only python3-perf-rt would be installed because installing python3-perf would require kernel which conflicts with already installed kernel-rt.

Copy link
Contributor Author

@harshitgupta1337 harshitgupta1337 Apr 11, 2025

Choose a reason for hiding this comment

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

Hi @christopherco , I have tried the same approach that @rlmenge used in #5897 and tested it with an image build using AzureLinux toolkit with default kernel set to one of kernel, kernel-rt, and kernel-ipe. In each case, the tuned package was installed, which installed the correct type of python3-perf package based on the kernel type. I used the RPMs built by this buddy build pipeline (which failed in the License Check step): https://dev.azure.com/mariner-org/mariner/_build/results?buildId=785103&view=results

@harshitgupta1337 harshitgupta1337 force-pushed the guptaharshit/kernel-rt-subpkgs-conflict branch from 2c04318 to 61558cf Compare April 11, 2025 15:50
@christopherco christopherco requested a review from Copilot April 15, 2025 02:56
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 4 out of 11 changed files in this pull request and generated no comments.

Files not reviewed (7)
  • SPECS-EXTENDED/kernel-ipe/kernel-ipe.spec: Language not supported
  • SPECS-EXTENDED/kernel-rt/kernel-rt.spec: Language not supported
  • SPECS-SIGNED/kernel-64k-signed/kernel-64k-signed.spec: Language not supported
  • SPECS-SIGNED/kernel-signed/kernel-signed.spec: Language not supported
  • SPECS/kernel-64k/kernel-64k.spec: Language not supported
  • SPECS/kernel-headers/kernel-headers.spec: Language not supported
  • SPECS/kernel/kernel.spec: Language not supported

@harshitgupta1337 harshitgupta1337 force-pushed the guptaharshit/kernel-rt-subpkgs-conflict branch from 10675b8 to f200d6f Compare April 25, 2025 14:44
Copy link
Contributor

@rlmenge rlmenge left a comment

Choose a reason for hiding this comment

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

There are recent changes to the OOT specs so these are no longer required to be bumped #13645.

Additionally looking to confirm image builds occcur as expected

@harshitgupta1337 harshitgupta1337 force-pushed the guptaharshit/kernel-rt-subpkgs-conflict branch from 1a90328 to 19c1079 Compare June 11, 2025 12:57
@harshitgupta1337
Copy link
Contributor Author

Change currently causes a build failure. Evaluating alternatives

@christopherco The build failure was likely due to the boolean OR expression in the Requires directive of tuned. With the updated approach, tuned requires simply python3-perf, and each kernel variant produces a subpackage (e.g., python3-perf-ipe, python3-perf-64k that provides python3-perf. The Conflict directives and the dependency of the python3-perf subpackage on its kernel ensure that only the current kernel's matching subpackage is installed to satisfy tuned.

The RPMs build successfully, as evidenced by the following pipeline runs:

Furthermore, I have validated that upon installing tuned, the right subpackage is installed (based on the current kernel). A description of the testing process is in this PR's description.

@harshitgupta1337 harshitgupta1337 force-pushed the guptaharshit/kernel-rt-subpkgs-conflict branch from dcb484a to d10c0fa Compare June 16, 2025 20:48
@harshitgupta1337
Copy link
Contributor Author

@christopherco @rlmenge I had to push some new commits due to a rebase. The PR is ready for review.
Please check this comment and the PR description for details about the approach and testing process.

@harshitgupta1337
Copy link
Contributor Author

Testing after recent rebase:

Copy link
Contributor

@dmcilvaney dmcilvaney left a comment

Choose a reason for hiding this comment

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

I think this approach should work. Might want to double check on a VM/Container that it doesn't swap the kernel or something, but otherwise lgtm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.0-dev PRs Destined for AzureLinux 3.0 Packaging specs-extended PR to fix SPECS-EXTENDED
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants