linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: kbuild test robot <lkp@intel.com>
To: Petr Mladek <pmladek@suse.com>
Cc: kbuild-all@01.org, Andrew Morton <akpm@linux-foundation.org>,
	Oleg Nesterov <oleg@redhat.com>, Tejun Heo <tj@kernel.org>,
	Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Josh Triplett <josh@joshtriplett.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Jiri Kosina <jkosina@suse.cz>, Borislav Petkov <bp@suse.de>,
	Michal Hocko <mhocko@suse.cz>,
	linux-mm@kvack.org, Vlastimil Babka <vbabka@suse.cz>,
	linux-api@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 08/20] kthread: Allow to cancel kthread work
Date: Tue, 23 Feb 2016 00:50:22 +0800	[thread overview]
Message-ID: <201602230025.uuCAc4Tn%fengguang.wu@intel.com> (raw)
In-Reply-To: <1456153030-12400-9-git-send-email-pmladek@suse.com>

[-- Attachment #1: Type: text/plain, Size: 7060 bytes --]

Hi Petr,

[auto build test WARNING on soc-thermal/next]
[also build test WARNING on v4.5-rc5 next-20160222]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Petr-Mladek/kthread-Use-kthread-worker-API-more-widely/20160222-230250
base:   https://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal next
reproduce: make htmldocs

All warnings (new ones prefixed by >>):

   include/linux/init.h:1: warning: no structured comments found
   kernel/kthread.c:860: warning: No description found for parameter 'dwork'
   kernel/kthread.c:860: warning: No description found for parameter 'delay'
   kernel/kthread.c:860: warning: Excess function parameter 'work' description in 'queue_delayed_kthread_work'
>> kernel/kthread.c:1012: warning: bad line: 
   kernel/sys.c:1: warning: no structured comments found
   drivers/dma-buf/seqno-fence.c:1: warning: no structured comments found
   drivers/dma-buf/reservation.c:1: warning: no structured comments found
   include/linux/reservation.h:1: warning: no structured comments found
   include/linux/spi/spi.h:540: warning: No description found for parameter 'max_transfer_size'

vim +1012 kernel/kthread.c

   854	 * either the timer was running or the work was queued. It returns %true
   855	 * otherwise.
   856	 */
   857	bool queue_delayed_kthread_work(struct kthread_worker *worker,
   858					struct delayed_kthread_work *dwork,
   859					unsigned long delay)
 > 860	{
   861		struct kthread_work *work = &dwork->work;
   862		unsigned long flags;
   863		bool ret = false;
   864	
   865		spin_lock_irqsave(&worker->lock, flags);
   866	
   867		if (!queuing_blocked(work)) {
   868			__queue_delayed_kthread_work(worker, dwork, delay);
   869			ret = true;
   870		}
   871	
   872		spin_unlock_irqrestore(&worker->lock, flags);
   873		return ret;
   874	}
   875	EXPORT_SYMBOL_GPL(queue_delayed_kthread_work);
   876	
   877	struct kthread_flush_work {
   878		struct kthread_work	work;
   879		struct completion	done;
   880	};
   881	
   882	static void kthread_flush_work_fn(struct kthread_work *work)
   883	{
   884		struct kthread_flush_work *fwork =
   885			container_of(work, struct kthread_flush_work, work);
   886		complete(&fwork->done);
   887	}
   888	
   889	/**
   890	 * flush_kthread_work - flush a kthread_work
   891	 * @work: work to flush
   892	 *
   893	 * If @work is queued or executing, wait for it to finish execution.
   894	 */
   895	void flush_kthread_work(struct kthread_work *work)
   896	{
   897		struct kthread_flush_work fwork = {
   898			KTHREAD_WORK_INIT(fwork.work, kthread_flush_work_fn),
   899			COMPLETION_INITIALIZER_ONSTACK(fwork.done),
   900		};
   901		struct kthread_worker *worker;
   902		bool noop = false;
   903	
   904		worker = work->worker;
   905		if (!worker)
   906			return;
   907	
   908		spin_lock_irq(&worker->lock);
   909		/* Work must not be used with more workers, see queue_kthread_work(). */
   910		WARN_ON_ONCE(work->worker != worker);
   911	
   912		if (!list_empty(&work->node))
   913			insert_kthread_work(worker, &fwork.work, work->node.next);
   914		else if (worker->current_work == work)
   915			insert_kthread_work(worker, &fwork.work, worker->work_list.next);
   916		else
   917			noop = true;
   918	
   919		spin_unlock_irq(&worker->lock);
   920	
   921		if (!noop)
   922			wait_for_completion(&fwork.done);
   923	}
   924	EXPORT_SYMBOL_GPL(flush_kthread_work);
   925	
   926	/*
   927	 * This function removes the work from the worker queue. Also it makes sure
   928	 * that it won't get queued later via the delayed work's timer.
   929	 *
   930	 * The work might still be in use when this function finishes. See the
   931	 * current_work proceed by the worker.
   932	 *
   933	 * Return: %true if @work was pending and successfully canceled,
   934	 *	%false if @work was not pending
   935	 */
   936	static bool __cancel_kthread_work(struct kthread_work *work, bool is_dwork)
   937	{
   938		/* Try to cancel the timer if exists. */
   939		if (is_dwork) {
   940			struct delayed_kthread_work *dwork =
   941				container_of(work, struct delayed_kthread_work, work);
   942	
   943			del_timer_sync(&dwork->timer);
   944		}
   945	
   946		/*
   947		 * Try to remove the work from a worker list. It might either
   948		 * be from worker->work_list or from worker->delayed_work_list.
   949		 *
   950		 * Note that the work is still in the delayed list when del_timer_sync()
   951		 * raced with the timer callback. In this case the callback was not able
   952		 * to take the lock and move the work to the normal list.
   953		 */
   954		if (!list_empty(&work->node)) {
   955			list_del_init(&work->node);
   956			return true;
   957		}
   958	
   959		return false;
   960	}
   961	
   962	static bool __cancel_kthread_work_sync(struct kthread_work *work, bool is_dwork)
   963	{
   964		struct kthread_worker *worker = work->worker;
   965		unsigned long flags;
   966		int ret = false;
   967	
   968		if (!worker)
   969			goto out;
   970	
   971		spin_lock_irqsave(&worker->lock, flags);
   972		/* Work must not be used with more workers, see queue_kthread_work(). */
   973		WARN_ON_ONCE(worker != work->worker);
   974	
   975		/*
   976		 * work->canceling has two functions here. It blocks queueing until
   977		 * the cancel operation is complete. Also it tells the timer callback
   978		 * that it cannot take the worker lock. It prevents a deadlock between
   979		 * the callback and del_timer_sync().
   980		 */
   981		work->canceling++;
   982		ret = __cancel_kthread_work(work, is_dwork);
   983	
   984		if (worker->current_work != work)
   985			goto out_fast;
   986	
   987		spin_unlock_irqrestore(&worker->lock, flags);
   988		flush_kthread_work(work);
   989		/*
   990		 * Nobody is allowed to switch the worker or queue the work
   991		 * when .canceling is set.
   992		 */
   993		spin_lock_irqsave(&worker->lock, flags);
   994	
   995	out_fast:
   996		work->canceling--;
   997		spin_unlock_irqrestore(&worker->lock, flags);
   998	out:
   999		return ret;
  1000	}
  1001	
  1002	/**
  1003	 * cancel_kthread_work_sync - cancel a kthread work and wait for it to finish
  1004	 * @work: the kthread work to cancel
  1005	 *
  1006	 * Cancel @work and wait for its execution to finish.  This function
  1007	 * can be used even if the work re-queues itself. On return from this
  1008	 * function, @work is guaranteed to be not pending or executing on any CPU.
  1009	 *
  1010	 * cancel_kthread_work_sync(&delayed_work->work) must not be used for
  1011	 * delayed_work's. Use cancel_delayed_kthread_work_sync() instead.
> 1012	
  1013	 * The caller must ensure that the worker on which @work was last
  1014	 * queued can't be destroyed before this function returns.
  1015	 *

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 6229 bytes --]

  reply	other threads:[~2016-02-22 16:51 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-22 14:56 [PATCH v5 00/20] kthread: Use kthread worker API more widely Petr Mladek
2016-02-22 14:56 ` [PATCH v5 01/20] kthread/smpboot: Do not park in kthread_create_on_cpu() Petr Mladek
2016-02-22 14:56 ` [PATCH v5 02/20] kthread: Allow to call __kthread_create_on_node() with va_list args Petr Mladek
2016-02-22 14:56 ` [PATCH v5 03/20] kthread: Add create_kthread_worker*() Petr Mladek
2016-02-22 15:48   ` kbuild test robot
2016-02-24 15:56     ` Petr Mladek
2016-02-22 14:56 ` [PATCH v5 04/20] kthread: Add drain_kthread_worker() Petr Mladek
2016-02-25 12:35   ` Peter Zijlstra
2016-02-26 15:23     ` Petr Mladek
2016-02-27 15:18       ` Peter Zijlstra
2016-02-22 14:56 ` [PATCH v5 05/20] kthread: Add destroy_kthread_worker() Petr Mladek
2016-02-25 12:36   ` Peter Zijlstra
2016-02-26 15:15     ` Petr Mladek
2016-02-22 14:56 ` [PATCH v5 06/20] kthread: Detect when a kthread work is used by more workers Petr Mladek
2016-02-22 14:56 ` [PATCH v5 07/20] kthread: Initial support for delayed kthread work Petr Mladek
2016-02-22 16:06   ` kbuild test robot
2016-02-24 16:09     ` Petr Mladek
2016-02-22 14:56 ` [PATCH v5 08/20] kthread: Allow to cancel " Petr Mladek
2016-02-22 16:50   ` kbuild test robot [this message]
2016-02-24 16:18     ` Petr Mladek
2016-02-25 12:59       ` Peter Zijlstra
2016-02-26 15:38         ` Petr Mladek
2016-02-26 16:25           ` Peter Zijlstra
2016-02-26 17:00             ` Petr Mladek
2016-02-27 15:16               ` Peter Zijlstra
2016-02-22 14:56 ` [PATCH v5 09/20] kthread: Allow to modify delayed " Petr Mladek
2016-02-22 14:57 ` [PATCH v5 10/20] kthread: Better support freezable kthread workers Petr Mladek
2016-02-22 17:33   ` kbuild test robot
2016-02-24 16:25     ` Petr Mladek
2016-02-25 13:01   ` Peter Zijlstra
2016-02-26 15:43     ` Petr Mladek
2016-02-22 14:57 ` [PATCH v5 11/20] mm/huge_page: Convert khugepaged() into kthread worker API Petr Mladek
2016-02-22 14:57 ` [PATCH v5 12/20] ring_buffer: Convert benchmark kthreads " Petr Mladek
2016-02-22 14:57 ` [PATCH v5 13/20] hung_task: Convert hungtaskd " Petr Mladek
2016-02-22 14:57 ` [PATCH v5 14/20] kmemleak: Convert kmemleak kthread " Petr Mladek
2016-02-22 14:57 ` [PATCH v5 15/20] ipmi: Convert kipmi " Petr Mladek
2016-02-22 14:57 ` [PATCH v5 16/20] IB/fmr_pool: Convert the cleanup thread " Petr Mladek
2016-02-22 14:57 ` [PATCH v5 17/20] memstick/r592: Better synchronize debug messages in r592_io kthread Petr Mladek
2016-02-22 14:57 ` [PATCH v5 18/20] memstick/r592: convert r592_io kthread into kthread worker API Petr Mladek
2016-02-22 14:57 ` [PATCH v5 19/20] thermal/intel_powerclamp: Remove duplicated code that starts the kthread Petr Mladek
2016-02-22 14:57 ` [PATCH v5 20/20] thermal/intel_powerclamp: Convert the kthread to kthread worker API Petr Mladek

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=201602230025.uuCAc4Tn%fengguang.wu@intel.com \
    --to=lkp@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=bp@suse.de \
    --cc=jkosina@suse.cz \
    --cc=josh@joshtriplett.org \
    --cc=kbuild-all@01.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.cz \
    --cc=mingo@redhat.com \
    --cc=oleg@redhat.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=tj@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=vbabka@suse.cz \
    /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