Linux Serial subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: shatyuka@qq.com
Cc: linux-serial@vger.kernel.org
Subject: Re: [PATCH v2] tty: hvc: dcc: Detect JTAG connection only on CPU core 0
Date: Tue, 13 Oct 2026 15:15:34 +0000	[thread overview]
Message-ID: <sashiko-outbox-169978@kernel.org> (raw)
In-Reply-To: <tencent_A0A4CA13FA8B0F7ABF62EE438764D032F205@qq.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] tty: hvc_dcc: commit message contradicts caching sequence implementation
--

commit 5ac910cf6c31d8b744bac3d1aa1c60fcaa2dafb2
Author: Jiannan Du <shatyuka@qq.com>

tty: hvc: dcc: Detect JTAG connection only on CPU core 0

This commit attempts to fix a potential SMP issue where the JTAG connection
check could occur on a different CPU than core 0. It simplifies the check by
caching the result from one initcall and reusing it in a later initcall.

> Multiple checks are unnecessary: nobody is going to plug/unplug JTAG
> during kernel boot and expect it to work. Cache the return value of
> hvc_dcc_check() from device_initcall and reuse the cached value during
> console_initcall. This avoids complex SMP-related code and ensures the
> result is always from core 0.

[Severity: Medium]
Does the commit message have the sequence reversed?

The commit message explicitly claims to cache the return value from
device_initcall and reuse it during console_initcall. However, the
implementation does the exact opposite.

In drivers/tty/hvc/hvc_dcc.c, hvc_dcc_console_init() (a console_initcall) calls
hvc_dcc_check() and stores the result in dcc_core0_available:

	dcc_core0_available = hvc_dcc_check();
	if (!dcc_core0_available)
		return -ENODEV;

Then, hvc_dcc_init() (a device_initcall, which runs later) reuses this cached
value without calling hvc_dcc_check() again:

	if (!dcc_core0_available)
		return -ENODEV;

The code appears correct since console_initcall runs before device_initcall,
but the commit message misrepresents the boot sequence ordering, which makes
verifying the SMP safety claims confusing.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/tencent_A0A4CA13FA8B0F7ABF62EE438764D032F205@qq.com?part=1

      reply	other threads:[~2026-10-13 15:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-13 15:06 [PATCH v2] tty: hvc: dcc: Detect JTAG connection only on CPU core 0 shatyuka
2026-10-13 15:15 ` sashiko-bot [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=sashiko-outbox-169978@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=shatyuka@qq.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