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

Fix CPU_COUNT check for FreeBSD 13.1+ #77867

Merged
merged 4 commits into from
Jan 11, 2023
Merged

Fix CPU_COUNT check for FreeBSD 13.1+ #77867

merged 4 commits into from
Jan 11, 2023

Conversation

Thefrank
Copy link
Contributor

@Thefrank Thefrank commented Nov 3, 2022

HAVE_GNU_CPU_COUNT has always incorrectly failed for FreeBSD.

This has not been an issue until FreeBSD 13.1 with its addition of sched_getaffinity and sched_setaffinity.

@ghost ghost added the community-contribution Indicates that the PR has been added by a community member label Nov 3, 2022
@Thefrank
Copy link
Contributor Author

Thefrank commented Nov 3, 2022

more info: With the two sched checks passing but CPU_COUNT failing it will try and make its own CPU_COUNT...and fail because FreeBSD already has a macro it uses for that.

Thinking about it more, the other option would be to opt FreeBSD out of HAVE_SCHED_GETAFFINITY and HAVE_GNU_CPU_COUNT

@build-analysis build-analysis bot mentioned this pull request Nov 4, 2022
2 tasks
@marek-safar marek-safar added the os-freebsd FreeBSD OS label Nov 4, 2022
src/mono/cmake/configure.cmake Outdated Show resolved Hide resolved
@Thefrank
Copy link
Contributor Author

Thefrank commented Nov 4, 2022

Switched to check_symbol_exists as per @am11 suggestion.
I left it in the section with the other "GNU" items but for readability it might be better with the other check_symbol_exists items

For those wondering:
FreeBSD 13.1:
CPU_COUNT sys/cpuset.h:74:#define CPU_COUNT(p) ((int)__BIT_COUNT(CPU_SETSIZE, p))
Ubuntu 20.04.02 + kernel 5.18.4
CPU_COUNT sched.h:88: # define CPU_COUNT(cpusetp) __CPU_COUNT_S (sizeof (cpu_set_t), cpusetp)

Copy link
Member

@am11 am11 left a comment

Choose a reason for hiding this comment

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

LGTM

@akoeplinger
Copy link
Member

Thank you!

@akoeplinger akoeplinger merged commit 97cb762 into dotnet:main Jan 11, 2023
@Thefrank Thefrank deleted the fbsd_cpucount branch January 23, 2023 22:20
@ghost ghost locked as resolved and limited conversation to collaborators Feb 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Build-mono community-contribution Indicates that the PR has been added by a community member os-freebsd FreeBSD OS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants