mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: dougthompson@xmission.com
Cc: greg@kroah.com, ralf@linux-mips.org, egor@pasemi.com,
	alan@lxorguk.ukuu.org.uk, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/4] drivers edac fix reset edac_mc pollmsec
Date: Wed, 25 Jul 2007 22:20:19 -0700	[thread overview]
Message-ID: <20070725222019.a8e3cc00.akpm@linux-foundation.org> (raw)
In-Reply-To: <46a7b87d.9iKovb4wybPFkLX6%dougthompson@xmission.com>

On Wed, 25 Jul 2007 14:54:21 -0600 dougthompson@xmission.com wrote:

> +void edac_mc_reset_delay_period(int value)
>  {
> -	/* cancel the current workq request */
> -	edac_mc_workq_teardown(mci);
> +	struct mem_ctl_info *mci;
> +	struct list_head *item;
> +
> +	mutex_lock(&mem_ctls_mutex);
> +
> +	/* scan the list and turn off all workq timers, doing so under lock
> +	 */
> +	list_for_each(item, &mc_devices) {
> +		mci = list_entry(item, struct mem_ctl_info, link);
> +
> +		if (mci->op_state == OP_RUNNING_POLL)
> +			cancel_delayed_work(&mci->work);
> +	}
> +
> +	mutex_unlock(&mem_ctls_mutex);

cancel_delayed_work() on its own looks a bit racy.  The work could
presently be running on another CPU.

So generally we'll run flush_workqueue() or cancel_work_sync() after the
cancel_delayed_work() to make sure that it has really gone away.

Beware however that you're holding a lock here.  If any of the work
functions which can be at mci->work also take mem_ctls_mutex then it is
deadlocky to run flush_workqueue() or cancel_work_sync() while holding that
lock.


      reply	other threads:[~2007-07-26  5:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-25 20:54 dougthompson
2007-07-26  5:20 ` Andrew Morton [this message]

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=20070725222019.a8e3cc00.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=dougthompson@xmission.com \
    --cc=egor@pasemi.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ralf@linux-mips.org \
    /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

Powered by JetHome