linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] optee: fix tee out of memory failure seen during kexec reboot
@ 2021-02-18 20:03 Dhananjay Phadke
  2021-02-22 12:45 ` Allen Pais
  0 siblings, 1 reply; 6+ messages in thread
From: Dhananjay Phadke @ 2021-02-18 20:03 UTC (permalink / raw)
  To: allen.lkml, jens.wiklander, zajec5
  Cc: linux-kernel, linux-mips, op-tee, bcm-kernel-feedback-list, apais,
	linux-arm-kernel

From: Allen Pais <allen.lkml@gmail.com>

On Wed, 17 Feb 2021 14:57:12 +0530, Allen Pais wrote:
> -	/*
> -	 * Ask OP-TEE to free all cached shared memory objects to decrease
> -	 * reference counters and also avoid wild pointers in secure world
> -	 * into the old shared memory range.
> -	 */
> -	optee_disable_shm_cache(optee);
> +	if (shutdown) {
> +		optee_disable_shm_cache(optee);
> +	} else {
> +		/*
> +		 * Ask OP-TEE to free all cached shared memory
> +		 * objects to decrease reference counters and
> +		 * also avoid wild pointers in secure world
> +		 * into the old shared memory range.
> +		 */
> +		optee_disable_shm_cache(optee);
 
Calling optee_disable_shm_cache() in both if and else. It could be
put in front of if().


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] optee: fix tee out of memory failure seen during kexec reboot
  2021-02-18 20:03 [PATCH 1/2] optee: fix tee out of memory failure seen during kexec reboot Dhananjay Phadke
@ 2021-02-22 12:45 ` Allen Pais
  2021-02-23  8:19   ` Jens Wiklander
  0 siblings, 1 reply; 6+ messages in thread
From: Allen Pais @ 2021-02-22 12:45 UTC (permalink / raw)
  To: Dhananjay Phadke, allen.lkml, jens.wiklander, zajec5
  Cc: op-tee, bcm-kernel-feedback-list, linux-kernel, linux-arm-kernel,
	linux-mips


> On Wed, 17 Feb 2021 14:57:12 +0530, Allen Pais wrote:
>> -	/*
>> -	 * Ask OP-TEE to free all cached shared memory objects to decrease
>> -	 * reference counters and also avoid wild pointers in secure world
>> -	 * into the old shared memory range.
>> -	 */
>> -	optee_disable_shm_cache(optee);
>> +	if (shutdown) {
>> +		optee_disable_shm_cache(optee);
>> +	} else {
>> +		/*
>> +		 * Ask OP-TEE to free all cached shared memory
>> +		 * objects to decrease reference counters and
>> +		 * also avoid wild pointers in secure world
>> +		 * into the old shared memory range.
>> +		 */
>> +		optee_disable_shm_cache(optee);
>   
> Calling optee_disable_shm_cache() in both if and else. It could be
> put in front of if().
> 

   Ideally, I could just use optee_remove for shutdown() too.
But it would not look good. Hence this approach.

- Allen

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] optee: fix tee out of memory failure seen during kexec reboot
  2021-02-22 12:45 ` Allen Pais
@ 2021-02-23  8:19   ` Jens Wiklander
  2021-02-23 16:26     ` Allen Pais
  0 siblings, 1 reply; 6+ messages in thread
From: Jens Wiklander @ 2021-02-23  8:19 UTC (permalink / raw)
  To: Allen Pais
  Cc: zajec5, linux-kernel, linux-mips, op-tee,
	bcm-kernel-feedback-list, Dhananjay Phadke, allen.lkml,
	linux-arm-kernel

