linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] firmware/arm_sdei: Fix invalid argument to unregister private events.
@ 2024-01-10  9:01 Levi Yun
  2024-01-15 13:01 ` Pierre Gondois
  0 siblings, 1 reply; 7+ messages in thread
From: Levi Yun @ 2024-01-10  9:01 UTC (permalink / raw)
  To: james.morse, pierre.gondois; +Cc: linux-arm-kernel, linux-kernel, Levi Yun

To unregister private events in device freeze, it should call
cpuhp_remove_state with sdei_hp_state not sdei_entry_point.
otherwise, it seems to fail on cpuhp_cb_check.

Signed-off-by: Levi Yun <ppbuk5246@gmail.com>
---
 drivers/firmware/arm_sdei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/firmware/arm_sdei.c b/drivers/firmware/arm_sdei.c
index 285fe7ad490d..3e8051fe8296 100644
--- a/drivers/firmware/arm_sdei.c
+++ b/drivers/firmware/arm_sdei.c
@@ -763,7 +763,7 @@ static int sdei_device_freeze(struct device *dev)
 	int err;
 
 	/* unregister private events */
-	cpuhp_remove_state(sdei_entry_point);
+	cpuhp_remove_state(sdei_hp_state);
 
 	err = sdei_unregister_shared();
 	if (err)
-- 
2.41.0


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

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

* Re: [PATCH] firmware/arm_sdei: Fix invalid argument to unregister private events.
  2024-01-10  9:01 [PATCH] firmware/arm_sdei: Fix invalid argument to unregister private events Levi Yun
@ 2024-01-15 13:01 ` Pierre Gondois
  2024-01-15 17:24   ` James Morse
  0 siblings, 1 reply; 7+ messages in thread
From: Pierre Gondois @ 2024-01-15 13:01 UTC (permalink / raw)
  To: Levi Yun, james.morse; +Cc: linux-arm-kernel, linux-kernel

Hello Levi,

On 1/10/24 10:01, Levi Yun wrote:
> To unregister private events in device freeze, it should call
> cpuhp_remove_state with sdei_hp_state not sdei_entry_point.
> otherwise, it seems to fail on cpuhp_cb_check.
> 

I think you can also add:
Fixes: d2c48b2387eb ("firmware: arm_sdei: Fix sleep from invalid context BUG")


> Signed-off-by: Levi Yun <ppbuk5246@gmail.com>
> ---
>   drivers/firmware/arm_sdei.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/firmware/arm_sdei.c b/drivers/firmware/arm_sdei.c
> index 285fe7ad490d..3e8051fe8296 100644
> --- a/drivers/firmware/arm_sdei.c
> +++ b/drivers/firmware/arm_sdei.c
> @@ -763,7 +763,7 @@ static int sdei_device_freeze(struct device *dev)
>   	int err;
>   
>   	/* unregister private events */
> -	cpuhp_remove_state(sdei_entry_point);
> +	cpuhp_remove_state(sdei_hp_state);

Maybe it would also be worth resetting 'sdei_hp_state':
   sdei_hp_state = 0;

>   
>   	err = sdei_unregister_shared();
>   	if (err)

Regards,
Pierre

_______________________________________________
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] 7+ messages in thread

* Re: [PATCH] firmware/arm_sdei: Fix invalid argument to unregister private events.
  2024-01-15 13:01 ` Pierre Gondois
