Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7962576rdb; Thu, 4 Jan 2024 13:32:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IEIqoXBTH6SfTNyy8yxWt9nwNl3PdqIBBBZ92jhwT3IU1pnIpLHiEn35XbZefZkZq0cCqkR X-Received: by 2002:ac2:5dee:0:b0:50e:3c1e:95ed with SMTP id z14-20020ac25dee000000b0050e3c1e95edmr590993lfq.52.1704403974915; Thu, 04 Jan 2024 13:32:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704403974; cv=none; d=google.com; s=arc-20160816; b=tO3oqE33S8XCIbWetntN5HzzkETVx/m73T/BaoYzJvoVPWJGRlvw4WKg5dZh7LjNiO PjRiaO4G3NtthfRmQzqhIaV2z7UROQoBFPjcgc0qQXIxkqB7Q15CSdrV8LNnSC2Tr3a1 FlqPJfsl2evcmVJyGPOnS1aNMJYPDs0UMivwx5++oHgMWW02TgbJtlbfmvwRRMaoGhAR XJlb73bekHSVAB/Z1vJ2Bj9QeNv8sF1DKjdRh6YeKSB4sFawhkjuN/QkpRbgTUinp+rk p0ruicQcdmAyX2gcBX1QXCe+v6x6ZKvuFTgHA+td0nVc6bzdLfvgnx3z4jUe7dwNOS9h sdxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=DpIPI5Ed7cmWRlguExtM65PCJHH1IGt9s+3fOm8lXEg=; fh=A0qHSgc+LFI6ONAV7b4P7e9BuXPZptsQo0GTmFK+5gc=; b=ZlzCyAO9s5NncipNlULjiLiXqoBBnDlASig9HZ5ZkOdg+XCS0tVGY2QGAB0iRQc0wy ZTE5QOLUpXQhgW021cwGDPnpmPgcGYz6vEcyvZGBVHxkyMFWJEiND2ezRLiZ9tBKWOBv sWWRwduuiI2Waa0Ycd7w304LRcgNAxRwTpoFuzz3eGnnUpOjwuPHG/t0sWrNBT+rDfQk 7/0rPtLKE2PvL8mClKpVQl9vZ2MpvKfJZX2G3S1xM1Ty0zF/A7z00udzWdK/je9IOd3E hk0bmE2GrmUVGDlxfXXJABDxdDogpBbFq7V37vRdykA+/XUZUSBr4j755GhtMVMXCZR9 UFqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=bZRT78KJ; spf=pass (google.com: domain of linux-kernel+bounces-17247-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17247-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id z20-20020a05640240d400b0054c4f06e4a0si107138edb.402.2024.01.04.13.32.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 13:32:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-17247-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=@google.com header.s=20230601 header.b=bZRT78KJ; spf=pass (google.com: domain of linux-kernel+bounces-17247-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17247-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.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 am.mirrors.kernel.org (Postfix) with ESMTPS id A3EED1F25621 for ; Thu, 4 Jan 2024 21:32:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CEB282C6BA; Thu, 4 Jan 2024 21:32:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="bZRT78KJ" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-qv1-f54.google.com (mail-qv1-f54.google.com [209.85.219.54]) (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 B75252C6B4 for ; Thu, 4 Jan 2024 21:32:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-qv1-f54.google.com with SMTP id 6a1803df08f44-67f7da00237so4011656d6.2 for ; Thu, 04 Jan 2024 13:32:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1704403960; x=1705008760; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=DpIPI5Ed7cmWRlguExtM65PCJHH1IGt9s+3fOm8lXEg=; b=bZRT78KJmeVJ58+RVIE5bTTWT1ih5vDwWGJ37K+k6DNt/XzYGn/n9sejqnp5D2AJ/S hLNJRmJqEKm1ohPylp1A7ibN2PL5Befb9lcPas6Kr+e64huFSGGqi166yPhVUsUl49js 5cQyZA4id3muw54tbzLQygADKOw4mOoBwjUFt3vpbChah86UtwHc77fEKUP58YS0BwXY OsTOEIfnuyTmrguLYjaQa1s6+lJZK0H8BoxYFZiZZEvF3j6by5AxbUPw0J/8H5rmWkzj YAdBkgfsphEcN33JAPwWRVDRz+TziT1/2vCzefuLKLw+UPrmFg3h2Gnbt/bjyh5/YHnZ hU1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704403960; x=1705008760; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=DpIPI5Ed7cmWRlguExtM65PCJHH1IGt9s+3fOm8lXEg=; b=QKmdRa9XrfRZRZ2UkqEd3nj7hmTJE3HyPUSAyaCfItW/yvjB/s4dOjIMcZXQTCEZqh LGVVdVLOxMGI4LZnkjeDSl/0Aj/fIWEfDYDD5S/3RUNLeTvX2YJfeMhBT36ju4bI93CR HB1uh8KCCahNNtfYNBayIYHOdHVEMl7ejzz0ZKTOZtXmD2gyGkGxHbZcUplxMhNXkyq7 bpBqG8BM0lMQqJO8sC00rdDAJKzdLz9eQFZ5qBpdSKbz4pcXhc3hkNRDxKexAlt6l5pM NOxb0tuTXG9nyyOACXAytrGAPGvf21yedt5mMAhQPivi2N1gg0CQTuWMoQ/OfgdNN8sF 51Lg== X-Gm-Message-State: AOJu0Yxx/W7HDfIwyyjtskDJZ4krMMJ1GMNI4UiTLdOCPi3e/4TeY1GF M/cvT4qrVVxhRBNIUulAejSho2vU4dWQ X-Received: by 2002:a05:6214:2266:b0:67f:2350:6d35 with SMTP id gs6-20020a056214226600b0067f23506d35mr1509512qvb.39.1704403960559; Thu, 04 Jan 2024 13:32:40 -0800 (PST) Received: from [192.168.1.31] (d-65-175-157-166.nh.cpe.atlanticbb.net. [65.175.157.166]) by smtp.gmail.com with ESMTPSA id a2-20020a0562140c2200b0067f24bd0afasm98136qvd.101.2024.01.04.13.32.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 04 Jan 2024 13:32:40 -0800 (PST) Message-ID: Date: Thu, 4 Jan 2024 16:32:39 -0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH bpf-next 2/2] selftests/bpf: add inline assembly helpers to access array elements Content-Language: en-US To: Andrii Nakryiko Cc: Andrii Nakryiko , Alexei Starovoitov , Daniel Borkmann , Song Liu , Yonghong Song , mattbobrowski@google.com, bpf@vger.kernel.org, linux-kernel@vger.kernel.org References: <20240103153307.553838-1-brho@google.com> <20240103153307.553838-3-brho@google.com> From: Barret Rhoden In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 1/3/24 16:21, Andrii Nakryiko wrote: > On Wed, Jan 3, 2024 at 12:06 PM Barret Rhoden wrote: >> On 1/3/24 14:51, Andrii Nakryiko wrote: >>> I'm curious how bpf_cmp_likely/bpf_cmp_unlikely (just applied to >>> bpf-next) compares to this? >> these work great! >> >> e.g. >> >> if (bpf_cmp_likely(idx, <, NR_MAP_ELEMS)) >> map_elems[idx] = i; >> >> works fine. since that's essentially the code that bpf_array_elem() was >> trying to replace, i'd rather just use the new bpf_cmp helpers than have >> the special array_elem helpers. > ok, cool, thanks for checking! The less special macros, the better. sorry - turns out it only worked in testing. in my actual program, i still run into issues. the comparison is done, which is what bpf_cmp enforces. but the compiler is discarding the comparison. i have more info in the other thread, but figured i'd mention it here too. =(