* [PATCH] tpm,tpm_tis: Avoid warning splat at shutdown
@ 2024-02-01 11:36 Lino Sanfilippo
2024-02-01 16:40 ` Elliott, Robert (Servers)
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Lino Sanfilippo @ 2024-02-01 11:36 UTC (permalink / raw)
To: jarkko, peterhuewe
Cc: LinoSanfilippo, p.rosenberger, lukas, jgg, linux-integrity,
linux-kernel, Lino Sanfilippo, stable
If interrupts are not activated the work struct 'free_irq_work' is not
initialized. This results in a warning splat at module shutdown.
Fix this by always initializing the work regardless of whether interrupts
are activated or not.
cc: stable@vger.kernel.org
Fixes: 481c2d14627d ("tpm,tpm_tis: Disable interrupts after 1000 unhandled IRQs")
Reported-by: Jarkko Sakkinen <jarkko@kernel.org>
Closes: https://lore.kernel.org/all/CX32RFOMJUQ0.3R4YCL9MDCB96@kernel.org/
Signed-off-by: Lino Sanfilippo <l.sanfilippo@kunbus.com>
---
drivers/char/tpm/tpm_tis_core.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
index 1b350412d8a6..64c875657687 100644
--- a/drivers/char/tpm/tpm_tis_core.c
+++ b/drivers/char/tpm/tpm_tis_core.c
@@ -919,8 +919,6 @@ static int tpm_tis_probe_irq_single(struct tpm_chip *chip, u32 intmask,
int rc;
u32 int_status;
- INIT_WORK(&priv->free_irq_work, tpm_tis_free_irq_func);
-
rc = devm_request_threaded_irq(chip->dev.parent, irq, NULL,
tis_int_handler, IRQF_ONESHOT | flags,
dev_name(&chip->dev), chip);
@@ -1132,6 +1130,7 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
priv->phy_ops = phy_ops;
priv->locality_count = 0;
mutex_init(&priv->locality_count_mutex);
+ INIT_WORK(&priv->free_irq_work, tpm_tis_free_irq_func);
dev_set_drvdata(&chip->dev, priv);
base-commit: 41bccc98fb7931d63d03f326a746ac4d429c1dd3
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* RE: [PATCH] tpm,tpm_tis: Avoid warning splat at shutdown
2024-02-01 11:36 [PATCH] tpm,tpm_tis: Avoid warning splat at shutdown Lino Sanfilippo
@ 2024-02-01 16:40 ` Elliott, Robert (Servers)
2024-02-01 23:18 ` Jarkko Sakkinen
2024-02-02 1:13 ` Lino Sanfilippo
2024-02-01 23:03 ` Jarkko Sakkinen
2024-03-05 15:43 ` Paul Menzel
2 siblings, 2 replies; 8+ messages in thread
From: Elliott, Robert (Servers) @ 2024-02-01 16:40 UTC (permalink / raw)
To: Lino Sanfilippo, jarkko, peterhuewe
Cc: LinoSanfilippo, p.rosenberger, lukas, jgg, linux-integrity,
linux-kernel, stable
> From: Lino Sanfilippo <l.sanfilippo@kunbus.com>
> Sent: Thursday, February 1, 2024 5:37 AM
> Subject: [PATCH] tpm,tpm_tis: Avoid warning splat at shutdown
>
> If interrupts are not activated the work struct 'free_irq_work' is not
> initialized. This results in a warning splat at module shutdown.
>
> Fix this by always initializing the work regardless of whether interrupts
> are activated or not.
That's using flush_work(), which just waits for one to complete. Is there
any case where multiple work entries could be queued, and cancel_work_sync()
would be necessary?
tpm_tis_probe_irq() has a loop calling tpm_tis_probe_irq_single()
for 3 to 15. Could each of those could trigger an interrupt storm and
call tpm_tis_revert_interrupts(), which calls schedule_work()?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] tpm,tpm_tis: Avoid warning splat at shutdown
2024-02-01 11:36 [PATCH] tpm,tpm_tis: Avoid warning splat at shutdown Lino Sanfilippo
2024-02-01 16:40 ` Elliott, Robert (Servers)
@ 2024-02-01 23:03 ` Jarkko Sakkinen
2024-03-05 15:43 ` Paul Menzel
2 siblings, 0 replies; 8+ messages in thread
From: Jarkko Sakkinen @ 2024-02-01 23:03 UTC (permalink / raw)
To: Lino Sanfilippo, peterhuewe
Cc: LinoSanfilippo, p.rosenberger, lukas, jgg, linux-integrity,
linux-kernel, stable
On Thu Feb 1, 2024 at 1:36 PM EET, Lino Sanfilippo wrote:
> If interrupts are not activated the work struct 'free_irq_work' is not
> initialized. This results in a warning splat at module shutdown.
>
> Fix this by always initializing the work regardless of whether interrupts
> are activated or not.
>
> cc: stable@vger.kernel.org
> Fixes: 481c2d14627d ("tpm,tpm_tis: Disable interrupts after 1000 unhandled IRQs")
> Reported-by: Jarkko Sakkinen <jarkko@kernel.org>
> Closes: https://lore.kernel.org/all/CX32RFOMJUQ0.3R4YCL9MDCB96@kernel.org/
> Signed-off-by: Lino Sanfilippo <l.sanfilippo@kunbus.com>
> ---
> drivers/char/tpm/tpm_tis_core.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
> index 1b350412d8a6..64c875657687 100644
> --- a/drivers/char/tpm/tpm_tis_core.c
> +++ b/drivers/char/tpm/tpm_tis_core.c
> @@ -919,8 +919,6 @@ static int tpm_tis_probe_irq_single(struct tpm_chip *chip, u32 intmask,
> int rc;
> u32 int_status;
>
> - INIT_WORK(&priv->free_irq_work, tpm_tis_free_irq_func);
> -
> rc = devm_request_threaded_irq(chip->dev.parent, irq, NULL,
> tis_int_handler, IRQF_ONESHOT | flags,
> dev_name(&chip->dev), chip);
> @@ -1132,6 +1130,7 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
> priv->phy_ops = phy_ops;
> priv->locality_count = 0;
> mutex_init(&priv->locality_count_mutex);
> + INIT_WORK(&priv->free_irq_work, tpm_tis_free_irq_func);
>
> dev_set_drvdata(&chip->dev, priv);
>
>
> base-commit: 41bccc98fb7931d63d03f326a746ac4d429c1dd3
Thank you had forgotten about this.
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
BR, Jarkko
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] tpm,tpm_tis: Avoid warning splat at shutdown
2024-02-01 16:40 ` Elliott, Robert (Servers)
@ 2024-02-01 23:18 ` Jarkko Sakkinen
2024-02-02 1:13 ` Lino Sanfilippo
1 sibling, 0 replies; 8+ messages in thread
From: Jarkko Sakkinen @ 2024-02-01 23:18 UTC (permalink / raw)
To: Elliott, Robert (Servers), Lino Sanfilippo, peterhuewe
Cc: LinoSanfilippo, p.rosenberger, lukas, jgg, linux-integrity,
linux-kernel, stable
On Thu Feb 1, 2024 at 6:40 PM EET, Elliott, Robert (Servers) wrote:
> > From: Lino Sanfilippo <l.sanfilippo@kunbus.com>
> > Sent: Thursday, February 1, 2024 5:37 AM
> > Subject: [PATCH] tpm,tpm_tis: Avoid warning splat at shutdown
> >
> > If interrupts are not activated the work struct 'free_irq_work' is not
> > initialized. This results in a warning splat at module shutdown.
> >
> > Fix this by always initializing the work regardless of whether interrupts
> > are activated or not.
>
> That's using flush_work(), which just waits for one to complete. Is there
> any case where multiple work entries could be queued, and cancel_work_sync()
> would be necessary?
Questions are cool but please explain how this aligns with the patch
review because I already accepted the patch.
Should I drop it based on this question, and if so, why?
> tpm_tis_probe_irq() has a loop calling tpm_tis_probe_irq_single()
> for 3 to 15. Could each of those could trigger an interrupt storm and
> call tpm_tis_revert_interrupts(), which calls schedule_work()?
AFAIK no based on that TPM_CHIP_FLAG_IRQ should take care of this.
BR, Jarkko
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] tpm,tpm_tis: Avoid warning splat at shutdown
2024-02-01 16:40 ` Elliott, Robert (Servers)
2024-02-01 23:18 ` Jarkko Sakkinen
@ 2024-02-02 1:13 ` Lino Sanfilippo
1 sibling, 0 replies; 8+ messages in thread
From: Lino Sanfilippo @ 2024-02-02 1:13 UTC (permalink / raw)
To: Elliott, Robert (Servers), jarkko, peterhuewe
Cc: LinoSanfilippo, p.rosenberger, lukas, jgg, linux-integrity,
linux-kernel, stable
On 01.02.24 17:40, Elliott, Robert (Servers) wrote:
> ATTENTION: This e-mail is from an external sender. Please check attachments and links before opening e.g. with mouseover.
>
>
>> From: Lino Sanfilippo <l.sanfilippo@kunbus.com>
>> Sent: Thursday, February 1, 2024 5:37 AM
>> Subject: [PATCH] tpm,tpm_tis: Avoid warning splat at shutdown
>>
>> If interrupts are not activated the work struct 'free_irq_work' is not
>> initialized. This results in a warning splat at module shutdown.
>>
>> Fix this by always initializing the work regardless of whether interrupts
>> are activated or not.
>
> That's using flush_work(), which just waits for one to complete. Is there
> any case where multiple work entries could be queued, and cancel_work_sync()
> would be necessary?
>
No. There is only one work struct (namely free_irq_work) and it can only be
queued once at a time (note that schedule_work() does not queue the same work
again if it is already queued).
> tpm_tis_probe_irq() has a loop calling tpm_tis_probe_irq_single()
> for 3 to 15. Could each of those could trigger an interrupt storm and
> call tpm_tis_revert_interrupts(), which calls schedule_work()?
>
>
The iteration stops as soon as there is an interrupt found that "works" (i.e.
as soon as one interrupt fires, see the "irq test" in tpm_tis_send()). If this
irq starts a storm it is handled by the implemented irq storm handling and
deactivated. No other interrupts are activated afterwards. So no,
I do not see that multiple interrupt storms are possible at the same time.
Regards,
Lino
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] tpm,tpm_tis: Avoid warning splat at shutdown
2024-02-01 11:36 [PATCH] tpm,tpm_tis: Avoid warning splat at shutdown Lino Sanfilippo
2024-02-01 16:40 ` Elliott, Robert (Servers)
2024-02-01 23:03 ` Jarkko Sakkinen
@ 2024-03-05 15:43 ` Paul Menzel
2024-03-07 20:05 ` Jarkko Sakkinen
2 siblings, 1 reply; 8+ messages in thread
From: Paul Menzel @ 2024-03-05 15:43 UTC (permalink / raw)
To: Lino Sanfilippo
Cc: jarkko, peterhuewe, LinoSanfilippo, p.rosenberger, lukas, jgg,
linux-integrity, linux-kernel, stable
Dear Lino,
Thank you for the patch.
Am 01.02.24 um 12:36 schrieb Lino Sanfilippo:
> If interrupts are not activated the work struct 'free_irq_work' is not
> initialized. This results in a warning splat at module shutdown.
>
> Fix this by always initializing the work regardless of whether interrupts
> are activated or not.
>
> cc: stable@vger.kernel.org
> Fixes: 481c2d14627d ("tpm,tpm_tis: Disable interrupts after 1000 unhandled IRQs")
> Reported-by: Jarkko Sakkinen <jarkko@kernel.org>
> Closes: https://lore.kernel.org/all/CX32RFOMJUQ0.3R4YCL9MDCB96@kernel.org/
> Signed-off-by: Lino Sanfilippo <l.sanfilippo@kunbus.com>
> ---
> drivers/char/tpm/tpm_tis_core.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
> index 1b350412d8a6..64c875657687 100644
> --- a/drivers/char/tpm/tpm_tis_core.c
> +++ b/drivers/char/tpm/tpm_tis_core.c
> @@ -919,8 +919,6 @@ static int tpm_tis_probe_irq_single(struct tpm_chip *chip, u32 intmask,
> int rc;
> u32 int_status;
>
> - INIT_WORK(&priv->free_irq_work, tpm_tis_free_irq_func);
> -
> rc = devm_request_threaded_irq(chip->dev.parent, irq, NULL,
> tis_int_handler, IRQF_ONESHOT | flags,
> dev_name(&chip->dev), chip);
> @@ -1132,6 +1130,7 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
> priv->phy_ops = phy_ops;
> priv->locality_count = 0;
> mutex_init(&priv->locality_count_mutex);
> + INIT_WORK(&priv->free_irq_work, tpm_tis_free_irq_func);
>
> dev_set_drvdata(&chip->dev, priv);
This is commit d6fb14208e22 in jarkko/next.
I tested this patch on top of Linux 6.8-rc7 on a Dell OptiPlex 5055 [1]
and it fixes the issue there too.
Kind regards,
Paul
[1]: https://lore.kernel.org/all/CYJ163J3I09U.2XMVZ0BLWV1Y1@seitikki/
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] tpm,tpm_tis: Avoid warning splat at shutdown
2024-03-05 15:43 ` Paul Menzel
@ 2024-03-07 20:05 ` Jarkko Sakkinen
2024-03-07 20:33 ` Paul Menzel
0 siblings, 1 reply; 8+ messages in thread
From: Jarkko Sakkinen @ 2024-03-07 20:05 UTC (permalink / raw)
To: Paul Menzel, Lino Sanfilippo
Cc: peterhuewe, LinoSanfilippo, p.rosenberger, lukas, jgg,
linux-integrity, linux-kernel, stable
On Tue Mar 5, 2024 at 5:43 PM EET, Paul Menzel wrote:
> Dear Lino,
>
>
> Thank you for the patch.
>
> Am 01.02.24 um 12:36 schrieb Lino Sanfilippo:
> > If interrupts are not activated the work struct 'free_irq_work' is not
> > initialized. This results in a warning splat at module shutdown.
> >
> > Fix this by always initializing the work regardless of whether interrupts
> > are activated or not.
> >
> > cc: stable@vger.kernel.org
> > Fixes: 481c2d14627d ("tpm,tpm_tis: Disable interrupts after 1000 unhandled IRQs")
> > Reported-by: Jarkko Sakkinen <jarkko@kernel.org>
> > Closes: https://lore.kernel.org/all/CX32RFOMJUQ0.3R4YCL9MDCB96@kernel.org/
> > Signed-off-by: Lino Sanfilippo <l.sanfilippo@kunbus.com>
> > ---
> > drivers/char/tpm/tpm_tis_core.c | 3 +--
> > 1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
> > index 1b350412d8a6..64c875657687 100644
> > --- a/drivers/char/tpm/tpm_tis_core.c
> > +++ b/drivers/char/tpm/tpm_tis_core.c
> > @@ -919,8 +919,6 @@ static int tpm_tis_probe_irq_single(struct tpm_chip *chip, u32 intmask,
> > int rc;
> > u32 int_status;
> >
> > - INIT_WORK(&priv->free_irq_work, tpm_tis_free_irq_func);
> > -
> > rc = devm_request_threaded_irq(chip->dev.parent, irq, NULL,
> > tis_int_handler, IRQF_ONESHOT | flags,
> > dev_name(&chip->dev), chip);
> > @@ -1132,6 +1130,7 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
> > priv->phy_ops = phy_ops;
> > priv->locality_count = 0;
> > mutex_init(&priv->locality_count_mutex);
> > + INIT_WORK(&priv->free_irq_work, tpm_tis_free_irq_func);
> >
> > dev_set_drvdata(&chip->dev, priv);
>
> This is commit d6fb14208e22 in jarkko/next.
>
> I tested this patch on top of Linux 6.8-rc7 on a Dell OptiPlex 5055 [1]
> and it fixes the issue there too.
Thanks!
If you don't mind I'll add your tested-by to the commit before I send
my next pull request to Linus?
BR, Jarkko
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] tpm,tpm_tis: Avoid warning splat at shutdown
2024-03-07 20:05 ` Jarkko Sakkinen
@ 2024-03-07 20:33 ` Paul Menzel
0 siblings, 0 replies; 8+ messages in thread
From: Paul Menzel @ 2024-03-07 20:33 UTC (permalink / raw)
To: Jarkko Sakkinen
Cc: Lino Sanfilippo, peterhuewe, LinoSanfilippo, p.rosenberger,
lukas, jgg, linux-integrity, linux-kernel, stable
Dear Jarkko,
Am 07.03.24 um 21:05 schrieb Jarkko Sakkinen:
> On Tue Mar 5, 2024 at 5:43 PM EET, Paul Menzel wrote:
>> Am 01.02.24 um 12:36 schrieb Lino Sanfilippo:
>>> If interrupts are not activated the work struct 'free_irq_work' is not
>>> initialized. This results in a warning splat at module shutdown.
>>>
>>> Fix this by always initializing the work regardless of whether interrupts
>>> are activated or not.
>>>
>>> cc: stable@vger.kernel.org
>>> Fixes: 481c2d14627d ("tpm,tpm_tis: Disable interrupts after 1000 unhandled IRQs")
>>> Reported-by: Jarkko Sakkinen <jarkko@kernel.org>
>>> Closes: https://lore.kernel.org/all/CX32RFOMJUQ0.3R4YCL9MDCB96@kernel.org/
>>> Signed-off-by: Lino Sanfilippo <l.sanfilippo@kunbus.com>
>>> ---
>>> drivers/char/tpm/tpm_tis_core.c | 3 +--
>>> 1 file changed, 1 insertion(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
>>> index 1b350412d8a6..64c875657687 100644
>>> --- a/drivers/char/tpm/tpm_tis_core.c
>>> +++ b/drivers/char/tpm/tpm_tis_core.c
>>> @@ -919,8 +919,6 @@ static int tpm_tis_probe_irq_single(struct tpm_chip *chip, u32 intmask,
>>> int rc;
>>> u32 int_status;
>>>
>>> - INIT_WORK(&priv->free_irq_work, tpm_tis_free_irq_func);
>>> -
>>> rc = devm_request_threaded_irq(chip->dev.parent, irq, NULL,
>>> tis_int_handler, IRQF_ONESHOT | flags,
>>> dev_name(&chip->dev), chip);
>>> @@ -1132,6 +1130,7 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
>>> priv->phy_ops = phy_ops;
>>> priv->locality_count = 0;
>>> mutex_init(&priv->locality_count_mutex);
>>> + INIT_WORK(&priv->free_irq_work, tpm_tis_free_irq_func);
>>>
>>> dev_set_drvdata(&chip->dev, priv);
>>
>> This is commit d6fb14208e22 in jarkko/next.
>>
>> I tested this patch on top of Linux 6.8-rc7 on a Dell OptiPlex 5055 [1]
>> and it fixes the issue there too.
>
> Thanks!
>
> If you don't mind I'll add your tested-by to the commit before I send
> my next pull request to Linus?
Sure, go ahead. I thought, it’s not going to be amended, and therefore
didn’t add the tag.
Tested-by: Paul Menzel <pmenzel@molgen.mpg.de>
Kind regards,
Paul
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-03-07 20:33 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-01 11:36 [PATCH] tpm,tpm_tis: Avoid warning splat at shutdown Lino Sanfilippo
2024-02-01 16:40 ` Elliott, Robert (Servers)
2024-02-01 23:18 ` Jarkko Sakkinen
2024-02-02 1:13 ` Lino Sanfilippo
2024-02-01 23:03 ` Jarkko Sakkinen
2024-03-05 15:43 ` Paul Menzel
2024-03-07 20:05 ` Jarkko Sakkinen
2024-03-07 20:33 ` Paul Menzel
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).