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

CI: Build on macOS #59

Merged
merged 3 commits into from
Sep 14, 2024
Merged

CI: Build on macOS #59

merged 3 commits into from
Sep 14, 2024

Conversation

ChinYikMing
Copy link
Collaborator

No description provided.

@ChinYikMing
Copy link
Collaborator Author

When running boot tests on macOS, the kernel gets stuck at the following message:

[ 3062.927108] sched_clock: 64 bits at 65MHz, resolution 15ns, wraps every 2199023255550ns

After bisecting, #49 was identified as the cause of the issue. Cc: @chiangkd

@ChinYikMing ChinYikMing changed the title CI: build on macOS CI: Build on macOS Sep 9, 2024
@chiangkd
Copy link
Collaborator

chiangkd commented Sep 10, 2024

Hi @ChinYikMing ,

I noticed an abnormal timestamp in the boot log:

[ 3062.927108] sched_clock: 64 bits at 65MHz, resolution 15ns, wraps every 2199023255550ns

This issue arises because I inadvertently returned the clocksource in nanoseconds when building on macOS, while the expected unit is seconds.

static uint64_t semu_timer_clocksource(uint64_t freq)
{
#if defined(HAVE_POSIX_TIMER)
    struct timespec t;
    clock_gettime(CLOCKID, &t);
    return t.tv_sec * freq + mult_frac(t.tv_nsec, freq, 1e9);
#elif defined(HAVE_MACH_TIMER)
    static mach_timebase_info_data_t t;
    if (t.denom == 0)
        (void) mach_timebase_info(&t);
-    return mult_frac(mach_absolute_time() * freq, t.numer, t.denom);
+    return mult_frac(mult_frac(mach_absolute_time(), freq, 1e9), t.numer, t.denom);
#else
    return time(0) * freq;
#endif
}

I will create another PR to fix this bug. Thanks for pointing it out!

Regarding the CI test failures, the CI workflow was failing due to a timeout (currently set to 90 seconds), I found some discussion about github-hosted runner. Increasing the timeout value to 600 seconds allowed the workflow to pass, I am not sure where is the bottleneck during workflow but it actually take much more time to boot linux on semu with macOS runner. I'm also exploring options to build semu on a real macOS machine to better address this issue.

jserv

This comment was marked as resolved.

@ChinYikMing
Copy link
Collaborator Author

ChinYikMing commented Sep 12, 2024

@chiangkd , Is the 600s timeout the minimum needed to pass the CI on the macOS runner? I would prefer adding a conditional statement based on the runner to select the appropriate timeout duration. After that, a new issue can be created to track this.

semu supports conditional compilation on both Linux and macOS. This
can sometimes lead to compilation failures on one platform when only
tested on another. To prevent such issues, automated CI checks ensure
that the code compiles properly before being merged into upstream.
@ChinYikMing

This comment was marked as resolved.

@chiangkd
Copy link
Collaborator

chiangkd commented Sep 12, 2024

@chiangkd , Is the 600s timeout the minimum needed to pass the CI on the macOS runner? I would prefer adding a conditional statement based on the runner to select the appropriate timeout duration. After that, a new issue can be created to track this.

In my testing, the average time to pass this Action is around 311 seconds. Additionally, I reverted to using the mtime counter instead of the real-time clock, which brought the execution time down to about 135 seconds,

I also tested running semu on macOS via VirtualBox, but it still took longer to boot the system.

Here are the results for make check on macOS through VirtualBox:

...
[142.702404] Run/ init as init process
...

.ci/autorun.sh Show resolved Hide resolved
@ChinYikMing
Copy link
Collaborator Author

@chiangkd , Is the 600s timeout the minimum needed to pass the CI on the macOS runner? I would prefer adding a conditional statement based on the runner to select the appropriate timeout duration. After that, a new issue can be created to track this.

In my testing, the average time to pass this Action is around 311 seconds. Additionally, I reverted to using the mtime counter instead of the real-time clock, which brought the execution time down to about 135 seconds,

I also tested running semu on macOS via VirtualBox, but it still took longer to boot the system.

Here are the results for make check on macOS through VirtualBox:

...
[142.702404] Run/ init as init process
...

Got it, thanks for testing. It looks like 600 seconds is sufficient to pass the CI on the macOS runner.

Testing shows 600 seconds is sufficient to boot Linux on macOS runners,
while 90 seconds works for Linux runners. This commit sets the timeout
for each platform accordingly.

The varying timeout requirements will be tracked in an issue.
@jserv jserv merged commit a0ad61b into sysprog21:master Sep 14, 2024
3 checks passed
@jserv
Copy link
Collaborator

jserv commented Sep 14, 2024

Thank @ChinYikMing for contributing!

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.

3 participants