From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Paul E. McKenney" Subject: Re: [PATCH 2/5] rhashtable: don't hold lock on first table throughout insertion. Date: Mon, 23 Jul 2018 13:56:25 -0700 Message-ID: <20180723205625.GZ12945@linux.vnet.ibm.com> References: <153086169828.24852.10332573315056854948.stgit@noble> <153086175009.24852.7782466383056542839.stgit@noble> <20180720075409.kfckhodsnvktift7@gondor.apana.org.au> <20180720144152.GW12945@linux.vnet.ibm.com> <87muulqq8q.fsf@notabene.neil.brown.name> <20180722215446.GH12945@linux.vnet.ibm.com> <87h8kqrhi0.fsf@notabene.neil.brown.name> Reply-To: paulmck@linux.vnet.ibm.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Herbert Xu , Thomas Graf , netdev@vger.kernel.org, linux-kernel@vger.kernel.org To: NeilBrown Return-path: Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:37054 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388052AbeGWV7Z (ORCPT ); Mon, 23 Jul 2018 17:59:25 -0400 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w6NKsMXR177273 for ; Mon, 23 Jul 2018 16:56:25 -0400 Received: from e13.ny.us.ibm.com (e13.ny.us.ibm.com [129.33.205.203]) by mx0b-001b2d01.pphosted.com with ESMTP id 2kdmd94vw4-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 23 Jul 2018 16:56:25 -0400 Received: from localhost by e13.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 23 Jul 2018 16:56:24 -0400 Content-Disposition: inline In-Reply-To: <87h8kqrhi0.fsf@notabene.neil.brown.name> Sender: netdev-owner@vger.kernel.org List-ID: On Mon, Jul 23, 2018 at 09:13:43AM +1000, NeilBrown wrote: > On Sun, Jul 22 2018, Paul E. McKenney wrote: > > > > One issue is that the ->func pointer can legitimately be NULL while on > > RCU's callback lists. This happens when someone invokes kfree_rcu() > > with the rcu_head structure at the beginning of the enclosing structure. > > I could add an offset to avoid this, or perhaps the kmalloc() folks > > could be persuaded Rao Shoaib's patch moving kfree_rcu() handling to > > the slab allocators, so that RCU only ever sees function pointers in > > the ->func field. > > > > Either way, this should be hidden behind an API to allow adjustments > > to be made if needed. Maybe something like is_after_call_rcu()? > > This would (for example) allow debug-object checks to be used to catch > > check-after-free bugs. > > > > Would something of that sort work for you? > > Yes, if you could provide an is_after_call_rcu() API, that would > perfectly suit my use-case. After beating my head against the object-debug code a bit, I have to ask if it would be OK for you if the is_after_call_rcu() API also takes the function that was passed to RCU. Thanx, Paul