🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #8534

Re: [PATCH net v2] net: qrtr: announce local services again once our HELLO is sent

#8534
From: Joonhoe Kim
Date: Thu, 29 Oct 2026 10:51
51 lines
13365 bytes
On Mon, Oct 26, 2026 at 08:11:56PM +0530, Manivannan Sadhasivam wrote:
> > +	if (cb->type == QRTR_TYPE_HELLO) {
> > +		/* Pairs with smp_load_acquire() in qrtr_hello_work() */
> > +		smp_store_release(&node->hello_rcvd, true);
>
> smp_store_{release/acquire}() accessors are only needed if there is an ordering
> requirement. But I don't see that exist with this 'hello_rcvd' bool flag.
> Wouldn't {READ/WRITE}_ONCE() suffice?

The flag is ordered against node->nid. qrtr_endpoint_post() assigns the
node id with qrtr_node_assign() before it sets hello_rcvd, and the
replay reads node->nid after it sees the flag. For an endpoint
registered with QRTR_EP_NID_AUTO, the id is only assigned when the first
packet from the remote arrives. With READ_ONCE()/WRITE_ONCE() the replay
could see the flag and still read QRTR_EP_NID_AUTO, which has the same
value as QRTR_NODE_BCAST, and the name service would then send its
announcements to every node.

The flag cannot be set under ep_lock instead, as qrtr_endpoint_post()
can be called in atomic context.

> > +		to.sq_node = READ_ONCE(node->nid);
>
> There is no READ_ONCE() in the earlier read. So please justify why you added it.

node->nid is read again here because the earlier read can come before
the remote's first packet and still be QRTR_EP_NID_AUTO. That is fine
for our HELLO, as qrtr_node_enqueue() takes the destination of a control
packet from node->nid itself, but the replay needs the assigned id.

The READ_ONCE() is there because qrtr_node_assign() writes node->nid
with WRITE_ONCE() and the other lockless readers, qrtr_node_enqueue()
and qrtr_bcast_enqueue(), use READ_ONCE(). After the acquire the id no
longer changes, so a plain read would also be correct. I kept it in v3
to match the other readers, but I can drop it if you prefer.

> > +		qrtr_local_enqueue(NULL, skb, QRTR_TYPE_HELLO, &to, &from);
>
> What happens to the return value?

It was ignored, and a failed replay was lost for good, as the Sashiko
review of v2 also points out. In v3 the replay is retried 100 ms later
if the allocation or qrtr_local_enqueue() fails, without sending our
HELLO again, and it is queued under ep_lock only while the endpoint is
still registered:

https://lore.kernel.org/all/20261029105142.2503-1-26rote@gmail.com/

Thanks,
Joonhoe Kim
Technical Details
Message-ID: <20261029105157.2553-1-26rote@gmail.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-353255-linux-kernel-netdev=dewy.ru
References: <20261022163116.1042-1-26rote@gmail.com> <at9mFUv1flg-6aMB@debian>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-353255-linux-kernel-netdev=dewy.ru
From: 26rote@gmail.com (Joonhoe Kim)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v2] net: qrtr: announce local services again once our HELLO is sent
Date: Thu, 29 Oct 2026 19:51:57 +0900
Organization: Usenet Network
Message-ID: <20261029105157.2553-1-26rote@gmail.com>
References: <20261022163116.1042-1-26rote@gmail.com> <at9mFUv1flg-6aMB@debian>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1989541"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:BCt6WzvUw+txj8mlypHuKSDNwsk= sha256:j5wAfLgDnAwP6n49BPynaCCK6Zsq0q+hnJEF5Qf8uz4=
	sha1:TVtJo+Z7+tFrM/i55lsftG/XFwo= sha256:nObdE5e7B+3MTeAkAi4yVEKCKu79PNhK37tpB83/EjE=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id B313C12580F; Thu, 29 Oct 2026 13:54:06 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.048
