Find a file
Andy Ross 722aeead91 kernel/sched: Nonatomic swap workaround update for qemu behavior
The workaround for nonatomic swap had yet another edge case: it would
save off the _current pointer when pending a thread so that the next
time slice interrupt could test it to see if the swap had actually
happened before assuming that _current could be rescheduled (if it
just pended itself, that's impossible).  Then it would clear the
pending_current pointer so future interrupts wouldn't be confused.

BUT: it turns out that qemu, when faced with really rapid timer rates
that exceed its (host-based) timing accuracy, is perfectly willing to
"stack up" timer interrupts such the one goes pending before the
previous one is finished executing.  In that case, we can enter the
SECOND timer interrupt, to try timeslicing a SECOND time, STILL before
the PendSV exception has run to actually effect the context switch.
Except this time pending_current has been cleared and we try to
reschedule the pended _current thread incorrectly.  In theory real
hardware could do this too, though it would involve absolutely crazy
interrupt latency problems.

Work around this by moving the clear to the thread itself, immediately
after it wakes up from the pend call it retakes a lock and clears
pending_current if it still matches _current.  That is not a perfect
fix: there remains a 2-3 instruction race at that moment where we
return from pend and before we can lock interrupts again where a timer
interrupt will see an incorrect pointer.  But I hammered at this and
couldn't make qemu do that (i.e. return from a timer interrupt but
flag a new one in just a cycle or two).

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-03-15 05:50:43 +01:00
.github/ISSUE_TEMPLATE templates: Update issue templates 2018-12-07 08:27:20 -05:00
.known-issues doc: introduce final structure 2019-02-05 07:04:40 -05:00
arch arch: arm: revert back to use assembly to jump to main thread 2019-03-14 17:10:59 -05:00
boards doc: prepare for improving doc API linking 2019-03-15 05:47:19 +01:00
cmake cmake/emu: Add qemu SMP flags automatically 2019-03-13 19:15:20 +01:00
doc doc: prepare for improving doc API linking 2019-03-15 05:47:19 +01:00
drivers drivers: led: lp5562: Fix use of logical or vs bitwise 2019-03-14 17:11:36 -05:00
dts dts: nrf: SW PWM device node added to nRF5 devices with yaml binding 2019-03-12 13:34:01 +01:00
ext mbedtls: kconfig: Remove redundant 'depends on MBEDTLS' 2019-03-13 12:00:17 -05:00
include power: Add device idle power management support 2019-03-14 14:26:15 +01:00
kernel kernel/sched: Nonatomic swap workaround update for qemu behavior 2019-03-15 05:50:43 +01:00
lib lib: os: ring_buffer: Fix not handled return value 2019-03-14 08:40:18 +01:00
misc cmake: Rename CMake variable out of the reserved CONFIG_ namespace 2019-03-03 23:52:29 -05:00
samples doc: prepare for improving doc API linking 2019-03-15 05:47:19 +01:00
scripts doc: prepare for improving doc API linking 2019-03-15 05:47:19 +01:00
soc arm: asm: Fix some asm issues when building with clang 2019-03-14 08:01:10 -05:00
subsys doc: prepare for improving doc API linking 2019-03-15 05:47:19 +01:00
tests device: Extend device_set_power_state API to support async requests 2019-03-14 14:26:15 +01:00
.checkpatch.conf checkpatch: define typedefsfile to deal with a few false positives 2017-10-09 10:43:05 -04:00
.clang-format clang-format: add support for clang-format 2018-11-19 09:31:44 -05:00
.codecov.yml ci: add .codecov.yml for codecov.io configuration 2018-01-03 13:12:03 -05:00
.editorconfig editorconfig: basic EditorConfig configuration 2019-02-07 08:15:23 -05:00
.gitattributes First commit 2015-04-10 16:44:37 -07:00
.gitignore gitignore: ignore IDE files 2018-11-21 15:05:07 +01:00
.gitlint gitlint: do not start with subsys: 2018-11-28 09:22:01 -08:00
.mailmap mailmap: add entry for ruuddw 2018-07-05 09:57:23 -04:00
.shippable.yml ci: Move to using SDK 0.10.0 2019-03-11 11:01:08 -05:00
.uncrustify.cfg uncrustify: Add a rule to remove space inside function argument 2018-10-16 09:50:03 -04:00
CMakeLists.txt userspace: don't modify optimization options 2019-03-14 22:22:31 -05:00
CODE_OF_CONDUCT.md coc: move to markdown format 2019-01-24 15:37:15 -05:00
CODEOWNERS samples: power: Add test for device Idle PM 2019-03-14 14:26:15 +01:00
CONTRIBUTING.rst doc: Fixed a link in CONTRIBUTING.rst 2019-02-28 12:46:04 -08:00
Kconfig license: Replace Apache boilerplate with SPDX tag 2017-01-19 03:50:58 +00:00
Kconfig.zephyr lib/os: Conditionally eliminate alloca/VLA usage 2019-02-28 10:06:35 -08:00
LICENSE add top level Apache 2.0 license file 2016-02-05 20:24:37 -05:00
Makefile doc: add clean target to Makefile 2019-02-05 16:58:14 -05:00
README.rst doc: Fix links to docs.zephyrproject.org 2019-02-18 17:18:33 -05:00
VERSION release: Zephyr 1.14-rc1 2019-02-11 11:12:14 -06:00
version.h.in Introduce cmake-based rewrite of KBuild 2017-11-08 20:00:22 -05:00
west.yml west: add west.yml 2019-01-29 10:15:01 +01:00
zephyr-env.cmd scripts: remove west from scripts/ 2019-01-29 10:15:01 +01:00
zephyr-env.sh shell: Piped output of cd to /dev/null when setting ZEPHYR_BASE. 2018-12-06 19:14:50 -05:00

