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 double low power ticker interrupt #7599

Merged
merged 1 commit into from Aug 20, 2018

Conversation

Projects
None yet
6 participants
@c1728p9
Contributor

c1728p9 commented Jul 26, 2018

Description

When computing the next set_interrupt time in the common ticker layer
the absolute time in microseconds is rounded down to the closes low
power tick. Because of this the low power ticker interrupt fires one
cycle too early. This causes ticker_irq_handler to run even though
there are no events ready to run.

To prevent this unnecessary interrupt this patch changes the
computation for the next set_interrupt time to round up rather than
down.

Pull request type

[x] Fix
[ ] Refactor
[ ] New target
[ ] Feature
[ ] Breaking change
Fix double low power ticker interrupt
When computing the next set_interrupt time in the common ticker layer
the absolute time in microseconds is rounded down to the closes low
power tick. Because of this the low power ticker interrupt fires one
cycle too early. This causes ticker_irq_handler to run even though
there are no events ready to run.

To prevent this unnecessary interrupt this patch changes the
computation for the next set_interrupt time to round up rather than
down.

@c1728p9 c1728p9 requested a review from pan- Jul 26, 2018

@cmonr cmonr requested a review from kjbracey-arm Aug 14, 2018

@cmonr

cmonr approved these changes Aug 14, 2018

@cmonr

This comment has been minimized.

Contributor

cmonr commented Aug 14, 2018

/morph build

@mbed-ci

This comment has been minimized.

mbed-ci commented Aug 14, 2018

Build : SUCCESS

Build number : 2789
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/7599/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build
/morph mbed2-build

@mbed-ci

This comment has been minimized.

@kjbracey-arm

To check I understand this correctly:

The schedule_interrupt tick conversion rounded down, that rounded-down tick was in the past, so it scheduled an immediate interrupt. That interrupt triggered, but ticker_irq_handler decided it wasn't time yet, so rescheduled. Repeat, spinning interrupts, until time is reached? Seems like it could be more than just double, potentially?

If that's right, then approved.

Slightly wary of it going in a patch release unless it's causing a real observed problem - vaguely possible someone's timing is somehow relying on that spin to get more accurate scheduling - it was working a bit like wait_ms.

@cmonr

This comment has been minimized.

Contributor

cmonr commented Aug 14, 2018

@c1728p9 Mind ack/nack-ing kjbracey-arm's interpretation?

@cmonr

This comment has been minimized.

Contributor

cmonr commented Aug 14, 2018

@kjbracey-arm We're close enough to the feature release that we could target it to 5.10 without too much issue. @c1728p9 any objections?

@mbed-ci

This comment has been minimized.

@studavekar

This comment has been minimized.

Collaborator

studavekar commented Aug 14, 2018

Test : FAILURE
Build number : 2524
Test logs :http://mbed-os-logs.s3-website-us-west-1.amazonaws.com/?prefix=logs/7599/2524

This failed as it failed to fetch the test app from AWS

download failed: s3://mbed-os/builds/7599/PASS/NUCLEO_F401RE/ARM/testbin_c36b58a05b0211d3dafe015416d3440eecbe4966.zip to ./testbin_c36b58a05b0211d3dafe015416d3440eecbe4966.zip HTTPSConnectionPool(host='mbed-os.s3.amazonaws.com', port=443): Read timed out.
unzip:  cannot find or open testbin_*.zip, testbin_*.zip.zip or testbin_*.zip.ZIP.
@studavekar

This comment has been minimized.

Collaborator

studavekar commented Aug 14, 2018

/morph test

@c1728p9

This comment has been minimized.

Contributor

c1728p9 commented Aug 14, 2018

Hi @kjbracey-arm yeah, that is correctly. In the setup I was using it was firing twice, but for faster devices it could fire many more times. @cmonr, this going into 5.10 sounds good to me.

@mbed-ci

This comment has been minimized.

@cmonr

This comment has been minimized.

Contributor

cmonr commented Aug 15, 2018

Hmmm, not liking the trend in silly test failures...
/morph test

@mbed-ci

This comment has been minimized.

@cmonr

This comment has been minimized.

Contributor

cmonr commented Aug 16, 2018

Failures don't appear to be related to CI.
/morph test

@mbed-ci

This comment has been minimized.

@cmonr cmonr added ready for merge and removed needs: CI labels Aug 17, 2018

@0xc0170 0xc0170 merged commit 5b751e8 into ARMmbed:master Aug 20, 2018

14 checks passed

AWS-CI uVisor Build & Test Success
Details
ci-morph-build build completed
Details
ci-morph-exporter build completed
Details
ci-morph-mbed2-build build completed
Details
ci-morph-test test completed , RTOS ROM(+0.05%) RAM(+0.0%)
Details
continuous-integration/jenkins/pr-head This commit looks good
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
travis-ci/astyle Passed, 793 files
Details
travis-ci/docs Local docs testing has passed
Details
travis-ci/events Passed, runtime is 10035 cycles (+351 cycles)
Details
travis-ci/gitattributestest Local gitattributestest testing has passed
Details
travis-ci/licence_check Local licence_check testing has passed
Details
travis-ci/littlefs Passed, code size is 9960B (+0.00%)
Details
travis-ci/tools-py2.7 Local tools-py2.7 testing has passed
Details

pan- pushed a commit to pan-/mbed that referenced this pull request Aug 22, 2018

Merge pull request ARMmbed#7599 from c1728p9/double_low_power_ticker_…
…interrupt

Fix double low power ticker interrupt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment