From nobody Fri Oct 2 12:19:38 2026 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (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 B314630C371; Fri, 31 Jul 2026 16:50:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785516622; cv=none; b=UxHs9Jrw6E913z5SIU6giTCNcX8W27dUH4fAew1bRpKIch95HtaPR4M2SKJzYi9KUCxUIW0t2B3nU1qQXF0wu2DWJ+vnwvkLChkZx+Zj0+OCtjP5axk+S7Zx4z6EXsuwfwns4Hj9nQTENrKDyfitlSBEBMjwsIBP7AZ064slOiE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785516622; c=relaxed/simple; bh=pQrbf13ZZw6TEaBMQCVXPSLhWi2PYKh0c4e2CT2olnA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KlGBbSBPaTlSeHkrYW6d4e3PoIFb9q9M0FK+umoSex4/hwPZ/JZLZPFw8AugjxdIQSOc7+IAcEC/sSy8HU/xZlVdnSbxsmjpwlO8NsWqZV8CYaNtkBwF+jk13S2NPbJE3gT8n3dnc2fFFn12a6xwaNSPOZ1na5pQE78OQmc8g9g= 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=kAv/rndi; arc=none smtp.client-ip=148.163.156.1 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="kAv/rndi" Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66VFlY51402318; Fri, 31 Jul 2026 16:50:11 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=+2RVMc2ni8gyNc+aC VLiIlr1CE9R4CzWE12uCn+7OLE=; b=kAv/rndi2+e2waUIiwtcxKEp5s/YdTJ51 2UtXqFtdWPnFnE0lp9SKNcPfSCDcQC0Z3mZH9Y9rfqx+FTuseXg5a89phoeQa5EX C6hsHBUGrks2t04MThseKPaRDEAPE++4ng4Ps79/GnuRS0oo00SznCUGfAvEHB57 ex0WC816CSziGKh7Y5EuoIv7L1WfZIvnlMSq2SJbl59023Ht/4b6PMOt1DD1HHGj pCKSyNvTcyeGf100nStSX7r4fQCovL3En3vTMu/ALSofPcvV5xUDOWiPRcFs9z8Y chZXHjWT+wF/ySE4QlJaehoNrtg0BodnvmjMHNDATB7DhCkFygeGA== Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fmuycx1bu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 31 Jul 2026 16:50:10 +0000 (GMT) Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66VGfKLY029047; Fri, 31 Jul 2026 16:50:09 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 4fn7fqrw5w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 31 Jul 2026 16:50:09 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66VGo5TB41419242 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 31 Jul 2026 16:50:05 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 47CE020040; Fri, 31 Jul 2026 16:50:05 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0EEAC20043; Fri, 31 Jul 2026 16:50:05 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 31 Jul 2026 16:50:05 +0000 (GMT) From: Heiko Carstens To: Alexander Gordeev , Sven Schnelle , Vasily Gorbik , Christian Borntraeger , Harald Freudenberger , Holger Dengler , Vineeth Vijayan , Peter Oberparleiter , Janosch Frank , Claudio Imbrenda , David Hildenbrand , Peter Zijlstra , Herbert Xu Cc: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org Subject: [PATCH v4 1/4] s390/crypto: Replace cond_resched() with msleep(1) Date: Fri, 31 Jul 2026 18:50:01 +0200 Message-ID: <20260731165004.2758105-2-hca@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260731165004.2758105-1-hca@linux.ibm.com> References: <20260731165004.2758105-1-hca@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: jJSHv5Om7-RWBjcc_jjkUv5Boksr6wBT X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzMxMDEyOCBTYWx0ZWRfX7HPxPsnHjbKv GC5dje0NPg+iC2FzkJQm2GkUwntPgsf1NYSQRrrpmn0550YqSfNVYXSF+yr3PREk5TcJf+QBftq vnSNSYYI9QNx560ePKIFHv44B1Qk/ZvdFvfJKdcY7X/s3J0Dta2vtROs59VnZZ7sJ7vf9/KHGeU 57eRFFNh+zNHc+3PbEywStWtKJ7sMlFE/ALIv1sTvweVg6sQgHEah4FOmENzt6B4lWHLTdwHvPs PYUcipnL8BKqdZbiZ8yARSqAh+bbT0fcJeQRdOLaRvanY5L2ziAO59yDwLvSOS2eDCVkIWpcuJO AYLPzATCRK3CrPWhvUdfowv/fIYH7vn0fGQIXtSPJRW1k7Fbt2FJnabkgsWV9llhczWDLqFhSx/ mhBz2Ds2pkDnX3/6o35razWB1JyAD8s4iMEEx7vy6OtxDhMSuMcOZYL7vFXgJ57E+3ojYiZboIL 47DbDjkMaAftxmN0xxg== X-Proofpoint-Spam-Info: AW1haW4tMjYwNzMxMDEyOCBTYWx0ZWRfX9K8oadAix1J+ 4RSfMttErCK7nWL9nNBxzVSuto3cBM2hyGudwiSTw/Uqw9sa9I1ne1kdS+CwJ8RpN7KcGtqV/QV G+z2hChgPU49FGTlBXETwHSB15LRX2M= X-Authority-Analysis: v=2.4 cv=AZeB2XXG c=1 sm=1 tr=0 ts=6a6cd242 cx=c_pps a=bLidbwmWQ0KltjZqbj+ezA==:117 a=bLidbwmWQ0KltjZqbj+ezA==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=uAbxVGIbfxUO_5tXvNgY:22 a=VwQbUJbxAAAA:8 a=VnNF1IyMAAAA:8 a=WsHKUha7AAAA:8 a=JfrnYn6hAAAA:8 a=DKx5s9VkpjxxvdiG65UA:9 a=H4LAKuo8djmI0KOkngUh:22 a=1CNFftbPRP8L7MoqJWF3:22 X-Proofpoint-GUID: jJSHv5Om7-RWBjcc_jjkUv5Boksr6wBT X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-31_05,2026-07-30_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 priorityscore=1501 phishscore=0 adultscore=0 impostorscore=0 clxscore=1015 malwarescore=0 suspectscore=0 lowpriorityscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607310128 Content-Type: text/plain; charset="utf-8" From: Peter Zijlstra With [1] cond_resched() is always compiled away and becomes a no-op. The comments for all cond_resched() calls in crypto code however indicate that the current process should be scheduled away to avoid instant re-invocation of a callback. This is not what cond_resched() would do or did. Instead of just removing the cond_resched() calls, replace them with msleep() calls, as suggested by Holger Dengler. This forces the current task to be scheduled away (sleeps) like originally intended. Holger provided information why this intended [2]: " Let me give a bit of background here: The protected key can only get invalid, if the Linux instance (z/VM or KVM guest) is moved to another hypervisor on a different machine (aka life guest relocation). In such a case, the crypto accelerator card and the host has to exchange the "real key", which is wrapped by the host and handed back to the guest as the re-newed protected key. Unfortunately there is no asynchronous trigger on completion, you have to re-try (and maybe get another "in progress" return). And as if that weren't bad enough, if this key exchange between card and host is the first one, card and host has to instantiate a secure communication channel (including a key exchange for the transport layer). " [1] commit 7dadeaa6e851 ("sched: Further restrict the preemption modes") [2] https://lore.kernel.org/all/39570813-27b0-40f9-89c5-8e2dce05e2f0@linux.= ibm.com/ [3] https://lore.kernel.org/all/20260731084027.GE776954@noisy.programming.k= icks-ass.net/ [hca@linux.ibm.com: took Peter's patch [3] and provided commit message] Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Heiko Carstens Reviewed-by: Holger Dengler --- arch/s390/crypto/paes_s390.c | 44 ++++------------------------------- arch/s390/crypto/phmac_s390.c | 25 +++----------------- arch/s390/include/asm/pkey.h | 16 +++++++++++++ 3 files changed, 23 insertions(+), 62 deletions(-) diff --git a/arch/s390/crypto/paes_s390.c b/arch/s390/crypto/paes_s390.c index 8cfe6166c193..973436592318 100644 --- a/arch/s390/crypto/paes_s390.c +++ b/arch/s390/crypto/paes_s390.c @@ -548,16 +548,7 @@ static int ecb_paes_do_one_request(struct crypto_engin= e *engine, void *areq) =20 rc =3D ecb_paes_do_crypt(ctx, req_ctx, tested, true); if (rc =3D=3D -EKEYEXPIRED) { - /* - * Protected key expired, conversion is in process. - * Trigger a re-schedule of this request by returning - * -ENOSPC ("hardware queue is full") to the crypto engine. - * To avoid immediately re-invocation of this callback, - * tell the scheduler to voluntarily give up the CPU here. - */ - cond_resched(); - pr_debug("rescheduling request\n"); - return -ENOSPC; + return pkey_handle_expired(); } else if (rc) { skcipher_walk_done(walk, rc); } @@ -814,16 +805,7 @@ static int cbc_paes_do_one_request(struct crypto_engin= e *engine, void *areq) =20 rc =3D cbc_paes_do_crypt(ctx, req_ctx, tested, true); if (rc =3D=3D -EKEYEXPIRED) { - /* - * Protected key expired, conversion is in process. - * Trigger a re-schedule of this request by returning - * -ENOSPC ("hardware queue is full") to the crypto engine. - * To avoid immediately re-invocation of this callback, - * tell the scheduler to voluntarily give up the CPU here. - */ - cond_resched(); - pr_debug("rescheduling request\n"); - return -ENOSPC; + return pkey_handle_expired(); } else if (rc) { skcipher_walk_done(walk, rc); } @@ -1122,16 +1104,7 @@ static int ctr_paes_do_one_request(struct crypto_eng= ine *engine, void *areq) =20 rc =3D ctr_paes_do_crypt(ctx, req_ctx, tested, true); if (rc =3D=3D -EKEYEXPIRED) { - /* - * Protected key expired, conversion is in process. - * Trigger a re-schedule of this request by returning - * -ENOSPC ("hardware queue is full") to the crypto engine. - * To avoid immediately re-invocation of this callback, - * tell the scheduler to voluntarily give up the CPU here. - */ - cond_resched(); - pr_debug("rescheduling request\n"); - return -ENOSPC; + return pkey_handle_expired(); } else if (rc) { skcipher_walk_done(walk, rc); } @@ -1565,16 +1538,7 @@ static int xts_paes_do_one_request(struct crypto_eng= ine *engine, void *areq) =20 rc =3D xts_paes_do_crypt(ctx, req_ctx, tested, true); if (rc =3D=3D -EKEYEXPIRED) { - /* - * Protected key expired, conversion is in process. - * Trigger a re-schedule of this request by returning - * -ENOSPC ("hardware queue is full") to the crypto engine. - * To avoid immediately re-invocation of this callback, - * tell the scheduler to voluntarily give up the CPU here. - */ - cond_resched(); - pr_debug("rescheduling request\n"); - return -ENOSPC; + return pkey_handle_expired(); } else if (rc) { skcipher_walk_done(walk, rc); } diff --git a/arch/s390/crypto/phmac_s390.c b/arch/s390/crypto/phmac_s390.c index 03ca33ffe6cc..020a1beb2e22 100644 --- a/arch/s390/crypto/phmac_s390.c +++ b/arch/s390/crypto/phmac_s390.c @@ -887,16 +887,7 @@ static int phmac_do_one_request(struct crypto_engine *= engine, void *areq) case OP_FINUP: rc =3D phmac_kmac_update(req, true); if (rc =3D=3D -EKEYEXPIRED) { - /* - * Protected key expired, conversion is in process. - * Trigger a re-schedule of this request by returning - * -ENOSPC ("hardware queue full") to the crypto engine. - * To avoid immediately re-invocation of this callback, - * tell scheduler to voluntarily give up the CPU here. - */ - pr_debug("rescheduling request\n"); - cond_resched(); - return -ENOSPC; + return pkey_handle_expired(); } else if (rc) { hwh_advance(hwh, rc); goto out; @@ -907,18 +898,8 @@ static int phmac_do_one_request(struct crypto_engine *= engine, void *areq) fallthrough; case OP_FINAL: rc =3D phmac_kmac_final(req, true); - if (rc =3D=3D -EKEYEXPIRED) { - /* - * Protected key expired, conversion is in process. - * Trigger a re-schedule of this request by returning - * -ENOSPC ("hardware queue full") to the crypto engine. - * To avoid immediately re-invocation of this callback, - * tell scheduler to voluntarily give up the CPU here. - */ - pr_debug("rescheduling request\n"); - cond_resched(); - return -ENOSPC; - } + if (rc =3D=3D -EKEYEXPIRED) + return pkey_handle_expired(); break; default: /* unknown/unsupported/unimplemented asynch op */ diff --git a/arch/s390/include/asm/pkey.h b/arch/s390/include/asm/pkey.h index 0af5ac4f646b..82e403322e89 100644 --- a/arch/s390/include/asm/pkey.h +++ b/arch/s390/include/asm/pkey.h @@ -13,6 +13,7 @@ =20 #include #include +#include #include =20 /* @@ -44,4 +45,19 @@ int pkey_key2protkey(const u8 *key, u32 keylen, */ #define PKEY_XFLAG_NOCLEARKEY 0x0002 =20 +static inline int pkey_handle_expired(void) +{ + /* + * Protected key expired due to relocation to another host. The long + * running re-wrap has no asynchronous completion notification, so + * polling is required. Trigger a re-schedule of this request by + * returning -ENOSPC ("hardware queue full") to the crypto engine. + * To avoid immediately re-invocation of this callback, + * tell the scheduler to voluntarily give up the CPU here. + */ + msleep(1); + pr_debug("rescheduling request\n"); + return -ENOSPC; +} + #endif /* _KAPI_PKEY_H */ --=20 2.53.0 From nobody Fri Oct 2 12:19:38 2026 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 5EDDB345EC9; Fri, 31 Jul 2026 16:50:21 +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=1785516623; cv=none; b=dQJsI0yVLcep7q6u6JDITHqdbMLLWAP85m+8IKotEOJmaSzWjExgwYyVRBzb0usxwBM8A6o0SbYIuERubxyA4brQqBUo83DsCve7q2s+FnBbLWzUORTm5QS6husvHQqKlnspwkKQqDm3frTHSJbVBpXcCvY+ET6JXcsWdHY6udE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785516623; c=relaxed/simple; bh=W5JGjzJwpvcvrtpf3/h5RQS7lGYaEquEicrdWaSVLj8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gPssNt6A4FI/BT7sZeLVj6mxV0UyIXuOursNa7liroB/nG1HulErEUW+NgtInBqgEASuhvcfCnGH2t4DBu230IbYWACKJgc5MTcyKj6IUBye+5uWnafh0yuWNyCmLk+7NgJJUKH8K2M+m+uvZzcz/mlEKB/zwDlO78C463MStCk= 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=M6rlJVMl; 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="M6rlJVMl" Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66VFloaZ2194591; Fri, 31 Jul 2026 16:50:10 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=8+nM+Elweo7CYkzIH Eo80qokqh76XrP+BRCVTvP2L9E=; b=M6rlJVMludljIXcRrvYQKHuTWqHtiz9eT dg2bRXMNg7h136YCElbtdveve6PMgL9tl3cAaMDThvQHtJXye9MyfgysgnqrR3c+ 2MH2b+1BG22VwBVhT0fc5Dhq3RXFhIbuCwh2pot4muDj3wF5+OmQAEAuaP+Mla7z 01GIZen+oGbtRe6hKNUbMKrH4Egl1WgabJRG7uftQDZQ4CNfLkA8cVssCMFOxOif a8Jl0vwwXWWD+Ij40sZp/4hQho8M4PkGy8BpES9FAOr5r3kSE7YAJxki2j4OXPde y/vciXxfHGlC3f48eU1dDUHIqNvN72dVTFlc2iEUCVbLZZ7GZF2BA== Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fmv0p514s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 31 Jul 2026 16:50:10 +0000 (GMT) Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66VGfPDC004522; Fri, 31 Jul 2026 16:50:09 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 4fn9pgrj6c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 31 Jul 2026 16:50:09 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66VGo5Ml41419246 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 31 Jul 2026 16:50:05 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 83C0A20040; Fri, 31 Jul 2026 16:50:05 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4D2092004B; Fri, 31 Jul 2026 16:50:05 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 31 Jul 2026 16:50:05 +0000 (GMT) From: Heiko Carstens To: Alexander Gordeev , Sven Schnelle , Vasily Gorbik , Christian Borntraeger , Harald Freudenberger , Holger Dengler , Vineeth Vijayan , Peter Oberparleiter , Janosch Frank , Claudio Imbrenda , David Hildenbrand , Peter Zijlstra , Herbert Xu Cc: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org Subject: [PATCH v4 2/4] KVM: s390: Remove cond_resched() calls Date: Fri, 31 Jul 2026 18:50:02 +0200 Message-ID: <20260731165004.2758105-3-hca@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260731165004.2758105-1-hca@linux.ibm.com> References: <20260731165004.2758105-1-hca@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzMxMDEyOCBTYWx0ZWRfX9tytjl7q9EUP /+h0sxkl/4kmXzNuYrX+8PEaSiwTxxkWIM5IXwtCAHrSa1zsR9xlWOL8yFB06SRf0/KFTqd23qg BZ/TFNyeZUkxbz01b3g+bqbH+czrWQ8= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzMxMDEyOCBTYWx0ZWRfX6UAMLlNusQjA 8EXwnfUctxOstHdNNsfQKRc8l40Eg0UNkM0/A0bvKcTvxAw8zGsOq88LIPPbrj3mVfBuRbXz7lm Phry7M1dXMSpPyBUGjZWrAZ9sQOmaN+X/O+mBLd0LTCMvNtS5REW7c8W7HKL6qiSVI8dEv3HLsf C+pQJNtODYieP84nvCXwStlWKMnexAmUa96JNgX3T9nyCNdhtxE2ogNyFTAqFtXLuMuG1n/iCsO 4fS2bQlRy8T0vY1f6l1pTeouRAb4qxI4t5VOl+ucaTG73ktDZZzlKx2pEBHKMGZtLo2cty/ZGVZ wNruQGAGL0BLpQFn5RkVoU3fXr7nV6T7nTRRkWqQhXXtT+melJHu37tVtwjKmEmnjF38Wvv1+0h 4I0Pem+hmXopZi4Hq0bDm/tzaH3bKfUDQO2w5gNSMneUjpV75b+v3dvRYciqSIAhgUvFzUKyv1M cDpQP6z357O93vexrAw== X-Authority-Analysis: v=2.4 cv=b5WCJNGx c=1 sm=1 tr=0 ts=6a6cd242 cx=c_pps a=AfN7/Ok6k8XGzOShvHwTGQ==:117 a=AfN7/Ok6k8XGzOShvHwTGQ==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=V8glGbnc2Ofi9Qvn3v5h:22 a=VnNF1IyMAAAA:8 a=jYxMFs5z4BTu7tBNxzoA:9 X-Proofpoint-GUID: bV5a5nWCI-uUuNW88lYqKrHaCGXhBBHV X-Proofpoint-ORIG-GUID: bV5a5nWCI-uUuNW88lYqKrHaCGXhBBHV X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-31_05,2026-07-30_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 spamscore=0 adultscore=0 malwarescore=0 impostorscore=0 bulkscore=0 phishscore=0 suspectscore=0 clxscore=1015 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607310128 Content-Type: text/plain; charset="utf-8" Since [1] cond_resched() is a no-op on s390. Remove all calls. This also entirely removes uv_call_sched() and replaces all call sites with uv_call(), since both functions are identical after the removal of cond_resched(). [1] commit 7dadeaa6e851 ("sched: Further restrict the preemption modes") Reviewed-by: Claudio Imbrenda Signed-off-by: Heiko Carstens --- arch/s390/include/asm/uv.h | 16 ++-------------- arch/s390/kernel/uv.c | 2 +- arch/s390/kvm/gaccess.c | 8 ++------ arch/s390/kvm/gmap.c | 4 ---- arch/s390/kvm/kvm-s390.c | 1 - arch/s390/kvm/pv.c | 11 +++++------ arch/s390/kvm/vsie.c | 1 - arch/s390/mm/gmap_helpers.c | 1 - drivers/s390/char/uvdevice.c | 6 +++--- 9 files changed, 13 insertions(+), 37 deletions(-) diff --git a/arch/s390/include/asm/uv.h b/arch/s390/include/asm/uv.h index d919e69662f5..89c9bb56c7e6 100644 --- a/arch/s390/include/asm/uv.h +++ b/arch/s390/include/asm/uv.h @@ -454,18 +454,6 @@ static inline int uv_call(unsigned long r1, unsigned l= ong r2) return cc; } =20 -/* Low level uv_call that avoids stalls for long running busy conditions = */ -static inline int uv_call_sched(unsigned long r1, unsigned long r2) -{ - int cc; - - do { - cc =3D __uv_call(r1, r2); - cond_resched(); - } while (cc > 1); - return cc; -} - /* * special variant of uv_call that only transports the cpu or guest * handle and the command, like destroy or verify. @@ -480,7 +468,7 @@ static inline int uv_cmd_nodata(u64 handle, u16 cmd, u1= 6 *rc, u16 *rrc) int cc; =20 WARN(!handle, "No handle provided to Ultravisor call cmd %x\n", cmd); - cc =3D uv_call_sched(0, (u64)&uvcb); + cc =3D uv_call(0, (u64)&uvcb); *rc =3D uvcb.header.rc; *rrc =3D uvcb.header.rrc; return cc ? -EINVAL : 0; @@ -518,7 +506,7 @@ static inline int uv_list_secrets(struct uv_secret_list= *buf, u16 start_idx, .start_idx =3D start_idx, .list_addr =3D (u64)buf, }; - int cc =3D uv_call_sched(0, (u64)&uvcb); + int cc =3D uv_call(0, (u64)&uvcb); =20 if (rc) *rc =3D uvcb.header.rc; diff --git a/arch/s390/kernel/uv.c b/arch/s390/kernel/uv.c index a284f98d9716..62841bb00a26 100644 --- a/arch/s390/kernel/uv.c +++ b/arch/s390/kernel/uv.c @@ -831,7 +831,7 @@ int uv_retrieve_secret(u16 secret_idx, u8 *buf, size_t = buf_size) .buf_size =3D buf_size, }; =20 - uv_call_sched(0, (u64)&uvcb); + uv_call(0, (u64)&uvcb); =20 switch (uvcb.header.rc) { case UVC_RC_EXECUTED: diff --git a/arch/s390/kvm/gaccess.c b/arch/s390/kvm/gaccess.c index 36102b2727fb..0d389a302a70 100644 --- a/arch/s390/kvm/gaccess.c +++ b/arch/s390/kvm/gaccess.c @@ -151,10 +151,8 @@ static void ipte_lock_simple(struct kvm *kvm) ic =3D &kvm->arch.sca->ipte_control; old =3D READ_ONCE(*ic); do { - if (old.k) { - cond_resched(); + if (old.k) goto retry; - } new =3D old; new.k =3D 1; } while (!try_cmpxchg(&ic->val, &old.val, new.val)); @@ -189,10 +187,8 @@ static void ipte_lock_siif(struct kvm *kvm) ic =3D &kvm->arch.sca->ipte_control; old =3D READ_ONCE(*ic); do { - if (old.kg) { - cond_resched(); + if (old.kg) goto retry; - } new =3D old; new.k =3D 1; new.kh++; diff --git a/arch/s390/kvm/gmap.c b/arch/s390/kvm/gmap.c index 8abb4f55b306..3758e4009709 100644 --- a/arch/s390/kvm/gmap.c +++ b/arch/s390/kvm/gmap.c @@ -941,7 +941,6 @@ void gmap_split_huge_pages(struct gmap *gmap) scoped_guard(read_lock, &gmap->kvm->mmu_lock) start =3D _dat_walk_gfn_range(start, asce_end(gmap->asce), gmap->asce, &ops, DAT_WALK_IGN_HOLES, gmap); - cond_resched(); } while (start); } =20 @@ -963,7 +962,6 @@ static int _gmap_enable_skeys(struct gmap *gmap) do { scoped_guard(write_lock, &gmap->kvm->mmu_lock) start =3D dat_reset_skeys(gmap->asce, start); - cond_resched(); } while (start); return 0; } @@ -1019,7 +1017,6 @@ int gmap_pv_destroy_range(struct gmap *gmap, gfn_t st= art, gfn_t end, bool interr DAT_WALK_IGN_HOLES, NULL); if (interruptible && fatal_signal_pending(current)) return -EINTR; - cond_resched(); } while (start && start < end); return 0; } @@ -1138,7 +1135,6 @@ void _gmap_set_cmma_all(struct gmap *gmap, bool dirty) gfn =3D _dat_walk_gfn_range(gfn, asce_end(gmap->asce), gmap->asce, &ops, DAT_WALK_IGN_HOLES, &gmap->kvm->arch.cmma_dirty_pages); - cond_resched(); } while (gfn); } =20 diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index 150b5dd2170e..2ede8f035a38 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c @@ -1027,7 +1027,6 @@ static int kvm_s390_set_mem_control(struct kvm *kvm, = struct kvm_device_attr *att do { scoped_guard(read_lock, &kvm->mmu_lock) start_gfn =3D dat_reset_cmma(kvm->arch.gmap->asce, start_gfn); - cond_resched(); } while (start_gfn); ret =3D 0; break; diff --git a/arch/s390/kvm/pv.c b/arch/s390/kvm/pv.c index 1beacc841ca8..54c17ddb6b11 100644 --- a/arch/s390/kvm/pv.c +++ b/arch/s390/kvm/pv.c @@ -429,7 +429,7 @@ static int kvm_s390_pv_deinit_vm_fast(struct kvm *kvm, = u16 *rc, u16 *rrc) }; int cc; =20 - cc =3D uv_call_sched(0, (u64)&uvcb); + cc =3D uv_call(0, (u64)&uvcb); if (rc) *rc =3D uvcb.header.rc; if (rrc) @@ -746,7 +746,7 @@ int kvm_s390_pv_init_vm(struct kvm *kvm, u16 *rc, u16 *= rrc) } gmap_split_huge_pages(kvm->arch.gmap); =20 - cc =3D uv_call_sched(0, (u64)&uvcb); + cc =3D uv_call(0, (u64)&uvcb); *rc =3D uvcb.header.rc; *rrc =3D uvcb.header.rrc; KVM_UV_EVENT(kvm, 3, "PROTVIRT CREATE VM: handle %llx len %llx rc %x rrc = %x flags %04x", @@ -832,7 +832,6 @@ int kvm_s390_pv_unpack(struct kvm *kvm, unsigned long a= ddr, unsigned long size, while (offset < size) { ret =3D unpack_one(kvm, addr, tweak, offset, rc, rrc); if (ret =3D=3D -EAGAIN) { - cond_resched(); if (fatal_signal_pending(current)) break; continue; @@ -875,7 +874,7 @@ int kvm_s390_pv_dump_cpu(struct kvm_vcpu *vcpu, void *b= uff, u16 *rc, u16 *rrc) }; int cc; =20 - cc =3D uv_call_sched(0, (u64)&uvcb); + cc =3D uv_call(0, (u64)&uvcb); *rc =3D uvcb.header.rc; *rrc =3D uvcb.header.rrc; return cc; @@ -959,7 +958,7 @@ int kvm_s390_pv_dump_stor_state(struct kvm *kvm, void _= _user *buff_user, /* We will loop until the user buffer is filled or an error occurs */ do { /* Get 1MB worth of guest storage state data */ - cc =3D uv_call_sched(0, (u64)&uvcb); + cc =3D uv_call(0, (u64)&uvcb); =20 /* All or nothing */ if (cc) { @@ -1037,7 +1036,7 @@ int kvm_s390_pv_dump_complete(struct kvm *kvm, void _= _user *buff_user, return -ENOMEM; complete.dump_area_origin =3D (u64)compl_data; =20 - ret =3D uv_call_sched(0, (u64)&complete); + ret =3D uv_call(0, (u64)&complete); *rc =3D complete.header.rc; *rrc =3D complete.header.rrc; KVM_UV_EVENT(kvm, 3, "PROTVIRT DUMP COMPLETE: rc %x rrc %x", diff --git a/arch/s390/kvm/vsie.c b/arch/s390/kvm/vsie.c index eea24562e7db..6dcd3b110c17 100644 --- a/arch/s390/kvm/vsie.c +++ b/arch/s390/kvm/vsie.c @@ -1434,7 +1434,6 @@ static int vsie_run(struct kvm_vcpu *vcpu, struct vsi= e_page *vsie_page) } if (sg) sg =3D gmap_put(sg); - cond_resched(); } if (sg) sg =3D gmap_put(sg); diff --git a/arch/s390/mm/gmap_helpers.c b/arch/s390/mm/gmap_helpers.c index 4bf7c9012feb..d564cdefb90f 100644 --- a/arch/s390/mm/gmap_helpers.c +++ b/arch/s390/mm/gmap_helpers.c @@ -272,7 +272,6 @@ static int __gmap_helper_unshare_zeropages(struct mm_st= ruct *mm) * truncation. In that case, the shared zeropage would be gone * and we can simply retry and make progress. */ - cond_resched(); goto retry; } =20 diff --git a/drivers/s390/char/uvdevice.c b/drivers/s390/char/uvdevice.c index e6a264c996ce..4d274a2ee84d 100644 --- a/drivers/s390/char/uvdevice.c +++ b/drivers/s390/char/uvdevice.c @@ -224,7 +224,7 @@ static int uvio_attestation(struct uvio_ioctl_cb *uv_io= ctl) if (ret) goto out; =20 - uv_call_sched(0, (u64)uvcb_attest); + uv_call(0, (u64)uvcb_attest); =20 uv_ioctl->uv_rc =3D uvcb_attest->header.rc; uv_ioctl->uv_rrc =3D uvcb_attest->header.rrc; @@ -291,7 +291,7 @@ static int uvio_add_secret(struct uvio_ioctl_cb *uv_ioc= tl) =20 ret =3D 0; uvcb.addr =3D (u64)asrcb; - uv_call_sched(0, (u64)&uvcb); + uv_call(0, (u64)&uvcb); uv_ioctl->uv_rc =3D uvcb.header.rc; uv_ioctl->uv_rrc =3D uvcb.header.rrc; =20 @@ -457,7 +457,7 @@ static int uvio_retr_secret(struct uvio_ioctl_cb *uv_io= ctl) =20 uvcb.buf_addr =3D (u64)buf; uvcb.buf_size =3D buf_len; - uv_call_sched(0, (u64)&uvcb); + uv_call(0, (u64)&uvcb); =20 if (copy_to_user((__user void *)uv_ioctl->argument_addr, buf, buf_len)) goto err; --=20 2.53.0 From nobody Fri Oct 2 12:19:38 2026 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 3594819DF62; Fri, 31 Jul 2026 16:50:19 +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=1785516623; cv=none; b=ObTr7vt5j9C1cVEJHwPS6ZfhBg7XMmwx4/sqcgCSTQwTjus89aG1PKN1wQwYBhH4AU5/V0K9J8NHO1MWcCoM9+ANpTM3y2SqhFb/2WKxkDdJ2IDk2TkK+T1TkHzk11yKZsrh1LT8nAir8ZObAtRyHji2GLGGOWwlAN3mjxMUYao= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785516623; c=relaxed/simple; bh=JbdAVIH/V+dcCTmGJRfR0JMfgH2g71CKT+aRIBUVV0E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LByOO8xnBYupw2Hzb9PxdQV5KbxjJJLPUJRMYSMsfJTUK1KgdTr08qJrrq+GiiHOQsMhaAB93FmYL+wlltIZze4niOXUCC6/D7LAZ35a3AlnwBAnFNSbVfdgCKzdxFajYLuGrex/id43dWDuAnt11Q3jVGGWgQl3nwM2ZctFKcw= 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=eFfG8lED; 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="eFfG8lED" Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66VFm0J02193162; Fri, 31 Jul 2026 16:50:11 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=tLbSk8vuz1zJt2j8B Iy4h/R21/y96gtErWLfHBvXfKs=; b=eFfG8lED4LAkeiooPSeEe+ReELNNUjuZY ii0wPIpnKStKZOi9UI4zDLfXPvIIKfT9EZr9irQRZ0j38sK+HnSnbFAkE4a3//tc eHvnON8ae/7PIQTh+vq5mAmqioNeZnnfETOEd+IWYii5aEQNSX2ZNLgYCvItZrjQ RHTS4plKANHdmO/vbHRSxmTIlG6BFQa7djWXI1enr6bbx1Wl06Jq2r76jbTcjin8 vzZQ+JuQdXgE2MYiz392O1sXA4hETRxG3LUuw8HYYoRAJermuPGwP6vWtwAUHf4P tZe4QGz5rvphSxOMECk8f2fl0xfFFkc+qG66+JKXqZYkutW/hKgmQ== Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fmuyjn1y8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 31 Jul 2026 16:50:10 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66VGfNqJ000465; Fri, 31 Jul 2026 16:50:09 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 4fna5ygfwh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 31 Jul 2026 16:50:09 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66VGo5hH50200908 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 31 Jul 2026 16:50:05 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B97D420040; Fri, 31 Jul 2026 16:50:05 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8863620043; Fri, 31 Jul 2026 16:50:05 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 31 Jul 2026 16:50:05 +0000 (GMT) From: Heiko Carstens To: Alexander Gordeev , Sven Schnelle , Vasily Gorbik , Christian Borntraeger , Harald Freudenberger , Holger Dengler , Vineeth Vijayan , Peter Oberparleiter , Janosch Frank , Claudio Imbrenda , David Hildenbrand , Peter Zijlstra , Herbert Xu Cc: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org Subject: [PATCH v4 3/4] s390: Remove cond_resched() calls Date: Fri, 31 Jul 2026 18:50:03 +0200 Message-ID: <20260731165004.2758105-4-hca@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260731165004.2758105-1-hca@linux.ibm.com> References: <20260731165004.2758105-1-hca@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzMxMDEyOCBTYWx0ZWRfX/IQLodZq2p/B WYkTCanc8oik67wClWhbNxS5TA8CyLjHq6b5R5zD1q37FjSgsDKaHlDQcVnh2qGHrgYPz7jk7fO UGLnbbvGG2di26dnfMQDnLN8Ow36U3o= X-Proofpoint-GUID: EmnMLjP07Lbq0G3a9vF0QKvRt9vn8cTe X-Proofpoint-ORIG-GUID: EmnMLjP07Lbq0G3a9vF0QKvRt9vn8cTe X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzMxMDEyOCBTYWx0ZWRfX0yLfq8wcpRMw oIYN7ZehrlveFzEVDMcqKloBXeR9rWaAyPfMGqfzp25Wkmh/FGt708FjGCh5iiKneTQEicngGzw U5vpSOl82QpGDak1Ap46QODmrn5mHtit7WA9YLFW49QtDv5gStHb9bbb+wrRLnO5KHl8wSgc427 aY4BimEFEELK5E6VMzNkxfgtIOT9++3zuPsl6+u7XTXXLcSbTBaCh0D+sZCx9qxoTaOsc/TZ7+M S9WM+/0KgyANK4loc5gwviBoFgQhaw5QKtPQsIMduZQIAbkwBzShGqNOQY0fnIuo53YdpWgg3z2 0FGJ6yJe2iPn/EwAP/j4A96YSPum3idhN4FjZt0CTGeEZVNt/D9oLqoXVfaOi+ixyuZmaFWD3sw ja/15uKQrA0GuvYDe/389H0itpCXv5Qu4nn06N3mOB7EKDKLsfEq7oJQXqtQccguxuOfgYOQ+0D 27ObH6TCqj6/5dsk50Q== X-Authority-Analysis: v=2.4 cv=X5Vi7mTe c=1 sm=1 tr=0 ts=6a6cd242 cx=c_pps a=aDMHemPKRhS1OARIsFnwRA==:117 a=aDMHemPKRhS1OARIsFnwRA==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=Y2IxJ9c9Rs8Kov3niI8_:22 a=VnNF1IyMAAAA:8 a=rF5c3LEHrUaPZy42MJMA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-31_05,2026-07-30_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 lowpriorityscore=0 phishscore=0 priorityscore=1501 malwarescore=0 spamscore=0 suspectscore=0 bulkscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607310128 Content-Type: text/plain; charset="utf-8" Since [1] cond_resched() is a no-op on s390. Remove all calls. [1] commit 7dadeaa6e851 ("sched: Further restrict the preemption modes") Signed-off-by: Heiko Carstens Reviewed-by: Vasily Gorbik --- arch/s390/kernel/perf_cpum_cf.c | 1 - arch/s390/mm/cmm.c | 2 -- arch/s390/mm/pageattr.c | 5 ----- arch/s390/mm/pgalloc.c | 1 - arch/s390/pci/pci.c | 4 +--- 5 files changed, 1 insertion(+), 12 deletions(-) diff --git a/arch/s390/kernel/perf_cpum_cf.c b/arch/s390/kernel/perf_cpum_c= f.c index 2076ac22e2c4..5f2596be6c1e 100644 --- a/arch/s390/kernel/perf_cpum_cf.c +++ b/arch/s390/kernel/perf_cpum_cf.c @@ -1496,7 +1496,6 @@ static int cfset_all_copy(unsigned long arg, cpumask_= t *mask) goto out; } uptr +=3D sizeof(struct s390_ctrset_cpudata) + cpuhw->used; - cond_resched(); } cpus =3D cpumask_weight(mask); if (put_user(cpus, &ctrset_read->no_cpus)) diff --git a/arch/s390/mm/cmm.c b/arch/s390/mm/cmm.c index eb7ef63fab1e..d342b68ee9be 100644 --- a/arch/s390/mm/cmm.c +++ b/arch/s390/mm/cmm.c @@ -95,7 +95,6 @@ static long cmm_alloc_pages(long nr, long *counter, (*counter)++; spin_unlock(&cmm_lock); nr--; - cond_resched(); } return nr; } @@ -134,7 +133,6 @@ static long cmm_free_pages(long nr, long *counter, stru= ct cmm_page_array **list) inc =3D __cmm_free_pages(inc, counter, list); if (inc) break; - cond_resched(); } return nr + inc; } diff --git a/arch/s390/mm/pageattr.c b/arch/s390/mm/pageattr.c index e6f788696dd1..1e202e3d08e7 100644 --- a/arch/s390/mm/pageattr.c +++ b/arch/s390/mm/pageattr.c @@ -105,7 +105,6 @@ static int walk_pte_level(pmd_t *pmdp, unsigned long ad= dr, unsigned long end, pgt_set((unsigned long *)ptep, pte_val(new), addr, CRDTE_DTT_PAGE); ptep++; addr +=3D PAGE_SIZE; - cond_resched(); } while (addr < end); return 0; } @@ -194,7 +193,6 @@ static int walk_pmd_level(pud_t *pudp, unsigned long ad= dr, unsigned long end, } pmdp++; addr =3D next; - cond_resched(); } while (addr < end); return rc; } @@ -281,7 +279,6 @@ static int walk_pud_level(p4d_t *p4d, unsigned long add= r, unsigned long end, } pudp++; addr =3D next; - cond_resched(); } while (addr < end && !rc); return rc; } @@ -301,7 +298,6 @@ static int walk_p4d_level(pgd_t *pgd, unsigned long add= r, unsigned long end, rc =3D walk_pud_level(p4dp, addr, next, flags); p4dp++; addr =3D next; - cond_resched(); } while (addr < end && !rc); return rc; } @@ -323,7 +319,6 @@ static int change_page_attr(unsigned long addr, unsigne= d long end, rc =3D walk_p4d_level(pgdp, addr, next, flags); if (rc) break; - cond_resched(); } while (pgdp++, addr =3D next, addr < end && !rc); return rc; } diff --git a/arch/s390/mm/pgalloc.c b/arch/s390/mm/pgalloc.c index 7ac44543e051..9610770fcf6d 100644 --- a/arch/s390/mm/pgalloc.c +++ b/arch/s390/mm/pgalloc.c @@ -268,7 +268,6 @@ static int base_segment_walk(unsigned long *origin, uns= igned long addr, return rc; if (!alloc) base_pgt_free(table); - cond_resched(); } while (ste++, addr =3D next, addr < end); return 0; } diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c index 39bd2adfc240..2dec238f3f12 100644 --- a/arch/s390/pci/pci.c +++ b/arch/s390/pci/pci.c @@ -1173,10 +1173,8 @@ int zpci_scan_devices(void) return rc; =20 zpci_add_devices(&scan_list); - zpci_bus_for_each(zbus) { + zpci_bus_for_each(zbus) zpci_bus_scan_bus(zbus); - cond_resched(); - } return 0; } =20 --=20 2.53.0 From nobody Fri Oct 2 12:19:38 2026 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (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 3D09F23D7F0; Fri, 31 Jul 2026 16:50:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785516621; cv=none; b=X8i78PVA5ASlS21lUG5vMIr01PIhPVKraC7YnlrELQWLhdj/ydSMXeqkgHAh6LnhYhoxMnsgNxqony/gEBlIC+VbBcFmiZUq25myZQN4FFqHMTRtRGB47I25bnKgSHXsmSJvwzlmsB3yfIIdtDplkOESJEvapLkQn/L29IlyeaQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785516621; c=relaxed/simple; bh=+48OdW2c+eMcu7qH9gjWRZnUcX90oCow45HZ5Uma/8E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=p0ZDjmTVRNS0/pFEbv060H7j1nbqsAWdqdl92nrmdhHLRbL7+hX/Pt+z9Ofy8POcRJU+2G6b+cbL/T3B5IGpHbRkryqf8Iv3wfVq0SZYYpWcF0qEAFLqvQa6hvgtBSuPBDZ3/vwjPz1zFV7ZQZO/4ugMk/XLU4AMqvSW8BoLIDw= 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=IMb/w1CY; arc=none smtp.client-ip=148.163.156.1 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="IMb/w1CY" Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66VFlsEM402627; Fri, 31 Jul 2026 16:50:11 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=GsS/PcaiZHkSIqKAt n0OpAFt9rSX4OlSrapO6SOezxA=; b=IMb/w1CYyhHKxPnAWfdJTgT5+4+WjaNZH zMP866HxbW1oP0l3C2CcCOlSz5IEJy8al08wA2hn7GQ5gsmfFk21xEDvb+QauD2q 3ynI+U1Y8Hn+IHyz1HJyJ/KWclD0Jw4sxTLHM6Zf1OyDYjTPPgmhfK+DTR4ZvJm1 PHYJWU8G1tHlB5F0Si9WIj+h2ja9kZKGqAwi7l3e4aNXubDgmMJqiL2lNtn108bL /p8zswMVTaGQvtcBVwKP0oDoetqfwb+Gd6P4Z1JA0JO1ERnXTQpTURGLuXTn1wgl lL8h/2GnwkxgHy8wyrbKkWiTdOVl/ifbBOtsFL0gUead8tYXjL2sA== Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fmuycx1bw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 31 Jul 2026 16:50:11 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66VGfNbd000455; Fri, 31 Jul 2026 16:50:10 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 4fna5ygfwk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 31 Jul 2026 16:50:10 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66VGo63P45875616 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 31 Jul 2026 16:50:06 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 00EA920040; Fri, 31 Jul 2026 16:50:06 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BE2F72004B; Fri, 31 Jul 2026 16:50:05 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 31 Jul 2026 16:50:05 +0000 (GMT) From: Heiko Carstens To: Alexander Gordeev , Sven Schnelle , Vasily Gorbik , Christian Borntraeger , Harald Freudenberger , Holger Dengler , Vineeth Vijayan , Peter Oberparleiter , Janosch Frank , Claudio Imbrenda , David Hildenbrand , Peter Zijlstra , Herbert Xu Cc: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org Subject: [PATCH v4 4/4] s390/cio: Remove cond_resched() calls Date: Fri, 31 Jul 2026 18:50:04 +0200 Message-ID: <20260731165004.2758105-5-hca@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260731165004.2758105-1-hca@linux.ibm.com> References: <20260731165004.2758105-1-hca@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: LybXybKLUth0mOxJgDxmIWx26iJTIbRS X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzMxMDEyOCBTYWx0ZWRfX6bmlGG4+qc/p lKr1t6aMhXCXaRYJEe5r4wVITX859DvFdB6S017vaLQMPWzIpv+1UhA95MFTQx7yn8E1AOKdH1h /6+seTBNTb3ONI7xkB0Oq9jHRXh1PMA4HAjRJtxwwPmGiT5MVfh/YPyUt7t8oEzImxTYWlTDrCn CBtXKIA7r6aZle0MDh8uqxEh5f9tULhNBjX1crn8IDHyAq7Q/eLtMBVYsLIKSWYGy1HyP6JPAIg A6XWoyhPcrbToNm4pNGS2c9QKZlYx+xzsmiAdbMzuN8JxrC21jPmhXZmTv716dPDxpmSctfwhkj IdJLZIStS7UgIodVyNUFnQ9Tn29NlNmvf3S3nxDvvUkeB7eFo2IF7zhxAkZAzSbGPSJekyID/z2 JF+F0gNe+ezk89iUJ8oT5pnqBI8ttPbpVlLctXKYCiXErHyLmNHZyV6NGnlFW2KJLO+04Lgs5g8 BNfmz6Ba5U/EePAjRyg== X-Proofpoint-Spam-Info: AW1haW4tMjYwNzMxMDEyOCBTYWx0ZWRfXy7tO6DTI2rwe kLxIsbB2NXhZM47O1Y4UJS4rTclQJAwd4oezfDguvm0Mwuo7h9SfbR8aNObUzC+b9pDAlRC1nr5 87vVJ38CXJwGkIYyQdoaB8CkcueM7B0= X-Authority-Analysis: v=2.4 cv=AZeB2XXG c=1 sm=1 tr=0 ts=6a6cd243 cx=c_pps a=aDMHemPKRhS1OARIsFnwRA==:117 a=aDMHemPKRhS1OARIsFnwRA==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=uAbxVGIbfxUO_5tXvNgY:22 a=VnNF1IyMAAAA:8 a=yDFob_ultygKJmZAZNUA:9 a=O8hF6Hzn-FEA:10 X-Proofpoint-GUID: LybXybKLUth0mOxJgDxmIWx26iJTIbRS X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-31_05,2026-07-30_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 priorityscore=1501 phishscore=0 adultscore=0 impostorscore=0 clxscore=1015 malwarescore=0 suspectscore=0 lowpriorityscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607310128 Content-Type: text/plain; charset="utf-8" Since [1] cond_resched() is a no-op on s390. Remove all calls. [1] commit 7dadeaa6e851 ("sched: Further restrict the preemption modes") Reviewed-by: Peter Oberparleiter Signed-off-by: Heiko Carstens --- drivers/s390/cio/css.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c index e5a0ec6b4e3e..54b8b8639694 100644 --- a/drivers/s390/cio/css.c +++ b/drivers/s390/cio/css.c @@ -618,11 +618,6 @@ static int slow_eval_known_fn(struct subchannel *sch, = void *data) rc =3D css_evaluate_known_subchannel(sch, 1); if (rc =3D=3D -EAGAIN) css_schedule_eval(sch->schid); - /* - * The loop might take long time for platforms with lots of - * known devices. Allow scheduling here. - */ - cond_resched(); } return 0; } @@ -654,9 +649,6 @@ static int slow_eval_unknown_fn(struct subchannel_id sc= hid, void *data) default: rc =3D 0; } - /* Allow scheduling here since the containing loop might - * take a while. */ - cond_resched(); } return rc; } --=20 2.53.0