1. 16 Oct, 2009 2 commits
    • Andrew Morton's avatar
      simplify · 28a5ae65
      Andrew Morton authored
      Cc: Amerigo Wang <amwang@redhat.com>
      Cc: Ben Woodard <bwoodard@llnl.gov>
      Cc: Brian Behlendorf <behlendorf1@llnl.gov>
      Cc: David Howells <dhowells@redhat.com>
      Cc: WANG Cong <amwang@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      28a5ae65
    • Amerigo Wang's avatar
      rwsem_is_locked() tests ->activity without locks, so we should always keep · d2ce5671
      Amerigo Wang authored
      ->activity consistent.  However, the code in __rwsem_do_wake() breaks this
      rule, it updates ->activity after _all_ readers waken up, this may give
      some reader a wrong ->activity value, thus cause rwsem_is_locked() behaves
      wrong.
      
      Quote from Andrew:
      
      "
      - we have one or more processes sleeping in down_read(), waiting for access.
      
      - we wake one or more processes up without altering ->activity
      
      - they start to run and they do rwsem_is_locked().  This incorrectly
        returns "false", because the waker process is still crunching away in
        __rwsem_do_wake().
      
      - the waker now alters ->activity, but it was too late.
      "
      
      So we need get a spinlock to protect this.  And rwsem_is_locked() should
      not block, thus we use spin_trylock_irqsave().
      Reported-by: default avatarBrian Behlendorf <behlendorf1@llnl.gov>
      Cc: Ben Woodard <bwoodard@llnl.gov>
      Cc: David Howells <dhowells@redhat.com>
      Signed-off-by: default avatarWANG Cong <amwang@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      d2ce5671
  2. 14 Oct, 2009 1 commit
  3. 09 Nov, 2009 1 commit
  4. 13 Oct, 2009 2 commits
    • H Hartley Sweeten's avatar
      The symbol 'call' is a static symbol used for initcall_debug. This same · 506fbd3e
      H Hartley Sweeten authored
      symbol name is used locally by a couple functions and produces the
      following sparse warnings:
      
      	warning: symbol 'call' shadows an earlier one
      
      Fix this noise by renaming the local symbols.
      Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      506fbd3e
    • Daniel Mack's avatar
      On Mon, Oct 12, 2009 at 12:31:46PM -0400, H Hartley Sweeten wrote: · 97876a82
      Daniel Mack authored
      > On Wednesday, October 07, 2009 1:01 PM, Daniel Mack wrote:
      > > This is actually too trivial to publish, but to export the function of
      > > that chip to the userspace, a module like this is needed.
      > >
      > > Signed-off-by: Daniel Mack <daniel@caiaq.de>
      > > Cc: Andrew Morton <akpm@linux-foundation.org>
      > > Cc: David Brownell <dbrownell@users.sourceforge.net>
      > > Cc: spi-devel-general@lists.sourceforge.net
      > > ---
      >
      > [snip]
      >
      > > +static ssize_t dac7512_store_val(struct device *dev,
      > > +				 struct device_attribute *attr,
      > > +				 const char *buf, size_t count)
      > > +{
      > > +	struct spi_device *spi = to_spi_device(dev);
      > > +	unsigned char tmp[2];
      > > +	unsigned long val;
      > > +
      > > +	if (strict_strtoul(buf, 10, &val) < 0)
      > > +		return -EINVAL;
      > > +
      > > +	tmp[0] = val >> 8;
      > > +	tmp[1] = val & 0xff;
      > > +	spi_write(spi, tmp, sizeof(tmp));
      > > +	return count;
      > > +}
      > > +
      > > +static DEVICE_ATTR(value, S_IWUSR | S_IRUGO,
      > > +		   NULL, dac7512_store_val);
      >
      > You have declared the "value" device attribute with mode S_IWUSR | S_IRUGO
      > but have not provided a show callback.
      
      Sorry, forget my last mail, I got you wrong. You're of course right,
      S_IRUGO shouldn't be set for write-only attributes. Updates patch below.
      
      Thanks,
      Daniel
      
      >From ab18a967e55d2bb1d39559333bca81a01c2838f0 Mon Sep 17 00:00:00 2001
      Date: Thu, 8 Oct 2009 03:55:46 +0800
      Subject: [PATCH] drivers/misc: add driver for Texas Instruments DAC7512
      This is actually too trivial to publish, but to export the function of
      that chip to the userspace, a module like this is needed.
      Signed-off-by: default avatarDaniel Mack <daniel@caiaq.de>
      Cc: David Brownell <dbrownell@users.sourceforge.net>
      Cc: "H Hartley Sweeten" <hartleys@visionengravers.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      97876a82
  5. 26 Oct, 2009 1 commit
  6. 24 Sep, 2009 1 commit
  7. 09 Oct, 2009 1 commit
  8. 09 Nov, 2009 1 commit
  9. 30 Sep, 2009 2 commits
  10. 28 Oct, 2009 1 commit
    • Andrew Lunn's avatar
      There is a race condition in um_request_irq(). The SIGIO handling is · 621935d0
      Andrew Lunn authored
      first enabled with the call to activate_fd().  The irq handler is then
      registered with request_irq().  What can happen is that directly after
      activate_fd() the SIGIO goes off and the IRQ source is disabled at the low
      level, the pollfd is set to -1.  Since no irq handler has yet been
      registered, the interrupt it left disabled at the low level.  The
      interrupt handler is then registered, but its too late, the interrupt
      source has been disabled at the lower level and is never re-enabled.  To
      fix this race condition i swapped the order.  First request_irq() then
      activate_fd() the interrupt sources.
      
      There is a second bug.  In 2.6.31 there was a change to the way __do_IRQ()
      and friends work for chained interrupt sources.  The old way was that all
      chained interrupt handlers were called.  The new way is that the chain is
      walked only until a handler returns IRQ_HANDLED or IRQ_WAKE_THREAD. 
      uml_net_interrupt() would always return IRQ_HANDLED, irrespective of if
      the device really did receive an interrupt or not.  This mean with the new
      code only the first device on a chained interrupt ever got its interrupts
      handled.  The second/third/...  device never got any interrupts processed.
       I changed uml_net_interrupt() to always return IRQ_NONE so that all
      handlers get called on a chained interrupt.
      Signed-off-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Cc: Jeff Dike <jdike@addtoit.com>
      Cc: Alexey Dobriyan <adobriyan@gmail.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      621935d0
  11. 12 Oct, 2009 1 commit
  12. 13 Oct, 2009 1 commit
    • Arjan van de Ven's avatar
      gcc is not convinced that the floppy.c ioctl has sufficient bound checks: · 8d989f3f
      Arjan van de Ven authored
      In function `copy_from_user',
          inlined from `fd_copyin' at drivers/block/floppy.c:3080,
          inlined from `fd_ioctl' at drivers/block/floppy.c:3503:
      /home/arjan/linux/arch/x86/include/asm/uaccess_32.h:211:
      warning: call to `copy_from_user_overflow' declared with attribute
      warning: copy_from_user buffer size is not provably correct
      
      And frankly, as a human I have a hard time proving the same more or less
      (the size comes from the ioctl argument.  humpf.  maybe.  the code isn't
      very nice)
      
      This patch adds an explicit check to make 100% sure it's safe, better than
      finding out later that there indeed was a gap.
      Signed-off-by: default avatarArjan van de Ven <arjan@linux.intel.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      8d989f3f
  13. 12 Oct, 2009 1 commit
  14. 23 Jul, 2009 1 commit
  15. 03 Nov, 2009 1 commit
  16. 09 Nov, 2009 1 commit
  17. 03 Nov, 2009 1 commit
  18. 14 Feb, 2009 2 commits
  19. 09 Nov, 2009 1 commit
  20. 14 Nov, 2009 1 commit
  21. 13 Nov, 2009 6 commits
    • Hugh Dickins's avatar
      Add a pointer to the ksm page into struct stable_node, holding a reference · 853dfb3e
      Hugh Dickins authored
      to the page while the node exists.  Put a pointer to the stable_node into
      the ksm page's ->mapping.
      
      Then we don't need get_ksm_page() while traversing the stable tree: the
      page to compare against is sure to be present and correct, even if it's no
      longer visible through any of its existing rmap_items.
      
      And we can handle the forked ksm page case more efficiently: no need to
      memcmp our way through the tree to find its match.
      Signed-off-by: default avatarHugh Dickins <hugh.dickins@tiscali.co.uk>
      Cc: Izik Eidus <ieidus@redhat.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      853dfb3e
    • Hugh Dickins's avatar
      Though we still do well to keep rmap_items in the unstable tree without a · 8f77cd8f
      Hugh Dickins authored
      separate tree_item at the node, for several reasons it becomes awkward to
      keep rmap_items in the stable tree without a separate stable_node: lack of
      space in the nicely-sized rmap_item, the need for an anchor as rmap_items
      are removed, the need for a node even when temporarily no rmap_items are
      attached to it.
      
      So declare struct stable_node (rb_node to place it in the tree and
      hlist_head for the rmap_items hanging off it), and convert stable tree
      handling to use it: without yet taking advantage of it.  Note how one
      stable_tree_insert() of a node now has _two_ stable_tree_append()s of the
      two rmap_items being merged.
      Signed-off-by: default avatarHugh Dickins <hugh.dickins@tiscali.co.uk>
      Cc: Izik Eidus <ieidus@redhat.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      8f77cd8f
    • Hugh Dickins's avatar
      Free up a pointer in struct rmap_item, by making the mm_slot's rmap_list a · f56975da
      Hugh Dickins authored
      singly-linked list: we always traverse that list sequentially, and we
      don't even lose any prefetches (but should consider adding a few later). 
      Name it rmap_list throughout.
      
      Do we need to free up that pointer?  Not immediately, and in the end, we
      could continue to avoid it with a union; but having done the conversion,
      let's keep it this way, since there's no downside, and maybe we'll want
      more in future (struct rmap_item is a cache-friendly 32 bytes on 32-bit
      and 64 bytes on 64-bit, so we shall want to avoid expanding it).
      Signed-off-by: default avatarHugh Dickins <hugh.dickins@tiscali.co.uk>
      Cc: Izik Eidus <ieidus@redhat.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      f56975da
    • Hugh Dickins's avatar
      Cleanup: make argument names more consistent from cmp_and_merge_page() · 4c0e3707
      Hugh Dickins authored
      down to replace_page(), so that it's easier to follow the rmap_item's page
      and the matching tree_page and the merged kpage through that code.
      
      In some places, e.g.  break_cow(), pass rmap_item instead of separate mm
      and address.
      
      cmp_and_merge_page() initialize tree_page to NULL, to avoid a "may be used
      uninitialized" warning seen in one config by Anil SB.
      Signed-off-by: default avatarHugh Dickins <hugh.dickins@tiscali.co.uk>
      Cc: Izik Eidus <ieidus@redhat.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      4c0e3707
    • Hugh Dickins's avatar
      There is no need for replace_page() to calculate a write-protected prot · 09d5bdea
      Hugh Dickins authored
      vm_page_prot must already be write-protected for an anonymous page (see
      mm/memory.c do_anonymous_page() for similar reliance on vm_page_prot).
      
      There is no need for try_to_merge_one_page() to get_page and put_page on
      newpage and oldpage: in every case we already hold a reference to each of
      them.
      
      But some instinct makes me move try_to_merge_one_page()'s unlock_page of
      oldpage down after replace_page(): that doesn't increase contention on the
      ksm page, and makes thinking about the transition easier.
      Signed-off-by: default avatarHugh Dickins <hugh.dickins@tiscali.co.uk>
      Cc: Izik Eidus <ieidus@redhat.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      09d5bdea
    • Hugh Dickins's avatar
      1. remove_rmap_item_from_tree() is called as a precaution from · 2ca5a722
      Hugh Dickins authored
         various places: don't dirty the rmap_item cacheline unnecessarily,
         just mask the flags out of the address when they have been set.
      
      2. First get_next_rmap_item() removes an unstable rmap_item from its tree,
         then shortly afterwards cmp_and_merge_page() removes a stable rmap_item
         from its tree: it's easier just to do both at once (but definitely keep
         the BUG_ON(age > 1) which guards against a future omission).
      
      3. When cmp_and_merge_page() moves an rmap_item from unstable to stable
         tree, it does its own rb_erase() and accounting: that's better
         expressed by remove_rmap_item_from_tree().
      Signed-off-by: default avatarHugh Dickins <hugh.dickins@tiscali.co.uk>
      Cc: Izik Eidus <ieidus@redhat.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      2ca5a722
  22. 12 Nov, 2009 10 commits