From: Philippe Gerum <rpm@xenomai.org>
To: "François Legal" <devel@thom.fr.eu.org>
Cc: "Julien Aube" <julien.aube@smile.fr>, xenomai@xenomai.org
Subject: Re: Switching from xenomai 3.2 IPIPE to xenomai 3.3 Dovetail
Date: Tue, 19 Nov 2024 17:10:16 +0100 [thread overview]
Message-ID: <87ed37dx1z.fsf@xenomai.org> (raw)
In-Reply-To: <87jzcze0hx.fsf@xenomai.org> (Philippe Gerum's message of "Tue, 19 Nov 2024 15:55:54 +0100")
Philippe Gerum <rpm@xenomai.org> writes:
> François Legal <devel@thom.fr.eu.org> writes:
>
>> Le Mardi, Novembre 19, 2024 11:23 CET, Philippe Gerum <rpm@xenomai.org> a écrit:
>>
>>> François Legal <francois.legal@thom.fr.eu.org> writes:
>>>
>>> > Le Mardi, Novembre 19, 2024 10:26 CET, Julien Aube <julien.aube@smile.fr> a écrit:
>>> >
>>> >> Hello,
>>> >>
>>> >> Reading this exchange it reminds me of a problem I had a few months ago
>>> >> on the same platform.
>>> >>
>>> >> Here is the thead :
>>> >>
>>> >> https://lore.kernel.org/xenomai/6814fa90-015e-91df-6941-db643e4d4229@smile.fr/#r
>>> >>
>>> >>
>>> >> Conclusion was that disabling the scutimer(*) on DTS level was enough to
>>> >> restore the correct usage and I did not found
>>> >> any bad behaviour after that. The product has passed all the rt-test
>>> >> afterward.
>>> >>
>>> >>
>>> >> (*)
>>> >> &scutimer {
>>> >> /* scutimer is forced to disabled since it does not work with
>>> >> Xenomai */
>>> >> status = "disabled";
>>> >> };
>>> >>
>>> >> Maybe i'm completely off the subject, but maybe it's worth having a look ?
>>> >>
>>> >> Julien
>>> >>
>>> >>
>>> >
>>> > Thanks. That fixes the problem. I'll dig into that driver to try to fix it and submit a patch then.
>>> >
>>>
>>> This may help:
>>>
>>> diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c
>>> index 8377f1d030c3a..a28f6b7f7eabc 100644
>>> --- a/arch/arm/kernel/smp_twd.c
>>> +++ b/arch/arm/kernel/smp_twd.c
>>> @@ -181,7 +181,7 @@ static irqreturn_t twd_handler(int irq, void *dev_id)
>>> {
>>> struct clock_event_device *evt = dev_id;
>>>
>>> - if (twd_timer_ack()) {
>>> + if (!clockevent_is_oob(evt) || twd_timer_ack()) {
>>> clockevents_handle_event(evt);
>>> return IRQ_HANDLED;
>>> }
>>>
>>
>> No noticeable effect here. I tried to dig a little more into this, but I can't find anything.
>> What I can tell, is that the TWD interrupts triggers on both cores when hung at boot. TWD registers settings seems OK in terms of prescaler and everything. By checking with JTAG debugger, I can see that xnintr_core_clock_handler is being called in the TWD service routine (twd_handler).
>>
>> I'm trying a little harder, but don't really know from which angle !
>
> The issue is as follows:
>
> When the proxy tick hijacks the timer to hand over its control to
> Xenomai, twd_handler() may be called either from the oob stage upon a
> real tick coming from the hardware, _and_ from the in-band stage as a
> consequence of emulating a common kernel tick, see [1] in the "Under the
> hood" section.
>
> The way twd_handler() operates ATM causes the hardware to be sent an ack
> on every invocation, which is wrong wrt the in-band tick emulation,
> which is most likely wrecking the logic afterwards.
>
> [1] https://v4.xenomai.org/dovetail/porting/timer/#proxy-tick-logic
diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c
index 8377f1d030c3a..194d3cc7ca2c8 100644
--- a/arch/arm/kernel/smp_twd.c
+++ b/arch/arm/kernel/smp_twd.c
@@ -181,7 +181,7 @@ static irqreturn_t twd_handler(int irq, void *dev_id)
{
struct clock_event_device *evt = dev_id;
- if (twd_timer_ack()) {
+ if ((running_inband() && clockevent_is_oob(evt)) || twd_timer_ack()) {
clockevents_handle_event(evt);
return IRQ_HANDLED;
}
--
Philippe.
next prev parent reply other threads:[~2024-11-19 16:10 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-18 8:50 Switching from xenomai 3.2 IPIPE to xenomai 3.3 Dovetail François Legal
2024-11-18 9:01 ` Jan Kiszka
2024-11-18 10:21 ` François Legal
2024-11-18 10:32 ` Florian Bezdeka
2024-11-18 11:18 ` François Legal
2024-11-18 11:37 ` Philippe Gerum
2024-11-18 12:06 ` Florian Bezdeka
2024-11-18 13:21 ` François Legal
2024-11-18 13:37 ` Philippe Gerum
2024-11-18 13:57 ` Florian Bezdeka
2024-11-18 14:49 ` Philippe Gerum
2024-11-18 15:22 ` François Legal
2024-11-18 15:33 ` Philippe Gerum
2024-11-19 7:26 ` François Legal
2024-11-19 9:26 ` Julien Aube
2024-11-19 10:06 ` François Legal
2024-11-19 10:23 ` Philippe Gerum
2024-11-19 14:30 ` Philippe Gerum
2024-11-19 14:36 ` François Legal
2024-11-19 14:55 ` Philippe Gerum
2024-11-19 16:10 ` Philippe Gerum [this message]
2024-11-19 17:04 ` François Legal
2024-11-18 13:38 ` François Legal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ed37dx1z.fsf@xenomai.org \
--to=rpm@xenomai.org \
--cc=devel@thom.fr.eu.org \
--cc=julien.aube@smile.fr \
--cc=xenomai@xenomai.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.