@ 2024-01-15 17:24   ` James Morse
  2024-01-17 12:34     ` Yun Levi
  2024-01-18 20:15     ` [PATCH v2] " Levi Yun
  0 siblings, 2 replies; 7+ messages in thread
From: James Morse @ 2024-01-15 17:24 UTC (permalink / raw)
  To: Pierre Gondois, Levi Yun; +Cc: linux-arm-kernel, linux-kernel

Hi Levi, Pierre,

On 15/01/2024 13:01, Pierre Gondois wrote:
> On 1/10/24 10:01, Levi Yun wrote:
>> To unregister private events in device freeze, it should call
>> cpuhp_remove_state with sdei_hp_state not sdei_entry_point.
>> otherwise, it seems to fail on cpuhp_cb_check.

Oops. Well caught!


> I think you can also add:
> Fixes: d2c48b2387eb ("firmware: arm_sdei: Fix sleep from invalid context BUG")


>> diff --git a/drivers/firmware/arm_sdei.c b/drivers/firmware/arm_sdei.c
>> index 285fe7ad490d..3e8051fe8296 100644
>> --- a/drivers/firmware/arm_sdei.c
>> +++ b/drivers/firmware/arm_sdei.c
>> @@ -763,7 +763,7 @@ static int sdei_device_freeze(struct device *dev)
>>       int err;
>>         /* unregister private events */
>> -    cpuhp_remove_state(sdei_entry_point);
>> +    cpuhp_remove_state(sdei_hp_state);
> 
> Maybe it would also be worth resetting 'sdei_hp_state':
>   sdei_hp_state = 0;

The next call should always be 'thaw', which doesn't check this, but it's good to cleanup
stale values.

Regardless:
Reviewed-by: James Morse <james.morse@arm.com>


Thanks,

James

_______________________________________________
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] 7+ messages in thread

* Re: [PATCH] firmware/arm_sdei: Fix invalid argument to unregister private events.
  2024-01-15 17:24   ` James Morse
@ 2024-01-17 12:34     ` Yun Levi
  2024-01-18 14:14       ` Yun Levi
  2024-01-18 20:15     ` [PATCH v2] " Levi Yun
  1 sibling, 1 reply; 7+ messages in thread
From: Yun Levi @ 2024-01-17 12:34 UTC (permalink / raw)
  To: James Morse; +Cc: Pierre Gondois, linux-arm-kernel, linux-kernel

Hi James, Pierre.


> > I think you can also add:
> > Fixes: d2c48b2387eb ("firmware: arm_sdei: Fix sleep from invalid context BUG")

Thanks, I'll add this fix tag.

> >> diff --git a/drivers/firmware/arm_sdei.c b/drivers/firmware/arm_sdei.c
> >> index 285fe7ad490d..3e8051fe8296 100644
> >> --- a/drivers/firmware/arm_sdei.c
> >> +++ b/drivers/firmware/arm_sdei.c
> >> @@ -763,7 +763,7 @@ static int sdei_device_freeze(struct device *dev)
> >>       int err;
> >>         /* unregister private events */
> >> -    cpuhp_remove_state(sdei_entry_point);
> >> +    cpuhp_remove_state(sdei_hp_state);
> >
> > Maybe it would also be worth resetting 'sdei_hp_state':
> >   sdei_hp_state = 0;
>
> The next call should always be 'thaw', which doesn't check this, but it's good to cleanup
> stale values.
>
But, I think it should be checked on sdei_reboot_notifier.
otherwise, In the situation sdei device was freezed, when
sdei_reboot_notifier is called,
It would fail on cpuhp_cb_check too.

Should I add a sanity check on sdei_reboot_notifier in the next patch?

Many 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] 7+ messages in thread

* Re: [PATCH] firmware/arm_sdei: Fix invalid argument to unregister private events.
  2024-01-17 12:34     ` Yun Levi
