From: "Juha-Matti Tilli" <juha-matti.tilli@iki.fi>
To: "Manivannan Sadhasivam" <mani@kernel.org>
Cc: linux-arm-msm@vger.kernel.org,
"Jeff Hugo" <jeff.hugo@oss.qualcomm.com>,
"Jeff Johnson" <jjohnson@kernel.org>,
"Bjorn Andersson" <andersson@kernel.org>,
"Konrad Dybcio" <konradybcio@kernel.org>,
"Eric Dumazet" <edumazet@google.com>,
"Kuniyuki Iwashima" <kuniyu@google.com>,
"Paolo Abeni" <pabeni@redhat.com>,
"Willem de Bruijn" <willemb@google.com>,
"David S . Miller" <davem@davemloft.net>,
"Jakub Kicinski" <kuba@kernel.org>,
"Simon Horman" <horms@kernel.org>,
"Mihai Moldovan" <ionic@ionic.de>,
"Denis Kenzior" <denkenz@gmail.com>,
"Marcel Holtmann" <marcel@holtmann.org>,
"Andy Gross" <agross@kernel.org>,
linux-kernel@vger.kernel.org, mhi@lists.linux.dev,
linux-wireless@vger.kernel.org, ath11k@lists.infradead.org,
ath12k@lists.infradead.org, netdev@vger.kernel.org
Subject: Re: [PATCH v7 03/15] net: qrtr: fit node ID + port number combination into unsigned long
Date: Wed, 16 Sep 2026 12:16:37 +0300 [thread overview]
Message-ID: <9ffaeae1-3768-408b-8434-9f1704412fbe@app.fastmail.com> (raw)
In-Reply-To: <bjfwy4usrfbrabmcp4xsr65nqwdpuryvmrb6tzp6k2ckmdx27h@kvf7idvsugsm>
On Wed, Sep 16, 2026, at 10:01, Manivannan Sadhasivam wrote:
> On Tue, Sep 15, 2026 at 08:41:55AM +0300, Juha-Matti Tilli wrote:
> > From: Mihai Moldovan <ionic@ionic.de>
> >
> > The flow control implementation uses a radix tree to store node ID and
> > port number combinations and the key length is hardcoded to unsigned
> > long.
> >
> > The original implementation shifted the node ID up by 32 bits and added
> > the port number to the lower 32 bits of the unsigned long value to
> > create a key.
> >
> > Unfortunately, since both node IDs and port numbers are defined as u32,
> > this will overflow on platforms where sizeof(unsigned long) < 8 (which
> > are most 32 bit platforms) and essentially just drop the node ID part.
> >
> > To fix this, build the key in a generic way, using half of the unsigned
> > long space for the node ID and the other half for the port number.
> >
> > This will be transparent to platforms where sizeof(unsigned long) >= 8
> > and fix overflow issues otherwise.
> >
> > The caveat, of course, is that, for platforms where
> > sizeof(unsigned long) < 8, the supported amount of node IDs and port
> > numbers will be severely limited - to half of sizeof(unsigned long),
> > which typically will be 16 bits. Needless to say, we have to check if
> > both values fit into this limit.
> >
> > This limitation is probably not going to be an issue in real-world
> > scenarios, but if it turns out to be one after all, we could switch from
> > a radix tree implementation to an XArray implementation.
> >
>
> Documentation/core-api/xarray.rst says:
>
> "If your index can be larger than ``ULONG_MAX`` then the XArray is not the data
> type for you."
>
> So the fix is to not make XArray work, but switch over to some other storage
> mechanism instead of XArray, like hashtable.
I think I will drop this along with patch 04/15 from the next series,
as it fixes one bug but introduces another, and those bugs should
probably be irrelevant for this patch series.
Indeed, that commit message by Mihai wasn't entirely correct: XArray
will not work here.
BR, Juha-Matti
next prev parent reply other threads:[~2026-09-16 9:17 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-15 5:41 [PATCH v7 00/15] QRTR Multi-endpoint support Juha-Matti Tilli
2026-09-15 5:41 ` [PATCH v7 01/15] net: qrtr: ns: validate msglen before ctrl_pkt use Juha-Matti Tilli
2026-09-16 6:45 ` Manivannan Sadhasivam
2026-09-15 5:41 ` [PATCH v7 02/15] net: qrtr: allocate and track endpoint ids Juha-Matti Tilli
2026-09-16 6:49 ` Manivannan Sadhasivam
2026-09-15 5:41 ` [PATCH v7 03/15] net: qrtr: fit node ID + port number combination into unsigned long Juha-Matti Tilli
2026-09-16 7:01 ` Manivannan Sadhasivam
2026-09-16 9:16 ` Juha-Matti Tilli [this message]
2026-09-15 5:41 ` [PATCH v7 04/15] net: qrtr: use only low 16 bits of node/port in 32-bit systems Juha-Matti Tilli
2026-09-15 5:41 ` [PATCH v7 05/15] net: qrtr: support identical node ids Juha-Matti Tilli
2026-09-15 5:41 ` [PATCH v7 06/15] net: qrtr: Report sender endpoint in aux data Juha-Matti Tilli
2026-09-15 5:41 ` [PATCH v7 07/15] net: qrtr: Report endpoint for locally generated messages Juha-Matti Tilli
2026-09-15 5:42 ` [PATCH v7 08/15] net: qrtr: Allow sendmsg to target an endpoint Juha-Matti Tilli
2026-09-15 5:42 ` [PATCH v7 09/15] net: qrtr: allow socket endpoint binding Juha-Matti Tilli
2026-09-15 5:42 ` [PATCH v7 10/15] net: qrtr: Drop remote {NEW|DEL}_LOOKUP messages Juha-Matti Tilli
2026-09-15 5:42 ` [PATCH v7 11/15] net: qrtr: ns: support multiple endpoints Juha-Matti Tilli
2026-09-15 5:42 ` [PATCH v7 12/15] net: qrtr: mhi: Report endpoint id in sysfs Juha-Matti Tilli
2026-09-15 7:11 ` Arthur Crepin Leblond
2026-09-15 12:30 ` Juha-Matti Tilli
2026-09-15 5:42 ` [PATCH v7 13/15] net: qrtr: limit endpoint range to 16 bits on 32-bit machines Juha-Matti Tilli
2026-09-15 5:42 ` [PATCH v7 14/15] net: qrtr: use nid modulo 65536 in 32-bit lookups Juha-Matti Tilli
2026-09-15 5:42 ` [PATCH v7 15/15] net: qrtr: solve the 32-bit unsafe use in endpoints Juha-Matti Tilli
2026-09-15 22:47 ` [PATCH v7 00/15] QRTR Multi-endpoint support Jakub Kicinski
2026-09-16 5:53 ` Juha-Matti Tilli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9ffaeae1-3768-408b-8434-9f1704412fbe@app.fastmail.com \
--to=juha-matti.tilli@iki.fi \
--cc=agross@kernel.org \
--cc=andersson@kernel.org \
--cc=ath11k@lists.infradead.org \
--cc=ath12k@lists.infradead.org \
--cc=davem@davemloft.net \
--cc=denkenz@gmail.com \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=ionic@ionic.de \
--cc=jeff.hugo@oss.qualcomm.com \
--cc=jjohnson@kernel.org \
--cc=konradybcio@kernel.org \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=mani@kernel.org \
--cc=marcel@holtmann.org \
--cc=mhi@lists.linux.dev \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=willemb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®