14 Jan, 2011

40 commits

  • Add parallel port PPS client. It uses a standard method for capturing
    timestamps for assert edge transitions: getting a timestamp soon after an
    interrupt has happened.

    This is not a very precise source of time information due to interrupt
    handling delays. However, timestamps for clear edge transitions are much
    more precise because the interrupt handler continuously polls hardware
    port until the transition is done.

    Hardware port operations require only about 1us so the maximum error
    should not exceed this value. This was my primary goal when developing
    this client.

    Clear edge capture could be disabled using clear_wait parameter.

    Signed-off-by: Alexander Gordeev
    Acked-by: Rodolfo Giometti
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexander Gordeev
     
  • Add an optional feature of PPSAPI, kernel consumer support, which uses the
    added hardpps() function.

    Signed-off-by: Alexander Gordeev
    Acked-by: Rodolfo Giometti
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexander Gordeev
     
  • MONOTONIC_RAW clock timestamps are ideally suited for frequency
    calculation and also fit well into the original NTP hardpps design. Now
    phase and frequency can be adjusted separately: the former based on
    REALTIME clock and the latter based on MONOTONIC_RAW clock.

    A new function getnstime_raw_and_real is added to timekeeping subsystem to
    capture both timestamps at the same time and atomically.

    Signed-off-by: Alexander Gordeev
    Acked-by: John Stultz
    Cc: Rodolfo Giometti
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexander Gordeev
     
  • This commit adds hardpps() implementation based upon the original one from
    the NTPv4 reference kernel code from David Mills. However, it is highly
    optimized towards very fast syncronization and maximum stickness to PPS
    signal. The typical error is less then a microsecond.

    To make it sync faster I had to throw away exponential phase filter so
    that the full phase offset is corrected immediately. Then I also had to
    throw away median phase filter because it gives a bigger error itself if
    used without exponential filter.

    Maybe we will find an appropriate filtering scheme in the future but it's
    not necessary if the signal quality is ok.

    Signed-off-by: Alexander Gordeev
    Acked-by: John Stultz
    Cc: Rodolfo Giometti
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexander Gordeev
     
  • Remove the code that gatheres timestamp in pps_tty_dcd_change() in case
    passed ts parameter is NULL because it never happens in the current code.
    Fix comments as well.

    Signed-off-by: Alexander Gordeev
    Acked-by: Rodolfo Giometti
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexander Gordeev
     
  • Bitwise conjunction is distributive so we can simplify some conditions.

    Signed-off-by: Alexander Gordeev
    Acked-by: Rodolfo Giometti
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexander Gordeev
     
  • This way less overhead is involved when running production kernel. If you
    want to debug a pps client module please define DEBUG to enable the
    checks.

    Signed-off-by: Alexander Gordeev
    Acked-by: Rodolfo Giometti
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexander Gordeev
     
  • Now pps_idr_lock is never used in interrupt context so we can replace
    spin_lock_irq/spin_unlock_irq with plain spin_lock/spin_unlock. But
    there is also a potential race condition when someone can steal an id
    which was allocated by idr_pre_get before it is used. So convert spin
    lock to mutex and protect the whole id generation process.

    Signed-off-by: Alexander Gordeev
    Cc: Rodolfo Giometti
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexander Gordeev
     
  • Since now idr is only used to manage char device id's and not used in
    kernel API anymore it should be moved to pps.c. This also makes it
    possible to release id only at actual device freeing so nobody can
    register a pps device with the same id while our device is not freed yet.

    Signed-off-by: Alexander Gordeev
    Acked-by: Rodolfo Giometti
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexander Gordeev
     
  • Since we now have direct pointers to struct pps_device everywhere it's
    easy to use dev_* functions to print messages instead of plain printks.
    Where dev_* cannot be used printks are converted to pr_*.

    Signed-off-by: Alexander Gordeev
    Acked-by: Rodolfo Giometti
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexander Gordeev
     
  • Using device index as a pointer needs some unnecessary work to be done
    every time the pointer is needed (in irq handler for example). Using a
    direct pointer is much more easy (and safe as well).

    Signed-off-by: Alexander Gordeev
    Acked-by: Rodolfo Giometti
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexander Gordeev
     
  • Add a helper function to gather timestamps. This way clients don't have
    to duplicate it.

    Signed-off-by: Alexander Gordeev
    Acked-by: Rodolfo Giometti
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexander Gordeev
     
  • There was a race in PPS_FETCH ioctl handler when several processes want to
    obtain PPS data simultaneously using sleeping PPS_FETCH. They all sleep
    most of the time in the system call.

    With the old approach when the first process waiting on the pps queue is
    waken up it makes new system call right away and zeroes pps->go. So other
    processes continue to sleep. This is a clear race condition because of
    the global 'go' variable.

    With the new approach pps->last_ev holds some value increasing at each PPS
    event. PPS_FETCH ioctl handler saves current value to the local variable
    at the very beginning so it can safely check that there is a new event by
    just comparing both variables.

    Signed-off-by: Alexander Gordeev
    Acked-by: Rodolfo Giometti
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexander Gordeev
     
  • Move variable declarations where they are used in pps_cdev_ioctl.

    Signed-off-by: Alexander Gordeev
    Acked-by: Rodolfo Giometti
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexander Gordeev
     
  • Here are some very trivial fixes combined:

    - add macro definitions to protect header file from including several times

    - remove declaration for an unexistent array

    - fix typos

    Signed-off-by: Alexander Gordeev
    Acked-by: Rodolfo Giometti
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexander Gordeev
     
  • Commit 4be2c95d ("taskstats: pad taskstats netlink response for aligment
    issues on ia64") added a null field to align the taskstats structure but
    the discussion centered around ia64. The issue exists on other platforms
    with inefficient unaligned access and adding them piecemeal would be an
    unmaintainable mess.

    This patch uses Dave Miller's suggestion of using a combination of
    CONFIG_64BIT && !CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS to determine
    whether alignment is needed.

    Note that this will cause breakage on those platforms with applications
    like iotop which had hard-coded offsets into the packet to access the
    taskstats structure.

    The message seen on systems without the alignment fixes looks like: kernel
    unaligned access to 0xe000023879dca9bc, ip=0xa000000100133d10

    The addresses may vary but resolve to locations inside __delayacct_add_tsk.

    iotop makes what I'd call unreasonable assumptions about the contents of a
    netlink genetlink packet containing generic attributes. They're typed and
    have headers that specify value lengths, so the client can (should)
    identify and skip the ones the client doesn't understand.

    The kernel, as of version 2.6.36, presented a packet like so:
    +--------------------------------+
    | genlmsghdr - 4 bytes |
    +--------------------------------+
    | NLA header - 4 bytes | /* Aggregate header */
    +-+------------------------------+
    | | NLA header - 4 bytes | /* PID header */
    | +------------------------------+
    | | pid/tgid - 4 bytes |
    | +------------------------------+
    | | NLA header - 4 bytes | /* stats header */
    | + -----------------------------+
    Reported-by: David S. Miller
    Acked-by: David S. Miller
    Cc: Dan Carpenter
    Cc: Balbir Singh
    Cc: Florian Mickler
    Cc: Guillaume Chazarain
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Mahoney
     
  • Creates a new "Near Field Communication" subsystem in drivers/nfc.
    http://en.wikipedia.org/wiki/Near_Field_Communication is useful ;)

    This is a driver for the pn544 NFC device. The driver transfers
    ETSI messages between the device and the user space.

    Signed-off-by: Matti J. Aaltonen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Matti J. Aaltonen
     
  • Currently on 64-bit arch the user_namespace is 2096 and when being
    kmalloc-ed it resides on a 4k slab wasting 2003 bytes.

    If we allocate a separate cache for it and reduce the hash size from 128
    to 64 chains the packaging becomes *much* better - the struct is 1072
    bytes and the hole between is 98 bytes.

    [akpm@linux-foundation.org: s/__initcall/module_init/]
    Signed-off-by: Pavel Emelyanov
    Acked-by: Serge E. Hallyn
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Pavel Emelyanov
     
  • ctl_unnumbered.txt have been removed in Documentation directory so just
    also remove this invalid comments

    [akpm@linux-foundation.org: fix Documentation/sysctl/00-INDEX, per Dave]
    Signed-off-by: Jovi Zhang
    Cc: Dave Young
    Acked-by: WANG Cong
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jovi Zhang
     
  • Signed-off-by: Jovi Zhang
    Acked-by: WANG Cong
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jovi Zhang
     
  • In fsl_rio_dbell_handler() the code currently simply acknowledges the QFI
    queue full interrupt, but does nothing to resolve the queue full
    condition. Instead, it jumps to the end of the isr. When a queue full
    condition occurs, the isr is then re-entered immediately and continually,
    forever.

    The fix is to just fall through and read out current doorbell entries.

    Signed-off-by: Thomas Taranowski
    Cc: Alexandre Bounine
    Cc: Kumar Gala
    Cc: Matt Porter
    Cc: Li Yang
    Cc: Thomas Moll
    Cc: Micha Nelissen
    Cc: Benjamin Herrenschmidt
    Cc: Grant Likely
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Thomas Taranowski
     
  • Add new sRIO switch device IDs and enable a basic support for them.

    Signed-off-by: Alexandre Bounine
    Cc: Kumar Gala
    Cc: Matt Porter
    Cc: Li Yang
    Cc: Thomas Moll
    Cc: Micha Nelissen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexandre Bounine
     
  • Change the way how switchid value is set. Local counter variable does not
    provide unified way to identify switch devices in a system with multiple
    processors. Using local counter leads to the situation when the same RIO
    switch has different switch ID for each processor. Replacing local
    counter with unique portion of the Component Tag provides unified
    reference to the switch by every processor in the system.

    Signed-off-by: Alexandre Bounine
    Cc: Kumar Gala
    Cc: Matt Porter
    Cc: Li Yang
    Cc: Thomas Moll
    Cc: Micha Nelissen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexandre Bounine
     
  • Add setting links between rio_dev objects into the discovery process.
    This needed to report device connections on agent (non-host) processors
    that perform RIO discovery. Originally, these links have been introduced
    for enumerating host only to support error management.

    Signed-off-by: Alexandre Bounine
    Cc: Kumar Gala
    Cc: Matt Porter
    Cc: Li Yang
    Cc: Thomas Moll
    Cc: Micha Nelissen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexandre Bounine
     
  • Add definition of the unique device identifier field in the component tag.
    RIO_CTAG_UDEVID does not take all 32 bits of the component tag value to
    allow future extensions to the component tag use.

    Selected size of the RIO_CTAG_UDEVID field (17 bits) is sufficient to
    accommodate maximum number of endpoints in large RIO network (16-bit id)
    plus switches.

    Signed-off-by: Alexandre Bounine
    Cc: Kumar Gala
    Cc: Matt Porter
    Cc: Li Yang
    Cc: Thomas Moll
    Cc: Micha Nelissen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexandre Bounine
     
  • Convert RIO switches device structures (rio_dev + rio_switch) into a
    single allocation unit.

    This change is based on the fact that RIO switches are using common RIO
    device objects anyway. Allocating RIO switch objects as RIO devices with
    added space for switch information simplifies handling of RIO switch
    devices.

    Signed-off-by: Alexandre Bounine
    Cc: Kumar Gala
    Cc: Matt Porter
    Cc: Li Yang
    Cc: Thomas Moll
    Cc: Micha Nelissen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexandre Bounine
     
  • Change code to use one storage location common for switches and endpoints.
    This eliminates unnecessary device type checks during basic access
    operations. Logic that assigns destid to RIO devices stays unchanged - as
    before, switches use an associated destid because they do not have their
    own.

    Signed-off-by: Alexandre Bounine
    Cc: Kumar Gala
    Cc: Matt Porter
    Cc: Li Yang
    Cc: Thomas Moll
    Cc: Micha Nelissen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexandre Bounine
     
  • Commit 66fa12c571d3 ("ieee1394: remove the old IEEE 1394 driver stack")
    eliminated the only user of cdev_index(). So it can be removed too.

    Signed-off-by: Namhyung Kim
    Cc: Stefan Richter
    Cc: Theodore Ts'o
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Namhyung Kim
     
  • Commit 34aacb2920 ("procfs: Use generic_file_llseek in /proc/kcore") broke
    seeking on /proc/kcore. This changes it back to use default_llseek in
    order to restore the original behavior.

    The problem with generic_file_llseek is that it only allows seeks up to
    inode->i_sb->s_maxbytes, which is 2GB-1 on procfs, where the memory file
    offset values in the /proc/kcore PT_LOAD segments may exceed or start
    beyond that offset value.

    A similar revert was made for /proc/vmcore.

    Signed-off-by: Dave Anderson
    Acked-by: Frederic Weisbecker
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dave Anderson
     
  • Filename is supposed to match procfile name for random junk.

    Add __init while I'm at it.

    Signed-off-by: Alexey Dobriyan
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     
  • For the common case where a proc entry is being removed and nobody is in
    the process of using it, save a LOCK/UNLOCK pair.

    Signed-off-by: Alexey Dobriyan
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     
  • Add a PageSlab() check before adding the _mapcount value to /kpagecount.
    page->_mapcount is in a union with the SLAB structure so for pages
    controlled by SLAB, page_mapcount() returns nonsense.

    Signed-off-by: Petr Holasek
    Cc: Wu Fengguang
    Cc: Matt Mackall
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Petr Holasek
     
  • single_open()'s third argument is for copying into seq_file->private. Use
    that, rather than open-coding it.

    Signed-off-by: Jovi Zhang
    Acked-by: David Rientjes
    Acked-by: Alexey Dobriyan
    Reviewed-by: KOSAKI Motohiro
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jovi Zhang
     
  • - ->low_ino is write-once field -- reading it under locks is unnecessary.

    - /proc/$PID stuff never reaches pde_put()/free_proc_entry() --
    PROC_DYNAMIC_FIRST check never triggers.

    - in proc_get_inode(), inode number always matches proc dir entry, so
    save one parameter.

    Signed-off-by: Alexey Dobriyan
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     
  • For string without format specifiers, use seq_puts().
    For seq_printf("\n"), use seq_putc('\n').

    text data bss dec hex filename
    61866 488 112 62466 f402 fs/proc/proc.o
    61729 488 112 62329 f379 fs/proc/proc.o
    ----------------------------------------------------
    -139

    Signed-off-by: Alexey Dobriyan
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     
  • /proc/*/statm code needlessly truncates data from unsigned long to int.
    One needs only 8+ TB of RAM to make truncation visible.

    Signed-off-by: Alexey Dobriyan
    Reviewed-by: WANG Cong
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     
  • Use temporary lr for struct latency_record for improved readability and
    fewer columns used. Removed trailing space from output.

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: Joe Perches
    Cc: Jiri Kosina
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • The 'ns' cgroup is considered deprecated. Change the cgroup subsystem
    used in the examples of the cgroup documentation from 'ns' to 'blkio'.

    Signed-off-by: Trevor Woerner
    Acked-by: Li Zefan
    Acked-by: Paul Menage
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Trevor Woerner
     
  • Show how to install the "toggle wordwrap" extension in thunderbird.

    Signed-off-by: Rob Landley
    Cc: Randy Dunlap
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rob Landley
     
  • Signed-off-by: Lasse Collin
    Cc: Randy Dunlap
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Lasse Collin