1. 03 Jul, 2006 5 commits
    • Eric Hustvedt's avatar
      intelfb: add vsync interrupt support · f80d0d23
      Eric Hustvedt authored
      [05/05] intelfb: Honor FB_ACTIVATE_VBL for display panning
      
      Extends the intelfb_vsync struct to store panning offset. The interrupt service routine uses the stored panning offset if a pan is requested for the vsync. intelfbhw_disable_irq also pans the display if there is a pending request.
      Signed-off-by: default avatarEric Hustvedt <ehustvedt@cecropia.com>
      f80d0d23
    • Eric Hustvedt's avatar
      intelfb: add vsync interrupt support · 37bced38
      Eric Hustvedt authored
      [04/05] intelfb: implement FBIO_WAITFORVSYNC ioctl
      
      The (unofficial) FBIO_WAITFORVSYNC ioctl is implemented by sleeping on the appropriate waitqueue, as defined in my earlier patch. Currently, only display 0 (aka pipe A) is supported.
      Signed-off-by: default avatarEric Hustvedt <ehustvedt@cecropia.com>
      37bced38
    • Eric Hustvedt's avatar
      intelfb: add vsync interrupt support · 7649757b
      Eric Hustvedt authored
      [03/05] intelfb: Implement basic interrupt handling
      
      Functions have been added to enable and disable interrupts using the MMIO registers. Currently only pipe A vsync interrupts are enabled.
      A generalized vsync accounting struct is defined, with the intent that it can encapsulate per-pipe vsync related info in the future. Currently a single instance is hard-coded.
      The interrupt service routine currently only looks for vsync interrupts on pipe A, and increments a counter and wakes up anyone waiting on it.
      
      This implementation is heavily influenced by similar implementations in the atyfb and matroxfb drivers.
      Signed-off-by: default avatarEric Hustvedt <ehustvedt@cecropia.com>
      7649757b
    • Eric Hustvedt's avatar
      intelfb: add vsync interrupt support · 9a5f019b
      Eric Hustvedt authored
      [02/05] intelfb: Add interrupt related register definitions
      
      Add constants for accessing HWSTAM, IER, IIR, and IMR registers.
      Add constants for interrupt types supported by the 8xx and 9xx chipsets.
      The registers are also stored in the hwstate struct and dumped in the debug routine.
      Signed-off-by: default avatarEric Hustvedt <ehustvedt@cecropia.com>
      9a5f019b
    • Eric Hustvedt's avatar
      intelfb: add vsync interrupt support · 3ce6fb43
      Eric Hustvedt authored
      [01/05] intelfb: Add 16-bit register access macros
      
      This patch adds macros to read and write two-byte MMIO registers. The interrupt-related registers are all word-sized, rather than long-sized.
      Signed-off-by: default avatarEric Hustvedt <ehustvedt@cecropia.com>
      3ce6fb43
  2. 24 Jun, 2006 2 commits
  3. 23 Jun, 2006 33 commits
    • Linus Torvalds's avatar
      Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev · 6edad161
      Linus Torvalds authored
      * 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev: (258 commits)
        [libata] conversion to new debug scheme, part 1 of $N
        [PATCH] libata: Add ata_scsi_dev_disabled
        [libata] Add host lock to struct ata_port
        [PATCH] libata: implement per-dev EH action mask eh_info->dev_action[]
        [PATCH] libata-dev: move the CDB-intr DMA blacklisting
        [PATCH] ahci: disable NCQ support on vt8251
        [libata] ahci: add JMicron PCI IDs
        [libata] sata_nv: add PCI IDs
        [libata] ahci: Add NVIDIA PCI IDs.
        [PATCH] libata: convert several bmdma-style controllers to new EH, take #3
        [PATCH] sata_via: convert to new EH, take #3
        [libata] sata_nv: s/spin_lock_irqsave/spin_lock/ in irq handler
        [PATCH] sata_nv: add hotplug support
        [PATCH] sata_nv: convert to new EH
        [PATCH] sata_nv: better irq handlers
        [PATCH] sata_nv: simplify constants
        [PATCH] sata_nv: kill struct nv_host_desc and nv_host
        [PATCH] sata_nv: kill not-working hotplug code
        [libata] Update docs to reflect current driver API
        [PATCH] libata: add host_set->next for legacy two host_sets case, take #3
        ...
      6edad161
    • Tony Luck's avatar
      [IA64] fix ia64 build (fadt_descriptor) · 236ee8c3
      Tony Luck authored
      arch/ia64/kernel/acpi.c got forgotten when include/acpi/actbl.h
      got a cleanup.
      Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
      236ee8c3
    • Tony Luck's avatar
      Auto-update from upstream · 8cf60e04
      Tony Luck authored
      8cf60e04
    • Nicolas Pitre's avatar
      [PATCH] fix silly ARM non-EABI build error · 95eaa5fa
      Nicolas Pitre authored
      My bad.
      Signed-off-by: default avatarNicolas Pitre <nico@cam.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      95eaa5fa
    • Andrew Morton's avatar
      [PATCH] s390_hypfs filesystem: get_sb_single() fix · a5cf4b9a
      Andrew Morton authored
      Update hypfs for dhowells API changes.
      
      Cc: Pekka Enberg <penberg@cs.helsinki.fi>
      Cc: Ingo Oeser <ioe-lkml@rameria.de>
      Cc: Joern Engel <joern@wohnheim.fh-wedel.de>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Michael Holzheu <holzheu@de.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      a5cf4b9a
    • Andrew Morton's avatar
      [PATCH] cpufreq build fix · 138a0128
      Andrew Morton authored
      drivers/cpufreq/cpufreq_ondemand.c: In function 'do_dbs_timer':
      drivers/cpufreq/cpufreq_ondemand.c:374: warning: implicit declaration of function 'lock_cpu_hotplug'
      drivers/cpufreq/cpufreq_ondemand.c:381: warning: implicit declaration of function 'unlock_cpu_hotplug'
      drivers/cpufreq/cpufreq_conservative.c: In function 'do_dbs_timer':
      drivers/cpufreq/cpufreq_conservative.c:425: warning: implicit declaration of function 'lock_cpu_hotplug'
      drivers/cpufreq/cpufreq_conservative.c:432: warning: implicit declaration of function 'unlock_cpu_hotplug'
      
      Cc: Dave Jones <davej@codemonkey.org.uk>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      138a0128
    • Andi Kleen's avatar
      [BLOCK] Fix bounce limit address check · 8269730b
      Andi Kleen authored
      Do a safer check for when to enable DMA. Currently we enable ISA DMA
      for cases that do not need it, resulting in OOM conditions when ZONE_DMA
      runs out of space.
      Signed-off-by: default avatarJens Axboe <axboe@suse.de>
      8269730b
    • Jens Axboe's avatar
      [PATCH] rbtree: support functions used by the io schedulers · dd67d051
      Jens Axboe authored
      They all duplicate macros to check for empty root and/or node, and
      clearing a node. So put those in rbtree.h.
      Signed-off-by: default avatarJens Axboe <axboe@suse.de>
      dd67d051
    • Jens Axboe's avatar
      [PATCH] splice: retrieve mapping after locking the page · 9e94cd4f
      Jens Axboe authored
      Otherwise we could be racing with truncate/mapping removal.
      
      Problem found/fixed by Nick Piggin <npiggin@suse.de>, logic rewritten
      by me.
      Signed-off-by: default avatarJens Axboe <axboe@suse.de>
      9e94cd4f
    • Jens Axboe's avatar
      [PATCH] cfq-iosched: rq update fixes · fd61af03
      Jens Axboe authored
      - Remember to set ->last_sector so that the cfq_choose_req() logic
        works correctly.
      
      - Remove redundant call to cfq_choose_req()
      Signed-off-by: default avatarJens Axboe <axboe@suse.de>
      fd61af03
    • Jens Axboe's avatar
      [PATCH] cfq-iosched: many performance fixes · caaa5f9f
      Jens Axboe authored
      This is a collection of patches that greatly improve CFQ performance
      in some circumstances.
      
      - Change the idling logic to only kick in after a request is done and we
        are deciding what to do. Before the idling included the request service
        time, so it was hard to adjust. Now it's true think/idle time.
      
      - Take advantage of TCQ/NCQ/queueing for seeky sync workloads, but keep
        it in control for sync and sequential (or close to) workloads.
      
      - Expire queues immediately and move on to other busy queues, if we are
        not going to idle after the current one finishes.
      
      - Don't rearm idle timer if there are no busy queues. Just leave the
        system idle.
      Signed-off-by: default avatarJens Axboe <axboe@suse.de>
      caaa5f9f
    • Jens Axboe's avatar
      [PATCH] cfq-iosched: correctly set ioprio on both targets · 35e6077c
      Jens Axboe authored
      Patch originally from Vasily Tarasov <vtaras@sw.ru>
      
      If you set io-priority of process 1 using sys_ioprio_set system call by
      another process 2 (like ionice do), then cfq_init_prio_data() function
      sets priority of process 2 (current) on queue of process 1 and clears
      the flag, that designates change of ioprio.  So the process  1 will work
      like with priority of process 2.
      
      I propose not to call cfq_init_prio_data() on io-priority change, but
      only mark queue as queue with changed prority.  Every time when new
      request comes cfq-scheduler checks for this flag and atomaticaly changes
      priority of queue to new value.
      Signed-off-by: default avatarJens Axboe <axboe@suse.de>
      35e6077c
    • Jens Axboe's avatar
      [PATCH] Make CFQ the default IO scheduler · b17fd9bc
      Jens Axboe authored
      Signed-off-by: default avatarJens Axboe <axboe@suse.de>
      b17fd9bc
    • Jens Axboe's avatar
      [PATCH] Rearrange a few struct request members · 8f34ee75
      Jens Axboe authored
      This saves 8 bytes of data in 64-bit archs.
      Signed-off-by: default avatarJens Axboe <axboe@suse.de>
      8f34ee75
    • Jens Axboe's avatar
      [PATCH] Get rid of struct request request_pm_state member · ad3cadda
      Jens Axboe authored
      The IDE power management can just use the ->end_io_data member to store
      it's data.
      Signed-off-by: default avatarJens Axboe <axboe@suse.de>
      ad3cadda
    • Jens Axboe's avatar
      [PATCH] Kill PF_SYNCWRITE flag · b31dc66a
      Jens Axboe authored
      A process flag to indicate whether we are doing sync io is incredibly
      ugly. It also causes performance problems when one does a lot of async
      io and then proceeds to sync it. Part of the io will go out as async,
      and the other part as sync. This causes a disconnect between the
      previously submitted io and the synced io. For io schedulers such as CFQ,
      this will cause us lost merges and suboptimal behaviour in scheduling.
      
      Remove PF_SYNCWRITE completely from the fsync/msync paths, and let
      the O_DIRECT path just directly indicate that the writes are sync
      by using WRITE_SYNC instead.
      Signed-off-by: default avatarJens Axboe <axboe@suse.de>
      b31dc66a
    • Jens Axboe's avatar
      [PATCH] cfq-iosched: Don't set the queue batching limits · 271f18f1
      Jens Axboe authored
      We cannot update them if the user changes nr_requests, so don't
      set it in the first place. The gains are pretty questionable as
      well. The batching loss has been shown to decrease throughput.
      Signed-off-by: default avatarJens Axboe <axboe@suse.de>
      271f18f1
    • Dave Jones's avatar
      [PATCH] remove dead code from elevator switching · acf42175
      Dave Jones authored
      We already drop the refcount in elevator_exit(), and as
      we're setting 'e' to NULL, we'll never take that branch anyway.
      Finally, as 'e' is a local var that isn't referenced afterwards,
      setting it to NULL is pointless.
      Signed-off-by: default avatarDave Jones <davej@redhat.com>
      Signed-off-by: default avatarJens Axboe <axboe@suse.de>
      acf42175
    • Alexey Dobriyan's avatar
      [PATCH] blktrace_api.h: endian annotations · fda151d9
      Alexey Dobriyan authored
      Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarJens Axboe <axboe@suse.de>
      fda151d9
    • Paolo 'Blaisorblade' Giarrusso's avatar
      [PATCH] blk_start_queue() must be called with irq disabled - add warning · a038e253
      Paolo 'Blaisorblade' Giarrusso authored
      The queue lock can be taken from interrupts so it must always be taken with
      irq disabling primitives.  Some primitives already verify this.
      blk_start_queue() is called under this lock, so interrupts must be
      disabled.
      
      Also document this requirement clearly in blk_init_queue(), where the queue
      spinlock is set.
      Signed-off-by: default avatarPaolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarJens Axboe <axboe@suse.de>
      a038e253
    • Akinobu Mita's avatar
      [PATCH] iosched: use hlist for request hashtable · bae386f7
      Akinobu Mita authored
      Use hlist instead of list_head for request hashtable in deadline-iosched
      and as-iosched. It also can remove the flag to know hashed or unhashed.
      Signed-off-by: default avatarAkinobu Mita <mita@miraclelinux.com>
      Signed-off-by: default avatarJens Axboe <axboe@suse.de>
      
       block/as-iosched.c       |   45 +++++++++++++++++++--------------------------
       block/deadline-iosched.c |   39 ++++++++++++++++-----------------------
       2 files changed, 35 insertions(+), 49 deletions(-)
      bae386f7
    • Linus Torvalds's avatar
      Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 · 199f4c9f
      Linus Torvalds authored
      * master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6:
        [NET]: Require CAP_NET_ADMIN to create tuntap devices.
        [NET]: fix net-core kernel-doc
        [TCP]: Move inclusion of <linux/dmaengine.h> to correct place in <linux/tcp.h>
        [IPSEC]: Handle GSO packets
        [NET]: Added GSO toggle
        [NET]: Add software TSOv4
        [NET]: Add generic segmentation offload
        [NET]: Merge TSO/UFO fields in sk_buff
        [NET]: Prevent transmission after dev_deactivate
        [IPV6] ADDRCONF: Fix default source address selection without CONFIG_IPV6_PRIVACY
        [IPV6]: Fix source address selection.
        [NET]: Avoid allocating skb in skb_pad
      199f4c9f
    • Linus Torvalds's avatar
      Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6 · 37224470
      Linus Torvalds authored
      * 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: (65 commits)
        ACPI: suppress power button event on S3 resume
        ACPI: resolve merge conflict between sem2mutex and processor_perflib.c
        ACPI: use for_each_possible_cpu() instead of for_each_cpu()
        ACPI: delete newly added debugging macros in processor_perflib.c
        ACPI: UP build fix for bugzilla-5737
        Enable P-state software coordination via _PDC
        P-state software coordination for speedstep-centrino
        P-state software coordination for acpi-cpufreq
        P-state software coordination for ACPI core
        ACPI: create acpi_thermal_resume()
        ACPI: create acpi_fan_suspend()/acpi_fan_resume()
        ACPI: pass pm_message_t from acpi_device_suspend() to root_suspend()
        ACPI: create acpi_device_suspend()/acpi_device_resume()
        ACPI: replace spin_lock_irq with mutex for ec poll mode
        ACPI: Allow a WAN module enable/disable on a Thinkpad X60.
        sem2mutex: acpi, acpi_link_lock
        ACPI: delete unused acpi_bus_drivers_lock
        sem2mutex: drivers/acpi/processor_perflib.c
        ACPI add ia64 exports to build acpi_memhotplug as a module
        ACPI: asus_acpi_init(): propagate correct return value
        ...
      
      Manual resolve of conflicts in:
      
      	arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
      	arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
      	include/acpi/processor.h
      37224470
    • Bob Copeland's avatar
      [PATCH] docs: update sparse.txt with CHECK_ENDIAN · e8331951
      Bob Copeland authored
      Update the sparse documentation to omit the -Wbitwise flag example (as it
      is now passed by default), and document the kernel defines to enable
      endianness checking.
      Signed-off-by: default avatarBob Copeland <me@bobcopeland.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      e8331951
    • Constantine Sapuntzakis's avatar
      [PATCH] drivers/block/loop.c: don't return garbage if LOOP_SET_STATUS not called · eefe85ee
      Constantine Sapuntzakis authored
      While writing a version of losetup, I ran into the problem that the loop
      device was returning total garbage.
      
      It turns out the problem was that this losetup was only issuing the
      LOOP_SET_FD ioctl and not issuing a subsequent LOOP_SET_STATUS ioctl.  This
      losetup didn't have any special status to set, so it left out the call.
      
      The deeper cause is that loop_set_fd sets the transfer function to NULL,
      which causes no transfer to happen lo_do_transfer.
      
      This patch fixes the problem by setting transfer to transfer_none in
      loop_set_fd.
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      eefe85ee
    • Mike Miller's avatar
      [PATCH] make kernel warn about incorrectly sized partitions · 98bd34ea
      Mike Miller authored
      Sometimes partitions claim to be larger than the reported capacity of a
      disk device.  This patch makes the kernel warn about those partitions.
      
      We still permit these patitions to be used.  Quoting Andries Brouwer
      <Andries.Brouwer@cwi.nl>:
      
       Case 1: The kernel is mistaken about the size of the disk.  (There are
       commands to clip a disk to a certain capacity, there are jumpers to tell a
       disk that it should report a certain capacity etc.  Usually this is because
       of BIOS bugs.  In bad cases the machine will crash in the BIOS and hence fail
       to boot if the disk reports full capacity.) In such cases actually accessing
       the blocks of the partition may work fine, or may work fine after running an
       unclip utility.  I wrote "setmax" some years ago precisely for this reason.
      
       Case 2: There was a messy partition table (maybe just a rounding error) but
       the actual filesystem on the partition is contained in the physical disk.
       Now using the filesystem goes without problem.
      
       Case 3: Both partition and filesystem extend beyond the end of the disk.  In
       forensic or debugging situations one often uses a copy of the start of a
       disk.  Now access beyond the end gives an expected I/O error.
      Signed-off-by: default avatarMike Miller <mike.miller@hp.com>
      Signed-off-by: default avatarStephen Cameron <steve.cameron@hp.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      98bd34ea
    • Eric Sesterhenn's avatar
      [PATCH] More BUG_ON conversion · 125e1874
      Eric Sesterhenn authored
      Signed-off-by: default avatarEric Sesterhenn <snakebyte@gmx.de>
      Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
      Cc: Bartlomiej Zolnierkiewicz <B.Zolnierkiewicz@elka.pw.edu.pl>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Cc: James Bottomley <James.Bottomley@steeleye.com>
      Acked-by: default avatar"Salyzyn, Mark" <mark_salyzyn@adaptec.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      125e1874
    • Jan Kara's avatar
      [PATCH] JBD: split checkpoint lists · 78ce89c9
      Jan Kara authored
      Split the checkpoint list of the transaction into two lists.  In the first
      list we keep the buffers that need to be submitted for IO.  In the second
      list are kept buffers that were already submitted and we just have to wait
      for the IO to complete.  This should simplify a handling of checkpoint
      lists a bit and can eventually be also a performance gain.
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Cc: Mark Fasheh <mark.fasheh@oracle.com>
      Cc: "Stephen C. Tweedie" <sct@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      78ce89c9
    • Peter Hagervall's avatar
      [PATCH] Sparse fixes for synclink_cs · cdaad343
      Peter Hagervall authored
      Mark a few non-exported functions static.
      Signed-off-by: default avatarPeter Hagervall <hager@cs.umu.se>
      Cc: Paul Fulghum <paulkf@microgate.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      cdaad343
    • Jan Beulich's avatar
      [PATCH] adjust handle_IRR_event() return type · 908dcecd
      Jan Beulich authored
      Correct the return type of handle_IRQ_event() (inconsistency noticed during
      Xen development), and remove redundant declarations.  The return type
      adjustment required breaking out the definition of irqreturn_t into a
      separate header, in order to satisfy current include order dependencies.
      Signed-off-by: default avatarJan Beulich <jbeulich@novell.com>
      
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      Cc: Russell King <rmk@arm.linux.org.uk>
      Cc: Ian Molton <spyro@f2s.com>
      Cc: Mikael Starvik <starvik@axis.com>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Cc: Hirokazu Takata <takata.hirokazu@renesas.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: William Lee Irwin III <wli@holomorphy.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Miles Bader <uclinux-v850@lsi.nec.co.jp>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Roman Zippel <zippel@linux-m68k.org>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      908dcecd
    • Adrian Bunk's avatar
      [PATCH] drivers/md/raid6algos.c: fix a NULL dereference · a5d6839b
      Adrian Bunk authored
      This patch fixes a NULL dereference spotted by the Coverity checker.
      Signed-off-by: default avatarAdrian Bunk <bunk@stusta.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Neil Brown <neilb@cse.unsw.edu.au>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      a5d6839b
    • Randy Dunlap's avatar
      [PATCH] CodingStyle: add typedefs chapter · 226a6b84
      Randy Dunlap authored
      Add a chapter on typedefs, copied from an email from Linus to lkml on Feb.
      3, 2006.  (Subject: Re: [RFC][PATCH 1/5] Virtualization/containers:
      startup)
      Signed-off-by: default avatarRandy Dunlap <rdunlap@xenotime.net>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      226a6b84
    • Porpoise's avatar
      [PATCH] When CONFIG_BASE_SMALL=1, cascade() may enter an infinite loop · 3439dd86
      Porpoise authored
      When CONFIG_BASE_SAMLL=1, cascade() in may enter the infinite loop.
      Because of CONFIG_BASE_SMALL=1(TVR_BITS=6 and TVN_BITS=4), the list
      base->tv5 may cascade into base->tv5.  So, the kernel enters the infinite
      loop in the function cascade().
      
      I created a test module to verify this bug, and a patch to fix it.
      
      #include <linux/kernel.h>
      #include <linux/module.h>
      #include <linux/init.h>
      #include <linux/timer.h>
      #if 0
      #include <linux/kdb.h>
      #else
      #define kdb_printf printk
      #endif
      
      #define TVN_BITS (CONFIG_BASE_SMALL ? 4 : 6)
      #define TVR_BITS (CONFIG_BASE_SMALL ? 6 : 8)
      #define TVN_SIZE (1 << TVN_BITS)
      #define TVR_SIZE (1 << TVR_BITS)
      #define TVN_MASK (TVN_SIZE - 1)
      #define TVR_MASK (TVR_SIZE - 1)
      
      #define TV_SIZE(N)  (N*TVN_BITS  + TVR_BITS)
      
      struct timer_list timer0;
      struct timer_list dummy_timer1;
      struct timer_list dummy_timer2;
      
      void dummy_timer_fun(unsigned long data) {
      }
      unsigned long j=0;
      void check_timer_base(unsigned long data)
      {
              kdb_printf("check_timer_base %08x\n",jiffies);
              mod_timer(&timer0,(jiffies & (~0xFFF)) + 0x1FFF);
      }
      
      int init_module(void)
      {
              init_timer(&timer0);
              timer0.data = (unsigned long)0;
              timer0.function = check_timer_base;
              mod_timer(&timer0,jiffies+1);
      
              init_timer(&dummy_timer1);
              dummy_timer1.data = (unsigned long)0;
              dummy_timer1.function = dummy_timer_fun;
      
              init_timer(&dummy_timer2);
              dummy_timer2.data = (unsigned long)0;
              dummy_timer2.function = dummy_timer_fun;
      
              j=jiffies;
              j&=(~((1<<TV_SIZE(3))-1));
              j+=(1<<TV_SIZE(3));
              j+=(1<<TV_SIZE(4));
      
              kdb_printf("mod_timer %08x\n",j);
      
              mod_timer(&dummy_timer1, j );
              mod_timer(&dummy_timer2, j );
      
              return 0;
      }
      
      void cleanup_module()
      {
              del_timer_sync(&timer0);
              del_timer_sync(&dummy_timer1);
              del_timer_sync(&dummy_timer2);
      }
      
      (Cleanups from Oleg)
      
      [oleg@tv-sign.ru: use list_replace_init()]
      Cc: Oleg Nesterov <oleg@tv-sign.ru>
      Cc: Matt Mackall <mpm@selenic.com>
      Signed-off-by: default avatarOleg Nesterov <oleg@tv-sign.ru>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      3439dd86