tpm: WARN_ONCE() -> pr_warn_once() in tpm_tis_status()
Subsystems (3)
[email protected]
maintainerPATCH 1/1 tpm: WARN_ONCE() -> pr_warn_once() in tpm_tis_status()
From: Jarkko Sakkinen <[email protected]>
An unexpected status from TPM chip is not irrecovable failure of the kernel. It's only undesirable situation. Thus, change the WARN_ONCE instance inside tpm_tis_status() to pr_warn_once().
In addition: print the status in the log message because it is actually useful information lacking from the existing log message.
--- drivers/char/tpm/tpm_tis_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/tpm/tpm_tis_core.c +1 -1
@@ -202,7 +202,7 @@ static u8 tpm_tis_status(struct tpm_chip *chip)* acquired. Usually because tpm_try_get_ops() hasn't * been called before doing a TPM operation. */ -WARN_ONCE (1 ,"TPM returned invalid status\n" ); +pr_warn_once ("TPM returned invalid status: 0x%x\n" , status);return 0 ; }
Signature · 1 line
2.30.0
Quoted 6 lines · On 2/2/21 7:33 AM, [email protected] wrote:
From: Jarkko Sakkinen <[email protected]>
An unexpected status from TPM chip is not irrecovable failure of the kernel. It's only undesirable situation. Thus, change the
WARN_ONCEinstance insidetpm_tis_status()topr_warn_once().
Quoted 7 lines
In addition: print the status in the log message because it is actually useful information lacking from the existing log message.
Suggested-by Guenter Roeck <[email protected]>Fixes 6f4f57f0b909 ("tpm: ibmvtpm: fix error return code in tpm_ibmvtpm_probe()")Signed-off-by Jarkko Sakkinen <[email protected]>
Quoted 18 lines
--- drivers/char/tpm/tpm_tis_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/char/tpm/tpm_tis_core.c +1
-1@@ -202,7 +202,7 @@ static u8 tpm_tis_status(struct tpm_chip *chip)* acquired. Usually because tpm_try_get_ops() hasn't * been called before doing a TPM operation. */ -WARN_ONCE (1 ,"TPM returned invalid status\n" ); +pr_warn_once ("TPM returned invalid status: 0x%x\n" , status);return 0 ; }
Quoted 22 lines · On 2/2/21 10:33 AM, [email protected] wrote:
From: Jarkko Sakkinen <[email protected]>
An unexpected status from TPM chip is not irrecovable failure of the kernel. It's only undesirable situation. Thus, change the
WARN_ONCEinstance insidetpm_tis_status()topr_warn_once().In addition: print the status in the log message because it is actually useful information lacking from the existing log message.
Suggested-by Guenter Roeck <[email protected]>Fixes 6f4f57f0b909 ("tpm: ibmvtpm: fix error return code in tpm_ibmvtpm_probe()")Signed-off-by Jarkko Sakkinen <[email protected]>--- drivers/char/tpm/tpm_tis_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/char/tpm/tpm_tis_core.c +0
-0
drivers/char/tpm/tpm_tis_core.c static u8 tpm_tis_status(struct tpm_chip *chip) · line 208
Quoted 8 lines
drivers/char/tpm/tpm_tis_core.c +1
-1@@ -202,7 +202,7 @@ static u8 tpm_tis_status(struct tpm_chip *chip)* acquired. Usually because tpm_try_get_ops() hasn't * been called before doing a TPM operation. */ -WARN_ONCE (1 ,"TPM returned invalid status\n" ); +pr_warn_once ("TPM returned invalid status: 0x%x\n" , status);return 0 ; }
Jason Gunthorpe
reviewerQuoted 20 lines · On Tue, Feb 02, 2021 at 05:33:17PM +0200, [email protected] wrote:
From: Jarkko Sakkinen <[email protected]>
An unexpected status from TPM chip is not irrecovable failure of the kernel. It's only undesirable situation. Thus, change the
WARN_ONCEinstance insidetpm_tis_status()topr_warn_once().In addition: print the status in the log message because it is actually useful information lacking from the existing log message.
Suggested-by Guenter Roeck <[email protected]>Fixes 6f4f57f0b909 ("tpm: ibmvtpm: fix error return code in tpm_ibmvtpm_probe()")Signed-off-by Jarkko Sakkinen <[email protected]>drivers/char/tpm/tpm_tis_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/char/tpm/tpm_tis_core.c +1
-0+++ b/drivers/char/tpm/tpm_tis_core.c
drivers/char/tpm/tpm_tis_core.c static u8 tpm_tis_status(struct tpm_chip *chip) · line 205
Quoted 5 lines
drivers/char/tpm/tpm_tis_core.c +1
-1@@ -202,7 +202,7 @@ static u8 tpm_tis_status(struct tpm_chip *chip)* acquired. Usually because tpm_try_get_ops() hasn't * been called before doing a TPM operation. */ -WARN_ONCE (1 ,"TPM returned invalid status\n" ); +pr_warn_once ("TPM returned invalid status: 0x%x\n" , status);
Use dev_warn_once since we have a chip->dev here
Jason
Quoted 22 lines · On Tue, Feb 02, 2021 at 05:33:17PM +0200, [email protected] wrote:
From: Jarkko Sakkinen <[email protected]>
An unexpected status from TPM chip is not irrecovable failure of the kernel. It's only undesirable situation. Thus, change the
WARN_ONCEinstance insidetpm_tis_status()topr_warn_once().In addition: print the status in the log message because it is actually useful information lacking from the existing log message.
Suggested-by Guenter Roeck <[email protected]>Fixes 6f4f57f0b909 ("tpm: ibmvtpm: fix error return code in tpm_ibmvtpm_probe()")Signed-off-by Jarkko Sakkinen <[email protected]>--- drivers/char/tpm/tpm_tis_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/char/tpm/tpm_tis_core.c +0
-0
drivers/char/tpm/tpm_tis_core.c static u8 tpm_tis_status(struct tpm_chip *chip) · line 207
Quoted 7 lines
drivers/char/tpm/tpm_tis_core.c +1
-1@@ -202,7 +202,7 @@ static u8 tpm_tis_status(struct tpm_chip *chip)* acquired. Usually because tpm_try_get_ops() hasn't * been called before doing a TPM operation. */ -WARN_ONCE (1 ,"TPM returned invalid status\n" ); +pr_warn_once ("TPM returned invalid status: 0x%x\n" , status);return 0 ; }
Actually in this case I don't understand why _once, especially based on the comment. Would ratelimited not be better? So we can see if it happens repeatedly? Even better would be if we could see when it next gave a valid status after an invalid one.
James Bottomley
maintainerQuoted 32 lines · Serge E. Hallyn
Quoted 31 lines · On Tue, Feb 02, 2021 at 05:33:17PM +0200, [email protected] wrote:
From: Jarkko Sakkinen <[email protected]>
An unexpected status from TPM chip is not irrecovable failure of the
kernel. It's only undesirable situation. Thus, change theWARN_ONCEinstance insidetpm_tis_status()topr_warn_once().In addition: print the status in the log message because it is actually
useful information lacking from the existing log message.Suggested-by Guenter Roeck <[email protected]>Fixes 6f4f57f0b909 ("tpm: ibmvtpm: fix error return code in
tpm_ibmvtpm_probe()")Signed-off-by Jarkko Sakkinen <[email protected]>--- drivers/char/tpm/tpm_tis_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/char/tpm/tpm_tis_core.c +1
-1@@ -202,7 +202,7 @@ static u8 tpm_tis_status(struct tpm_chip *chip)* acquired. Usually because tpm_try_get_ops() hasn't * been called before doing a TPM operation. */ -WARN_ONCE (1 ,"TPM returned invalid status\n" ); + pr_warn_once("TPM returned invalid status: 0x%x\n",
Quoted 8 lines
drivers/char/tpm/tpm_tis_core.c static u8 tpm_tis_status(struct tpm_chip *chip) · line 207
Quoted 3 lines
drivers/char/tpm/tpm_tis_core.c +0
-0status);return 0 ; }Actually in this case I don't understand why
_once, especially based on the comment. Would ratelimited not be better? So we can see if it happens repeatedly? Even better would be if we could see when it next gave a valid status after an invalid one.
The reason was that we're trying to catch and kill paths to the status where the locality is incorrect. If you do some operation that finds an incorrect path the likelihood is you'll exercise it more than once, but all we need to identify it is the call trace from a single access. The symptom the user space process sees is a TPM timeout, but we still have the in-kernel trace to tell us why.
James
Jarkko Sakkinen
maintainerQuoted 10 lines · Guenter Roeck
Quoted 9 lines · On 2/2/21 7:33 AM, [email protected] wrote:
From: Jarkko Sakkinen <[email protected]>
An unexpected status from TPM chip is not irrecovable failure of the kernel. It's only undesirable situation. Thus, change the
WARN_ONCEinstance insidetpm_tis_status()topr_warn_once().In addition: print the status in the log message because it is actually useful information lacking from the existing log message.
Quoted 6 lines
Quoted 4 lines
Suggested-by Guenter Roeck <[email protected]>Fixes 6f4f57f0b909 ("tpm: ibmvtpm: fix error return code in tpm_ibmvtpm_probe()")Signed-off-by Jarkko Sakkinen <[email protected]>Reviewed-by Guenter Roeck <[email protected]>
Thanks.
/Jarkko
Jarkko Sakkinen
maintainerQuoted 18 lines · Stefan Berger
Quoted 17 lines · On 2/2/21 10:33 AM, [email protected] wrote:
From: Jarkko Sakkinen <[email protected]>
An unexpected status from TPM chip is not irrecovable failure of the kernel. It's only undesirable situation. Thus, change the
WARN_ONCEinstance insidetpm_tis_status()topr_warn_once().In addition: print the status in the log message because it is actually useful information lacking from the existing log message.
Suggested-by Guenter Roeck <[email protected]>Fixes 6f4f57f0b909 ("tpm: ibmvtpm: fix error return code in tpm_ibmvtpm_probe()")Signed-off-by Jarkko Sakkinen <[email protected]>--- drivers/char/tpm/tpm_tis_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines
drivers/char/tpm/tpm_tis_core.c static u8 tpm_tis_status(struct tpm_chip *chip) · line 207
Quoted 12 lines
drivers/char/tpm/tpm_tis_core.c +1
-1@@ -202,7 +202,7 @@ static u8 tpm_tis_status(struct tpm_chip *chip)* acquired. Usually because tpm_try_get_ops() hasn't * been called before doing a TPM operation. */ -WARN_ONCE (1 ,"TPM returned invalid status\n" ); +pr_warn_once ("TPM returned invalid status: 0x%x\n" , status);return 0 ; }Reviewed-by Stefan Berger <[email protected]>
Thank you.
/Jarkko
Jarkko Sakkinen
maintainerQuoted 29 lines · Jason Gunthorpe
Quoted 20 lines · On Tue, Feb 02, 2021 at 05:33:17PM +0200, [email protected] wrote:
From: Jarkko Sakkinen <[email protected]>
An unexpected status from TPM chip is not irrecovable failure of the kernel. It's only undesirable situation. Thus, change the
WARN_ONCEinstance insidetpm_tis_status()topr_warn_once().In addition: print the status in the log message because it is actually useful information lacking from the existing log message.
Suggested-by Guenter Roeck <[email protected]>Fixes 6f4f57f0b909 ("tpm: ibmvtpm: fix error return code in tpm_ibmvtpm_probe()")Signed-off-by Jarkko Sakkinen <[email protected]>drivers/char/tpm/tpm_tis_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/char/tpm/tpm_tis_core.c +1
-0+++ b/drivers/char/tpm/tpm_tis_core.cdrivers/char/tpm/tpm_tis_core.c static u8 tpm_tis_status(struct tpm_chip *chip) · line 205
Quoted 5 lines
drivers/char/tpm/tpm_tis_core.c +1
-1@@ -202,7 +202,7 @@ static u8 tpm_tis_status(struct tpm_chip *chip)* acquired. Usually because tpm_try_get_ops() hasn't * been called before doing a TPM operation. */ -WARN_ONCE (1 ,"TPM returned invalid status\n" ); +pr_warn_once ("TPM returned invalid status: 0x%x\n" , status);Use
dev_warn_oncesince we have achip->devhere
Quoted 1 line
Jason
Right obviously that one is best to be preferred. I'll do that. Thanks.
/Jarkko
Jarkko Sakkinen
maintainerQuoted 42 lines · James Bottomley
Quoted 32 lines · Serge E. Hallyn
Quoted 31 lines · On Tue, Feb 02, 2021 at 05:33:17PM +0200, [email protected] wrote:
From: Jarkko Sakkinen <[email protected]>
An unexpected status from TPM chip is not irrecovable failure of the
kernel. It's only undesirable situation. Thus, change theWARN_ONCEinstance insidetpm_tis_status()topr_warn_once().In addition: print the status in the log message because it is actually
useful information lacking from the existing log message.Suggested-by Guenter Roeck <[email protected]>Fixes 6f4f57f0b909 ("tpm: ibmvtpm: fix error return code in
tpm_ibmvtpm_probe()")Signed-off-by Jarkko Sakkinen <[email protected]>--- drivers/char/tpm/tpm_tis_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/char/tpm/tpm_tis_core.c +1
-1@@ -202,7 +202,7 @@ static u8 tpm_tis_status(struct tpm_chip *chip)* acquired. Usually because tpm_try_get_ops() hasn't * been called before doing a TPM operation. */ -WARN_ONCE (1 ,"TPM returned invalid status\n" ); + pr_warn_once("TPM returned invalid status: 0x%x\n",Quoted 8 lines
drivers/char/tpm/tpm_tis_core.c static u8 tpm_tis_status(struct tpm_chip *chip) · line 207
Quoted 3 lines
drivers/char/tpm/tpm_tis_core.c +0
-0status);return 0 ; }Actually in this case I don't understand why
_once, especially based on the comment. Would ratelimited not be better? So we can see if it happens repeatedly? Even better would be if we could see when it next gave a valid status after an invalid one.
Quoted 6 lines
The reason was that we're trying to catch and kill paths to the status where the locality is incorrect. If you do some operation that finds an incorrect path the likelihood is you'll exercise it more than once, but all we need to identify it is the call trace from a single access. The symptom the user space process sees is a TPM timeout, but we still have the in-kernel trace to tell us why.
I don't agree with this reasoning. This warn could spun off also from chip not following TCG spec. The patch does provide the status code, which is always useful information.
/Jarkko
Jarkko Sakkinen
maintainerQuoted 50 lines · Jarkko Sakkinen
Quoted 42 lines · James Bottomley
Quoted 32 lines · Serge E. Hallyn
Quoted 31 lines · On Tue, Feb 02, 2021 at 05:33:17PM +0200, [email protected] wrote:
From: Jarkko Sakkinen <[email protected]>
An unexpected status from TPM chip is not irrecovable failure of the
kernel. It's only undesirable situation. Thus, change theWARN_ONCEinstance insidetpm_tis_status()topr_warn_once().In addition: print the status in the log message because it is actually
useful information lacking from the existing log message.Suggested-by Guenter Roeck <[email protected]>Fixes 6f4f57f0b909 ("tpm: ibmvtpm: fix error return code in
tpm_ibmvtpm_probe()")Signed-off-by Jarkko Sakkinen <[email protected]>--- drivers/char/tpm/tpm_tis_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/char/tpm/tpm_tis_core.c +1
-1@@ -202,7 +202,7 @@ static u8 tpm_tis_status(struct tpm_chip *chip)* acquired. Usually because tpm_try_get_ops() hasn't * been called before doing a TPM operation. */ -WARN_ONCE (1 ,"TPM returned invalid status\n" ); + pr_warn_once("TPM returned invalid status: 0x%x\n",Quoted 8 lines
drivers/char/tpm/tpm_tis_core.c static u8 tpm_tis_status(struct tpm_chip *chip) · line 207
Quoted 3 lines
drivers/char/tpm/tpm_tis_core.c +0
-0status);return 0 ; }Actually in this case I don't understand why
_once, especially based on the comment. Would ratelimited not be better? So we can see if it happens repeatedly? Even better would be if we could see when it next gave a valid status after an invalid one.Quoted 6 lines
The reason was that we're trying to catch and kill paths to the status where the locality is incorrect. If you do some operation that finds an incorrect path the likelihood is you'll exercise it more than once, but all we need to identify it is the call trace from a single access. The symptom the user space process sees is a TPM timeout, but we still have the in-kernel trace to tell us why.
Quoted 3 lines
I don't agree with this reasoning. This warn could spun off also from chip not following TCG spec. The patch does provide the status code, which is always useful information.
I.e. WARN() implies usually that there is something wrong in the kernel state risking its stability which *is not* case here. Thus, it's best to make the status code visible, not the stack trace, and make rest of the conclusions from that.
/Jarkko
James Bottomley
maintainerQuoted 2 lines · Jarkko Sakkinen
Quoted 1 line · James Bottomley
On Tue, 2021-02-02 at 11:26 -0600, Serge E. Hallyn wrote:
[...]
Quoted 13 lines
Quoted 6 lines
Quoted 5 lines
Actually in this case I don't understand why
_once, especially based on the comment. Would ratelimited not be better? So we can see if it happens repeatedly? Even better would be if we could see when it next gave a valid status after an invalid one.Quoted 6 lines
The reason was that we're trying to catch and kill paths to the status where the locality is incorrect. If you do some operation that finds an incorrect path the likelihood is you'll exercise it more than once, but all we need to identify it is the call trace from a single access. The symptom the user space process sees is a TPM timeout, but we still have the in-kernel trace to tell us why.
Quoted 2 lines
I don't agree with this reasoning. This warn could spun off also from chip not following TCG spec.
If it doesn't follow this basic part of the spec, the chip is unusable by us anyway because we need the status to proceed with command handling.
Quoted 2 lines
The patch does provide the status code, which is always useful
information.
In the wrong locality that will be bus not connected, so likely 0xff. The most useful thing to know is what path triggered the condition because the most likely cause is coding error.
James
Jarkko Sakkinen
maintainerQuoted 24 lines · James Bottomley
Quoted 2 lines · Jarkko Sakkinen
Quoted 1 line · James Bottomley
On Tue, 2021-02-02 at 11:26 -0600, Serge E. Hallyn wrote:
[...]
Quoted 13 lines
Quoted 6 lines
Quoted 5 lines
Actually in this case I don't understand why
_once, especially based on the comment. Would ratelimited not be better? So we can see if it happens repeatedly? Even better would be if we could see when it next gave a valid status after an invalid one.Quoted 6 lines
The reason was that we're trying to catch and kill paths to the status where the locality is incorrect. If you do some operation that finds an incorrect path the likelihood is you'll exercise it more than once, but all we need to identify it is the call trace from a single access. The symptom the user space process sees is a TPM timeout, but we still have the in-kernel trace to tell us why.
Quoted 2 lines
I don't agree with this reasoning. This warn could spun off also from chip not following TCG spec.
If it doesn't follow this basic part of the spec, the chip is unusable by us anyway because we need the status to proceed with command handling.
Quoted 8 lines
Quoted 2 lines
The patch does provide the status code, which is always useful
information.In the wrong locality that will be bus not connected, so likely
0xff. The most useful thing to know is what path triggered the condition because the most likely cause is coding error.James
I tend to agree for now. Let's focus on collecting the fixes. Thanks.
/Jarkko