Skip to content

Fix for Clocktest Failure (Bugfix)#1434

Merged
Hook25 merged 1 commit intomainfrom
cpu_clocktest_fix
Sep 11, 2024
Merged

Fix for Clocktest Failure (Bugfix)#1434
Hook25 merged 1 commit intomainfrom
cpu_clocktest_fix

Conversation

@mreed8855
Copy link
Copy Markdown
Collaborator

The test program retroeves the number of cpus using "num_cpus = sysconf(_SC_NPROCESSORS_CONF);". After an
upstream change in the kernel between 22.04 and 24.04, this returns now the number of physical cpus available.
But these cpus do not need to be available to the system right now. Looping over num_cpus, the call to
sched_setaffinity results in an error EINVAL which is explained with:

EINVAL The affinity bit mask mask contains no processors that are currently physi‐
cally on the system and permitted to the thread according to any restrictions
that may be imposed by cpuset cgroups or the "cpuset" mechanism described in
cpuset(7).

The correct way to retrieve the available number of cpus would be "num_cpus = sysconf(_SC_NPROCESSORS_ONLN);", as described here:

man sysconf

_SC_NPROCESSORS_CONF
The number of processors configured. See also get_nprocs_conf(3).

_SC_NPROCESSORS_ONLN
The number of processors currently online (available). See also get_nprocs_conf(3).

A Fix for issue https://github.com/canonical/checkbox/issues/815

Description

Resolved issues

Documentation

Tests

    _SC_NPROCESSORS_CONF
    The number of processors configured. See also get_nprocs_conf(3).

    _SC_NPROCESSORS_ONLN
    The number of processors currently online (available). See also get_nprocs_conf(3).

    A Fix for issue #815
@mreed8855
Copy link
Copy Markdown
Collaborator Author

This still needs to be tested, I am creating the PR to see what other checks could fail.

@codecov
Copy link
Copy Markdown

codecov bot commented Aug 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 45.72%. Comparing base (b672f33) to head (fb907b6).
Report is 149 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1434      +/-   ##
==========================================
+ Coverage   45.25%   45.72%   +0.47%     
==========================================
  Files         367      367              
  Lines       39131    39130       -1     
  Branches     6617     6617              
==========================================
+ Hits        17707    17893     +186     
+ Misses      20751    20564     -187     
  Partials      673      673              
Flag Coverage Δ
provider-base 19.91% <ø> (+1.20%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Hook25 Hook25 merged commit da49281 into main Sep 11, 2024
@Hook25 Hook25 deleted the cpu_clocktest_fix branch September 11, 2024 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants