* [Xenomai] infinite loop/oops on cat /proc/xenomai/sched/stats when online cpus > present cpus
@ 2015-06-05 0:06 Don Mahurin
2015-06-05 15:30 ` Don Mahurin
0 siblings, 1 reply; 3+ messages in thread
From: Don Mahurin @ 2015-06-05 0:06 UTC (permalink / raw)
To: xenomai
In the function xnintr_query_next in kernel/cobalt/intr.c,
The iterator proceeds to the next entry when the next cpu is nr_cpus.
where nr_cpus is set to num_online_cpus().
if (cpu + 1 == nr_cpus)
iterator->prev = intr;
But if there are more cpus present than online, for the case for a timer
irq, this condition is never reached, as the following will cause cpu to be
reset to 0 if they are at the end of the list.
for (cpu = iterator->cpu + 1; cpu < nr_cpus; ++cpu) {
if (cpu_online(cpu))
break;
}
if (cpu == nr_cpus)
cpu = 0;
In our case, we have 8 cpus present, and 4 online.
For a timer irq, this will loop 0,1,2,3 repeatedly for the same irq.
Can we safely replace 'num_present_cpus' with 'num_online_cpus'?
Or do we need another way of detecting the last online cpu for the next
entry?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: intr-cpus-present-online.patch
Type: application/octet-stream
Size: 770 bytes
Desc: not available
URL: <http://xenomai.org/pipermail/xenomai/attachments/20150604/d7259c0c/attachment.obj>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Xenomai] infinite loop/oops on cat /proc/xenomai/sched/stats when online cpus > present cpus
2015-06-05 0:06 [Xenomai] infinite loop/oops on cat /proc/xenomai/sched/stats when online cpus > present cpus Don Mahurin
@ 2015-06-05 15:30 ` Don Mahurin
2015-06-09 18:24 ` Jan Kiszka
0 siblings, 1 reply; 3+ messages in thread
From: Don Mahurin @ 2015-06-05 15:30 UTC (permalink / raw)
To: xenomai
On Thu, Jun 4, 2015 at 5:06 PM, Don Mahurin <don@mperpetuo.com> wrote:
> In the function xnintr_query_next in kernel/cobalt/intr.c,
>
> The iterator proceeds to the next entry when the next cpu is nr_cpus.
> where nr_cpus is set to num_online_cpus().
>
> if (cpu + 1 == nr_cpus)
> iterator->prev = intr;
> But if there are more cpus present than online, for the case for a timer
> irq, this condition is never reached, as the following will cause cpu to be
> reset to 0 if they are at the end of the list.
>
> for (cpu = iterator->cpu + 1; cpu < nr_cpus; ++cpu) {
> if (cpu_online(cpu))
> break;
> }
> if (cpu == nr_cpus)
> cpu = 0;
> In our case, we have 8 cpus present, and 4 online.
>
> For a timer irq, this will loop 0,1,2,3 repeatedly for the same irq.
>
> Can we safely replace 'num_present_cpus' with 'num_online_cpus'?
>
> Or do we need another way of detecting the last online cpu for the next
> entry?
>
>
The attached patch is an alternate fix. This skips past offline cpus when
detecting last cpu, making no assumptions of the order of online/offline
cpu's.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: intr-cpus-present-online-alt.patch
Type: application/octet-stream
Size: 809 bytes
Desc: not available
URL: <http://xenomai.org/pipermail/xenomai/attachments/20150605/e388a27e/attachment.obj>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Xenomai] infinite loop/oops on cat /proc/xenomai/sched/stats when online cpus > present cpus
2015-06-05 15:30 ` Don Mahurin
@ 2015-06-09 18:24 ` Jan Kiszka
0 siblings, 0 replies; 3+ messages in thread
From: Jan Kiszka @ 2015-06-09 18:24 UTC (permalink / raw)
To: Don Mahurin, xenomai
On 2015-06-05 17:30, Don Mahurin wrote:
> On Thu, Jun 4, 2015 at 5:06 PM, Don Mahurin <don@mperpetuo.com> wrote:
>
>> In the function xnintr_query_next in kernel/cobalt/intr.c,
>>
>> The iterator proceeds to the next entry when the next cpu is nr_cpus.
>> where nr_cpus is set to num_online_cpus().
>>
>> if (cpu + 1 == nr_cpus)
>> iterator->prev = intr;
>> But if there are more cpus present than online, for the case for a timer
>> irq, this condition is never reached, as the following will cause cpu to be
>> reset to 0 if they are at the end of the list.
>>
>> for (cpu = iterator->cpu + 1; cpu < nr_cpus; ++cpu) {
>> if (cpu_online(cpu))
>> break;
>> }
>> if (cpu == nr_cpus)
>> cpu = 0;
>> In our case, we have 8 cpus present, and 4 online.
>>
>> For a timer irq, this will loop 0,1,2,3 repeatedly for the same irq.
>>
>> Can we safely replace 'num_present_cpus' with 'num_online_cpus'?
>>
>> Or do we need another way of detecting the last online cpu for the next
>> entry?
>>
>>
> The attached patch is an alternate fix. This skips past offline cpus when
> detecting last cpu, making no assumptions of the order of online/offline
> cpu's.
Note that Xenomai does not support hotplug for CPUs that are included in
its supported_cpus set. You have to exclude those CPUs by setting
xenomai.supported_cpus during boot accordingly. That should also resolve
the issue you have seen. Can you confirm this?
Jan
--
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-06-09 18:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-05 0:06 [Xenomai] infinite loop/oops on cat /proc/xenomai/sched/stats when online cpus > present cpus Don Mahurin
2015-06-05 15:30 ` Don Mahurin
2015-06-09 18:24 ` Jan Kiszka
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.