[Xenomai] potentially missing timer rating check in select_root_only_timer()

Jan Kiszka jan.kiszka at siemens.com
Thu May 3 23:31:44 CEST 2018


On 2018-05-02 19:43, Pham, Phong wrote:
> 
> Hi Jan,
> 
> In my scenario, it is a single CPU Powerpc system.  What I was intending to do is replacing the decrementer (Powerpc specific count down timer) clockevent with my timer clockevent.  (My timer is located somewhere else on the chip accessible via memory mapped IO).   According to Linux, user can change the rating and kernel will select the highest rating timer for you.  So I change my timer rating to be higher than the decrementer.  In ipipe_select_timers(), it will pick the first timer found on the timers linked list.  That linked list of timers is also sorted by highest priority first.  However, when select_root_only_timer() is executed, the code goes thru the entire list and select the last one, the one with the lowest rating.

OK, I'm starting to see the problem:

1. You have some CPUs that are not used by Xenomai (ipipe_select_timers,
   "fixup" mask is non-empty)

2. There are multiple ipipe-timers available, sorted according to their
   rating in "timers" list (higher ratings first).

3. select_root_only_timer is now called for each timer in the list, and
   if the timer matches regarding the IRQ, it will be registered
   (install_pcpu_timer).

Due to this multi-registration (actually overwriting), you end up with
the lowest rated timer installed.

So the proper fix is to prevent further calls to select_root_only_timer
after the first successful one. Would you write such a patch? Should be
about making select_root_only_timer return some true/false, depending on
whether it actually installed something.

Jan

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux



More information about the Xenomai mailing list