From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=148.163.156.1 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794479182; b=QPSm45M+9J5vXbew8EGZ5vHIVbzRladIVY++kbIAaBIcKRGZ3kk7pxCfXjYELXsaoy1D HzysfYrgzjUXudeYp2y+EAccqy22BnnEH14Itd52aKgfZ9lKZHyBNllV7OJLG47BMPvZE HkxXeq7E1UGPw7/CnSmNy0VHK+Tv2zBJSWJuaFL0LJL+M2RUvTZovdll8hgoTkCxc6HbO z7sIXESRzuhLRzX2bqC2O+JmAV1cEBu0EMcjUNKDWHIMQpom0ro42KajnQdW2XSw4vIS8 +g0+e+bxjlAOjthVB2IOpd5Y/uSphLLr6ElO6wTUgoDJrQEGTchEVl789ulvlqPWbUw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794479182; h=DMARC-Filter:Received:DKIM-Signature:Received:Received:Received: Received:Received:Received:Received:From:To:Cc:Subject:Date: Message-ID:X-Mailer:In-Reply-To:References:MIME-Version:Content-Type: Content-Transfer-Encoding:X-TM-AS-GCONF:X-Proofpoint-ORIG-GUID: X-Authority-Analysis:X-Proofpoint-GUID:X-Proofpoint-Spam-Details-Enc: X-Proofpoint-Spam-Info:X-Proofpoint-Virus-Version: X-Proofpoint-Spam-Details; bh=oRdTUTRYzNDrSPfeXcG2zmiDwKSBQeKLX5yqDfBJkds=; b=zznjjL5yYEpyUvinXjHtenNqAEnzEU6i4Qs5idF0e/MRxq0iloywAO/lhtAc+v6Y8/IG VCul/LNqzHBrdHMeWUUESsKY59oZKZKKCGLk69vlAcciFpXY6/Gh3cfrPfMMfXCujyUlt wTxqUADvWiMR7nkWPNsXu1NHx+PEHq7fL118hNPpJYzbsncUeqeLloRdurFiY9jL6LNgB /QDm1r+BvGQky45VoDVYgstfFDLdWdz3m3xAOVZV/4Vaofh+O7cEYNC6GbEqcI3FADjVP p4KnuU8q74jm9XTWlfMKK3IhR8Iwj1e1j1mM4EHRY/fxz5XNDO341CBxHw33vui86XQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=OZ1sOpmZ; arc=none smtp.remote-ip=148.163.156.1 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3B5EA606A332; Thu, 12 Nov 2026 10:26:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 3B5EA606A332 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.a=rsa-sha256 header.s=pp1 header.b=OZ1sOpmZ Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6AC2ib0s3054262; Thu, 12 Nov 2026 10:26:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pp1; bh=oRdTUT RYzNDrSPfeXcG2zmiDwKSBQeKLX5yqDfBJkds=; b=OZ1sOpmZirsozGOxIz4Ivd JXQRDZafn/LpH+TVAYgTL+72ENrZNAHwrr22htNcJsY9NmyU4Cip0uo3oOFZsB+7 Z29vW3DME/IIDs5mpDCTXjAuy9xbHOJ/RZqHdhLYNq4RxsFB9hw4m/GQmQwlLucv Jcxv4crxKF3MDS3mf8AqAuO2EMwYjpTt2UtqmJWeWUhJkGPI6mqpCBxurqxgNH2l BpBS00QZfTKwZzCnS7pn58ENZCKTe7/RvUWVm/MG2mU/2ZbsORgoMfNVqaWPVXxX evDWOzR7Wg+h38oUEPco7ppIsP+x1AoFhZOFwAAMnPUTwTuNE3uSWShRxI4ojwPg == Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4hsug6eypx-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 12 Nov 2026 10:26:20 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 6AC8NKfR098417; Thu, 12 Nov 2026 10:26:19 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4hvkq0vv4v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 Nov 2026 10:26:19 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 6ACAQDL528770678 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 Nov 2026 10:26:13 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1E5072004F; Thu, 12 Nov 2026 10:26:13 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id ED74A2004E; Thu, 12 Nov 2026 10:26:12 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9]) by smtpav04.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 12 Nov 2026 10:26:12 +0000 (GMT) From: Stefan Haberland To: Jens Axboe Cc: linux-block@vger.kernel.org, Jan Hoeppner , linux-s390@vger.kernel.org, Heiko Carstens , Vasily Gorbik , Christian Borntraeger Subject: [PATCH 2/4] s390/dasd: Re-initialize RCD buffer with "V1.0" before every start Date: Thu, 12 Nov 2026 11:26:06 +0100 Message-ID: <20261112102608.1057852-3-sth@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261112102608.1057852-1-sth@linux.ibm.com> References: <20261112102608.1057852-1-sth@linux.ibm.com> X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: m9_l6y-44SeWObcJfsFkWGXnS1xi3rpx X-Authority-Analysis: v=2.4 cv=PeVqFShd c=1 sm=1 tr=0 ts=6af5944c cx=c_pps a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17 a=IkcTkHD0fZMA:10 a=zJRp6_cAMcgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=iQ6ETzBq9ecOQQE5vZCe:22 a=VwQbUJbxAAAA:8 a=VnNF1IyMAAAA:8 a=Ab1ESWjozxJcnBHYUgwA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 X-Proofpoint-GUID: m9_l6y-44SeWObcJfsFkWGXnS1xi3rpx X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTEyMDA0MCBTYWx0ZWRfX3bnv24yENitl tG+moGquPPUL3unTcvwQkEDrv1VqXfaV+f63ZjlpHESNJAN9hpB1ldMW/aYC3HBw61DiWRFBuRy 0iUezlztTvZV08oDcqm2CwBWhCcbP8RfovIrOVzC7BcqcOH8bOUBOg4UbiNeSLA0Jk1gfDtyKct 47eCJ4rGGWrpVai5lyDfaw5D4pNd6ifVS69SJaHPvioYJyujwFSmHOtS/MFiiUQ3aSzFQC5nMYN MM17mruYa4KH0OxP37OhDkxUQ/Hu0xTUTcUju9DNSUanD7tLLuzeDVnrz4F2cyUBWZPPWDI28l3 +KpLpK6c/I6UoV6wg1uUmw3qEFZSvmTn3S8LEItA02Sopp4kOmHW0Fod6KikAfmyUsll2Dacky+ k4lVl0iXpW6ZI1rBlS6qDZyzlfpKowntUf8LXf/S2nPTMMQdP8UUWLuGRKNfNwNUiRKXLLIQcT5 NRZjItWo4O0u8bpaz0A== X-Proofpoint-Spam-Info: AW1haW4tMjYxMTEyMDA0MCBTYWx0ZWRfX0hJiUlePB8pC ZdKV7Fv5cNKlZ5a3ipPp6n762NLbRKMThRXgfKu/Ajh737NVO2R1GIgxhfmLIDEI2M+4P6+SXZq No5dZPcnvA4RCvsOA6f7jwHdMdSbAkk= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-11-12_01,2026-11-11_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 phishscore=0 suspectscore=0 impostorscore=0 priorityscore=1501 lowpriorityscore=0 spamscore=0 malwarescore=0 clxscore=1011 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611120040 Under z/VM the Read Configuration Data (RCD) buffer has to start with EBCDIC "V1.0" to request the virtual device SNEQ that carries the minidisk UIT. The request and the response share the same buffer: CP evaluates the magic on the way out and the RCD data is written into the same buffer on the way back. The magic is only written when the request is built and again in read_conf_cb() when the original request fails. Several restart paths do not run that callback: - ERP use the same buffer and if the same error occurs again, the ERP restarts the existing ERP request; if a different error occurs, it adds another ERP request. Neither re-initializes the magic. - Terminated (timed out) ERP requests, killed requests and requests requeued after the last path was gone are restarted without it. - dasd_sleep_on_immediately() overwrites cqr->callback, so read_conf_cb() never ran for dasd_eckd_read_conf_immediately(), and its fastpath retries in dasd_int_handler() do not call a callback either. If such a restart succeeds, z/VM omits the virtual device SNEQ, the UID of that path is built without the UIT and the paths are reported as "Not all channel paths lead to the same device" although they lead to the same minidisk. Every start of a request, whatever path led to it, goes through dasd_start_IO(). Add an optional prepare_io function to the request that dasd_start_IO() calls before every start of the request and of its ERP requests, and use it to write the magic for RCD requests. The ERP handling stays unchanged. read_conf_cb() is no longer needed and is removed, which also gets rid of its memset() that only cleared a single byte. Fixes: 5915a873fcb1 ("[S390] dasd: re-initialize read_conf buffer for retries") Cc: stable@vger.kernel.org Reviewed-by: Jan Höppner Signed-off-by: Stefan Haberland --- drivers/s390/block/dasd.c | 1 + drivers/s390/block/dasd_eckd.c | 52 ++++++++++++---------------------- drivers/s390/block/dasd_int.h | 15 ++++++++++ 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index d74ef737ae26..3a55c937d0d6 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c @@ -1396,6 +1396,7 @@ int dasd_start_IO(struct dasd_ccw_req *cqr) cqr->status = DASD_CQR_ERROR; return -EIO; } + dasd_start_IO_prepare(cqr); cqr->startclk = get_tod_clock(); cqr->starttime = jiffies; cqr->retries--; diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c index 53f823a9310e..efaf117e39f4 100644 --- a/drivers/s390/block/dasd_eckd.c +++ b/drivers/s390/block/dasd_eckd.c @@ -845,20 +845,29 @@ static int dasd_eckd_compare_path_uid(struct dasd_device *device, return memcmp(&device_uid, &path_uid, sizeof(struct dasd_uid)); } +/* + * The RCD buffer has to start with EBCDIC "V1.0" to show support for + * virtual device SNEQ. The RCD data is written into the same buffer, so + * a failed attempt may already have overwritten the magic. Re-initialize + * it before every start, including restarts by ERP requests. + */ +static void dasd_eckd_rcd_prepare_io(struct dasd_ccw_req *cqr) +{ + struct ccw1 *ccw = cqr->cpaddr; + __u8 *rcd_buffer = dma32_to_virt(ccw->cda); + + rcd_buffer[0] = 0xE5; + rcd_buffer[1] = 0xF1; + rcd_buffer[2] = 0x4B; + rcd_buffer[3] = 0xF0; +} + static void dasd_eckd_fill_rcd_cqr(struct dasd_device *device, struct dasd_ccw_req *cqr, __u8 *rcd_buffer, __u8 lpm) { struct ccw1 *ccw; - /* - * buffer has to start with EBCDIC "V1.0" to show - * support for virtual device SNEQ - */ - rcd_buffer[0] = 0xE5; - rcd_buffer[1] = 0xF1; - rcd_buffer[2] = 0x4B; - rcd_buffer[3] = 0xF0; ccw = cqr->cpaddr; ccw->cmd_code = DASD_ECKD_CCW_RCD; @@ -875,33 +884,10 @@ static void dasd_eckd_fill_rcd_cqr(struct dasd_device *device, cqr->retries = 256; cqr->buildclk = get_tod_clock(); cqr->status = DASD_CQR_FILLED; + cqr->prepare_io = dasd_eckd_rcd_prepare_io; set_bit(DASD_CQR_VERIFY_PATH, &cqr->flags); } -/* - * Wakeup helper for read_conf - * if the cqr is not done and needs some error recovery - * the buffer has to be re-initialized with the EBCDIC "V1.0" - * to show support for virtual device SNEQ - */ -static void read_conf_cb(struct dasd_ccw_req *cqr, void *data) -{ - struct ccw1 *ccw; - __u8 *rcd_buffer; - - if (cqr->status != DASD_CQR_DONE) { - ccw = cqr->cpaddr; - rcd_buffer = dma32_to_virt(ccw->cda); - memset(rcd_buffer, 0, sizeof(*rcd_buffer)); - - rcd_buffer[0] = 0xE5; - rcd_buffer[1] = 0xF1; - rcd_buffer[2] = 0x4B; - rcd_buffer[3] = 0xF0; - } - dasd_wakeup_cb(cqr, data); -} - static int dasd_eckd_read_conf_immediately(struct dasd_device *device, struct dasd_ccw_req *cqr, __u8 *rcd_buffer, @@ -921,7 +907,6 @@ static int dasd_eckd_read_conf_immediately(struct dasd_device *device, clear_bit(DASD_CQR_FLAGS_USE_ERP, &cqr->flags); set_bit(DASD_CQR_ALLOW_SLOCK, &cqr->flags); cqr->retries = 5; - cqr->callback = read_conf_cb; rc = dasd_sleep_on_immediately(cqr); return rc; } @@ -959,7 +944,6 @@ static int dasd_eckd_read_conf_lpm(struct dasd_device *device, goto out_error; } dasd_eckd_fill_rcd_cqr(device, cqr, rcd_buf, lpm); - cqr->callback = read_conf_cb; ret = dasd_sleep_on(cqr); /* * on success we update the user input parms diff --git a/drivers/s390/block/dasd_int.h b/drivers/s390/block/dasd_int.h index 26ecf9f47d2e..53c450036fe1 100644 --- a/drivers/s390/block/dasd_int.h +++ b/drivers/s390/block/dasd_int.h @@ -147,6 +147,8 @@ struct dasd_ccw_req { void *data; /* pointer to data area */ struct irb irb; /* device status in case of an error */ struct dasd_ccw_req *refers; /* ERP-chain queueing. */ + /* optional prepare function called before every start_io, must not sleep */ + void (*prepare_io)(struct dasd_ccw_req *cqr); void *function; /* originating ERP action */ void *mem_chunk; @@ -892,6 +894,19 @@ static inline void *dasd_get_callback_data(struct dasd_ccw_req *cqr) return cqr->callback_data; } +/* + * Walk down the ERP chain to the original CQR and call its + * prepare_io function if set. + */ +static inline void dasd_start_IO_prepare(struct dasd_ccw_req *cqr) +{ + /* ERP requests use the prepare function of the original request */ + while (cqr->refers) + cqr = cqr->refers; + if (cqr->prepare_io) + cqr->prepare_io(cqr); +} + static inline bool dasd_req_conflict(struct dasd_ccw_req *cqr1, struct dasd_ccw_req *cqr2) { -- 2.53.0