[LITMUS^RT] Create a Plugin Tutorial Step 5

shijunjie92 shijunjie92 at gmail.com
Wed Oct 26 20:09:08 CEST 2016


Because of the based linux version has been changed, some functions have been reweitten. You need to compare the tutorial with the latest version of LITMUS-RT's plugin (for example sched_pfp.c) . Rewrite the related functions yourself.

2016-10-26 

shijunjie92 



发件人:NICHOLAS ALLAN KLEPP <nickbk at uga.edu>
发送时间:2016-10-26 19:01
主题:[LITMUS^RT] Create a Plugin Tutorial Step 5
收件人:"litmus-dev at lists.litmus-rt.org"<litmus-dev at lists.litmus-rt.org>
抄送:

Hello! 



I am following the Create a Plugin Tutorial and I am getting a compilation error after I add the scheduling decision logic in step 5. The error seems to be a problem with the demo_requeue() method. Here is the error message generated on compilation: 



litmus/sched_demo.c: In function ‘demo_requeue’:
litmus/sched_demo.c:32:28: error: dereferencing pointer to incomplete type
       __add_ready(&cpu_state->local_queues,tsk);
                            ^
litmus/sched_demo.c:37:28: error: dereferencing pointer to incomplete type
       add_release(&cpu_state->local_queues,tsk);
                            ^
litmus/sched_demo.c: In function ‘demo_schedule’:
litmus/sched_demo.c:69:10: error: implicit declaration of function ‘__get_cpu_var’ [-Werror=implicit-function-declaration]
   struct demo_cpu_state *local_state = local_cpu_state();
          ^
litmus/sched_demo.c:14:28: error: lvalue required as unary ‘&’ operand
 #define local_cpu_state() (&__get_cpu_var(demo_cpu_state))
                            ^
litmus/sched_demo.c:69:40: note: in expansion of macro ‘local_cpu_state’
   struct demo_cpu_state *local_state = local_cpu_state();
                                        ^
litmus/sched_demo.c:83:3: error: implicit declaration of function ‘is_running’ [-Werror=implicit-function-declaration]
   self_suspends = exists && !is_running(prev);
   ^
cc1: some warnings being treated as errors
scripts/Makefile.build:258: recipe for target 'litmus/sched_demo.o' failed



In searching the mailing list for similar problems I ran into a thread which did describe the dereferencing pointer to incomplete type error. There are two responses in that thread which I found to be possibly illuminating. One: 



On May 7, 2013, at 2:11 PM, Björn Brandenburg <bbb at mpi-sws.org> wrote:

> 
> On May 7, 2013, at 9:29 AM, Schorr Stefan <stschorr at eit.uni-kl.de> wrote:
>> 
>> I'm trying to follow the Create A Plugin Tutorial from the webpage.
>> The first steps work like a charm, step 4 however doesn't compile :(
>> 
>> I copied the code from the website and I created a new local git
>> branch, so I'm absolutely sure that the only file I changed - apart
>> from the Makefile - is sched_demo.c (so I don't understand why
>> the error messages below point to .h files).
>> 
>> Please give me some hint what goes wrong here...
>> 
>> Best Regards
>> Stefan
>> 
>> 
>> Here's the error I get, when doing make bzImage
>> 
>> In file included from litmus/sched_demo.c:3:
>> include/litmus/litmus.h:74: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘litmus_clock’
>> include/litmus/litmus.h: In function ‘is_kernel_np’:
>> include/litmus/litmus.h:120: error: dereferencing pointer to incomplete type
> 
> 
> Hi Stefan,
> 
> this is a configuration error in LITMUS^RT. Please enable the configuration option CONFIG_NP_SECTION, which should silence the error. Sorry about that...


Actually, litmus/litmus.h already has correct dummy implementations for the !CONFIG_NP_SECTION case, so it's something different. Have you tried a 'make clean'?
- Björn

And two: 


> On 05/07/2013 02:19 PM, Björn Brandenburg wrote:
>> If it doesn't go away, you are probably missing a header file. Here are the one from the reference version. Does it fail with these headers as well?
> 
> Hi Björn,
> thanks for the fast reply!
> There's no change after make clean.
> I paste my C code here:
> 

Commit c5248a7288e54c2b5e2bba8aa2677772542bf90e compiles for me. Can you please try compiling c5248a7288e54c2b5e2bba8aa2677772542bf90e and, if it doesn't work, send me your configuration?

Thanks,
Björn



I have verified that CONFIG_NP_SECTION is in fact enabled and as well I have run a 'make clean'. My next option was to try to checkout commit c5248a7288e54c2b5e2bba8aa2677772542bf90e, however, this is not allowed for my local repository. The error: 

fatal: reference is not a tree: c5248a7288e54c2b5e2bba8aa2677772542bf90e

Is there something else I should do to make this work? Thanks! 


- Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.litmus-rt.org/pipermail/litmus-dev/attachments/20161026/6ccba09f/attachment.html>


More information about the litmus-dev mailing list