On Mon, Feb 22, 2021 at 06:15:08PM +0530, Allen Pais wrote:
> 
> > On Wed, 17 Feb 2021 14:57:12 +0530, Allen Pais wrote:
> > > -	/*
> > > -	 * Ask OP-TEE to free all cached shared memory objects to decrease
> > > -	 * reference counters and also avoid wild pointers in secure world
> > > -	 * into the old shared memory range.
> > > -	 */
> > > -	optee_disable_shm_cache(optee);
> > > +	if (shutdown) {
> > > +		optee_disable_shm_cache(optee);
> > > +	} else {
> > > +		/*
> > > +		 * Ask OP-TEE to free all cached shared memory
> > > +		 * objects to decrease reference counters and
> > > +		 * also avoid wild pointers in secure world
> > > +		 * into the old shared memory range.
> > > +		 */
> > > +		optee_disable_shm_cache(optee);
> > Calling optee_disable_shm_cache() in both if and else. It could be
> > put in front of if().
> > 
> 
>   Ideally, I could just use optee_remove for shutdown() too.
> But it would not look good. Hence this approach.

What is the problem with using optee_remove() for shutdown()?

Cheers,
Jens

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] optee: fix tee out of memory failure seen during kexec reboot
  2021-02-23  8:19   ` Jens Wiklander
@ 2021-02-23 16:26     ` Allen Pais
  2021-02-24  8:15       ` Jens Wiklander
  0 siblings, 1 reply; 6+ messages in thread
From: Allen Pais @ 2021-02-23 16:26 UTC (permalink / raw)
  To: Jens Wiklander
  Cc: zajec5, linux-kernel, linux-mips, op-tee,
	bcm-kernel-feedback-list, Dhananjay Phadke, allen.lkml,
	linux-arm-kernel



>>>> -	/*
>>>> -	 * Ask OP-TEE to free all cached shared memory objects to decrease
>>>> -	 * reference counters and also avoid wild pointers in secure world
>>>> -	 * into the old shared memory range.
>>>> -	 */
>>>> -	optee_disable_shm_cache(optee);
>>>> +	if (shutdown) {
>>>> +		optee_disable_shm_cache(optee);
>>>> +	} else {
>>>> +		/*
>>>> +		 * Ask OP-TEE to free all cached shared memory
>>>> +		 * objects to decrease reference counters and
>>>> +		 * also avoid wild pointers in secure world
>>>> +		 * into the old shared memory range.
>>>> +		 */
>>>> +		optee_disable_shm_cache(optee);
>>> Calling optee_disable_shm_cache() in both if and else. It could be
>>> put in front of if().
>>>
>>
>>    Ideally, I could just use optee_remove for shutdown() too.
>> But it would not look good. Hence this approach.
> 
> What is the problem with using optee_remove() for shutdown()?
> 

  There is no problem, I just thought it would be more cleaner/readable
with this approach. If you'd like to keep it simple by just calling
optee_remove() for shutdown() too, I could quickly send out V2.

Thanks for the review.

- Allen

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] optee: fix tee out of memory failure seen during kexec reboot
  2021-02-23 16:26     ` Allen Pais
@ 2021-02-24  8:15       ` Jens Wiklander
  2021-02-24 16:53         ` Allen Pais
  0 siblings, 1 reply; 6+ messages in thread
From: Jens Wiklander @ 2021-02-24  8:15 UTC (permalink / raw)
  To: Allen Pais
  Cc: zajec5, linux-kernel, linux-mips, op-tee,
	bcm-kernel-feedback-list, Dhananjay Phadke, allen.lkml,
	linux-arm-kernel

