1. 20 3月, 2012 1 次提交
  2. 09 2月, 2012 1 次提交
  3. 06 1月, 2012 3 次提交
  4. 20 12月, 2011 1 次提交
  5. 09 12月, 2011 1 次提交
  6. 17 11月, 2011 1 次提交
  7. 19 10月, 2011 1 次提交
  8. 14 10月, 2011 1 次提交
  9. 07 10月, 2011 3 次提交
  10. 29 9月, 2011 1 次提交
    • D
      e1000: don't enable dma receives until after dma address has been setup · d5bc77a2
      Dean Nelson 提交于
      Doing an 'ifconfig ethN down' followed by an 'ifconfig ethN up' on a qemu-kvm
      guest system configured with two e1000 NICs can result in an 'unable to handle
      kernel paging request at 0000000100000000' or 'bad page map in process ...' or
      something similar.
      
      These result from a 4096-byte page being corrupted with the following two-word
      pattern (16-bytes) repeated throughout the entire page:
      
        0x0000000000000000
        0x0000000100000000
      
      There can be other bits set as well. What is a constant is that the 2nd word
      has the 32nd bit set. So one could see:
      
              :
        0x0000000000000000
        0x0000000100000000
        0x0000000000000000
        0x0000000172adc067    <<< bad pte
        0x800000006ec60067
        0x0000000700000040
        0x0000000000000000
        0x0000000100000000
              :
      
      Which came from from a process' page table I dumped out when the marked line
      was seen as bad by print_bad_pte().
      
      The repeating pattern represents the e1000's two-word receive descriptor:
      
      struct e1000_rx_desc {
              __le64 buffer_addr;   /* Address of the descriptor's data buffer */
              __le16 length;        /* Length of data DMAed into data buffer */
              __le16 csum;          /* Packet checksum */
              u8 status;            /* Descriptor status */
              u8 errors;            /* Descriptor Errors */
              __le16 special;
      };
      
      And the 32nd bit of the 2nd word maps to the 'u8 status' member, and
      corresponds to E1000_RXD_STAT_DD which indicates the descriptor is done.
      
      The corruption appears to result from the following...
      
       . An 'ifconfig ethN down' gets us into e1000_close(), which through a number
         of subfunctions results in:
           1. E1000_RCTL_EN being cleared in RCTL register.  [e1000_down()]
           2. dma_free_coherent() being called.  [e1000_free_rx_resources()]
      
       . An 'ifconfig ethN up' gets us into e1000_open(), which through a number of
         subfunctions results in:
           1. dma_alloc_coherent() being called.  [e1000_setup_rx_resources()]
           2. E1000_RCTL_EN being set in RCTL register.  [e1000_setup_rctl()]
           3. E1000_RCTL_EN being cleared in RCTL register.  [e1000_configure_rx()]
           4. RDLEN, RDBAH and RDBAL registers being set to reflect the dma page
              allocated in step 1.  [e1000_configure_rx()]
           5. E1000_RCTL_EN being set in RCTL register.  [e1000_configure_rx()]
      
      During the 'ifconfig ethN up' there is a window opened, starting in step 2
      where the receives are enabled up until they are disabled in step 3, in which
      the address of the receive descriptor dma page known by the NIC is still the
      previous one which was freed during the 'ifconfig ethN down'. If this memory
      has been reallocated for some other use and the NIC feels so inclined, it will
      write to that former dma page with predictably unpleasant results.
      
      I realize that in the guest, we're dealing with an e1000 NIC that is software
      emulated by qemu-kvm. The problem doesn't appear to occur on bare-metal. Andy
      suspects that this is because in the emulator link-up is essentially instant
      and traffic can start flowing immediately. Whereas on bare-metal, link-up
      usually seems to take at least a few milliseconds. And this might be enough
      to prevent traffic from flowing into the device inside the window where
      E1000_RCTL_EN is set.
      
      So perhaps a modification needs to be made to the qemu-kvm e1000 NIC emulator
      to delay the link-up. But in defense of the emulator, it seems like a bad idea
      to enable dma operations before the address of the memory to be involved has
      been made known.
      
      The following patch no longer enables receives in e1000_setup_rctl() but leaves
      them however they were. It only enables receives in e1000_configure_rx(), and
      only after the dma address has been made known to the hardware.
      
      There are two places where e1000_setup_rctl() gets called. The one in
      e1000_configure() is followed immediately by a call to e1000_configure_rx(), so
      there's really no change functionally (except for the removal of the problem
      window. The other is in __e1000_shutdown() and is not followed by a call to
      e1000_configure_rx(), so there is a change functionally. But consider...
      
       . An 'ifconfig ethN down' (just as described above).
      
       . A 'suspend' of the system, which (I'm assuming) will find its way into
         e1000_suspend() which calls __e1000_shutdown() resulting in:
           1. E1000_RCTL_EN being set in RCTL register.  [e1000_setup_rctl()]
      
      And again we've re-opened the problem window for some unknown amount of time.
      Signed-off-by: NAndy Gospodarek <andy@greyhouse.net>
      Signed-off-by: NDean Nelson <dnelson@redhat.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      d5bc77a2
  11. 31 8月, 2011 1 次提交
  12. 27 8月, 2011 1 次提交
    • D
      e1000: save skb counts in TX to avoid cache misses · 31c15a2f
      Dean Nelson 提交于
      Virtual Machines with emulated e1000 network adapter running on Parallels'
      server were seeing kernel panics due to the e1000 driver dereferencing an
      unexpected NULL pointer retrieved from buffer_info->skb.
      
      The problem has been addressed for the e1000e driver, but not for the e1000.
      Since the two drivers share similar code in the affected area, a port of the
      following e1000e driver commit solves the issue for the e1000 driver:
      
      commit 9ed318d5
      Author: Tom Herbert <therbert@google.com>
      Date:   Wed May 5 14:02:27 2010 +0000
      
          e1000e: save skb counts in TX to avoid cache misses
      
          In e1000_tx_map, precompute number of segements and bytecounts which
          are derived from fields in skb; these are stored in buffer_info.  When
          cleaning tx in e1000_clean_tx_irq use the values in the associated
          buffer_info for statistics counting, this eliminates cache misses
          on skb fields.
      Signed-off-by: NDean Nelson <dnelson@redhat.com>
      Acked-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      31c15a2f
  13. 18 8月, 2011 1 次提交
  14. 11 8月, 2011 1 次提交
  15. 22 7月, 2011 2 次提交
  16. 21 6月, 2011 1 次提交
  17. 23 5月, 2011 2 次提交
    • P
      Add appropriate <linux/prefetch.h> include for prefetch users · 70c71606
      Paul Gortmaker 提交于
      After discovering that wide use of prefetch on modern CPUs
      could be a net loss instead of a win, net drivers which were
      relying on the implicit inclusion of prefetch.h via the list
      headers showed up in the resulting cleanup fallout.  Give
      them an explicit include via the following $0.02 script.
      
       =========================================
       #!/bin/bash
       MANUAL=""
       for i in `git grep -l 'prefetch(.*)' .` ; do
       	grep -q '<linux/prefetch.h>' $i
       	if [ $? = 0 ] ; then
       		continue
       	fi
      
       	(	echo '?^#include <linux/?a'
       		echo '#include <linux/prefetch.h>'
       		echo .
       		echo w
       		echo q
       	) | ed -s $i > /dev/null 2>&1
       	if [ $? != 0 ]; then
       		echo $i needs manual fixup
       		MANUAL="$i $MANUAL"
       	fi
       done
       echo ------------------- 8\<----------------------
       echo vi $MANUAL
       =========================================
      Signed-off-by: NPaul <paul.gortmaker@windriver.com>
      [ Fixed up some incorrect #include placements, and added some
        non-network drivers and the fib_trie.c case    - Linus ]
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      70c71606
    • P
      drivers/net: add prefetch header for prefetch users · c0cba59e
      Paul Gortmaker 提交于
      After discovering that wide use of prefetch on modern CPUs
      could be a net loss instead of a win, net drivers which were
      relying on the implicit inclusion of prefetch.h via the list
      headers showed up in the resulting cleanup fallout.  Give
      them an explicit include via the following $0.02 script.
      
       =========================================
       #!/bin/bash
       MANUAL=""
       for i in `git grep -l 'prefetch(.*)' .` ; do
       	grep -q '<linux/prefetch.h>' $i
       	if [ $? = 0 ] ; then
       		continue
       	fi
      
       	(	echo '?^#include <linux/?a'
       		echo '#include <linux/prefetch.h>'
       		echo .
       		echo w
       		echo q
       	) | ed -s $i > /dev/null 2>&1
       	if [ $? != 0 ]; then
       		echo $i needs manual fixup
       		MANUAL="$i $MANUAL"
       	fi
       done
       echo ------------------- 8\<----------------------
       echo vi $MANUAL
       =========================================
      Signed-off-by: NPaul <paul.gortmaker@windriver.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c0cba59e
  18. 30 4月, 2011 1 次提交
  19. 31 3月, 2011 1 次提交
  20. 14 1月, 2011 1 次提交
  21. 10 1月, 2011 1 次提交
  22. 17 12月, 2010 1 次提交
  23. 11 12月, 2010 1 次提交
  24. 28 11月, 2010 1 次提交
  25. 22 11月, 2010 1 次提交
  26. 02 11月, 2010 1 次提交
  27. 25 10月, 2010 1 次提交
  28. 21 10月, 2010 2 次提交
  29. 27 9月, 2010 1 次提交
  30. 24 9月, 2010 3 次提交
  31. 23 9月, 2010 1 次提交