1. 10 Jan, 2007 19 commits
    • Ingo Molnar's avatar
      [PATCH] sched: fix bad missed wakeups in the i386, x86_64, ia64, ACPI and APM idle code · 9ba9b18a
      Ingo Molnar authored
      Fernando Lopez-Lezcano reported frequent scheduling latencies and audio
      xruns starting at the 2.6.18-rt kernel, and those problems persisted all
      until current -rt kernels. The latencies were serious and unjustified by
      system load, often in the milliseconds range.
      
      After a patient and heroic multi-month effort of Fernando, where he
      tested dozens of kernels, tried various configs, boot options,
      test-patches of mine and provided latency traces of those incidents, the
      following 'smoking gun' trace was captured by him:
      
                       _------=> CPU#
                      / _-----=> irqs-off
                     | / _----=> need-resched
                     || / _---=> hardirq/softirq
                     ||| / _--=> preempt-depth
                     |||| /
                     |||||     delay
         cmd     pid ||||| time  |   caller
            \   /    |||||   \   |   /
        IRQ_19-1479  1D..1    0us : __trace_start_sched_wakeup (try_to_wake_up)
        IRQ_19-1479  1D..1    0us : __trace_start_sched_wakeup <<...>-5856> (37 0)
        IRQ_19-1479  1D..1    0us : __trace_start_sched_wakeup (c01262ba 0 0)
        IRQ_19-1479  1D..1    0us : resched_task (try_to_wake_up)
        IRQ_19-1479  1D..1    0us : __spin_unlock_irqrestore (try_to_wake_up)
        ...
        <idle>-0     1...1   11us!: default_idle (cpu_idle)
        ...
        <idle>-0     0Dn.1  602us : smp_apic_timer_interrupt (c0103baf 1 0)
        ...
         <...>-5856  0D..2  618us : __switch_to (__schedule)
         <...>-5856  0D..2  618us : __schedule <<idle>-0> (20 162)
         <...>-5856  0D..2  619us : __spin_unlock_irq (__schedule)
         <...>-5856  0...1  619us : trace_stop_sched_switched (__schedule)
         <...>-5856  0D..1  619us : trace_stop_sched_switched <<...>-5856> (37 0)
      
      what is visible in this trace is that CPU#1 ran try_to_wake_up() for
      PID:5856, it placed PID:5856 on CPU#0's runqueue and ran resched_task()
      for CPU#0. But it decided to not send an IPI that no CPU - due to
      TS_POLLING. But CPU#0 never woke up after its NEED_RESCHED bit was set,
      and only rescheduled to PID:5856 upon the next lapic timer IRQ. The
      result was a 600+ usecs latency and a missed wakeup!
      
      the bug turned out to be an idle-wakeup bug introduced into the mainline
      kernel this summer via an optimization in the x86_64 tree:
      
          commit 495ab9c0
          Author: Andi Kleen <ak@suse.de>
          Date:   Mon Jun 26 13:59:11 2006 +0200
      
          [PATCH] i386/x86-64/ia64: Move polling flag into thread_info_status
      
          During some profiling I noticed that default_idle causes a lot of
          memory traffic. I think that is caused by the atomic operations
          to clear/set the polling flag in thread_info. There is actually
          no reason to make this atomic - only the idle thread does it
          to itself, other CPUs only read it. So I moved it into ti->status.
      
      the problem is this type of change:
      
              if (!hlt_counter && boot_cpu_data.hlt_works_ok) {
      -               clear_thread_flag(TIF_POLLING_NRFLAG);
      +               current_thread_info()->status &= ~TS_POLLING;
                      smp_mb__after_clear_bit();
                      while (!need_resched()) {
                              local_irq_disable();
      
      this changes clear_thread_flag() to an explicit clearing of TS_POLLING.
      clear_thread_flag() is defined as:
      
              clear_bit(flag, &ti->flags);
      
      and clear_bit() is a LOCK-ed atomic instruction on all x86 platforms:
      
        static inline void clear_bit(int nr, volatile unsigned long * addr)
        {
                __asm__ __volatile__( LOCK_PREFIX
                        "btrl %1,%0"
      
      hence smp_mb__after_clear_bit() is defined as a simple compile barrier:
      
        #define smp_mb__after_clear_bit()       barrier()
      
      but the explicit TS_POLLING clearing introduced by the patch:
      
      +               current_thread_info()->status &= ~TS_POLLING;
      
      is not an atomic op! So the clearing of the TS_POLLING bit is freely
      reorderable with the reading of the NEED_RESCHED bit - and both now
      reside in different memory addresses.
      
      CPU idle wakeup very much depends on ordered memory ops, the clearing of
      the TS_POLLING flag must always be done before we test need_resched()
      and hit the idle instruction(s). [Symmetrically, the wakeup code needs
      to set NEED_RESCHED before it tests the TS_POLLING flag, so memory
      ordering is paramount.]
      
      Fernando's dual-core Athlon64 system has a sufficiently advanced memory
      ordering model so that it triggered this scenario very often.
      
      ( And it also turned out that the reason why these latencies never
        triggered on my testsystems is that i routinely use idle=poll, which
        was the only idle variant not affected by this bug. )
      
      The fix is to change the smp_mb__after_clear_bit() to an smp_mb(), to
      act as an absolute barrier between the TS_POLLING write and the
      NEED_RESCHED read. This affects almost all idling methods (default,
      ACPI, APM), on all 3 x86 architectures: i386, x86_64, ia64.
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      Tested-by: default avatarFernando Lopez-Lezcano <nando@ccrma.Stanford.EDU>
      [chrisw: backport to 2.6.19.1]
      Signed-off-by: default avatarChris Wright <chrisw@sous-sol.org>
      9ba9b18a
    • Dirk Eibach's avatar
      [PATCH] i2c: fix broken ds1337 initialization · 2be250f7
      Dirk Eibach authored
      On a custom board with ds1337 RTC I found that upgrade from 2.6.15 to
      2.6.18 broke RTC support.
      
      The main problem are changes to ds1337_init_client().
      When a ds1337 recognizes a problem (e.g. power or clock failure) bit 7
      in status register is set. This has to be reset by writing 0 to status
      register. But since there are only 16 byte written to the chip and the
      first byte is interpreted as an address, the status register (which is
      the 16th) is never written.
      The other problem is, that initializing all registers to zero is not
      valid for day, date and month register. Funny enough this is checked by
      ds1337_detect(), which depends on this values not being zero. So then
      treated by ds1337_init_client() the ds1337 is not detected anymore,
      whereas the failure bit in the status register is still set.
      
      Broken by commit f9e89579 (2.6.16-rc1,
      2006-01-06). This fix is in Linus' tree since 2.6.20-rc1 (commit
      763d9c04).
      Signed-off-by: default avatarDirk Stieler <stieler@gdsys.de>
      Signed-off-by: default avatarDirk Eibach <eibach@gdsys.de>
      Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
      Signed-off-by: default avatarChris Wright <chrisw@sous-sol.org>
      2be250f7
    • Marcel Holtmann's avatar
      [PATCH] Bluetooth: Add packet size checks for CAPI messages (CVE-2006-6106) · d4ea7f9f
      Marcel Holtmann authored
      With malformed packets it might be possible to overwrite internal
      CMTP and CAPI data structures. This patch adds additional length
      checks to prevent these kinds of remote attacks.
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: default avatarChris Wright <chrisw@sous-sol.org>
      d4ea7f9f
    • Tejun Heo's avatar
      [PATCH] SCSI: add missing cdb clearing in scsi_execute() · f7323792
      Tejun Heo authored
      Clear-garbage-after-CDB patch missed scsi_execute() and it causes some
      ODDs (HL-DT-ST DVD-RAM GSA-H30N) choke during SCSI scan.  Note that
      this patch is only for -stable.  There is another more reliable fix
      for this problem proposed for devel tree.
      
      http://thread.gmane.org/gmane.linux.ide/14605/focus=14605Signed-off-by: default avatarTejun Heo <htejun@gmail.com>
      Cc: Jens Axboe <jens.axboe@oracle.com>
      Cc: Douglas Gilbert <dougg@torque.net>
      Signed-off-by: default avatarChris Wright <chrisw@sous-sol.org>
      f7323792
    • Roland Dreier's avatar
      [PATCH] IB/srp: Fix FMR mapping for 32-bit kernels and addresses above 4G · 5033031c
      Roland Dreier authored
      struct srp_device.fmr_page_mask was unsigned long, which means that
      the top part of addresses above 4G was being chopped off on 32-bit
      architectures.  Of course nothing good happens when data from SRP
      targets is DMAed to the wrong place.
      
      Fix this by changing fmr_page_mask to u64, to match the addresses
      actually used by IB devices.
      
      Thanks to Brian Cain <Brian.Cain@ge.com> and David McMillen
      <davem@systemfabricworks.com> for help diagnosing the bug and testing
      the fix.
      Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
      Signed-off-by: default avatarChris Wright <chrisw@sous-sol.org>
      5033031c
    • Tim Chen's avatar
      [PATCH] sched: remove __cpuinitdata anotation to cpu_isolated_map · fb0ddf36
      Tim Chen authored
      The structure cpu_isolated_map is used not only during initialization.
      Multi-core scheduler configuration changes and exclusive cpusets
      use this during run time.  During setting of sched_mc_power_savings
       policy, this structure is accessed to update sched_domains.
      Signed-off-by: default avatarTim Chen <tim.c.chen@intel.com>
      Acked-by: default avatarSuresh Siddha <suresh.b.siddha@intel.com>
      Acked-by: default avatarIngo Molnar <mingo@elte.hu>
      Signed-off-by: default avatarChris Wright <chrisw@sous-sol.org>
      fb0ddf36
    • Russell King's avatar
      [PATCH] ARM: Add sys_*at syscalls · 4a40b99a
      Russell King authored
      Later glibc requires the *at syscalls.  Add them.
      Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: default avatarChris Wright <chrisw@sous-sol.org>
      4a40b99a
    • Roman Zippel's avatar
      [PATCH] kbuild: don't put temp files in source · 57696190
      Roman Zippel authored
      The as-instr/ld-option need to create temporary files, but create them in the
      output directory, when compiling external modules.  Reformat them a bit and
      use $(CC) instead of $(AS) as the former is used by kbuild to assemble files.
      Signed-off-by: default avatarRoman Zippel <zippel@linux-m68k.org>
      Cc: Andi Kleen <ak@suse.de>
      Cc: Jan Beulich <jbeulich@novell.com>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Cc: <jpdenheijer@gmail.com>
      Cc: Horst Schirmeier <horst@schirmeier.com>
      Cc: Daniel Drake <dsd@gentoo.org>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      Signed-off-by: default avatarChris Wright <chrisw@sous-sol.org>
      57696190
    • Stefan Richter's avatar
      [PATCH] ieee1394: ohci1394: add PPC_PMAC platform code to driver probe · 459593b9
      Stefan Richter authored
      Fixes http://bugzilla.kernel.org/show_bug.cgi?id=7431
      iBook G3 threw a machine check exception and put the display backlight
      to full brightness after ohci1394 was unloaded and reloaded.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      [dsd@gentoo.org: also added missing if condition, commit
       63cca59e]
      Signed-off-by: default avatarDaniel Drake <dsd@gentoo.org>
      Acked-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      Signed-off-by: default avatarChris Wright <chrisw@sous-sol.org>
      459593b9
    • Tejun Heo's avatar
      [PATCH] libata: handle 0xff status properly · a1803540
      Tejun Heo authored
      libata waits for !BSY even when the status register reports 0xff.
      This causes long boot delays when D8 isn't pulled down properly.  This
      patch does the followings.
      
      * don't wait if status register is 0xff in all wait functions
      
      * make ata_busy_sleep() return 0 on success and -errno on failure.
        -ENODEV is returned on 0xff status and -EBUSY on other failures.
      
      * make ata_bus_softreset() succeed on 0xff status.  0xff status is not
        reset failure.  It indicates no device.  This removes unnecessary
        retries on such ports.  Note that the code change assumes unoccupied
        port reporting 0xff status does not produce valid device signature.
      Signed-off-by: default avatarTejun Heo <htejun@gmail.com>
      Cc: Joe Jin <lkmaillist@gmail.com>
      Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
      Signed-off-by: default avatarChris Wright <chrisw@sous-sol.org>
      a1803540
    • John W. Linville's avatar
      [PATCH] Revert "[PATCH] zd1211rw: Removed unneeded packed attributes" · a151f584
      John W. Linville authored
      This reverts commit 4e1bbd84.
      
      Quoth Daniel Drake <dsd@gentoo.org>:
      
      "A user reported that commit 4e1bbd84
      (Remove unneeded packed attributes) breaks the zd1211rw driver on ARM."
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      Signed-off-by: default avatarChris Wright <chrisw@sous-sol.org>
      a151f584
    • Hans Verkuil's avatar
      [PATCH] V4L: Fix broken TUNER_LG_NTSC_TAPE radio support · f37a67a1
      Hans Verkuil authored
      The TUNER_LG_NTSC_TAPE is identical in all respects to the
      TUNER_PHILIPS_FM1236_MK3. So use the params struct for the Philips tuner.
      Also add this LG_NTSC_TAPE tuner to the switches where radio specific
      parameters are set so it behaves like a TUNER_PHILIPS_FM1236_MK3. This
      change fixes the radio support for this tuner (the wrong bandswitch byte
      was used).
      
      Thanks to Andy Walls <cwalls@radix.net> for finding this bug.
      Signed-off-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
      Signed-off-by: default avatarMichael Krufky <mkrufky@linuxtv.org>
      Signed-off-by: default avatarChris Wright <chrisw@sous-sol.org>
      f37a67a1
    • Michael Krufky's avatar
      [PATCH] DVB: lgdt330x: fix signal / lock status detection bug · 65bb9cf4
      Michael Krufky authored
      In some cases when using VSB, the AGC status register has been known to
      falsely report "no signal" when in fact there is a carrier lock.  The
      datasheet labels these status flags as QAM only, yet the lgdt330x
      module is using these flags for both QAM and VSB.
      
      This patch allows for the carrier recovery lock status register to be
      tested, even if the agc signal status register falsely reports no signal.
      
      Thanks to jcrews from #linuxtv in irc, for initially reporting this bug.
      Signed-off-by: default avatarMichael Krufky <mkrufky@linuxtv.org>
      Signed-off-by: default avatarChris Wright <chrisw@sous-sol.org>
      65bb9cf4
    • Andy Gospodarek's avatar
      [PATCH] bonding: incorrect bonding state reported via ioctl · fae0ef93
      Andy Gospodarek authored
      This is a small fix-up to finish out the work done by Jay Vosburgh to
      add carrier-state support for bonding devices.  The output in
      /proc/net/bonding/bondX was correct, but when collecting the same info
      via an iotcl it could still be incorrect.
      Signed-off-by: default avatarAndy Gospodarek <andy@greyhouse.net>
      Cc: Jeff Garzik <jeff@garzik.org>
      Cc: Stephen Hemminger <shemminger@osdl.org>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
      Signed-off-by: default avatarChris Wright <chrisw@sous-sol.org>
      fae0ef93
    • Arjan van de Ven's avatar
      [PATCH] x86-64: Mark rdtsc as sync only for netburst, not for core2 · 33e57a8e
      Arjan van de Ven authored
      On the Core2 cpus, the rdtsc instruction is not serializing (as defined
      in the architecture reference since rdtsc exists) and due to the deep
      speculation of these cores, it's possible that you can observe time go
      backwards between cores due to this speculation. Since the kernel
      already deals with this with the SYNC_RDTSC flag, the solution is
      simple, only assume that the instruction is serializing on family 15...
      
      The price one pays for this is a slightly slower gettimeofday (by a
      dozen or two cycles), but that increase is quite small to pay for a
      really-going-forward tsc counter.
      Signed-off-by: default avatarArjan van de Ven <arjan@linux.intel.com>
      Signed-off-by: default avatarAndi Kleen <ak@suse.de>
      Signed-off-by: default avatarChris Wright <chrisw@sous-sol.org>
      33e57a8e
    • Ulrich Kunitz's avatar
      [PATCH] ieee80211softmac: Fix mutex_lock at exit of ieee80211_softmac_get_genie · 4ad328ff
      Ulrich Kunitz authored
      ieee80211softmac_wx_get_genie locks the associnfo mutex at
      function exit. This patch fixes it. The patch is against Linus'
      tree (commit af1713e0).
      Signed-off-by: default avatarUlrich Kunitz <kune@deine-taler.de>
      Signed-off-by: default avatarMichael Buesch <mb@bu3sch.de>
      Signed-off-by: default avatarChris Wright <chrisw@sous-sol.org>
      4ad328ff
    • Hugh Dickins's avatar
      [PATCH] read_zero_pagealigned() locking fix · 18576724
      Hugh Dickins authored
      Ramiro Voicu hits the BUG_ON(!pte_none(*pte)) in zeromap_pte_range: kernel
      bugzilla 7645.  Right: read_zero_pagealigned uses down_read of mmap_sem,
      but another thread's racing read of /dev/zero, or a normal fault, can
      easily set that pte again, in between zap_page_range and zeromap_page_range
      getting there.  It's been wrong ever since 2.4.3.
      
      The simple fix is to use down_write instead, but that would serialize reads
      of /dev/zero more than at present: perhaps some app would be badly
      affected.  So instead let zeromap_page_range return the error instead of
      BUG_ON, and read_zero_pagealigned break to the slower clear_user loop in
      that case - there's no need to optimize for it.
      
      Use -EEXIST for when a pte is found: BUG_ON in mmap_zero (the other user of
      zeromap_page_range), though it really isn't interesting there.  And since
      mmap_zero wants -EAGAIN for out-of-memory, the zeromaps better return that
      than -ENOMEM.
      Signed-off-by: default avatarHugh Dickins <hugh@veritas.com>
      Cc: Ramiro Voicu: <Ramiro.Voicu@cern.ch>
      Cc: <stable@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarChris Wright <chrisw@sous-sol.org>
      18576724
    • Herbert Xu's avatar
      [PATCH] sha512: Fix sha384 block size · 80355a9d
      Herbert Xu authored
      The SHA384 block size should be 128 bytes, not 96 bytes.  This was
      spotted by Andrew Donofrio.
      
      This breaks HMAC which uses the block size during setup and the final
      calculation.
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarChris Wright <chrisw@sous-sol.org>
      80355a9d
    • Herbert Xu's avatar
      [PATCH] dm-crypt: Select CRYPTO_CBC · 43cb0cab
      Herbert Xu authored
      As CBC is the default chaining method for cryptoloop, we should select
      it from cryptoloop to ease the transition.  Spotted by Rene Herman.
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarChris Wright <chrisw@sous-sol.org>
      43cb0cab
  2. 11 Dec, 2006 21 commits