Message-ID: Date: Mon, 2 Jan 2006 20:43:05 +0200 From: Dmitry Adamushko In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_12011_21543055.1136227385479" References: <43B69CEC.1040606@domain.hid> Subject: [Xenomai-core] Re: [PATCH, RFC] nucleus:shared irq and possible ipipe problem List-Id: "Xenomai life and development \(bug reports, patches, discussions\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: xenomai@xenomai.org ------=_Part_12011_21543055.1136227385479 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline > > Nope, good spot, that could indeed happen in SMP configs. The code is > expected to shut the given interrupt source _before_ calling > rthal_irq_release(). But, the root of the problem is that > rthal_irq_release() doesn't make sure that all _pending_ IRQs from the > given kind are synchronized before processing. We need the equivalent of > Linux's synchronize_irq() here, and I would tend to implement this in > the Adeos layer directly, in ipipe_virtualize_irq() for the NULL handler > case, since it's a matter of general consistency. Yep, I thought about the analogue of Linux's synchronize_irq() too. I guess, what we need to provide is the guarantee that the "cookie" argumen= t (as well as a "handler") remains valid as long as there is a given irq handler in execution. i.e. o ipipe_virtualize_irq(THIS_IRQ, handler=3DNULL, cookie=3DNULL) call _remo= ves_ the IPIPE_HANDLE_FLAG so that new occurences of the THIS_IRQ is no more accepted for the given domain; o then ipipe_virtualize_irq is buzy waiting (ipipe_synchronize_irq() or smth like this) until the active ipd->irqs[THIS_IRQ].handler() is completed= . If there is not currently active handler we may drop all cpudata->irq_pending_hits for THIS_IRQ to zero. But ipipe_sync_stage() should check for IPIPE_HANDLE_FLAG then since this is a sign that a given irq is no more handled (even if there are some pending ones). o as a final step, ipd->irqs[THIS_IRQ].handler/cookie are set to zero. Ok, repeating myself, the main idea is to keep the "cookie" unchanged as long as the corresponding handler is active. This would partialy resolve th= e sync. problem I have got on the nucleus layer. err... I have to orginize some issues next few days so I'll be out of my notebook. Then I'll finilize the ipipe-irq-related patch so to be ready for the .01 version. -- Best regards, Dmitry Adamushko ------=_Part_12011_21543055.1136227385479 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline

Nope, good spot, that coul= d indeed happen in SMP configs. The code is
expected to shut the given interrupt source _before_ calling
rthal_irq_release(). But, the root of the problem is that
rthal_irq_= release() doesn't make sure that all _pending_ IRQs from the
given kind = are synchronized before processing. We need the equivalent of
Linux's sy= nchronize_irq() here, and I would tend to implement this in
the Adeos layer directly, in ipipe_virtualize_irq() for the NULL handle= r
case, since it's a matter of general consistency.
<= div>
Yep, I thought about the analogue of Linux's synchronize_irq() too.
I guess, what we need to provide is the guarantee that the "cookie&quo= t; argument (as well as a "handler") remains valid as long as there = is a given irq handler in execution.

i.e.

o  ipipe_virtualize_irq(THIS_IRQ, handler=3DNULL, cookie=3DNULL) call _removes_ the IPIPE_HANDLE_FLAG so that new occurences of the THIS_IRQ is no more accepted for the given domain;

o  then ipipe_virtualize_irq is buzy waiting (ipipe_synchronize_irq() or smth like this) until the active ipd->irqs[THIS_IRQ].handler() is completed.
If there is not currently active handler we may drop all cpudata->irq_pending_hits for THIS_IRQ to zero. But ipipe_sync_stage() should check for IPIPE_HANDLE_FLAG then since this is a sign that a given irq is no more handled (even if there are some pending ones).

o  as a final step, ipd->irqs[THIS_IRQ].handler/cookie are set to z= ero.
 
Ok, repeating myself, the main idea is to keep the "cookie" uncha= nged as long as the corresponding handler is active. This would partialy resolve the sync. problem I have got on the nucleus layer.

err... I have to orginize some issues next few days so I'll be out of my notebook. Then I'll finilize the ipipe-irq-related patch so to be ready for the .01 version.

--
Best regards,
Dmitry Adamushko

------=_Part_12011_21543055.1136227385479--