From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 235461D555 for ; Thu, 23 Oct 2025 12:30:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761222622; cv=none; b=hvGj0I8K0+g9O9e5U7t+OKoZQ8NjxnQjPuzfnVll3NetxyY7MyEtOnmJ7hJKXg8NqtIewPrT9VJIed2Fjg68t3wbX7G/AHobcUhe30lKktZ5NKDAa5gaQFFGK87HkjiVV4ROQUfx2NM9uGj7MyM2oVijHmx7D937rfbbxC9QVRY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761222622; c=relaxed/simple; bh=Lf7YOQf8V02utUBN/f/dSt4noL1+fZx7zdhiTZo+kgk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YR86U/BL9k0xtD0kYJhesW5d0dRr9CXLjLN50WbM43/4L/fKGZf7xOPii2LbMu4Caa2Ci3cFR/madnJL1MDqopNJ4fa3lmDKgsWmXuJM+hcSUX4XplX1pnp7beirVmIJGenjtjL+Pi6I5IQAVNax3a76Kx7YtOdK5VpGiRsYhQE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=EHeozfyc; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="EHeozfyc" Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 59NARptB022111 for ; Thu, 23 Oct 2025 12:30:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=GbYU8m9RlIQsMrvs4 L2CEVuUmwo3QuB646bHShkynLY=; b=EHeozfycZ7CPFZGHv+9333bxlIICtHPf1 IisS05xfCkSH72c0Iifs3NtYcLLWB0Lmlrxc3XABTh97WhwmQDlN66ZbUrhDZt/p PBp0K8pXTZ2PPJsetNtMKEmyOv64+2QpC92WewhRrdbcOWr71tMa7A/UGWLhfJIA dUz5WGD6F4hc8iHwMC5mV5qkJS292i7SBiANlWoNr6ivGNyQuB8xtypKXza9rh6L hprBAcN+KzleW4gHiv2nA8QT3xM9yCImt77eyqfJePRBxd3waHHmZZMXuOLopXpk 2sFo8WHtMKsglZxoaXOGIT2+KF0lQ4XML6VpHTmeYUhcgfMtK0OlQ== Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 49v30w0mdc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 23 Oct 2025 12:30:19 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 59NANSKA024687 for ; Thu, 23 Oct 2025 12:30:19 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 49vpqk5kn6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 23 Oct 2025 12:30:19 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 59NCUF9261800910 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Oct 2025 12:30:15 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5536B20043; Thu, 23 Oct 2025 12:30:15 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3FF8020040; Thu, 23 Oct 2025 12:30:15 +0000 (GMT) Received: from tuxmaker.lnxne.boe (unknown [9.152.85.9]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 23 Oct 2025 12:30:15 +0000 (GMT) From: Vineeth Vijayan To: stable@vger.kernel.org Cc: hca@linux.ibm.com, oberpar@linux.ibm.com Subject: [PATCH 6.1.y] s390/cio: Update purge function to unregister the unused subchannels Date: Thu, 23 Oct 2025 14:30:15 +0200 Message-ID: <20251023123015.2935403-1-vneethv@linux.ibm.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <2025101905-removal-wistful-dd49@gregkh> References: <2025101905-removal-wistful-dd49@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: KeNwQpM6mt-x_BAN4Xo8xlNtZh1hZnK2 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMDE4MDAyMiBTYWx0ZWRfX1Y/S+UF1Br+g 94Flj4S+mMbwPdHyKAcgEqjaRrGua70BDBnNSqbsx0MjMyx4GsQLLXfAmzWRsKf9bfYF93PN0TS SVyQEVUnZBLOP0rtrnB05egsYXGBGK24xO92g7+CewUGsjfLqZexWBDHVvFxFrThYYget42Pkeo bMoSnfO/GaB3JedilxKapHQE8YG4/UuSFO6a57xbUsIwCPicwpShfWepdnpdUkbn09uGmQgK1Mp fSsHcq4zlmyheEeDzxxcjCEF9OGyw0GCA60PpSX1uSKYv41cg/EENxlg/yZA5IbVd6gbI4JlmnV 9gv5CZoiFT1iv+M2KBjVUDvonn7LtxG1mLcKUdtrDXEuC91Njxmr4kUsCPssks9/UHSM1JhdBYB yaq7xO9vIAdxSznifrctSbz76FjOTQ== X-Authority-Analysis: v=2.4 cv=MIJtWcZl c=1 sm=1 tr=0 ts=68fa1fdb cx=c_pps a=3Bg1Hr4SwmMryq2xdFQyZA==:117 a=3Bg1Hr4SwmMryq2xdFQyZA==:17 a=x6icFKpwvdMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=VnNF1IyMAAAA:8 a=qBIcWJXr8Lgkn95qcsUA:9 X-Proofpoint-ORIG-GUID: KeNwQpM6mt-x_BAN4Xo8xlNtZh1hZnK2 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-10-22_08,2025-10-22_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 phishscore=0 lowpriorityscore=0 adultscore=0 clxscore=1015 impostorscore=0 bulkscore=0 priorityscore=1501 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2510020000 definitions=main-2510180022 Starting with 'commit 2297791c92d0 ("s390/cio: dont unregister subchannel from child-drivers")', cio no longer unregisters subchannels when the attached device is invalid or unavailable. As an unintended side-effect, the cio_ignore purge function no longer removes subchannels for devices on the cio_ignore list if no CCW device is attached. This situation occurs when a CCW device is non-operational or unavailable To ensure the same outcome of the purge function as when the current cio_ignore list had been active during boot, update the purge function to remove I/O subchannels without working CCW devices if the associated device number is found on the cio_ignore list. Fixes: 2297791c92d0 ("s390/cio: dont unregister subchannel from child-drivers") Suggested-by: Peter Oberparleiter Reviewed-by: Peter Oberparleiter Signed-off-by: Vineeth Vijayan Signed-off-by: Heiko Carstens (cherry picked from commit 9daa5a8795865f9a3c93d8d1066785b07ded6073) --- drivers/s390/cio/device.c | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index bdf5a50bd931..1873c865b4d6 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c @@ -1309,23 +1309,34 @@ void ccw_device_schedule_recovery(void) spin_unlock_irqrestore(&recovery_lock, flags); } -static int purge_fn(struct device *dev, void *data) +static int purge_fn(struct subchannel *sch, void *data) { - struct ccw_device *cdev = to_ccwdev(dev); - struct ccw_dev_id *id = &cdev->private->dev_id; - struct subchannel *sch = to_subchannel(cdev->dev.parent); + struct ccw_device *cdev; - spin_lock_irq(cdev->ccwlock); - if (is_blacklisted(id->ssid, id->devno) && - (cdev->private->state == DEV_STATE_OFFLINE) && - (atomic_cmpxchg(&cdev->private->onoff, 0, 1) == 0)) { - CIO_MSG_EVENT(3, "ccw: purging 0.%x.%04x\n", id->ssid, - id->devno); + spin_lock_irq(sch->lock); + if (sch->st != SUBCHANNEL_TYPE_IO || !sch->schib.pmcw.dnv) + goto unlock; + + if (!is_blacklisted(sch->schid.ssid, sch->schib.pmcw.dev)) + goto unlock; + + cdev = sch_get_cdev(sch); + if (cdev) { + if (cdev->private->state != DEV_STATE_OFFLINE) + goto unlock; + + if (atomic_cmpxchg(&cdev->private->onoff, 0, 1) != 0) + goto unlock; ccw_device_sched_todo(cdev, CDEV_TODO_UNREG); - css_sched_sch_todo(sch, SCH_TODO_UNREG); atomic_set(&cdev->private->onoff, 0); } - spin_unlock_irq(cdev->ccwlock); + + css_sched_sch_todo(sch, SCH_TODO_UNREG); + CIO_MSG_EVENT(3, "ccw: purging 0.%x.%04x%s\n", sch->schid.ssid, + sch->schib.pmcw.dev, cdev ? "" : " (no cdev)"); + +unlock: + spin_unlock_irq(sch->lock); /* Abort loop in case of pending signal. */ if (signal_pending(current)) return -EINTR; @@ -1341,7 +1352,7 @@ static int purge_fn(struct device *dev, void *data) int ccw_purge_blacklisted(void) { CIO_MSG_EVENT(2, "ccw: purging blacklisted devices\n"); - bus_for_each_dev(&ccw_bus_type, NULL, NULL, purge_fn); + for_each_subchannel_staged(purge_fn, NULL, NULL); return 0; } -- 2.48.1