Skip to content

CONFIG_TICKLESS_KERNEL makes z_clock_set_timeout doesn't work #11129

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

Closed
vonhust opened this issue Nov 6, 2018 · 3 comments
Closed

CONFIG_TICKLESS_KERNEL makes z_clock_set_timeout doesn't work #11129

vonhust opened this issue Nov 6, 2018 · 3 comments
Assignees
Labels
bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug

Comments

@vonhust
Copy link

vonhust commented Nov 6, 2018

@andyross @nashif @ruuddw

in timeout.c, the function will call the clock driver wrapper z_clock_set_timerout in legacy_api.h.

void z_clock_set_timeout(s32_t ticks, bool idle)
{
#ifdef CONFIG_TICKLESS_KERNEL
	if (idle) {
		_timer_idle_enter(ticks);
	} else {
		_set_time(ticks == K_FOREVER ? 0 : ticks);
	}
#endif
}

According to the code, if TICKLESS_KERNEL is not configured, z_clock_set_timeout will do nothing, which means the timeout mechnism will fail.

I already observed the failure in tests/kernel/profiling/profiling_api caused by the changes in clock driver (legacy_api.h)

BTW in line 46 of legacy_api.h

#ifdef TICKLESS_KERNEL shoud be #ifdef CONFIG_TICKLESS_KERNEL ?

@nashif nashif removed bug The issue is a bug, or the PR is fixing a bug labels Nov 8, 2018
@andyross
Copy link
Collaborator

z_clock_set_timeout() is an internal API between the kernel and timer driver, and indeed it's a noop if TICKLESS_KERNEL is not defined. When TICKLESS_KERNEL=n, the driver is expected to deliver regular ticks on its own, and doesn't need the kernel to tell it when to schedule the next z_clock_announce().

@andyross andyross self-assigned this Nov 10, 2018
@vonhust
Copy link
Author

vonhust commented Nov 12, 2018 via email

@andyross
Copy link
Collaborator

Check the new drivers in #10556, hopefully that will be clearer. I think the problem is that you're looking at only half the change (the API refactoring) and getting confused about the shim layer needed to make the older drivers work.

@nashif nashif added the bug The issue is a bug, or the PR is fixing a bug label Nov 13, 2018
@galak galak added the priority: medium Medium impact/importance bug label Nov 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug
Projects
None yet
Development

No branches or pull requests

4 participants