[LITMUS^RT] litmus-dev Digest, Vol 56, Issue 9

Mahircan Gul mahircg at mpi-sws.org
Wed Oct 26 23:57:22 CEST 2016


Greetings

As mentioned in a previous reply, the issue arises due to changes in 
Linux kernel versions. More specifically, macros for accessing the 
per-CPU variables has changed between kernel v 3.x to 4.x.

I guess those tutorials were written for the LITMUS version that was 
based on Linux 3.x. Therefore, using the old version of macros within 
the current kernel version (I'm assuming you are writing the plug-in on 
Linux v 4.x) yields to the errors you mentioned.

Changing

	
	#define local_cpu_state() (&__get_cpu_var(demo_cpu_state))

to (mind the address-of operator)

	#define local_cpu_state() (this_cpu_ptr(&demo_cpu_state))

should take care of the issue.

The change above should get your development process up and running! The 
tutorials need to be updated at some point, though.

Mahir

On 10/26/2016 07:09 PM, litmus-dev-request at lists.litmus-rt.org wrote:
> Send litmus-dev mailing list submissions to
> 	litmus-dev at lists.litmus-rt.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> 	https://lists.litmus-rt.org/listinfo/litmus-dev
> or, via email, send a message with subject or body 'help' to
> 	litmus-dev-request at lists.litmus-rt.org
>
> You can reach the person managing the list at
> 	litmus-dev-owner at lists.litmus-rt.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of litmus-dev digest..."
>
>
> Today's Topics:
>
>     1. Create a Plugin Tutorial Step 5 (NICHOLAS ALLAN KLEPP)
>     2. Re: Create a Plugin Tutorial Step 5 (shijunjie92)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Wed, 26 Oct 2016 17:01:02 +0000
> From: NICHOLAS ALLAN KLEPP <nickbk at uga.edu>
> To: "litmus-dev at lists.litmus-rt.org" <litmus-dev at lists.litmus-rt.org>
> Subject: [LITMUS^RT] Create a Plugin Tutorial Step 5
> Message-ID:
> 	<BL2PR02MB465FD2B01B25792C2378779D5AB0 at BL2PR02MB465.namprd02.prod.outlook.com>
> 	
> Content-Type: text/plain; charset="iso-8859-1"
>
> 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/4601336b/attachment-0001.html>
>
> ------------------------------
>
> Message: 2
> Date: Wed, 26 Oct 2016 19:09:08 +0100
> From: "shijunjie92" <shijunjie92 at gmail.com>
> To: "litmus-dev" <litmus-dev at lists.litmus-rt.org>
> Subject: Re: [LITMUS^RT] Create a Plugin Tutorial Step 5
> Message-ID: <5810E331.1010709 at gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> 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>
>
> ------------------------------
>
> _______________________________________________
> litmus-dev mailing list
> litmus-dev at lists.litmus-rt.org
> https://lists.litmus-rt.org/listinfo/litmus-dev
>
>
> End of litmus-dev Digest, Vol 56, Issue 9
> *****************************************





More information about the litmus-dev mailing list