* [Xenomai-help] Kernel access of bad area with rtdm_event_wait() (MPC8347)
@ 2008-02-21 14:58 Perrine Martignoni
2008-02-21 15:23 ` Jan Kiszka
0 siblings, 1 reply; 3+ messages in thread
From: Perrine Martignoni @ 2008-02-21 14:58 UTC (permalink / raw)
To: xenomai-help
[-- Attachment #1: Type: text/plain, Size: 3248 bytes --]
Hello,
I work on a MPC8347 processor and I found out a problem with
rtdm_event_wait(). I reproduce the problem with a simple code :
*driver.c* :
#include <rtdm/rtdm_driver.h>
MODULE_AUTHOR("P.Martignoni");
MODULE_LICENSE("GPL");
#define DEV_FILE_NAME "DspDev"
#define DRV_NAME "DspDrv"
#define DEV_FILE_DSP "dspdev0"
static rtdm_event_t s_ReadEvent;
static int Open(struct rtdm_dev_context *p_Context,
rtdm_user_info_t *p_UserInfo,
int Oflags)
{
int ret = 0;
rtdm_event_init(&s_ReadEvent,0);
// generates an error : Oops : Kernel access of bad area, sig : 11 [#1]
rtdm_event_wait(&s_ReadEvent);
return ret;
}
static int Close(struct rtdm_dev_context *p_Context,
rtdm_user_info_t *p_UserInfo)
{
rtdm_event_destroy(&s_ReadEvent);
return 0;
}
/*****************************************************/
/* Structures rtdm_device */
/*****************************************************/
static struct rtdm_device t_IdspDevice = {
struct_version: RTDM_DEVICE_STRUCT_VER,
device_flags: RTDM_NAMED_DEVICE,
context_size: 0,
device_name: DEV_FILE_DSP,
open_rt: NULL,
open_nrt: Open,
ops:{
close_rt: NULL,
close_nrt: Close,
ioctl_rt: NULL,
ioctl_nrt: NULL,
read_rt: NULL,
read_nrt: NULL,
write_rt: NULL,
write_rt: NULL,
recvmsg_rt: NULL,
recvmsg_nrt:NULL,
sendmsg_rt: NULL,
sendmsg_nrt:NULL,
},
device_class: RTDM_CLASS_EXPERIMENTAL,
device_sub_class: 222,
driver_name: DRV_NAME,
peripheral_name: DEV_FILE_NAME,
provider_name: "-",
proc_name: t_IdspDevice.device_name,
};
/**************************************/
/* Init Driver */
/**************************************/
static int ddsp_Init(void)
{
if(rtdm_dev_register(&t_IdspDevice)!=0)
rtdm_printk("Enregistrement impossible\n");
else
rtdm_printk("Initialisation OK\n");
return 0;
}
/*************************************/
/* Exit Driver */
/*************************************/
static void ddsp_Exit(void)
{
if(rtdm_dev_unregister(&t_IdspDevice,0))
rtdm_printk("Desabonnement KO\n");
else
rtdm_printk("Desabonnement OK\n");
}
module_init(ddsp_Init);
module_exit(ddsp_Exit);
*App.c* :
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include <sys/mman.h>
#include <native/task.h>
#define DEV_FILE_DSP "dspdev0"
#define TASK_PRIO 50
static RT_TASK s_TaskTest;
int main(int argc, char * argv[])
{
int ret = 0;
mlockall(MCL_CURRENT | MCL_FUTURE);
// set the currrent task in rt mode
ret = rt_task_shadow(&s_TaskTest,NULL,1,0);
rt_dev_open(DEV_FILE_DSP, 0);
return ret;
}
When I launch this code, I have this error : *Oops : Kernel access of bad
area, sig 11 [#1]
*I notice that if the rtdm_event_wait() is called in a kernel task, there is
no problem.
Have you any idea for my issue ?
Thanks in advance.
[-- Attachment #2: Type: text/html, Size: 6500 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Xenomai-help] Kernel access of bad area with rtdm_event_wait() (MPC8347)
2008-02-21 14:58 [Xenomai-help] Kernel access of bad area with rtdm_event_wait() (MPC8347) Perrine Martignoni
@ 2008-02-21 15:23 ` Jan Kiszka
2008-02-22 7:58 ` Perrine Martignoni
0 siblings, 1 reply; 3+ messages in thread
From: Jan Kiszka @ 2008-02-21 15:23 UTC (permalink / raw)
To: Perrine Martignoni; +Cc: xenomai-help
Perrine Martignoni wrote:
> Hello,
>
> I work on a MPC8347 processor and I found out a problem with
> rtdm_event_wait(). I reproduce the problem with a simple code :
>
> *driver.c* :
> #include <rtdm/rtdm_driver.h>
>
> MODULE_AUTHOR("P.Martignoni");
> MODULE_LICENSE("GPL");
>
> #define DEV_FILE_NAME "DspDev"
> #define DRV_NAME "DspDrv"
>
> #define DEV_FILE_DSP "dspdev0"
>
> static rtdm_event_t s_ReadEvent;
>
> static int Open(struct rtdm_dev_context *p_Context,
> rtdm_user_info_t *p_UserInfo,
> int Oflags)
> {
> int ret = 0;
>
> rtdm_event_init(&s_ReadEvent,0);
>
> // generates an error : Oops : Kernel access of bad area, sig : 11 [#1]
> rtdm_event_wait(&s_ReadEvent);
General advice: switch on XENO_OPT_DEBUG_RTDM (and IPIPE_DEBUG_CONTEXT)
to catch service invocations from a wrong context, like here.
Your mistake: calling a blocking Xenomai services from non-rt context
(see your registration of Open in t_IdspDevice).
Jan
--
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Xenomai-help] Kernel access of bad area with rtdm_event_wait() (MPC8347)
2008-02-21 15:23 ` Jan Kiszka
@ 2008-02-22 7:58 ` Perrine Martignoni
0 siblings, 0 replies; 3+ messages in thread
From: Perrine Martignoni @ 2008-02-22 7:58 UTC (permalink / raw)
To: xenomai-help
[-- Attachment #1: Type: text/plain, Size: 1522 bytes --]
Indeed, I have bad reproduced the problem in the code I suggest to you. But
your remark makes me understand that I was in secondary mode and I never
switched to primary mode so ....
My issue is understood and solved.
Thanks
On Thu, Feb 21, 2008 at 4:23 PM, Jan Kiszka <jan.kiszka@domain.hid> wrote:
> Perrine Martignoni wrote:
> > Hello,
> >
> > I work on a MPC8347 processor and I found out a problem with
> > rtdm_event_wait(). I reproduce the problem with a simple code :
> >
> > *driver.c* :
> > #include <rtdm/rtdm_driver.h>
> >
> > MODULE_AUTHOR("P.Martignoni");
> > MODULE_LICENSE("GPL");
> >
> > #define DEV_FILE_NAME "DspDev"
> > #define DRV_NAME "DspDrv"
> >
> > #define DEV_FILE_DSP "dspdev0"
> >
> > static rtdm_event_t s_ReadEvent;
> >
> > static int Open(struct rtdm_dev_context *p_Context,
> > rtdm_user_info_t *p_UserInfo,
> > int Oflags)
> > {
> > int ret = 0;
> >
> > rtdm_event_init(&s_ReadEvent,0);
> >
> > // generates an error : Oops : Kernel access of bad area, sig : 11
> [#1]
> > rtdm_event_wait(&s_ReadEvent);
>
> General advice: switch on XENO_OPT_DEBUG_RTDM (and IPIPE_DEBUG_CONTEXT)
> to catch service invocations from a wrong context, like here.
>
> Your mistake: calling a blocking Xenomai services from non-rt context
> (see your registration of Open in t_IdspDevice).
>
> Jan
>
> --
> Siemens AG, Corporate Technology, CT SE 2
> Corporate Competence Center Embedded Linux
>
[-- Attachment #2: Type: text/html, Size: 2345 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-02-22 7:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-21 14:58 [Xenomai-help] Kernel access of bad area with rtdm_event_wait() (MPC8347) Perrine Martignoni
2008-02-21 15:23 ` Jan Kiszka
2008-02-22 7:58 ` Perrine Martignoni
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.