X-Spam-Status: No, score=-3.048 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
	FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id y9NDlsXAgflv;
	Thu, 29 Oct 2026 13:54:04 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-353255-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id B19A9125C63; Thu, 29 Oct 2026 13:53:54 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id ABE4B25826; Thu, 29 Oct 2026 10:52:05 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1793271125;
	b=PpeKgiCsG2DM3ZZFEtWpe/2ieT0cHxrHIfEO9AGv8BXrOFvsWzXmZ8vkOhzqpSHoLqd9
	 luN1J7KfjHBmFkRgkeHp/1D4SLf9ZDY03Kld3rQ3Haan3MVkbGSmpt1SAWFByF0d3dZkv
	 bt8EJDE+0tjbW6jibaTJpl46ZXFR44v7RGukJdSo5SGsF7l4Mu/mJuQeUoDaJY8HDuRZr
	 3d7MBdwwL4sWqvqxgbiOkFpYc1jPFtx9QAq+wB73eAuu9aWemcdfuXFyLLdPGd3D8jJ56
	 2XqAogulWpcoagyMS+o3iytVmdkSUZBqUGjbwTyu1o7KzIjhYulYLOvn1fBrz5fVO/w==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793271125;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
	 X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:Date:Message-ID:
	 X-Mailer:In-Reply-To:References:X-Mailing-List:List-Id:List-Post:
	 List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence:
	 MIME-Version:Content-Transfer-Encoding;
	bh=iymo6yWih1u6JSkjazwtYJq1W+j31tigL1sbJo3i2bo=;
	b=mKmKkmO1F3xl1rZL9fXuow5UVAlpmkUVqZDSD2EKdurecTjU39qxe0wCaUJvLj4t6b9i
	 xojdqxS5WuO37RIi4Wuv4vYrv3F0WSS2t4EIdo45G+fGNqZBgeBf4ZtZPpv6JW0I4mxRv
	 fFfRNSO/udDd0nypGnWHXveY7litScGGEVRKMWIMxLX2yhyWoyvajgycJkYIt+jgtbyFz
	 xpqN0YjOmo4Yjy+gIPstDVRRlbEob87luAOKcqow0FC8tdVckM1djyLwxNNvgRjcCRp4z
	 m4NitK2+oKxmgHEWFyImaWJeXV4Qlm8QzDA+LZ6UQHzSxh5kWJjgH5F0qZARqz4ju7Q==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=TSZB30aS;
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 2DEF1606A31C;
	Thu, 29 Oct 2026 10:52:05 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=TSZB30aS
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.43
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793271124;
	b=Dv+J8LY+0Dd5Sc1sYyLQ6DCZGF0L8nBG+prPTe8hwz6eDCsvNoCob6i0LQzEy1+hPSwa
	 pfUhArqmIPqeDp+IetwlNFt9lJ6XhhfKPn6D7bcdZaOkaLIYsy4DJVrtfpekd0fVa5cqd
	 01udmuuyxTMF1x3UGCcH+sxs2vgJ+/XNyMoh7p+3Pbq+rKKMK29KSHhzqzjnWLoxG5xTL
	 yPWaojVHPtVmMMb9Tvo++kYU77bi9Hs0a7BY63gL/Zkw3Zt1/+jH2BGMQ3RfH5v1as8qz
	 YybLKL13zj5EwbnEqZnmBEXOXHzvHkkMRFSm9sD/Xt5UPaQpjinrJl+5jijEIqZXkCA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793271124;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
	 From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References:
	 MIME-Version:Content-Transfer-Encoding;
	bh=iymo6yWih1u6JSkjazwtYJq1W+j31tigL1sbJo3i2bo=;
	b=DpyEuJMlP2UftR0mJgXe8hmQOB2BuH3G8CDcb4YIy/wcaaNFBD0/1dYI+sE/7Wtg4jEi
	 krpVqJWGYAp8S4Dmpa4fJCMBR+feCJzxnxyhg9UEmOIHX4D4fgEiarP3I0shZQ3k8JOh6
	 UFW1zbP9doT5zGilHlRtMmLqxrUz4KgVh9mRR2KaOPRQkeh4f6squcjHShrkMvNMUi+gM
	 K0hWqeDs3XX7M4F6PO/PBGyKGIOzgqy/V1SdW06PwLZdRyS3bPqChwgk3dbW21t3zfuh0
	 uZE+kw2F6JFTudInxrtzIxUfYzjXnyvz+Qo8qRzrMHSkoDmB7wpnwPTPq/cds2P+hgw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=TSZB30aS;
	arc=none smtp.remote-ip=74.125.82.43
