1. 29 8月, 2017 2 次提交
  2. 28 3月, 2017 1 次提交
    • J
      KVM: MIPS/Emulate: Adapt T&E CACHE emulation for Octeon · 4fa9de5a
      James Hogan 提交于
      Cache management is implemented separately for Cavium Octeon CPUs, so
      r4k_blast_[id]cache aren't available. Instead for Octeon perform a local
      icache flush using local_flush_icache_range(), and for other platforms
      which don't use c-r4k.c use __flush_cache_all() / flush_icache_all().
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: "Radim Krčmář" <rkrcmar@redhat.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: David Daney <david.daney@cavium.com>
      Cc: Andreas Herrmann <andreas.herrmann@caviumnetworks.com>
      Cc: linux-mips@linux-mips.org
      Cc: kvm@vger.kernel.org
      4fa9de5a
  3. 05 10月, 2016 1 次提交
    • P
      MIPS: mm: Audit and remove any unnecessary uses of module.h · d9ba5778
      Paul Gortmaker 提交于
      Historically a lot of these existed because we did not have
      a distinction between what was modular code and what was providing
      support to modules via EXPORT_SYMBOL and friends.  That changed
      when we forked out support for the latter into the export.h file.
      
      This means we should be able to reduce the usage of module.h
      in code that is obj-y Makefile or bool Kconfig.  The advantage
      in doing so is that module.h itself sources about 15 other headers;
      adding significantly to what we feed cpp, and it can obscure what
      headers we are effectively using.
      
      Since module.h was the source for init.h (for __init) and for
      export.h (for EXPORT_SYMBOL) we consider each obj-y/bool instance
      for the presence of either and replace as needed.
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/14033/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      d9ba5778
  4. 04 10月, 2016 2 次提交
    • J
      MIPS: cacheflush: Use __flush_icache_user_range() · 8e3a9f4c
      James Hogan 提交于
      The cacheflush(2) system call uses flush_icache_range() to flush a range
      of usermode addresses from the icache, so change it to utilise the new
      __flush_icache_user_range() API to allow the more generic
      flush_icache_range() to be changed to work on kernel addresses only.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: Leonid Yegoshin <leonid.yegoshin@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/14153/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      8e3a9f4c
    • J
      MIPS: c-r4k: Split user/kernel flush_icache_range() · 01882b4d
      James Hogan 提交于
      flush_icache_range() is used for both user addresses (i.e.
      cacheflush(2)), and kernel addresses (as the API documentation
      describes).
      
      This isn't really suitable however for Enhanced Virtual Addressing (EVA)
      where cache operations on usermode addresses must use a different
      instruction, and the protected cache ops assume user addresses, making
      flush_icache_range() ineffective on kernel addresses.
      
      Split out a new __flush_icache_user_range() and
      __local_flush_icache_user_range() for users which actually want to flush
      usermode addresses (note that flush_icache_user_range() already exists
      on various architectures but with different arguments).
      
      The implementation of flush_icache_range() will be changed in an
      upcoming commit to use unprotected normal cache ops so as to always work
      on the kernel mode address space.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: Leonid Yegoshin <leonid.yegoshin@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/14152/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      01882b4d
  5. 13 5月, 2016 3 次提交
    • P
      MIPS: Sync icache & dcache in set_pte_at · 37d22a0d
      Paul Burton 提交于
      It's possible for pages to become visible prior to update_mmu_cache
      running if a thread within the same address space preempts the current
      thread or runs simultaneously on another CPU. That is, the following
      scenario is possible:
      
          CPU0                            CPU1
      
          write to page
          flush_dcache_page
          flush_icache_page
          set_pte_at
                                          map page
          update_mmu_cache
      
      If CPU1 maps the page in between CPU0's set_pte_at, which marks it valid
      & visible, and update_mmu_cache where the dcache flush occurs then CPU1s
      icache will fill from stale data (unless it fills from the dcache, in
      which case all is good, but most MIPS CPUs don't have this property).
      Commit 4d46a67a ("MIPS: Fix race condition in lazy cache flushing.")
      attempted to fix that by performing the dcache flush in
      flush_icache_page such that it occurs before the set_pte_at call makes
      the page visible. However it has the problem that not all code that
      writes to pages exposed to userland call flush_icache_page. There are
      many callers of set_pte_at under mm/ and only 2 of them do call
      flush_icache_page. Thus the race window between a page becoming visible
      & being coherent between the icache & dcache remains open in some cases.
      
      To illustrate some of the cases, a WARN was added to __update_cache with
      this patch applied that triggered in cases where a page about to be
      flushed from the dcache was not the last page provided to
      flush_icache_page. That is, backtraces were obtained for cases in which
      the race window is left open without this patch. The 2 standout examples
      follow.
      
      When forking a process:
      
      [   15.271842] [<80417630>] __update_cache+0xcc/0x188
      [   15.277274] [<80530394>] copy_page_range+0x56c/0x6ac
      [   15.282861] [<8042936c>] copy_process.part.54+0xd40/0x17ac
      [   15.289028] [<80429f80>] do_fork+0xe4/0x420
      [   15.293747] [<80413808>] handle_sys+0x128/0x14c
      
      When exec'ing an ELF binary:
      
      [   14.445964] [<80417630>] __update_cache+0xcc/0x188
      [   14.451369] [<80538d88>] move_page_tables+0x414/0x498
      [   14.457075] [<8055d848>] setup_arg_pages+0x220/0x318
      [   14.462685] [<805b0f38>] load_elf_binary+0x530/0x12a0
      [   14.468374] [<8055ec3c>] search_binary_handler+0xbc/0x214
      [   14.474444] [<8055f6c0>] do_execveat_common+0x43c/0x67c
      [   14.480324] [<8055f938>] do_execve+0x38/0x44
      [   14.485137] [<80413808>] handle_sys+0x128/0x14c
      
      These code paths write into a page, call flush_dcache_page then call
      set_pte_at without flush_icache_page inbetween. The end result is that
      the icache can become corrupted & userland processes may execute
      unexpected or invalid code, typically resulting in a reserved
      instruction exception, a trap or a segfault.
      
      Fix this race condition fully by performing any cache maintenance
      required to keep the icache & dcache in sync in set_pte_at, before the
      page is made valid. This has the added bonus of ensuring the cache
      maintenance always happens in one location, rather than being duplicated
      in flush_icache_page & update_mmu_cache. It also matches the way other
      architectures solve the same problem (see arm, ia64 & powerpc).
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Reported-by: NIonela Voinescu <ionela.voinescu@imgtec.com>
      Cc: Lars Persson <lars.persson@axis.com>
      Fixes: 4d46a67a ("MIPS: Fix race condition in lazy cache flushing.")
      Cc: Steven J. Hill <sjhill@realitydiluted.com>
      Cc: David Daney <david.daney@cavium.com>
      Cc: Huacai Chen <chenhc@lemote.com>
      Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Jerome Marchand <jmarchan@redhat.com>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Cc: stable <stable@vger.kernel.org> # v4.1+
      Patchwork: https://patchwork.linux-mips.org/patch/12722/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      37d22a0d
    • P
      MIPS: Handle highmem pages in __update_cache · f4281bba
      Paul Burton 提交于
      The following patch will expose __update_cache to highmem pages. Handle
      them by mapping them in for the duration of the cache maintenance, just
      like in __flush_dcache_page. The code for that isn't shared because we
      need the page address in __update_cache so sharing became messy. Given
      that the entirity is an extra 5 lines, just duplicate it.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: Lars Persson <lars.persson@axis.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Jerome Marchand <jmarchan@redhat.com>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Cc: stable <stable@vger.kernel.org> # v4.1+
      Patchwork: https://patchwork.linux-mips.org/patch/12721/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      f4281bba
    • P
      MIPS: Flush highmem pages in __flush_dcache_page · 234859e4
      Paul Burton 提交于
      When flush_dcache_page is called on an executable page, that page is
      about to be provided to userland & we can presume that the icache
      contains no valid entries for its address range. However if the icache
      does not fill from the dcache then we cannot presume that the pages
      content has been written back as far as the memories that the dcache
      will fill from (ie. L2 or further out).
      
      This was being done for lowmem pages, but not for highmem which can lead
      to icache corruption. Fix this by mapping highmem pages & flushing their
      content from the dcache in __flush_dcache_page before providing the page
      to userland, just as is done for lowmem pages.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: Lars Persson <lars.persson@axis.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/12720/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      234859e4
  6. 16 1月, 2016 1 次提交
  7. 03 8月, 2015 1 次提交
    • R
      MIPS: Partially disable RIXI support. · 55fdcb2d
      Ralf Baechle 提交于
      Execution of break instruction, trap instructions, emulation of unaligned
      loads or floating point instructions - anything that tries to read the
      instruction's opcode from userspace - needs read access to a page.
      
      RIXI (Read Inhibit / Execute Inhibit) support however allows the creation of
      pags that are executable but not readable.  On such a mapping the attempted
      load of the opcode by the kernel is going to cause an endless loop of
      page faults.
      
      The quick workaround for this is to disable the combinations that the kernel
      currently isn't able to handle which are executable mappings.
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      55fdcb2d
  8. 25 3月, 2015 2 次提交
    • L
      MIPS: Fix race condition in lazy cache flushing. · 4d46a67a
      Lars Persson 提交于
      The lazy cache flushing implemented in the MIPS kernel suffers from a
      race condition that is exposed by do_set_pte() in mm/memory.c.
      
      A pre-condition is a file-system that writes to the page from the CPU
      in its readpage method and then calls flush_dcache_page(). One example
      is ubifs. Another pre-condition is that the dcache flush is postponed
      in __flush_dcache_page().
      
      Upon a page fault for an executable mapping not existing in the
      page-cache, the following will happen:
      1. Write to the page
      2. flush_dcache_page
      3. flush_icache_page
      4. set_pte_at
      5. update_mmu_cache (commits the flush of a dcache-dirty page)
      
      Between steps 4 and 5 another thread can hit the same page and it will
      encounter a valid pte. Because the data still is in the L1 dcache the CPU
      will fetch stale data from L2 into the icache and execute garbage.
      
      This fix moves the commit of the cache flush to step 3 to close the
      race window. It also reduces the amount of flushes on non-executable
      mappings because we never enter __flush_dcache_page() for non-aliasing
      CPUs.
      
      Regressions can occur in drivers that mistakenly relies on the
      flush_dcache_page() in get_user_pages() for DMA operations.
      
      [ralf@linux-mips.org: Folded in patch 9346 to fix highmem issue.]
      Signed-off-by: NLars Persson <larper@axis.com>
      Cc: linux-mips@linux-mips.org
      Cc: paul.burton@imgtec.com
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/9346/
      Patchwork: https://patchwork.linux-mips.org/patch/9738/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      4d46a67a
    • L
      Revert "MIPS: Remove race window in page fault handling" · 5b9593f3
      Lars Persson 提交于
      Revert commit 2a4a8b1e ("MIPS: Remove race window in page fault
      handling") because it increased the number of flushed dcache pages and
      became a performance problem for some workloads.
      Signed-off-by: NLars Persson <larper@axis.com>
      Cc: linux-mips@linux-mips.org
      Cc: paul.burton@imgtec.com
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/9345/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      5b9593f3
  9. 26 8月, 2014 1 次提交
    • L
      MIPS: Remove race window in page fault handling · 4b34cdde
      Lars Persson 提交于
      Multicore MIPSes without I/D hardware coherency suffered from a race
      condition in the page fault handler. The page table entry was
      published before any pending lazy D-cache flush was committed, hence
      it allowed execution of stale page cache data by other VPEs in the
      system.
      
      To make the cache handling safe we need to perform flushing already in
      the set_pte_at function. MIPSes without coherent I-caches can get a
      small increase in flushes due to the unavailability of the execute
      flag in set_pte_at.
      
      [ralf@linux-mips.org: outlining set_pte_at() saves a good k in a test
      build, so I moved its definition from pgtable.h to cache.c.]
      Signed-off-by: NLars Persson <larper@axis.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/7511/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      4b34cdde
  10. 19 8月, 2014 1 次提交
    • L
      MIPS: Remove race window in page fault handling · 2a4a8b1e
      Lars Persson 提交于
      Multicore MIPSes without I/D hardware coherency suffered from a race
      condition in the page fault handler. The page table entry was
      published before any pending lazy D-cache flush was committed, hence
      it allowed execution of stale page cache data by other VPEs in the
      system.
      
      To make the cache handling safe we need to perform flushing already in
      the set_pte_at function. MIPSes without coherent I-caches can get a
      small increase in flushes due to the unavailability of the execute
      flag in set_pte_at.
      
      [ralf@linux-mips.org: outlining set_pte_at() saves a good k in a test
      build, so I moved its definition from pgtable.h to cache.c.]
      Signed-off-by: NLars Persson <larper@axis.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/7511/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      2a4a8b1e
  11. 30 5月, 2014 1 次提交
  12. 19 4月, 2014 1 次提交
  13. 27 3月, 2014 1 次提交
  14. 25 1月, 2014 1 次提交
  15. 15 7月, 2013 1 次提交
    • P
      MIPS: Delete __cpuinit/__CPUINIT usage from MIPS code · 078a55fc
      Paul Gortmaker 提交于
      commit 3747069b25e419f6b51395f48127e9812abc3596 upstream.
      
      The __cpuinit type of throwaway sections might have made sense
      some time ago when RAM was more constrained, but now the savings
      do not offset the cost and complications.  For example, the fix in
      commit 5e427ec2 ("x86: Fix bit corruption at CPU resume time")
      is a good example of the nasty type of bugs that can be created
      with improper use of the various __init prefixes.
      
      After a discussion on LKML[1] it was decided that cpuinit should go
      the way of devinit and be phased out.  Once all the users are gone,
      we can then finally remove the macros themselves from linux/init.h.
      
      Note that some harmless section mismatch warnings may result, since
      notify_cpu_starting() and cpu_up() are arch independent (kernel/cpu.c)
      and are flagged as __cpuinit  -- so if we remove the __cpuinit from
      the arch specific callers, we will also get section mismatch warnings.
      As an intermediate step, we intend to turn the linux/init.h cpuinit
      related content into no-ops as early as possible, since that will get
      rid of these warnings.  In any case, they are temporary and harmless.
      
      Here, we remove all the MIPS __cpuinit from C code and __CPUINIT
      from asm files.  MIPS is interesting in this respect, because there
      are also uasm users hiding behind their own renamed versions of the
      __cpuinit macros.
      
      [1] https://lkml.org/lkml/2013/5/20/589
      
      [ralf@linux-mips.org: Folded in Paul's followup fix.]
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/5494/
      Patchwork: https://patchwork.linux-mips.org/patch/5495/
      Patchwork: https://patchwork.linux-mips.org/patch/5509/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      078a55fc
  16. 08 5月, 2013 1 次提交
  17. 14 9月, 2012 1 次提交
  18. 20 10月, 2011 1 次提交
  19. 13 4月, 2010 1 次提交
    • A
      MIPS: Fix __vmalloc() etc. on MIPS for non-GPL modules · 7b3e543d
      Anton Altaparmakov 提交于
      Commit b3594a089f1c17ff919f8f78505c3f20e1f6f8ce (lmo) rsp.
      35133692 (kernel.org) break non-GPL modules
      that use __vmalloc() or any of the vmap(), vm_map_ram(), etc functions on
      MIPS.
      
      All those functions are EXPORT_SYMBOL() so are meant to be allowed to be
      used by non-GPL kernel modules.  These calls all take page protection as
      an argument which is normally a constant like PAGE_KERNEL.
      
      This commit causes all protection constants like PAGE_KERNEL to not be
      constants and instead to contain the GPL-only symbol _page_cachable_default.
      
      This means that all calls to __vmalloc(), vmap(), etc, cause non-GPL
      modules to fail to link with the complaint that they are trying to use the
      GPL-only symbol _page_cachable_default...
      
      Change EXPORT_SYMBOL_GPL(_page_cachable_default) to EXPORT_SYMBOL() for
      non-GPL modules that call __vmalloc(), vmap(), vm_map_ram() etc.
      Signed-off-by: NAnton Altaparmakov <aia21@cantab.net>
      Cc: Chris Dearman <chris@mips.com>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: http://patchwork.linux-mips.org/patch/1084/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      7b3e543d
  20. 27 2月, 2010 1 次提交
    • D
      MIPS: Implement Read Inhibit/eXecute Inhibit · 6dd9344c
      David Daney 提交于
      The SmartMIPS ASE specifies how Read Inhibit (RI) and eXecute Inhibit
      (XI) bits in the page tables work.  The upper two bits of EntryLo{0,1}
      are RI and XI when the feature is enabled in the PageGrain register.
      SmartMIPS only covers 32-bit systems.  Cavium Octeon+ extends this to
      64-bit systems by continuing to place the RI and XI bits in the top of
      EntryLo even when EntryLo is 64-bits wide.
      
      Because we need to carry the RI and XI bits in the PTE, the layout of
      the PTE is changed.  There is a two instruction overhead in the TLB
      refill hot path to get the EntryLo bits into the proper position.
      Also the TLB load exception has to probe the TLB to check if RI or XI
      caused the exception.
      
      Also of note is that the layout of the PTE bits is done at compile and
      runtime rather than statically.  In the 32-bit case this allows for
      the same number of PFN bits as before the patch as the _PAGE_HUGE is
      not supported in 32-bit kernels (we have _PAGE_NO_EXEC and
      _PAGE_NO_READ instead of _PAGE_READ and _PAGE_HUGE).
      
      The patch is tested on Cavium Octeon+, but should also work on 32-bit
      systems with the Smart-MIPS ASE.
      Signed-off-by: NDavid Daney <ddaney@caviumnetworks.com>
      To: linux-mips@linux-mips.org
      Patchwork: http://patchwork.linux-mips.org/patch/952/
      Patchwork: http://patchwork.linux-mips.org/patch/956/
      Patchwork: http://patchwork.linux-mips.org/patch/962/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      6dd9344c
  21. 11 2月, 2010 1 次提交
  22. 10 12月, 2009 1 次提交
    • C
      vfs: Implement proper O_SYNC semantics · 6b2f3d1f
      Christoph Hellwig 提交于
      While Linux provided an O_SYNC flag basically since day 1, it took until
      Linux 2.4.0-test12pre2 to actually get it implemented for filesystems,
      since that day we had generic_osync_around with only minor changes and the
      great "For now, when the user asks for O_SYNC, we'll actually give
      O_DSYNC" comment.  This patch intends to actually give us real O_SYNC
      semantics in addition to the O_DSYNC semantics.  After Jan's O_SYNC
      patches which are required before this patch it's actually surprisingly
      simple, we just need to figure out when to set the datasync flag to
      vfs_fsync_range and when not.
      
      This patch renames the existing O_SYNC flag to O_DSYNC while keeping it's
      numerical value to keep binary compatibility, and adds a new real O_SYNC
      flag.  To guarantee backwards compatiblity it is defined as expanding to
      both the O_DSYNC and the new additional binary flag (__O_SYNC) to make
      sure we are backwards-compatible when compiled against the new headers.
      
      This also means that all places that don't care about the differences can
      just check O_DSYNC and get the right behaviour for O_SYNC, too - only
      places that actuall care need to check __O_SYNC in addition.  Drivers and
      network filesystems have been updated in a fail safe way to always do the
      full sync magic if O_DSYNC is set.  The few places setting O_SYNC for
      lower layers are kept that way for now to stay failsafe.
      
      We enforce that O_DSYNC is set when __O_SYNC is set early in the open path
      to make sure we always get these sane options.
      
      Note that parisc really screwed up their headers as they already define a
      O_DSYNC that has always been a no-op.  We try to repair it by using it for
      the new O_DSYNC and redefinining O_SYNC to send both the traditional
      O_SYNC numerical value _and_ the O_DSYNC one.
      
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      Cc: Grant Grundler <grundler@parisc-linux.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Andreas Dilger <adilger@sun.com>
      Acked-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      Acked-by: NKyle McMartin <kyle@mcmartin.ca>
      Acked-by: NUlrich Drepper <drepper@redhat.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NJan Kara <jack@suse.cz>
      6b2f3d1f
  23. 28 2月, 2009 1 次提交
  24. 11 1月, 2009 1 次提交
  25. 06 9月, 2008 1 次提交
  26. 29 4月, 2008 1 次提交
  27. 08 4月, 2008 1 次提交
  28. 12 3月, 2008 1 次提交
  29. 20 2月, 2008 1 次提交
  30. 17 10月, 2007 1 次提交
  31. 12 10月, 2007 1 次提交
  32. 11 7月, 2007 1 次提交
  33. 27 4月, 2007 1 次提交
  34. 25 3月, 2007 1 次提交
  35. 12 2月, 2007 1 次提交
    • R
      [PATCH] extend the set of "__attribute__" shortcut macros · 82ddcb04
      Robert P. J. Day 提交于
      Extend the set of "__attribute__" shortcut macros, and remove identical
      (and now superfluous) definitions from a couple of source files.
      
      based on a page at robert love's blog:
      
      	http://rlove.org/log/2005102601
      
      extend the set of shortcut macros defined in compiler-gcc.h with the
      following:
      
      #define __packed                       __attribute__((packed))
      #define __weak                         __attribute__((weak))
      #define __naked                        __attribute__((naked))
      #define __noreturn                     __attribute__((noreturn))
      #define __pure                         __attribute__((pure))
      #define __aligned(x)                   __attribute__((aligned(x)))
      #define __printf(a,b)                  __attribute__((format(printf,a,b)))
      
      Once these are in place, it's up to subsystem maintainers to decide if they
      want to take advantage of them.  there is already a strong precedent for
      using shortcuts like this in the source tree.
      
      The ones that might give people pause are "__aligned" and "__printf", but
      shortcuts for both of those are already in use, and in some ways very
      confusingly.  note the two very different definitions for a macro named
      "ALIGNED":
      
        drivers/net/sgiseeq.c:#define ALIGNED(x) ((((unsigned long)(x)) + 0xf) & ~(0xf))
        drivers/scsi/ultrastor.c:#define ALIGNED(x) __attribute__((aligned(x)))
      
      also:
      
        include/acpi/platform/acgcc.h:
          #define ACPI_PRINTF_LIKE(c) __attribute__ ((__format__ (__printf__, c, c+1)))
      
      Given the precedent, then, it seems logical to at least standardize on a
      consistent set of these macros.
      Signed-off-by: NRobert P. J. Day <rpjday@mindspring.com>
      Acked-by: NRalf Baechle <ralf@linux-mips.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      82ddcb04