Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp888595pxk; Thu, 1 Oct 2020 16:59:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKsNTXQ15i8Qzd0j6buJY+RQALESKWhy96Kb8kqha4cOgbxwlP8OO2zU2a71RiNvi9S1c/ X-Received: by 2002:a17:906:5809:: with SMTP id m9mr10577462ejq.304.1601596786267; Thu, 01 Oct 2020 16:59:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601596786; cv=none; d=google.com; s=arc-20160816; b=LUsm31vfZzkQjXSCKXei4cki9T/fcxQknoel5cQkq7nkF+O7xr6SFR1Os/q+NdhtDQ pfush8xW1GQY0MXFIq/RKdSokVNlyekT7LawAl1oEk5pBcOBgqJT+PmNzcmmmNDSH7/z fDHS6qZnau7uZL9Ts7Fd6TZHzvWcHutCGoBPLBVt3tgy8x+uG3P43XKqt63sIPjwWJGC N8LG9rrXyRY+FKLF6vSXJbGOwHCnf8uzubAaP3XueUSBOX9HF5m3nAMuZvNR2uURNICp XYmkDzIWLAzGImTWW1GRSN8q6NjiSPtYSuhVr/ndLVj1ZV9i4IYq5XmoSS7gN5MzXaUC ctbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=huRrm9uRTF6EQtP3Gb3rzv3n9rl5QC5dhEPKA1yWUwo=; b=x1wLvyg46PDkSVGCVmg84Vc84/nxG5deHMfw3SDKfPkU7nVVYVjYuFU/70rBPWOhJu aboFo9w6eWrsSxPn2ubY2ku6k8gsPY4woTABvOIlatKsaBIcuHnFCZQJt1147fzOmIJq OoOO1LXQuYaX6HhtLap1DyV6Hcr6W4C9a6uYULBh4/L05NyyPwfpITNpXOVaUi+I5o1r eflseZxJq0BJA6pSV7LBSYbylZhh/9Kndn6T+BF5SVMr938BkGMch68CM7/ZM4kPXSRb UnPlVtV0MLim7+s5f7O9C+NnNdaXK5LFayK1apY30KTyWvFXsZzSRYTyGokAnu+U+OeE acSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=XaP00L7E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h7si4359395edt.471.2020.10.01.16.59.23; Thu, 01 Oct 2020 16:59:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=XaP00L7E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733085AbgJAX4T (ORCPT + 99 others); Thu, 1 Oct 2020 19:56:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727017AbgJAX4S (ORCPT ); Thu, 1 Oct 2020 19:56:18 -0400 Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96A19C0613D0 for ; Thu, 1 Oct 2020 16:56:18 -0700 (PDT) Received: by mail-ej1-x642.google.com with SMTP id a3so312715ejy.11 for ; Thu, 01 Oct 2020 16:56:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=huRrm9uRTF6EQtP3Gb3rzv3n9rl5QC5dhEPKA1yWUwo=; b=XaP00L7EdhotRxKDmoF2aYq7K8neRHGRpPiSpCbWUMRbbHRzomvmHNio8rp7Bqld9k 6sTEPllvCqsoowPLp5OqORiyIKcW9T3Nnve22rGNj4up9gkv9fvV2sJFnhhzQLH9spc7 gPewysecSzSqjCaI+kmUiKHcR15RTvcZsOcPERvYwkc3XKv+DA31+BNxlkYr0Yine0qq Wn5Q8Hjelz1j02imtNEGqQTx471nFgRWf41hl+blA8s+LvRVTgtDr6cdpTmNQIDKZ0dL DK6OwtyNLs0JS6FjQKc/0mTfkd/D6xAZVyFdtmlAKKd2kHweSimVSSihZbvTfZk8q9CE Q36A== 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=huRrm9uRTF6EQtP3Gb3rzv3n9rl5QC5dhEPKA1yWUwo=; b=cPURqjAN7gCoEdXWZsd1GJ00CupifpSHp24IvSc2plRgqXININ2wftzw9JfI64vJEe jef+zsu9BdPCXA07b2VWxTY/2VVYuQ/LBKn30crXm1Q1Dlg2K05hsmddL0c95ZMvxM4L Un2cy7T5C+RNohParOPX0JeHQGz3w2Oze2+FP2ompmwnqR+to38dsPp5fmzaXysy3KoK uqP8p8njgfvq/w9utAF+dmbtbCuvUvhMmMel5UtKoTph+bqTPOTVbMRz8zcfPxpDfRoh 78lP5iTK/UZmlxJLUoevhnU47Fcv0622WZOmRGeM0Wg7esGHmZboGfzs0ZwIbVOsE+9g 2+Xw== X-Gm-Message-State: AOAM530oMBu1QFYgPAO5dcZVUpQCPPLfgUQUHL4e70nLltEz9j5Y9PSb l0SS+eohBhtvWUuC0yYdXiPHyJmu8NSUTGP43fHQEw== X-Received: by 2002:a17:906:980f:: with SMTP id lm15mr11072385ejb.184.1601596577053; Thu, 01 Oct 2020 16:56:17 -0700 (PDT) MIME-Version: 1.0 References: <20200930011944.19869-1-jannh@google.com> <20200930123000.GC9916@ziepe.ca> <20200930232655.GE9916@ziepe.ca> <20201001191512.GF9916@ziepe.ca> <20201001234127.GG9916@ziepe.ca> In-Reply-To: <20201001234127.GG9916@ziepe.ca> From: Jann Horn Date: Fri, 2 Oct 2020 01:55:51 +0200 Message-ID: Subject: Re: [PATCH 3/4] mmap locking API: Don't check locking if the mm isn't live yet To: Jason Gunthorpe Cc: Michel Lespinasse , Andrew Morton , Linux-MM , kernel list , "Eric W . Biederman" , Mauro Carvalho Chehab , Sakari Ailus Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 2, 2020 at 1:41 AM Jason Gunthorpe wrote: > On Thu, Oct 01, 2020 at 10:16:35PM +0200, Jann Horn wrote: > > > A subclass isn't right, it has to be a _nested annotation. > > > > > > nested locking is a pretty good reason to not be able to do this, this > > > is something lockdep does struggle to model. > > > > Did I get the terminology wrong? I thought they were the same. The > > down_*_nested() APIs take an argument "subclass", with the default > > subclass for the functions without "_nested" being 0. > > AFAIK a subclass at init time sticks with the lock forever, the > _nested ones are temporary overrides. > > I think what you kind of want is to start out with > lockdep_set_novalidate_class() then switch to a real class once things > are finished. Not sure exactly how :) Huh, is there an API that sets a *subclass* (not a class) at init time? I don't think there is. Anyway, I'm pretty sure I just need to use the normal _nested() locking API. I'm still cleaning up and testing a little bit, but I'll send it out in a short while, unless I run into unexpected trouble. Let's continue this if necessary once there's a concrete patch to talk about. :)