Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2339496rbb; Tue, 27 Feb 2024 20:43:07 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX/2bjtMWIlC6f68+3RcnZO0v3dNcUDWJ5iOWPt2veJWl4l4yj5ELDSJJnxz49+CHyPtDJaanMigyDLibgN9CUmmFPh/5lRwSnL3Mcn2A== X-Google-Smtp-Source: AGHT+IE/BpYB+8WKMzxKXHzP/7P14f9vvurHWzCFc5+M4cYQHZ4B7YE/eIwj+HHYXE7Z4g3xpXkx X-Received: by 2002:a17:906:e45:b0:a43:900a:31c5 with SMTP id q5-20020a1709060e4500b00a43900a31c5mr3608605eji.4.1709095387483; Tue, 27 Feb 2024 20:43:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709095387; cv=pass; d=google.com; s=arc-20160816; b=aE/0szc9wfxd2ZYzgY7ajZiL2WRGRFS5/YdFeTSso84sp08MBmgZWpu8ITgb7wMUqp dUm5WEhziuaUPCRKeuLskmVod054KWPL7r2/ciGA0Dj1iOaWvPs5cpyYCyC0pfUloFUn QzlbrRovWZes3Zpou5CwVXhpiFJktocLXAv++HPe7rdKmRwlDnBAh2dpfXLV0NdjpmA0 yNGKc1Q0itV2R8DvhLt3ab4F/QkKlunHyzgS7QQy82djNtUHG1bV3UU5cRFYvN6beorW Fwyeh8k/lNVhNNw3CXRV0smyPj95ul7UF6yu6m2ASvq8gROk1kNH0sG0dmCfqvSHcx0d lkqA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=M77PklB1ltlKmHSPA+GnBKbnClzALJ1XJt337YJkj6Q=; fh=2ni6Ff1EUMCbkXSvNAH7ws4SdqzXtAdwKvEfpeYp/DM=; b=fL9Dlwir8qg32NZt7aicm+M0YViMgRYNlwhT1M4mDhv1oAonNeXyeypoV5WrpeuDj7 R+Nh+twp1RRTEXjzcFu+wtE5lbHrAgaHxNIcZCD/Z9cEnRyWirPlO1NpZl9pfOWjN9CA GJViqouIQ3I+Zjy8xDNX6620Y5ocyUV10dhILO59wue5swzLeN0Ed+Rz1VAMoBjDo+6x 7qiyqPKb4caUzmQ4AnmX5qQpN/5+ey0QoZNMNG/++iS3NmaEkw80gntLu1t9MxW8RmCo uQcnD9g6UKuBO2TA6IagZ/xGgvAX2Wgg+dFzrIEe3lY+lAvDmDS9PxSrJpcOa3wVV+2I lFQw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bjDPcJWB; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-84511-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84511-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id jt11-20020a170906dfcb00b00a42f6cc157bsi1361061ejc.884.2024.02.27.20.43.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 20:43:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84511-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bjDPcJWB; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-84511-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84511-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id DCC021F28873 for ; Wed, 28 Feb 2024 04:42:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 742D721350; Wed, 28 Feb 2024 04:42:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bjDPcJWB" 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 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