All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: David Milburn <dmilburn@redhat.com>
Cc: jeff@garzik.org, linux-ide@vger.kernel.org, kristen.c.accardi@intel.com
Subject: Re: [RFC PATCH] libata: ahci enclosure management sync
Date: Wed, 15 Oct 2008 15:22:01 +0900	[thread overview]
Message-ID: <48F58C09.6050905@kernel.org> (raw)
In-Reply-To: <20081015013916.GA5982@dhcp-210.hsv.redhat.com>

David Milburn wrote:
> Hello,
> 
> Shouldn't we synchronize ahci_sw_activity and ahci_sw_activity_blink?
> Isn't it possible that __run_timers has detached the timer so it is
> no longer pending and it is in the process of running the timer func
> on one cpu, and ahci_sw_activity is running on another cpu and may
> see no timer pending so both ahci_sw_activity and ahci_sw_activity_blink
> modify the timeout. Also, ahci_sw_activity is incrementing
> emp->activity and ahci_sw_activity_blink is reading this value.
> Since ap->lock is already being held when ahci_sw_activity runs
> shouldn't ahci_sw_activity_blink grab this lock to better sync
> between the two? 
> 
> Thanks,
> David
> 
>  drivers/ata/ahci.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
> index 2e1a7cb..1573ce3 100644
> --- a/drivers/ata/ahci.c
> +++ b/drivers/ata/ahci.c
> @@ -1227,6 +1227,7 @@ static void ahci_sw_activity_blink(unsigned long arg)
>  	 * toggle state of LED and reset timer.  If not,
>  	 * turn LED to desired idle state.
>  	 */
> +	spin_lock(ap->lock);

You'll need to use spin_lock_irqsave and unlock_irqrestore.  Other than
that, nice catch.

Thanks.

-- 
tejun

      reply	other threads:[~2008-10-15  6:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-15  1:39 [RFC PATCH] libata: ahci enclosure management sync David Milburn
2008-10-15  6:22 ` Tejun Heo [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=48F58C09.6050905@kernel.org \
    --to=tj@kernel.org \
    --cc=dmilburn@redhat.com \
    --cc=jeff@garzik.org \
    --cc=kristen.c.accardi@intel.com \
    --cc=linux-ide@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.