Skip to contentSkip to conversation

tpm: restore timeout for key creation commands

PATCH Superseded Baoli.Zhang 3 participants 4 messages Apr 10 – Apr 15

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tpm: restore timeout for key creation commands

After the per-command duration map was introduced, TPM2 key creation commands (CREATE_PRIMARY, CREATE, CREATE_LOADED) were limited to 30 seconds.

On some platforms this is not sufficient and key creation can time out. Commit 207696b17f38 ("tpm: use a map for tpm2_calc_ordinal_duration()") inadvertently reduced these command timeouts from 300 seconds to 30 seconds. Restore them to 300 seconds to avoid spurious failures.

Fixes 207696b17f38 ("tpm: use a map for tpm2_calc_ordinal_duration()")
---
 drivers/char/tpm/tpm2-cmd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/char/tpm/tpm2-cmd.c +3 -3
index 3a77be7ebf4aa..430022f695f24 100644
@@ -71,9 +71,9 @@ static const struct {
 	{TPM2_CC_HIERARCHY_CHANGE_AUTH, 2000},
 	{TPM2_CC_GET_CAPABILITY, 750},
 	{TPM2_CC_NV_READ, 2000},
-	{TPM2_CC_CREATE_PRIMARY, 30000},
-	{TPM2_CC_CREATE, 30000},
-	{TPM2_CC_CREATE_LOADED, 30000},
+	{TPM2_CC_CREATE_PRIMARY, 300000},
+	{TPM2_CC_CREATE, 300000},
+	{TPM2_CC_CREATE_LOADED, 300000},
 };
 
 /**
Signature · 1 line
2.43.0
#1 lore raw

Dear Baoli,

Thank you for your patch. Some formalities:

Am 10.04.26 um 03:49 schrieb Baoli.Zhang:

Quoted 8 lines

After the per-command duration map was introduced, TPM2 key creation commands (CREATE_PRIMARY, CREATE, CREATE_LOADED) were limited to 30 seconds.

On some platforms this is not sufficient and key creation can time out. Commit 207696b17f38 ("tpm: use a map for tpm2_calc_ordinal_duration()") inadvertently reduced these command timeouts from 300 seconds to 30 seconds. Restore them to 300 seconds to avoid spurious failures.

Please document such a platform.

Quoted 3 lines
Fixes 207696b17f38 ("tpm: use a map for tpm2_calc_ordinal_duration()")

It’d be great if you remove the dot from your name:

    git config --global user.name "Baoli Zhang"
Quoted 1 line

Same here. Maybe spell it Lili Li?

    git commit --amend --author="BaoliZhang 

<[email protected]>" -s

Quoted 21 lines
---
  drivers/char/tpm/tpm2-cmd.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
drivers/char/tpm/tpm2-cmd.c +3 -3
index 3a77be7ebf4aa..430022f695f24 100644
@@ -71,9 +71,9 @@ static const struct {
  	{TPM2_CC_HIERARCHY_CHANGE_AUTH, 2000},
  	{TPM2_CC_GET_CAPABILITY, 750},
  	{TPM2_CC_NV_READ, 2000},
-	{TPM2_CC_CREATE_PRIMARY, 30000},
-	{TPM2_CC_CREATE, 30000},
-	{TPM2_CC_CREATE_LOADED, 30000},
+	{TPM2_CC_CREATE_PRIMARY, 300000},
+	{TPM2_CC_CREATE, 300000},
+	{TPM2_CC_CREATE_LOADED, 300000},
  };
 
  /**
#2 lore raw
Quoted 10 lines · Paul Menzel

Dear Baoli,

Thank you for your patch. Some formalities:

Am 10.04.26 um 03:49 schrieb Baoli.Zhang:

Quoted 4 lines

After the per-command duration map was introduced, TPM2 key creation commands (CREATE_PRIMARY, CREATE, CREATE_LOADED) were limited to 30 seconds.

Quoted 6 lines
Quoted 4 lines

On some platforms this is not sufficient and key creation can time out. Commit 207696b17f38 ("tpm: use a map for tpm2_calc_ordinal_duration()") inadvertently reduced these command timeouts from 300 seconds to 30 seconds. Restore them to 300 seconds to avoid spurious failures.

Please document such a platform.

Thanks for your comments, I will add the platform after the internal alignment.

Quoted 9 lines
Quoted 4 lines
Fixes 207696b17f38 ("tpm: use a map for tpm2_calc_ordinal_duration()")

It’d be great if you remove the dot from your name:

    git config --global user.name "Baoli Zhang"

Yes,  will remove it in v2.

Quoted 6 lines
Quoted 1 line

Same here. Maybe spell it Lili Li?

    git commit --amend --author="BaoliZhang <[email protected]>" -s

Yes, her name is Lili Li. Will also remove  dot from her name.

Quoted 22 lines
Quoted 20 lines

---
  drivers/char/tpm/tpm2-cmd.c | 6 +++---

  1 file changed, 3 insertions(+), 3 deletions(-)
drivers/char/tpm/tpm2-cmd.c +3 -3
index 3a77be7ebf4aa..430022f695f24 100644
@@ -71,9 +71,9 @@ static const struct {
       {TPM2_CC_HIERARCHY_CHANGE_AUTH, 2000},
       {TPM2_CC_GET_CAPABILITY, 750},
       {TPM2_CC_NV_READ, 2000},
-    {TPM2_CC_CREATE_PRIMARY, 30000},
-    {TPM2_CC_CREATE, 30000},
-    {TPM2_CC_CREATE_LOADED, 30000},
+    {TPM2_CC_CREATE_PRIMARY, 300000},
+    {TPM2_CC_CREATE, 300000},
+    {TPM2_CC_CREATE_LOADED, 300000},
   };
     /**
maintainer
#3 lore raw
In reply to Baoli.Zhang
Quoted 8 lines · Baoli.Zhang

After the per-command duration map was introduced, TPM2 key creation commands (CREATE_PRIMARY, CREATE, CREATE_LOADED) were limited to 30 seconds.

On some platforms this is not sufficient and key creation can time out. Commit 207696b17f38 ("tpm: use a map for tpm2_calc_ordinal_duration()") inadvertently reduced these command timeouts from 300 seconds to 30 seconds. Restore them to 300 seconds to avoid spurious failures.

Is this like pre-silicon (FPGA) type of situation? I have doubts these latencies happening on ASIC.

If it is pre-release hardware, maybe there should be option to extend the delay, or does this happen on actual production hardware?

Just want to understand this better...

Quoted 3 lines
Fixes 207696b17f38 ("tpm: use a map for tpm2_calc_ordinal_duration()")

Extra empty line.

Quoted 2 lines

"Co-developed-by: states that the patch was co-created by several developers; it is a used to give attribution to co-authors (in addition to the author attributed by the From: tag) when multiple people work on a single patch. Every Co-developed-by: must be immediately followed by a
Signed-off-by: of the associated co-author. Details and examples can be found in Documentation/process/submitting-patches.rst." [1]

[1] https://docs.kernel.org/process/5.Posting.html

Quoted 24 lines
---
 drivers/char/tpm/tpm2-cmd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/char/tpm/tpm2-cmd.c +3 -3
index 3a77be7ebf4aa..430022f695f24 100644
@@ -71,9 +71,9 @@ static const struct {
 	{TPM2_CC_HIERARCHY_CHANGE_AUTH, 2000},
 	{TPM2_CC_GET_CAPABILITY, 750},
 	{TPM2_CC_NV_READ, 2000},
-	{TPM2_CC_CREATE_PRIMARY, 30000},
-	{TPM2_CC_CREATE, 30000},
-	{TPM2_CC_CREATE_LOADED, 30000},
+	{TPM2_CC_CREATE_PRIMARY, 300000},
+	{TPM2_CC_CREATE, 300000},
+	{TPM2_CC_CREATE_LOADED, 300000},
 };
 
 /**
Signature · 1 line
2.43.0

BR, Jarkko