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

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:

    void __attribute__((optimize("O2"))) func()
    {
        //...
    }
    • This reply was modified 6 years, 9 months 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.:

    1><...>\include\asm-generic\qrwlock.h(165,2): note :  in expansion of macro `smp_store_release'

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

    static inline void queued_write_unlock(struct qrwlock *lock)
    {
        smp_store_release(__qrwlock_write_byte(lock), 0);
    }
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.