1. 13 Aug, 2002 2 commits
    • Patrick Mochel's avatar
      Update device model locking · 789e39b0
      Patrick Mochel authored
      Change all iterators of devices to:
      - use list_for_each
      - check return of get_device_locked
      - don't break until we hold the lock if we get an error
      
      When a device's reference count hits 0, remove it from all lists, including
      bus and driver lists.
      
      Between the iterator algorithm and the guaranteed removal from the lists,
      there should never be a device in a list with a reference count of 0. 
      So, whenever we're iterating over the lists, we'll always have a valid 
      device. We don't decrement the refcount until the next iteration of the
      loop, so we're also guaranteed to get the correct next item in the list.
      789e39b0
    • Patrick Mochel's avatar
      Fix and prevent bugs in device_register() · 266c24ad
      Patrick Mochel authored
      When adding to the global device list, we were adding devices just after their parent, while we wanted to
      add them just before. That way when we iterate over the list on suspend and shutdown, we'll hit all
      children before the parents.
      
      Make sure dev->driver_list and dev->bus_list are initialized when the device is registered
      
      Remove device from global and parent's list if registration failed.
      266c24ad
  2. 12 Aug, 2002 2 commits
    • Patrick Mochel's avatar
      Update device model locking · d8b2993c
      Patrick Mochel authored
      This updates the device model locking to use device_lock when accessing all
      lists (the global list, the bus' lists and the drivers' lists). Before the latter
      two would use their own rwlocks. 
      
      This also updates get_device() to return a pointer to the struct device if it 
      can successfully increment the reference count. 
      
      Between these two changes, this should prevent anything gaining an invalid 
      reference to a device that is in the process of being removed:
      
      If a device is being removed, it's reference count is 0, but it hasn't 
      necessarily hasn't been removed from its bus's list. If the bus list iterator
      attempts to access the device, it will take the lock, but will continue on to 
      the next device because the refcount is 0 (and drop the lock).
      
      Well, theoretically; the bus iterators still need to be changed, but that's 
      coming next..
      d8b2993c
    • Patrick Mochel's avatar
      Merge osdl.org:/home/mochel/src/kernel/devel/linux-2.5-virgin · 44013500
      Patrick Mochel authored
      into osdl.org:/home/mochel/src/kernel/devel/linux-2.5-driverfs
      44013500
  3. 10 Aug, 2002 36 commits
    • Linus Torvalds's avatar
      Linux v2.5.31 · 80e4e144
      Linus Torvalds authored
      80e4e144
    • Andrew Morton's avatar
      [PATCH] Infrastructure for atomic user accesses · 199143a8
      Andrew Morton authored
      Well the optimum solution there would be to create and use
      `inc_preempt_count_non_preempt()'.  I don't see any
      way of embedding this in kmap_atomic() or copy_to_user_atomic()
      without loss of flexibility or incurring a double-inc somewhere.
      199143a8
    • Linus Torvalds's avatar
      Merge bk://linuxusb.bkbits.net/pci_hp-2.5 · 1dd4dd0c
      Linus Torvalds authored
      into home.transmeta.com:/home/torvalds/v2.5/linux
      1dd4dd0c
    • Linus Torvalds's avatar
      Merge bk://ppc.bkbits.net/for-linus-ppc · 01cf0f73
      Linus Torvalds authored
      into home.transmeta.com:/home/torvalds/v2.5/linux
      01cf0f73
    • Andrew Morton's avatar
      [PATCH] fix a race between set_page_dirty and truncate · 67886cc6
      Andrew Morton authored
      Fix a race between set_page_dirty() and truncate.
      
      The page could have been removed from the mapping while this CPU is
      spinning on the lock.  __free_pages_ok() will go BUG.
      
      This has not been observed in practice - most callers of
      set_page_dirty() hold the page lock which gives exclusion from
      truncate.  But zap_pte_range() does not.
      
      A fix for this has been sent to Marcelo also.
      67886cc6
    • Andrew Morton's avatar
      [PATCH] direct IO fixes · 0ea7efc9
      Andrew Morton authored
      Some direct IO fixes from Badari Pulavarty.
      
      - off-by-one in the bounds checking in blkdev_get_blocks().
      
      - When adding more blocks into a bio_vec, account for the current
        offset into that bio_vec.
      
      - Fix a total ballsup in the code which calculates the total number
        of pages which are about to be put under IO.
      0ea7efc9
    • Andrew Morton's avatar
      [PATCH] sync get_user_pages with 2.4 · 6df888f6
      Andrew Morton authored
      Forward port of get_user_pages() change from 2.4.
      
      - If the vma is marked as VM_IO area then fail the map.
      
        This prevents kernel deadlocks which occur when applications which
        have frame buffers mapped try to dump core.  Also prevents a kernel
        oops when a debugger is attached to a process which has an IO mmap.
      
      - Check that the mapped page is inside mem_map[] (pfn_valid).
      
      - inline follow_page() and remove the preempt_disable()s.  It has
        only a single callsite and is called under spinloclk.
      6df888f6
    • Andrew Morton's avatar
      [PATCH] tunable ext3 commit interval · 88cb17e4
      Andrew Morton authored
      The patch from Stephen Tweedie allows users to modify the journal
      commit interval for the ext3 filesystem.
      
      The commit interval is normally five seconds.  For portable computers
      with spun-down drives it is advantageous to be able to increase the
      commit interval.
      
      There may also be advantages in decreasing the commit interval for
      specialised applications such as heavily-loaded NFS servers which are
      using synchronous exports.
      
      The laptop users will also need to increase the pdflush periodic
      writeback interval (/proc/sys/vm/dirty_writeback_centisecs), because
      the `kupdate' activity also forces a commit.
      
      To specify the commit interval, use
      
      	mount -o commit=30 /dev/hda1 /mnt/whatever
      
      or
      	mount -o remount,commit=30 /dev/hda1
      
      The commit interval is specified in units of seconds.
      88cb17e4
    • Andrew Morton's avatar
      [PATCH] copy_strings speedup · d34e8c85
      Andrew Morton authored
      This is the first of three patches which reduce the amount of
      kmap/kunmap traffic on highmem machines.
      
      The workload which was tested was RAM-only dbench.  This is dominated
      by copy_*_user() costs.
      
      The three patches speed up my 4xPIII by 3%
      
      The three patches speed up a 16P NUMA-Q by 100 to 150%
      
      The first two patches (copy_strings and pagecache reads) speed up an
      8-way by 15%.  I expect that all three patches will speed up the 8-way
      by 40%.
      
      Some of the benefit is from reduced pressure on kmap_lock.  Most of it
      is from reducing the number of global TLB invalidations.
      
      
      This patch fixes up copy_strings().  copy_strings does a huge amount of
      kmapping.  Martin Bligh has noted that across a kernel compile this
      function is the second or third largest user of kmaps in the kernel.
      
      The fix is pretty simple: just hang onto the previous kmap as we we go
      around the loop.  It reduces the number of kmappings from copy_strings
      by a factor of 30.
      d34e8c85
    • Andrew Morton's avatar
      [PATCH] 3c905B fix · ab77bb3e
      Andrew Morton authored
      Patch from Zwane which fixes a transceiver problem on his 3c905B.
      
      Apparently the 905B's MII status register is saying that it doesn't
      need preamble, but the datasheet says that it does.  So add a 905B
      override for that in the device table.
      
      This could break other 3c905B's.  I don't know.  There's only one way
      to find out.
      ab77bb3e
    • Russell King's avatar
      [PATCH] build warning fix · 0e2774eb
      Russell King authored
      This patch has been verified to apply cleanly to 2.5.30
      
      This patch fixes a build warning in smp.h.  register_cpu_notifier uses
      struct notifier_block in its argument list.  Unfortunately, there are
      places where smp.h is included before the definition of this structure.
      0e2774eb
    • Pavel Machek's avatar
      [PATCH] S3 and swsusp: fixing device_resume order · 66431f4b
      Pavel Machek authored
      pci driver's resume must not be called during RESUME_POWER_ON because
      interrupts are still off and i8259A is not initialized [OHCI kills
      machine in such case, cardbus probably too.  PCI drivers just assume
      initialized interrupts.]
      
      Second hunk fixes device_resume calls to be okay according to
      documentation.
      66431f4b
    • David Howells's avatar
      [PATCH] Re: downgrade_write · 090d3e77
      David Howells authored
      The prototype name is wrong, not the name called by the actual
      implementation.  Noticed by David Miller.
      090d3e77
    • Jens Axboe's avatar
      [PATCH] missing export of elv_queue_empty() · f610191b
      Jens Axboe authored
      Forgot to export it to modules :/
      f610191b
    • Paul Menage's avatar
      [PATCH] Fix misspelling of "sector" in ide.c · b84e52f8
      Paul Menage authored
      b84e52f8
    • Linus Torvalds's avatar
      Merge Al's partition handling cleanups · 3c128e58
      Linus Torvalds authored
      3c128e58
    • Alexander Viro's avatar
      [PATCH] fix check_disk_change() deadlocks · 951f4be9
      Alexander Viro authored
      Small, but tricky: fix for check_disk_change() deadlocks.
      What we do is
      	a) opening block device shifted from check_partition() to
      	   grok_partitions(); check_partitions() takes opened
      	   struct block_device.
      	b) all callers of check_disk_change() fall in two groups -
      	   ones that are called only from some ->open() and ones
      	   that are _never_ called from ->open().  There is no
      	   middle ground.  We split the thing in two functions -
      	   check_disk_change() for the first class and full_check_....
      	   for the second.  The former (ones inside ->open()) doesn't
      	   touch partition tables but marks the bdev as "had been
      	   invalidated".  In the end of do_open() we check if
      	   bdev is marked and call wipe_partitions()/check_partition()
      	   if it is - at that point bdev is fully set up and ready.
      	c) ->bd_part_sem kludge is gone - we use ->bd_sem instead.
      	   That is, do_open() on a partition grabs ->bd_sem on entire
      	   disk and picks partition data while under it; do_open() on
      	   entire disk rereads partition if needed before dropping
      	   ->bd_sem (right before dropping it); BLKRRPART does
      	   trylock on ->bd_sem and then checks ->bd_part_count -
      	   same logics as before, except that we use ->bd_sem instead
      	   of ->bd_part_sem.
      
      That kills recursive open(), gives us the same exclusion rules as
      we had and makes sure that actual IO (including rereading partition
      tables) is done only when we are ready to do it.
      
      It actually sounds a lot nastier than it is.  do_open() is a one sick
      puppy right now, but we have everything in one place and _out_ of drivers
      (and 20-odd equally sick puppies are gone from them, along with about
      the same number of races).
      
      Now we are almost ready to clean it up for good - all that remains to
      do before that is to get the rest of drivers (cciss, DAC960, i2o and
      a couple of ancients - xd and acsi) using per-disk gendisks.  Then
      most of that crap will disappear.
      
      BTW, the only generic ioctl remaining in the drivers is HDIO_GETGEO -
      a lot of foo_ioctl() starts with if (cmd != HDIO_GETGEO) return -EINVAL; ;-)
      951f4be9
    • Alexander Viro's avatar
      [PATCH] ps2esdi.c per-disk gendisks · 9804df6c
      Alexander Viro authored
      ps2esdi.c switched to per-disk gendisks
      9804df6c
    • Alexander Viro's avatar
      [PATCH] cpqarray.c per-disk gendisks · ea309121
      Alexander Viro authored
      cpqarray.c switched to per-disk gendisks
      ea309121
    • Alexander Viro's avatar
      [PATCH] partition table flush/read cleanup · 816ab591
      Alexander Viro authored
      Big One.  Flushing/rereading partition tables is taken from
      ->revalidate() for partitioned devices; now it's done in the
      caller (check_disk_change()).  BLKRRPART handling also moved
      out of drivers - they are still allowed to override it (DAC960
      and i2o are the only remaining ones), but common case is handled
      in fs/block_dev.c.
      
      Note: we are still only shifting stuff - bd_sem deadlocks in
      check_disk_change() are still there.  However, now we have all
      relevant code outside of drivers and that will allow to fix the
      thing (see next patches).
      816ab591
    • Alexander Viro's avatar
      [PATCH] ide subdrivers attach() cleanup · fc4dfb65
      Alexander Viro authored
      ->attach() for ide subdrivers explicitly calls register_disk()
      instead of ata_revalidate() now; revalidate_drives() is gone -
      it's not needed anymore (we _know_ that we'll read partition
      table as soon as driver claims the drive; no need to mess with
      bogus rereading).
      fc4dfb65
    • Alexander Viro's avatar
      [PATCH] clean up major_name · 7e06e792
      Alexander Viro authored
      ->major_name for per-disk gendisks set to full name - i.e.
      IDE gendisks have "hda", "hdb", etc. instead of "hd".
      As the result, we kill a lot of crap in check.c::disk_name().
      In particular, now we can afford ->minor_shift set to 0
      for ide-cd (disk_name() was the only obstacle)
      7e06e792
    • Alexander Viro's avatar
      [PATCH] make check_disk_change() use struct block_device · 814bd2ba
      Alexander Viro authored
      check_disk_change() converted to passing struct block_device.
      
      Old variant is still needed for a couple of places; wrapper
      is provided (__check_disk_change(kdev)).  do_open() logics
      with setting ->bd_op sanitized - now we do that before calling
      ->open().
      814bd2ba
    • Alexander Viro's avatar
      [PATCH] fix /proc/partitions braino · 5c2f6403
      Alexander Viro authored
      fix for embarrassing braino in /proc/partitions - size in kilobytes
      is _half_ the size in secotrs, not twice that size...
      5c2f6403
    • Alexander Viro's avatar
      [PATCH] seq_read() fix · 4f4b6a13
      Alexander Viro authored
      Present both in 2.4 and 2.5 ;-/
      4f4b6a13
    • Christoph Hellwig's avatar
      [PATCH] misc pagecache cleanups / tweaks · 8b1763fb
      Christoph Hellwig authored
      - inline grab_cache_page() in pagemap.h, it's just a simple wrapper
        around find_or_create_page()
      - rename (__)remove_inode_page to (__)remove_from_page_cache and
        move them from mm.h and swap.h to pagemap.h because they reverse
        add_to_page_cache and that's where they belong.
      8b1763fb
    • Ivan Kokshaysky's avatar
      [PATCH] alpha: rwsem update [10/10] · 28e17277
      Ivan Kokshaysky authored
      - __down_[read,write]_trylock, __downgrade_write implemented;
      - __builtin_expect replaced with unlikely().
      28e17277
    • Ivan Kokshaysky's avatar
      [PATCH] alpha: misc fixes [9/10] · 93be99e7
      Ivan Kokshaysky authored
      Set of small fixes:
      - pcibios_init() must be int;
      - fls() - ctlz on ev67, generic on others. This was required for
        something several kernel releases back, now it seems to be unused.
        Anyway, it shouldn't hurt, so included here.
      - missing #includes, missing #if RTC_IRQ in drivers/char/rtc.c;
      - define USER_HZ;
      From Jeff Wiedemeier:
      - rename alpha-specific config section 'General setup' to 'System setup'
        to avoid confusion with generic 'General setup';
      - fix the 'bootpfile' build.
      93be99e7
    • Ivan Kokshaysky's avatar
      [PATCH] alpha: osf getrusage, readv, writev [8/10] · 74b4e814
      Ivan Kokshaysky authored
      - osf_getrusage() updated for new utime/stime fields of the task_struct;
      - compatibility wrappers for OSF/1 v4 readv/writev syscalls:
        forward port from 2.4.19.
      74b4e814
    • Ivan Kokshaysky's avatar
      [PATCH] alpha: percpu update [7/10] · 18fc1ad1
      Ivan Kokshaysky authored
      Generic per-cpu areas; wrappers for SMP boot process.
      18fc1ad1
    • Ivan Kokshaysky's avatar
      [PATCH] alpha: interrupt/preempt update [6/10] · 7226c990
      Ivan Kokshaysky authored
      This one is large mostly because of massive code deletion.
      - cli, sti an so on go away;
      - irq_smp.c goes to /dev/null; the only leftover (synchronize_irq)
        moved to irq.c;
      - hardirq count field in the preemption counter extended to 12 bits -
        one more than required for wildfire.
      7226c990
    • Ivan Kokshaysky's avatar
      [PATCH] alpha: cia-1 fix [5/10] · 1fb62ea2
      Ivan Kokshaysky authored
      From Jay Estabrook:
      CIA rev 1 can't use DAC and windows 1,2 for SG.
      1fb62ea2
    • Ivan Kokshaysky's avatar
      [PATCH] alpha: regdef.h [4/10] · a63ab460
      Ivan Kokshaysky authored
      Historically, assembly routines included libc header <alpha/regdef.h>
      for OSF/1 register names. With the new kernel build system
      it doesn't work anymore. Make our own copy in <include/asm>.
      a63ab460
    • Ivan Kokshaysky's avatar
      [PATCH] alpha: CPU logical mapping [3/10] · 4d6642d3
      Ivan Kokshaysky authored
      Hardware cpu_id to logical cpu mapping is gone.
      Converted to cpu_online() etc.
      4d6642d3
    • Ivan Kokshaysky's avatar
      [PATCH] alpha: IPI update [2/10] · cdc03222
      Ivan Kokshaysky authored
      - send_ipi_message() fix from Jeff Wiedemeier:
        The 2.5.30 IPI algorithm (with the to_whom == set test) incorrectly sends
        IPI messages to CPU 0 in a SMP system running with one processor. In this
        case to_whom is often 0 (cpu_present_mask & ~1UL << smp_processor_id()) which
        ends up triggering the to_whom == set case.
      - migration IPI removed;
      cdc03222
    • Ivan Kokshaysky's avatar
      [PATCH] alpha: pte/pfn/page/tlb macros update [1/10] · 24165732
      Ivan Kokshaysky authored
      This starts a large set of alpha patches accumulated since 2.5.18 or
      even earlier. All of this was reasonably well tested.
      Thanks to Jeff Wiedemeier for SMP testing and fixes.
      
      - sync up with (2.5.18?) pte/pfn/page/tlb etc. macros;
      - asm-generic/tlb.h: loading unsigned long constant to unsigned int
        tlb->nr causes compiler warnings on 64 bit platforms.
      24165732