diff mbox series

i2c: i801: Prefer async probe

Message ID 20220826074430.1333272-1-mani@chromium.org
State Accepted
Commit 342530f7fe1ada578452c4daa2c9b5902cedf480
Headers show
Series i2c: i801: Prefer async probe | expand

Commit Message

Mani Milani Aug. 26, 2022, 7:44 a.m. UTC
This i801 driver probe can take more than ~190ms in some devices, since
the "i2c_register_spd()" call was added inside
"i801_probe_optional_slaves()".

Prefer async probe so that other drivers can be probed and boot can
continue in parallel while this driver loads, to reduce boot time. There is
no reason to block other drivers from probing while this driver is
loading.

Signed-off-by: Mani Milani <mani@chromium.org>
---

 drivers/i2c/busses/i2c-i801.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Jean Delvare Sept. 29, 2022, 3:43 p.m. UTC | #1
Hi Mani,

On Fri, 26 Aug 2022 17:44:30 +1000, Mani Milani wrote:
> This i801 driver probe can take more than ~190ms in some devices, since
> the "i2c_register_spd()" call was added inside
> "i801_probe_optional_slaves()".

Is there anything special about this 190 ms value?

> Prefer async probe so that other drivers can be probed and boot can
> continue in parallel while this driver loads, to reduce boot time. There is
> no reason to block other drivers from probing while this driver is
> loading.
> 
> Signed-off-by: Mani Milani <mani@chromium.org>
> ---
> 
>  drivers/i2c/busses/i2c-i801.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
> index a176296f4fff..e06509edc5f3 100644
> --- a/drivers/i2c/busses/i2c-i801.c
> +++ b/drivers/i2c/busses/i2c-i801.c
> @@ -1838,6 +1838,7 @@ static struct pci_driver i801_driver = {
>  	.shutdown	= i801_shutdown,
>  	.driver		= {
>  		.pm	= &i801_pm_ops,
> +		.probe_type = PROBE_PREFER_ASYNCHRONOUS,
>  	},
>  };
>  

Seems reasonable. I can't foresee any problem that would occur from
this change, and preliminary testing on my own workstation is OK.

Jarkko, Heiner, Wolfram, can you think of any reason why we should NOT
apply this change?

Thanks,
Wolfram Sang Sept. 29, 2022, 8:59 p.m. UTC | #2
> Jarkko, Heiner, Wolfram, can you think of any reason why we should NOT
> apply this change?

Nope. Even if we overlooked something, we can still revert and figure
out what went wrong.
Mani Milani Sept. 30, 2022, 8:45 a.m. UTC | #3
Hi Jean,

No, there is nothing special about the 190ms. It is just what I
measured on my device under test. I decided to include it in the
commit message to give a rough idea on how much delay this driver
probe can be adding to boot time.

Thank you Jean and Wolfram for reviewing.

P.S:   Apologies for sending this twice! My previous message was
rejected by the mailing list due to containing HTML subparts. (fingers
crossed this time)
Jarkko Nikula Sept. 30, 2022, 10:26 a.m. UTC | #4
On 9/29/22 18:43, Jean Delvare wrote:
>> diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
>> index a176296f4fff..e06509edc5f3 100644
>> --- a/drivers/i2c/busses/i2c-i801.c
>> +++ b/drivers/i2c/busses/i2c-i801.c
>> @@ -1838,6 +1838,7 @@ static struct pci_driver i801_driver = {
>>   	.shutdown	= i801_shutdown,
>>   	.driver		= {
>>   		.pm	= &i801_pm_ops,
>> +		.probe_type = PROBE_PREFER_ASYNCHRONOUS,
>>   	},
>>   };
>>   
> 
> Seems reasonable. I can't foresee any problem that would occur from
> this change, and preliminary testing on my own workstation is OK.
> 
> Jarkko, Heiner, Wolfram, can you think of any reason why we should NOT
> apply this change?
> 
I tested this on two systems. One with EE1004-compliant SPD EEPROM and 
another with touchpad connected to RMI4 SMB bus.

Average boot time improved ~20 ms over 5 boots on the first system and 
did not see any issue with the touchpad on second.

Tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Jean Delvare Sept. 30, 2022, 1:24 p.m. UTC | #5
On Fri, 26 Aug 2022 17:44:30 +1000, Mani Milani wrote:
> This i801 driver probe can take more than ~190ms in some devices, since
> the "i2c_register_spd()" call was added inside
> "i801_probe_optional_slaves()".
> 
> Prefer async probe so that other drivers can be probed and boot can
> continue in parallel while this driver loads, to reduce boot time. There is
> no reason to block other drivers from probing while this driver is
> loading.
> 
> Signed-off-by: Mani Milani <mani@chromium.org>
> ---
> 
>  drivers/i2c/busses/i2c-i801.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
> index a176296f4fff..e06509edc5f3 100644
> --- a/drivers/i2c/busses/i2c-i801.c
> +++ b/drivers/i2c/busses/i2c-i801.c
> @@ -1838,6 +1838,7 @@ static struct pci_driver i801_driver = {
>  	.shutdown	= i801_shutdown,
>  	.driver		= {
>  		.pm	= &i801_pm_ops,
> +		.probe_type = PROBE_PREFER_ASYNCHRONOUS,
>  	},
>  };
>  

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Wolfram Sang Oct. 1, 2022, 10:56 p.m. UTC | #6
On Fri, Aug 26, 2022 at 05:44:30PM +1000, Mani Milani wrote:
> This i801 driver probe can take more than ~190ms in some devices, since
> the "i2c_register_spd()" call was added inside
> "i801_probe_optional_slaves()".
> 
> Prefer async probe so that other drivers can be probed and boot can
> continue in parallel while this driver loads, to reduce boot time. There is
> no reason to block other drivers from probing while this driver is
> loading.
> 
> Signed-off-by: Mani Milani <mani@chromium.org>

Applied to for-next, thanks!
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index a176296f4fff..e06509edc5f3 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -1838,6 +1838,7 @@  static struct pci_driver i801_driver = {
 	.shutdown	= i801_shutdown,
 	.driver		= {
 		.pm	= &i801_pm_ops,
+		.probe_type = PROBE_PREFER_ASYNCHRONOUS,
 	},
 };