diff mbox

[U-Boot,20/23] scsi: bootstage: Measure time taken to scan the bus

Message ID 1422321801-6743-21-git-send-email-sjg@chromium.org
State Superseded
Delegated to: Simon Glass
Headers show

Commit Message

Simon Glass Jan. 27, 2015, 1:23 a.m. UTC
On some hardware this time can be significant. Add bootstage support for
measuring this. The result can be obtained using 'bootstage report' or
passed on to the Linux via the device tree.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 common/cmd_scsi.c   | 2 ++
 include/bootstage.h | 1 +
 2 files changed, 3 insertions(+)

Comments

Bin Meng Jan. 27, 2015, 1:20 p.m. UTC | #1
On Tue, Jan 27, 2015 at 9:23 AM, Simon Glass <sjg@chromium.org> wrote:
> On some hardware this time can be significant. Add bootstage support for
> measuring this. The result can be obtained using 'bootstage report' or
> passed on to the Linux via the device tree.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  common/cmd_scsi.c   | 2 ++
>  include/bootstage.h | 1 +
>  2 files changed, 3 insertions(+)
>
> diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c
> index cbc107e..a0a62eb 100644
> --- a/common/cmd_scsi.c
> +++ b/common/cmd_scsi.c
> @@ -217,8 +217,10 @@ void scsi_init(void)
>                        (busdevfunc >> 8) & 0x7);
>         }
>  #endif
> +       bootstage_start(BOOTSTAGE_ID_ACCUM_SCSI, "ahci");
>         scsi_low_level_init(busdevfunc);
>         scsi_scan(1);
> +       bootstage_accum(BOOTSTAGE_ID_ACCUM_SCSI);
>  }
>  #endif
>
> diff --git a/include/bootstage.h b/include/bootstage.h
> index df13ab2..6b7588d 100644
> --- a/include/bootstage.h
> +++ b/include/bootstage.h
> @@ -194,6 +194,7 @@ enum bootstage_id {
>         BOOTSTAGE_ID_MAIN_CPU_READY,
>
>         BOOTSTAGE_ID_ACCUM_LCD,
> +       BOOTSTAGE_ID_ACCUM_SCSI,
>
>         /* a few spare for the user, from here */
>         BOOTSTAGE_ID_USER,
> --

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Rob Herring Jan. 27, 2015, 5:38 p.m. UTC | #2
On Mon, Jan 26, 2015 at 7:23 PM, Simon Glass <sjg@chromium.org> wrote:
> On some hardware this time can be significant. Add bootstage support for
> measuring this. The result can be obtained using 'bootstage report' or
> passed on to the Linux via the device tree.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  common/cmd_scsi.c   | 2 ++
>  include/bootstage.h | 1 +
>  2 files changed, 3 insertions(+)
>
> diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c
> index cbc107e..a0a62eb 100644
> --- a/common/cmd_scsi.c
> +++ b/common/cmd_scsi.c
> @@ -217,8 +217,10 @@ void scsi_init(void)
>                        (busdevfunc >> 8) & 0x7);
>         }
>  #endif
> +       bootstage_start(BOOTSTAGE_ID_ACCUM_SCSI, "ahci");
>         scsi_low_level_init(busdevfunc);
>         scsi_scan(1);
> +       bootstage_accum(BOOTSTAGE_ID_ACCUM_SCSI);

This does not cover the case if the platform calls scsi_scan at boot.
The first time is the important one as that will include disk spin-up
time.

Perhaps they shouldn't be and "scsi scan" should always be in boot scripts.

Rob
Bin Meng Jan. 28, 2015, 1:20 a.m. UTC | #3
Hi Rob,

