Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2528170lqp; Mon, 25 Mar 2024 01:14:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXK+CSXQxbDiCzb/E3tC7Og3427WScOt+om96Fz8beul9Rb/JgDSj6yoNFYFGla7a5IZ7obS03muTMfDxDy401SwGb0erfmaB6diWCsXA== X-Google-Smtp-Source: AGHT+IE/7tmWYzktM0hRDFd6ut+GwTnUKMYoSg9q/deUjCDkLJxhnP/t6f2QDoHZTEdVX484CSSI X-Received: by 2002:a17:906:c003:b0:a45:b91f:2f95 with SMTP id e3-20020a170906c00300b00a45b91f2f95mr3751265ejz.72.1711354441381; Mon, 25 Mar 2024 01:14:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711354441; cv=pass; d=google.com; s=arc-20160816; b=Sz48YjqTvBI/PWDFKfKGa+7xf1WLa1V8M/w88jHoV0ailaVbrB7li7wDPLlo41+y2p qMa3oe+xK1r07+aa45s+rouc4grMTvpMDd43fvFzKVL7zOrzPYlVYTHRzp7+DngCJUoD BbuO+5zk+k7kVP87GXjA+ZlH8aM/KPJCsgjs084Av6iJQr+v3otbRLyP/NipJQ0Ah3FK SKHv9gReLMZOciROH/oMFwOOoug38duUk16d85hBTVwYxMbWlSPLYkfiBrrrQm8UpMhO w+OkAEJ8j9IDYsYrBWuGHQZbdD+rW8DvpVQ5wqFokpFFyBW4GbdL21z3TFDI3ZXHNOQx xg7Q== 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=MEYEldVhxnLEGeGH9iUnSWk7517bBulJj+5vGRn85Vw=; fh=4sX0AQqkeIj0OfiW+ozFIhOM0fQ6NXViqGWq13GB+Rg=; b=fCU893W0gICOt9+uJ2Z8Nn0FZdIqYMFaUssX+2Rm/Am594ISCXJ6FtYzpBDoxLqbem GaKVBFC5rXbXsWZiwbN1UjqTdIqdiPCmmTXTl8pl9IZYWDbuELw3z9Hl7SX7OD3DMmsO jN3TkF7AyeBp/6BLjdDFgmmn8LlQVoV2Ujg7kP/mXrKpO8k/UBPOXiVMn+P09ESJNz3M KvfLiB3G2NFnVwu4/2n8Na+5cL2N3DhJxybMEEgUGmPqppXdJxOv8dpUJgJitgUovkKY Piy+1CkNnPuQZWcX2Xh7WOeJpKhRCTPDADaQO6y4vwoc+tOFvY6dQ7Bkc9knMFNiUo2f 5ePg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HXNHt0pd; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115998-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115998-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. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id d1-20020a170906304100b00a4666c635besi2265766ejd.785.2024.03.25.01.14.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 01:14:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-115998-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HXNHt0pd; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115998-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115998-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 D42F41F2EF12 for ; Mon, 25 Mar 2024 08:14:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 00393171663; Mon, 25 Mar 2024 03:06:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HXNHt0pd" 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 460CE23B485; Sun, 24 Mar 2024 23:19:19 +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=1711322360; cv=none; b=mIIeN449J5X0uHPo5GqYCSu0AIGrB4RnI1FkBYqFP3lni+T4TSCoGo/dB3BpRASczfX/rPffaKEhlBq/c3Uhb1QGqYjsP0UrQ2DgAVwgd7qVi4/ScILugxGdYKlLLh5KV0dS2KSbLjKjROkS4UtB8DUEKkYwPLRbQX2F4NHxF6Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711322360; c=relaxed/simple; bh=5CKGby1NuCF7QCsolsfXL0BdWTq1mp477nUEtXnb8Co=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=A8Z0TSV6pNNg8FzEeesGOgIG7kMTjkbTnvO9MAVPMad2tbKjbZ6dwV/z7yT37723XIny7rLuzmrDPjp1YgLKsTj4PDdq/g9/Oxm5snW8ILe2eKbVpucpXtujXcmFTo65Uk4YuhkgGmT2rt9t3G7GnDmgvwQyhbzO5oCnkRMxK0E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HXNHt0pd; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54525C43399; Sun, 24 Mar 2024 23:19:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711322359; bh=5CKGby1NuCF7QCsolsfXL0BdWTq1mp477nUEtXnb8Co=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HXNHt0pdCo+Tvdc2bYAVQkwzMzIT6ZAstIxQEdLbfVyXsf6cy5NKqX42JvZ56Fvjg cLMPbmUBQHc8aNU3AYcHTYDVcLpkT7JglJj/h4jk6Co1EKFW+tQYfcJ4M1ysqzPRXd 5xRneOGkZ+p+57L7N4dZIrUyMnPzDhm6sP6qPbFFsSsr4KnzcVuBz1GTvq19s1a4zp pXqTwOF2pOtEfS+MMcQXX9PAW3+P6zGppnWyWW0iOQ3TG4ECBQIXUyIT7twnw7DVbt fqmGTDRhhqH3URxTmN7wU9WkcVLGb5BHQKGzJ1r1irF5fdCE2rIllSU++1hNdWfA0s PnPc9kYDUpa0Q== 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.1 441/451] bpf: report RCU QS in cpumap kthread Date: Sun, 24 Mar 2024 19:11:57 -0400 Message-ID: <20240324231207.1351418-442-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324231207.1351418-1-sashal@kernel.org> References: <20240324231207.1351418-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 0508937048137..806a7c1b364b6 100644 --- a/kernel/bpf/cpumap.c +++ b/kernel/bpf/cpumap.c @@ -306,6 +306,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); @@ -331,10 +332,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