From patchwork Sat Jun 10 03:50:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Vernet X-Patchwork-Id: 105892 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1365634vqr; Fri, 9 Jun 2023 22:43:36 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5pg7Pwxvvqj+6qGH3e7ebiXjT/sLkVsW48fS1TP3cglkzeVx+Nb9SGMlC0MTdtn56U4MqJ X-Received: by 2002:a17:902:bd83:b0:1af:cabb:87b6 with SMTP id q3-20020a170902bd8300b001afcabb87b6mr865280pls.19.1686375816141; Fri, 09 Jun 2023 22:43:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686375816; cv=none; d=google.com; s=arc-20160816; b=ehfJsRJX8k7rK5SB8CS9bQT7ZdglpJvV6K6QUbdDy83T7WoyBo9HjgjV+xcopE25O9 ZwtevMcNH1lz+TE34kQPSxy9ebOFkKT73OFSyMC5TZkt89Ax+51xtCV1X4VI4em6HpvE DESI5ogLbjnppY5f9Qfr2Ek1Ib4IeUL0v3fxCMUeH12XNu7mhfAVSyL5Je9eW/Lgti4s 1a8DrCgbDzdVfEaDWzhaBh0gqXc6p6Hb+mP05uJVnt1Iy8IoBal9ILLp9s2cnyIPX3Im vx5tsCKa7nuwAbY8soAbtA+n8/AQz9sa+mfS4CXwM7nIamEJcd6nq4CXYXPaVGiEx958 nErQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=OjnRZ997c0EJsAweMRpMCDSezCDXyn9PqnhVcCtO5Hk=; b=ysIZbeR1522TrMOBQCr1j+usBYssV2z+nfdXDfvKW/hgCuYSS2O/lMvbNWh6XN4XPy eBUZB+FM9tHAuH7hzyyER7blnoGKNOBXEeCg9Cws0MnW0dyZAA/TJ8edmvixxBwu+pvt x5Q+r6aFXCJYiRovcCfeRdPcv/rrjPvJDbZIdClWMOwD9qehUQFPR8Mn1pdotRENmPfP /x2Lf8kMpbokxzBSrJZymccCcGYHf9zktYUFfOcm0EzQpOvmrkWa+YoK/3QxSLBV5GJ6 fUtd9crMEkv9aqGXtaIIBAOCV6MS6oYWRg7W15N00hsjTAyPYGRuo6U+W5U8Kot1c+t/ eYEw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u20-20020a170903305400b001ae645b8d11si3749988pla.119.2023.06.09.22.43.17; Fri, 09 Jun 2023 22:43:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232532AbjFJDvB (ORCPT + 99 others); Fri, 9 Jun 2023 23:51:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229491AbjFJDu6 (ORCPT ); Fri, 9 Jun 2023 23:50:58 -0400 Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C6C7359A; Fri, 9 Jun 2023 20:50:57 -0700 (PDT) Received: by mail-qk1-f175.google.com with SMTP id af79cd13be357-75d3f2c9d13so234167385a.1; Fri, 09 Jun 2023 20:50:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686369056; x=1688961056; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=OjnRZ997c0EJsAweMRpMCDSezCDXyn9PqnhVcCtO5Hk=; b=FPr04JbVwrHpTaO39GfkrOKBcIigZRfyC1eio7izpllyJsuAgMKEwsWKdz+eTFMgXA f9olGDfrXl4H4GQyQJFo+jxjdpOQzhc+6a8mbxNYpx0lYfIzJDFdY+bi0KI/usLZSZj3 3KhpCCGay9iGs22JEW3GIlUiBKlzHsvUv4teC6VuXlDH8UyZBvsEOPeccpSVa8MK88F8 0SlIYJo7xo01+0/7SoZbDjHv0ZA8fPbEGp+IVMrQr2p2NxWHe2Bmy/F/p8PGe0ZnIhJV WpvUTABR8MfpaXBVfy1UJ7taqkWFpKy9imCPeeghS2qkvWco/b+H313by1vOsVic6cWt wd/Q== X-Gm-Message-State: AC+VfDzz41yoDMVCl/4+Ni8FncdE8GcuwHMcBbHxbZDo3FgZgtftnBQM HwggaZTs2f2k+NYXCPeiB8W4YxDDyrEBUTYf X-Received: by 2002:ac8:7f50:0:b0:3f9:d590:82ac with SMTP id g16-20020ac87f50000000b003f9d59082acmr3260032qtk.20.1686369056110; Fri, 09 Jun 2023 20:50:56 -0700 (PDT) Received: from localhost ([2620:10d:c091:400::5:81d3]) by smtp.gmail.com with ESMTPSA id t2-20020ac87382000000b003f6bdc221e6sm1667873qtp.53.2023.06.09.20.50.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Jun 2023 20:50:55 -0700 (PDT) From: David Vernet To: bpf@vger.kernel.org Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev, song@kernel.org, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, jolsa@kernel.org, linux-kernel@vger.kernel.org, kernel-team@meta.com, tj@kernel.org Subject: [PATCH bpf-next 1/5] bpf: Add bpf_cpumask_first_and() kfunc Date: Fri, 9 Jun 2023 22:50:49 -0500 Message-Id: <20230610035053.117605-1-void@manifault.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768293207765921404?= X-GMAIL-MSGID: =?utf-8?q?1768293207765921404?= We currently provide bpf_cpumask_first(), bpf_cpumask_any(), and bpf_cpumask_any_and() kfuncs. bpf_cpumask_any() and bpf_cpumask_any_and() are confusing misnomers in that they actually just call cpumask_first() and cpumask_first_and() respectively. We'll replace them with bpf_cpumask_any_distribute() and bpf_cpumask_any_distribute_and() kfuncs in a subsequent patch, so let's ensure feature parity by adding a bpf_cpumask_first_and() kfunc to account for bpf_cpumask_any_and() being removed. Signed-off-by: David Vernet Acked-by: Yonghong Song --- kernel/bpf/cpumask.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/kernel/bpf/cpumask.c b/kernel/bpf/cpumask.c index 7efdf5d770ca..9416c8ac8a04 100644 --- a/kernel/bpf/cpumask.c +++ b/kernel/bpf/cpumask.c @@ -131,6 +131,21 @@ __bpf_kfunc u32 bpf_cpumask_first_zero(const struct cpumask *cpumask) return cpumask_first_zero(cpumask); } +/** + * bpf_cpumask_first_and() - Return the index of the first nonzero bit from the + * AND of two cpumasks. + * @src1: The first cpumask. + * @src2: The second cpumask. + * + * Find the index of the first nonzero bit of the AND of two cpumasks. + * struct bpf_cpumask pointers may be safely passed to @src1 and @src2. + */ +__bpf_kfunc u32 bpf_cpumask_first_and(const struct cpumask *src1, + const struct cpumask *src2) +{ + return cpumask_first_and(src1, src2); +} + /** * bpf_cpumask_set_cpu() - Set a bit for a CPU in a BPF cpumask. * @cpu: The CPU to be set in the cpumask. @@ -406,6 +421,7 @@ BTF_ID_FLAGS(func, bpf_cpumask_release, KF_RELEASE) BTF_ID_FLAGS(func, bpf_cpumask_acquire, KF_ACQUIRE | KF_TRUSTED_ARGS) BTF_ID_FLAGS(func, bpf_cpumask_first, KF_RCU) BTF_ID_FLAGS(func, bpf_cpumask_first_zero, KF_RCU) +BTF_ID_FLAGS(func, bpf_cpumask_first_and, KF_RCU) BTF_ID_FLAGS(func, bpf_cpumask_set_cpu, KF_RCU) BTF_ID_FLAGS(func, bpf_cpumask_clear_cpu, KF_RCU) BTF_ID_FLAGS(func, bpf_cpumask_test_cpu, KF_RCU) From patchwork Sat Jun 10 03:50:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Vernet X-Patchwork-Id: 105889 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1336257vqr; Fri, 9 Jun 2023 21:02:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6ub5YM5qAou5qi7+BTAtFsbv1K/TxRaFPM8tGTcRbPhpPI9VkSupuuKY4gIBWOjLaPf7Ki X-Received: by 2002:a17:907:2da1:b0:973:84b0:b077 with SMTP id gt33-20020a1709072da100b0097384b0b077mr4024359ejc.33.1686369730931; Fri, 09 Jun 2023 21:02:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686369730; cv=none; d=google.com; s=arc-20160816; b=PgNlPaz+8xpzKHOAKAKS1WTTvLF2tjmOkAIfvYqsEXcgmktc27QYqPRozd2UvkC3wt WUcz0W7z6LtuMBBdF4d27AI/BAXkT8qbUhXqkz7vtpxYKBIpjMSDmAaIoddmtSMT1j8i QXnigDjLqb0ylJkWfBqwH0dELnUNrBZRvL/KOJIfilowKvMG5j/jInXvqWdzmKZ7VegB cMK/FaUNNrJK16ZNroIWWhvLQi2gxdALVgneLS+uhHmr8CfN7wZ6xybnHF+fjf+8ldcJ mVwuFf1sVasHSKVb27vT3iUbrQJ4BZ0YDuOSXxQxN0YIvcv6dRTRrOL+I5JZOQ16ltSm qXCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=LwoULZs5X3hMJWti4aKL+kX48d28ami6bZcIsL0hjWs=; b=EbOAEg9Dx4rXSld8ByaQp11AcslfycxT/vjcbOazEj3f0sTAEyP9TKYdpS2SD/KsN1 TDdVQchRS4XWgk8YNQ4DTVd4Dy9tVCoAF02FZb40cFod5m1d/wbAxwpKqGRSofzlTEIM O44En7KsDcziCGSFgcs/oCglqc4qKzg0mutVbOw/k/Va/1EKf1dHOITSi2FP+Z7COkRI 1djq9+LZ8mBQAttz2V9lTBHtKsitTuHkLDxowdy3ToXYWxnYADFviIdFP3+XD5kZVy/C GZ8WhGaPVN9aQh9aI8y6XcQFJLrhM0mWkBzb5Tm0kESXstzyw7wf0aOU1mCnHdwzfw8z rGEA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kj24-20020a170907765800b0097882a99abcsi2289610ejc.964.2023.06.09.21.01.46; Fri, 09 Jun 2023 21:02:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230040AbjFJDvE (ORCPT + 99 others); Fri, 9 Jun 2023 23:51:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229854AbjFJDvA (ORCPT ); Fri, 9 Jun 2023 23:51:00 -0400 Received: from mail-qk1-f172.google.com (mail-qk1-f172.google.com [209.85.222.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F308135B1; Fri, 9 Jun 2023 20:50:58 -0700 (PDT) Received: by mail-qk1-f172.google.com with SMTP id af79cd13be357-75d509d425eso241033985a.1; Fri, 09 Jun 2023 20:50:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686369058; x=1688961058; 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=LwoULZs5X3hMJWti4aKL+kX48d28ami6bZcIsL0hjWs=; b=aTQJSp4ituCCarOfAFDblDb7ono+/JhfldNXC43+ftR9Ic/QHSvbPTBNntWm5gOO3E PjLn1TBEUllRpU3qaZsk4MofvgKHQa31VU1099izRpWrUddNm3ea8fElA/7qyQvAvWvt K6QXzuCs1WvvA8gdrIoijeueMX9fWlYdE9XEhlJHFZWciYHnWFibU/gHtR6kNMzZzYOS hopZ9wlxpSZWls5NA2F4EkVnql6y6kNNGoOjWG5e/d1bBiC4WdVW2bKi0GkoFomKa2gV V0tm+KT4hpA0aXUZ2Ht/68CqFn+T897UqUJZNY1fYF/iHWVzeOH6jvS97LrjtLZuJcW4 DCgw== X-Gm-Message-State: AC+VfDxvMwAGVrLfqjr8mcwT776Xx2ee29RTg93lGS+GXBDPFo7NoaRu BTf8qvYpquwAXdTTI+HGsuXuc19Y28jn36cE X-Received: by 2002:a05:620a:8884:b0:75d:4fb8:e219 with SMTP id qk4-20020a05620a888400b0075d4fb8e219mr2571323qkn.36.1686369057575; Fri, 09 Jun 2023 20:50:57 -0700 (PDT) Received: from localhost ([2620:10d:c091:400::5:81d3]) by smtp.gmail.com with ESMTPSA id w13-20020a05620a148d00b0075914b01c10sm1456322qkj.85.2023.06.09.20.50.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Jun 2023 20:50:57 -0700 (PDT) From: David Vernet To: bpf@vger.kernel.org Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev, song@kernel.org, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, jolsa@kernel.org, linux-kernel@vger.kernel.org, kernel-team@meta.com, tj@kernel.org Subject: [PATCH bpf-next 2/5] selftests/bpf: Add test for new bpf_cpumask_first_and() kfunc Date: Fri, 9 Jun 2023 22:50:50 -0500 Message-Id: <20230610035053.117605-2-void@manifault.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230610035053.117605-1-void@manifault.com> References: <20230610035053.117605-1-void@manifault.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768286826887697512?= X-GMAIL-MSGID: =?utf-8?q?1768286826887697512?= A prior patch added a new kfunc called bpf_cpumask_first_and() which wraps cpumask_first_and(). This patch adds a selftest to validate its behavior. Signed-off-by: David Vernet Acked-by: Yonghong Song --- .../selftests/bpf/prog_tests/cpumask.c | 1 + .../selftests/bpf/progs/cpumask_common.h | 2 ++ .../selftests/bpf/progs/cpumask_success.c | 32 +++++++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/tools/testing/selftests/bpf/prog_tests/cpumask.c b/tools/testing/selftests/bpf/prog_tests/cpumask.c index d89191440fb1..756ea8b590b6 100644 --- a/tools/testing/selftests/bpf/prog_tests/cpumask.c +++ b/tools/testing/selftests/bpf/prog_tests/cpumask.c @@ -10,6 +10,7 @@ static const char * const cpumask_success_testcases[] = { "test_set_clear_cpu", "test_setall_clear_cpu", "test_first_firstzero_cpu", + "test_firstand_nocpu", "test_test_and_set_clear", "test_and_or_xor", "test_intersects_subset", diff --git a/tools/testing/selftests/bpf/progs/cpumask_common.h b/tools/testing/selftests/bpf/progs/cpumask_common.h index 0c5b785a93e4..b3493d5d263e 100644 --- a/tools/testing/selftests/bpf/progs/cpumask_common.h +++ b/tools/testing/selftests/bpf/progs/cpumask_common.h @@ -28,6 +28,8 @@ void bpf_cpumask_release(struct bpf_cpumask *cpumask) __ksym; struct bpf_cpumask *bpf_cpumask_acquire(struct bpf_cpumask *cpumask) __ksym; u32 bpf_cpumask_first(const struct cpumask *cpumask) __ksym; u32 bpf_cpumask_first_zero(const struct cpumask *cpumask) __ksym; +u32 bpf_cpumask_first_and(const struct cpumask *src1, + const struct cpumask *src2) __ksym; void bpf_cpumask_set_cpu(u32 cpu, struct bpf_cpumask *cpumask) __ksym; void bpf_cpumask_clear_cpu(u32 cpu, struct bpf_cpumask *cpumask) __ksym; bool bpf_cpumask_test_cpu(u32 cpu, const struct cpumask *cpumask) __ksym; diff --git a/tools/testing/selftests/bpf/progs/cpumask_success.c b/tools/testing/selftests/bpf/progs/cpumask_success.c index 602a88b03dbc..fbaf510f4ab5 100644 --- a/tools/testing/selftests/bpf/progs/cpumask_success.c +++ b/tools/testing/selftests/bpf/progs/cpumask_success.c @@ -175,6 +175,38 @@ int BPF_PROG(test_first_firstzero_cpu, struct task_struct *task, u64 clone_flags return 0; } +SEC("tp_btf/task_newtask") +int BPF_PROG(test_firstand_nocpu, struct task_struct *task, u64 clone_flags) +{ + struct bpf_cpumask *mask1, *mask2; + u32 first; + + if (!is_test_task()) + return 0; + + mask1 = create_cpumask(); + if (!mask1) + return 0; + + mask2 = create_cpumask(); + if (!mask2) + goto release_exit; + + bpf_cpumask_set_cpu(0, mask1); + bpf_cpumask_set_cpu(1, mask2); + + first = bpf_cpumask_first_and(cast(mask1), cast(mask2)); + if (first <= 1) + err = 3; + +release_exit: + if (mask1) + bpf_cpumask_release(mask1); + if (mask2) + bpf_cpumask_release(mask2); + return 0; +} + SEC("tp_btf/task_newtask") int BPF_PROG(test_test_and_set_clear, struct task_struct *task, u64 clone_flags) { From patchwork Sat Jun 10 03:50:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Vernet X-Patchwork-Id: 105887 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1333936vqr; Fri, 9 Jun 2023 20:54:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6ic7V5Uw7PA0m/TkLbEDeATW8zeEnJfbkyuCNtTAdm8wmSFrLqw6MVOn0TSKww7gO7B1Kc X-Received: by 2002:a17:902:e747:b0:1ae:626b:4771 with SMTP id p7-20020a170902e74700b001ae626b4771mr852126plf.36.1686369248434; Fri, 09 Jun 2023 20:54:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686369248; cv=none; d=google.com; s=arc-20160816; b=GD374c9HqGuqKsvSZ6uFwCVSsy3BU62DFUoSkORGSO8hjYHByMAFhmEVprnx0nMUqf aCeEYYioAOEDVxwVcCTQdkt+NdOLRBGp8dEVyrC4nk4XP3BlwPjxmHFyMpvVGH4ZphC4 ABP3ahJTNFJVD5G4qxjEKD77X4G3/i4u18/XWFJiIv8FCwIi4hFXj+J2IBfO/N36IxWk TloBlLtKE+WiG5vLBPJC1YSRhe+bnMFJ9M4lEz940t9/9Gr1slD2pjsmT3x70YlRxQf3 Ci4mDCyRoWC3iFxCI3aJdbdzUAi75Q+R7obHmFFqvpHP+sHZHGWprVamEVLf9Bq46jtu 0YFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=3+QjjC2Q6R+F5tehvijFrBV+74kCnxo9UVFUil+fcVI=; b=WyigZ9nbO++XKFYS/ClDwTGoOTWjgWV5rpMyJU0uDmg2y7AoMko1mZ71+KujrSLdi5 RSu24x7cQAq6JgN9hWYD82L6FGYA5l6UZp3Ldtqc6/4WMKRmTwBQtOYJVCmoySQQ4Zqb eUnTPGV2Phy0VAZ6caKHzntFKT/RUXYnluwJ4O8s0QG+PFUwhZwrOmwv9ogrcKm5givM zO8NxOwma9NDhh0tnAUx7lze6wosbK51YkcIL1Io9w3lvLrXN0pJQHpOTbKLtvza7Xro k3iVihk8T4ll9V6czDp0xqtGpufGjWgu6SRcGdUPSB3GDyzIty0PkBRRaSmSpcOhTTMI JFQQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kv3-20020a17090328c300b001a9baadecc0si204295plb.160.2023.06.09.20.53.56; Fri, 09 Jun 2023 20:54:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233293AbjFJDvJ (ORCPT + 99 others); Fri, 9 Jun 2023 23:51:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232709AbjFJDvB (ORCPT ); Fri, 9 Jun 2023 23:51:01 -0400 Received: from mail-qv1-f46.google.com (mail-qv1-f46.google.com [209.85.219.46]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BA7D35B6; Fri, 9 Jun 2023 20:51:00 -0700 (PDT) Received: by mail-qv1-f46.google.com with SMTP id 6a1803df08f44-6260f03b76dso17869976d6.1; Fri, 09 Jun 2023 20:51:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686369059; x=1688961059; 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=3+QjjC2Q6R+F5tehvijFrBV+74kCnxo9UVFUil+fcVI=; b=Mq+DBsf+GXQa0lrFwRYRtzYUZQ9a2Mt5MM/4diyDzXM3BnxavAZzQ9az5obUjv5/Cw leKyOjU43ieRJ7sLes0jhpCS1cr/EP/+8aiCn78m2i8nEBW2kinvijS3bEFT6uFLF+Nh CSEWFcPwwlsRj8ftMywdRo6CoaslzL7g+07C7XLIOL1MUuTWF+p3x5PW787WdEX0MUnR FlJa39Oir7KrbNF6aidAB/i5N70OhE2A1cFfcugNKy6AFtEdP7awP4QmecL54GA9gf2y BLXvJAz9ySL/PdbwrLLOyO7NuoRZeVLAsIl30gQ0AZF76s6N6sXvErFg5/Qa3DA+xqYe XTzA== X-Gm-Message-State: AC+VfDyUhsZ0T0kxb5H+REGzoj4PIPsMAJO1+PqH9OuDTSYkINFcN7yC oVxyrrTSRkhrPnhPz6qSEO/XOSsYc0eurCQD X-Received: by 2002:a05:6214:b68:b0:623:9126:8d7b with SMTP id ey8-20020a0562140b6800b0062391268d7bmr5436418qvb.28.1686369059185; Fri, 09 Jun 2023 20:50:59 -0700 (PDT) Received: from localhost ([2620:10d:c091:400::5:81d3]) by smtp.gmail.com with ESMTPSA id a18-20020a0ce392000000b005fe4a301350sm1599968qvl.48.2023.06.09.20.50.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Jun 2023 20:50:58 -0700 (PDT) From: David Vernet To: bpf@vger.kernel.org Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev, song@kernel.org, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, jolsa@kernel.org, linux-kernel@vger.kernel.org, kernel-team@meta.com, tj@kernel.org Subject: [PATCH bpf-next 3/5] bpf: Replace bpf_cpumask_any* with bpf_cpumask_any_distribute* Date: Fri, 9 Jun 2023 22:50:51 -0500 Message-Id: <20230610035053.117605-3-void@manifault.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230610035053.117605-1-void@manifault.com> References: <20230610035053.117605-1-void@manifault.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768286321158779686?= X-GMAIL-MSGID: =?utf-8?q?1768286321158779686?= We currently export the bpf_cpumask_any() and bpf_cpumask_any_and() kfuncs. Intuitively, one would expect these to choose any CPU in the cpumask, but what they actually do is alias to cpumask_first() and cpmkas_first_and(). This is useless given that we already export bpf_cpumask_first() and bpf_cpumask_first_and(), so this patch replaces them with kfuncs that call cpumask_any_distribute() and cpumask_any_and_distribute(), which actually choose any CPU from the cpumask (or the AND of two cpumasks for the latter). Signed-off-by: David Vernet Acked-by: Yonghong Song --- kernel/bpf/cpumask.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/kernel/bpf/cpumask.c b/kernel/bpf/cpumask.c index 9416c8ac8a04..938a60ff4295 100644 --- a/kernel/bpf/cpumask.c +++ b/kernel/bpf/cpumask.c @@ -382,7 +382,7 @@ __bpf_kfunc void bpf_cpumask_copy(struct bpf_cpumask *dst, const struct cpumask } /** - * bpf_cpumask_any() - Return a random set CPU from a cpumask. + * bpf_cpumask_any_distribute() - Return a random set CPU from a cpumask. * @cpumask: The cpumask being queried. * * Return: @@ -391,26 +391,28 @@ __bpf_kfunc void bpf_cpumask_copy(struct bpf_cpumask *dst, const struct cpumask * * A struct bpf_cpumask pointer may be safely passed to @src. */ -__bpf_kfunc u32 bpf_cpumask_any(const struct cpumask *cpumask) +__bpf_kfunc u32 bpf_cpumask_any_distribute(const struct cpumask *cpumask) { - return cpumask_any(cpumask); + return cpumask_any_distribute(cpumask); } /** - * bpf_cpumask_any_and() - Return a random set CPU from the AND of two - * cpumasks. + * bpf_cpumask_any_and_distribute() - Return a random set CPU from the AND of + * two cpumasks. * @src1: The first cpumask. * @src2: The second cpumask. * * Return: - * * A random set bit within [0, num_cpus) if at least one bit is set. + * * A random set bit within [0, num_cpus) from the AND of two cpumasks, if at + * least one bit is set. * * >= num_cpus if no bit is set. * * struct bpf_cpumask pointers may be safely passed to @src1 and @src2. */ -__bpf_kfunc u32 bpf_cpumask_any_and(const struct cpumask *src1, const struct cpumask *src2) +__bpf_kfunc u32 bpf_cpumask_any_and_distribute(const struct cpumask *src1, + const struct cpumask *src2) { - return cpumask_any_and(src1, src2); + return cpumask_any_and_distribute(src1, src2); } __diag_pop(); @@ -438,8 +440,8 @@ BTF_ID_FLAGS(func, bpf_cpumask_subset, KF_RCU) BTF_ID_FLAGS(func, bpf_cpumask_empty, KF_RCU) BTF_ID_FLAGS(func, bpf_cpumask_full, KF_RCU) BTF_ID_FLAGS(func, bpf_cpumask_copy, KF_RCU) -BTF_ID_FLAGS(func, bpf_cpumask_any, KF_RCU) -BTF_ID_FLAGS(func, bpf_cpumask_any_and, KF_RCU) +BTF_ID_FLAGS(func, bpf_cpumask_any_distribute, KF_RCU) +BTF_ID_FLAGS(func, bpf_cpumask_any_and_distribute, KF_RCU) BTF_SET8_END(cpumask_kfunc_btf_ids) static const struct btf_kfunc_id_set cpumask_kfunc_set = { From patchwork Sat Jun 10 03:50:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Vernet X-Patchwork-Id: 105888 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1334714vqr; Fri, 9 Jun 2023 20:56:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Bw9z8rZMMKsALOyTCJaK8gEpqYoxv/eLLvNrXrc7iFAic91BhGAscQkYaIty3B30ruAMX X-Received: by 2002:a17:902:bd05:b0:1ae:10bc:4ae8 with SMTP id p5-20020a170902bd0500b001ae10bc4ae8mr597710pls.26.1686369413932; Fri, 09 Jun 2023 20:56:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686369413; cv=none; d=google.com; s=arc-20160816; b=c/FKiYN6663n56ejEOidZoNQD4Y4S6xRIu1dpbHpME8wYVES8Rv/z6Qg8N+ZUXZDRS 01x7yeG0uJcRT8pIQMP4nb0g4soiq1zqzClsaxmkJ3+AGpVxx5VvvuIzph/Fu2qrA9cX 4flvSqadR7R5qeWn6XAWG/gYSa+U7FeWYeYxiEL/yhinAr2H7GOux7s0LZfJF/R+zvb6 h57CD1d8Ekgydht7KsJtMHWPoIrx+8r9Q9+g/qxy1UC3MobmblN/BHdv17JNfYQy1Qmq ACo/OaLNUNAXByYLC8bg2wcSvf7nwyxp0RsoyG8e17caHNkpvLsXCZ2G5R02lsLaMOYI hJTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=7fnYwuYaIS9dKMy4HedverGuGC//hnx9S7Ka8IPobdY=; b=LGjieRtKMb7ZKACmZbo9ATQVQucYURzQKdzK3knn8Yugld/7Oe1DvOBC8KlqWHrBwb KU5/cOZh8bRAj2WoLikJURAStZBHuc8s8t0I7k3PSAlWrjugehkGNedY50/yWvJ6FzM+ V9NkW0a3zLU9deNfDriPasislNYhEpCcb8AO2ZkK1XGnzDsC/rRFErwfoK8ULyDLgYxt nxS4aZVKIpLcYXvxJnQUFSLG3OpwCi/7rM0sv8sClUsB8TlFQZWtOJQ4PfDiAp2jmkGN Xmgv0VmkQgbpS7366UZz3Qev21thEDbnxMfo9mqC+4g6M3WFWlwklHqykE+AceW1Rdoa Os7Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kv3-20020a17090328c300b001a9baadecc0si204295plb.160.2023.06.09.20.56.41; Fri, 09 Jun 2023 20:56:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233651AbjFJDvN (ORCPT + 99 others); Fri, 9 Jun 2023 23:51:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232766AbjFJDvD (ORCPT ); Fri, 9 Jun 2023 23:51:03 -0400 Received: from mail-qv1-f43.google.com (mail-qv1-f43.google.com [209.85.219.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA2143AA8; Fri, 9 Jun 2023 20:51:01 -0700 (PDT) Received: by mail-qv1-f43.google.com with SMTP id 6a1803df08f44-626190df842so19634526d6.0; Fri, 09 Jun 2023 20:51:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686369061; x=1688961061; 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=7fnYwuYaIS9dKMy4HedverGuGC//hnx9S7Ka8IPobdY=; b=UHI9aRy4+WIJFi0zmfDkpuONYdKhfEfQmPJfIs8lP2QbfWlbNIhQdvN5L6s0EHoPOu XMnBjUwgvOzxGejPJJOdeTT77Kihx7YSo0XzO6KcrDAadgJQ9WqRzDQVtcHs9lWEy4ZD q1hJU5l9quKMdzgTKE+OFy7sEHSoRGliHPTqeyDmA25SD6f1omaerx7sxMaIrA23TYxO R/xa0R0PwhWT0vL/bqIiC47a6DRzN6OiVAiCuTlDlw70aqm0IgyP3pS1CbtWQLYMla3w K5kjdZz17TMSFUjYpFmaSQt0Piaj1l3ecagVh9Fic5EN7/Y1anzqtMgQL7Sp5tzDgz5b nBNg== X-Gm-Message-State: AC+VfDwY4ejrOANIqILDIiMwabiaPr3aMMo9tRdNGshs+O04gi7iiYZx keB+TUKOsWFNCskWXXW4rWSDWplH5qaLCV1f X-Received: by 2002:a05:6214:c2b:b0:621:3b88:7b09 with SMTP id a11-20020a0562140c2b00b006213b887b09mr3883590qvd.35.1686369060687; Fri, 09 Jun 2023 20:51:00 -0700 (PDT) Received: from localhost ([2620:10d:c091:400::5:81d3]) by smtp.gmail.com with ESMTPSA id t18-20020a0cea32000000b005ef54657ea0sm1588317qvp.126.2023.06.09.20.50.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Jun 2023 20:51:00 -0700 (PDT) From: David Vernet To: bpf@vger.kernel.org Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev, song@kernel.org, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, jolsa@kernel.org, linux-kernel@vger.kernel.org, kernel-team@meta.com, tj@kernel.org Subject: [PATCH bpf-next 4/5] selftests/bpf: Update bpf_cpumask_any* tests to use bpf_cpumask_any_distribute* Date: Fri, 9 Jun 2023 22:50:52 -0500 Message-Id: <20230610035053.117605-4-void@manifault.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230610035053.117605-1-void@manifault.com> References: <20230610035053.117605-1-void@manifault.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768286494523274511?= X-GMAIL-MSGID: =?utf-8?q?1768286494523274511?= In a prior patch, we removed the bpf_cpumask_any() and bpf_cpumask_any_and() kfuncs, and replaced them with bpf_cpumask_any_distribute() and bpf_cpumask_any_distribute_and(). The advertised semantics between the two kfuncs were identical, with the former always returning the first CPU, and the latter actually returning any CPU. This patch updates the selftests for these kfuncs to use the new names. Signed-off-by: David Vernet Acked-by: Yonghong Song --- tools/testing/selftests/bpf/progs/cpumask_common.h | 4 ++-- tools/testing/selftests/bpf/progs/cpumask_success.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/bpf/progs/cpumask_common.h b/tools/testing/selftests/bpf/progs/cpumask_common.h index b3493d5d263e..b15c588ace15 100644 --- a/tools/testing/selftests/bpf/progs/cpumask_common.h +++ b/tools/testing/selftests/bpf/progs/cpumask_common.h @@ -52,8 +52,8 @@ bool bpf_cpumask_subset(const struct cpumask *src1, const struct cpumask *src2) bool bpf_cpumask_empty(const struct cpumask *cpumask) __ksym; bool bpf_cpumask_full(const struct cpumask *cpumask) __ksym; void bpf_cpumask_copy(struct bpf_cpumask *dst, const struct cpumask *src) __ksym; -u32 bpf_cpumask_any(const struct cpumask *src) __ksym; -u32 bpf_cpumask_any_and(const struct cpumask *src1, const struct cpumask *src2) __ksym; +u32 bpf_cpumask_any_distribute(const struct cpumask *src) __ksym; +u32 bpf_cpumask_any_and_distribute(const struct cpumask *src1, const struct cpumask *src2) __ksym; void bpf_rcu_read_lock(void) __ksym; void bpf_rcu_read_unlock(void) __ksym; diff --git a/tools/testing/selftests/bpf/progs/cpumask_success.c b/tools/testing/selftests/bpf/progs/cpumask_success.c index fbaf510f4ab5..674a63424dee 100644 --- a/tools/testing/selftests/bpf/progs/cpumask_success.c +++ b/tools/testing/selftests/bpf/progs/cpumask_success.c @@ -344,13 +344,13 @@ int BPF_PROG(test_copy_any_anyand, struct task_struct *task, u64 clone_flags) bpf_cpumask_set_cpu(1, mask2); bpf_cpumask_or(dst1, cast(mask1), cast(mask2)); - cpu = bpf_cpumask_any(cast(mask1)); + cpu = bpf_cpumask_any_distribute(cast(mask1)); if (cpu != 0) { err = 6; goto release_exit; } - cpu = bpf_cpumask_any(cast(dst2)); + cpu = bpf_cpumask_any_distribute(cast(dst2)); if (cpu < nr_cpus) { err = 7; goto release_exit; @@ -362,13 +362,13 @@ int BPF_PROG(test_copy_any_anyand, struct task_struct *task, u64 clone_flags) goto release_exit; } - cpu = bpf_cpumask_any(cast(dst2)); + cpu = bpf_cpumask_any_distribute(cast(dst2)); if (cpu > 1) { err = 9; goto release_exit; } - cpu = bpf_cpumask_any_and(cast(mask1), cast(mask2)); + cpu = bpf_cpumask_any_and_distribute(cast(mask1), cast(mask2)); if (cpu < nr_cpus) { err = 10; goto release_exit; From patchwork Sat Jun 10 03:50:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Vernet X-Patchwork-Id: 105894 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1365933vqr; Fri, 9 Jun 2023 22:44:46 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7s2qdQt6Fo0XMpDsBcx7vtSksHY+jGekDX/Qjq4sA7hA8tT9H/T0D12owRDEtOJSUBrPl/ X-Received: by 2002:a17:902:7449:b0:1b1:b253:5428 with SMTP id e9-20020a170902744900b001b1b2535428mr925101plt.58.1686375885950; Fri, 09 Jun 2023 22:44:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686375885; cv=none; d=google.com; s=arc-20160816; b=IsyhHL9xMLPc3bgSpPdEh8X/5kVAOMlbEpaaClgSUTqAIVzvfxpg+97NVsWkyC7Vg7 QyiiU5N/nVIGnEwCOhmoW/eKjior7CdpSK3siBgRLG3aEOt/z2Ni8Gckm5FWboRp+efa o3fNeYh4cT5PDPWUym9QepRbw9KGul69S8XbiezVVoaKI70s1iuyLip0IwgUgo4wnwwS T4psOMhHKzeQSHjhDMVx/aO96eh6Ap8XcXG7u06UKVZLZq1yGXmtlmsSh3Pfhg8COmwL ppeKiW2V/EJF1qfe3Wruq3XghwpQ3vdEos9F4NNL5vBiq1owHwyIDKcCfN5P5R+MPEbr wp1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=AgbyKA8QC3K+q2sl72LDjL4RrY6kZndZm/jjqQ5iNdY=; b=o1OHLnYr8/Tpz4OOKYcMvoN+ST9gxbw4Op5oM3RpQmLMSsVmdIZV2WrY16B03t9ukF Hm9hs6tPKbM3w5r0bkVwHwzeU4FUrkK68BozHxcqkoopxhbxNtbikZTqM8yn7I73C58I m44ngfhMB5OuAvY2CzYttFBP2Rsx+qu1LQvWIGcvV70C1F6I3rCQOaTvEIiQof1i+y+r m6MZqk9Px6yoOdGuiyxufXm9ceIiZVHh23XH18hyws7sl3Z1rx7+yohrWLww1E6fl9/H reDSo8GTGaASrMfoNMEEmCjZdjU8sNFDXRnNEevLng5JmdqB06YR7FgCK2TlaUZc18Gc rxvQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f4-20020a170902ce8400b001a643dfb884si3869637plg.451.2023.06.09.22.44.34; Fri, 09 Jun 2023 22:44:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232971AbjFJDvS (ORCPT + 99 others); Fri, 9 Jun 2023 23:51:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232947AbjFJDvF (ORCPT ); Fri, 9 Jun 2023 23:51:05 -0400 Received: from mail-qk1-f173.google.com (mail-qk1-f173.google.com [209.85.222.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CDE13ABF; Fri, 9 Jun 2023 20:51:03 -0700 (PDT) Received: by mail-qk1-f173.google.com with SMTP id af79cd13be357-75d4b85b3ccso234266585a.2; Fri, 09 Jun 2023 20:51:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686369062; x=1688961062; 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=AgbyKA8QC3K+q2sl72LDjL4RrY6kZndZm/jjqQ5iNdY=; b=Kz/ll/HtF6io3i0ST43NPilEmeUA2gTDSy1uJmmLyLpxAvunien8SETITsDk+z6jJX B2m/abMZob+okJItLFa8kHLFyDQwYFOW0ov/FneFP8JkF1SadiHzjZYZVBCzIa0kvRXX MFSEoVcLW0RGmE2Yf/6bq6Dmu4uzF3l1lkiQNcuEHIn4X5MEpJtuEyvU4PuZDnUv9MZN U2t15v7a1gn8Vl+XhVLbQY1bIB+lz+aPLFn85MPi5Lo49PUVF/wNZOIqOc6CK31uAEw2 jzQt3oC8yZLAJ5ZQB6HBjgcGtlq00ED4aXsszXtK55qDcm612E64rXKzB+LzXWUOy4bW vYgg== X-Gm-Message-State: AC+VfDz0ni/MMnkx0mwG/gDFgUPsJf95xuinZ++QMPwk2XWa8+RQAsnx jYcbJZ+FKW9jrFXkfDFfjaspDgcM+DlmQ3sF X-Received: by 2002:a05:620a:45a9:b0:75e:d2d2:26c with SMTP id bp41-20020a05620a45a900b0075ed2d2026cmr3901966qkb.47.1686369062120; Fri, 09 Jun 2023 20:51:02 -0700 (PDT) Received: from localhost ([2620:10d:c091:400::5:81d3]) by smtp.gmail.com with ESMTPSA id x14-20020ae9f80e000000b0074d60b697a6sm1469315qkh.12.2023.06.09.20.51.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Jun 2023 20:51:01 -0700 (PDT) From: David Vernet To: bpf@vger.kernel.org Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev, song@kernel.org, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, jolsa@kernel.org, linux-kernel@vger.kernel.org, kernel-team@meta.com, tj@kernel.org Subject: [PATCH bpf-next 5/5] bpf/docs: Update documentation for new cpumask kfuncs Date: Fri, 9 Jun 2023 22:50:53 -0500 Message-Id: <20230610035053.117605-5-void@manifault.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230610035053.117605-1-void@manifault.com> References: <20230610035053.117605-1-void@manifault.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768293280937859982?= X-GMAIL-MSGID: =?utf-8?q?1768293280937859982?= We recently added the bpf_cpumask_first_and() kfunc, and changed bpf_cpumask_any() / bpf_cpumask_any_and() to bpf_cpumask_any_distribute() and bpf_cpumask_any_distribute_and() respectively. This patch adds an entry for the bpf_cpumask_first_and() kfunc, and updates the documentation for the *any* kfuncs to the new names. Signed-off-by: David Vernet Acked-by: Yonghong Song --- Documentation/bpf/cpumasks.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Documentation/bpf/cpumasks.rst b/Documentation/bpf/cpumasks.rst index 41efd8874eeb..3139c7c02e79 100644 --- a/Documentation/bpf/cpumasks.rst +++ b/Documentation/bpf/cpumasks.rst @@ -351,14 +351,15 @@ In addition to the above kfuncs, there is also a set of read-only kfuncs that can be used to query the contents of cpumasks. .. kernel-doc:: kernel/bpf/cpumask.c - :identifiers: bpf_cpumask_first bpf_cpumask_first_zero bpf_cpumask_test_cpu + :identifiers: bpf_cpumask_first bpf_cpumask_first_zero bpf_cpumask_first_and + bpf_cpumask_test_cpu .. kernel-doc:: kernel/bpf/cpumask.c :identifiers: bpf_cpumask_equal bpf_cpumask_intersects bpf_cpumask_subset bpf_cpumask_empty bpf_cpumask_full .. kernel-doc:: kernel/bpf/cpumask.c - :identifiers: bpf_cpumask_any bpf_cpumask_any_and + :identifiers: bpf_cpumask_any_distribute bpf_cpumask_any_and_distribute ----