Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp434868ybi; Thu, 30 May 2019 00:40:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqyKRi/pEhnPrUExcOEsdbksMHUQmhOBFH475A36GjGZXYYi0fJLpVz0oB2/mLEZqu/Qz4Ww X-Received: by 2002:a17:90b:d8c:: with SMTP id bg12mr2277397pjb.70.1559202051479; Thu, 30 May 2019 00:40:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559202051; cv=none; d=google.com; s=arc-20160816; b=fGDNbo6KFSyBh/VByjCDHv/2trHZRP+7Myb3k11AzmWVj9C1i3OwzCyPOnhy/U7+PN l5QJZBs6/vC+k9wZG/BkToGTooTbHKgCiiatILN8RnDh+3lVvK6Cbo9oXydzq/3Apvy1 IpZ0nsuxhryKMsJvScRR6IggqFNB11KF8tbbMHGykRaoZkD9t4yGFAQ4CSmc27onreZj 4nBP0PwjP++lxb4JwrQEbTFIZYSpeudQlLW9meDs2Rt5dkyC2fXhXoQrpBYqjxz4mmSb TVns9mcpMwcuf2a8dcw1d6vmK8rVV97hj3pxhJ3mq53Hb9LQeosOWu2VK874iRtFSCvC fZ5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=4maX8l5l7zxqXpvb7GBDy3cvUeNR3LgJtCZ3+Mtu/zs=; b=uw6SU4rYJltk+9L3fBMpJICzIvVgXIMxYsSkOZKs2Kb167CBZKVSDBh89MDf3vqJN2 hEaqi5yLbR/7NHrdPYggZDj7iuduPCKgb/0ZVNwuYg1xdLeoS14ySmbvCR0ZwxpcKvAt pSdFyos15aufeFLVQjtwe+x4pVjh20eaUwgSzVkqfiKsj4rTIiFvi+mAP4c2/O4RRYD4 mD3b8d7QZf5ruSQVhhFyNFQPs84Nxh4HnL192e7Bpl+OWFPjphw7In50KckEIDRBdQsl 7VVSES6nXPy6FyL5DS0nAHK/6vDyh6FUGdByLY/1gq8358+V7ymustkfXXQ7f5naHr30 iZsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IObnS4Ww; 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 3si2489522pgt.305.2019.05.30.00.40.31; Thu, 30 May 2019 00:40:51 -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=IObnS4Ww; 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 S1726613AbfE3HiD (ORCPT + 99 others); Thu, 30 May 2019 03:38:03 -0400 Received: from mail-qk1-f196.google.com ([209.85.222.196]:43719 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726027AbfE3HiC (ORCPT ); Thu, 30 May 2019 03:38:02 -0400 Received: by mail-qk1-f196.google.com with SMTP id m14so3215923qka.10 for ; Thu, 30 May 2019 00:38:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4maX8l5l7zxqXpvb7GBDy3cvUeNR3LgJtCZ3+Mtu/zs=; b=IObnS4WwDgXEcSl2mzx38IGgBkv2XERkmVIojRuiswXqH5M+L4E+vwKpl2sS0ktYUd bxeIYm9eBNLUr4B6oVKMPSVByBvelsfeqgmf1LbVRJAdhBh9Aye4MXQB+qmz1KVty1Jp n8AX7sqtR4EhD37R8U8hBZuyanEu5ZcxyJtNhMZFwPe5Azo6OaNnwDX50bhTOnzTcPuo GzcYV9k+78TXLkA/9XKWD4XkjwauRHDuNFaQztK4d2S7qpzoXvYhi+BZ0RqGGQ/5fiyP diUwLc1pZ3L/laT1awq55Yasz5R4DspcyainhY7NWced+q318j0d7UXZ9aHzW4WlqNAV /0ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4maX8l5l7zxqXpvb7GBDy3cvUeNR3LgJtCZ3+Mtu/zs=; b=gdr/tNIfYlHMQVmvtxcpzKcF7KGTcN3lSaV0XLQq9fFB7P9LgDXGKYw1UKFY9qAWby Lq6rX4GldDBH1X5AxrmbUvxZMYQ2slqMXZSLBfpVLZYmwj17CFfJqhpEtGj9oreRxySs 2rHOrIdbmZdMl4iQI5lo/s2kjJ8mHV8ouiZ9GCYj0RV9r0Qun7zJcepLDEq6pE18geIC E0nOKGMkn+dLTral96omCjA/vBcQfV1RMUcNvVFo0rfsE7cL7uxFW4QeSWEThhIns5pZ E5MWwggpZGhDLnbafZfJqNUtDApRaLkEYClfcRnH+0ve8KjueLWfpgtP2sLFMvxL6hP9 kgpQ== X-Gm-Message-State: APjAAAWOonnnysVH3AVRBzHwjcm/6AKOH2N+2n3BKjr8rvOs+I1T9bHa JlQ5V3HoV3haot6Ack2Zcvv6pFCmzOB1qCFz4qQ= X-Received: by 2002:a37:9c8:: with SMTP id 191mr1801707qkj.341.1559201881785; Thu, 30 May 2019 00:38:01 -0700 (PDT) MIME-Version: 1.0 References: <20190516080015.16033-1-duyuyang@gmail.com> <20190516080015.16033-12-duyuyang@gmail.com> <20190529114451.GA12812@tardis> In-Reply-To: <20190529114451.GA12812@tardis> From: Yuyang Du Date: Thu, 30 May 2019 15:37:50 +0800 Message-ID: Subject: Re: [PATCH v2 11/17] locking/lockdep: Adjust lockdep selftest cases To: Boqun Feng Cc: Peter Zijlstra , will.deacon@arm.com, Ingo Molnar , Bart Van Assche , ming.lei@redhat.com, Frederic Weisbecker , tglx@linutronix.de, paulmck@linux.ibm.com, LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thanks for review. On Wed, 29 May 2019 at 19:44, Boqun Feng wrote: > > > @@ -424,7 +424,7 @@ static void rwsem_ABBA2(void) > > ML(Y1); > > RSL(X1); > > RSU(X1); > > - MU(Y1); // should fail > > + MU(Y1); // should NOT fail > > I'm afraid you get this wrong ;-) reader of rwsem is non-recursive if I > understand correctly, so case like: > > Task 0 Task 1 > > down_read(A); > mutex_lock(B); > > down_read(A); > mutex_lock(B); > > can be a deadlock, if we consider a third independent task: > > Task 0 Task 1 Task 2 > > down_read(A); > mutex_lock(B); > down_write(A); > down_read(A); > mutex_lock(B); > > in this case, Task 1 can not get it's lock for A, therefore, deadlock. Well, yes. This situation is damn counterintuitive and looks suboptimal, but I guess I can understand why this is done so. It is a shame read locks are not 100% concurrent. I wish I were bright enough to have figured this out on my own. Ok, now this perhaps can be easily remedied. it is merely a matter that finally I can set straight the lock exclusiveness table, and then from there the only change seems to be now only recursive-read locks are no deadlock. Thanks, Yuyang