From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="bZRT78KJ" 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-Google-Smtp-Source: AGHT+IHQ8kUX4NQIuMSORH9SxLZP7aB6AcltBfUpdUB7GHn56kb1zERlaKSnCAHr72huzFQcPKIR1g== 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. =(