Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp317042yba; Thu, 16 May 2019 01:01:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqwWgvwYP6a6Q3yeG7V2tEI+Sc9NcHyENd/z20pZTOi8cv9y3oTIo0oEYkeAMy9tWULkNPOp X-Received: by 2002:a62:6582:: with SMTP id z124mr54259689pfb.0.1557993709025; Thu, 16 May 2019 01:01:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557993709; cv=none; d=google.com; s=arc-20160816; b=CqxdrPE0ezCydq11Gss00FUi460wjXp1afIGktBoWiuf/Ew+4l9YR6M7idPFGQnE/e xQXS1CATWegNL8G67hKFGHKAs+HhnGV899AW1b/wjSuim6cNYXGDRWPN2/2Ee8trdI16 kdD2+Hu+xu3TC9hwScyqZnps6BGpiVAVLp0+TqiaM0GWZtOHbefO1TdUCWDQ53oYIUGg L4uq9CgGY8UIXJYbrT8xAFDkqwadKwBkQjYREGOEXQXB6gx00oGaR46R5fRz3bsOWudN T/Th4f38ycbgGQSfWrfmy0tQmfmHZHz91TfCi4OtU7d5CNcsjFf2vbVI3YH5AdW9Ij/P LvjQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=Qt6Ac1pksxjiwvx3dMonP/o+vxTUaZcZRFsJt0WMmbM=; b=geuW8Hc4jpdzQZ9fDvUPrr9f6IOyY5h4LEImNteLAVeh/j74pugZyzz3wjlhAvZqNt YdwEJfbgmlHwQWS35SUWac6uVPF4QZEpzuzSDeC/4HP1wQ8mev8e4nydVhkjwIwGUXE6 6WCZD33cqKFnXq4tQBEr7hIgiu0RsBqeAKp8mhjqtYER5KUUF9TuwsJ9H560tfrbc8rj 0lERMJ+piLUFQ2sfjrpsymvGsNnLv1dtOGRid09BPNsnrmjpgAVR+SgS8wzEGk4d51j7 yOq5WIirb0MYsK4R2cKK/RAiZiPk8CLLR8b+EmtVaHzQKBeiP6UBlCMlJ2AtBXOWhVSj b9YQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hoOiEiU5; 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 q61si4387140plb.381.2019.05.16.01.01.33; Thu, 16 May 2019 01:01:49 -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=hoOiEiU5; 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 S1726739AbfEPIAY (ORCPT + 99 others); Thu, 16 May 2019 04:00:24 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:38335 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726363AbfEPIAX (ORCPT ); Thu, 16 May 2019 04:00:23 -0400 Received: by mail-pf1-f194.google.com with SMTP id b76so1420427pfb.5 for ; Thu, 16 May 2019 01:00:23 -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:mime-version :content-transfer-encoding; bh=Qt6Ac1pksxjiwvx3dMonP/o+vxTUaZcZRFsJt0WMmbM=; b=hoOiEiU5dxl2DoI77mL5xYPGCumtbpIot6kN5iOzIpflYMtO2VBzG1Hna+ipuAsFjX UWSxRrzP1IV/l01F0H18c8vskJYg1N79gXd2/k4qrBP7r/Z9tSFP9k4MV2K6Fsqs0Qzk tyeihJMC60aEGn/kxgN8f7GCskUpfBArRrZewGE0n68IgnpN/ZWnBqFEelxO473bjkNm W1Eu0utbhg0N4xLDy4GymEjRSG8xuUZZiEB8uIuDg532rU6+XreN5hPR4O89RPSZqWug MLP+swb/p2m9e7QbEEV1+4oZVR9BSgMBh9y24FTfUEElyaJrELx9FHe3rtYKtp5utxpM 4vTQ== 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:mime-version :content-transfer-encoding; bh=Qt6Ac1pksxjiwvx3dMonP/o+vxTUaZcZRFsJt0WMmbM=; b=aIGWGYSv2SfTEvnC84ddu0g1I9yL1j9uveBLLl0J6HDh7hJEbr8ZKFbNWZtl5onu3/ tuLRYjxSYYPWuLxjbtvyKTwkKyPJzjShpKv2DGPYfZsaBksdpU8rdjOXQFdIs4SLeHWy /rKTyi5T9SVBYy/6iCRe6iIYfho1sPvNJfWRG7xkN+JI8Ulwd/LL7DJkPq1raqkGB4ZF l6fEO0dZcONn/JDfwfcG9qddiZZb0uxPfVfjJsX6CHUaPUhv+Fg/nF19+buYbgtluin4 f+HaRzs+l2PYfPotynS2OH3vXu2PCYRGqYG4hDxZILwXRWZ0wIFoDylypt1KmggXZWaA DIog== X-Gm-Message-State: APjAAAUknzoZtNXzlSWL132vCh9iNUeGQ+HeACo1l2U5/CIlnK9BGnFQ 5JTSlDsgb0CpLDwe/SwO0daFBV7PGYzdjw== X-Received: by 2002:a63:e50c:: with SMTP id r12mr34808440pgh.284.1557993623102; Thu, 16 May 2019 01:00:23 -0700 (PDT) Received: from localhost.localdomain ([203.100.54.194]) by smtp.gmail.com with ESMTPSA id p7sm2051471pgb.92.2019.05.16.01.00.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 May 2019 01:00:22 -0700 (PDT) From: Yuyang Du To: peterz@infradead.org, will.deacon@arm.com, mingo@kernel.org Cc: bvanassche@acm.org, ming.lei@redhat.com, frederic@kernel.org, tglx@linutronix.de, boqun.feng@gmail.com, paulmck@linux.ibm.com, linux-kernel@vger.kernel.org, Yuyang Du Subject: [PATCH v2 00/17] Support for read-write lock deadlock detection Date: Thu, 16 May 2019 15:59:58 +0800 Message-Id: <20190516080015.16033-1-duyuyang@gmail.com> X-Mailer: git-send-email 2.20.1 (Apple Git-117) 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 Hi Peter and Ingo, Historically, the read-write lock (recursive-read locks included) is not well supported in lockdep. This patchset attempts to solve this problem sound and complete. The bulk of the algorithm is in patch #10, which is actually not complex at all. Hopefully, it simply works. Now that we have read-write locks suppported, we have all the 262 cases passed, though I have to flip some cases which, I think, are wrong. P.S. To Boqun, I haven't got time to read your patchset except that I did carefully read your design doc and learnt from it a lot. It is helpful. Please give this patchset at least a look. Change from v1: - As Peter pointed out the assumption that a lock class cannot ever be read and recursive read does not hold. The value of LOCK_TYPE_RECURSIVE is changed to 3 from 2, which maintains that if type1 and type2 are exclusive then type1 & type2 == 0. And since it is legal for a task can have a read and then a recursive read lock, we allow this in deadlock check. - Some typo fixes and rewording in comments or changelog. Thanks, Yuyang -- Yuyang Du (17): locking/lockdep: Add lock type enum to explicitly specify read or write locks locking/lockdep: Add read-write type for dependency locking/lockdep: Add helper functions to operate on the searched path locking/lockdep: Update direct dependency's read-write type if it exists locking/lockdep: Rename deadlock check functions locking/lockdep: Adjust BFS algorithm to support multiple matches locking/lockdep: Introduce mark_lock_unaccessed() locking/lockdep: Introduce chain_hlocks_type for held lock's read-write type locking/lockdep: Hash held lock's read-write type into chain key locking/lockdep: Support read-write lock's deadlock detection locking/lockdep: Adjust lockdep selftest cases locking/lockdep: Remove useless lock type assignment locking/lockdep: Add nest lock type locking/lockdep: Support recursive read locks locking/lockdep: Adjust selftest case for recursive read lock locking/lockdep: Add more lockdep selftest cases locking/lockdep: Remove irq-safe to irq-unsafe read check include/linux/lockdep.h | 57 +- include/linux/rcupdate.h | 2 +- kernel/locking/lockdep.c | 464 +++++++++++---- kernel/locking/lockdep_internals.h | 4 + lib/locking-selftest.c | 1099 +++++++++++++++++++++++++++++++++++- 5 files changed, 1489 insertions(+), 137 deletions(-) -- 1.8.3.1