* [Xenomai-help] System hangs in/after rtdm_lock_put_irqrestore
@ 2007-08-29 14:34 Axel Beierlein
2007-08-29 14:42 ` Jan Kiszka
0 siblings, 1 reply; 5+ messages in thread
From: Axel Beierlein @ 2007-08-29 14:34 UTC (permalink / raw)
To: Xenomai-help@domain.hid
what could it be that an simple rt_dev_open locks up my system when it
calls rtdm_lock_put_irqrestore?
[...]
if (rtdm_irq_request(&ctx->irq_handle,
MPC5xxx_PSC2_IRQ,
rt_psc_interrupt,
RTDM_IRQTYPE_SHARED | RTDM_IRQTYPE_EDGE,
context->device->proc_name,
ctx))
{
printk ("psc5200B.c: request_irq() failed\n");
return -1;
}
rtdm_irq_enable(&ctx->irq_handle);
rtdm_lock_get_irqsave(&ctx->lock, lock_ctx);
ctx->imr_status = MPC5xxx_PSC_IMR_RXRDY;
out_be16(&psc->mpc5xxx_psc_imr, ctx->imr_status);
rtdm_lock_put_irqrestore(&ctx->lock, lock_ctx);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Here i get the crash
The test prog is a simple
fd=rt_dev_open("nameofdevice",0)......rt_dev_close(fd).
Axel
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [Xenomai-help] System hangs in/after rtdm_lock_put_irqrestore 2007-08-29 14:34 [Xenomai-help] System hangs in/after rtdm_lock_put_irqrestore Axel Beierlein @ 2007-08-29 14:42 ` Jan Kiszka [not found] ` <op.txuzl2o9t06gyn@domain.hid> 0 siblings, 1 reply; 5+ messages in thread From: Jan Kiszka @ 2007-08-29 14:42 UTC (permalink / raw) To: Axel Beierlein; +Cc: Xenomai-help@domain.hid [-- Attachment #1: Type: text/plain, Size: 1038 bytes --] Axel Beierlein wrote: > what could it be that an simple rt_dev_open locks up my system when it > calls rtdm_lock_put_irqrestore? > > [...] > if (rtdm_irq_request(&ctx->irq_handle, > MPC5xxx_PSC2_IRQ, > rt_psc_interrupt, > RTDM_IRQTYPE_SHARED | RTDM_IRQTYPE_EDGE, > context->device->proc_name, > ctx)) > { > printk ("psc5200B.c: request_irq() failed\n"); > return -1; > } > > rtdm_irq_enable(&ctx->irq_handle); > > rtdm_lock_get_irqsave(&ctx->lock, lock_ctx); > > ctx->imr_status = MPC5xxx_PSC_IMR_RXRDY; > out_be16(&psc->mpc5xxx_psc_imr, ctx->imr_status); Let me guess: this line arms the related IRQ source at hw level, no? > > rtdm_lock_put_irqrestore(&ctx->lock, lock_ctx); > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > Here i get the crash Because it enabled local IRQ delivery again, and the system ends up in an IRQ storm, or some endless loop in the IRQ handler, or some crash related to IRQ handling. Still just guessing... Jan [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 250 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <op.txuzl2o9t06gyn@domain.hid>]
* Re: [Xenomai-help] System hangs in/after rtdm_lock_put_irqrestore [not found] ` <op.txuzl2o9t06gyn@domain.hid> @ 2007-08-30 6:55 ` Jan Kiszka 2007-08-30 8:36 ` Axel Beierlein 0 siblings, 1 reply; 5+ messages in thread From: Jan Kiszka @ 2007-08-30 6:55 UTC (permalink / raw) To: Axel Beierlein; +Cc: Xenomai [-- Attachment #1: Type: text/plain, Size: 2093 bytes --] Axel Beierlein wrote: > Am 29.08.2007, 16:42 Uhr, schrieb Jan Kiszka <jan.kiszka@domain.hid>: > >> Axel Beierlein wrote: >>> what could it be that an simple rt_dev_open locks up my system when it >>> calls rtdm_lock_put_irqrestore? >>> >>> [...] >>> if (rtdm_irq_request(&ctx->irq_handle, >>> MPC5xxx_PSC2_IRQ, >>> rt_psc_interrupt, >>> RTDM_IRQTYPE_SHARED | RTDM_IRQTYPE_EDGE, >>> context->device->proc_name, >>> ctx)) >>> { >>> printk ("psc5200B.c: request_irq() failed\n"); >>> return -1; >>> } >>> >>> rtdm_irq_enable(&ctx->irq_handle); >>> >>> rtdm_lock_get_irqsave(&ctx->lock, lock_ctx); >>> >>> ctx->imr_status = MPC5xxx_PSC_IMR_RXRDY; >>> out_be16(&psc->mpc5xxx_psc_imr, ctx->imr_status); >> >> Let me guess: this line arms the related IRQ source at hw level, no? >> > > Yes you are right. This Bit enables the RX_Ready IRQ at hw level. Sorry > for the little Code fragment but the code relates to your 16550A.c and i > don´t want to post all the routines at the moment. > >>> >>> rtdm_lock_put_irqrestore(&ctx->lock, lock_ctx); >>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >>> Here i get the crash >> >> Because it enabled local IRQ delivery again, and the system ends up in >> an IRQ storm, or some endless loop in the IRQ handler, or some crash >> related to IRQ handling. Still just guessing... >> >> Jan >> > > But how your UART driver handle this Problem? I have check the Irq > Handler an implement an printk in it to see where it hangs, but it > doesn´t step into this handler. In case you have an IRQ storm or your handler runs in an endless loop, you won't be able to read that printk even if it's executed - Linux will have no chance to dump the message. Start debugging with shrinking the handler down to a plain "return RTDM_IRQ_HANDLED" (or even RTDM_IRQ_NONE so that Xenomai disables the line), then slowly re-enabling and reviewing your code. Jan PS: reply-to-all [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 250 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Xenomai-help] System hangs in/after rtdm_lock_put_irqrestore 2007-08-30 6:55 ` Jan Kiszka @ 2007-08-30 8:36 ` Axel Beierlein 2007-08-30 8:58 ` Jan Kiszka 0 siblings, 1 reply; 5+ messages in thread From: Axel Beierlein @ 2007-08-30 8:36 UTC (permalink / raw) To: Jan Kiszka; +Cc: Xenomai Am 30.08.2007, 08:55 Uhr, schrieb Jan Kiszka <jan.kiszka@domain.hid>: > Axel Beierlein wrote: >> Am 29.08.2007, 16:42 Uhr, schrieb Jan Kiszka <jan.kiszka@domain.hid>: >> >>> Axel Beierlein wrote: >>>> what could it be that an simple rt_dev_open locks up my system when it >>>> calls rtdm_lock_put_irqrestore? >>>> >>>> [...] >>>> if (rtdm_irq_request(&ctx->irq_handle, >>>> MPC5xxx_PSC2_IRQ, >>>> rt_psc_interrupt, >>>> RTDM_IRQTYPE_SHARED | RTDM_IRQTYPE_EDGE, >>>> context->device->proc_name, >>>> ctx)) >>>> { >>>> printk ("psc5200B.c: request_irq() failed\n"); >>>> return -1; >>>> } >>>> >>>> rtdm_irq_enable(&ctx->irq_handle); >>>> >>>> rtdm_lock_get_irqsave(&ctx->lock, lock_ctx); >>>> >>>> ctx->imr_status = MPC5xxx_PSC_IMR_RXRDY; >>>> out_be16(&psc->mpc5xxx_psc_imr, ctx->imr_status); >>> >>> Let me guess: this line arms the related IRQ source at hw level, no? >>> >> >> Yes you are right. This Bit enables the RX_Ready IRQ at hw level. Sorry >> for the little Code fragment but the code relates to your 16550A.c and i >> don´t want to post all the routines at the moment. >> >>>> >>>> rtdm_lock_put_irqrestore(&ctx->lock, lock_ctx); >>>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >>>> Here i get the crash >>> >>> Because it enabled local IRQ delivery again, and the system ends up in >>> an IRQ storm, or some endless loop in the IRQ handler, or some crash >>> related to IRQ handling. Still just guessing... >>> >>> Jan >>> >> >> But how your UART driver handle this Problem? I have check the Irq >> Handler an implement an printk in it to see where it hangs, but it >> doesn´t step into this handler. > > In case you have an IRQ storm or your handler runs in an endless loop, > you won't be able to read that printk even if it's executed - Linux will > have no chance to dump the message. > > Start debugging with shrinking the handler down to a plain "return > RTDM_IRQ_HANDLED" (or even RTDM_IRQ_NONE so that Xenomai disables the > line), then slowly re-enabling and reviewing your code. That has no effect. It doesn´t step into it. I think there is another Problem, cause when i go back to the userspace applikation after i have opened the device the system locks up when i call a funktion like getchar() Just in following dev_open and dev_close is workin for only one time. But when i call the same applikation a second time it locks up in the rt_open routine at rtdm_lock_put_irqrestore. > > Jan > > PS: reply-to-all Ups, wrong button. Now i know why my message doesn´t appear in the mailing list ;-) Axel ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Xenomai-help] System hangs in/after rtdm_lock_put_irqrestore 2007-08-30 8:36 ` Axel Beierlein @ 2007-08-30 8:58 ` Jan Kiszka 0 siblings, 0 replies; 5+ messages in thread From: Jan Kiszka @ 2007-08-30 8:58 UTC (permalink / raw) To: Axel Beierlein; +Cc: Xenomai [-- Attachment #1: Type: text/plain, Size: 2931 bytes --] Axel Beierlein wrote: > Am 30.08.2007, 08:55 Uhr, schrieb Jan Kiszka <jan.kiszka@domain.hid>: > >> Axel Beierlein wrote: >>> Am 29.08.2007, 16:42 Uhr, schrieb Jan Kiszka <jan.kiszka@domain.hid>: >>> >>>> Axel Beierlein wrote: >>>>> what could it be that an simple rt_dev_open locks up my system when it >>>>> calls rtdm_lock_put_irqrestore? >>>>> >>>>> [...] >>>>> if (rtdm_irq_request(&ctx->irq_handle, >>>>> MPC5xxx_PSC2_IRQ, >>>>> rt_psc_interrupt, >>>>> RTDM_IRQTYPE_SHARED | RTDM_IRQTYPE_EDGE, >>>>> context->device->proc_name, >>>>> ctx)) >>>>> { >>>>> printk ("psc5200B.c: request_irq() failed\n"); >>>>> return -1; >>>>> } >>>>> >>>>> rtdm_irq_enable(&ctx->irq_handle); >>>>> >>>>> rtdm_lock_get_irqsave(&ctx->lock, lock_ctx); >>>>> >>>>> ctx->imr_status = MPC5xxx_PSC_IMR_RXRDY; >>>>> out_be16(&psc->mpc5xxx_psc_imr, ctx->imr_status); >>>> >>>> Let me guess: this line arms the related IRQ source at hw level, no? >>>> >>> >>> Yes you are right. This Bit enables the RX_Ready IRQ at hw level. Sorry >>> for the little Code fragment but the code relates to your 16550A.c and i >>> don´t want to post all the routines at the moment. >>> >>>>> >>>>> rtdm_lock_put_irqrestore(&ctx->lock, lock_ctx); >>>>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >>>>> Here i get the crash >>>> >>>> Because it enabled local IRQ delivery again, and the system ends up in >>>> an IRQ storm, or some endless loop in the IRQ handler, or some crash >>>> related to IRQ handling. Still just guessing... >>>> >>>> Jan >>>> >>> >>> But how your UART driver handle this Problem? I have check the Irq >>> Handler an implement an printk in it to see where it hangs, but it >>> doesn´t step into this handler. >> >> In case you have an IRQ storm or your handler runs in an endless loop, >> you won't be able to read that printk even if it's executed - Linux will >> have no chance to dump the message. >> >> Start debugging with shrinking the handler down to a plain "return >> RTDM_IRQ_HANDLED" (or even RTDM_IRQ_NONE so that Xenomai disables the >> line), then slowly re-enabling and reviewing your code. > > That has no effect. It doesn´t step into it. > I think there is another Problem, cause when i go back to the userspace > applikation after i have opened the device the system locks up when i > call a funktion like getchar() > Just in following dev_open and dev_close is workin for only one time. > But when i call the same applikation a second time it locks up in the > rt_open routine at rtdm_lock_put_irqrestore. Something must be very wrong. Do you register the correct IRQ line / modify the right hw registers? Also, don't you have some hardware debugger at hand to find out where the system goes to, what IRQs show up? Jan [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 250 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-08-30 8:58 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-29 14:34 [Xenomai-help] System hangs in/after rtdm_lock_put_irqrestore Axel Beierlein
2007-08-29 14:42 ` Jan Kiszka
[not found] ` <op.txuzl2o9t06gyn@domain.hid>
2007-08-30 6:55 ` Jan Kiszka
2007-08-30 8:36 ` Axel Beierlein
2007-08-30 8:58 ` 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.