Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp304481yba; Thu, 25 Apr 2019 23:48:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqyxORhC5aCn7LcdESijZcgya8UhRAMw+KnTiQ6ZuDXpGX/7NYMrUTwKbXHf9RlQVZwAlbDz X-Received: by 2002:a17:902:684a:: with SMTP id f10mr18649819pln.286.1556261317695; Thu, 25 Apr 2019 23:48:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556261317; cv=none; d=google.com; s=arc-20160816; b=slm4xRHkG0NQt5wwDE9fI4agHOCizNcM/IY5pXlOq0/4sJcT5SfdNrTCBum5GugL2o RwjQFEAsIyaf9gef8xiqos/Qu5zw6VIuOumWGoTaSaLYZjE8b9Z2YHESvzSc1jqGxZMB sTIt2JOVvg7DckfOYm7Xpf77ezgkPtrhniEqPcgMypOKx6qrbb9YOBFGeb7P+sdZDR/X poNvkH/qbaoKQowYQp0pD4TGmAnCu2cREjloZq9VSmILmFwjuAJFvCTSokx2mW7WOWbK sRna8jwgdT35y8hzUbhv0R5+yXfAyh5/IHyg3C3W6f54y96p5CtmX14hu/y2ASQj9tC2 JgQA== 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=+jNz4gntAB8156apHxCMFhJ92iHi21h3N/PZZLyrHKQ=; b=ReyWRy9ZW0WbmoovtwXA313kg3P2iSVd1nsMjjIAGIPII3SPYQK6oIDHSsnEqg9c9W DHNOuW1NWeXrXuRYzjx15vdJd1JCwC/jNRNffPX4MrJZHSjJ1TBF0wNot8BULYVVzwfH +NMzT8CKtl5m5yeXXzF333aMJX5zzX8pXhu7WylWVARebjWQJ56U+g+/a8r9pggEbTJK hm/pytZqpX+nvKhOMX+3RrKNYDyk4t33MkAFHAtgykcb/mHOky3lbkqT/I3OtvN2YbhL WtPO1UcwKV13hfhgRR7s5pdY4OA9422bIpdhJkPiKNlr1l9SmFt0Uvc8RaxS7KJCLp3G 4FKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=QMwIdMqw; 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 h20si22711565pgv.352.2019.04.25.23.48.22; Thu, 25 Apr 2019 23:48:37 -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=QMwIdMqw; 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 S1726138AbfDZGpn (ORCPT + 99 others); Fri, 26 Apr 2019 02:45:43 -0400 Received: from mail-qk1-f193.google.com ([209.85.222.193]:45012 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725893AbfDZGpn (ORCPT ); Fri, 26 Apr 2019 02:45:43 -0400 Received: by mail-qk1-f193.google.com with SMTP id y5so1255805qkc.11 for ; Thu, 25 Apr 2019 23:45:42 -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=+jNz4gntAB8156apHxCMFhJ92iHi21h3N/PZZLyrHKQ=; b=QMwIdMqwRT43VgnCqcadXBtdtwH3jGQXw4Maj/+RNrsu02q9+YgaAH0lGWzKydv54g W8WwwzK+GjMe++5Z1ZYrXlXHPUrtpIZR2MdvCsRB93cwMyR+C0/tKsosxdGh1wB9ouiS 20XyXpjFsyX1K6R26MbKPbSklePamHs1YKHviyqQkOH0KIGarHN2B+ja/qJz0mXNlqx+ 9zEYwgJFICiZQJas4LMWnR23p2+E7Ma2G0rcuV8XSKjXPOfheX0cB/2N4WuV0A7i1Kql gleHvjYVhY+ojLIMRCU6EODq/oqpj7CDOob3YIHAUJWuvZ8sk/cPS5JQkLEoLZDPum7v 8azQ== 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=+jNz4gntAB8156apHxCMFhJ92iHi21h3N/PZZLyrHKQ=; b=Bp914XBb4q7vcIEf6ffM/uO1Lizo++xGTAbJdCRnQNvERf2bFCwQ5tq26/at8qlmap uIiWFoF7lV7Wj5bbpXN4kVkM4FD4LeyT/Ec2Z5VLALxCokTH/5FC2t/tyHy202FkY07w Qz9rnPjTvY5zzK/X129CA8zHQjxK2kQxppgTPUIfTty0NngLH4Xw3b4VBKWa245i0kBo PraLz71svqogfbzGMfS6EMWPeU66uECX1eevIR12oFuvQha0zO/DygPt7YdWY8i8YGAd /f7ZMU01Ezl2t4QC5LhruOPTTdcFnD8s1QG5SQteT23tXNE33ToNhWQ000L+b6IdL6n/ Lc8A== X-Gm-Message-State: APjAAAV98YuJWGlFgYmOf/kdFwRYR1TJycPTUUEEiTAOHC+zUneeTGBN qxawGTt3RM31rSwrQw1SCB1Tfp15bLD8CeoKPcE= X-Received: by 2002:a05:620a:1088:: with SMTP id g8mr9658259qkk.173.1556261142229; Thu, 25 Apr 2019 23:45:42 -0700 (PDT) MIME-Version: 1.0 References: <20190424101934.51535-1-duyuyang@gmail.com> <20190424101934.51535-24-duyuyang@gmail.com> <20190425195515.GX12232@hirez.programming.kicks-ass.net> In-Reply-To: <20190425195515.GX12232@hirez.programming.kicks-ass.net> From: Yuyang Du Date: Fri, 26 Apr 2019 14:45:31 +0800 Message-ID: Subject: Re: [PATCH 23/28] locking/lockdep: Update irqsafe lock bitmaps To: Peter Zijlstra Cc: will.deacon@arm.com, Ingo Molnar , Bart Van Assche , ming.lei@redhat.com, Frederic Weisbecker , tglx@linutronix.de, 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 Fri, 26 Apr 2019 at 03:55, Peter Zijlstra wrote: > > + if (!dir) { > > + unsigned long *bitmaps[4] = { > > + lock_classes_hardirq_safe, > > + lock_classes_hardirq_safe_read, > > + lock_classes_softirq_safe, > > + lock_classes_softirq_safe_read > > That again should be something CPP magic using lockdep_states.h. Yes. > Also, that array can be static const, right? It's just an index into the > static bitmaps. Sure. [...] > > +static inline void remove_irqsafe_lock_bitmap(struct lock_class *class) > > +{ > > +#if defined(CONFIG_TRACE_IRQFLAGS) && defined(CONFIG_PROVE_LOCKING) > > + unsigned long usage = class->usage_mask; > > + > > + if (usage & LOCKF_USED_IN_HARDIRQ) > > + __clear_bit(class - lock_classes, lock_classes_hardirq_safe); > > + if (usage & LOCKF_USED_IN_HARDIRQ_READ) > > + __clear_bit(class - lock_classes, lock_classes_hardirq_safe_read); > > + if (usage & LOCKF_USED_IN_SOFTIRQ) > > + __clear_bit(class - lock_classes, lock_classes_softirq_safe); > > + if (usage & LOCKF_USED_IN_SOFTIRQ_READ) > > + __clear_bit(class - lock_classes, lock_classes_softirq_safe_read); > > More CPP foo required here. Definitely. > Also, do we really need to test, we could > just unconditionally clear the bits. Actually, these tests are used later for another cause: we want to know which safe usage may be changed by zapping this lock.