Compile error if i use rwlock or rcu into debug mode

Sysprogs forums Forums VisualKernel Compile error if i use rwlock or rcu into debug mode

This topic contains 3 replies, has 2 voices, and was last updated by  support 1 month, 3 weeks ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #11498

    vemax78
    Participant

    Hi, I have a problem using rwlock or rcu (read-copy-update) if compile con visualkernel in debug mode. The compile failed with error “error : call to ‘__compiletime_assert_142’ declared with attribute error: Need native word sized stores/loads for atomicity.” The cause is to be attributed to disable all optimizations during compilation (rightly) by the -O0 parameter.

    Do you have any suggestions on how to use rwlock and rcu in debug mode without enabling optimizations ?

     

    Thanks

    Massimo

     

     

    #11500

    support
    Keymaster

    Hi,

    This looks like a bug of the Linux kernel itself. The easiest workaround would be to manually override the optimization level for the function that is causing the problem:

    • This reply was modified 1 month, 4 weeks ago by  support.
    #11576

    vemax78
    Participant

    Thank you for the response.

     

    I try with this example:

    void __attribute__((optimize(“O2”))) func(rwlock_t* lock) {
    write_lock(lock);

    write_unlock(lock);
    }

    but continue with same error in “write_unlock” call. All ok if i set -O2 in Makefile.

     

     

     

    #11579

    support
    Keymaster

    Hi,

    Most likely you would need to set the “optimize” attribute on some of the inline functions in the kernel headers. Please check the build log for the actual function that calls __smp_store_release(), e.g.:

    E.g. with kernel 4.10 you would need to set the optimization for the queued_write_unlock() function:

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.