Analyzers
Talk to fellow users of Intel Analyzer tools (Intel VTune™ Profiler, Intel Advisor)
4995 Discussions

build driver failed with probe_cpu_idle

Jenny_Z_
Beginner
339 Views

Hi,

After installing vtune_aplifier_xe_2013, I tried to build driver.

cd /opt/intel/vtune_amplifier_xe_2013/powerdk/src

./build_driver

In file included from /opt/intel/vtune_amplifier_xe_2013/powerdk/src/src/apwr_driver.c:109:
include/trace/events/workqueue.h:37: warning: âstruct cpu_workqueue_structâ declared inside parameter list
include/trace/events/workqueue.h:37: warning: its scope is only this definition or declaration, which is probably not what you want
include/trace/events/workqueue.h:37: warning: âstruct cpu_workqueue_structâ declared inside parameter list
include/trace/events/workqueue.h:37: warning: âstruct cpu_workqueue_structâ declared inside parameter list
include/trace/events/workqueue.h:37: warning: âstruct cpu_workqueue_structâ declared inside parameter list
/opt/intel/vtune_amplifier_xe_2013/powerdk/src/src/apwr_driver.c: In function âregister_non_pausable_probesâ:
/opt/intel/vtune_amplifier_xe_2013/powerdk/src/src/apwr_driver.c:4954: error: âprobe_cpu_idleâ undeclared (first use in this function)
/opt/intel/vtune_amplifier_xe_2013/powerdk/src/src/apwr_driver.c:4954: error: (Each undeclared identifier is reported only once
/opt/intel/vtune_amplifier_xe_2013/powerdk/src/src/apwr_driver.c:4954: error: for each function it appears in.)
/opt/intel/vtune_amplifier_xe_2013/powerdk/src/src/apwr_driver.c: In function âunregister_non_pausable_probesâ:
/opt/intel/vtune_amplifier_xe_2013/powerdk/src/src/apwr_driver.c:5046: error: âprobe_cpu_idleâ undeclared (first use in this function)
/opt/intel/vtune_amplifier_xe_2013/powerdk/src/src/apwr_driver.c: In function âpw_alrm_suspend_notifier_callback_iâ:
/opt/intel/vtune_amplifier_xe_2013/powerdk/src/src/apwr_driver.c:6631: warning: ISO C90 forbids mixed declarations and code
make[2]: *** [/opt/intel/vtune_amplifier_xe_2013/powerdk/src/src/apwr_driver.o] Error 1
make[1]: *** [_module_/opt/intel/vtune_amplifier_xe_2013/powerdk/src] Error 2
make[1]: Leaving directory `/usr/src/kernels/2.6.39-200.24.1.el6uek.x86_64'

It complains probe_cpu_idle is not defined.  In apwr_driver.c, it seems probe_cpu_idle is defined:

#if LINUX_VERSION_CODE  < KERNEL_VERSION(2,6,38)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)
static void probe_power_start(unsigned int type, unsigned int state)
#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)
static void probe_power_start(void *ignore, unsigned int type, unsigned int state)
#else // 2.6.36 <= version < 2.6.38
static void probe_power_start(void *ignore, unsigned int type, unsigned int state, unsigned int cpu_id)
#endif
{
    // tps_i(type, state);
    DO_PER_CPU_OVERHEAD_FUNC(tps, type, state);
};
#else // version >= 2.6.38
static void probe_cpu_idle(void *ignore, unsigned int state, unsigned int cpu_id)
{
   if (state == PWR_EVENT_EXIT) {
       return;
   }

    // tps_i(type, state);
   DO_PER_CPU_OVERHEAD_FUNC(tps, 0 /*type*/, state);
};
#endif // version
#endif // APWR_RED_HAT

I am using OEL(based on RedHat) kernel 2.6.39-200.24.1.el6uek.x86_64. gcc version 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC)

Any suggestions how I should fix this?

Regards,

Jenny

0 Kudos
1 Reply
Jenny_Z_
Beginner
339 Views

Read the build driver output more carefully.

build-driver scripts set APWR_RED_HAT=1 due to the following line:
#if [ $APWR_RED_HAT -eq 0 ] && [ -e "/etc/redhat-release" ]; then
#    is_redhat=`cat /etc/redhat-release| grep -i "red hat"`;
#    if [ "$is_redhat" != "" ]; then
#       APWR_RED_HAT=1 # HACK HACK HACK!!!
#        echo "Using RedHat-specific hack for kernel version number..."
#    fi
#fi

in apwr_driver.c
#if APWR_RED_HAT/* * Red Hat back ports SOME changes from 2.6.37 kernel * into 2.6.32 kernel. Special case that here. */static void probe_power_start(unsigned int type, unsigned int state, unsigned int cpu_id)
{
    // tps_i(type, state);
    DO_PER_CPU_OVERHEAD_FUNC(tps, type, state);
};
#else
...
#else // version >= 2.6.38
static void probe_cpu_idle(void *ignore, unsigned int state, unsigned int cpu_id)
{
   if (state == PWR_EVENT_EXIT) {
       return;
   }

    // tps_i(type, state);
   DO_PER_CPU_OVERHEAD_FUNC(tps, 0 /*type*/, state);
};
#endif // version

Basically probe_cpu_idle is not defined if APWR_RED_HAT=1. 

I commented out the lines in build-driver.  Then I can build the driver.  Maybe some bug, or OEL should need some special treatment?

0 Kudos
Reply