fix task stuck on timer wake-up event
fix task stuck on timer wake-up event

When we are in interrupt context and doing a task_set_event,
if we are interrupted by a timer interrupt firing, we might end
resetting the runnable bit added by the expiration of a timer (when
finishing the interrupted read-modify-write to tasks_ready).
So we need to have an atomic access there.

We don't need to atomic primitives (and the associated overhead) on other
tasks_ready accesses because there are always done at the highest
priority.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BUG=chrome-os-partner:8721
TEST=from Linux, run "ectool lightbar test" several times and see that
the keyboard task no longer ends up stuck with a timer event set and no
runnable bit.

Change-Id: Ied45ee33cb6aba4549626d35d694f1c259f2400c

mtk09422/chromiumos-platform-ec,alterapraxisptyltd/chromium-ec,thehobn/ec,thehobn/ec,alterapraxisptyltd/chromium-ec,mtk09422/chromiumos-platform-ec,fourier49/BIZ_EC,coreboot/chrome-ec,akappy7/ChromeOS_EC_LED_Diagnostics,fourier49/BZ_DEV_EC,longsleep/ec,md5555/ec,gelraen/cros-ec,eatbyte/chromium-ec,md5555/ec,thehobn/ec,alterapraxisptyltd/chromium-ec,longsleep/ec,fourier49/BZ_DEV_EC,coreboot/chrome-ec,coreboot/chrome-ec,eatbyte/chromium-ec,mtk09422/chromiumos-platform-ec,gelraen/cros-ec,fourier49/BIZ_EC,fourier49/BIZ_EC,eatbyte/chromium-ec,md5555/ec,gelraen/cros-ec,eatbyte/chromium-ec,akappy7/ChromeOS_EC_LED_Diagnostics,coreboot/chrome-ec,akappy7/ChromeOS_EC_LED_Diagnostics,alterapraxisptyltd/chromium-ec,fourier49/BZ_DEV_EC,fourier49/BZ_DEV_EC,mtk09422/chromiumos-platform-ec,longsleep/ec,longsleep/ec,akappy7/ChromeOS_EC_LED_Diagnostics,coreboot/chrome-ec,md5555/ec,gelraen/cros-ec,thehobn/ec,coreboot/chrome-ec,fourier49/BIZ_EC,akappy7/ChromeOS_EC_LED_Diagnostics