From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-182.mta1.migadu.com (out-182.mta1.migadu.com [95.215.58.182]) (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 E0C521A713 for ; Sat, 13 Jan 2024 01:24:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="q6W2D3gh" Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1705109063; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4bL4S/jroxJgoBeuPGxDevD38iVLhJSNNIyAPOZuboU=; b=q6W2D3ghwcXELWP75MDz7TKwhsJ0pRn2KC7h6uKAg23K3L4pPXq97mayvb1oh3usRPIfjR Ci00GVfjrJ4EgoFoKE/MCenD+hSpfhx+0FpUNCOgq+6mSJWFTTX6stWzeKX2Ru11uXF+mh EP5z/fMhwIWpojSeQEfqfdqxv5+/EDM= Date: Fri, 12 Jan 2024 17:24:18 -0800 Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH bpf-next] bpf: Minor improvements for bpf_cmp. Content-Language: en-GB To: Alexei Starovoitov , bpf@vger.kernel.org Cc: daniel@iogearbox.net, andrii@kernel.org, martin.lau@kernel.org, kernel-team@fb.com References: <20240112220134.71209-1-alexei.starovoitov@gmail.com> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Yonghong Song In-Reply-To: <20240112220134.71209-1-alexei.starovoitov@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 1/12/24 2:01 PM, Alexei Starovoitov wrote: > From: Alexei Starovoitov > > Few minor improvements for bpf_cmp() macro: > . reduce number of args in __bpf_cmp() > . rename NOFLIP to UNLIKELY > . add a comment about 64-bit truncation in "i" constraint > . use "ri" constraint for sizeof(rhs) <= 4 > . improve error message for bpf_cmp_likely() > > Before: > progs/iters_task_vma.c:31:7: error: variable 'ret' is uninitialized when used here [-Werror,-Wuninitialized] > 31 | if (bpf_cmp_likely(seen, <==, 1000)) > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > ../bpf/bpf_experimental.h:325:3: note: expanded from macro 'bpf_cmp_likely' > 325 | ret; > | ^~~ > progs/iters_task_vma.c:31:7: note: variable 'ret' is declared here > ../bpf/bpf_experimental.h:310:3: note: expanded from macro 'bpf_cmp_likely' > 310 | bool ret; > | ^ > > After: > progs/iters_task_vma.c:31:7: error: invalid operand for instruction > 31 | if (bpf_cmp_likely(seen, <==, 1000)) > | ^ > ../bpf/bpf_experimental.h:324:17: note: expanded from macro 'bpf_cmp_likely' > 324 | asm volatile("r0 " #OP " invalid compare"); > | ^ > :1:5: note: instantiated into assembly here > 1 | r0 <== invalid compare > | ^ > > Signed-off-by: Alexei Starovoitov Acked-by: Yonghong Song