Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2164459imm; Tue, 2 Oct 2018 22:40:50 -0700 (PDT) X-Google-Smtp-Source: ACcGV61ciGdx3yFMQGzwhdQoQXQLXmN/cA9v2eiIOjEQwCn4aunA6vfHHUeNbjw5HaRSxLpY3V6E X-Received: by 2002:a63:5b14:: with SMTP id p20-v6mr17157135pgb.56.1538545250782; Tue, 02 Oct 2018 22:40:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538545250; cv=none; d=google.com; s=arc-20160816; b=XOPjClwS6qSozhLl/PGAIsOJuCs0v3tPtJs0IelV7gwBkY9DsbD4ywlHXNdw31b+Lf /YpXggHXp/TasVHw1MOmZr3exBJ0RvjaAepjv+S3iM1WRvnIw4EMpyxOQQTfRh+gDFEt FF0qhATB6Rbztm/SC8uDSLrgzE2kRJjRbDRpsN5LUdmGQrWEJmDhPE0x7h9WZgiFy/+t PoNoLct7ehIGhjTKFn2URDM2IpaWhnTM1C5QOSD0PDUYLWZ+MjmUvnHQ06uHaM+YcJ1U cQ4lGLwZ2vdW6F4OTCP79DI886njgvXIZrBULH8YxRPddfe9BlKNwpGgPNQHndGHrfnv +2Tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :reply-to:references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=E/Mfv8nCJWeeyQlp/XUi0bPWD1GB9UX6UcF/dUzBp5o=; b=d2Nakdgj0KqsMr7ypQvKaO4UzonxqeFIsF7nlEQ9hEjDMzVjK/tfL1xaOkPY0/ISmH V4EJMHjuk2yQtrwayf/E8kEofXe0T/twHDacO7924kTMh88VBTzGV7T1vzwSL4xQfILW 85PzZJqJqsjO0AtOK83Jp1wW3CVyCiIfSMH9eK2N3ArN6tq6uCYdjXH+XT2qHtCqRTin 7GvUafC3+BY783cPUb6yeBLXzOuMdj5SjBS7lGOhpYdWNrrFblp80F22tbC2tUy6WX9Y SrKHBfnKp9nsX+65fiyHqWtjLmD4T5WWR7AI8+tK6r3bNkF1yuRMW2hx3U59eZdHs29S ALFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ljCuQCRZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w3-v6si347147pgk.176.2018.10.02.22.40.35; Tue, 02 Oct 2018 22:40:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ljCuQCRZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727438AbeJCM1C (ORCPT + 99 others); Wed, 3 Oct 2018 08:27:02 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:44504 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727264AbeJCM1C (ORCPT ); Wed, 3 Oct 2018 08:27:02 -0400 Received: by mail-pl1-f196.google.com with SMTP id p25-v6so2877597pli.11 for ; Tue, 02 Oct 2018 22:40:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references:reply-to :mime-version:content-transfer-encoding; bh=E/Mfv8nCJWeeyQlp/XUi0bPWD1GB9UX6UcF/dUzBp5o=; b=ljCuQCRZ677QCGk1mXe3hedVicVAiDtDCetS8GKR+hn4R2zXwSGoFxy6FoEHxmxhWj 3roCV0fxITwsqWxQYOpFcolDo8216D/OV8uhRNgZ6fM/P2oAq8DG5mdYcdlfgYvWQKKC ainXISduKtZllD97OhTTn6CPTsAhQ1cuSs5z+TMwM5sApmwpCVk6rdFA69TCg5/Fkmlp L/iVejiXgWmVhZP66RmsEu+7WhaN/6AXtp6mQYKVl7i30Cys3rKqJ4owArLospCU19ao ddve/ZVgaofNadf9hujBXhKQKR8HW63r+anOXUUu5HkMxMjQnx1g3Ji6TcrHncg4+eLe Tu1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:reply-to:mime-version:content-transfer-encoding; bh=E/Mfv8nCJWeeyQlp/XUi0bPWD1GB9UX6UcF/dUzBp5o=; b=SzBS+K1Zq4Hsu75mBLZsk37t7qdDUpJpge62ydRtdAgd36kKGAXIB5+OPMaQhy1+Lv 2sFO2yrl63ioAsg9eSx+CKJSKvVHZGgQbe0C/ovpq93KUOrvy3odnIfFD1v8rbY4XlDu ctabDvL6gG0it8iWdRHKqu0B05e6dNgKTusJ5npq4i8etjvXBjkPbN6FKnjU7qC8gYPG +tzOWyFU4fmYY059YXG7L8KZvTee0NRe0IT+bni9WuIlf4uebEYaJleiuEUFghGrTGiE K5vptGIFn29bo994cxRV2FJ56ZO9bc+l5ia2OxqhcmZSN8oSTDpCGJ/cp2Wxe+u8qz5h 7lvw== X-Gm-Message-State: ABuFfoibV4TFv2IvrW5TSSZXJtR1wcPmWijHNSBUvi2lTFWDsbPmoPb1 HpwYo1xn8qCaepFB/9Q22Q0= X-Received: by 2002:a17:902:6b45:: with SMTP id g5-v6mr7651740plt.41.1538545212211; Tue, 02 Oct 2018 22:40:12 -0700 (PDT) Received: from E570.localdomain (c-24-21-68-121.hsd1.or.comcast.net. [24.21.68.121]) by smtp.gmail.com with ESMTPSA id x20-v6sm691340pfe.131.2018.10.02.22.40.11 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Oct 2018 22:40:11 -0700 (PDT) Received: by E570.localdomain (Postfix, from userid 1000) id 056391643D0; Tue, 2 Oct 2018 22:40:11 -0700 (PDT) From: Lance Roy To: linux-kernel@vger.kernel.org Cc: "Paul E. McKenney" , Lance Roy , Peter Zijlstra , Ingo Molnar , Will Deacon Subject: [PATCH 12/16] locking/mutex: Replace spin_is_locked() with lockdep Date: Tue, 2 Oct 2018 22:38:58 -0700 Message-Id: <20181003053902.6910-13-ldr709@gmail.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181003053902.6910-1-ldr709@gmail.com> References: <20181003053902.6910-1-ldr709@gmail.com> Reply-To: Lance Roy MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org lockdep_assert_held() is better suited to checking locking requirements, since it won't get confused when someone else holds the lock. This is also a step towards possibly removing spin_is_locked(). Signed-off-by: Lance Roy Cc: Peter Zijlstra Cc: Ingo Molnar Cc: Will Deacon --- kernel/locking/mutex-debug.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/locking/mutex-debug.c b/kernel/locking/mutex-debug.c index 9aa713629387..771d4ca96dda 100644 --- a/kernel/locking/mutex-debug.c +++ b/kernel/locking/mutex-debug.c @@ -36,7 +36,7 @@ void debug_mutex_lock_common(struct mutex *lock, struct mutex_waiter *waiter) void debug_mutex_wake_waiter(struct mutex *lock, struct mutex_waiter *waiter) { - SMP_DEBUG_LOCKS_WARN_ON(!spin_is_locked(&lock->wait_lock)); + lockdep_assert_held(&lock->wait_lock); DEBUG_LOCKS_WARN_ON(list_empty(&lock->wait_list)); DEBUG_LOCKS_WARN_ON(waiter->magic != waiter); DEBUG_LOCKS_WARN_ON(list_empty(&waiter->list)); @@ -51,7 +51,7 @@ void debug_mutex_free_waiter(struct mutex_waiter *waiter) void debug_mutex_add_waiter(struct mutex *lock, struct mutex_waiter *waiter, struct task_struct *task) { - SMP_DEBUG_LOCKS_WARN_ON(!spin_is_locked(&lock->wait_lock)); + lockdep_assert_held(&lock->wait_lock); /* Mark the current thread as blocked on the lock: */ task->blocked_on = waiter; -- 2.19.0