Linux s390 Architecture development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Sven Schnelle" <svens@linux.ibm.com>
Cc: linux-s390@vger.kernel.org, "Heiko Carstens" <hca@linux.ibm.com>,
	"Alexander Gordeev" <agordeev@linux.ibm.com>,
	"Vasily Gorbik" <gor@linux.ibm.com>,
	"Christian Borntraeger" <borntraeger@linux.ibm.vom>
Subject: Re: [PATCH] s390/stp: Drop CLOCK_SYNC_STP
Date: Fri, 14 Aug 2026 07:34:50 +0000	[thread overview]
Message-ID: <20260814073450.908631F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260814072223.2218864-1-svens@linux.ibm.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Booting on systems with XRC-capable DASDs but no active STP network will hang indefinitely due to an unhandled -EAGAIN loop.
- [Low] Lockless plain read/write of `stp_online` introduces a formal data race.
--

--- Patch [1]: [PATCH] s390/stp: Drop CLOCK_SYNC_STP ---
commit 39bb08d28d4e120a87017a08eb301d774dd6baa2
Author: Sven Schnelle <svens@linux.ibm.com>

s390/stp: Drop CLOCK_SYNC_STP

This commit removes the CLOCK_SYNC_STP flag in favor of using the stp_online
boolean directly. This change prevents get_phys_clock() from returning -EACCES
when the kernel command line option stp=1 is used or STP is enabled by default.

> diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
> index 2b989bebd220a..de80e2a316ba7 100644
> --- a/arch/s390/kernel/time.c
> +++ b/arch/s390/kernel/time.c
[ ... ]
> @@ -299,7 +299,7 @@ int get_phys_clock(unsigned long *clock)
>  		return 0;
>  	if (!test_bit(CLOCK_SYNC_HAS_STP, &clock_sync_flags))
>  		return -EOPNOTSUPP;
> -	if (!test_bit(CLOCK_SYNC_STP, &clock_sync_flags))
> +	if (!stp_online)

[Severity: Low]
Does this introduce a formal data race under the LKMM?

get_phys_clock() now performs a lockless plain read of stp_online.
Meanwhile, online_store() modifies it concurrently via a plain write:

arch/s390/kernel/time.c:online_store() {
    ...
    mutex_lock(&stp_mutex);
    stp_online = value;
    ...
}

Could this trigger KCSAN warnings when userspace toggles the sysfs
online attribute while get_phys_clock() is executing?

>  		return -EACCES;
>  	return -EAGAIN;
>  }

[Severity: High]
Could this change cause a boot hang on systems with XRC-capable DASDs
but no active STP network?

Because stp_online is initialized to true, if the machine supports the
STP facility but is not connected to a usable STP time source, time
synchronization won't occur and stp_online will remain true.

With stp_online remaining true, get_phys_clock() will continuously fall
through and return -EAGAIN, rather than safely returning -EACCES as it
did prior to this patch.

The DASD driver ignores -EACCES but propagates -EAGAIN:

drivers/s390/block/dasd_eckd.c:set_timestamp() {
    ...
	if ((rc && !private->rdc_data.facilities.XRC_supported) ||
	    rc == -EOPNOTSUPP || rc == -EACCES)
		return 0;
    ...
}

If -EAGAIN is propagated up, will the block layer endlessly retry the I/O,
resulting in a complete hang during boot?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260814072223.2218864-1-svens@linux.ibm.com?part=1

      reply	other threads:[~2026-08-14  7:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-14  7:22 [PATCH] s390/stp: Drop CLOCK_SYNC_STP Sven Schnelle
2026-08-14  7:34 ` 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=20260814073450.908631F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@linux.ibm.vom \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=linux-s390@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=svens@linux.ibm.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