Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2620490lqp; Mon, 25 Mar 2024 04:49:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW9TBuPp7xxx+oodNFe6c4q+uqqtwDVOJpOMJvNhlVgTb89fao8j8jmLGfD1C4+EbLoaYJHpyBUeECJpH67Cg7zEad0qRfMIQPtigYduQ== X-Google-Smtp-Source: AGHT+IGzjj2h3yrELJcQxrO1j41B94rrzA9w5q4K0DFJDgigIHFwxrl2gqCoe3IelOrveaNJORj+ X-Received: by 2002:a05:622a:180e:b0:431:3af9:1c7d with SMTP id t14-20020a05622a180e00b004313af91c7dmr7648348qtc.36.1711367375773; Mon, 25 Mar 2024 04:49:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711367375; cv=pass; d=google.com; s=arc-20160816; b=A6jdutDRr8QV9iHcNuKjwXrsH32YDVUkFtxDYbAa+ETotPXUfjZ2Z+NhUFmBZFDrRZ S69OxC9zrXlBkiF2LUKpkcPvEHL8c+0FOo1YWrEcC6QQmGZ6h2Y7GwVUkQmKeFPvkR3X wH3DKvDEDY9ctsdd0455X1bXuSEF5XwuR4ACKcEDXh2H0aMp3b1mtDxD/K5c/4K2gaO5 rVaU7TUZFY8Uzv20TcoO3/KzspjyPI/Hot7Vrw/eGNhntyiiquA2LaUGY/hkfFRThA3a TEJu1CqZlfQgpZ53oMUTobJ45eKqwSRsz91pTBtphu5N9aQpMvb9u9FZIFtEV+9ipVxS rv7w== 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=ltHOh7vB+Am54tRsNLdM6vwp2Lhor1ub3nLBfYpXgR0=; fh=4sX0AQqkeIj0OfiW+ozFIhOM0fQ6NXViqGWq13GB+Rg=; b=qGcqa72/kABrnGg07k9h7+abPTqqZyKvYr79ApI3HM4dDOHf/gopefphEvYh5/YsUQ D5Vkdpdz7pXeKWEvm12BSseivpVMVsQUPrV69LCvsUrY8Iml1iH3hZXdl8YiPbrNK1Hs auB5ASXiRI1Ni2oY6O71ULpMmlRDWabt0CkxeXY/87Fkgd1giSSeJikhj12YY58HVZYk VkeD1aL4DfYw01o96MxW3lh/IfcNEpoI5nzWfGn6afB8/AAaqaK8r8Geqs3NQVEgtlqe Pc/MARj0ckIRSlKsUGmwnvdIxQIqedD9hs8OZYPMMWkhN8TZsZvCqKejLbpwd6CXoev7 ZQKQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZfIW+jeC; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-116226-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-116226-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 fz10-20020a05622a5a8a00b0042f4db1ba40si5285389qtb.608.2024.03.25.04.49.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 04:49:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-116226-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=ZfIW+jeC; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-116226-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-116226-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 8186D1C34A93 for ; Mon, 25 Mar 2024 11:49:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C153C3C0D7E; Mon, 25 Mar 2024 03:34:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZfIW+jeC" 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 6CDD7131BB3; Sun, 24 Mar 2024 23:44:17 +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=1711323858; cv=none; b=GaRBGr3XW5nLCjbwzeAmHu0Kf8WFJQg2o5PKGnENZ2U+sW48NDXjYerZTnTWyG5BNQakM66scnwbZQBu4lO4gUUdOHTGL2WHPTB+F9Jjsa+Dz2qJxQejUABm2IzRjto6dyaMu5T+yAnVjVFtG3vZJ5WPzjkrZZjfqA18kTpzvdQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711323858; c=relaxed/simple; bh=QMGPU9v5zCezGY7dbzADYR4mYAy++b+NW7nLcEaX8zA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KMrG1MYWvqipyO8cfrGyeeShBXIr0evFNFMnfgHpEKgrPegIxW2TN2CJf62+XKeBO5u7i6iG5GqVbj7vyg4bBkl3yDx+Ei2VoxIDrJxvO5SJLHEadGOARND4OwqN2/RQDKj9Zv3u64uB/6nwMyNVgv+G2iENdxsCUjlewPb0BpM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZfIW+jeC; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B69BC43390; Sun, 24 Mar 2024 23:44:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711323857; bh=QMGPU9v5zCezGY7dbzADYR4mYAy++b+NW7nLcEaX8zA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZfIW+jeCP6Ic8m1ilPF9oe0K2Qw7QsrD1f0Lh4HucExe2pEENJLV3L8WwPdWh5l2M +51usPwbKBk+Abtg4k6yp3U+welj7cbNw06EjaXH/oNYSCsg7CNztC1c56bMn4T7Tu zfYY+Vc22LY6itA5pYs3tatsdtfQCL0WAyPbMRnW5Xxeqk6N9W7uQoINql/9bEQvDn dmWJtxFMMUsF7JYEvRlaqT6tYIkQiNKqQF/qdZ2aBMojNB/I9g4lvFL9A1yFRe5fAW Bobb8QBxXQDCRDO99nYqv0hR0IyTMnCGyj8a9f1t8RXO+oMq4BjKq7F0H6JzxSgOv0 60LaCSIrFl7FQ== 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 5.10 235/238] bpf: report RCU QS in cpumap kthread Date: Sun, 24 Mar 2024 19:40:23 -0400 Message-ID: <20240324234027.1354210-236-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324234027.1354210-1-sashal@kernel.org> References: <20240324234027.1354210-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 2dcc04b2f330e..9a4378df45998 100644 --- a/kernel/bpf/cpumap.c +++ b/kernel/bpf/cpumap.c @@ -299,6 +299,7 @@ static int cpu_map_bpf_prog_run_xdp(struct bpf_cpu_map_entry *rcpu, static int cpu_map_kthread_run(void *data) { struct bpf_cpu_map_entry *rcpu = data; + unsigned long last_qs = jiffies; set_current_state(TASK_INTERRUPTIBLE); @@ -322,10 +323,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