Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1348894ybh; Thu, 16 Jul 2020 09:40:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmt4+4q7neX2CjGr2J3vdUlgnJiE69TftVb3L91/0ml7e1nhYgiOPPbHEoB8TN2inuCAnz X-Received: by 2002:a17:906:8588:: with SMTP id v8mr4698096ejx.211.1594917624689; Thu, 16 Jul 2020 09:40:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594917624; cv=none; d=google.com; s=arc-20160816; b=0wdN01fAcmm3d0Cnhf6hKoK4FY8de2JTVk8+5KFrdmqftOhStUZ/UoZvLnLhUPTxK2 4qUovMLWdSZq+kfo+xEPkVRX5ec3+Mv3lnsZZAI/1n9xNJJeHLKZSBxN+380GyKT7bO9 P1QFKpGfG6J570OoBBvsy5km8NMWm4qgwqZVuY+8eazyDDww2jHfC9gWS4uZ0NBG9ege XrT5zot9YkrCLrSGbvu+WmiEg4TB96KjuZMU/Ts4MYY7BCsoY8XU8+vg9hqkEJGlYjCB C+bhGJGP+kK5xCM0z4CQ1NA5VnPVzu9TFOsVdvj6RlKIjNmGlKC4hWujH82+qt1A8ybI 6BcQ== 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:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=aOWLCSGIulr8ChkaGsrXoYCNcp/hrmXQAAgM1VJEIJg=; b=0dba9naF8SPuKZJlUVfH0JuvgoS8hIl5CO++LroG3D9kMHd67PzScH/aNWFb/VUDog ASpTC9X89zBgx4gcQX5fwKvSpgWlWtHJsAqdJsPXrlp+3nr5FefFHYM/9eIJ6fIFnOOn QNcpbKuHRuz0XwaYH8+FUXrfvPQUOQ0/KYbJXvB5rg2slwPYlB8hdmn/xfmcoSgJU0Oy CFc+nQRwTo+4GGHOEsLeniCNn50/rcTU+TkSXjaFIywLJ80FNGpuqYqiLJEc7avX4o9Q 7ucd+vf5q7HJc9tJideVexMns5pV55bMwbt98LZE9L6d3fN6akNj1k7Y4MQobWTg8jII pimQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TZBjx7mZ; 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 p5si3458346ejx.318.2020.07.16.09.40.00; Thu, 16 Jul 2020 09:40:24 -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=TZBjx7mZ; 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 S1729296AbgGPQgw (ORCPT + 99 others); Thu, 16 Jul 2020 12:36:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:39310 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725867AbgGPQgw (ORCPT ); Thu, 16 Jul 2020 12:36:52 -0400 Received: from paulmck-ThinkPad-P72.home (50-39-111-31.bvtn.or.frontiernet.net [50.39.111.31]) (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 ECD932065E; Thu, 16 Jul 2020 16:36:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594917412; bh=az0IyH/7x50ZeNPAUBePv3DYZTSReLjZFD9XTeIEdMg=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=TZBjx7mZCeZ9BIBXrD9gII+gVHCj93c1xcflS6+SWNZ0wLRaxTPUdCajWbQEOTSvF l9Kt9BceI6B8WOacBdoI1raEy/zfmGahLNzxFnEOJ3xU6PkUty/6kRqW40aEqF3QLG gcUtvjZGj2+6sTZk9/CxBdyjSkn7SxbKysrEfikA= Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id C99A73522635; Thu, 16 Jul 2020 09:36:51 -0700 (PDT) Date: Thu, 16 Jul 2020 09:36:51 -0700 From: "Paul E. McKenney" To: Sebastian Andrzej Siewior Cc: Uladzislau Rezki , LKML , RCU , linux-mm@kvack.org, Andrew Morton , "Theodore Y . Ts'o" , Matthew Wilcox , Joel Fernandes , Oleksiy Avramchenko Subject: Re: [PATCH 1/1] rcu/tree: Drop the lock before entering to page allocator Message-ID: <20200716163651.GT9247@paulmck-ThinkPad-P72> Reply-To: paulmck@kernel.org References: <20200715183537.4010-1-urezki@gmail.com> <20200715185628.7b4k3o5efp4gnbla@linutronix.de> <20200715190243.GA26735@pc636> <20200715193250.axntj7jdt6bw52dr@linutronix.de> <20200715221449.GJ9247@paulmck-ThinkPad-P72> <20200716141421.fzwf4tedr6rixd6d@linutronix.de> <20200716152027.GQ9247@paulmck-ThinkPad-P72> <20200716153638.gfh6dzp2h35ygfaa@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200716153638.gfh6dzp2h35ygfaa@linutronix.de> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 16, 2020 at 05:36:38PM +0200, Sebastian Andrzej Siewior wrote: > On 2020-07-16 08:20:27 [-0700], Paul E. McKenney wrote: > > You lost me on this one. I am instead concerned that something like this > > might be needed on short notice: > > > > raw_spin_lock(&some_lock); > > kfree_rcu(some_pointer, some_field_offset); > > > > In contrast, single-argument kfree_rcu() cannot be invoked from any > > environment where synchronize_rcu() cannot be invoked. > > I see. We don't have any kfree() in that context as far as I remember. > We had a few cases in "resize" where you allocate memory, copy content > and free old memory while under the lock but they are gone. True, but we also didn't have any calls to call_rcu() prior to the call to rcu_init() until suddenly we did. (Yeah, I could have put my foot down and prohibited that practice, but the workarounds were quite a bit more complicated than just making call_rcu() work during very early boot.) And last I checked, there really were calls to call_rcu() under raw spinlocks, so the potential or calls to double-argument kfree_rcu() clearly exists and is very real. > > > > Yes, dropping to a plain spinlock would be simple in the here and now, > > > > but experience indicates that it is only a matter of time, and that when > > > > that time comes it will come as an emergency. > > > > > > Hmmm. > > > > I point out the call_rcu() experience. > > > > > > One approach would be to replace the "IS_ENABLED(CONFIG_PREEMPT_RT)" > > > > with some sort of check for being in a context where spinlock acquisition > > > > is not legal. What could be done along those lines? > > > > > > I would rethink the whole concept how this is implemented now and give > > > it another try. The code does not look pretty and is looking > > > complicated. The RT covering of this part then just added a simple > > > return because nothing else seemed to be possible. This patch here > > > looks like another duct tape attempt to avoid a warning. > > > > In addition to the possibility of invocation from BH? > > Invocation from BH should be possible because network would probably be > the first user. I don't remember anything wrong with BH if I remember > correctly. OK, that is reassuring. Here is hoping! Thanx, Paul