From: "Hölzl, Alexander" <alexander.hoelzl@gmx.net>
To: Oleksij Rempel <o.rempel@pengutronix.de>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>,
Markus Koeniger <markus.koeniger87@gmail.com>,
robin@protonic.nl, linux-kernel@vger.kernel.org,
kernel@pengutronix.de, linux-can@vger.kernel.org
Subject: Re: [PATCH] can: j1939: fix potential race condition in BAM segmentation
Date: Thu, 1 Oct 2026 13:54:52 +0200 [thread overview]
Message-ID: <fc961382-aa90-4d82-b574-131437abb6f6@gmx.net> (raw)
In-Reply-To: <ar5F3nxH6pvuE_Up@pengutronix.de>
Am 01.10.2026 um 13:37 schrieb Oleksij Rempel:
> Hi,
>
> On Thu, Oct 01, 2026 at 01:18:27PM +0200, Hölzl, Alexander wrote:
>> Hello,
>> Am 01.10.2026 um 12:57 schrieb Marc Kleine-Budde:
>>> On 01.10.2026 12:42:21, Markus Koeniger wrote:
>>>> I really appreciate your solution to schedule the TX timer for a BAM
>>>> transfer after receiving the looped-back frame.
>>>
>> Glad that I could help.
>>
>>>> We use external CAN controllers in our system, which introduce some
>>>> jitter into the transmit path. As a result, messages were sent from
>>>> time to time too quickly and violated the 50 ms minimum interval. Your
>>>> patch solves this problem.
>>>>
>>>> Tested-by: Markus Koeniger markus.koeniger@liebherr.com
>>>
>>> Thanks for testing, however I'm not sure if we can get this patch
>>> upstream if sashiko complains about it.
>>>
>> I wasn't planning on letting this patch stall. Next week I'll try to address
>> sashiko comment's as well as the other patch I still have open.
>
> Nice, thx.
>
> I'm working right now on j1939 selftests for core functionality. Hope
> it will be ready this week. If not, next week i'll be in Prag on E-OSS
> conference...
>
Ah that's good to know. In the CTS hold patch I've also implemented
some tests (https://lkml.org/lkml/2026/7/7/85) but I guess they'll
mostly be superfluous then?>> Additionally while I'm at it I just wanted
to ask, is it intended behavior
>> that the kernel implementation strictly serializes all J1939 sessions. E.g
>> when sending a segmented message directed to destination address A it is not
>> possible to have a second session open targeting destination address B.
>> According to the standard this is allowed and not
>> being able to do so can result in very low performance in some use-cases.
>> This especially true if one of the sessions is a BAM session transmitting a
>> longer message, as there are 50ms pauses between each frame.
>
> Is it not working with a separate socket? If I remember it correctly,
> this behavior should be supported if two sockets send to separate
> addresses. Withing one socket, frames should be serialized.
>
I've never tried it with multiple sockets but if you say so I'm sure
it'll work :). For my use case specifically this quite inconvenient
behavior but I guess I might be abusing the stack a little bit :).
I've written a patch which allows interleaved tx-sessions per socket but
if the kernel behaves as designed then that's probably not something
which I should try to get into the mainline.
prev parent reply other threads:[~2026-10-01 11:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-10 9:06 Alexander Hölzl
2026-10-01 10:42 ` Markus Koeniger
2026-10-01 10:57 ` Marc Kleine-Budde
2026-10-01 11:18 ` Hölzl, Alexander
2026-10-01 11:37 ` Oleksij Rempel
2026-10-01 11:54 ` Hölzl, Alexander [this message]
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=fc961382-aa90-4d82-b574-131437abb6f6@gmx.net \
--to=alexander.hoelzl@gmx.net \
--cc=kernel@pengutronix.de \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=markus.koeniger87@gmail.com \
--cc=mkl@pengutronix.de \
--cc=o.rempel@pengutronix.de \
--cc=robin@protonic.nl \
/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®