All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vineeth Vijayan <vneethv@linux.ibm.com>
To: wbezenah@linux.ibm.com, cohuck@redhat.com, pasic@linux.ibm.com,
	farman@linux.ibm.com, mjrosato@linux.ibm.com,
	oberpar@linux.ibm.com
Cc: linux-s390@vger.kernel.org
Subject: [PATCH 0/3] s390/cio: Harden pmcw/schib handling for dnv=0
Date: Thu, 10 Sep 2026 11:32:00 +0200	[thread overview]
Message-ID: <20260910093205.3357827-1-vneethv@linux.ibm.com> (raw)

For I/O subchannels, pmcw.dnv must be validated before relying on any
other PMCW or SCHIB fields.
Two issues exist today:
 - Some I/O entry points check pmcw.ena without first verifying that
   pmcw.dnv is set.
 - cio_update_schib() updates the cached SCHIB before validating
   pmcw.dnv, allowing an stsch result with dnv=0 to leave stale or
   undefined data in sch->schib.
 
This can trigger spurious, non-fatal error messages in the guest kernel
log when a virtio device is being detached.
 
Fix this by validating pmcw.dnv before updating the cached SCHIB. Also
clear the cached SCHIB when stsch succeeds but returns dnv=0, ensuring
that stale state is not retained.
 
Additionally, add pmcw.dnv checks before pmcw.ena checks in I/O entry
points and return -ENODEV when no device is present. Guard remaining
direct accesses to cached PMCW fields, such as chpid[] and pam, to
ensure they are only evaluated when the SCHIB contents are valid.
 
This was reported and discussed at:
 
Link: https://lore.kernel.org/linux-s390/20260612155407.199218-1-wbezenah@linux.ibm.com/ 

Vineeth Vijayan (3):
  s390/cio: Fix cio_update_schib() to not cache invalid schib
  s390/cio: Check pmcw.dnv before pmcw.ena in I/O entry points
  s390/cio: Guard PMCW field accesses with dnv check

 drivers/s390/cio/chp.c          |  3 +++
 drivers/s390/cio/cio.c          | 11 +++++++----
 drivers/s390/cio/device.c       |  9 +++++----
 drivers/s390/cio/device_fsm.c   |  3 +++
 drivers/s390/cio/device_ops.c   | 21 +++++++++++++++++++++
 drivers/s390/cio/vfio_ccw_fsm.c |  2 +-
 6 files changed, 40 insertions(+), 9 deletions(-)

-- 
2.53.0


             reply	other threads:[~2026-09-10  9:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-10  9:32 Vineeth Vijayan [this message]
2026-09-10  9:32 ` [PATCH 1/3] s390/cio: Fix cio_update_schib() to not cache invalid schib Vineeth Vijayan
2026-09-10  9:41   ` sashiko-bot
2026-09-10  9:32 ` [PATCH 2/3] s390/cio: Check pmcw.dnv before pmcw.ena in I/O entry points Vineeth Vijayan
2026-09-10  9:43   ` sashiko-bot
2026-09-10  9:32 ` [PATCH 3/3] s390/cio: Guard PMCW field accesses with dnv check Vineeth Vijayan
2026-09-10  9:48   ` sashiko-bot

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=20260910093205.3357827-1-vneethv@linux.ibm.com \
    --to=vneethv@linux.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=farman@linux.ibm.com \
    --cc=linux-s390@vger.kernel.org \
    --cc=mjrosato@linux.ibm.com \
    --cc=oberpar@linux.ibm.com \
    --cc=pasic@linux.ibm.com \
    --cc=wbezenah@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.