From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-178.mta0.migadu.com (out-178.mta0.migadu.com [91.218.175.178]) (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 F0659201278 for ; Wed, 26 Nov 2025 22:20:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764195632; cv=none; b=Ac2qEAUOaZRtfT0PJtJ0XiJtCDhInIren29QK52jRymuGBSMtcpvZE6FvjM/I4+nEXgch/dGhYnnrn+GENSg88LsXA5TNxkjWziFIJMQ/1mS2h4/ECz8syAs8NNQM84zya589BFtr57WdNWf/8W5awIGpLNiEqw1c02xJxQ0iUM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764195632; c=relaxed/simple; bh=0igFXLYu5hKG2KTGnD2aFnks2+K9FHMeFt/JFeWpnUo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=k7tINo2UKsEKVHBggkBB8OEzVX9pz4cQ13XugivDR8c0qWnjnSX+PIz/2NwcoaWMEqmfSK2M36I/rzszwGQEtsdY9cAykcNzzi842pgyPPxlGowcD8r3pw+XTIsGaYS+mtgUw0TpVO+Rq1rl8VN3YQ4meaR/xiSsSkWpxGAkFtU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=a+eUVchy; arc=none smtp.client-ip=91.218.175.178 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="a+eUVchy" Message-ID: <68ecc660-1e02-4aa6-9bf1-3e56c3a23da4@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1764195617; 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=9g8i2m3HErDYjYqt4Hkjbxi9Nqmf5HurBqBAwcdaCgg=; b=a+eUVchyxqYdPB5fn1a5mAKno7Fe1PFDLaklkXx+6IgUuL9N7YeUoQ2q4bwctTDgb4sC2Q plRF6ODPCElC5vThuPB8k3x+LzsyeKeKaRYuIiXft9Lkla+sDjpuMalK07JyRfyU8Mkyvy bDsu4clsLu5EIfYRixbFvelcRYKh0NA= Date: Wed, 26 Nov 2025 14:20:06 -0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH bpf-next v12 2/7] bpf: Add BPF_F_CPU and BPF_F_ALL_CPUS flags support for percpu_array maps To: Chris Mason , Leon Hwang , bot+bpf-ci@kernel.org, bpf@vger.kernel.org Cc: ast@kernel.org, andrii@kernel.org, daniel@iogearbox.net, jolsa@kernel.org, yonghong.song@linux.dev, song@kernel.org, eddyz87@gmail.com, dxu@dxuuu.xyz, deso@posteo.net, martin.lau@linux.dev, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@fomichev.me, haoluo@google.com, shuah@kernel.org, kerneljasonxing@gmail.com, chen.dylane@linux.dev, willemb@google.com, paul.chaignon@gmail.com, a.s.protopopov@gmail.com, memxor@gmail.com, yatsenko@meta.com, tklauser@distanz.ch, kernel-patches-bot@fb.com, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, martin.lau@kernel.org References: <20251126145039.15715-3-leon.hwang@linux.dev> <07707b44fc9032398db551041498d6265ccf0a0313ecd8779bd1fa82a7d96409@mail.kernel.org> <4d8120f7-f3b6-4654-9b14-0ee7da5f87ac@linux.dev> <26c4677b-aeff-4516-85f4-87b5d1a9f6ee@meta.com> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Ihor Solodrai In-Reply-To: <26c4677b-aeff-4516-85f4-87b5d1a9f6ee@meta.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 11/26/25 7:56 AM, Chris Mason wrote: > > > On 11/26/25 10:24 AM, Leon Hwang wrote: >> >> >> On 2025/11/26 23:11, bot+bpf-ci@kernel.org wrote: >>>> diff --git a/include/linux/bpf.h b/include/linux/bpf.h >>>> index d84af3719..01a99e3a3 100644 >>>> --- a/include/linux/bpf.h >>>> +++ b/include/linux/bpf.h >>> >>> [ ... ] >>> >>>> diff --git a/kernel/bpf/arraymap.c b/kernel/bpf/arraymap.c >>>> index 1eeb31c5b..67e9e811d 100644 >>>> --- a/kernel/bpf/arraymap.c >>>> +++ b/kernel/bpf/arraymap.c >>> >>> [ ... ] >>> >>>> @@ -398,10 +405,11 @@ int bpf_percpu_array_update(struct bpf_map *map, void *key, void *value, >>>> struct bpf_array *array = container_of(map, struct bpf_array, map); >>>> u32 index = *(u32 *)key; >>>> void __percpu *pptr; >>>> - int cpu, off = 0; >>>> + void *ptr, *val; >>>> u32 size; >>>> + int cpu; >>>> >>>> - if (unlikely(map_flags > BPF_EXIST)) >>>> + if (unlikely((map_flags & BPF_F_LOCK) || (u32)map_flags > BPF_F_ALL_CPUS)) >>>> /* unknown flags */ >>>> return -EINVAL; >>>> >>>> @@ -409,7 +417,7 @@ int bpf_percpu_array_update(struct bpf_map *map, void *key, void *value, >>>> /* all elements were pre-allocated, cannot insert a new one */ >>>> return -E2BIG; >>>> >>>> - if (unlikely(map_flags & BPF_NOEXIST)) >>>> + if (unlikely(map_flags == BPF_NOEXIST)) >>> ^^ >>> >> >> ? >> >> No such change in this version. >> >> It seems that this change was inferred from v11 to v12 by AI itself > > Thanks for flagging this, I'll try to find this section of the logs to > see how the false positive checks failed to catch it. > > -chris AI got confused here, this was not in the diff. But it appears it got triggered, because there are these two code fragments nearby [1]: if (unlikely(map_flags & BPF_NOEXIST)) /* all elements already exist */ return -EEXIST; and if (unlikely(map_flags == BPF_NOEXIST)) /* all elements already exist */ return -EEXIST; Which is a good thing to notice even if this is intentional. Anyone knows if it is? https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/tree/kernel/bpf/arraymap.c#n356 >