1. 19 4月, 2017 3 次提交
  2. 25 12月, 2016 1 次提交
  3. 18 6月, 2016 1 次提交
    • B
      PCI: Ignore write combining when mapping I/O port space · 3a92c319
      Bjorn Helgaas 提交于
      PCI exposes files like /proc/bus/pci/00/00.0 in procfs.  These files
      support operations like this:
      
        ioctl(fd, PCIIOC_MMAP_IS_IO);           # request I/O port space
        ioctl(fd, PCIIOC_WRITE_COMBINE, 1);     # request write-combining
        mmap(fd, ...)
      
      Write combining is useful on PCI memory space, but I don't think it makes
      sense on PCI I/O port space.
      
      We *could* change proc_bus_pci_ioctl() to make it impossible to set
      mmap_state == pci_mmap_io and write_combine at the same time, but that
      would break the following sequence, which is currently legal:
      
        mmap(fd, ...)                           # default is I/O, non-combining
        ioctl(fd, PCIIOC_WRITE_COMBINE, 1);     # request write-combining
        ioctl(fd, PCIIOC_MMAP_IS_MEM);          # request memory space
        mmap(fd, ...)                           # get write-combining mapping
      
      Ignore the write-combining flag when mapping I/O port space.
      
      This patch should have no functional effect, based on this analysis of all
      implementations of pci_mmap_page_range():
      
        - ia64 mips parisc sh unicore32 x86 do not support mapping of I/O port
          space at all.
      
        - arm cris microblaze mn10300 sparc xtensa support mapping of I/O port
          space, but ignore the write_combine argument to pci_mmap_page_range().
      
        - powerpc supports mapping of I/O port space and uses write_combine, and
          it disables write combining for I/O port space in
          __pci_mmap_set_pgprot().
      
      This patch makes it possible to remove __pci_mmap_set_pgprot() from
      powerpc, which simplifies that path.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      3a92c319
  4. 11 6月, 2014 1 次提交
  5. 15 11月, 2013 1 次提交
  6. 29 6月, 2013 1 次提交
  7. 02 5月, 2013 2 次提交
  8. 10 4月, 2013 1 次提交
    • A
      procfs: new helper - PDE_DATA(inode) · d9dda78b
      Al Viro 提交于
      The only part of proc_dir_entry the code outside of fs/proc
      really cares about is PDE(inode)->data.  Provide a helper
      for that; static inline for now, eventually will be moved
      to fs/proc, along with the knowledge of struct proc_dir_entry
      layout.
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      d9dda78b
  9. 23 2月, 2013 1 次提交
  10. 06 11月, 2012 1 次提交
  11. 23 8月, 2012 1 次提交
  12. 18 11月, 2010 1 次提交
  13. 12 11月, 2010 1 次提交
    • M
      PCI: fix size checks for mmap() on /proc/bus/pci files · 3b519e4e
      Martin Wilck 提交于
      The checks for valid mmaps of PCI resources made through /proc/bus/pci files
      that were introduced in 9eff02e2 have several
      problems:
      
      1. mmap() calls on /proc/bus/pci files are made with real file offsets > 0,
      whereas under /sys/bus/pci/devices, the start of the resource corresponds
      to offset 0. This may lead to false negatives in pci_mmap_fits(), which
      implicitly assumes the /sys/bus/pci/devices layout.
      
      2. The loop in proc_bus_pci_mmap doesn't skip empty resouces. This leads
      to false positives, because pci_mmap_fits() doesn't treat empty resources
      correctly (the calculated size is 1 << (8*sizeof(resource_size_t)-PAGE_SHIFT)
      in this case!).
      
      3. If a user maps resources with BAR > 0, pci_mmap_fits will emit bogus
      WARNINGS for the first resources that don't fit until the correct one is found.
      
      On many controllers the first 2-4 BARs are used, and the others are empty.
      In this case, an mmap attempt will first fail on the non-empty BARs
      (including the "right" BAR because of 1.) and emit bogus WARNINGS because
      of 3., and finally succeed on the first empty BAR because of 2.
      This is certainly not the intended behaviour.
      
      This patch addresses all 3 issues.
      Updated with an enum type for the additional parameter for pci_mmap_fits().
      
      Cc: stable@kernel.org
      Signed-off-by: NMartin Wilck <martin.wilck@ts.fujitsu.com>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      3b519e4e
  14. 28 10月, 2010 1 次提交
  15. 16 10月, 2010 1 次提交
  16. 31 7月, 2010 2 次提交
    • K
      PCI: use for_each_pci_dev() · 4e344b1c
      Kulikov Vasiliy 提交于
      Use for_each_pci_dev() to simplify the code.
      Signed-off-by: NKulikov Vasiliy <segooon@gmail.com>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      4e344b1c
    • K
      PCI: kernel oops on access to pci proc file while hot-removal · 8cc2bfd8
      Kenji Kaneshige 提交于
      I encountered the problem that /proc/bus/pci/XX/YY is not removed even
      after the corresponding device is hot-removed, if the file is still
      being opened. In addtion, accessing this file in this situation causes
      kernel panic (see below).
      
      Becasue the pci_proc_detach_device() doesn't call remove_proc_entry()
      if struct proc_dir_entry->count > 1, access to /proc/bus/pci/XX/YY
      would refer to struct pci_dev that was already freed.
      
      Though I don't know why the check for proc_dir_entry->count was added,
      I don't think it is needed. Removing this check fixes the problem.
      
      Steps to reproduce
      ------------------
      # cd /sys/bus/pci/slots/2/
      # PROC_BUS_PCI_FILE=/proc/bus/pci/`awk -F: '{print $2"/"$3}' < address`.0
      # sleep 10000 < $PROC_BUS_PCI_FILE &
      # echo 0 > power
      # while true; do cat $PROC_BUS_PCI_FILE > /dev/null; done
      
      Oops Messages
      -------------
      BUG: unable to handle kernel NULL pointer dereference at 00000042
      IP: [<c05c82d5>] pci_user_read_config_dword+0x65/0xa0
      *pdpt = 000000002185e001 *pde = 0000000476a79067
      Oops: 0000 [#1] SMP
      last sysfs file: /sys/devices/pci0000:00/0000:00:1c.0/0000:10:00.0/local_cpus
      Modules linked in: autofs4 sunrpc cpufreq_ondemand acpi_cpufreq ipv6 dm_mirror dm_region_hash dm_log dm_mod e1000e i2c_i801 i2c_core iTCO_wdt igb sg pcspkr dca iTCO_vendor_support ext4 mbcache jbd2 sd_mod crc_t10dif lpfc mptsas scsi_transport_fc mptscsih mptbase scsi_tgt scsi_transport_sas [last unloaded: microcode]
      
      Pid: 2997, comm: cat Not tainted 2.6.34-kk #32 SB/PRIMEQUEST 1800E
      EIP: 0060:[<c05c82d5>] EFLAGS: 00010046 CPU: 19
      EIP is at pci_user_read_config_dword+0x65/0xa0
      EAX: 00000002 EBX: e44f1800 ECX: e144df14 EDX: 155668c7
      ESI: 00000087 EDI: 00000000 EBP: e144df40 ESP: e144df0c
       DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
      Process cat (pid: 2997, ti=e144c000 task=e26f2570 task.ti=e144c000)
      Stack:
       c09ceac0 c0570f72 ffffffff 08c57000 00000000 00001000 e44f1800 c05d2404
      <0> e144df40 00001000 00000000 00001000 08c57000 3093ae50 e420cb40 e358d5c0
      <0> c05d2300 fffffffb c054984f e144df9c 00008000 08c57000 e358d5c0 00008000
      Call Trace:
       [<c0570f72>] ? security_capable+0x22/0x30
       [<c05d2404>] ? proc_bus_pci_read+0x104/0x220
       [<c05d2300>] ? proc_bus_pci_read+0x0/0x220
       [<c054984f>] ? proc_reg_read+0x5f/0x90
       [<c05497f0>] ? proc_reg_read+0x0/0x90
       [<c050694d>] ? vfs_read+0x9d/0x190
       [<c04958f4>] ? audit_syscall_entry+0x204/0x230
       [<c0506a81>] ? sys_read+0x41/0x70
       [<c0402f1f>] ? sysenter_do_call+0x12/0x28
      Code: b4 26 00 00 00 00 b8 20 88 b1 c0 c7 44 24 08 ff ff ff ff e8 3e 52 22 00 f6 83 24 04 00 00 20 75 34 8b 43 08 8d 4c 24 08 8b 53 1c <8b> 70 40 89 4c 24 04 89 f9 c7 04 24 04 00 00 00 ff 16 89 c6 f0
      EIP: [<c05c82d5>] pci_user_read_config_dword+0x65/0xa0 SS:ESP 0068:e144df0c
      CR2: 0000000000000042
      Acked-by: NGreg Kroah-Hartman <gregkh@suse.de>
      Signed-off-by: NKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      8cc2bfd8
  17. 30 3月, 2010 1 次提交
    • T
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo 提交于
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      
        http://userweb.kernel.org/~tj/misc/slabh-sweep.py
      
      The script does the followings.
      
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
        file.
      
      The conversion was done in the following steps.
      
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
         files.
      
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
         necessary.
      
      6. percpu.h was updated not to include slab.h.
      
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
      
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Guess-its-ok-by: NChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
      5a0e3ad6
  18. 08 1月, 2009 2 次提交
  19. 23 7月, 2008 1 次提交
  20. 11 6月, 2008 2 次提交
  21. 29 4月, 2008 2 次提交
  22. 22 2月, 2008 1 次提交
    • K
      PCI: Fix wrong reference counter check for proc_dir_entry · 79df4c60
      Kenji Kaneshige 提交于
      Fix wrong counter check for proc_dir_entry in pci_proc_detach_device().
      
      The pci_proc_detach_device() returns with -EBUSY before calling
      remove_proc_entry() if the reference counter of proc_dir_entry is not
      0. But this check is wrong and pci_proc_detach_device() always fails
      because the reference counter of proc_dir_entry is initialized with 1
      at creating time and decremented in remove_proc_entry(). This bug
      cause strange behaviour as followings:
      
      - Accessing /proc/bus/pci/XXXX/YY file after hot-removing pci adapter
        card causes kernel panic.
      
      - Repeating hot-add/hot-remove of pci adapter card increases files
        with the same name under /proc/bus/pci/XXXX/ directory. For example:
      
          # pwd
          /proc/bus/pci/0002:09
          # ls
          01.0
          # for i in `seq 5`
          > do
          > echo 0 > /sys/bus/pci/slots/0009_0032/power
          > echo 1 > /sys/bus/pci/slots/0009_0032/power
          > done
          # ls
          01.0  01.0  01.0  01.0  01.0  01.0
      
      The pci_proc_detach_device() should check if the reference counter is
      not larger than 1 instead.
      Signed-off-by: NKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      79df4c60
  23. 02 2月, 2008 3 次提交
  24. 13 10月, 2007 2 次提交
  25. 17 7月, 2007 1 次提交
    • A
      Remove capability.h from mm.h · aa0ac365
      Alexey Dobriyan 提交于
      I forgot to remove capability.h from mm.h while removing sched.h!  This
      patch remedies that, because the only inline function which was using
      CAP_something was made out of line.
      
      Cross-compile tested without regressions on:
      
      	all powerpc defconfigs
      	all mips defconfigs
      	all m68k defconfigs
      	all arm defconfigs
      	all ia64 defconfigs
      
      	alpha alpha-allnoconfig alpha-defconfig alpha-up
      	arm
      	i386 i386-allnoconfig i386-defconfig i386-up
      	ia64 ia64-allnoconfig ia64-defconfig ia64-up
      	m68k
      	mips
      	parisc parisc-allnoconfig parisc-defconfig parisc-up
      	powerpc powerpc-up
      	s390 s390-allnoconfig s390-defconfig s390-up
      	sparc sparc-allnoconfig sparc-defconfig sparc-up
      	sparc64 sparc64-allnoconfig sparc64-defconfig sparc64-up
      	um-x86_64
      	x86_64 x86_64-allnoconfig x86_64-defconfig x86_64-up
      
      as well as my two usual configs.
      Signed-off-by: NAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      aa0ac365
  26. 12 7月, 2007 1 次提交
  27. 09 5月, 2007 1 次提交
  28. 13 2月, 2007 1 次提交
  29. 09 12月, 2006 1 次提交
  30. 28 6月, 2006 1 次提交