Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1539754

Re: [PATCH] driver core: flush async calls before testing driver removal

From Dmitry Torokhov <dmitry.torokhov@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] driver core: flush async calls before testing driver removal
Date 2016-12-10 03:00 +0100
Message-ID <sMF7b-2hy-1@gated-at.bofh.it> (permalink)
References <sMDyp-1x9-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Dec 9, 2016 at 4:15 PM, Vladimir Zapolskiy <vz@mleia.com> wrote:
> If CONFIG_DEBUG_TEST_DRIVER_REMOVE option is enabled a number of false
> positives are reported for ATA controller drivers, because ATA port
> probes are done asynchronously, and the same problem may also touch
> other asynchronously probed drivers.
>
> To reduce the rate of false reports on boot call async_synchronize_full()
> before attempting to remove a driver, the same is done in delete_module()
> syscall for all possible drivers and in __device_release_driver() function
> for asynchronously probed drivers.

I'd say CONFIG_DEBUG_TEST_DRIVER_REMOVE did what it was supposed to do
and uncovered a big in ATA drivers. Since driver core did not
asynchronously scheduled those actions it should not wait for their
completion either, but either ATA core or drivers should wait for
probing to complete before allowing remove() methods to run.

>
> Fixes: bea5b158ff0d ("driver core: add test of driver remove calls during probe")
> Suggested-by: Tejun Heo <tj@kernel.org>
> Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
> ---
> Some time ago the issue was discussed on the linux-ide mailing list, see
>
>   https://www.spinics.net/lists/linux-ide/msg53481.html
>
>  drivers/base/dd.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/base/dd.c b/drivers/base/dd.c
> index d76cd97..a4feecf 100644
> --- a/drivers/base/dd.c
> +++ b/drivers/base/dd.c
> @@ -384,6 +384,8 @@ static int really_probe(struct device *dev, struct device_driver *drv)
>         if (test_remove) {
>                 test_remove = false;
>
> +               async_synchronize_full();
> +
>                 if (dev->bus->remove)
>                         dev->bus->remove(dev);
>                 else if (drv->remove)
> --
> 2.10.2
>

Thanks.

-- 
Dmitry

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] driver core: flush async calls before testing driver removal Vladimir Zapolskiy <vz@mleia.com> - 2016-12-10 01:20 +0100
  Re: [PATCH] driver core: flush async calls before testing driver removal Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2016-12-10 03:00 +0100
    Re: [PATCH] driver core: flush async calls before testing driver  removal Vladimir Zapolskiy <vz@mleia.com> - 2016-12-10 14:00 +0100
  Re: [PATCH] driver core: flush async calls before testing driver  removal Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-12-10 08:40 +0100
    Re: [PATCH] driver core: flush async calls before testing driver  removal Vladimir Zapolskiy <vz@mleia.com> - 2016-12-10 13:40 +0100
      Re: [PATCH] driver core: flush async calls before testing driver  removal Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-12-10 14:10 +0100
        Re: [PATCH] driver core: flush async calls before testing driver  removal Vladimir Zapolskiy <vz@mleia.com> - 2016-12-11 02:50 +0100
          Re: [PATCH] driver core: flush async calls before testing driver  removal Tejun Heo <tj@kernel.org> - 2016-12-12 19:00 +0100
            Re: [PATCH] driver core: flush async calls before testing driver removal Rob Herring <robh@kernel.org> - 2016-12-12 19:40 +0100
              Re: [PATCH] driver core: flush async calls before testing driver  removal Tejun Heo <tj@kernel.org> - 2016-12-12 19:50 +0100

csiph-web