lkml.org 
[lkml]   [2024]   [Feb]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v12 14/27] cpu/hotplug: Use a weaker annotation in AP thread
    Date
    cb92173d1f0 ("locking/lockdep, cpu/hotplug: Annotate AP thread") was
    introduced to make lockdep_assert_cpus_held() work in AP thread.

    However, the annotation is too strong for that purpose. We don't have to
    use more than try lock annotation for that.

    rwsem_acquire() implies:

    1. might be a waiter on contention of the lock.
    2. enter to the critical section of the lock.

    All we need in here is to act 2, not 1. So trylock version of annotation
    is sufficient for that purpose. Now that dept partially relies on
    lockdep annotaions, dept interpets rwsem_acquire() as a potential wait
    and might report a deadlock by the wait. So replaced it with trylock
    version of annotation.

    Signed-off-by: Byungchul Park <byungchul@sk.com>
    ---
    kernel/cpu.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/kernel/cpu.c b/kernel/cpu.c
    index a86972a91991..b708989f789f 100644
    --- a/kernel/cpu.c
    +++ b/kernel/cpu.c
    @@ -535,7 +535,7 @@ int lockdep_is_cpus_held(void)

    static void lockdep_acquire_cpus_lock(void)
    {
    - rwsem_acquire(&cpu_hotplug_lock.dep_map, 0, 0, _THIS_IP_);
    + rwsem_acquire(&cpu_hotplug_lock.dep_map, 0, 1, _THIS_IP_);
    }

    static void lockdep_release_cpus_lock(void)
    --
    2.17.1

    \
     
     \ /
      Last update: 2024-05-27 15:14    [W:4.920 / U:0.264 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site