lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200331143355.GP1922688@smile.fi.intel.com>
Date:   Tue, 31 Mar 2020 17:33:55 +0300
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Grant Likely <grant.likely@....com>
Cc:     linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
        nd@....com, Jonathan Corbet <corbet@....net>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Saravana Kannan <saravanak@...gle.com>
Subject: Re: [PATCH] Add documentation on meaning of -EPROBE_DEFER

On Fri, Mar 27, 2020 at 05:01:32PM +0000, Grant Likely wrote:
> Add a bit of documentation on what it means when a driver .probe() hook
> returns the -EPROBE_DEFER error code, including the limitation that
> -EPROBE_DEFER should be returned as early as possible, before the driver
> starts to register child devices.
> 
> Also: minor markup fixes in the same file

Greg, can we at least for time being have this documented, means applied?

FWIW,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>

> Signed-off-by: Grant Likely <grant.likely@....com>
> Cc: Jonathan Corbet <corbet@....net>
> Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> Cc: Saravana Kannan <saravanak@...gle.com>
> Cc: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> ---
>  .../driver-api/driver-model/driver.rst        | 32 ++++++++++++++++---
>  1 file changed, 27 insertions(+), 5 deletions(-)
> 
> diff --git a/Documentation/driver-api/driver-model/driver.rst b/Documentation/driver-api/driver-model/driver.rst
> index baa6a85c8287..63057d9bc8a6 100644
> --- a/Documentation/driver-api/driver-model/driver.rst
> +++ b/Documentation/driver-api/driver-model/driver.rst
> @@ -4,7 +4,6 @@ Device Drivers
>  
>  See the kerneldoc for the struct device_driver.
>  
> -
>  Allocation
>  ~~~~~~~~~~
>  
> @@ -167,9 +166,26 @@ the driver to that device.
>  
>  A driver's probe() may return a negative errno value to indicate that
>  the driver did not bind to this device, in which case it should have
> -released all resources it allocated::
> +released all resources it allocated.
> +
> +Optionally, probe() may return -EPROBE_DEFER if the driver depends on
> +resources that are not yet available (e.g., supplied by a driver that
> +hasn't initialized yet).  The driver core will put the device onto the
> +deferred probe list and will try to call it again later. If a driver
> +must defer, it should return -EPROBE_DEFER as early as possible to
> +reduce the amount of time spent on setup work that will need to be
> +unwound and reexecuted at a later time.
> +
> +.. warning::
> +      -EPROBE_DEFER must not be returned if probe() has already created
> +      child devices, even if those child devices are removed again
> +      in a cleanup path. If -EPROBE_DEFER is returned after a child
> +      device has been registered, it may result in an infinite loop of
> +      .probe() calls to the same driver.
> +
> +::
>  
> -	void (*sync_state)(struct device *dev);
> +	void	(*sync_state)	(struct device *dev);
>  
>  sync_state is called only once for a device. It's called when all the consumer
>  devices of the device have successfully probed. The list of consumers of the
> @@ -212,6 +228,8 @@ over management of devices from the bootloader, the usage of sync_state() is
>  not restricted to that. Use it whenever it makes sense to take an action after
>  all the consumers of a device have probed.
>  
> +::
> +
>  	int 	(*remove)	(struct device *dev);
>  
>  remove is called to unbind a driver from a device. This may be
> @@ -224,11 +242,15 @@ not. It should free any resources allocated specifically for the
>  device; i.e. anything in the device's driver_data field.
>  
>  If the device is still present, it should quiesce the device and place
> -it into a supported low-power state::
> +it into a supported low-power state.
> +
> +::
>  
>  	int	(*suspend)	(struct device *dev, pm_message_t state);
>  
> -suspend is called to put the device in a low power state::
> +suspend is called to put the device in a low power state.
> +
> +::
>  
>  	int	(*resume)	(struct device *dev);
>  
> -- 
> 2.20.1
> 

-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