On Tue, Feb 23, 2021 at 09:56:13PM +0530, Allen Pais wrote:
> 
> 
> > > > > -	/*
> > > > > -	 * Ask OP-TEE to free all cached shared memory objects to decrease
> > > > > -	 * reference counters and also avoid wild pointers in secure world
> > > > > -	 * into the old shared memory range.
> > > > > -	 */
> > > > > -	optee_disable_shm_cache(optee);
> > > > > +	if (shutdown) {
> > > > > +		optee_disable_shm_cache(optee);
> > > > > +	} else {
> > > > > +		/*
> > > > > +		 * Ask OP-TEE to free all cached shared memory
> > > > > +		 * objects to decrease reference counters and
> > > > > +		 * also avoid wild pointers in secure world
> > > > > +		 * into the old shared memory range.
> > > > > +		 */
> > > > > +		optee_disable_shm_cache(optee);
> > > > Calling optee_disable_shm_cache() in both if and else. It could be
> > > > put in front of if().
> > > > 
> > > 
> > >    Ideally, I could just use optee_remove for shutdown() too.
> > > But it would not look good. Hence this approach.
> > 
> > What is the problem with using optee_remove() for shutdown()?
> > 
> 
>  There is no problem, I just thought it would be more cleaner/readable
> with this approach. If you'd like to keep it simple by just calling
> optee_remove() for shutdown() too, I could quickly send out V2.

In the patch you posted it looks like you'd like to call
only optee_disable_shm_cache() in the case of shutdown. Like:

static void optee_shutdown(struct platform_device *pdev)
{
        optee_disable_shm_cache(platform_get_drvdata(pdev));
}

and optee_remove() kept as it was before this patch.

Cheers,
Jens

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] optee: fix tee out of memory failure seen during kexec reboot
  2021-02-24  8:15       ` Jens Wiklander
@ 2021-02-24 16:53         ` Allen Pais
  0 siblings, 0 replies; 6+ messages in thread
From: Allen Pais @ 2021-02-24 16:53 UTC (permalink / raw)
  To: Jens Wiklander
  Cc: zajec5, linux-kernel, linux-mips, op-tee,
	bcm-kernel-feedback-list, Dhananjay Phadke, allen.lkml,
	linux-arm-kernel


>>>>>> -	/*
>>>>>> -	 * Ask OP-TEE to free all cached shared memory objects to decrease
>>>>>> -	 * reference counters and also avoid wild pointers in secure world
>>>>>> -	 * into the old shared memory range.
>>>>>> -	 */
>>>>>> -	optee_disable_shm_cache(optee);
>>>>>> +	if (shutdown) {
>>>>>> +		optee_disable_shm_cache(optee);
>>>>>> +	} else {
>>>>>> +		/*
>>>>>> +		 * Ask OP-TEE to free all cached shared memory
>>>>>> +		 * objects to decrease reference counters and
>>>>>> +		 * also avoid wild pointers in secure world
>>>>>> +		 * into the old shared memory range.
>>>>>> +		 */
>>>>>> +		optee_disable_shm_cache(optee);
>>>>> Calling optee_disable_shm_cache() in both if and else. It could be
>>>>> put in front of if().
>>>>>
>>>>
>>>>     Ideally, I could just use optee_remove for shutdown() too.
>>>> But it would not look good. Hence this approach.
>>>
>>> What is the problem with using optee_remove() for shutdown()?
>>>
>>
>>   There is no problem, I just thought it would be more cleaner/readable
>> with this approach. If you'd like to keep it simple by just calling
>> optee_remove() for shutdown() too, I could quickly send out V2.
> 
> In the patch you posted it looks like you'd like to call
> only optee_disable_shm_cache() in the case of shutdown. Like:
> 
> static void optee_shutdown(struct platform_device *pdev)
> {
>          optee_disable_shm_cache(platform_get_drvdata(pdev));
> }
> 
> and optee_remove() kept as it was before this patch.
> 

  Sure, Will have it fixed and send out V2.

Thanks.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-02-24 16:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-18 20:03 [PATCH 1/2] optee: fix tee out of memory failure seen during kexec reboot Dhananjay Phadke
2021-02-22 12:45 ` Allen Pais
2021-02-23  8:19   ` Jens Wiklander
2021-02-23 16:26     ` Allen Pais
2021-02-24  8:15       ` Jens Wiklander
2021-02-24 16:53         ` Allen Pais

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).