From patchwork Tue May 7 09:34:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uladzislau Rezki X-Patchwork-Id: 13656482 Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 40DE114E2F1; Tue, 7 May 2024 09:35:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715074539; cv=none; b=iAUEYkj4r9Wdg/6whBMmefgoSDVttfoA5gfB/K/qH9mbxC76dVOWggg0cySJKR/GhBXDEiws/zYef37nujA/szWRSMilG3M/kaGRtj1ZiaXBboUnonT9Oq5a2jAgepIJdFdH+X27Hzi2Df1QCOZZG7uHK2/lyg8NxFPYdgixykU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715074539; c=relaxed/simple; bh=+/Wzimi9IDd0AOad7JCOBMX+aJPeFaceFPRoaZUd6JQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ZCWochjwwZwz9NztqWraIvMIuGg4l6idzMjg55a2fduCr/Z8Z1pg++R8NiPu+kSDJP5FZDpSJrB9qmijuq2h8K2u707NSmfl5RhXPjjFqoXgaz5XGzkaHAkgenyI97Jr3z8KKyk/vRrxCVFEA2qPRwpf5XnuCayIEZb7TqZ04Zs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Qn9V5A0j; arc=none smtp.client-ip=209.85.208.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Qn9V5A0j" Received: by mail-lj1-f172.google.com with SMTP id 38308e7fff4ca-2db101c11beso36565341fa.0; Tue, 07 May 2024 02:35:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715074536; x=1715679336; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tHQ3wThlCa+tmPm7RaR+qFcrkGfD7gzEvoOA5PrmsZ8=; b=Qn9V5A0jesQZGCTXuVJHyqNGw/91oEXDjIgBz/SvXiZ9YgEOFnZ3GLIgWUxQi7Mkgi IdLpfkgpBsad/tqUYMYMscuLuqDTdvb7fdrjzWPazXJRw8/8nPYNrvq4GJKoHRzihu3p 6GT23cNQY1Qloec5lS22UXhNQmVsQK9OIAeaz63upP/VZZg4tDalQ7glnDbRvqTCRE19 LgNTPKaFuKycCmarguyQmGTyPMveC/07wz3cnsSV9wQ6qoxqgmO+I95gpdG+pnS3H/Ta 1UvVfnvx7a7iGATudsuL3BwehWn+Z5ZSKMm+3ERzR1rZkLWoYTeWfRr2mUGwCRRXTBv9 e4rA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715074536; x=1715679336; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tHQ3wThlCa+tmPm7RaR+qFcrkGfD7gzEvoOA5PrmsZ8=; b=CXjPGBIQoCbgcXn7xVJu/XpAvOaif58H4PK87Gi+TlMk+289DJ2m2H2T8PfzgQX/jf MWoVyZVAozg4fQz4xO+HUf25/DnXY0nKqbu2SMCs3ehSnax+BU4kkiVeQZ9qe+lPo+8j ZON+W9eNMSIf4lo2ZzU1fEMfc4j5sS0KT9pEnQOy9mGkFV3KzBvDi+7G4Cyjd8m/FV2M QD7dE5nwM4AGlDdlX2KwSmkgtWFYM0HjqbqN+2jjGvFTI3hppykGFKjUZDNIcKpwyvii +heNTR9DFhrOCb8KsZ+mnxAo8GemcAJc+LN0vbWlajIZKC1jKaOLxM2X9MPmWSZ2Tetd njvg== X-Forwarded-Encrypted: i=1; AJvYcCX1J+RbDqD9+y0rw6COw06z8VEGi5ub7/EWn1T2VMLrTIvxOZNv7rUOmg4wRnynzazsr0KYF1gpcp6nrOKVq0xCtSNO6pHdnhH/QlECOwA57LgK/crFnk7OpFUgi49tTmGg+Dzp X-Gm-Message-State: AOJu0Yzth5zG1sWevcu579UGoEjy0q0draT/MwMZmMTrZRUU3gB6xS3W GJIEflqCsXSViVMphY3hFMPV769ryHnG5LsqkegdcXH/mXFd3OFz X-Google-Smtp-Source: AGHT+IH3kyXVRJ4PLiuJO5l/3kxoCLnD2cm+0pheedS9Aj4zvXVnedQGHMETTqwaLGYpsfRGaYHCpA== X-Received: by 2002:a2e:9585:0:b0:2df:b800:5bff with SMTP id w5-20020a2e9585000000b002dfb8005bffmr8142337ljh.7.1715074536291; Tue, 07 May 2024 02:35:36 -0700 (PDT) Received: from pc638.lan (host-185-121-47-193.sydskane.nu. [185.121.47.193]) by smtp.gmail.com with ESMTPSA id t18-20020a2e9d12000000b002e29c50c4dcsm1335473lji.27.2024.05.07.02.35.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 02:35:35 -0700 (PDT) From: "Uladzislau Rezki (Sony)" To: "Paul E . McKenney" Cc: RCU , Neeraj upadhyay , Boqun Feng , Hillf Danton , Joel Fernandes , LKML , Uladzislau Rezki , Oleksiy Avramchenko , Frederic Weisbecker , Eric Dumazet , Jakub Kicinski , "David S. Miller" , Yan Zhai , netdev@vger.kernel.org Subject: [PATCH 03/48] rcu: Add lockdep checks and kernel-doc header to rcu_softirq_qs() Date: Tue, 7 May 2024 11:34:45 +0200 Message-Id: <20240507093530.3043-4-urezki@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240507093530.3043-1-urezki@gmail.com> References: <20240507093530.3043-1-urezki@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: "Paul E. McKenney" There is some indications that rcu_softirq_qs() might be more generally used than anticipated. This commit therefore adds some lockdep assertions and some cautionary tales in a new kernel-doc header. Link: https://lore.kernel.org/all/Zd4DXTyCf17lcTfq@debian.debian/ Signed-off-by: Paul E. McKenney Cc: Eric Dumazet Cc: Jakub Kicinski Cc: "David S. Miller" Cc: Yan Zhai Cc: Signed-off-by: Uladzislau Rezki (Sony) --- kernel/rcu/tree.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index d9642dd06c25..2795a1457acf 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -240,8 +240,36 @@ static long rcu_get_n_cbs_cpu(int cpu) return 0; } +/** + * rcu_softirq_qs - Provide a set of RCU quiescent states in softirq processing + * + * Mark a quiescent state for RCU, Tasks RCU, and Tasks Trace RCU. + * This is a special-purpose function to be used in the softirq + * infrastructure and perhaps the occasional long-running softirq + * handler. + * + * Note that from RCU's viewpoint, a call to rcu_softirq_qs() is + * equivalent to momentarily completely enabling preemption. For + * example, given this code:: + * + * local_bh_disable(); + * do_something(); + * rcu_softirq_qs(); // A + * do_something_else(); + * local_bh_enable(); // B + * + * A call to synchronize_rcu() that began concurrently with the + * call to do_something() would be guaranteed to wait only until + * execution reached statement A. Without that rcu_softirq_qs(), + * that same synchronize_rcu() would instead be guaranteed to wait + * until execution reached statement B. + */ void rcu_softirq_qs(void) { + RCU_LOCKDEP_WARN(lock_is_held(&rcu_bh_lock_map) || + lock_is_held(&rcu_lock_map) || + lock_is_held(&rcu_sched_lock_map), + "Illegal rcu_softirq_qs() in RCU read-side critical section"); rcu_qs(); rcu_preempt_deferred_qs(current); rcu_tasks_qs(current, false); From patchwork Tue May 7 09:34:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uladzislau Rezki X-Patchwork-Id: 13656531 X-Patchwork-Delegate: bpf@iogearbox.net Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4DE62155390; Tue, 7 May 2024 09:35:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715074547; cv=none; b=drLS33OU0KDImWTemDXS/SlvjmF0Lrdry/x+jf+ZrHB3OUqPBvCn/x/VDjoURtLc6F3e15UAq98K52Sq16586KW9JT2n7XLtTF38eJDACNhvJHIUBUZifp+FDTJ8K+eYUBChT8yubgIUxJXDA6zClGWmXBNK1GYSG99H/3wnQ+U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715074547; c=relaxed/simple; bh=chdfDJkJUd2381b+AYErmHdsM+6kHBcN2R8PWQKTK+w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ZldjTnukViJ49IyYLPPl/dXwoR5dmr+/JxUg8RbC4ickHWHshmB4IgGFui4jXpkReLLDh8QJ4dNoKLt6pBiGcv1gHFZy30x4Jf0fOrXw1RucqsgWQ+48t/ta322MpZvDLyJjmsEP+/BLQMbsK7PFl6MTZ4gmntlLOlTppamO3yc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=MtT+8ywr; arc=none smtp.client-ip=209.85.208.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MtT+8ywr" Received: by mail-lj1-f176.google.com with SMTP id 38308e7fff4ca-2e3f6166e4aso7187251fa.1; Tue, 07 May 2024 02:35:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715074543; x=1715679343; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qp9Gj7lq4ACmCS98GBHRZFh0tqGLeKwKmlOcd+I5en8=; b=MtT+8ywrCi5/iQhwutoypnQspkEBkOeIZ3ujcsFJewmsDbGXx6uzHcz+7KsakzSz3N /oJISuR6Vjaa58IlRdQ2xi9qE8mYaBnEJ/jt0VhNTFFrJ3cwVyDfSKAnQSE1qUy7Fhbm VHXpfrZxLKiDko0O20xheOore+68yCR3WR0HEDe8zHS3Tuakok80b4857eHUAhNwoU0a 7OUIQ9DLSurTW5/fYqjaBYC310V+nHDOqZtTumQIcMh1e37jAvXNA/Qd7EGdHr/tFzkd ULb8QYz+Q4E1giAzOY0oYNyOSk7yZCxc7gCasQjaQMxN2pFwhxj09T75TfnRDztbIizr C3JQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715074543; x=1715679343; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qp9Gj7lq4ACmCS98GBHRZFh0tqGLeKwKmlOcd+I5en8=; b=Zhh/UtlKheF3Gx4Io58FsgUh1TCw3j7ztG3CQ2Z54EbUS0g3l7tSjNc5CgohqyTvpg nNZmNSearJUgYMOh60//2rXYlk31wlIiPN5lm06oGKvs/ZWkbRZi4xOdNMMTocVnmrSb vxpOaYzt+6no7CXYz+vNY7d3cJsel8L0IgEqEcxeo41O/BwcRhozTRemI5LQI7FqWC8f 0WBY2gmsZK7Jzogzxdz4OMEQ0D9tS1fHWuVk6H1aa6bIwkuVYwLLUkAZRJP1aNMAuN0K X1laj1683FL75GjpsBZDO+1C6n9Ppb9LCBq8jIu84FPq5pAIvcAkgQNxhSPWGuS99RbJ n/xQ== X-Forwarded-Encrypted: i=1; AJvYcCXreQtJiIo4EFqvgpFGG1cy7AEd6XhlTFhR1ERiOzXc0C1kmT4GgjEC/H289ilpC91edI8q919uuCLQmgdraCcTTgKeV0tNFtDG1L4fsaWFbLxO9PIpdSBBTpDtXekNS4uS X-Gm-Message-State: AOJu0YygEgI3vICDO9iJqHiQfTITFSVJbvVLSBYNMBWCimOtzJAlzCKS 6zBB9/lyjz1SacSIcyBtwrsRRSSRMLukuckQCgWPMmBAhmUDSYypQWsRQ59E X-Google-Smtp-Source: AGHT+IE1e9KG4xXibyeIv5ywJLp8h+Y7KAHo9JjU55aHVH5tx8ojg9MGUZmij8FPRmFRUqtHpxZifw== X-Received: by 2002:a2e:b8d4:0:b0:2e2:72a7:8440 with SMTP id s20-20020a2eb8d4000000b002e272a78440mr10513801ljp.41.1715074543428; Tue, 07 May 2024 02:35:43 -0700 (PDT) Received: from pc638.lan (host-185-121-47-193.sydskane.nu. [185.121.47.193]) by smtp.gmail.com with ESMTPSA id t18-20020a2e9d12000000b002e29c50c4dcsm1335473lji.27.2024.05.07.02.35.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 02:35:43 -0700 (PDT) From: "Uladzislau Rezki (Sony)" To: "Paul E . McKenney" Cc: RCU , Neeraj upadhyay , Boqun Feng , Hillf Danton , Joel Fernandes , LKML , Uladzislau Rezki , Oleksiy Avramchenko , Frederic Weisbecker , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , bpf@vger.kernel.org, Ankur Arora , Thomas Gleixner , Steven Rostedt , Mark Rutland Subject: [PATCH 11/48] bpf: Select new NEED_TASKS_RCU Kconfig option Date: Tue, 7 May 2024 11:34:53 +0200 Message-Id: <20240507093530.3043-12-urezki@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240507093530.3043-1-urezki@gmail.com> References: <20240507093530.3043-1-urezki@gmail.com> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: bpf@iogearbox.net From: "Paul E. McKenney" Currently, if a Kconfig option depends on TASKS_RCU, it conditionally does "select TASKS_RCU if PREEMPTION". This works, but requires any change in this enablement logic to be replicated across all such "select" clauses. A new NEED_TASKS_RCU Kconfig option has been created to allow this enablement logic to be in one place in kernel/rcu/Kconfig. Therefore, make BPF select the new NEED_TASKS_RCU Kconfig option. Signed-off-by: Paul E. McKenney Cc: Alexei Starovoitov Cc: Daniel Borkmann Cc: Andrii Nakryiko Cc: Martin KaFai Lau Cc: Song Liu Cc: Yonghong Song Cc: John Fastabend Cc: KP Singh Cc: Stanislav Fomichev Cc: Hao Luo Cc: Jiri Olsa Cc: Cc: Ankur Arora Cc: Thomas Gleixner Cc: Steven Rostedt Acked-by: Mark Rutland Signed-off-by: Uladzislau Rezki (Sony) --- kernel/bpf/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/bpf/Kconfig b/kernel/bpf/Kconfig index bc25f5098a25..4100df44c665 100644 --- a/kernel/bpf/Kconfig +++ b/kernel/bpf/Kconfig @@ -28,7 +28,7 @@ config BPF_SYSCALL bool "Enable bpf() system call" select BPF select IRQ_WORK - select TASKS_RCU if PREEMPTION + select NEED_TASKS_RCU select TASKS_TRACE_RCU select BINARY_PRINTF select NET_SOCK_MSG if NET From patchwork Tue May 7 09:34:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uladzislau Rezki X-Patchwork-Id: 13656532 X-Patchwork-Delegate: bpf@iogearbox.net Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com [209.85.208.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 87D4715B11A; Tue, 7 May 2024 09:35:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715074551; cv=none; b=C31O6r5Lgnkr5mPrqyOXriq9ZaJIv+rIuCDWxzy9GqwgMpaNeweT1JK3hciQzF9kkB/jr9A/dJnLtkLbRvAyI1zC/L9SUdVAfbcAR/9CrPVCqUBQNaY49IVDhDwwOJKJPfCtdcRMnY8gGa1WQdlpVaWxGLFoq0Wy+vrbgBdmNHk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715074551; c=relaxed/simple; bh=G5UgDUwYgbkYtBYd0068KteomsXMFoI4xHNbykAdpq8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=dNWPNCHik5pgbLcaiWzM+X/fMB+XQNS7wnjO8I0ROuj/UBJiw5LW+ABa+AkTd1z4kBEUgCNWI4ROkROm2aaZWhZJES3s3uFT6BW9IVEguRxxdnAtF2HzwG0RM0DrI1ZOeoYSBKATC1hbGLox8zVj3+5uri1zm19hvb2Qx8xyHMg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=HtzLRibQ; arc=none smtp.client-ip=209.85.208.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HtzLRibQ" Received: by mail-lj1-f173.google.com with SMTP id 38308e7fff4ca-2e3e1ad0b19so8250161fa.0; Tue, 07 May 2024 02:35:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715074548; x=1715679348; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/haxlK53UizV+SleK0qa7ThwxwFJdnlLNlR+JkvSJOE=; b=HtzLRibQ2FMBXjR7xQsprPaIwuSkHaplJiuUfg0EN0femlK2o2JM0DQBrPq33jxfJ2 Ptmnr0+ZDGhB3aIy3hYF6PrOXd7dmpXHw+Ogwacy4JAyjepvl1ClvPsCd4EYAoK6/+w+ n7+sjODPiODOJ9nbuCsddAIqfRgwkhww10T53VeiqFDB1V32LChC7Bs1huqIMK0RPPUP Q65dZuhQ8ue2DmYxa/Vw2vEfELn30t3ltSwS3y3CfIAwZPkXaq9Vp9SpqDSIW+vgrKUq 17Ikx/EB4tVaYO3HNsCGlj63SNpjY/LqSDfWfBjbkROWPbarVv0C0g+4tWVU2h+KE4lR J2ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715074548; x=1715679348; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/haxlK53UizV+SleK0qa7ThwxwFJdnlLNlR+JkvSJOE=; b=kVJudqZuZwabvnVhdgqhvBQi357fSyFGLLD6GF7g/J/0nqRUsrC499Jfwzw8lzODOH DGsSWB/9AERAVHE5cwsVvKc6MRfNDyx6tpnSxWpT5XJ7bzXeovUxmz4o25zAqWu9TBGi lM3WP6P6dnIsEXo6Gk1O66z24dcLjW4+7jSb1A7hNg8NNlw4zg3DO56f2wEbPvIIhX3r g9rVwB0wTHn/vVkYeGgk+vkqr6D5MAlhi2rxgbE+wE/fUPLsghGXtgcKoD5mGUhb5rra qLVu/VjEqgkK44/5h2wYQegP70plyQ559JjpF3ZmuDlFVRQkAn4GOcDlikhsLL6w0x4E UmFQ== X-Forwarded-Encrypted: i=1; AJvYcCV2VyfD+7Vca4LHQkRrvyXBnN6T8mp/0/kTZbJGAIheVdXe6mQ0ITNzl5xHIF9A0LWh3GSCBPRp0qxowX39shGu0NkClE8ZSVsvzwYFf+ei8A2I2dun6OYNl5ab2+MUpYyu X-Gm-Message-State: AOJu0Yzc2HTcPzAUTLuXrIci0Yf3iA2vIXz0wNjy+W6CA9ALF4+aHu2F 2b1akwOAyJtPanjmjgI4kchhTQC4B2XCewDklL/OG9P/vxJEWm3+3ZFSmKID X-Google-Smtp-Source: AGHT+IEoIfKd7XfhA0BRXVZFDJt+SXdbx+BppfUXbCeRu12K7jxUfWy7v/cBvFIssPL6qXdVfiZCLw== X-Received: by 2002:a2e:2e0b:0:b0:2e2:3dac:447b with SMTP id u11-20020a2e2e0b000000b002e23dac447bmr9471075lju.18.1715074547523; Tue, 07 May 2024 02:35:47 -0700 (PDT) Received: from pc638.lan (host-185-121-47-193.sydskane.nu. [185.121.47.193]) by smtp.gmail.com with ESMTPSA id t18-20020a2e9d12000000b002e29c50c4dcsm1335473lji.27.2024.05.07.02.35.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 02:35:47 -0700 (PDT) From: "Uladzislau Rezki (Sony)" To: "Paul E . McKenney" Cc: RCU , Neeraj upadhyay , Boqun Feng , Hillf Danton , Joel Fernandes , LKML , Uladzislau Rezki , Oleksiy Avramchenko , Frederic Weisbecker , Alexei Starovoitov , Daniel Borkmann , John Fastabend , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Ankur Arora , Thomas Gleixner , bpf@vger.kernel.org Subject: [PATCH 15/48] bpf: Choose RCU Tasks based on TASKS_RCU rather than PREEMPTION Date: Tue, 7 May 2024 11:34:57 +0200 Message-Id: <20240507093530.3043-16-urezki@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240507093530.3043-1-urezki@gmail.com> References: <20240507093530.3043-1-urezki@gmail.com> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: bpf@iogearbox.net From: "Paul E. McKenney" The advent of CONFIG_PREEMPT_AUTO, AKA lazy preemption, will mean that even kernels built with CONFIG_PREEMPT_NONE or CONFIG_PREEMPT_VOLUNTARY might see the occasional preemption, and that this preemption just might happen within a trampoline. Therefore, update bpf_tramp_image_put() to choose call_rcu_tasks() based on CONFIG_TASKS_RCU instead of CONFIG_PREEMPTION. This change might enable further simplifications, but the goal of this effort is to make the code safe, not necessarily optimal. Signed-off-by: Paul E. McKenney Cc: Alexei Starovoitov Cc: Daniel Borkmann Cc: John Fastabend Cc: Andrii Nakryiko Cc: Martin KaFai Lau Cc: Song Liu Cc: Yonghong Song Cc: KP Singh Cc: Stanislav Fomichev Cc: Hao Luo Cc: Jiri Olsa Cc: Ankur Arora Cc: Thomas Gleixner Cc: Signed-off-by: Uladzislau Rezki (Sony) --- kernel/bpf/trampoline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/bpf/trampoline.c b/kernel/bpf/trampoline.c index db7599c59c78..88673a4267eb 100644 --- a/kernel/bpf/trampoline.c +++ b/kernel/bpf/trampoline.c @@ -333,7 +333,7 @@ static void bpf_tramp_image_put(struct bpf_tramp_image *im) int err = bpf_arch_text_poke(im->ip_after_call, BPF_MOD_JUMP, NULL, im->ip_epilogue); WARN_ON(err); - if (IS_ENABLED(CONFIG_PREEMPTION)) + if (IS_ENABLED(CONFIG_TASKS_RCU)) call_rcu_tasks(&im->rcu, __bpf_tramp_image_put_rcu_tasks); else percpu_ref_kill(&im->pcref);