How to hook a context switch??

From: Gromer (osIndgy_at_gmail.com)
Date: 10/22/05

  • Next message: NonDeterministic: "can't load own simple module :("
    Date: 22 Oct 2005 02:00:55 -0700
    
    

    Hi,

    I have one issue and would like to get some expert advise from the
    group. The below shown code snippet gives some idea about the scenario.
    I have basically one function (func_1) which does a wake_up after
    processing some information. Once the wake_up is executed the system
    crashes.

    So to debug this, i've put printks after the add_wait_queue() and
    schedule function to capture the functions that gets executed with a
    wake_up... but for no help.. Im unable to find the thread which gets
    executed after the wake_up.

    I'm wondering how to capture or debug which thread/function gets the
    CPU when this wake_up has been executed... Any pointer would be highly
    appreciable.

    How is such a situation usually debugged?? Can such a context switching
    be hooked..

    /* Wait on here when we're waiting device to be ready */
    wait_queue_head_t waitDev;

    void func_1( struct func_arg*)
    {

     /*..Do some useful work */

            wake_up(&waitDev); /* crash occurs here */
    }

    int sec_func (struct func_arg2 *)
    {

         /* some processing work done here */
                ....
                 ..
            set_current_state(TASK_UNINTERRUPTIBLE);
            add_wait_queue(&waitDev, &wait);
            spin_unlock(mutex);
            schedule();
            remove_wait_queue(&waitDev, &wait);
            spin_lock(chip->mutex);

          /* some more work is being done here */

    }

    Thanks in Advance,
    Gromer


  • Next message: NonDeterministic: "can't load own simple module :("

    Relevant Pages

    • How to hook a context switch??
      ... The below shown code snippet gives some idea about the scenario. ... I'm wondering how to capture or debug which thread/function gets the ...
      (comp.os.linux.embedded)
    • Re: Cant registe in "Audio Capture Sources" folder
      ... > First of all use debug version of DX and check output of sysadio driver. ... Also check pin names; ... > capture pin should have PINNAME_CAPTURE category and name. ... Hi IVS: ...
      (microsoft.public.development.device.drivers)
    • Re: Problem with unbuffered IO over network
      ... In this scenario, we hope you can provide us a simplified sample so that we ... could debug it on our machine. ... (This posting is provided "AS IS", with no warranties, and confers no ...
      (microsoft.public.win32.programmer.networks)
    • Re: OT: China converting coal to methane..
      ... The same applies to the coal_plan_electric_car scenario for carbon ... capture. ... What makes you think CHINA is going to clean up their emissions? ...
      (sci.electronics.design)
    • RE: application fails with c0000354
      ... did Mark's suggestion hit it? ... What's the scenario of your problem, does this problem happen on other ... platforms, do you have debug this program to find out the call stack info ...
      (microsoft.public.vc.mfc)