The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Harald Freudenberger <freude@linux.ibm.com>
To: Heiko Carstens <hca@linux.ibm.com>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>,
	Sven Schnelle <svens@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Christian Borntraeger <borntraeger@linux.ibm.com>,
	Holger Dengler <dengler@linux.ibm.com>,
	Vineeth Vijayan <vneethv@linux.ibm.com>,
	Peter Oberparleiter <oberpar@linux.ibm.com>,
	Janosch Frank <frankja@linux.ibm.com>,
	Claudio Imbrenda <imbrenda@linux.ibm.com>,
	David Hildenbrand <david@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/4] s390/crypto: Replace cond_resched() with schedule()
Date: Tue, 28 Jul 2026 09:05:16 +0200	[thread overview]
Message-ID: <f88846b24b1250f89b503b6ddfda318c@linux.ibm.com> (raw)
In-Reply-To: <20260727162430.1599396-2-hca@linux.ibm.com>

On 2026-07-27 18:24, Heiko Carstens wrote:
> The comment for all cond_resched() calls in crypto code says that the
> process should be scheduled away to avoid instant re-invocation of a
> callback. This is not what cond_resched() would do or did.
> 
> Replace cond_resched() with a call to schedule() which comes closer, 
> but
> it looks more like this code wants an msleep() call.
> 
> Note that with [1] cond_resched() is always compiled away and becomes a
> no-op.
> 
> [1] commit 7dadeaa6e851 ("sched: Further restrict the preemption 
> modes")
> 
> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
> ---
>  arch/s390/crypto/paes_s390.c  | 8 ++++----
>  arch/s390/crypto/phmac_s390.c | 4 ++--
>  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/s390/crypto/paes_s390.c 
> b/arch/s390/crypto/paes_s390.c
> index 8cfe6166c193..d02de945f864 100644
> --- a/arch/s390/crypto/paes_s390.c
> +++ b/arch/s390/crypto/paes_s390.c
> @@ -555,7 +555,7 @@ static int ecb_paes_do_one_request(struct
> crypto_engine *engine, void *areq)
>  		 * To avoid immediately re-invocation of this callback,
>  		 * tell the scheduler to voluntarily give up the CPU here.
>  		 */
> -		cond_resched();
> +		schedule();
>  		pr_debug("rescheduling request\n");
>  		return -ENOSPC;
>  	} else if (rc) {
> @@ -821,7 +821,7 @@ static int cbc_paes_do_one_request(struct
> crypto_engine *engine, void *areq)
>  		 * To avoid immediately re-invocation of this callback,
>  		 * tell the scheduler to voluntarily give up the CPU here.
>  		 */
> -		cond_resched();
> +		schedule();
>  		pr_debug("rescheduling request\n");
>  		return -ENOSPC;
>  	} else if (rc) {
> @@ -1129,7 +1129,7 @@ static int ctr_paes_do_one_request(struct
> crypto_engine *engine, void *areq)
>  		 * To avoid immediately re-invocation of this callback,
>  		 * tell the scheduler to voluntarily give up the CPU here.
>  		 */
> -		cond_resched();
> +		schedule();
>  		pr_debug("rescheduling request\n");
>  		return -ENOSPC;
>  	} else if (rc) {
> @@ -1572,7 +1572,7 @@ static int xts_paes_do_one_request(struct
> crypto_engine *engine, void *areq)
>  		 * To avoid immediately re-invocation of this callback,
>  		 * tell the scheduler to voluntarily give up the CPU here.
>  		 */
> -		cond_resched();
> +		schedule();
>  		pr_debug("rescheduling request\n");
>  		return -ENOSPC;
>  	} else if (rc) {
> diff --git a/arch/s390/crypto/phmac_s390.c 
> b/arch/s390/crypto/phmac_s390.c
> index 03ca33ffe6cc..bddfdcee6cb3 100644
> --- a/arch/s390/crypto/phmac_s390.c
> +++ b/arch/s390/crypto/phmac_s390.c
> @@ -895,7 +895,7 @@ static int phmac_do_one_request(struct
> crypto_engine *engine, void *areq)
>  			 * tell scheduler to voluntarily give up the CPU here.
>  			 */
>  			pr_debug("rescheduling request\n");
> -			cond_resched();
> +			schedule();
>  			return -ENOSPC;
>  		} else if (rc) {
>  			hwh_advance(hwh, rc);
> @@ -916,7 +916,7 @@ static int phmac_do_one_request(struct
> crypto_engine *engine, void *areq)
>  			 * tell scheduler to voluntarily give up the CPU here.
>  			 */
>  			pr_debug("rescheduling request\n");
> -			cond_resched();
> +			schedule();
>  			return -ENOSPC;
>  		}
>  		break;

Ok for me but we agreed to have all this code going via Herbert Xu.
So please address this patch to Herbert and the crypto mailing list.
And then I'll add my Reviewed-by.

  reply	other threads:[~2026-07-28  7:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-27 16:24 [PATCH 0/4] s390: Remove or replace cond_resched() calls Heiko Carstens
2026-07-27 16:24 ` [PATCH 1/4] s390/crypto: Replace cond_resched() with schedule() Heiko Carstens
2026-07-28  7:05   ` Harald Freudenberger [this message]
2026-07-28  8:29     ` Heiko Carstens
2026-07-28  8:53       ` Harald Freudenberger
2026-07-28  9:51       ` Holger Dengler
2026-07-28 12:06         ` Heiko Carstens
2026-07-28 10:43       ` Peter Zijlstra
2026-07-27 16:24 ` [PATCH 2/4] KVM: s390: Remove cond_resched() calls Heiko Carstens
2026-07-27 16:24 ` [PATCH 3/4] " Heiko Carstens
2026-07-27 16:24 ` [PATCH 4/4] s390/cio: " Heiko Carstens
2026-07-28  9:28   ` Peter Oberparleiter

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=f88846b24b1250f89b503b6ddfda318c@linux.ibm.com \
    --to=freude@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=david@kernel.org \
    --cc=dengler@linux.ibm.com \
    --cc=frankja@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=oberpar@linux.ibm.com \
    --cc=peterz@infradead.org \
    --cc=svens@linux.ibm.com \
    --cc=vneethv@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