From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8127720DFD; Wed, 28 Feb 2024 04:42:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709095346; cv=none; b=JEqxT8GADVo84KTeO6us+ClptTh2ZLLbynl7SDeP20JPD3mT64x1wAgyqk2vnBIkEhEbT8v5BCEfb5FrWYJPAk6nVNPT04W6ook2skQcwXOVfA0HHNrgtYO2UwUfOBBviqnuPEFLqUJejlV6DxdoW/esZo4FvJRPI+FI9fxBGZA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709095346; c=relaxed/simple; bh=mHd/KQs2I6DtcTXYUjb2qGOo80+cn1MWMpEjtSlbgWg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=A/XaYlUKnfKWu5FQ8U522YyzndQN4BYY5DQbUR5nacx5aEMCxxSNkvbJd6jmZZbsLIAG/6H421FMd2OkjC/0I2qIBln8D0B+dELRXlZGLjaeykIJpJhdib2ZXwAhRjhd6Jzp95s2rOM8zEnTt0NEyEDNkm4QfN3SpJR2ABncybI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bjDPcJWB; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bjDPcJWB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48C45C43390; Wed, 28 Feb 2024 04:42:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709095345; bh=mHd/KQs2I6DtcTXYUjb2qGOo80+cn1MWMpEjtSlbgWg=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=bjDPcJWBRSScqEAHFdMNHIvdus7GT20rmgdWQlLM6komppf0OM9pXAtksqKLXpO5X sF/lPVh6a0C+tvwD5qQzR4k0bhKYjTiNkVJoihwKgob+xq0QzEjpgbAsN+l506CarJ 8qf8m2m21wgxOJMZQE1AHU0DF6xc9R8vxZlvvU5OKRsXZMeAc7DocSr7RTsP1qBcIQ szC+Z2RO5Jlei1nuFHhCeKKWnZTjczypK+blhtyu07FKHs1JdOktWgYXWbDJSYDqzH mYLrFKMyYTRynVYd+qaq3oYVvC8755GzhGLuu3PVxgN/ThoAQdefhjgb/t1j1MzgGs fvOLvQJ0twNdw== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id D86F5CE088C; Tue, 27 Feb 2024 20:42:24 -0800 (PST) Date: Tue, 27 Feb 2024 20:42:24 -0800 From: "Paul E. McKenney" To: Jakub Kicinski Cc: Eric Dumazet , Yan Zhai , netdev@vger.kernel.org, "David S. Miller" , Paolo Abeni , Jiri Pirko , Simon Horman , Daniel Borkmann , Lorenzo Bianconi , Coco Li , Wei Wang , Alexander Duyck , Hannes Frederic Sowa , linux-kernel@vger.kernel.org, rcu@vger.kernel.org, bpf@vger.kernel.org, kernel-team@cloudflare.com Subject: Re: [PATCH] net: raise RCU qs after each threaded NAPI poll Message-ID: <66a81295-ab6f-41f4-a3da-8b5003634c6a@paulmck-laptop> Reply-To: paulmck@kernel.org References: <20240227191001.0c521b03@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240227191001.0c521b03@kernel.org> On Tue, Feb 27, 2024 at 07:10:01PM -0800, Jakub Kicinski wrote: > On Tue, 27 Feb 2024 10:32:22 -0800 Paul E. McKenney wrote: > > > > + if (!IS_ENABLED(CONFIG_PREEMPT_RT)) > > > > + rcu_softirq_qs(); > > > > + > > > > local_bh_enable(); > > > > > > > > if (!repoll) > > > > > > Hmm.... > > > Why napi_busy_loop() does not have a similar problem ? > > > > > > It is unclear why rcu_all_qs() in __cond_resched() is guarded by > > > > > > #ifndef CONFIG_PREEMPT_RCU > > > rcu_all_qs(); > > > #endif > > > > The theory is that PREEMPT_RCU kernels have preemption, and get their > > quiescent states that way. > > But that doesn't work well enough? > > Assuming that's the case why don't we add it with the inverse ifdef > condition next to the cond_resched() which follows a few lines down? > > skb_defer_free_flush(sd); > + > + if (!IS_ENABLED(CONFIG_PREEMPT_RT)) > + rcu_softirq_qs(); > + > local_bh_enable(); > > if (!repoll) > break; > > cond_resched(); > } > > We won't repoll majority of the time. I am not completely clear on what you are proposing, but one complication is that We need preemption disabled across calls to rcu_softirq_qs() and we cannot have preemption disabled across calls to cond_resched(). Another complication is that although CONFIG_PREEMPT_RT kernels are built with CONFIG_PREEMPT_RCU, the reverse is not always the case. And if we are not repolling, don't we have a high probability of doing a voluntary context when we reach napi_thread_wait() at the beginning of that loop? All in all, I suspect that I am missing your point. Thanx, Paul