Skip to content

platform: infer CPU variant from arch on non-Linux OSes - #1070

Open
ahze wants to merge 1 commit into
podman-container-tools:mainfrom
ahze:freebsd-cpu-variant
Open

platform: infer CPU variant from arch on non-Linux OSes#1070
ahze wants to merge 1 commit into
podman-container-tools:mainfrom
ahze:freebsd-cpu-variant

Conversation

@ahze

@ahze ahze commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

On FreeBSD, this falls through to a Linux-only /proc/cpuinfo check on arm64 and logs this error immediately, without ever attempting the read:

Couldn't get cpu architecture: getCPUInfo for OS freebsd not implemented

I initially considered a narrower || os == "freebsd" check, but I believe linux is the only OS this detection method actually works for.

@github-actions github-actions Bot added the image Related to "image" package label Aug 11, 2026
@ahze
ahze force-pushed the freebsd-cpu-variant branch from d1be9be to 29a245d Compare August 11, 2026 21:02

@mtrmac mtrmac left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks!

I think this is fine in principle, but we shouldn’t have functions with misleading names. That goes both for (newly) getCPUVariantDarwinWindows and for already-misleading getCPUVariantArm (not highlighting that it is Linux-specific).

@ahze
ahze force-pushed the freebsd-cpu-variant branch 2 times, most recently from 2731abc to b963a37 Compare August 11, 2026 22:38
func getCPUVariantDarwinWindows(arch string) string {
func getCPUVariantFromArch(arch string) string {
// Darwin and Windows only support v7 for ARM32 and v8 for ARM64 and so we can use
// runtime.GOARCH to determine the variants

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This comment (or behavior?) also needs updating … somehow.

E.g. https://wiki.freebsd.org/arm suggests that ARMv6 is still supported, and for hypothetical other OSes we have no idea.

I suppose the major concern is that values for the larger-share OSes are not changing; and ARM ≤v6 will go away over time. so I’m not too worried, but, still…

One option might be to make this OS-conditional on 32-bit. Another might be to just punt and document that we don’t know and are guessing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, good point!

Worth noting: v6 is Tier 3 on FreeBSD 14.x and not supported at all on 15+, and v7 is Tier 2 with no packages built for it (https://www.freebsd.org/platforms/).

So in practice there's no FreeBSD user who could actually run a pkg-based podman workload on anything below v7 that we'd be mis-detecting. Happy to still make the 32-bit case OS-conditional for correctness, or just document the assumption in the comment -- which would you prefer?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for that context! In that case either is fine — and the comment is simpler.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Went with the simpler comment-only version, pushed

Signed-off-by: Michael Johnson <buhnux@gmail.com>
@ahze
ahze force-pushed the freebsd-cpu-variant branch from b963a37 to 8077629 Compare August 11, 2026 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

image Related to "image" package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants