public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Haojian Zhuang <haojian.zhuang@linaro.org>
Cc: Grant Likely <grant.likely@secretlab.ca>,
	Andrew Morton <akpm@linux-foundation.org>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	viro@zeniv.linux.org.uk, Rusty Russell <rusty@rustcorp.com.au>,
	hpa@linux.intel.com, Jim Cromie <jim.cromie@gmail.com>,
	linux-kernel@vger.kernel.org,
	"Russell King - ARM Linux" <linux@arm.linux.org.uk>,
	Linus Walleij <linus.walleij@linaro.org>,
	broonie@opensource.wolfsonmicro.com,
	Patch Tracking <patches@linaro.org>
Subject: Re: [PATCH] driver core: add wait event for deferred probe
Date: Thu, 14 Feb 2013 16:50:20 +0000	[thread overview]
Message-ID: <201302141650.21144.arnd@arndb.de> (raw)
In-Reply-To: <CAD6h2NS_eR7zJjwAuBJPRrCb9=-4r=y-QJt7Lvg5U+yBf-e=kw@mail.gmail.com>

On Thursday 14 February 2013, Haojian Zhuang wrote:
> On 14 February 2013 23:57, Arnd Bergmann <arnd@arndb.de> wrote:
> > On Thursday 14 February 2013, Haojian Zhuang wrote:
> >> If you can change it into code in below, it could work. Otherwise, it
> >> always fails.
> >>         driver_deferred_probe_enable = true;
> >>         driver_deferred_probe_trigger();
> >> +      deferred_probe_work_func(NULL);
> >>         return 0;
> >>
> >> Because deferred_probe_work_func() depends on that deferred_probe is added
> >> into deferred_probe_active_list. If driver_deferred_probe_trigger() isn't called
> >> first, the deferred uart probe can't be added into active list. So even you call
> >> work_func at here, it doesn't help.
> >>
> >
> > Would that not cause two instances of the work function to run at the same time?
> > That sounds like a source for a lot of problems.
> >
> >         Arnd
> 
> Two instances of the work function? I'm sorry that I don't
> understanding your meaning.
> Could you help explain your question?

I mean you end up calling the work function directly, while it gets run as part
of the work queue on a different CPU at the same time. I just noticed that
there is actually locking in place in deferred_probe_work_func that prevents
any actual bugs, but you are still adding extra overhead here.

Maybe just add

	flush_workqueue(deferred_wq);

here?

	Arnd

  reply	other threads:[~2013-02-14 16:50 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-09 16:57 [PATCH] driver core: add wait event for deferred probe Haojian Zhuang
2013-02-11 23:10 ` Andrew Morton
2013-02-12  2:52   ` Haojian Zhuang
2013-02-13 21:36     ` Grant Likely
2013-02-14  3:27       ` anish singh
2013-02-14  9:56         ` Arnd Bergmann
2013-02-14 10:04           ` Russell King - ARM Linux
2013-02-14 11:08             ` Arnd Bergmann
2013-02-14 16:33         ` Grant Likely
2013-02-14 17:42           ` anish kumar
2013-02-14 15:52       ` Haojian Zhuang
2013-02-14 15:57         ` Arnd Bergmann
2013-02-14 16:04           ` Haojian Zhuang
2013-02-14 16:50             ` Arnd Bergmann [this message]
2013-02-14 16:58               ` Haojian Zhuang
2013-02-14 17:54                 ` Grant Likely
2013-02-14 17:42           ` Grant Likely
2013-02-14 17:38         ` Grant Likely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201302141650.21144.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=akpm@linux-foundation.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=grant.likely@secretlab.ca \
    --cc=gregkh@linuxfoundation.org \
    --cc=haojian.zhuang@linaro.org \
    --cc=hpa@linux.intel.com \
    --cc=jim.cromie@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=patches@linaro.org \
    --cc=rusty@rustcorp.com.au \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox