mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: Rodolfo Giometti <giometti@enneenne.com>
Cc: linux-kernel@vger.kernel.org, Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] LinuxPPS - definitive version
Date: Tue, 24 Jul 2007 15:52:49 +0100	[thread overview]
Message-ID: <1185288769.14697.339.camel@pmac.infradead.org> (raw)
In-Reply-To: <20070724142050.GD4074@enneenne.com>

On Tue, 2007-07-24 at 16:20 +0200, Rodolfo Giometti wrote:
> On Tue, Jul 24, 2007 at 02:49:02PM +0100, David Woodhouse wrote:
> 
> > Also 's/unknow /unknown /' (2 instances)
> 
> ?? I didn't find them:
> 
>    $ grep 'unknow ' Documentation/pps/pps.txt

Elsewhere in the patch.

> > In order for your handling of 'pps_source[source].info' to be safe with
> > respect to pps_unregister_source(), you have to guarantee that
> > pps_event() has finished -- and can't be in progress on another CPU --
> > by the time your client's call to pps_unregister_source() completes. At
> > first glance I think your existing clients have that right (you have
> > del_timer_sync() before pps_unregister_source() in ktimer.c, for
> > example). But you should make sure it's clearly documented for new
> > clients.
> 
> This can be done only with locks, but it's not necessary since even if
> a pps_unregister_source() runs while pps_event() executes on another
> CPU the latter will write always on a valid area (even if it could be
> a dummy one) and the data are not corrupted (note also that the data
> will be, in any case, discarted since we are executing a
> pps_unregister_source()).

Read Documentation/memory-barriers.txt

There is a tiny but possibly non-zero chance that one CPU could be in
pps_event() and might not yet have 'seen' the change to the .info field.
Releasing the pps_mutex provides a write-barrier on the CPU which runs
pps_unregister_source(), but there's no corresponding read-barrier on
the CPU running pps_event(). You have to be careful about when
pps_event() is run. It _MUST_ not touch the old info structure after
pps_unregister_source() has completed.

At the moment, I think it's OK because you won't be calling pps_event()
at the wrong times. But you do need to make sure that requirement is
documented. And I think you can remove the whole dummy_info thing
because it's not necessary.

-- 
dwmw2


  parent reply	other threads:[~2007-07-24 14:53 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-17 18:05 Rodolfo Giometti
2007-07-23 13:35 ` David Woodhouse
2007-07-23 16:04   ` Rodolfo Giometti
2007-07-23 19:28   ` Andrew Morton
2007-07-23 19:48     ` David Woodhouse
2007-07-24  8:00   ` Rodolfo Giometti
2007-07-24 13:49     ` David Woodhouse
2007-07-24 14:20       ` Rodolfo Giometti
2007-07-24 14:46         ` David Woodhouse
2007-07-24 14:52         ` David Woodhouse [this message]
2007-07-24 16:01           ` Rodolfo Giometti
2007-07-27 18:44           ` LinuxPPS & spinlocks Rodolfo Giometti
2007-07-27 19:08             ` Chris Friesen
2007-07-27 19:28               ` Rodolfo Giometti
2007-07-27 19:40                 ` Chris Friesen
2007-07-27 19:45                   ` Rodolfo Giometti
2007-07-27 20:47                     ` Satyam Sharma
2007-07-27 23:41                       ` Satyam Sharma
2007-07-29  9:50                         ` Rodolfo Giometti
2007-07-30  5:03                           ` Satyam Sharma
2007-07-30  8:51                             ` Rodolfo Giometti
2007-07-30  9:20                               ` Satyam Sharma
2007-07-30 14:55                                 ` Rodolfo Giometti
2007-07-30 22:01                                   ` Satyam Sharma
2007-07-31  8:20                                     ` Rodolfo Giometti
2007-07-31 18:49                                       ` Satyam Sharma
2007-07-31 19:44                                         ` Rodolfo Giometti
2007-07-31 21:15                                           ` Satyam Sharma
2007-08-01 22:14                                 ` Christopher Hoover
2007-08-01 23:03                                   ` Satyam Sharma
2007-07-29  9:57                         ` Rodolfo Giometti
2007-07-29 10:00                         ` Rodolfo Giometti
2007-07-30  5:09                           ` Satyam Sharma
2007-07-30  8:53                             ` Rodolfo Giometti
2007-07-30  9:31                               ` Satyam Sharma
2007-07-29  9:17                       ` Rodolfo Giometti
2007-07-30  4:19                         ` Satyam Sharma
2007-07-30  8:32                           ` Rodolfo Giometti
2007-07-30  9:07                             ` Satyam Sharma
2007-07-24 14:31       ` [PATCH] LinuxPPS - definitive version Rodolfo Giometti
2007-07-24 14:45         ` David Woodhouse
2007-07-24 16:09           ` Rodolfo Giometti
2007-07-26 19:52         ` Roman Zippel

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=1185288769.14697.339.camel@pmac.infradead.org \
    --to=dwmw2@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=giometti@enneenne.com \
    --cc=linux-kernel@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 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®