From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="YVRI/OVg" Received: from out-185.mta1.migadu.com (out-185.mta1.migadu.com [95.215.58.185]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 015AFF9 for ; Fri, 8 Dec 2023 10:00:21 -0800 (PST) Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1702058420; 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=mgjY9jJN9jmuhTIpwU+oAxTTmRdACbqy9UaZxPdYkDM=; b=YVRI/OVg5gewIj1NZMqXw2o1V5aKHRe4LAxsqgQ9t39qAagcIerOxBHiRtfeZ3vwY0xajd 8tdfgp8ziKFMJh8GGK7eF+3MwkpOQEZBQR0afhEzpm/SaXqnLZA8gYWvwZB3lJ51BwMIA7 u82xg9Jw8E4noiilAM7/RqYi9wDMjwM= Date: Fri, 8 Dec 2023 10:00:14 -0800 Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH RESEND bpf-next 1/2] bpf: Reduce the scope of rcu_read_lock when updating fd map Content-Language: en-GB To: Hou Tao , bpf@vger.kernel.org Cc: Martin KaFai Lau , Alexei Starovoitov , Andrii Nakryiko , Song Liu , Hao Luo , Daniel Borkmann , KP Singh , Stanislav Fomichev , Jiri Olsa , John Fastabend , houtao1@huawei.com References: <20231208103357.2637299-1-houtao@huaweicloud.com> <20231208103357.2637299-2-houtao@huaweicloud.com> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Yonghong Song In-Reply-To: <20231208103357.2637299-2-houtao@huaweicloud.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 12/8/23 2:33 AM, Hou Tao wrote: > From: Hou Tao > > There is no rcu-read-lock requirement for ops->map_fd_get_ptr() or > ops->map_fd_put_ptr(), so doesn't use rcu-read-lock for these two > callbacks. > > For bpf_fd_array_map_update_elem(), accessing array->ptrs doesn't need > rcu-read-lock because array->ptrs will not be freed until the map-in-map > is released. For bpf_fd_htab_map_update_elem(), htab_map_update_elem() > requires rcu-read-lock to be held, so only use rcu_read_lock() during > the invocation of htab_map_update_elem(). > > Signed-off-by: Hou Tao Acked-by: Yonghong Song