Potential problem with rt_eepro100
Quoted 37 lines · Jan Kiszka
Quoted 28 lines · Philippe Gerum
Quoted 6 lines · Gilles Chanteperdrix
Quoted 5 lines · Jan Kiszka
Quoted 5 lines
Quoted 5 lines
Anyway, after some thoughts, I think we are going to try and make the current situation work instead of going back to the old way.
You can find the patch which attempts to do so here:
http://sisyphus.hd.free.fr/~gilles/sched_status.txtQuoted 7 lines
Quoted 5 lines
Quoted 2 lines
Ack. At last, this addresses the real issues without asking for regression funkiness: fix the lack of barrier before testing XNSCHED in
Check the kernel, we actually need it on both sides. Wherever the final barriers will be, we should leave a comment behind why they are there. Could be picked up from
kernel/smp.c.We have it on both sides: the non-local flags are modified while holding the nklock. Unlocking the nklock implies a barrier.
I think we may have an issue with this kind of construct:
xnlock_get_irq*(&nklock)
xnpod_resume/suspend/whatever_thread() xnlock_get_irq*(&nklock) ... xnlock_put_irq*(&nklock) xnpod_schedule() xnlock_get_irq*(&nklock) send_ipi =====> xnpod_schedule_handler on dest CPU xnlock_put_irq*(&nklock)xnlock_put_irq*(&nklock)
Quoted 7 lines
The issue would be triggered by the use of recursive locking. In that case, the source CPU would only sync its cache when the lock is actually dropped by the outer xnlock_put_irq* call and the inner xnlock_get/put_irq* would not act as barriers, so the remote rescheduling handler won't always see the XNSCHED update done remotely, and may lead to a no-op. So we need a barrier before sending the IPI in
__xnpod_test_resched().
Quoted 3 lines
That's what I said.
And we need it on the reader side as an
rmb().
This one we have, in xnpod_schedule_handler.
Signature · 1 line
Gilles.
Quoted 38 lines · Gilles Chanteperdrix
Quoted 37 lines · Jan Kiszka
Quoted 35 lines · Philippe Gerum
Quoted 6 lines · Gilles Chanteperdrix
Quoted 5 lines · Jan Kiszka
Quoted 5 lines
Quoted 5 lines
Anyway, after some thoughts, I think we are going to try and make the current situation work instead of going back to the old way.
You can find the patch which attempts to do so here:
http://sisyphus.hd.free.fr/~gilles/sched_status.txtQuoted 7 lines
Quoted 5 lines
Quoted 2 lines
Ack. At last, this addresses the real issues without asking for regression funkiness: fix the lack of barrier before testing XNSCHED in
Check the kernel, we actually need it on both sides. Wherever the final barriers will be, we should leave a comment behind why they are there. Could be picked up from
kernel/smp.c.We have it on both sides: the non-local flags are modified while holding the nklock. Unlocking the nklock implies a barrier.
I think we may have an issue with this kind of construct:
xnlock_get_irq*(&nklock)
xnpod_resume/suspend/whatever_thread() xnlock_get_irq*(&nklock) ... xnlock_put_irq*(&nklock) xnpod_schedule() xnlock_get_irq*(&nklock) send_ipi =====> xnpod_schedule_handler on dest CPU xnlock_put_irq*(&nklock)xnlock_put_irq*(&nklock)
The issue would be triggered by the use of recursive locking. In that case, the source CPU would only sync its cache when the lock is actually dropped by the outer xnlock_put_irq* call and the inner xnlock_get/put_irq* would not act as barriers, so the remote rescheduling handler won't always see the XNSCHED update done remotely, and may lead to a no-op. So we need a barrier before sending the IPI in
__xnpod_test_resched().
Quoted 6 lines
Quoted 3 lines
That's what I said.
And we need it on the reader side as an
rmb().This one we have, in
xnpod_schedule_handler.
Right, with your patch (the above sounded like we only need it on writer side).
Jan
Quoted 41 lines · Jan Kiszka
Quoted 40 lines · Gilles Chanteperdrix
Quoted 39 lines · Jan Kiszka
Quoted 28 lines · Philippe Gerum
Quoted 6 lines · Gilles Chanteperdrix
Quoted 5 lines · Jan Kiszka
Quoted 5 lines
Quoted 5 lines
Anyway, after some thoughts, I think we are going to try and make the current situation work instead of going back to the old way.
You can find the patch which attempts to do so here:
http://sisyphus.hd.free.fr/~gilles/sched_status.txtQuoted 7 lines
Quoted 5 lines
Quoted 2 lines
Ack. At last, this addresses the real issues without asking for regression funkiness: fix the lack of barrier before testing XNSCHED in
Check the kernel, we actually need it on both sides. Wherever the final barriers will be, we should leave a comment behind why they are there. Could be picked up from
kernel/smp.c.We have it on both sides: the non-local flags are modified while holding the nklock. Unlocking the nklock implies a barrier.
I think we may have an issue with this kind of construct:
xnlock_get_irq*(&nklock)
xnpod_resume/suspend/whatever_thread() xnlock_get_irq*(&nklock) ... xnlock_put_irq*(&nklock) xnpod_schedule() xnlock_get_irq*(&nklock) send_ipi =====> xnpod_schedule_handler on dest CPU xnlock_put_irq*(&nklock)xnlock_put_irq*(&nklock)
Quoted 7 lines
The issue would be triggered by the use of recursive locking. In that case, the source CPU would only sync its cache when the lock is actually dropped by the outer xnlock_put_irq* call and the inner xnlock_get/put_irq* would not act as barriers, so the remote rescheduling handler won't always see the XNSCHED update done remotely, and may lead to a no-op. So we need a barrier before sending the IPI in
__xnpod_test_resched().That's what I said.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
And we need it on the reader side as an
rmb().This one we have, in
xnpod_schedule_handler.Right, with your patch (the above sounded like we only need it on writer side).
C'mon...
Signature · 1 line
Philippe.
Quoted 12 lines · Jan Kiszka
I just hope we finally converge over a solution. Looks like all possibilities have been explored now. A few more comments on this one:
It probably makes sense to group the status bits accordingly (both their values and definitions) and briefly document on which status field they are supposed to be applied.
I do not understand the split logic - or some bits are simply not yet migrated. XNHDEFER, XNSWLOCK, XNKCOUT are all local-only as well, no? Then better put them in the _local_ status field, that's more consistent (and would help if we once wanted to optimize their cache line usage).
Quoted 6 lines
The naming is unfortunate: status vs. lstatus. This is asking for confusion and typos. They must be better distinguishable, e.g.
local_status. Or we need accessors that have debug checks built in, catching wrong bits for their target fields.Good catch of the RPI breakage, Gilles!
Hi Jan,
I just pushed a modified version of this patch, including your remarks as well as the ones of Philippe. I suspect some of the cleanup patches you sent still make sense over this patch, would it be possible to rebase them over this pushed version?
TIA,
Signature · 1 line
Gilles.
Quoted 18 lines · Gilles Chanteperdrix
Quoted 17 lines · Jan Kiszka
I just hope we finally converge over a solution. Looks like all possibilities have been explored now. A few more comments on this one:
It probably makes sense to group the status bits accordingly (both their values and definitions) and briefly document on which status field they are supposed to be applied.
I do not understand the split logic - or some bits are simply not yet migrated. XNHDEFER, XNSWLOCK, XNKCOUT are all local-only as well, no? Then better put them in the _local_ status field, that's more consistent (and would help if we once wanted to optimize their cache line usage).
The naming is unfortunate: status vs. lstatus. This is asking for confusion and typos. They must be better distinguishable, e.g.
local_status. Or we need accessors that have debug checks built in, catching wrong bits for their target fields.
Quoted 8 lines
Quoted 1 line
Good catch of the RPI breakage, Gilles!
Hi Jan,
I just pushed a modified version of this patch, including your remarks as well as the ones of Philippe. I suspect some of the cleanup patches you sent still make sense over this patch, would it be possible to rebase them over this pushed version?
Just rebased and pushed my queue. One additional optimization was added ("Optimize setting of XNRESCHED"), basic tests passed.
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux
Quoted 22 lines · Jan Kiszka
Quoted 21 lines · Gilles Chanteperdrix
Quoted 12 lines · Jan Kiszka
I just hope we finally converge over a solution. Looks like all possibilities have been explored now. A few more comments on this one:
It probably makes sense to group the status bits accordingly (both their values and definitions) and briefly document on which status field they are supposed to be applied.
I do not understand the split logic - or some bits are simply not yet migrated. XNHDEFER, XNSWLOCK, XNKCOUT are all local-only as well, no? Then better put them in the _local_ status field, that's more consistent (and would help if we once wanted to optimize their cache line usage).
Quoted 6 lines
The naming is unfortunate: status vs. lstatus. This is asking for confusion and typos. They must be better distinguishable, e.g.
local_status. Or we need accessors that have debug checks built in, catching wrong bits for their target fields.Good catch of the RPI breakage, Gilles!
Hi Jan,
Quoted 7 lines
Quoted 4 lines
I just pushed a modified version of this patch, including your remarks as well as the ones of Philippe. I suspect some of the cleanup patches you sent still make sense over this patch, would it be possible to rebase them over this pushed version?
Just rebased and pushed my queue. One additional optimization was added ("Optimize setting of XNRESCHED"), basic tests passed.
Ah, I thought about this one, I wonder why I forgot it. Merged, thanks.
Signature · 1 line
Gilles.