On Wed, Jan 28, 2015 at 1:38 AM, Rob Herring <robherring2@gmail.com> wrote:
> On Mon, Jan 26, 2015 at 7:23 PM, Simon Glass <sjg@chromium.org> wrote:
>> On some hardware this time can be significant. Add bootstage support for
>> measuring this. The result can be obtained using 'bootstage report' or
>> passed on to the Linux via the device tree.
>>
>> Signed-off-by: Simon Glass <sjg@chromium.org>
>> ---
>>
>>  common/cmd_scsi.c   | 2 ++
>>  include/bootstage.h | 1 +
>>  2 files changed, 3 insertions(+)
>>
>> diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c
>> index cbc107e..a0a62eb 100644
>> --- a/common/cmd_scsi.c
>> +++ b/common/cmd_scsi.c
>> @@ -217,8 +217,10 @@ void scsi_init(void)
>>                        (busdevfunc >> 8) & 0x7);
>>         }
>>  #endif
>> +       bootstage_start(BOOTSTAGE_ID_ACCUM_SCSI, "ahci");
>>         scsi_low_level_init(busdevfunc);
>>         scsi_scan(1);
>> +       bootstage_accum(BOOTSTAGE_ID_ACCUM_SCSI);
>
> This does not cover the case if the platform calls scsi_scan at boot.
> The first time is the important one as that will include disk spin-up
> time.
>
> Perhaps they shouldn't be and "scsi scan" should always be in boot scripts.
>

scsi_init() is called in common/board_r.c, which already covers the
boot scan case.

Regards,
Bin
Simon Glass Jan. 28, 2015, 5:07 a.m. UTC | #4
Hi,

On 27 January 2015 at 18:20, Bin Meng <bmeng.cn@gmail.com> wrote:
> Hi Rob,
>
> On Wed, Jan 28, 2015 at 1:38 AM, Rob Herring <robherring2@gmail.com> wrote:
>> On Mon, Jan 26, 2015 at 7:23 PM, Simon Glass <sjg@chromium.org> wrote:
>>> On some hardware this time can be significant. Add bootstage support for
>>> measuring this. The result can be obtained using 'bootstage report' or
>>> passed on to the Linux via the device tree.
>>>
>>> Signed-off-by: Simon Glass <sjg@chromium.org>
>>> ---
>>>
>>>  common/cmd_scsi.c   | 2 ++
>>>  include/bootstage.h | 1 +
>>>  2 files changed, 3 insertions(+)
>>>
>>> diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c
>>> index cbc107e..a0a62eb 100644
>>> --- a/common/cmd_scsi.c
>>> +++ b/common/cmd_scsi.c
>>> @@ -217,8 +217,10 @@ void scsi_init(void)
>>>                        (busdevfunc >> 8) & 0x7);
>>>         }
>>>  #endif
>>> +       bootstage_start(BOOTSTAGE_ID_ACCUM_SCSI, "ahci");
>>>         scsi_low_level_init(busdevfunc);
>>>         scsi_scan(1);
>>> +       bootstage_accum(BOOTSTAGE_ID_ACCUM_SCSI);
>>
>> This does not cover the case if the platform calls scsi_scan at boot.
>> The first time is the important one as that will include disk spin-up
>> time.
>>
>> Perhaps they shouldn't be and "scsi scan" should always be in boot scripts.
>>
>
> scsi_init() is called in common/board_r.c, which already covers the
> boot scan case.

I think platform data is missing. Rob if you are able to test this I
could send an updated patch?

Regards,
Simon
diff mbox

Patch

diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c
index cbc107e..a0a62eb 100644
--- a/common/cmd_scsi.c
+++ b/common/cmd_scsi.c
@@ -217,8 +217,10 @@  void scsi_init(void)
 		       (busdevfunc >> 8) & 0x7);
 	}
 #endif
+	bootstage_start(BOOTSTAGE_ID_ACCUM_SCSI, "ahci");
 	scsi_low_level_init(busdevfunc);
 	scsi_scan(1);
+	bootstage_accum(BOOTSTAGE_ID_ACCUM_SCSI);
 }
 #endif
 
diff --git a/include/bootstage.h b/include/bootstage.h
index df13ab2..6b7588d 100644
--- a/include/bootstage.h
+++ b/include/bootstage.h
@@ -194,6 +194,7 @@  enum bootstage_id {
 	BOOTSTAGE_ID_MAIN_CPU_READY,
 
 	BOOTSTAGE_ID_ACCUM_LCD,
+	BOOTSTAGE_ID_ACCUM_SCSI,
 
 	/* a few spare for the user, from here */
 	BOOTSTAGE_ID_USER,