lkml.org 
[lkml]   [2020]   [May]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v1 07/25] lockdep: Add preemption disabled assertion API
    On Tue, May 19, 2020 at 11:45:29PM +0200, Ahmed S. Darwish wrote:
    > diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
    > index 206774ac6946..54c929ea5b98 100644
    > --- a/include/linux/lockdep.h
    > +++ b/include/linux/lockdep.h
    > @@ -702,6 +702,14 @@ do { \
    > "Not in hardirq as expected\n"); \
    > } while (0)
    >
    > +/*
    > + * Don't define this assertion here to avoid a call-site's header file
    > + * dependency on sched.h task_struct current. This is needed by call
    > + * sites that are inline defined at header files already included by
    > + * sched.h.
    > + */
    > +void lockdep_assert_preemption_disabled(void);

    So how about:

    #if defined(CONFIG_PREEMPT_COUNT) && defined(CONFIG_TRACE_IRQFLAGS)
    #define lockdep_assert_preemption_disabled() do { \
    WARN_ON(debug_locks && !preempt_count() && \
    current->hardirqs_enabled); \
    } while (0)
    #else
    #define lockdep_assert_preemption_disabled() do { } while (0)
    #endif

    That is both more consistent with the things you claim it's modelled
    after and also completely avoids that header dependency.

    \
     
     \ /
      Last update: 2020-05-22 19:57    [W:7.867 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site