Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2405920lqp; Sun, 24 Mar 2024 18:11:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVUXIfZ2IoQpP17Efm3UkhGU/brpIxfBNzxYB2q14o/mFZNms4iVn9qosxLyYChbEFYnZC5VsPLnoa3vKBvWMF2IlpNS2lWPYvrW8+GiQ== X-Google-Smtp-Source: AGHT+IEKzJqjhnsauT0iUETmiTgX+nuxGAKPZaT/Oe9VHQPt+HhgmBcNEwYdEyBmtj3A3ualhnL4 X-Received: by 2002:a05:620a:1250:b0:788:78a9:abcc with SMTP id a16-20020a05620a125000b0078878a9abccmr5741301qkl.69.1711329099689; Sun, 24 Mar 2024 18:11:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711329099; cv=pass; d=google.com; s=arc-20160816; b=ClNTIuANkDCG/yyBL0cJMVvO7bDt3wWMJxZPo83xIIBejA189PB/RVu+ysoCEsv26L AXQicjwLR286NpTpDLjGEqKU7T+H2clKD9QfXSV0DMo2pdDEyTIFLenJ8wPHE/Z1iRvO pFJQ41RTzwwdR74aMZI6bQ2NUi7y+iwhHZdEQaFdpi+UnsgSDCeDGSD/Uo6exqtFBBck rTI0Kp+uu1KmBQhQ7/4DwYZWuf1oUM+ViydrhYK/Nw9cPR1ezK5s/gqMlu3qmUbcucy/ PGuG9wKzL/FT9L6uE0mLtLxL7ZIaIbEApl3+HYvMsPeyI+NnzBYc33oW79VxVrjGfuYd Ck1Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=KOpA6RObHUO6dNe9FUw2Ts8qJLYpA0RGWsYLNs1h0NM=; fh=4sX0AQqkeIj0OfiW+ozFIhOM0fQ6NXViqGWq13GB+Rg=; b=fQvcYsyp6bxFoqteH+GwFIpU8hRETb9eMAmyy0rXGbHN+3+x5PLCpmK4ftNQAB93uH UCmO3TpkvUL0AmkM1CjVnh1ANNuEYgssU2bQ3NT5B0wPdcCqhQUhlU0YktZtkgmcXPs/ ArKsyrdLUxv8ow3Y87e4ju1Ts7Mzyk3gB8XdjH7DNIZJnkTFNUz8XiIHwz6B8Qn4zMAN P23Eo1NSCJdo4VsKrZJR8ZYy9dfonyTyxMlOzFfmTwpj7wjZmWTkTdZ9eqer5Xvc1iNK p1pmyQzlpyfkK/1k+5Obvqn4w8++1Z1PRVEcPgEPqgB6X8zkO3Cggs3oh0+AQ4f7074y lFlA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rOrkQhyI; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113596-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113596-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id pi48-20020a05620a37b000b00787e004f816si4356578qkn.207.2024.03.24.18.11.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 18:11:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113596-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rOrkQhyI; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113596-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113596-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id AA71E1C24E70 for ; Mon, 25 Mar 2024 01:11:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3CC421CD619; Sun, 24 Mar 2024 22:46:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rOrkQhyI" 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 58A851CC602; Sun, 24 Mar 2024 22:46:39 +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=1711320399; cv=none; b=rVh+7CEHdpDsuvqp24tEOqlhi2DWNdH7XhpTRYOZXZXMcTtOpoVLCf1qjWI9gA/Bnqj4QPfaDHA8NgoET2sk+r8WQV4rUzqKnHmx7rGA7u/yaNwuEu66FagQClAkftgU75UCAoWhKx6HtwzisIkFy/v5GxCNAs1EdRNZ2pO/Ni4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320399; c=relaxed/simple; bh=3V3Y8Z3T/2ffOncnPPsWGzqaz/UacQ7HKa0i63JPH1g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Yd5dOzaA2FPFGNX5I7fv/iQ5XbvTTd8axOeDGjx4nUBeVdQ5wIcBAHB2fJFZ+gfit2svsLyV1nw+PwbYTKrQAONT2p5zmDudhSYs6VB8RecFWOG80rWjw+dno+0xPxwc4HxKuGb/l4VI1gyBkDV44TocuyZMokguUZ/EiXihFFc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rOrkQhyI; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FFC4C433B1; Sun, 24 Mar 2024 22:46:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711320399; bh=3V3Y8Z3T/2ffOncnPPsWGzqaz/UacQ7HKa0i63JPH1g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rOrkQhyIn+/gGkp10Szef4rjXk7NKoBYOD98FxU/XUnn2lOFXRY/rvPmo8dUXtQPa foiSIw71oG1cMILexnUAs7Y27i3R881isdF2BNCHE2a3vf9tE0HG8SiemIbf+fg0eM Wx7MKpd0VfFXE/7ew3Q51FPva5sATkzw1mLVJrEUivcH6w7Q3ICpmJnztyxjGtMsUN 98Na7Hyyy9huiedNLcaBujbqJa7Qf4DWTVJq+eStKHoQ6xu1WngzmXK1+3cVRhVUcW e/NTabHgFV9SjkZpJue4h4I2ms7FdmxpJ017a3KcUiWIEN4aXAAOMNItqQucm/1ViZ SyilEKwZnuNbQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Yan Zhai , Jesper Dangaard Brouer , "Paul E . McKenney" , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.8 705/715] bpf: report RCU QS in cpumap kthread Date: Sun, 24 Mar 2024 18:34:44 -0400 Message-ID: <20240324223455.1342824-706-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Yan Zhai [ Upstream commit 00bf63122459e87193ee7f1bc6161c83a525569f ] 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 Acked-by: Jesper Dangaard Brouer Link: https://lore.kernel.org/r/c17b9f1517e19d813da3ede5ed33ee18496bb5d8.1710877680.git.yan@cloudflare.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- kernel/bpf/cpumap.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/bpf/cpumap.c b/kernel/bpf/cpumap.c index ef82ffc90cbe9..8f1d390bcbdeb 100644 --- a/kernel/bpf/cpumap.c +++ b/kernel/bpf/cpumap.c @@ -262,6 +262,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); @@ -287,10 +288,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.43.0