Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp521749lqh; Tue, 7 May 2024 06:34:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU5SdNrYLe9wl3bOJJzsgIuSCG90Q2zWqQjSa48YSBOFHc3cF0mjzMwYK8DbeDrTTc1VMSPcwn9ngoMzUgzcjmU22RA3ST8NYv46N3kBg== X-Google-Smtp-Source: AGHT+IF9eW1isOgis+fe5m7iKqwyrqCgKYNQ6oRf+AWQkB62Xv53LyW62Shl9Gx0zPuP8rptC9Ke X-Received: by 2002:ac8:5a93:0:b0:43a:f091:29ec with SMTP id c19-20020ac85a93000000b0043af09129ecmr16411961qtc.21.1715088863575; Tue, 07 May 2024 06:34:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715088863; cv=pass; d=google.com; s=arc-20160816; b=ThzqmzPm3MA3t4BRxMS45CObOXp5wiB1kuMdDlM7DNA5ci3sK4j8NCB90bE+4w2rXZ /zFYvyVqX55HMyIZtb0J/NSt9xffD23GV6GMzJ3QjnTm5JqUFAKsAlaa8eK9jX0dxZoV syyzVhnlVftykJwooNm+XwUV1LWJ7xBC1cSZZ06TnV4EUjRYMXa9sXA1ra4QdJ8On8J1 MvtS6tQxs63AAsvduBmC5OFoIvwRrJDjJromjHL49iGwkK6RBSgwPJzndaRjTVDj6BH+ gxpcW/cqWMUlsYyPIC3peDw3P7WSys0M/cB5UbDbWNXZWKaIFI9dQUZux4+9KgtLFDK+ 0/Pw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=LLx1D2UiFS0qba8bpv7RAfSl1h/uh5fyFC6Oy2Ceygs=; fh=+xF1049tVypekkjShp17fvMlvSr2JIl/AO2WK77YLJ4=; b=kuvs2uVMg70n12wIOBiNNCjrNJU1P2eQQqk4wqXatFS9yV9gU3O4Rt++ObwGtTK0oV iqAeW3Iy29h7hpiJY+IDOsekN62ZOiR2lUZFGhA7Pf+8UYR9u295NXfjJvHdeQX9aUhb blK42fJCHAOR9EEd/S2AoO2I5Y5o2bfTmAoiCch23r+3JFRIVIEHs07P993F5pxnl8yd PcsdTZdiU94ZYaSYU6rxuUP7MerECgEXhkalB1LZsfYe8zUWeQGkUNKrKi2FS0BG+kmL Gt+db+Q8D7NFiIgJYnjwhQtifJ0lP081SafcNEJ9pWnX7TJtzyBaGVW0iiqAMa5ibWaH JHIw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nA3mioI8; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-171425-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171425-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 o9-20020a05622a008900b004390ae6192fsi12188724qtw.670.2024.05.07.06.34.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 06:34:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-171425-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=nA3mioI8; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-171425-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171425-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 503E71C22355 for ; Tue, 7 May 2024 13:34:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B5ACB15F3F4; Tue, 7 May 2024 13:20:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="nA3mioI8" 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 CAAD31C68BE; Tue, 7 May 2024 13:20:02 +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=1715088002; cv=none; b=RRi5rgoDB4LgBrjWQ2lhtCf3xXdOLXs6+GjWS6Pv11drViiPUZ8SbiDLRT8/9KdPTiFm118fSO93lR3ew6+Vgv/wDb9Rf67vyv68z/svL6nBC+umtde6VKm4dIBR2lbqFgPQRFsIC2tATxmyRDOkUqNEu2FqxtP3ITDCumWJezI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715088002; c=relaxed/simple; bh=0dEsk9xVdvoDP5+magmILPSKFXyPAEcbBanwvUnwrlY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=f5G8iwGCMIRY1m0qhLCZ2Iny2fO6BjtFn+CQi6ga03irCJfic8rDrXdX2FQCo+vssXslZQBRzhh7VKGjYesnpuhKQd59jJn3QCVvIYLis6NZmF55pp7itEkT7+9vXM4tLB6XtYc9QZTlZzau71FmpqvhC3VOOJO976RyaE+fqR0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nA3mioI8; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62A7BC2BBFC; Tue, 7 May 2024 13:19:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715088002; bh=0dEsk9xVdvoDP5+magmILPSKFXyPAEcbBanwvUnwrlY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=nA3mioI81UV3xgoC8RpC4Mu22zpMCKXYRlU/M0cIBQxJS5NYL2ihjDXIYn5pt0i5z cRFdDyZ28oIdOewfMakPEPhAYRiOP8MF1xPPMMc+FZ1sRWu29gcvhoBahZAyjQxNLN P6KN4YOvqktZPl5Xf/OST/2vejSVcJEyxfSYpsu0B1oM1H67Eg1qmsQDDVE3oGJobm 5ViRnwQXDxq81GQMwb39d/IBoZCuAQcOsJZTa6J9pN39UT+2sNF0njN7Nn9Kniw5// eMB3XuK6tRhI9v5MLYyGAlHin7SfLGuLjq9cTmZMg2FMUoFpBoZwcMxV6X2J8qdkcv 4OyFUh2ogaSNw== From: Benjamin Tissoires Date: Tue, 07 May 2024 15:19:33 +0200 Subject: [PATCH RFC bpf-next 5/8] selftests/bpf: rely on wq_callback_fn_t Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240507-bpf_async-v1-5-b4df966096d8@kernel.org> References: <20240507-bpf_async-v1-0-b4df966096d8@kernel.org> In-Reply-To: <20240507-bpf_async-v1-0-b4df966096d8@kernel.org> To: Alexei Starovoitov , Daniel Borkmann , John Fastabend , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Mykola Lysenko , Shuah Khan Cc: bpf@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Benjamin Tissoires X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1715087980; l=3917; i=bentiss@kernel.org; s=20230215; h=from:subject:message-id; bh=0dEsk9xVdvoDP5+magmILPSKFXyPAEcbBanwvUnwrlY=; b=VNx/k5glZWhQsEmI/jClMdqC4UnM4gt56GY1CihI90O1YgryD8UCunolfxq3F1C4/J6ijV/H/ ZehySth33UECpOr7dY8Uh+dje+SWyor08VqDO+p7JMprnY5wk08PIgt X-Developer-Key: i=bentiss@kernel.org; a=ed25519; pk=7D1DyAVh6ajCkuUTudt/chMuXWIJHlv2qCsRkIizvFw= The type of bpf_wq callbacks changed. So adapt to it and make use of wq_callback_fn_t. Signed-off-by: Benjamin Tissoires --- This is an RFC, and is not meant to be fully reviewed/applied as it is. I'm posting this to show what I wanted to explain in https://lore.kernel.org/bpf/mhkzkf4e23uvljtmwizwcxyuyat2tmfxn33xb4t7waafgmsa66@mcrzpj3b6ssx/ --- tools/testing/selftests/bpf/bpf_experimental.h | 3 +-- tools/testing/selftests/bpf/progs/wq.c | 10 ++++------ tools/testing/selftests/bpf/progs/wq_failures.c | 4 ++-- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/tools/testing/selftests/bpf/bpf_experimental.h b/tools/testing/selftests/bpf/bpf_experimental.h index 8b9cc87be4c4..0a35e6efccae 100644 --- a/tools/testing/selftests/bpf/bpf_experimental.h +++ b/tools/testing/selftests/bpf/bpf_experimental.h @@ -494,8 +494,7 @@ extern void bpf_iter_css_destroy(struct bpf_iter_css *it) __weak __ksym; extern int bpf_wq_init(struct bpf_wq *wq, void *p__map, unsigned int flags) __weak __ksym; extern int bpf_wq_start(struct bpf_wq *wq, unsigned int flags) __weak __ksym; -extern int bpf_wq_set_callback_impl(struct bpf_wq *wq, - int (callback_fn)(void *map, int *key, struct bpf_wq *wq), +extern int bpf_wq_set_callback_impl(struct bpf_wq *wq, wq_callback_fn_t cb, unsigned int flags__k, void *aux__ign) __ksym; #define bpf_wq_set_callback(timer, cb, flags) \ bpf_wq_set_callback_impl(timer, cb, flags, NULL) diff --git a/tools/testing/selftests/bpf/progs/wq.c b/tools/testing/selftests/bpf/progs/wq.c index 49e712acbf60..c8c88976baca 100644 --- a/tools/testing/selftests/bpf/progs/wq.c +++ b/tools/testing/selftests/bpf/progs/wq.c @@ -52,8 +52,7 @@ struct { __u32 ok; __u32 ok_sleepable; -static int test_elem_callback(void *map, int *key, - int (callback_fn)(void *map, int *key, struct bpf_wq *wq)) +static int test_elem_callback(void *map, int *key, wq_callback_fn_t callback_fn) { struct elem init = {}, *val; struct bpf_wq *wq; @@ -83,8 +82,7 @@ static int test_elem_callback(void *map, int *key, return 0; } -static int test_hmap_elem_callback(void *map, int *key, - int (callback_fn)(void *map, int *key, struct bpf_wq *wq)) +static int test_hmap_elem_callback(void *map, int *key, wq_callback_fn_t callback_fn) { struct hmap_elem init = {}, *val; struct bpf_wq *wq; @@ -114,7 +112,7 @@ static int test_hmap_elem_callback(void *map, int *key, } /* callback for non sleepable workqueue */ -static int wq_callback(void *map, int *key, struct bpf_wq *work) +static int wq_callback(struct bpf_map *map, int *key, struct bpf_wq *work) { bpf_kfunc_common_test(); ok |= (1 << *key); @@ -122,7 +120,7 @@ static int wq_callback(void *map, int *key, struct bpf_wq *work) } /* callback for sleepable workqueue */ -static int wq_cb_sleepable(void *map, int *key, struct bpf_wq *work) +static int wq_cb_sleepable(struct bpf_map *map, int *key, struct bpf_wq *work) { bpf_kfunc_call_test_sleepable(); ok_sleepable |= (1 << *key); diff --git a/tools/testing/selftests/bpf/progs/wq_failures.c b/tools/testing/selftests/bpf/progs/wq_failures.c index 4cbdb425f223..3d87ccb8286e 100644 --- a/tools/testing/selftests/bpf/progs/wq_failures.c +++ b/tools/testing/selftests/bpf/progs/wq_failures.c @@ -28,14 +28,14 @@ struct { } lru SEC(".maps"); /* callback for non sleepable workqueue */ -static int wq_callback(void *map, int *key, struct bpf_wq *work) +static int wq_callback(struct bpf_map *map, int *key, struct bpf_wq *work) { bpf_kfunc_common_test(); return 0; } /* callback for sleepable workqueue */ -static int wq_cb_sleepable(void *map, int *key, struct bpf_wq *work) +static int wq_cb_sleepable(struct bpf_map *map, int *key, struct bpf_wq *work) { bpf_kfunc_call_test_sleepable(); return 0; -- 2.44.0