Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp47498ybk; Tue, 12 May 2020 15:01:08 -0700 (PDT) X-Google-Smtp-Source: APiQypLpRbrLC5UkNSrIfDnzIweNkEsDyOtl8wELJNV3A+O//0t9jUiySpItwFUDQLwzsvuyBz7V X-Received: by 2002:a17:906:a417:: with SMTP id l23mr18090737ejz.213.1589320868252; Tue, 12 May 2020 15:01:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589320868; cv=none; d=google.com; s=arc-20160816; b=bRhI8ZcMREPY+cVLv+NSdS6Av4FyIn/I3Af1kUNPTuZZN4GOVo1p4ky7X5cTfcRJQA j6iUrYEr6/S0n4gjmJUAb8SLPneZv651ISUfytxAyVW5gmIn+OsnuY76tph223NpJxR6 0vvu253oOlrVrTBcHJvPNy2R8A7ktVeKX2wEaop6IJZPzySwYc88UE++FfmhU/ZG//rd zwcK+pmGwx8LMpiIqfG6XuY7xe0ukY8REM9FlUxlgfBuxXaGVLXMAX5qkEovdIVc+lqS 7YLzZOR+3jcD5KwA4xslDDCrsq6wrvW1JnJ6yOm20FFAVJHmSPpdEYUQXAQYQbuNuU13 PhVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=9QcYVLyGhYtpR5A6i5jM/y0/OxD1ap1/35e79tJK3mQ=; b=TjyY9WHkLDWaa6o2eqe+9gzufCj1AQ6i5fV9Z6PqdZAskXz7CwwgaosoNR+ad1QVN0 25eBsCDLF3jhJPJHspbVrENoIdG23//mku61SDjuYduHQoj8o+qJBND0Gw7azT4oC8yT CyPtXWMfcO69RQzC1MDwzCEh2p765/e/t2JNh/yr/S4i/lodJJmToux5aSLAZBo51SV/ wfs9KfVrVBUISq7FGyK+GqPWU/2+iSgprX/bopj79t09K789U1EW1ieOR+ClHZ5hWqqB 00qVk+uJJ8EcNcKiGgs3uZ3J9LpEt1sll8QPatOGMSmotgujCIoi+O6dcs+zYWwjK6Z2 u64w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Orwq489T; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u12si5153357ejt.385.2020.05.12.15.00.44; Tue, 12 May 2020 15:01:08 -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=@kernel.org header.s=default header.b=Orwq489T; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731528AbgELV7V (ORCPT + 99 others); Tue, 12 May 2020 17:59:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:37040 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728313AbgELV7U (ORCPT ); Tue, 12 May 2020 17:59:20 -0400 Received: from kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com (unknown [163.114.132.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A2180206B7; Tue, 12 May 2020 21:59:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589320760; bh=umeyPfzMnWUsI5DYYCbU0pSKl5SS197xscOjTElhVOU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Orwq489TX5Fd2s66luzYbKVVgduIHMk5HY1Z5C2/g255CTs0S+aNNxq/hJsS/Y41o W8r0qfRHsg71g6f6Rxqm6CQwuwh6IBrjpO2gNOLIXo4fj0upk24RpESOk6UItCHhiL YVKL1XGaqCNX3GK3lmfbBhf5Q01Dnb+hT43e1oCQ= Date: Tue, 12 May 2020 14:59:17 -0700 From: Jakub Kicinski To: Amol Grover Cc: Madhuparna Bhowmik , sfr@canb.auug.org.au, "David S . Miller" , Alexey Kuznetsov , Hideaki YOSHIFUJI , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, Joel Fernandes , "Paul E . McKenney" Subject: Re: [PATCH net 2/2 RESEND] ipmr: Add lockdep expression to ipmr_for_each_table macro Message-ID: <20200512145917.729db7bd@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: <20200512171710.GA3200@workstation-portable> References: <20200509072243.3141-1-frextrite@gmail.com> <20200509072243.3141-2-frextrite@gmail.com> <20200509141938.028fa959@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> <20200512051705.GB9585@madhuparna-HP-Notebook> <20200512171710.GA3200@workstation-portable> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 12 May 2020 22:47:10 +0530 Amol Grover wrote: > > > This is a strange condition, IMHO. How can we be fine with either > > > lock.. This is supposed to be the writer side lock, one can't have > > > two writer side locks.. > > > > > > I think what is happening is this: > > > > > > ipmr_net_init() -> ipmr_rules_init() -> ipmr_new_table() > > > > > > ipmr_new_table() returns an existing table if there is one, but > > > obviously none can exist at init. So a better fix would be: > > > > > > #define ipmr_for_each_table(mrt, net) \ > > > list_for_each_entry_rcu(mrt, &net->ipv4.mr_tables, list, \ > > > lockdep_rtnl_is_held() || \ > > > list_empty(&net->ipv4.mr_tables)) > > > > > Jakub, I agree, this condition looks better (and correct) than the one I > proposed. I'll do the changes as necessary. Also, do you want me to add > the full trace to the git commit body as well? I omitted it on purpose > to not make it messy. In this case we can leave it at the depth of IPMR code + the caller, so: [ 1.534758] ? ipmr_get_table+0x3c/0x70 [ 1.535430] ? ipmr_new_table+0x1c/0x60 [ 1.536173] ? ipmr_net_init+0x7b/0x170 [ 1.536923] ? register_pernet_subsys+0xd/0x30 This makes it clear that the problem happens at net namespace init. Thanks!