Skip to contentSkip to conversation

firmware: Add support for boot_stats

PATCH In review Souradeep Chowdhury 5 participants 11 messages Jul 5, 2023 – Jul 11, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v7 cover firmware: Add support for boot_stats

Qualcomm's proprietary Android boot-loaders capture boot time stats, like the time when the bootloader started execution and at what point the bootloader handed over control to the kernel etc. in the IMEM region. This information is captured by the bootloader and populated on the device tree properties "pre-abl-time" and "abl-time" which can be be viewed from the user space like as follows:-

/sys/firmware/devicetree/base/bootstats # cat abl_time 17898

As a part of this patch series added the bindings for boot-stats which was suggested in the v6 of the series. The link for the same is as follows:-

https://lore.kernel.org/linux-arm-kernel/[email protected]/

Souradeep Chowdhury (2):
dt-bindings: firmware: bootstats: Add the dtschema
MAINTAINERS: Add the entry for boot_stats support

 .../bindings/firmware/qcom,bootstats.yaml     | 38 +++++++++++++++++++
 MAINTAINERS                                   |  6 +++
 2 files changed, 44 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/firmware/qcom,bootstats.yaml

--
2.17.1

#1 lore raw

PATCH v7 1/2 dt-bindings: firmware: bootstats: Add the dtschema

Add the device tree bindings for boot stats. This has 2 properties pre-abl-time and abl-time which records the timestamps for boot stats.

---
 .../bindings/firmware/qcom,bootstats.yaml     | 38 +++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/firmware/qcom,bootstats.yaml
Documentation/devicetree/bindings/firmware/qcom,bootstats.yaml new file +38 -0
new file mode 100644
index 000000000000..22e697524058
@@ -0,0 +1,38 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/firmware/qcom,bootstats.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Boot Stats
+
+maintainers:
+  - Souradeep Chowdhury <[email protected]>
+
+description: |
+    Qualcomm's proprietary Android boot-loaders capture boot time
+    stats, like the time when the bootloader started execution and
+    at what point the bootloader handed over control to the kernel.
+    This is captured in the unit of ms in devicetree property.
+
+properties:
+  pre-abl-time:
+    description: The property to store the starting point of abl in ms.
+    $ref: /schemas/types.yaml#/definitions/string-array
+
+  abl-time:
+    description: The property to store the duration of abl in ms.
+    $ref: /schemas/types.yaml#/definitions/string-array
+
+required:
+  - pre-abl-time
+  - abl-time
+
+additionalProperties: false
+
+examples:
+  - |
+    bootstats {
+        pre-abl-time="17627";
+        abl-time="26748";
+    };
Signature · 1 line
2.17.1
#2 lore raw

Re: [PATCH V7 1/2] dt-bindings: firmware: bootstats: Add the dtschema

Quoted 17 lines · Souradeep Chowdhury

Add the device tree bindings for boot stats. This has 2 properties pre-abl-time and abl-time which records the timestamps for boot stats.

---
 .../bindings/firmware/qcom,bootstats.yaml     | 38 +++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/firmware/qcom,bootstats.yaml
Documentation/devicetree/bindings/firmware/qcom,bootstats.yaml new file +0 -0
new file mode 100644
index 000000000000..22e697524058

Documentation/devicetree/bindings/firmware/qcom,bootstats.yaml line 7

Quoted 7 lines
Documentation/devicetree/bindings/firmware/qcom,bootstats.yaml new file +7 -0
@@ -0,0 +1,38 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/firmware/qcom,bootstats.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Boot Stats

This explains nothing...

Documentation/devicetree/bindings/firmware/qcom,bootstats.yaml line 12

Quoted 5 lines
Documentation/devicetree/bindings/firmware/qcom,bootstats.yaml new file +5 -0
+
+maintainers:
+  - Souradeep Chowdhury <[email protected]>
+
+description: |

Drop |

Documentation/devicetree/bindings/firmware/qcom,bootstats.yaml line 13

Quoted 1 line
Documentation/devicetree/bindings/firmware/qcom,bootstats.yaml new file +1 -0
+    Qualcomm's proprietary Android boot-loaders capture boot time

Wrong indentation.

Documentation/devicetree/bindings/firmware/qcom,bootstats.yaml line 20

Quoted 7 lines
Documentation/devicetree/bindings/firmware/qcom,bootstats.yaml new file +7 -0
+    stats, like the time when the bootloader started execution and
+    at what point the bootloader handed over control to the kernel.
+    This is captured in the unit of ms in devicetree property.
+
+properties:
+  pre-abl-time:
+    description: The property to store the starting point of abl in ms.

