Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5818434yba; Mon, 13 May 2019 18:33:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqy709bf8vSQP+cF5VAmFk4vLYxvzMNiIU1YtopZplVkwl/ccfuXwuAIVG8at6dPEBG2Hl7c X-Received: by 2002:a17:902:2a69:: with SMTP id i96mr1314251plb.213.1557797596252; Mon, 13 May 2019 18:33:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557797596; cv=none; d=google.com; s=arc-20160816; b=bFl9+BEIfeZ38PV8X9OQ3B4krKkxwbblQ7PuIMaXehcRjYQR7PxNEfBk+4HzdRWtAw wgmj6PpEM/pRxK+ozzy0jk7l5Vg8N6rN0khsRK0Aej3z5TGzJHFmUjf/Z/0yU/mqTeBv elFdSoMpaHb+9p5xjR5RSb0k6XIiNLBtgpoLQzvNBBVuaM2xi6BwH604ZT2aIMjzDcch 5BJAs034684AmeAR5O6I/0hQrAONrkiSpCvjTgipEHj6DBj+p0CWy5C5DhmD2l0YvdA2 TDmMVH5gOvuYRbsE5yuNMczkiWhxBug3YkXoDpzXlMgUmte45p1RfJ4hmVNPMlZM+oXe +HWA== 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=+uzZggL7uaEuD2m83sZrmm7ypbTjMCDPij4bD1U6Km4=; b=NqsT/LXnGrYebDvc0/QBtWItW4jWrZLuY4L9/10QbJ5zvddcc7Y9+PfkeeoxxkWsQY xphyoCDTt53pX9O7qtnaHnBidekuO6gUl8S/OSF72/VZ17T6+ZxK7U56R4ZVVeCVkf0r S9PqAR42RHFH0VGf/WkCBPJ3i/oHkoQ2THHK4DEi6CQ7unk86luB3Xc2GCeCT2H/Zj5w BTNh/ckCeahmoZDfYpdW8iSwQdi9tfDfZI+17k3IbhV07Z456d5Z1kGUSRxVuNZtdU9n sz4rZ7JLBPD2iU0ncVrIeFH2ysuRurCm2Bn1akNBBdJ7XFOLxNifcgEkq+pSeEz+OtuC BiIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Yw1d42kc; 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 d15si19873500plj.91.2019.05.13.18.32.58; Mon, 13 May 2019 18:33:16 -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=Yw1d42kc; 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 S1726547AbfENBcF (ORCPT + 99 others); Mon, 13 May 2019 21:32:05 -0400 Received: from mail-qk1-f195.google.com ([209.85.222.195]:39856 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726233AbfENBcF (ORCPT ); Mon, 13 May 2019 21:32:05 -0400 Received: by mail-qk1-f195.google.com with SMTP id z128so9318402qkb.6 for ; Mon, 13 May 2019 18:32:05 -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=+uzZggL7uaEuD2m83sZrmm7ypbTjMCDPij4bD1U6Km4=; b=Yw1d42kccOcuD4dM7cuNCekEKABH6dROBIov4bmT2B0NlJosxDADNL374BYkyGsZ7O ppkbJsz1p/rLMWbj8auOxxtk+8yqcSVbCoKC3YmaK9JE3B6evqoamQkrRFqjadnAyCoR abQt5RWrmkyS2RlmAjn7P6A7+Nexr115z6KlwjkXPlL1+mrLF02nx2ttKQu8FuNe2k5D lUqYCYrfjBVM6U76AjqglaQ84i30xx8uGOOlmkzeQVG/y1TF/x5iEES+FS1sXg0Ey3Va tmXPF0hNu9BRqJyECy9WqYXeGo4wmXax8N99ysoCdAF4HUCFAlvwBQQgRnRyaVSOONUZ YckQ== 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=+uzZggL7uaEuD2m83sZrmm7ypbTjMCDPij4bD1U6Km4=; b=E77v3PmR/zVi3RnybfonoxCjCxGCdaLUJVL2RNIHqyOYnf+yA6QIixR1jNpCRT8QJx d0rIfHdbNxNmqNQu0jxv29GBoZUJA5/YlY2Bdi2j7bO/2Eue/v82I3+qAOTQHsVjQO+6 Eu1cj72R25HH9bBOKmk3hoUvXPgEeCNqjb2QDgFFb56TV8mTOJ+a/DwU0vjiwsmESb6b UeYkBMT6RH1EGT6Mcv7Y00pfwncN/wQ1IXQCieJAMiom+zuXUaE6Hyeg8lhJx7IPwi5c t/uwtJF/iO6IFw1CkXgY+vv0r8njjWsk8GeheLfNfYunZbZyJ4ujyLfzMyo+7etS0+eL ABiA== X-Gm-Message-State: APjAAAV2lvcFAXR1FA9szy0fHxnqU9E6pTjhsDjKBJ2L9i56DhSGFl9/ LcPrTqfN/Qyx/1qs8rFmFvaT7lEoyXQPLOyMmoo= X-Received: by 2002:a37:b4c6:: with SMTP id d189mr25209054qkf.173.1557797524504; Mon, 13 May 2019 18:32:04 -0700 (PDT) MIME-Version: 1.0 References: <20190513091203.7299-1-duyuyang@gmail.com> <20190513091203.7299-2-duyuyang@gmail.com> <20190513114504.GR2623@hirez.programming.kicks-ass.net> In-Reply-To: <20190513114504.GR2623@hirez.programming.kicks-ass.net> From: Yuyang Du Date: Tue, 14 May 2019 09:31:48 +0800 Message-ID: Subject: Re: [PATCH 01/17] locking/lockdep: Add lock type enum to explicitly specify read or write locks To: Peter Zijlstra Cc: will.deacon@arm.com, Ingo Molnar , Bart Van Assche , ming.lei@redhat.com, Frederic Weisbecker , tglx@linutronix.de, Boqun Feng , 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 Mon, 13 May 2019 at 19:45, Peter Zijlstra wrote: > > On Mon, May 13, 2019 at 05:11:47PM +0800, Yuyang Du wrote: > > + * Note that we have an assumption that a lock class cannot ever be both > > + * read and recursive-read. > > We have such locks in the kernel... see: > > kernel/qrwlock.c:queued_read_lock_slowpath() > > And yes, that is somewhat unfortunate, but hard to get rid of due to > hysterical raisins. That is ok, then LOCK_TYPE_RECURSIVE has to be 3 such that LOCK_TYPE_RECURSIVE & LOCK_TYPE_READ != 0. I thought to do this in the first place without assuming. Anyway, it is better to know. And I guess in a task: (1) read(X); recursive_read(x); /* this is ok ? */ (2) recursive_read(x); read(x) /* not ok ? */ Either way, very small change may need to be made.