Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7989678rdb; Thu, 4 Jan 2024 14:46:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IHb1V0LFNZXT9BiMPLm6KX5N03Pd4XqlCitPQBQfS3Z+EzlnSdSRBQ47ecjAT7GMHsv9lTQ X-Received: by 2002:a05:6358:4411:b0:175:5e2f:41c5 with SMTP id z17-20020a056358441100b001755e2f41c5mr1480857rwc.26.1704408388528; Thu, 04 Jan 2024 14:46:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704408388; cv=none; d=google.com; s=arc-20160816; b=CwsMxndU1rcR+1IFeb2O1Gz0xESKudSxxee0bM06lFbPc1Qo6ifSDlwqshEaMz/yz+ F8bwIFqHfMvwLcxFldik0CGyvd6o01p4tG9plLjLBKrLeVcre1ZHfYb3T++j6HZ4Eq4u XSEazXJ3mvV14+UVMZ0nVQ50i9Mkci8ThDFKRNlqjKJDMFUGUlUM8U8SNG1DPKSHjcUr QWE27rad0bv8ydQeStaEbcIDXcJbfkHtI12uVUBpFwd2XojOLUYr50jyO/f/kt/unSOE clPMNrpp5W3I4BMHPMS52UBwUhOVYW547uzsL+Muj2NVG+5stY9WTPuYhAputWxv1LJX +bmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=06lPjTfo3YdRLLJ7lhbrUqAnozPaB9BqiqaizfWnuOM=; fh=kWZtVRr3OqUr9cTIRnamcvwoPDzGPV8zB4X9oxIpA3M=; b=qojg42h3/vLYYgAFveZgnkA9Owj/O1Ouf9geguy1ikURl0Q3HMq2K6fEiFiwOjPUjh OV/XxJsG0DUmZq1BodNgegb9V0pM5idL8Rwo5YjNUvAjF+1m88iUsjRfLJdNeEoFCUGw Zu5XVRDvqH5PgNzEXVdRhkWyXEU6voMFplOATqOP2kGXOp8Syy+WsR9+VMXDHHBeEdOF IGRJX9XlRuF/sJDwea2KXlNhUqLSTNJw/kHxzGslNBpvzpufBS8vYZmBaj2VUOt85lLe OLejiNZlEko6LAGgUg5MTuwtErKzsRnvVFg/0zFKiuZ80iQU152anTHnKH3gT3943x8Y eUDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=IQgzbLnF; spf=pass (google.com: domain of linux-kernel+bounces-17304-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17304-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 9-20020a631149000000b005c201eb7e85si281128pgr.541.2024.01.04.14.46.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 14:46:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-17304-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=IQgzbLnF; spf=pass (google.com: domain of linux-kernel+bounces-17304-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17304-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 2CFF728592C for ; Thu, 4 Jan 2024 22:46:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7C9E92D04A; Thu, 4 Jan 2024 22:46:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IQgzbLnF" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) (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 47E2B2CCB2; Thu, 4 Jan 2024 22:46:10 +0000 (UTC) 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 Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-556aa7fe765so1146783a12.2; Thu, 04 Jan 2024 14:46:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704408368; x=1705013168; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=06lPjTfo3YdRLLJ7lhbrUqAnozPaB9BqiqaizfWnuOM=; b=IQgzbLnFGdO+4MBt6ztnHKGXNezZFRB7ucHqKPakO5MjdHU1sp8etNPSdXRyhWKmol 9rNyhc4udwC4VDtxzdsbqN+emtTzhdEz46t7UTd3CaVTbF/gpavy6UxlYaCUU1p29EWZ ZfxgH2AqaEGTgPAPCaBWb5gFIugUaa6BxWk6F5NAXAabFaOmLIvyf9yHD9AqQsDPYgsH XXliaECHgt3YFKuXGIcF76mI+sbdWoEmsMAsflyaBYP/8zUd+apoGHSn3lXF+/Sry65Q gWuNgmoxyZ1ZuZvUYmeDI7447L9ViAIQhkhqkbprJmCAmdid1yhVBSFJ5JxFvScIWuHV S3Wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704408368; x=1705013168; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=06lPjTfo3YdRLLJ7lhbrUqAnozPaB9BqiqaizfWnuOM=; b=M8eBBILl9+idCXYwSVsDUgf7OIm+wj7bj29mMG5YRyMTHJwvHOvD+V0lj/yYjHMJ6x J6r0hCDuWneSKlcHki0XYbQ/HZO9HY4Y0IxMpNRD+UNlrvVfPFWPkXmsHeGohxVpRYpe mFalkA84ZHbNXWmE2W6KVUcbMGqXl5heBF7GywU/8AMDd0GksHh8lTlrH15mu24guNeS sf6p+QnoUqUHIAdeamVFeXeTz7hyChoUsdKd1wqkzK3vrIgCWp9cu2dZYTBH1NAJe++H 0wN7qgDrbFhnaq5ez/kUA//cYY3OyAR10EOA5wjUKTLHnYv6uz/o+xZQQtEhFqZ/lJ3p nPTg== X-Gm-Message-State: AOJu0YwOBhhECEfUg9xA3QS08J3O8wSzIM5lLBM2s2VjkddqUROHARIT 7NSQRdWo7BAsgVy+kUbTuaGw54X4Sg+k65bwuOs= X-Received: by 2002:a17:906:c55:b0:a28:77b:bb36 with SMTP id t21-20020a1709060c5500b00a28077bbb36mr625274ejf.134.1704408368287; Thu, 04 Jan 2024 14:46:08 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240103153307.553838-1-brho@google.com> <20240103153307.553838-3-brho@google.com> <0d9f51e9-7e07-48dd-bf18-ea28ab6b1e83@google.com> In-Reply-To: <0d9f51e9-7e07-48dd-bf18-ea28ab6b1e83@google.com> From: Andrii Nakryiko Date: Thu, 4 Jan 2024 14:45:56 -0800 Message-ID: Subject: Re: [PATCH bpf-next 2/2] selftests/bpf: add inline assembly helpers to access array elements To: Barret Rhoden Cc: Andrii Nakryiko , Alexei Starovoitov , Daniel Borkmann , Song Liu , Yonghong Song , mattbobrowski@google.com, bpf@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Jan 4, 2024 at 1:37=E2=80=AFPM Barret Rhoden wrot= e: > > On 1/3/24 14:51, Andrii Nakryiko wrote: > >> + > >> +/* > >> + * Helper to load and run a program. > >> + * Call must define skel, map_elems, and bss_elems. > >> + * Destroy the skel when you're done. > >> + */ > >> +#define load_and_run(PROG) ({ > > does this have to be a macro? Can you write it as a function? > > can do. (if we keep these patches). > > i used a macro for the ## PROG below, but i can do something with ints > and switches to turn on the autoload for a single prog. or just > copy-paste the boilerplate. why can't you pass the `struct bpf_program *prog` parameter? > > >> + int err; = \ > >> + skel =3D array_elem_test__open(); = \ > >> + if (!ASSERT_OK_PTR(skel, "array_elem_test open")) = \ > >> + return; = \ > >> + bpf_program__set_autoload(skel->progs.x_ ## PROG, true); = \ > > thanks, > > barret > >