@ 2024-01-18 14:14       ` Yun Levi
  0 siblings, 0 replies; 7+ messages in thread
From: Yun Levi @ 2024-01-18 14:14 UTC (permalink / raw)
  To: James Morse; +Cc: Pierre Gondois, linux-arm-kernel, linux-kernel

> But, I think it should be checked on sdei_reboot_notifier.
> otherwise, In the situation sdei device was freezed, when
> sdei_reboot_notifier is called,
> It would fail on cpuhp_cb_check too.
>
> Should I add a sanity check on sdei_reboot_notifier in the next patch?
>

Sorry to make a noise. Maybe there's no case for this.

_______________________________________________
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] 7+ messages in thread

* [PATCH v2] firmware/arm_sdei: Fix invalid argument to unregister private events.
  2024-01-15 17:24   ` James Morse
  2024-01-17 12:34     ` Yun Levi
@ 2024-01-18 20:15     ` Levi Yun
  2024-01-18 20:20       ` [PATCH v3] " Levi Yun
  1 sibling, 1 reply; 7+ messages in thread
From: Levi Yun @ 2024-01-18 20:15 UTC (permalink / raw)
  To: james.morse, pierre.gondois; +Cc: linux-arm-kernel, linux-kernel, Levi Yun

To unregister private events in device freeze, it should call
cpuhp_remove_state with sdei_hp_state not sdei_entry_point.
otherwise, it seems to fail on cpuhp_cb_check.

Fixes: d2c48b2387eb ("firmware: arm_sdei: Fix sleep from invalid context BUG")
Signed-off-by: Levi Yun <ppbuk5246@gmail.com>
Reviewed-by: James Morse <james.morse@arm.com>
---
Changes:
    v1->v2: add fixes tag and resetting sdei_hp_state

 drivers/firmware/arm_sdei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/firmware/arm_sdei.c b/drivers/firmware/arm_sdei.c
index 285fe7ad490d..3e8051fe8296 100644
--- a/drivers/firmware/arm_sdei.c
+++ b/drivers/firmware/arm_sdei.c
@@ -763,7 +763,7 @@ static int sdei_device_freeze(struct device *dev)
 	int err;

 	/* unregister private events */
-	cpuhp_remove_state(sdei_entry_point);
+	cpuhp_remove_state(sdei_hp_state);

 	err = sdei_unregister_shared();
 	if (err)
--
2.41.0

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

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

* [PATCH v3] firmware/arm_sdei: Fix invalid argument to unregister private events.
  2024-01-18 20:15     ` [PATCH v2] " Levi Yun
@ 2024-01-18 20:20       ` Levi Yun
  0 siblings, 0 replies; 7+ messages in thread
From: Levi Yun @ 2024-01-18 20:20 UTC (permalink / raw)
  To: james.morse, pierre.gondois; +Cc: linux-arm-kernel, linux-kernel, Levi Yun

To unregister private events in device freeze, it should call
cpuhp_remove_state with sdei_hp_state not sdei_entry_point.
otherwise, it seems to fail on cpuhp_cb_check.

Signed-off-by: Levi Yun <ppbuk5246@gmail.com>
Fixes: d2c48b2387eb ("firmware: arm_sdei: Fix sleep from invalid context BUG")
Reviewed-by: James Morse <james.morse@arm.com>
---
Changes:
    v1->v2: add fixes tag and resetting sdei_hp_state
   v2->v3: add missing resetting sdei_hp_state.

 drivers/firmware/arm_sdei.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/arm_sdei.c b/drivers/firmware/arm_sdei.c
index 285fe7ad490d..973972d50287 100644
--- a/drivers/firmware/arm_sdei.c
+++ b/drivers/firmware/arm_sdei.c
@@ -763,7 +763,9 @@ static int sdei_device_freeze(struct device *dev)
 	int err;

 	/* unregister private events */
-	cpuhp_remove_state(sdei_entry_point);
+	cpuhp_remove_state(sdei_hp_state);
+
+	sdei_hp_state = 0;

 	err = sdei_unregister_shared();
 	if (err)
--
2.41.0

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

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

end of thread, other threads:[~2024-01-18 20:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-10  9:01 [PATCH] firmware/arm_sdei: Fix invalid argument to unregister private events Levi Yun
2024-01-15 13:01 ` Pierre Gondois
2024-01-15 17:24   ` James Morse
2024-01-17 12:34     ` Yun Levi
2024-01-18 14:14       ` Yun Levi
2024-01-18 20:15     ` [PATCH v2] " Levi Yun
2024-01-18 20:20       ` [PATCH v3] " Levi Yun

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).