Received: by 10.223.185.116 with SMTP id b49csp582761wrg; Fri, 23 Feb 2018 03:38:35 -0800 (PST) X-Google-Smtp-Source: AH8x224mRhzDxw5SW+Sr0/ewBfBzRRzTQbN/+JWE+Ww1AxU5wGhS3ByrmnG4a9ZeWosJ5Vx/fXHa X-Received: by 10.98.17.147 with SMTP id 19mr1478919pfr.160.1519385915838; Fri, 23 Feb 2018 03:38:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519385915; cv=none; d=google.com; s=arc-20160816; b=NrUxIKRBR/bciG3zTwa2JVKeC0+IBmu5Bg/alpmHfjtQUXbzoCaU/IieOXiaBbxy7d nsudZ4XrOukC4Zmd/kHZMUIz06yHE+xM6e+xhL7Eqw06vVFJOTnoYdNO3VaMRpvQxoe9 jbxxqySHQ2BN/TZ4LKvP4v1TDsNv202Lvv58mhwZQHN5p0B30me0o3RCU1gwAr5YUd6n BJ3EGenWtZOwYY6oobyX2P1UBLu3PwmMIcg4jTky9He4w/gMqG4UplZcZu0zNMkImL2e rBjMCxjrTX8eB5PBTztOPM57S58Byn9M+2cwcC8u2idlIPRnWXilKOKzc4RVo4k+H7KS CWmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=uvLRpMPKaQvm1H2G+G/ixdziSVaDe5M/4Ya3WeRyZeY=; b=fJ/bAhjqtcD9dTe7f6tzWXDI14P7IrlsVI4zyWGrp39kwxaTr7d51C382qJ5Bdhicx xckFnVHt36ALx9hIqedmRUVIrEhDXm7aFqcNeiB18QsOzhSUUqpxtXfck/pi8Map41NZ dKgHZnUULGFQk/6DWzzUA+X615WslfMKP9brY9e9LpbP/d8O3GPVNCJqrEMh2BIxDjyb cKK6koBLGaJP8WhffL884htGPbnbKAc0NJPi2wV5RsNWBIT8DyKkwcK3jKzNiZJSnRGo m5anYCGGT3WUsAmpPJwKyOA/WfhULzXAHZm2d1fMQj6FiEsmf8PA0idEdhGINaF9QYUG Mnag== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=K92byE1S; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m73si1674237pfj.131.2018.02.23.03.38.21; Fri, 23 Feb 2018 03:38:35 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=K92byE1S; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751440AbeBWLgw (ORCPT + 99 others); Fri, 23 Feb 2018 06:36:52 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:59468 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750910AbeBWLgv (ORCPT ); Fri, 23 Feb 2018 06:36:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=uvLRpMPKaQvm1H2G+G/ixdziSVaDe5M/4Ya3WeRyZeY=; b=K92byE1SfFv7rEkiOvuTYo03A m2wWhjGVVbulBXWfWiqfEsg3EIZqrieVUI0SCf/J0GUS4DpvFDQCCkalRPQAUZeHNjtR3z2WyoHlV NVktWW7n4wqUD8IoDyiAOQ60m3jxwt8DyGoV8CV8IpFk3pranGrQ8uoCXXuc82uAjw5loFEOXW733 Ve4e9HZrhVK02KgJpAAtyNy/eq3HwMNE5BuJbNM0nHyttSYXmC4ZVZymBXVG2XS8oBgg+1nJkOAR1 bymuTNxlucWNCQZCQoUygKjmKFbDZsqBz7Dr0mzOkYbeEEiTY9XlTHKm5DZOMSvaFm7e7ih1yK12T 0I91CE92Q==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.89 #1 (Red Hat Linux)) id 1epBef-0003DN-Ta; Fri, 23 Feb 2018 11:36:46 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id E655C2029FD41; Fri, 23 Feb 2018 12:36:43 +0100 (CET) Date: Fri, 23 Feb 2018 12:36:43 +0100 From: Peter Zijlstra To: Boqun Feng Cc: linux-kernel@vger.kernel.org, Ingo Molnar , Andrea Parri Subject: Re: [RFC tip/locking/lockdep v5 08/17] lockdep: Fix recursive read lock related safe->unsafe detection Message-ID: <20180223113643.GX25201@hirez.programming.kicks-ass.net> References: <20180222070904.548-1-boqun.feng@gmail.com> <20180222070904.548-9-boqun.feng@gmail.com> <20180222174654.GW25201@hirez.programming.kicks-ass.net> <20180223082134.ykkbzqj2h7glxrqn@tardis> <20180223085812.22u7o6z2gcg272jn@tardis> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180223085812.22u7o6z2gcg272jn@tardis> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 23, 2018 at 04:58:12PM +0800, Boqun Feng wrote: > Hmm... think again, maybe I can combine case 1 with 3, and case 2 with > 4, because each of them could share the same find_usage_backwards(), and > find_usage_forwards() uses a usage_match_forwards() as follow for the > match function: > > static inline int usage_match_forwards(struct lock_list *entry, void *bit) > { > enum lock_usage_bit ub = (enum lock_usage_bit)bit; > unsigned long mask; > unsigned long read_mask; > > /* mask out the read bit */ > ub &= ~1; > > mask = 1ULL << ub; > read_mask = 1ULL << (ub + 1); > > return (entry->class->usage_mask & mask) || // *-> L2 and L2 is an irq-unsafe lock > ((entry->class->usage_mask & read_mask) && !entry->is_rr); // N-> L2 and L2 is an irq-read-unsafe lock > } > > Got a bus to catch, I can explain this later, if you need ;-) Right, that's about what I was thinking of. Clearly that needs a wee comment but it's much better.