From: "Liu, Chuansheng" <chuansheng.liu@intel.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: "john.stultz@linaro.org" <john.stultz@linaro.org>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH 2/3] alarmtimer: Using the alarmtimer_get_rtcdev for all posix clock interface
Date: Fri, 2 Nov 2012 03:41:14 +0000 [thread overview]
Message-ID: <27240C0AC20F114CBF8149A2696CBE4A1BAAD8@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <alpine.LFD.2.02.1211012343120.2756@ionos>
> -----Original Message-----
> From: Thomas Gleixner [mailto:tglx@linutronix.de]
> Sent: Friday, November 02, 2012 6:56 AM
> To: Liu, Chuansheng
> Cc: john.stultz@linaro.org; gregkh@linuxfoundation.org;
> linux-kernel@vger.kernel.org
> Subject: Re: [PATCH 2/3] alarmtimer: Using the alarmtimer_get_rtcdev for all
> posix clock interface
>
> On Thu, 1 Nov 2012, Chuansheng Liu wrote:
> >
> > Some posix clock interface directly use the variable rtcdev,
> > cleanup it here by alarmtimer_get_rtcdev().
> >
> > Signed-off-by: liu chuansheng <chuansheng.liu@intel.com>
> > ---
> > kernel/time/alarmtimer.c | 13 ++++++-------
> > 1 files changed, 6 insertions(+), 7 deletions(-)
> >
> > diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c
> > index 4fc17cb..5490fa8 100644
> > --- a/kernel/time/alarmtimer.c
> > +++ b/kernel/time/alarmtimer.c
> > @@ -86,11 +86,10 @@ static int alarmtimer_rtc_add_device(struct device
> *dev,
> > return -1;
> >
> > mutex_lock(&rtcdev_mutex);
> > - if (!rtcdev) {
> > - rtcdev = rtc;
> > - /* hold a reference so it doesn't go away */
> > - get_device(dev);
> > - }
> > + rtcdev = rtc;
> > + /* hold a reference so it doesn't go away */
> > + get_device(dev);
> > +
>
> Brilliant.
>
> rtcdev = NULL
>
> CPU0 CPU 1
>
> alarmtimer_rtc_add_device(A)
> if (rtcdev) alarmtimer_rtc_add_device(B)
> return -EBUSY; if (rtcdev)
> mutex_lock(); return -EBUSY;
> rtcdev = A; mutex_lock();
> mutex_unlock;
>
> bla = alarmtimer_rtc_get_device()
>
> So bla = A
> mutex_lock() returns
> rtcdev = B;
> mutex_unlock();
>
> The next call to alarmtimer_rtc_get_device() will return B. Not what
> you want. Maybe you want that, but then your patch is missing an
> explanation why you want that and why this would be a desired
> behaviour.
Thanks your pointing out, I am wrong.
>
> Thanks,
>
> tglx
next prev parent reply other threads:[~2012-11-02 3:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-31 16:20 [PATCH 1/3] alarmtimer: Replace the spinlock rtcdev_lock with mutex Chuansheng Liu
2012-10-31 9:03 ` Oliver Neukum
2012-11-01 0:02 ` Liu, Chuansheng
2012-11-01 22:43 ` Thomas Gleixner
2012-11-02 3:32 ` Liu, Chuansheng
2012-10-31 16:23 ` [PATCH 2/3] alarmtimer: Using the alarmtimer_get_rtcdev for all posix clock interface Chuansheng Liu
2012-11-01 22:55 ` Thomas Gleixner
2012-11-02 3:41 ` Liu, Chuansheng [this message]
2012-11-02 6:10 ` Liu, Chuansheng
2012-10-31 16:25 ` [PATCH 3/3] alarmtimer: cleanup the POSIX clock interface without CONFIG_RTC_CLASS Chuansheng Liu
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=27240C0AC20F114CBF8149A2696CBE4A1BAAD8@SHSMSX101.ccr.corp.intel.com \
--to=chuansheng.liu@intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
/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
all inboxes | Powered by JetHome®