X-Received: from mail-dl1-f43.google.com (mail-dl1-f43.google.com [74.125.82.43])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id F1115606A320
	for <netdev@vger.kernel.org>; Thu, 29 Oct 2026 10:52:03 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org F1115606A320
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-dl1-f43.google.com with SMTP id a92af1059eb24-15ea896ddc8so2916245c88.0
        for <netdev@vger.kernel.org>; Thu, 29 Oct 2026 03:52:03 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1793271123; x=1793875923; darn=vger.kernel.org;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=iymo6yWih1u6JSkjazwtYJq1W+j31tigL1sbJo3i2bo=;
        b=TSZB30aSZew/Y5iJpxyPAdCHSaUlGuRX0vGPWMGscUtyNdl4Gfru7VebT+uqAfmp6z
         QuRNmBliNwyit8/AV+JZGMrzS05uBUZyaJBYwcrM6V4CAEnFVG1H07Yh8XF6guXXqq/R
         0K6G6cvVOv6UxRt55KGii+YttWs6XbRYn3Y8tJ0JSK/FGkHwvCu2ElRB76I+w9muGUO+
         ehdbGY7CFuQhqr3Ct5KWUxe2bQqDJtvarrPkhglzBJlDKwFze5DOofXjDSx9NBRX5hSL
         ja5G7My3fhuw5URGr6Ba/QVGC9gd8w3GL/SZKX1gX5+fgnfevpEj7+FyT+7DRLu+RlLX
         hbjA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1793271123; x=1793875923;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
         :to:cc:subject:date:message-id:reply-to:content-type;
        bh=iymo6yWih1u6JSkjazwtYJq1W+j31tigL1sbJo3i2bo=;
        b=a+oo1FZwzuzZr4zHcm+yH3Sao7KUZdNVvd1Cqh9PdzlEG8WO5HxcFdGZImRwqNRwtI
         fY4g9xxin+4IJ5VzPxvT3JLvm/MYBVSaKBdeyvSRKhCf33auF+H642hGASY0HY2gCjCk
         ryNZU8VbbtKLCXw3KZYYAgjp4MYY8cpns96kpp92MtNSc1xvAxo8z2H2eJlOU8fGJKow
         BuEEUliM95+HsXSym1SpXL1+vaPbRYpoqD0EhBIrBUh5m1TB5YI384dmq9u9dKosvfwK
         NsamXxrMVfhubTx13aLIrQlG98q9wv2fQwujecm0PexWIf/uVCIpQRl60PkLNMuH1A+P
         ++cw==
X-Forwarded-Encrypted: i=1; AKwUvBzsvCH9hwVztJV99NKn8tl88dJuK5VCzOWcdBqTqvxiks/wjbpSdCFZbxEEFztzsRgg7oqEVmI=@vger.kernel.org
X-Gm-Message-State: AFq9FYJgPwongBHcrb+Ea0pM/fI+C4LoQvpq4SJX8zKVtbi8POgGLI3a
	Q95lk4WfT6nMnRvUcEO3m40g5iSIhDfAx+7i1ZlhhMukXNVPz9M03jKz
X-Gm-Gg: AYBFou10CJs4/g6i1D1i42al1CsvAMipDN8v9+uIItE6BgG3muhkKqjQ/dmw8iPutcF
	F/yFXE4EhAgXDQT0ZBh/19oGbK1tqATE7yeE0CebJHa/aiXoB/hAt4ynPAY2cKPm1ohmDHi4xkg
	6EeLubMullOcnpADRRJejG2zZVfYO+5YOSUacPwF43H9lsIM9ZhM5UiGYPMaHlCDEUtyooUfVEt
	rga+H/Il5EhK0Tw2GTobpwP4yOqo6lasZJi5Rjm2wwIwcebrk12nJLfoRY5vC1p843OaOX2I2mr
	ms7KESV9mhPfqF0uKu48enqXtWdK/OaHAAh96xChRz6OSJ+8XjyH8e36K2fNOaf4DZvEKF3aYXq
	zD+p53D6z8Jt+Eps/6OWRV0o4823Inmn44sN5O9R0jjNXXHoYjLvHEmhY6xr7+0W8i6/c+tGoef
	KCsI34juCjxjf87WbuJPn+rq83TkL1k0jzT0wkSFmFaSQJd5Jye6ZTYGuZ3FXKcIuPGD4wn1Qje
	MvjZc615enmRpSupSoBiyGnYBmRkUkAILMlGTUs3t3n/G8D7RopIB45zi+g5QE/SK3OBsRO23Go
	TMx1hLGVma8gItri67Mgl4C7aDYeXLoJrUs+7Xxj6cj8
X-Received: by 2002:a05:7023:c081:b0:14f:8e70:fad0 with SMTP id a92af1059eb24-1a6cfb045camr6418261c88.33.1793271122885;
        Thu, 29 Oct 2026 03:52:02 -0700 (PDT)
X-Received: from DESKTOP-NM9EKIA ([125.134.240.130])
        by smtp.gmail.com with ESMTPSA id a92af1059eb24-1a75c9fd2b4sm14692245c88.6.2026.10.29.03.51.58
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Thu, 29 Oct 2026 03:52:01 -0700 (PDT)
X-Cc: davem@davemloft.net,
	edumazet@kernel.org,
	kuba@kernel.org,
	pabeni@redhat.com,
	horms@kernel.org,
	christopher.lew@oss.qualcomm.com,
	deepak.singh@oss.qualcomm.com,
	pranav.phansalkar@oss.qualcomm.com,
	andersson@kernel.org,
	effeffe99@gmail.com,
	linux-arm-msm@vger.kernel.org,
	netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	regressions@lists.linux.dev,
	stable@vger.kernel.org
X-Mailer: git-send-email 2.55.0.windows.5
X-In-Reply-To: <at9mFUv1flg-6aMB@debian>
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list