Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp1153333lqt; Tue, 19 Mar 2024 14:33:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCULGlE+3fyfO+Kk3U/dTz8jdv0nr/oh37M8L2uIQ+0aKo92T6VQ+LheUMEb4JjHkhmPxIR+G3VkH37kSWZ/2zNWvxLB4wK2isMSzRmseA== X-Google-Smtp-Source: AGHT+IEuWbLyyFfdN/dEDCnC0itvpWI+Gvr1+hunv5FBUHrf98ZNvB87kT6LnAFWEAIFfhe2nBH/ X-Received: by 2002:a17:90a:f298:b0:29e:d30:5b2c with SMTP id fs24-20020a17090af29800b0029e0d305b2cmr4068575pjb.18.1710883992944; Tue, 19 Mar 2024 14:33:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710883992; cv=pass; d=google.com; s=arc-20160816; b=CwOfx+RdQWBt321yRy/yXqVgf9/HL/u1iIxe6rcTSFinJ/ffVjS99baVdODj8BYsK8 062rxS4SDeK+3ERrp2+2OqQKkkCbpFhmIriU8/gZHFFbqgZ7I33Ae/vWUzvlJ4n4S1e9 FUrcezultEAbL/Lt46R0P0SAb1GnXKnQeUoZVwvmmHbl3hRt8z10O8pKj9pAugoT0W+U k1x65Bep+nUj04hH4S5k/wD9vDNc3sYI4pXwvvMKFsmNSCkJOwZfjGTWp7p3GgmMICzK 1DsPeJoB6HO6UFLnbX/J8LzgzqKnkSiFfGfSc7i4/MJw2o2UvPg1bDABbhN/+DUMUps+ jd/w== 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=vF9XHObPYFj1irEVtGf5RWcUFV3yQAmFOKePZHEiUOM=; fh=IPfoympBUn2hmjH/3zoAae5/cm+1JOfoMlFH2h+zs8Q=; b=aO+R0kg/50cWQ48oCAq514zPTUreXdBUMK8L5uNDdReJToa4DJZD+HV0+sB04uHL5v LO30+K4tpfPYhafBI1O3dU7Q8eUlfgYEenHpbWb1wlLRlIkeO0q4ziXJvSWT1oD7HxHH IV5XqIRm6CzKsqZ/kjKmD3IelXhvxKQt2ykrEoAG+Y3zKjsH0pmast9i52kk7zXlavSK 6cX5xNb4n1tS1iIKgu2laU24+FNKRTfPS82rTvLfgVofynz1q1hyvVdT9F7H0sVpN66D c/EMaiUTOGWxxGFszZLO5MUmiIg7zF55iNQdzjdnuCwnrc9qS8jjxqKwym5ig5+8TWwq 5TgQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AuBgZmDG; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-108156-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108156-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id q197-20020a632ace000000b005e857e42aa7si739758pgq.55.2024.03.19.14.33.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 14:33:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-108156-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AuBgZmDG; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-108156-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108156-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 32546B2196A for ; Tue, 19 Mar 2024 21:33:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 084D34EB55; Tue, 19 Mar 2024 21:33:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="AuBgZmDG" 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 18121405FF; Tue, 19 Mar 2024 21:32:58 +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=1710883979; cv=none; b=aJqAX7/u5kGNz03YljcwC6sniTqRwHThI7rrxUPmr1mR/WbqjBtpy6twkTJR1FgicFjGwnuGBYGRWlRagWZUH7X0k8bG2E3qj5PARTvdEHBC1kCgJ0OXffKEkts2nag1s+85XbcConBXDz2kRrofCAa1woTFO1EZkAbyTm2hako= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710883979; c=relaxed/simple; bh=Z0VLowaW1cMKEukbDvZbKOTvPsbt5jpTUoOXaf3vRa0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=JeFYnl9hI5vr0feYNJydO2bFJN77EVFyuV+Orv7+9AbGQPPWwlhQ4YHtefj0jDpOJ4c0dyGtoBB0GzaLAhezmFISLUxn3veZTr8h1gDnND1yW3m8uuSLRuexeK5WbzFmVv8ytvBjx1cmmdEyIQd7M69jNZWyU/MLhtKWaRCp/EM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AuBgZmDG; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88C8AC433F1; Tue, 19 Mar 2024 21:32:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710883978; bh=Z0VLowaW1cMKEukbDvZbKOTvPsbt5jpTUoOXaf3vRa0=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=AuBgZmDGLT6z0xuFCkeF0czQP2q9f5XlukF8labTvW6pmjWe5rff92CzWtGRZhGck P8T0RLcmANKwLqelJX4KLiZsMcC8WIOLpfNrQGhB/gFdHEP9pmttLMuVwZ/HmPV1QX QAA0kTbyRrsT8y9Cg6xm6igbtkg5o5UqfFzpsVkXOWvyIcQ7MkyyuKvzJhONQHqFRc 1vWStuF2pPEOwavmy1lyxUsnlYkmXZjHg41pHoyiE5m/FYMAOa05kwMM5C32VR0RnD 3S7227aFhwDvXBckZnvxydf0MmDCCSzwZgmKOttEomrGbJnK0H6+bwI0XKPHgHWhBo Y9pkrycapFwtQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id AE739CE16D7; Tue, 19 Mar 2024 14:32:56 -0700 (PDT) Date: Tue, 19 Mar 2024 14:32:56 -0700 From: "Paul E. McKenney" To: Yan Zhai Cc: netdev@vger.kernel.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jiri Pirko , Simon Horman , Daniel Borkmann , Lorenzo Bianconi , Coco Li , Wei Wang , Alexander Duyck , linux-kernel@vger.kernel.org, rcu@vger.kernel.org, bpf@vger.kernel.org, kernel-team@cloudflare.com, Joel Fernandes , Toke =?iso-8859-1?Q?H=F8iland-J=F8rgensen?= , Alexei Starovoitov , Steven Rostedt , mark.rutland@arm.com, Jesper Dangaard Brouer , Sebastian Andrzej Siewior Subject: Re: [PATCH v5 net 3/3] bpf: report RCU QS in cpumap kthread Message-ID: Reply-To: paulmck@kernel.org References: 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: On Tue, Mar 19, 2024 at 01:44:40PM -0700, Yan Zhai wrote: > When there are heavy load, cpumap kernel threads can be busy polling > packets from redirect queues and block out RCU tasks from reaching > quiescent states. It is insufficient to just call cond_resched() in such > context. Periodically raise a consolidated RCU QS before cond_resched > fixes the problem. > > Fixes: 6710e1126934 ("bpf: introduce new bpf cpu map type BPF_MAP_TYPE_CPUMAP") > Reviewed-by: Jesper Dangaard Brouer > Signed-off-by: Yan Zhai Acked-by: Paul E. McKenney > --- > kernel/bpf/cpumap.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/kernel/bpf/cpumap.c b/kernel/bpf/cpumap.c > index 9ee8da477465..a8e34416e960 100644 > --- a/kernel/bpf/cpumap.c > +++ b/kernel/bpf/cpumap.c > @@ -263,6 +263,7 @@ static int cpu_map_bpf_prog_run(struct bpf_cpu_map_entry *rcpu, void **frames, > static int cpu_map_kthread_run(void *data) > { > struct bpf_cpu_map_entry *rcpu = data; > + unsigned long last_qs = jiffies; > > complete(&rcpu->kthread_running); > set_current_state(TASK_INTERRUPTIBLE); > @@ -288,10 +289,12 @@ static int cpu_map_kthread_run(void *data) > if (__ptr_ring_empty(rcpu->queue)) { > schedule(); > sched = 1; > + last_qs = jiffies; > } else { > __set_current_state(TASK_RUNNING); > } > } else { > + rcu_softirq_qs_periodic(last_qs); > sched = cond_resched(); > } > > -- > 2.30.2 > >