Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp446629yba; Wed, 24 Apr 2019 04:11:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqyDmqGDGCxL2Cp9GdTygL9rXLEvBdWcyVRijyXkp/B/y0JSo1yl+IyiIpSC5df95Vun0ZVb X-Received: by 2002:a63:1a42:: with SMTP id a2mr29579502pgm.358.1556104288394; Wed, 24 Apr 2019 04:11:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556104288; cv=none; d=google.com; s=arc-20160816; b=bpHQpZQflYYSmgZ11FUs0spP8V7PUse28kJHrYaG2cIzKAJlg6Idv8FIqa72NqWeUe Zq2mFuNitC1au9hTeZ0o9GKzUz9mfY4NvwW/+kW4inbQ3xM1V9ruotHqwHIN5P1D/Jfv UiwiK3uFONYJY8sk3DToS1TrpmtGfIjJzeajSJxEB/GxQ2hPMlAV9WT23yBpgzKl5y/F dkEovworOO/qBi+i1YAo8Z9Hslv68/OI22e5sk+gS3BePVKpXpn5TFoju124+pIxlVOd BNtNI8XFN/G+ogHi0DenDdbSo9vakrcAXnRtZuyxJhIM9Qqvks83oeRR9neQXuEsbjer tA/g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+qDwchYUEwEWxZipDWoyQdCOIu7W4mr2V2HYbPHT39Q=; b=AMLC1PLXTteSJYWJloFxDQ6gZXedn+AXbtn4co+WHloQcEAGUYdQ5t/ASaYQtZA3MO 1AROnm6KREYlksQmXqnWGxlfexgQshqfYvfL/qPMDE7Ewa/83tNui5IWtnj99tqCFlbX CAy1z3C9YE4AlCC6XzIvFvkPr/2ahL/cuc7NGCHgJGl3Xdbz30rWzKBCu3uSPpRyUYOU PMIv25qd7AiJlGnrGdOnIDORzGIhTbjIb0PkJfrudqVEGbcloQQ9hJfITPJsDaUu9XnG PgfrDGb5pDm2elPL86zDLDHwD9TSiNmai8TCVoci4YcsTgE5TJ0qmmGoCRMs4Ou9auD7 BUGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=HVUDm+Wi; 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 j16si17807123pgl.335.2019.04.24.04.11.12; Wed, 24 Apr 2019 04:11:28 -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=HVUDm+Wi; 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 S1728606AbfDXKWL (ORCPT + 99 others); Wed, 24 Apr 2019 06:22:11 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:33268 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727478AbfDXKVm (ORCPT ); Wed, 24 Apr 2019 06:21:42 -0400 Received: by mail-pl1-f193.google.com with SMTP id t16so9094131plo.0 for ; Wed, 24 Apr 2019 03:21:42 -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 :mime-version:content-transfer-encoding; bh=+qDwchYUEwEWxZipDWoyQdCOIu7W4mr2V2HYbPHT39Q=; b=HVUDm+WimHUIiKKSmNd7gAxNjLUsRlA3yvKckHVnhJFwwrsSP6p2v0qqQVn+V+iVNU qIvuH01zQ18YiTUzr5auzwNMesemCqDtE+xsw16M2rFeGnOzfhCjyz5fBH5zXJTtzPYG 3CEmj2HSbPI0ZGMRzuPq9XqFfYfHekj5IgHTr2k474XwiY58QkJLuhXMPNyYn+z8j7dP DcYZg0KGmHwcLpolRKfowjIopb7idlfVs4+4ulTJAB04KJJud6H229lOs2/8VJRLDPEQ fRUo6loFc8zw66YENNr21jVeC+zxNvfxuE7cszm1t1IRR3/CUsPiJJggxnlJvW/ckHfg Xvew== 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:mime-version:content-transfer-encoding; bh=+qDwchYUEwEWxZipDWoyQdCOIu7W4mr2V2HYbPHT39Q=; b=G3KCaQ8FXArRY7XNBkcFZ8crDZtZ+8GeSvistCZmICyPw62fi3/MkyLprpgUMHgsaL PB/JP+b7B+U9GqBXVHVoUskNbCgnI/kTn7JRDKFYIqEL9AMWNU6NejqXVhffHXVxZmPC EvjehA0CW7K/Du57Ins4hFvhT/5GQ+IboP94qNL4HD2nYoVI6sooSoXeZU84zdet0myL hVZP6+M9Jy3gUlYDaqhSfiGn99itgfMd0oX1KFHS3FZvlVt7FbHbewrTSe5nn41jYRZ2 iLGeWlDt28rDTNHW4L9DefzmJAN4bQ1xwKxWUF3dmf2fkPwt5OE6cuYnccWC0bb1Ljhl C0vg== X-Gm-Message-State: APjAAAVmtDv7wWr7J8mI/Pk4TcyMG0T0320DwtP9sGksEX3yKKgywtmy sCOPK7fpJfpDZl6jJUgL1bc= X-Received: by 2002:a17:902:778b:: with SMTP id o11mr8505608pll.333.1556101301846; Wed, 24 Apr 2019 03:21:41 -0700 (PDT) Received: from localhost.localdomain ([203.100.54.194]) by smtp.gmail.com with ESMTPSA id v19sm25051604pfn.62.2019.04.24.03.21.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Apr 2019 03:21:41 -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, linux-kernel@vger.kernel.org, Yuyang Du Subject: [PATCH 24/28] locking/lockdep: Remove !dir in lock irq usage check Date: Wed, 24 Apr 2019 18:19:30 +0800 Message-Id: <20190424101934.51535-25-duyuyang@gmail.com> X-Mailer: git-send-email 2.20.1 (Apple Git-117) In-Reply-To: <20190424101934.51535-1-duyuyang@gmail.com> References: <20190424101934.51535-1-duyuyang@gmail.com> 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 In mark_lock_irq(), the following checks are performed: ---------------------------------- | -> | unsafe | read unsafe | |----------------------------------| | safe | F B | F* B* | |----------------------------------| | read safe | F? B* | - | ---------------------------------- Where: F: check_usage_forwards B: check_usage_backwards *: check enabled by STRICT_READ_CHECKS ?: check enabled by the !dir condition From checking point of view, the special F? case does not make sense, whereas it perhaps is made for peroformance concern. As later patch will address this issue, remove this exception, which makes the checks consistent later. With STRICT_READ_CHECKS = 1 which is default, there is no functional change. Signed-off-by: Yuyang Du --- kernel/locking/lockdep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index 1b78216..2f24028 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c @@ -3149,7 +3149,7 @@ typedef int (*check_usage_f)(struct task_struct *, struct held_lock *, * Validate that the lock dependencies don't have conflicting usage * states. */ - if ((!read || !dir || STRICT_READ_CHECKS) && + if ((!read || STRICT_READ_CHECKS) && !usage(curr, this, excl_bit, state_name(new_bit & ~LOCK_USAGE_READ_MASK))) return 0; -- 1.8.3.1