Skip to contentSkip to conversation

tee: optee: remove need_resched() before cond_resched()

PATCH In review Jens Wiklander 4 participants 8 messages Jan 25, 2021 – Feb 3, 2021 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tee: optee: remove need_resched() before cond_resched()

Testing need_resched() before cond_resched() is not needed as an equivalent test is done internally in cond_resched(). So drop the need_resched() test.

Fixes dcb3b06d9c34 ("tee: optee: replace might_sleep with cond_resched")
---
 drivers/tee/optee/call.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/tee/optee/call.c +1 -2
index 780d7c4fd756..7a77e375b503 100644
@@ -149,8 +149,7 @@ u32 optee_do_call_with_arg(struct tee_context *ctx, phys_addr_t parg)
 			 */
 			optee_cq_wait_for_completion(&optee->call_queue, &w);
 		} else if (OPTEE_SMC_RETURN_IS_RPC(res.a0)) {
-			if (need_resched())
-				cond_resched();
+			cond_resched();
 			param.a0 = res.a0;
 			param.a1 = res.a1;
 			param.a2 = res.a2;
Signature · 1 line
2.25.1
#1 lore raw

Hi Rouven and Sumit,

Quoted 10 lines · Jens Wiklander

Testing need_resched() before cond_resched() is not needed as an equivalent test is done internally in cond_resched(). So drop the need_resched() test.

Fixes dcb3b06d9c34 ("tee: optee: replace might_sleep with cond_resched")
---
 drivers/tee/optee/call.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Can you please test to see that this works in your setups too?

Thanks,
Jens

A message that is not in the archive (sent off-list or not yet received): =?utf-8?q?=3C0100017738faac80-87e5cf40-6a5a-4727-9c36-382fb909c?= =?utf-8?q?8ff-000000=40email=2Eamazonses=2Ecom=3E?=

#4 lore raw

Hi Rouven and Sumit,

Quoted 10 lines · Jens Wiklander via OP-TEE

Hi Rouven and Sumit,

Quoted 5 lines · Jens Wiklander

Testing need_resched() before cond_resched() is not needed as an equivalent test is done internally in cond_resched(). So drop the need_resched() test.

Quoted 7 lines
Quoted 5 lines
Fixes dcb3b06d9c34 ("tee: optee: replace might_sleep with cond_resched")
---
 drivers/tee/optee/call.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Can you please test to see that this works in your setups too?

Does this work for you? I'd like to get this patch ready for v5.12.

Thanks,
Jens

#5 lore raw
Quoted 20 lines · Jens Wiklander

Hi Rouven and Sumit,

Quoted 16 lines · Jens Wiklander via OP-TEE

Hi Rouven and Sumit,

Quoted 10 lines · Jens Wiklander

Testing need_resched() before cond_resched() is not needed as an equivalent test is done internally in cond_resched(). So drop the need_resched() test.

Fixes dcb3b06d9c34 ("tee: optee: replace might_sleep with cond_resched")
---
  drivers/tee/optee/call.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
Quoted 3 lines
Quoted 1 line

Can you please test to see that this works in your setups too?

Does this work for you? I'd like to get this patch ready for v5.12.

Sorry I did not get to this yet, I'll need to modify the existing kernelconfig again to reproduce the buggy configuration. I'll get this done by monday.

Regards,
Rouven

Reviewed-by Tested-by
#6 lore raw
In reply to Jens Wiklander

Hi Jens,

Quoted 20 lines · Jens Wiklander

Hi Rouven and Sumit,

Quoted 16 lines · Jens Wiklander via OP-TEE

Hi Rouven and Sumit,

Quoted 10 lines · Jens Wiklander

Testing need_resched() before cond_resched() is not needed as an equivalent test is done internally in cond_resched(). So drop the need_resched() test.

Fixes dcb3b06d9c34 ("tee: optee: replace might_sleep with cond_resched")
---
  drivers/tee/optee/call.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
Quoted 3 lines
Quoted 1 line

Can you please test to see that this works in your setups too?

Does this work for you? I'd like to get this patch ready for v5.12.

Yes it does. I also looked at it right after Arnds mail, so for future reference:

cond_resched()

_cond_resched() (ifndef CONFIG_PREEMPTION)

     should_resched(0)

       tif_need_resched() (+ preempt_count == 0 for current thread)

while:

need_resched()

tif_need_resched()

You can add my

I also retested on the STM32-DK2 and the problem remains fixed:

Regrads and thanks for the patch,
Rouven

Tested-by
#7 lore raw
In reply to Jens Wiklander

Hi Jens,

Quoted 21 lines · Jens Wiklander

Hi Rouven and Sumit,

Quoted 16 lines · Jens Wiklander via OP-TEE

Hi Rouven and Sumit,

Quoted 10 lines · Jens Wiklander

Testing need_resched() before cond_resched() is not needed as an equivalent test is done internally in cond_resched(). So drop the need_resched() test.

Fixes dcb3b06d9c34 ("tee: optee: replace might_sleep with cond_resched")
---
 drivers/tee/optee/call.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
Quoted 3 lines
Quoted 1 line

Can you please test to see that this works in your setups too?

Does this work for you? I'd like to get this patch ready for v5.12.

It does work for me as well.

-Sumit

Quoted 3 lines

Thanks,
Jens

#8 lore raw
In reply to Jens Wiklander
Quoted 20 lines · Jens Wiklander

Hi Rouven and Sumit,

Quoted 16 lines · Jens Wiklander via OP-TEE

Hi Rouven and Sumit,

Quoted 10 lines · Jens Wiklander

Testing need_resched() before cond_resched() is not needed as an equivalent test is done internally in cond_resched(). So drop the need_resched() test.

Fixes dcb3b06d9c34 ("tee: optee: replace might_sleep with cond_resched")
---
 drivers/tee/optee/call.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
Quoted 3 lines
Quoted 1 line

Can you please test to see that this works in your setups too?

Does this work for you? I'd like to get this patch ready for v5.12.

Thanks for the help with this patch. I'll submit this up for v5.12.

Cheers,
Jens