.. raw:: html

   <a href="https://www.zephyrproject.org">
     <p align="center">
       <img src="doc/images/Zephyr-Project.png">
     </p>
   </a>

   <a href="https://bestpractices.coreinfrastructure.org/projects/74"><img
   src="https://bestpractices.coreinfrastructure.org/projects/74/badge"></a>
   <img
   src="https://api.shippable.com/projects/58ffb2b8baa5e307002e1d79/badge?branch=master">


The Zephyr Project is a scalable real-time operating system (RTOS) supporting
multiple hardware architectures, optimized for resource constrained devices,
and built with security in mind.

The Zephyr OS is based on a small-footprint kernel designed for use on
resource-constrained systems: from simple embedded environmental sensors and
LED wearables to sophisticated smart watches and IoT wireless gateways.

The Zephyr kernel supports multiple architectures, including ARM Cortex-M,
Intel x86, ARC, Nios II, Tensilica Xtensa, and RISC-V, and a large number of
`supported boards`_.

.. below included in doc/introduction/introduction.rst

.. start_include_here

Getting Started
***************

To start developing Zephyr applications refer to the `Getting Started Guide`_
in the `Zephyr Documentation`_ pages.
A brief introduction to Zephyr can be found in the  `Zephyr Introduction`_
page.

Community Support
*****************

The Zephyr Project Developer Community includes developers from member
organizations and the general community all joining in the development of
software within the Zephyr Project. Members contribute and discuss ideas,
submit bugs and bug fixes, and provide training. They also help those in need
through the community's forums such as mailing lists and IRC channels. Anyone
can join the developer community and the community is always willing to help
its members and the User Community to get the most out of the Zephyr Project.

Welcome to the Zephyr community!

Resources
*********

Here's a quick summary of resources to find your way around the Zephyr Project
support systems:

* **Zephyr Project Website**: The https://zephyrproject.org website is the
  central source of information about the Zephyr Project. On this site, you'll
  find background and current information about the project as well as all the
  relevant links to project material.

* **Releases**: Source code for Zephyr kernel releases are available at
  https://zephyrproject.org/developers/#downloads. On this page,
  you'll find release information, and links to download or clone source
  code from our GitHub repository.  You'll also find links for the Zephyr
  SDK, a moderated collection of tools and libraries used to develop your
  applications.

* **Source Code in GitHub**: Zephyr Project source code is maintained on a
  public GitHub repository at https://github.com/zephyrproject-rtos/zephyr.
  You'll find information about getting access to the repository and how to
  contribute to the project in this `Contribution Guide`_ document.

* **Samples Code**: In addition to the kernel source code, there are also
  many documented `Sample and Demo Code Examples`_ that can help show you
  how to use Zephyr services and subsystems.

* **Documentation**: Extensive Project technical documentation is developed
  along with the Zephyr kernel itself, and can be found at
  http://docs.zephyrproject.org.  Additional documentation is maintained in
  the `Zephyr GitHub wiki`_.

* **Cross-reference**: Source code cross-reference for the Zephyr
  kernel and samples code is available at
  https://elixir.bootlin.com/zephyr/latest/source.

* **Issue Reporting and Tracking**: Requirements and Issue tracking is done in
  the Github issues system: https://github.com/zephyrproject-rtos/zephyr/issues.
  You can browse through the reported issues and submit issues of your own.

* **Security-related Issue Reporting and Tracking**: For security-related
  inquiries or reporting suspected security-related bugs in the Zephyr OS,
  please send email to vulnerabilities@zephyrproject.org.  We will assess and
  fix flaws according to our security policy outlined in the Zephyr Project
  `Security Overview`_.

  Security related issue tracking is done in JIRA.  The location of this JIRA
  is https://zephyrprojectsec.atlassian.net.

* **Mailing List**: The `Zephyr Development mailing list`_ is perhaps the most convenient
  way to track developer discussions and to ask your own support questions to
  the Zephyr project community.  There are also specific `Zephyr mailing list
  subgroups`_ for announcements, builds, marketing, and Technical
  Steering Committee notes, for example.
  You can read through the message archives to follow
  past posts and discussions, a good thing to do to discover more about the
  Zephyr project.

* **Chatting**: You can chat online with the Zephyr project developer
  community and other users in two ways:

  * On `Slack`_: Zephyr has dedicated channels on Slack. To register, use the
    following `Slack Invite`_.

  * IRC channel #zephyrproject on the freenode.net IRC server. You can use the
    http://webchat.freenode.net web client or use a client-side application such
    as pidgin (Note that all discussions have moved to Slack, although we still
    have many developers still available on the IRC channel).

.. _Slack Invite: https://tinyurl.com/yarkuemx
.. _Slack: https://zephyrproject.slack.com
.. _supported boards: http://docs.zephyrproject.org/latest/boards
.. _Zephyr Documentation: http://docs.zephyrproject.org
.. _Zephyr Introduction: http://docs.zephyrproject.org/latest/introduction/index.html
.. _Getting Started Guide: http://docs.zephyrproject.org/latest/getting_started/index.html
.. _Contribution Guide: http://docs.zephyrproject.org/latest/contribute/index.html
.. _Zephyr GitHub wiki: https://github.com/zephyrproject-rtos/zephyr/wiki
.. _Zephyr Development mailing list: https://lists.zephyrproject.org/g/devel
.. _Zephyr mailing list subgroups: https://lists.zephyrproject.org/g/main/subgroups
.. _Sample and Demo Code Examples: http://docs.zephyrproject.org/latest/samples/index.html
.. _Security Overview: http://docs.zephyrproject.org/latest/security/index.html