String instead of ms? No, this is the craziest idea I saw recently. Use -ms suffix.

Documentation/devicetree/bindings/firmware/qcom,bootstats.yaml line 25

Quoted 5 lines
Documentation/devicetree/bindings/firmware/qcom,bootstats.yaml new file +5 -0
+    $ref: /schemas/types.yaml#/definitions/string-array
+
+  abl-time:
+    description: The property to store the duration of abl in ms.
+    $ref: /schemas/types.yaml#/definitions/string-array

I have no clue what this entire binding is about. Nothing can bind to it, no usage explained. Properties are not used to "store the duration". This does not look like suitable for DT, drop entire binding.

Documentation/devicetree/bindings/firmware/qcom,bootstats.yaml line 37

Quoted 12 lines
Documentation/devicetree/bindings/firmware/qcom,bootstats.yaml new file +12 -0
+
+required:
+  - pre-abl-time
+  - abl-time
+
+additionalProperties: false
+
+examples:
+  - |
+    bootstats {
+        pre-abl-time="17627";
+        abl-time="26748";

Missing spaces. Open existing DTS and look at existing coding style.

Best regards,
Krzysztof

#3 lore raw

Re: [PATCH V7 1/2] dt-bindings: firmware: bootstats: Add the dtschema

Quoted 12 lines · Krzysztof Kozlowski
Quoted 11 lines · Souradeep Chowdhury

Add the device tree bindings for boot stats. This has 2 properties pre-abl-time and abl-time which records the timestamps for boot stats.

---
  .../bindings/firmware/qcom,bootstats.yaml     | 38 +++++++++++++++++++
  1 file changed, 38 insertions(+)

create mode 100644 Documentation/devicetree/bindings/firmware/qcom,bootstats.yaml

Quoted 15 lines

Documentation/devicetree/bindings/firmware/qcom,bootstats.yaml line 7

Quoted 13 lines
Documentation/devicetree/bindings/firmware/qcom,bootstats.yaml new file +7 -0
new file mode 100644
index 000000000000..22e697524058
@@ -0,0 +1,38 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/firmware/qcom,bootstats.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Boot Stats

This explains nothing...

Ack

Quoted 8 lines

Documentation/devicetree/bindings/firmware/qcom,bootstats.yaml line 12

Quoted 6 lines
Documentation/devicetree/bindings/firmware/qcom,bootstats.yaml new file +5 -0
+
+maintainers:
+  - Souradeep Chowdhury <[email protected]>
+
+description: |

Drop |

Ack

Quoted 4 lines

Documentation/devicetree/bindings/firmware/qcom,bootstats.yaml line 13

Quoted 2 lines
Documentation/devicetree/bindings/firmware/qcom,bootstats.yaml new file +1 -0
+    Qualcomm's proprietary Android boot-loaders capture boot time

Wrong indentation.

Ack

Quoted 18 lines

Documentation/devicetree/bindings/firmware/qcom,bootstats.yaml line 20

Quoted 8 lines
Documentation/devicetree/bindings/firmware/qcom,bootstats.yaml new file +7 -0
+    stats, like the time when the bootloader started execution and
+    at what point the bootloader handed over control to the kernel.
+    This is captured in the unit of ms in devicetree property.
+
+properties:
+  pre-abl-time:
+    description: The property to store the starting point of abl in ms.

String instead of ms? No, this is the craziest idea I saw recently. Use -ms suffix.

Documentation/devicetree/bindings/firmware/qcom,bootstats.yaml line 25

Quoted 5 lines
Documentation/devicetree/bindings/firmware/qcom,bootstats.yaml new file +5 -0
+    $ref: /schemas/types.yaml#/definitions/string-array
+
+  abl-time:
+    description: The property to store the duration of abl in ms.
+    $ref: /schemas/types.yaml#/definitions/string-array
Quoted 3 lines

I have no clue what this entire binding is about. Nothing can bind to it, no usage explained. Properties are not used to "store the duration". This does not look like suitable for DT, drop entire binding.

This binding was created as per the suggestion on version 6 of the patch by Arnd. The idea was that these 2 devicetree properties will be used to populate the bootstat values from the bootloader and exposed to the user via /sys/firmware/devicetree/ directly.

Details in the link below:-

https://lore.kernel.org/lkml/[email protected]/T/#mbdc9ad95fcbb5ad7b56c6996a3933899b42d982c

Can you suggest any alternative way to represent this as a binding?

Quoted 15 lines

Documentation/devicetree/bindings/firmware/qcom,bootstats.yaml line 37

Quoted 13 lines
Documentation/devicetree/bindings/firmware/qcom,bootstats.yaml new file +12 -0
+
+required:
+  - pre-abl-time
+  - abl-time
+
+additionalProperties: false
+
+examples:
+  - |
+    bootstats {
+        pre-abl-time="17627";
+        abl-time="26748";

Missing spaces. Open existing DTS and look at existing coding style.

Ack

Quoted 4 lines

Best regards,
Krzysztof

#4 lore raw

Re: [PATCH V7 1/2] dt-bindings: firmware: bootstats: Add the dtschema

Quoted 15 lines · Souradeep Chowdhury
Quoted 9 lines

Documentation/devicetree/bindings/firmware/qcom,bootstats.yaml line 25

Quoted 5 lines
Documentation/devicetree/bindings/firmware/qcom,bootstats.yaml new file +5 -0
+    $ref: /schemas/types.yaml#/definitions/string-array
+
+  abl-time:
+    description: The property to store the duration of abl in ms.
+    $ref: /schemas/types.yaml#/definitions/string-array

I have no clue what this entire binding is about. Nothing can bind to it, no usage explained. Properties are not used to "store the duration". This does not look like suitable for DT, drop entire binding.

This binding was created as per the suggestion on version 6 of the patch by Arnd. The idea was that these 2 devicetree properties will be used to populate the bootstat values from the bootloader and exposed to the user via /sys/firmware/devicetree/ directly.

Quoted 5 lines

Details in the link below:-

https://lore.kernel.org/lkml/[email protected]/T/#mbdc9ad95fcbb5ad7b56c6996a3933899b42d982c

Can you suggest any alternative way to represent this as a binding?

Then you should clearly state in the binding how this is going to be used and who is going to populate it. Not only in the binding but also in commit msg which currently has 0 rationale and answers to "why". Your commit msg explained only "what", which is usually obvious and much less important. Your commit should stand on its own and should clearly explain why we need this feature at all, what problem it solves.

And before you claim that there is some discussion under link or some cover letter - these do not matter. Commit and bindings matter.

What's more, I don't think that Arnd's advice is correct here - DT is suppose to describe hardware or firmware. These properties are coming from firmware but they are not describing any firmware or hardware characteristics. Instead they are debugging of current boot status.

I will leave the decision on that for Rob, however anyway binding is very vague and incorrect, so I would expect he will come with the same concerns regardless whether it is suitable to DT or is not.

Best regards,
Krzysztof

maintainer
#5 lore raw

Re: [PATCH V7 1/2] dt-bindings: firmware: bootstats: Add the dtschema

Quoted 32 lines · Krzysztof Kozlowski
Quoted 15 lines · Souradeep Chowdhury
Quoted 9 lines

Documentation/devicetree/bindings/firmware/qcom,bootstats.yaml line 25

Quoted 5 lines
Documentation/devicetree/bindings/firmware/qcom,bootstats.yaml new file +5 -0
+    $ref: /schemas/types.yaml#/definitions/string-array
+
+  abl-time:
+    description: The property to store the duration of abl in ms.
+    $ref: /schemas/types.yaml#/definitions/string-array

I have no clue what this entire binding is about. Nothing can bind to it, no usage explained. Properties are not used to "store the duration". This does not look like suitable for DT, drop entire binding.

This binding was created as per the suggestion on version 6 of the patch by Arnd. The idea was that these 2 devicetree properties will be used to populate the bootstat values from the bootloader and exposed to the user via /sys/firmware/devicetree/ directly.

Quoted 5 lines

Details in the link below:-

https://lore.kernel.org/lkml/[email protected]/T/#mbdc9ad95fcbb5ad7b56c6996a3933899b42d982c

Can you suggest any alternative way to represent this as a binding?

Then you should clearly state in the binding how this is going to be used and who is going to populate it. Not only in the binding but also in commit msg which currently has 0 rationale and answers to "why". Your commit msg explained only "what", which is usually obvious and much less important. Your commit should stand on its own and should clearly explain why we need this feature at all, what problem it solves.

And before you claim that there is some discussion under link or some cover letter - these do not matter. Commit and bindings matter.

Quoted 8 lines

What's more, I don't think that Arnd's advice is correct here - DT is suppose to describe hardware or firmware. These properties are coming from firmware but they are not describing any firmware or hardware characteristics. Instead they are debugging of current boot status.

I will leave the decision on that for Rob, however anyway binding is very vague and incorrect, so I would expect he will come with the same concerns regardless whether it is suitable to DT or is not.

My main concern here is not so much having this info in DT, but whether it's just the start of various properties. Either because there's already more data and these are just the 2 things you care about now, or because once we enable this it's an invitation to add more properties.

Boot timing information seems like something multiple platforms might want and only having 2 stages isn't extensible.

Rob

#6 lore raw

Re: [PATCH V7 1/2] dt-bindings: firmware: bootstats: Add the dtschema

Quoted 42 lines · Rob Herring
Quoted 32 lines · Krzysztof Kozlowski
Quoted 15 lines · Souradeep Chowdhury
Quoted 9 lines

Documentation/devicetree/bindings/firmware/qcom,bootstats.yaml line 25

Quoted 5 lines
Documentation/devicetree/bindings/firmware/qcom,bootstats.yaml new file +5 -0
+    $ref: /schemas/types.yaml#/definitions/string-array
+
+  abl-time:
+    description: The property to store the duration of abl in ms.
+    $ref: /schemas/types.yaml#/definitions/string-array

I have no clue what this entire binding is about. Nothing can bind to it, no usage explained. Properties are not used to "store the duration". This does not look like suitable for DT, drop entire binding.

This binding was created as per the suggestion on version 6 of the patch by Arnd. The idea was that these 2 devicetree properties will be used to populate the bootstat values from the bootloader and exposed to the user via /sys/firmware/devicetree/ directly.

Quoted 5 lines

Details in the link below:-

https://lore.kernel.org/lkml/[email protected]/T/#mbdc9ad95fcbb5ad7b56c6996a3933899b42d982c

Can you suggest any alternative way to represent this as a binding?

Then you should clearly state in the binding how this is going to be used and who is going to populate it. Not only in the binding but also in commit msg which currently has 0 rationale and answers to "why". Your commit msg explained only "what", which is usually obvious and much less important. Your commit should stand on its own and should clearly explain why we need this feature at all, what problem it solves.

And before you claim that there is some discussion under link or some cover letter - these do not matter. Commit and bindings matter.

Quoted 8 lines

What's more, I don't think that Arnd's advice is correct here - DT is suppose to describe hardware or firmware. These properties are coming from firmware but they are not describing any firmware or hardware characteristics. Instead they are debugging of current boot status.

I will leave the decision on that for Rob, however anyway binding is very vague and incorrect, so I would expect he will come with the same concerns regardless whether it is suitable to DT or is not.

Quoted 7 lines

My main concern here is not so much having this info in DT, but whether it's just the start of various properties. Either because there's already more data and these are just the 2 things you care about now, or because once we enable this it's an invitation to add more properties.

Boot timing information seems like something multiple platforms might want and only having 2 stages isn't extensible.

I preferred the previous implementation idea, where the Linux driver will parse firmware data, instead of bootloader doing something for us.

Not to mention that that approach would allow us to get boot time stats on older platforms, without waiting (indefinitely) for the platform vendor to update the bootloader.

Quoted 2 lines

Rob

Signature · 2 lines
With best wishes
Dmitry
#7 lore raw

Re: [PATCH V7 1/2] dt-bindings: firmware: bootstats: Add the dtschema

Quoted 48 lines · Dmitry Baryshkov
Quoted 47 lines · Rob Herring
Quoted 32 lines · Krzysztof Kozlowski
Quoted 15 lines · Souradeep Chowdhury
Quoted 9 lines
Quoted 5 lines

+    $ref: /schemas/types.yaml#/definitions/string-array +
+  abl-time:
+    description: The property to store the duration of abl in ms. +    $ref: /schemas/types.yaml#/definitions/string-array

I have no clue what this entire binding is about. Nothing can bind to it, no usage explained. Properties are not used to "store the duration". This does not look like suitable for DT, drop entire binding.

This binding was created as per the suggestion on version 6 of the patch by Arnd. The idea was that these 2 devicetree properties will be used to populate the bootstat values from the bootloader and exposed to the user via /sys/firmware/devicetree/ directly.

Quoted 5 lines

Details in the link below:-

https://lore.kernel.org/lkml/[email protected]/T/#mbdc9ad95fcbb5ad7b56c6996a3933899b42d982c

Can you suggest any alternative way to represent this as a binding?

Then you should clearly state in the binding how this is going to be used and who is going to populate it. Not only in the binding but also in commit msg which currently has 0 rationale and answers to "why". Your commit msg explained only "what", which is usually obvious and much less important. Your commit should stand on its own and should clearly explain why we need this feature at all, what problem it solves.

And before you claim that there is some discussion under link or some cover letter - these do not matter. Commit and bindings matter.

Quoted 8 lines

What's more, I don't think that Arnd's advice is correct here - DT is suppose to describe hardware or firmware. These properties are coming from firmware but they are not describing any firmware or hardware characteristics. Instead they are debugging of current boot status.

I will leave the decision on that for Rob, however anyway binding is very vague and incorrect, so I would expect he will come with the same concerns regardless whether it is suitable to DT or is not.

My main concern here is not so much having this info in DT, but whether it's just the start of various properties. Either because there's already more data and these are just the 2 things you care about now, or because once we enable this it's an invitation to add more properties.

Quoted 9 lines
Quoted 2 lines

Boot timing information seems like something multiple platforms might want and only having 2 stages isn't extensible.

I preferred the previous implementation idea, where the Linux driver will parse firmware data, instead of bootloader doing something for us.

Not to mention that that approach would allow us to get boot time stats on older platforms, without waiting (indefinitely) for the platform vendor to update the bootloader.

Quoted 2 lines

Rob

Hi Rob/Krzysztof/Arnd,

We will work on describing the bindings better but can you first give us clarity on whether this is something that should be represented on the devicetree and what should be the final approach we need to take for boot_stats?

Thanks,
Souradeep

Quoted 1 line
#8 lore raw

PATCH v7 2/2 MAINTAINERS: Add the entry for boot_stats support

In reply to Souradeep Chowdhury

Add the entry for the file added as a part of support for boot stats.

---
 MAINTAINERS | 6 ++++++
 1 file changed, 6 insertions(+)
MAINTAINERS +6 -0
index 4eba5e88c6b0..ee64b9e7b7cc 100644
@@ -17173,6 +17173,12 @@ F:	sound/soc/codecs/wsa881x.c
 F:	sound/soc/codecs/wsa883x.c
 F:	sound/soc/qcom/
 
+QCOM BOOT_STATS DRIVER
+M:	Souradeep Chowdhury <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	Documentation/devicetree/bindings/firmware/qcom,bootstats.yaml
+
 QCOM EMBEDDED USB DEBUGGER (EUD)
 M:	Souradeep Chowdhury <[email protected]>
 L:	[email protected]
Signature · 1 line
2.17.1
#9 lore raw
In reply to Souradeep Chowdhury
Quoted 7 lines · Souradeep Chowdhury

Qualcomm's proprietary Android boot-loaders capture boot time stats, like the time when the bootloader started execution and at what point the bootloader handed over control to the kernel etc. in the IMEM region. This information is captured by the bootloader and populated on the device tree properties "pre-abl-time" and "abl-time" which can be be viewed from the user space like as follows:-

Quoted 6 lines

/sys/firmware/devicetree/base/bootstats # cat abl_time 17898

As a part of this patch series added the bindings for boot-stats which was suggested in the v6 of the series. The link for the same is as follows:-

Should boot statistics be exposed to userspace through the qcom socinfo driver? I see that the socinfo v19 metadata has fields for the boot core and boot cluster [1], so boot timing wouldn't be out of place.

Brian

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/soc/qcom/socinfo.c#n572

#10 lore raw
Quoted 11 lines · Brian Masney
Quoted 10 lines · Souradeep Chowdhury

Qualcomm's proprietary Android boot-loaders capture boot time stats, like the time when the bootloader started execution and at what point the bootloader handed over control to the kernel etc. in the IMEM region. This information is captured by the bootloader and populated on the device tree properties "pre-abl-time" and "abl-time" which can be be viewed from the user space like as follows:-

/sys/firmware/devicetree/base/bootstats # cat abl_time 17898

Quoted 7 lines
Quoted 3 lines

As a part of this patch series added the bindings for boot-stats which was suggested in the v6 of the series. The link for the same is as follows:-

Should boot statistics be exposed to userspace through the qcom socinfo driver? I see that the socinfo v19 metadata has fields for the boot core and boot cluster [1], so boot timing wouldn't be out of place.

"Boot Cluster" and "boot core" are soc specific info which are fixed for a particular qcom soc recorded in smem region of memory. "Boot_stats" is not a property of a soc as such, they are KPI measurements in the boot time path stored in the imem region. So I not sure if this is the right home for it.

Quoted 5 lines

Brian

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/soc/qcom/socinfo.c#n572