Received: by 10.223.185.116 with SMTP id b49csp1593937wrg; Wed, 21 Feb 2018 23:07:59 -0800 (PST) X-Google-Smtp-Source: AH8x225dWGkj6iXh8vtgr3r979EAjMLvOJStrNvMJilREKVEkX+oCbQe43HzFPm99pTzeowptNU6 X-Received: by 2002:a17:902:47:: with SMTP id 65-v6mr5547608pla.194.1519283279577; Wed, 21 Feb 2018 23:07:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519283279; cv=none; d=google.com; s=arc-20160816; b=O23X7Gc2ZCBFWPF6nmKys9TSGTxVogR5qCqeaB23LN3L/pFBZns5t2rqE//YHBCKQz PWCPS9um1MVsVuZpVNQmXtz8QukbdBoxPxqaQitOsnajgdPl0s6TC7Rn7AbbqigHwOHl 2lVQpRcTEnrwGWEmmQm+Rg/XYr6KeiSqJtgF3eF/4jdx6/px3zEtJf8k61z0ORDYyuso awwemNy0N2o0DofzeOR0km5Z6YHVBp4e+jGdzSXfNPNkaEpdlh1rB2psR7IHbeTGTwVA kWhYKTRYzA+6mJ4YL4/tJHZMG4IuScphYVQcINVUg8Y+rClJKZSn4tzj600WtKO/2S9V jQpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=XZxs+FzeRpxyjhFb0urM4qV2hisR182W7lsDtVP7K/E=; b=Fr2JxaUjI8b1QGOry/Mdp+WzcN0jNnFmjmbwJzCKj+uM6AGH3y+PUJz6sKHUgI5/rW 2EvQlnPopnI9oP9ZdilEgK8avEf8ETes7cu7fyJHKqSH8caL0kwQXBftUOIHa34s6cZg l1snqb0oDl1bJSvRsDfxipdhALK17EXwrYrjhnqEsBoMYxb8Bnen8RvKzRk457q5d+4s UyLsKuGD3YzlP5hYgax8mdCSMoXUX1hj7T+9WNKJzbqYfIl54cOqj9qFxZc5phRk5QQP Xsqd9L8LQFj31LHeJFgx7BdEMVRlNK6+rumDRPE1Ou+9iDh0lRXFsCCbqA9HoLfGLHyI aD7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LjD1TlgG; 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 f69si780908pfd.211.2018.02.21.23.07.44; Wed, 21 Feb 2018 23:07:59 -0800 (PST) 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=LjD1TlgG; 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 S1752763AbeBVHGq (ORCPT + 99 others); Thu, 22 Feb 2018 02:06:46 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:37356 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752728AbeBVHGm (ORCPT ); Thu, 22 Feb 2018 02:06:42 -0500 Received: by mail-wm0-f67.google.com with SMTP id m207so1188148wma.2 for ; Wed, 21 Feb 2018 23:06:41 -0800 (PST) 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; bh=XZxs+FzeRpxyjhFb0urM4qV2hisR182W7lsDtVP7K/E=; b=LjD1TlgGHX25CVmefhLZ5t3xvhrRSip4e2eSJaIg2vj1QEhWqfPuZ0Cljbov2WzGWo FqBDWnPaugGbE2KnbfHt6CAH0mwVF7O66cULc3+fxptQ2KksuhYS00bzAFkSmNnozeZQ /PPXf22cGvDFyzLiSoqPEztWNjen0Qq/L4iilym87GAC/7fkmMK42ZDLetf7jMOEDVP3 FYLb5iVCCKusssOqtCNQ+R84robsd0TKhlFAbZtSVGY1/s/TFbViFtfupYNGqmSkVJwK 9eojQUw2RcJ0+4+iyBOJ26EeseRqTa/iAj/Ux2IUNzt8iYrJ6oQRaDj+uhundD8eKfFt 7HsA== 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; bh=XZxs+FzeRpxyjhFb0urM4qV2hisR182W7lsDtVP7K/E=; b=BHk2KBc16mAeZpbW6o+v+O519OSysd62HaMauTbTqHD98hZdYB7mhedRLDUnX6++Ct 84LmhtK0Ru/+LTzKtkYuTEd6V9PhQo8RyanrI59DiOoiSw3khTXh5TlUnBuzJWxXcWcj Xv9VXwCEZpcMidVo2nzG7L7M4ElQb1veUDqdgSNld1O5ZkwZWnSlskhtpaTcBiRHGuwA HoiVxoZPBA4P3W16wtwUDO6q8W65sgACRc/QCXbzPEGel5b3JoEnbIzZanW2v0VxV9vc bDHGIQOF96pnyI3ICfurAKdUHI1wzDCHpXr9mh5XtPI7Tb7rPpqIPGrniV62iezpce0B RacQ== X-Gm-Message-State: APf1xPBHv1fdnnY0F1/l4EhZ+xpdKkEBW7r7SBoIUNHUDIszc1pZ4G55 pBvyB/EDzEKdTP6l52JvgXw= X-Received: by 10.80.152.55 with SMTP id g52mr7938986edb.33.1519283200689; Wed, 21 Feb 2018 23:06:40 -0800 (PST) Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com. [66.111.4.227]) by smtp.gmail.com with ESMTPSA id 26sm9713249eds.26.2018.02.21.23.06.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Feb 2018 23:06:39 -0800 (PST) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailauth.nyi.internal (Postfix) with ESMTP id 61C2820D65; Thu, 22 Feb 2018 02:06:38 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute7.internal (MEProxy); Thu, 22 Feb 2018 02:06:38 -0500 X-ME-Sender: Received: from localhost (unknown [45.32.128.109]) by mail.messagingengine.com (Postfix) with ESMTPA id D98E32463E; Thu, 22 Feb 2018 02:06:37 -0500 (EST) From: Boqun Feng To: linux-kernel@vger.kernel.org Cc: Peter Zijlstra , Ingo Molnar , Andrea Parri , Boqun Feng Subject: [RFC tip/locking/lockdep v5 12/17] lockdep/selftest: Unleash irq_read_recursion2 and add more Date: Thu, 22 Feb 2018 15:08:59 +0800 Message-Id: <20180222070904.548-13-boqun.feng@gmail.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180222070904.548-1-boqun.feng@gmail.com> References: <20180222070904.548-1-boqun.feng@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now since we can handle recursive read related irq inversion deadlocks correctly, uncomment the irq_read_recursion2 and add more testcases. Signed-off-by: Boqun Feng --- lib/locking-selftest.c | 59 ++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 47 insertions(+), 12 deletions(-) diff --git a/lib/locking-selftest.c b/lib/locking-selftest.c index 700f9aa19db6..c2f06b423da8 100644 --- a/lib/locking-selftest.c +++ b/lib/locking-selftest.c @@ -1052,20 +1052,28 @@ GENERATE_PERMUTATIONS_3_EVENTS(irq_inversion_soft_wlock) #define E3() \ \ IRQ_ENTER(); \ - RL(A); \ + LOCK(A); \ L(B); \ U(B); \ - RU(A); \ + UNLOCK(A); \ IRQ_EXIT(); /* - * Generate 12 testcases: + * Generate 24 testcases: */ #include "locking-selftest-hardirq.h" -GENERATE_PERMUTATIONS_3_EVENTS(irq_read_recursion_hard) +#include "locking-selftest-rlock.h" +GENERATE_PERMUTATIONS_3_EVENTS(irq_read_recursion_hard_rlock) + +#include "locking-selftest-wlock.h" +GENERATE_PERMUTATIONS_3_EVENTS(irq_read_recursion_hard_wlock) #include "locking-selftest-softirq.h" -GENERATE_PERMUTATIONS_3_EVENTS(irq_read_recursion_soft) +#include "locking-selftest-rlock.h" +GENERATE_PERMUTATIONS_3_EVENTS(irq_read_recursion_soft_rlock) + +#include "locking-selftest-wlock.h" +GENERATE_PERMUTATIONS_3_EVENTS(irq_read_recursion_soft_wlock) #undef E1 #undef E2 @@ -1079,8 +1087,8 @@ GENERATE_PERMUTATIONS_3_EVENTS(irq_read_recursion_soft) \ IRQ_DISABLE(); \ L(B); \ - WL(A); \ - WU(A); \ + LOCK(A); \ + UNLOCK(A); \ U(B); \ IRQ_ENABLE(); @@ -1097,13 +1105,21 @@ GENERATE_PERMUTATIONS_3_EVENTS(irq_read_recursion_soft) IRQ_EXIT(); /* - * Generate 12 testcases: + * Generate 24 testcases: */ #include "locking-selftest-hardirq.h" -// GENERATE_PERMUTATIONS_3_EVENTS(irq_read_recursion2_hard) +#include "locking-selftest-rlock.h" +GENERATE_PERMUTATIONS_3_EVENTS(irq_read_recursion2_hard_rlock) + +#include "locking-selftest-wlock.h" +GENERATE_PERMUTATIONS_3_EVENTS(irq_read_recursion2_hard_wlock) #include "locking-selftest-softirq.h" -// GENERATE_PERMUTATIONS_3_EVENTS(irq_read_recursion2_soft) +#include "locking-selftest-rlock.h" +GENERATE_PERMUTATIONS_3_EVENTS(irq_read_recursion2_soft_rlock) + +#include "locking-selftest-wlock.h" +GENERATE_PERMUTATIONS_3_EVENTS(irq_read_recursion2_soft_wlock) #ifdef CONFIG_DEBUG_LOCK_ALLOC # define I_SPINLOCK(x) lockdep_reset_lock(&lock_##x.dep_map) @@ -1256,6 +1272,25 @@ static inline void print_testname(const char *testname) dotest(name##_rlock_##nr, SUCCESS, LOCKTYPE_RWLOCK); \ pr_cont("\n"); +#define DO_TESTCASE_2RW(desc, name, nr) \ + print_testname(desc"/"#nr); \ + pr_cont(" |"); \ + dotest(name##_wlock_##nr, FAILURE, LOCKTYPE_RWLOCK); \ + dotest(name##_rlock_##nr, SUCCESS, LOCKTYPE_RWLOCK); \ + pr_cont("\n"); + +#define DO_TESTCASE_2x2RW(desc, name, nr) \ + DO_TESTCASE_2RW("hard-"desc, name##_hard, nr) \ + DO_TESTCASE_2RW("soft-"desc, name##_soft, nr) \ + +#define DO_TESTCASE_6x2x2RW(desc, name) \ + DO_TESTCASE_2x2RW(desc, name, 123); \ + DO_TESTCASE_2x2RW(desc, name, 132); \ + DO_TESTCASE_2x2RW(desc, name, 213); \ + DO_TESTCASE_2x2RW(desc, name, 231); \ + DO_TESTCASE_2x2RW(desc, name, 312); \ + DO_TESTCASE_2x2RW(desc, name, 321); + #define DO_TESTCASE_6(desc, name) \ print_testname(desc); \ dotest(name##_spin, FAILURE, LOCKTYPE_SPIN); \ @@ -2114,8 +2149,8 @@ void locking_selftest(void) DO_TESTCASE_6x6("safe-A + unsafe-B #2", irqsafe4); DO_TESTCASE_6x6RW("irq lock-inversion", irq_inversion); - DO_TESTCASE_6x2("irq read-recursion", irq_read_recursion); -// DO_TESTCASE_6x2B("irq read-recursion #2", irq_read_recursion2); + DO_TESTCASE_6x2x2RW("irq read-recursion", irq_read_recursion); + DO_TESTCASE_6x2x2RW("irq read-recursion #2", irq_read_recursion2); ww_tests(); -- 2.16.1