1. 30 Oct, 2012 30 commits
  2. 17 Oct, 2012 10 commits
    • Ben Hutchings's avatar
      Linux 3.2.32 · f34e7558
      Ben Hutchings authored
      f34e7558
    • Daniel Vetter's avatar
      drm/i915: clear fencing tracking state when retiring requests · 309c9c15
      Daniel Vetter authored
      commit 15a13bbd upstream.
      
      This fixes a resume regression introduced in
      
      commit 7dd49065
      Author: Chris Wilson <chris@chris-wilson.co.uk>
      Date:   Wed Mar 21 10:48:18 2012 +0000
      
          drm/i915: Mark untiled BLT commands as fenced on gen2/3
      
      which fixed fencing tracking for untiled blt commands.
      
      A side effect of that patch was that now also untiled objects have a
      non-zero obj->last_fenced_seqno to track when a fence can be set up
      after a pipelined tiling change. Unfortunately this was only cleared
      by the fence setup and teardown code, resulting in tons of untiled but
      inactive objects with non-zero last_fenced_seqno.
      
      Now after resume we completely reset the seqno tracking, both on the
      driver side (by setting dev_priv->next_seqno = 1) and on the hw side
      (by allocating a new hws page, which contains the seqnos). Hilarity
      and indefinite waits ensued from the stale seqnos in
      obj->last_fenced_seqno from before the suspend.
      
      The fix is to properly clear the fencing tracking state like we
      already do for the normal gpu rendering while moving objects off the
      active list.
      Reported-and-tested-by: default avatar"Rafael J. Wysocki" <rjw@sisk.pl>
      Cc: Jiri Slaby <jslaby@suse.cz>
      Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Signed-Off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      309c9c15
    • Chris Wilson's avatar
      drm/i915: Mark untiled BLT commands as fenced on gen2/3 · e25aa0dd
      Chris Wilson authored
      commit 7dd49065 upstream.
      
      The BLT commands on gen2/3 utilize the fence registers and so we cannot
      modify any fences for the object whilst those commands are in flight.
      Currently we marked tiled commands as occupying a fence, but forgot to
      restrict the untiled commands from preventing a fence being assigned
      before they were completed.
      
      One side-effect is that we ten have to double check that a fence was
      allocated for a fenced buffer during move-to-active.
      Reported-by: default avatarJiri Slaby <jirislaby@gmail.com>
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=43427
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=47990Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Testcase: i-g-t/tests/gem_tiled_after_untiled_blt
      Tested-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      [bwh: Backported to 3.2: The nesting of if-statements in the old
       i915_gem_execbuffer_reserve() differs from pin_and_fence_object(),
       so don't move the assignment of obj->pending_fenced_gpu_access but
       adjust the boolean expression as recommended by Daniel Vetter.]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      e25aa0dd
    • Daniel Vetter's avatar
      drm/i915: fix swizzle detection for gen3 · c1852234
      Daniel Vetter authored
      commit c9c4b6f6 upstream.
      
      It looks like the desktop variants of i915 and i945 also have the DCC
      register to control dram channel interleave and cpu side bit6
      swizzling.
      
      Unfortunately internal Cspec/ConfigDB documentation for these ancient chips
      have already been dropped and there seem to be no archives. Also
      somebody thought the swizzling behaviour is surely a worthy secret to
      keep and redacted any mention of these fields from the published Intel
      datasheets.
      
      I suspect the hw engineers were really proud of the page coloring
      they've achieved in their first dual channel dram controller with
      bit17 - after all Bspec explains in great length the optimal layout of
      page frame numbers modulo 4 for the color and depth buffers, too.
      Later on when they've started to work on VT-d they shamefully
      discoverd their stupidity and tried to cover the tracks ...
      
      Tested-by: Daniel Vetter <daniel.vetter@ffwll.ch> (i915g)
      Tested-by: Pavel Ondračka <pavel.ondracka@email.cz> (i945g)
      Tested-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=42625Signed-Off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      c1852234
    • Elric Fu's avatar
      xHCI: handle command after aborting the command ring · f3fe0bab
      Elric Fu authored
      commit b63f4053 upstream.
      
      According to xHCI spec section 4.6.1.1 and section 4.6.1.2,
      after aborting a command on the command ring, xHC will
      generate a command completion event with its completion
      code set to Command Ring Stopped at least. If a command is
      currently executing at the time of aborting a command, xHC
      also generate a command completion event with its completion
      code set to Command Abort. When the command ring is stopped,
      software may remove, add, or rearrage Command Descriptors.
      
      To cancel a command, software will initialize a command
      descriptor for the cancel command, and add it into a
      cancel_cmd_list of xhci. When the command ring is stopped,
      software will find the command trbs described by command
      descriptors in cancel_cmd_list and modify it to No Op
      command. If software can't find the matched trbs, we can
      think it had been finished.
      
      This patch should be backported to kernels as old as 3.0, that contain
      the commit 7ed603ec "xhci: Add an
      assertion to check for virt_dev=0 bug." That commit papers over a NULL
      pointer dereference, and this patch fixes the underlying issue that
      caused the NULL pointer dereference.
      Signed-off-by: default avatarElric Fu <elricfu1@gmail.com>
      Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
      Tested-by: default avatarMiroslav Sabljic <miroslav.sabljic@avl.com>
      [bwh: Backported to 3.2: inc_deq() needs an additional 'consumer' argument;
       Jonathan Nieder worked out that this should be false]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      f3fe0bab
    • Jesse Brandeburg's avatar
      e1000: fix lockdep splat in shutdown handler · 79c43665
      Jesse Brandeburg authored
      commit 3a3847e0 upstream.
      
      As reported by Steven Rostedt, e1000 has a lockdep splat added
      during the recent merge window.  The issue is that
      cancel_delayed_work is called while holding our private mutex.
      
      There is no reason that I can see to hold the mutex during pci
      shutdown, it was more just paranoia that I put the mutex_lock
      around the call to e1000_down.
      
      In a quick survey lots of drivers handle locking differently when
      being called by the pci layer.  The assumption here is that we
      don't need the mutexes' protection in this function because
      the driver could not be unloaded while in the shutdown handler
      which is only called at reboot or poweroff.
      Reported-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
      Tested-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      79c43665
    • Jan Engelhardt's avatar
      netfilter: xt_limit: have r->cost != 0 case work · c06493eb
      Jan Engelhardt authored
      commit 82e6bfe2 upstream.
      
      Commit v2.6.19-rc1~1272^2~41 tells us that r->cost != 0 can happen when
      a running state is saved to userspace and then reinstated from there.
      
      Make sure that private xt_limit area is initialized with correct values.
      Otherwise, random matchings due to use of uninitialized memory.
      Signed-off-by: default avatarJan Engelhardt <jengelh@inai.de>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      c06493eb
    • Florian Westphal's avatar
      netfilter: limit, hashlimit: avoid duplicated inline · 8a39c34f
      Florian Westphal authored
      commit 7a909ac7 upstream.
      
      credit_cap can be set to credit, which avoids inlining user2credits
      twice. Also, remove inline keyword and let compiler decide.
      
      old:
          684     192       0     876     36c net/netfilter/xt_limit.o
         4927     344      32    5303    14b7 net/netfilter/xt_hashlimit.o
      now:
          668     192       0     860     35c net/netfilter/xt_limit.o
         4793     344      32    5169    1431 net/netfilter/xt_hashlimit.o
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      8a39c34f
    • Lin Ming's avatar
      ipvs: fix oops on NAT reply in br_nf context · bfa53965
      Lin Ming authored
      commit 9e33ce45 upstream.
      
      IPVS should not reset skb->nf_bridge in FORWARD hook
      by calling nf_reset for NAT replies. It triggers oops in
      br_nf_forward_finish.
      
      [  579.781508] BUG: unable to handle kernel NULL pointer dereference at 0000000000000004
      [  579.781669] IP: [<ffffffff817b1ca5>] br_nf_forward_finish+0x58/0x112
      [  579.781792] PGD 218f9067 PUD 0
      [  579.781865] Oops: 0000 [#1] SMP
      [  579.781945] CPU 0
      [  579.781983] Modules linked in:
      [  579.782047]
      [  579.782080]
      [  579.782114] Pid: 4644, comm: qemu Tainted: G        W    3.5.0-rc5-00006-g95e69f9 #282 Hewlett-Packard  /30E8
      [  579.782300] RIP: 0010:[<ffffffff817b1ca5>]  [<ffffffff817b1ca5>] br_nf_forward_finish+0x58/0x112
      [  579.782455] RSP: 0018:ffff88007b003a98  EFLAGS: 00010287
      [  579.782541] RAX: 0000000000000008 RBX: ffff8800762ead00 RCX: 000000000001670a
      [  579.782653] RDX: 0000000000000000 RSI: 000000000000000a RDI: ffff8800762ead00
      [  579.782845] RBP: ffff88007b003ac8 R08: 0000000000016630 R09: ffff88007b003a90
      [  579.782957] R10: ffff88007b0038e8 R11: ffff88002da37540 R12: ffff88002da01a02
      [  579.783066] R13: ffff88002da01a80 R14: ffff88002d83c000 R15: ffff88002d82a000
      [  579.783177] FS:  0000000000000000(0000) GS:ffff88007b000000(0063) knlGS:00000000f62d1b70
      [  579.783306] CS:  0010 DS: 002b ES: 002b CR0: 000000008005003b
      [  579.783395] CR2: 0000000000000004 CR3: 00000000218fe000 CR4: 00000000000027f0
      [  579.783505] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [  579.783684] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
      [  579.783795] Process qemu (pid: 4644, threadinfo ffff880021b20000, task ffff880021aba760)
      [  579.783919] Stack:
      [  579.783959]  ffff88007693cedc ffff8800762ead00 ffff88002da01a02 ffff8800762ead00
      [  579.784110]  ffff88002da01a02 ffff88002da01a80 ffff88007b003b18 ffffffff817b26c7
      [  579.784260]  ffff880080000000 ffffffff81ef59f0 ffff8800762ead00 ffffffff81ef58b0
      [  579.784477] Call Trace:
      [  579.784523]  <IRQ>
      [  579.784562]
      [  579.784603]  [<ffffffff817b26c7>] br_nf_forward_ip+0x275/0x2c8
      [  579.784707]  [<ffffffff81704b58>] nf_iterate+0x47/0x7d
      [  579.784797]  [<ffffffff817ac32e>] ? br_dev_queue_push_xmit+0xae/0xae
      [  579.784906]  [<ffffffff81704bfb>] nf_hook_slow+0x6d/0x102
      [  579.784995]  [<ffffffff817ac32e>] ? br_dev_queue_push_xmit+0xae/0xae
      [  579.785175]  [<ffffffff8187fa95>] ? _raw_write_unlock_bh+0x19/0x1b
      [  579.785179]  [<ffffffff817ac417>] __br_forward+0x97/0xa2
      [  579.785179]  [<ffffffff817ad366>] br_handle_frame_finish+0x1a6/0x257
      [  579.785179]  [<ffffffff817b2386>] br_nf_pre_routing_finish+0x26d/0x2cb
      [  579.785179]  [<ffffffff817b2cf0>] br_nf_pre_routing+0x55d/0x5c1
      [  579.785179]  [<ffffffff81704b58>] nf_iterate+0x47/0x7d
      [  579.785179]  [<ffffffff817ad1c0>] ? br_handle_local_finish+0x44/0x44
      [  579.785179]  [<ffffffff81704bfb>] nf_hook_slow+0x6d/0x102
      [  579.785179]  [<ffffffff817ad1c0>] ? br_handle_local_finish+0x44/0x44
      [  579.785179]  [<ffffffff81551525>] ? sky2_poll+0xb35/0xb54
      [  579.785179]  [<ffffffff817ad62a>] br_handle_frame+0x213/0x229
      [  579.785179]  [<ffffffff817ad417>] ? br_handle_frame_finish+0x257/0x257
      [  579.785179]  [<ffffffff816e3b47>] __netif_receive_skb+0x2b4/0x3f1
      [  579.785179]  [<ffffffff816e69fc>] process_backlog+0x99/0x1e2
      [  579.785179]  [<ffffffff816e6800>] net_rx_action+0xdf/0x242
      [  579.785179]  [<ffffffff8107e8a8>] __do_softirq+0xc1/0x1e0
      [  579.785179]  [<ffffffff8135a5ba>] ? trace_hardirqs_off_thunk+0x3a/0x6c
      [  579.785179]  [<ffffffff8188812c>] call_softirq+0x1c/0x30
      
      The steps to reproduce as follow,
      
      1. On Host1, setup brige br0(192.168.1.106)
      2. Boot a kvm guest(192.168.1.105) on Host1 and start httpd
      3. Start IPVS service on Host1
         ipvsadm -A -t 192.168.1.106:80 -s rr
         ipvsadm -a -t 192.168.1.106:80 -r 192.168.1.105:80 -m
      4. Run apache benchmark on Host2(192.168.1.101)
         ab -n 1000 http://192.168.1.106/
      
      ip_vs_reply4
        ip_vs_out
          handle_response
            ip_vs_notrack
              nf_reset()
              {
                skb->nf_bridge = NULL;
              }
      
      Actually, IPVS wants in this case just to replace nfct
      with untracked version. So replace the nf_reset(skb) call
      in ip_vs_notrack() with a nf_conntrack_put(skb->nfct) call.
      Signed-off-by: default avatarLin Ming <mlin@ss.pku.edu.cn>
      Signed-off-by: default avatarJulian Anastasov <ja@ssi.bg>
      Signed-off-by: default avatarSimon Horman <horms@verge.net.au>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      bfa53965
    • Pablo Neira Ayuso's avatar
      netfilter: nf_ct_expect: fix possible access to uninitialized timer · 92450749
      Pablo Neira Ayuso authored
      commit 2614f864 upstream.
      
      In __nf_ct_expect_check, the function refresh_timer returns 1
      if a matching expectation is found and its timer is successfully
      refreshed. This results in nf_ct_expect_related returning 0.
      Note that at this point:
      
      - the passed expectation is not inserted in the expectation table
        and its timer was not initialized, since we have refreshed one
        matching/existing expectation.
      
      - nf_ct_expect_alloc uses kmem_cache_alloc, so the expectation
        timer is in some undefined state just after the allocation,
        until it is appropriately initialized.
      
      This can be a problem for the SIP helper during the expectation
      addition:
      
       ...
       if (nf_ct_expect_related(rtp_exp) == 0) {
               if (nf_ct_expect_related(rtcp_exp) != 0)
                       nf_ct_unexpect_related(rtp_exp);
       ...
      
      Note that nf_ct_expect_related(rtp_exp) may return 0 for the timer refresh
      case that is detailed above. Then, if nf_ct_unexpect_related(rtcp_exp)
      returns != 0, nf_ct_unexpect_related(rtp_exp) is called, which does:
      
       spin_lock_bh(&nf_conntrack_lock);
       if (del_timer(&exp->timeout)) {
               nf_ct_unlink_expect(exp);
               nf_ct_expect_put(exp);
       }
       spin_unlock_bh(&nf_conntrack_lock);
      
      Note that del_timer always returns false if the timer has been
      initialized.  However, the timer was not initialized since setup_timer
      was not called, therefore, the expectation timer remains in some
      undefined state. If I'm not missing anything, this may lead to the
      removal an unexistent expectation.
      
      To fix this, the optimization that allows refreshing an expectation
      is removed. Now nf_conntrack_expect_related looks more consistent
      to me since it always add the expectation in case that it returns
      success.
      
      Thanks to Patrick McHardy for participating in the discussion of
      this patch.
      
      I think this may be the source of the problem described by:
      http://marc.info/?l=netfilter-devel&m=134073514719421&w=2Reported-by: default avatarRafal Fitt <rafalf@aplusc.com.pl>
      Acked-by: default avatarPatrick McHardy <kaber@trash.net>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      92450749