diff options
37 files changed, 870 insertions, 390 deletions
diff --git a/Documentation/SM501.txt b/Documentation/SM501.txt new file mode 100644 index 000000000000..3a1bd95d3767 --- /dev/null +++ b/Documentation/SM501.txt @@ -0,0 +1,66 @@ + SM501 Driver + ============ + +Copyright 2006, 2007 Simtec Electronics + +Core +---- + +The core driver in drivers/mfd provides common services for the +drivers which manage the specific hardware blocks. These services +include locking for common registers, clock control and resource +management. + +The core registers drivers for both PCI and generic bus based +chips via the platform device and driver system. + +On detection of a device, the core initialises the chip (which may +be specified by the platform data) and then exports the selected +peripheral set as platform devices for the specific drivers. + +The core re-uses the platform device system as the platform device +system provides enough features to support the drivers without the +need to create a new bus-type and the associated code to go with it. + + +Resources +--------- + +Each peripheral has a view of the device which is implicitly narrowed to +the specific set of resources that peripheral requires in order to +function correctly. + +The centralised memory allocation allows the driver to ensure that the +maximum possible resource allocation can be made to the video subsystem +as this is by-far the most resource-sensitive of the on-chip functions. + +The primary issue with memory allocation is that of moving the video +buffers once a display mode is chosen. Indeed when a video mode change +occurs the memory footprint of the video subsystem changes. + +Since video memory is difficult to move without changing the display +(unless sufficient contiguous memory can be provided for the old and new +modes simultaneously) the video driver fully utilises the memory area +given to it by aligning fb0 to the start of the area and fb1 to the end +of it. Any memory left over in the middle is used for the acceleration +functions, which are transient and thus their location is less critical +as it can be moved. + + +Configuration +------------- + +The platform device driver uses a set of platform data to pass +configurations through to the core and the subsidiary drivers +so that there can be support for more than one system carrying +an SM501 built into a single kernel image. + +The PCI driver assumes that the PCI card behaves as per the Silicon +Motion reference design. + +There is an errata (AB-5) affecting the selection of the +of the M1XCLK and M1CLK frequencies. These two clocks +must be sourced from the same PLL, although they can then +be divided down individually. If this is not set, then SM501 may +lock and hang the whole system. The driver will refuse to +attach if the PLL selection is different. diff --git a/Documentation/volatile-considered-harmful.txt b/Documentation/volatile-considered-harmful.txt new file mode 100644 index 000000000000..10c2e411cca8 --- /dev/null +++ b/Documentation/volatile-considered-harmful.txt @@ -0,0 +1,119 @@ +Why the "volatile" type class should not be used +------------------------------------------------ + +C programmers have often taken volatile to mean that the variable could be +changed outside of the current thread of execution; as a result, they are +sometimes tempted to use it in kernel code when shared data structures are +being used. In other words, they have been known to treat volatile types +as a sort of easy atomic variable, which they are not. The use of volatile in +kernel code is almost never correct; this document describes why. + +The key point to understand with regard to volatile is that its purpose is +to suppress optimization, which is almost never what one really wants to +do. In the kernel, one must protect shared data structures against +unwanted concurrent access, which is very much a different task. The +process of protecting against unwanted concurrency will also avoid almost +all optimization-related problems in a more efficient way. + +Like volatile, the kernel primitives which make concurrent access to data +safe (spinlocks, mutexes, memory barriers, etc.) are designed to prevent +unwanted optimization. If they are being used properly, there will be no +need to use volatile as well. If volatile is still necessary, there is +almost certainly a bug in the code somewhere. In properly-written kernel +code, volatile can only serve to slow things down. + +Consider a typical block of kernel code: + + spin_lock(&the_lock); + do_something_on(&shared_data); + do_something_else_with(&shared_data); + spin_unlock(&the_lock); + +If all the code follows the locking rules, the value of shared_data cannot +change unexpectedly while the_lock is held. Any other code which might +want to play with that data will be waiting on the lock. The spinlock +primitives act as memory barriers - they are explicitly written to do so - +meaning that data accesses will not be optimized across them. So the +compiler might think it knows what will be in shared_data, but the +spin_lock() call, since it acts as a memory barrier, will force it to +forget anything it knows. There will be no optimization problems with +accesses to that data. + +If shared_data were declared volatile, the locking would still be +necessary. But the compiler would also be prevented from optimizing access +to shared_data _within_ the critical section, when we know that nobody else +can be working with it. While the lock is held, shared_data is not +volatile. When dealing with shared data, proper locking makes volatile +unnecessary - and potentially harmful. + +The volatile storage class was originally meant for memory-mapped I/O +registers. Within the kernel, register accesses, too, should be protected +by locks, but one also does not want the compiler "optimizing" register +accesses within a critical section. But, within the kernel, I/O memory +accesses are always done through accessor functions; accessing I/O memory +directly through pointers is frowned upon and does not work on all +architectures. Those accessors are written to prevent unwanted +optimization, so, once again, volatile is unnecessary. + +Another situation where one might be tempted to use volatile is +when the processor is busy-waiting on the value of a variable. The right +way to perform a busy wait is: + + while (my_variable != what_i_want) + cpu_relax(); + +The cpu_relax() call can lower CPU power consumption or yield to a +hyperthreaded twin processor; it also happens to serve as a memory barrier, +so, once again, volatile is unnecessary. Of course, busy-waiting is +generally an anti-social act to begin with. + +There are still a few rare situations where volatile makes sense in the +kernel: + + - The above-mentioned accessor functions might use volatile on + architectures where direct I/O memory access does work. Essentially, + each accessor call becomes a little critical section on its own and + ensures that the access happens as expected by the programmer. + + - Inline assembly code which changes memory, but which has no other + visible side effects, risks being deleted by GCC. Adding the volatile + keyword to asm statements will prevent this removal. + + - The jiffies variable is special in that it can have a different value + every time it is referenced, but it can be read without any special + locking. So jiffies can be volatile, but the addition of other + variables of this type is strongly frowned upon. Jiffies is considered + to be a "stupid legacy" issue (Linus's words) in this regard; fixing it + would be more trouble than it is worth. + + - Pointers to data structures in coherent memory which might be modified + by I/O devices can, sometimes, legitimately be volatile. A ring buffer + used by a network adapter, where that adapter changes pointers to + indicate which descriptors have been processed, is an example of this + type of situation. + +For most code, none of the above justifications for volatile apply. As a +result, the use of volatile is likely to be seen as a bug and will bring +additional scrutiny to the code. Developers who are tempted to use +volatile should take a step back and think about what they are truly trying +to accomplish. + +Patches to remove volatile variables are generally welcome - as long as +they come with a justification which shows that the concurrency issues have +been properly thought through. + + +NOTES +----- + +[1] http://lwn.net/Articles/233481/ +[2] http://lwn.net/Articles/233482/ + +CREDITS +------- + +Original impetus and research by Randy Dunlap +Written by Jonathan Corbet +Improvements via coments from Satyam Sharma, Johannes Stezenbach, Jesper + Juhl, Heikki Orsila, H. Peter Anvin, Philipp Hahn, and Stefan + Richter. diff --git a/arch/alpha/lib/csum_ipv6_magic.S b/arch/alpha/lib/csum_ipv6_magic.S index e09748dbf2ed..2c2acb96deb6 100644 --- a/arch/alpha/lib/csum_ipv6_magic.S +++ b/arch/alpha/lib/csum_ipv6_magic.S @@ -7,6 +7,9 @@ * __u32 len, * unsigned short proto, * unsigned int csum); + * + * Misalignment handling (which costs 16 instructions / 8 cycles) + * added by Ivan Kokshaysky <ink@jurassic.park.msu.ru> */ .globl csum_ipv6_magic @@ -16,37 +19,57 @@ csum_ipv6_magic: .prologue 0 - ldq $0,0($16) # e0 : load src & dst addr words + ldq_u $0,0($16) # e0 : load src & dst addr words zapnot $20,15,$20 # .. e1 : zero extend incoming csum extqh $18,1,$4 # e0 : byte swap len & proto while we wait - ldq $1,8($16) # .. e1 : + ldq_u $21,7($16) # .. e1 : handle misalignment extbl $18,1,$5 # e0 : - ldq $2,0($17) # .. e1 : + ldq_u $1,8($16) # .. e1 : extbl $18,2,$6 # e0 : - ldq $3,8($17) # .. e1 : + ldq_u $22,15($16) # .. e1 : extbl $18,3,$18 # e0 : + ldq_u $2,0($17) # .. e1 : sra $4,32,$4 # e0 : + ldq_u $23,7($17) # .. e1 : + + extql $0,$16,$0 # e0 : + ldq_u $3,8($17) # .. e1 : + extqh $21,$16,$21 # e0 : + ldq_u $24,15($17) # .. e1 : + sll $5,16,$5 # e0 : + or $0,$21,$0 # .. e1 : 1st src word complete + extql $1,$16,$1 # e0 : addq $20,$0,$20 # .. e1 : begin summing the words - sll $6,8,$6 # e0 : + extqh $22,$16,$22 # e0 : cmpult $20,$0,$0 # .. e1 : - extwh $19,7,$7 # e0 : - or $4,$18,$18 # .. e1 : + sll $6,8,$6 # e0 : + or $1,$22,$1 # .. e1 : 2nd src word complete - extbl $19,1,$19 # e0 : + extql $2,$17,$2 # e0 : + or $4,$18,$18 # .. e1 : + extqh $23,$17,$23 # e0 : or $5,$6,$5 # .. e1 : - or $18,$5,$18 # e0 : len complete - or $19,$7,$19 # .. e1 : - sll $19,48,$19 # e0 : + extql $3,$17,$3 # e0 : + or $2,$23,$2 # .. e1 : 1st dst word complete + extqh $24,$17,$24 # e0 : + or $18,$5,$18 # .. e1 : len complete + + extwh $19,7,$7 # e0 : + or $3,$24,$3 # .. e1 : 2nd dst word complete + extbl $19,1,$19 # e0 : addq $20,$1,$20 # .. e1 : - sra $19,32,$19 # e0 : proto complete + + or $19,$7,$19 # e0 : cmpult $20,$1,$1 # .. e1 : + sll $19,48,$19 # e0 : + nop # .. e0 : - nop # e0 : + sra $19,32,$19 # e0 : proto complete addq $20,$2,$20 # .. e1 : cmpult $20,$2,$2 # e0 : addq $20,$3,$20 # .. e1 : @@ -84,7 +107,7 @@ csum_ipv6_magic: extwl $0,2,$1 # e0 : fold 17-bit value zapnot $0,3,$0 # .. e1 : addq $0,$1,$0 # e0 : - not $0,$0 # e1 : and complement. + not $0,$0 # .. e1 : and complement. zapnot $0,3,$0 # e0 : ret # .. e1 : diff --git a/arch/alpha/lib/ev6-csum_ipv6_magic.S b/arch/alpha/lib/ev6-csum_ipv6_magic.S index de1948a69118..fc0bc399f872 100644 --- a/arch/alpha/lib/ev6-csum_ipv6_magic.S +++ b/arch/alpha/lib/ev6-csum_ipv6_magic.S @@ -46,6 +46,10 @@ * add the 3 low ushorts together, generating a uint * a final add of the 2 lower ushorts * truncating the result. + * + * Misalignment handling added by Ivan Kokshaysky <ink@jurassic.park.msu.ru> + * The cost is 16 instructions (~8 cycles), including two extra loads which + * may cause additional delay in rare cases (load-load replay traps). */ .globl csum_ipv6_magic @@ -55,25 +59,45 @@ csum_ipv6_magic: .prologue 0 - ldq $0,0($16) # L : Latency: 3 + ldq_u $0,0($16) # L : Latency: 3 inslh $18,7,$4 # U : 0000000000AABBCC - ldq $1,8($16) # L : Latency: 3 + ldq_u $1,8($16) # L : Latency: 3 sll $19,8,$7 # U : U L U L : 0x00000000 00aabb00 + and $16,7,$6 # E : src misalignment + ldq_u $5,15($16) # L : Latency: 3 zapnot $20,15,$20 # U : zero extend incoming csum - ldq $2,0($17) # L : Latency: 3 - sll $19,24,$19 # U : U L L U : 0x000000aa bb000000 + ldq_u $2,0($17) # L : U L U L : Latency: 3 + + extql $0,$6,$0 # U : + extqh $1,$6,$22 # U : + ldq_u $3,8($17) # L : Latency: 3 + sll $19,24,$19 # U : U U L U : 0x000000aa bb000000 + + cmoveq $6,$31,$22 # E : src aligned? + ldq_u $23,15($17) # L : Latency: 3 inswl $18,3,$18 # U : 000000CCDD000000 + addl $19,$7,$19 # E : U L U L : <sign bits>bbaabb00 - ldq $3,8($17) # L : Latency: 3 - bis $18,$4,$18 # E : 000000CCDDAABBCC - addl $19,$7,$19 # E : <sign bits>bbaabb00 - nop # E : U L U L + or $0,$22,$0 # E : 1st src word complete + extql $1,$6,$1 # U : + or $18,$4,$18 # E : 000000CCDDAABBCC + extqh $5,$6,$5 # U : L U L U + and $17,7,$6 # E : dst misalignment + extql $2,$6,$2 # U : + or $1,$5,$1 # E : 2nd src word complete + extqh $3,$6,$22 # U : L U L U : + + cmoveq $6,$31,$22 # E : dst aligned? + extql $3,$6,$3 # U : addq $20,$0,$20 # E : begin summing the words + extqh $23,$6,$23 # U : L U L U : + srl $18,16,$4 # U : 0000000000CCDDAA + or $2,$22,$2 # E : 1st dst word complete zap $19,0x3,$19 # U : <sign bits>bbaa0000 - nop # E : L U U L + or $3,$23,$3 # E : U L U L : 2nd dst word complete cmpult $20,$0,$0 # E : addq $20,$1,$20 # E : diff --git a/arch/avr32/boards/atngw100/setup.c b/arch/avr32/boards/atngw100/setup.c index 9bc37d4f6687..6c4dc0a00e9f 100644 --- a/arch/avr32/boards/atngw100/setup.c +++ b/arch/avr32/boards/atngw100/setup.c @@ -94,9 +94,6 @@ static void __init set_hw_addr(struct platform_device *pdev) clk_put(pclk); } -struct platform_device *at32_usart_map[1]; -unsigned int at32_nr_usarts = 1; - void __init setup_board(void) { at32_map_usart(1, 0); /* USART 1: /dev/ttyS0, DB9 */ diff --git a/arch/avr32/configs/atngw100_defconfig b/arch/avr32/configs/atngw100_defconfig index c254ffcfa458..49493ad3b5a9 100644 --- a/arch/avr32/configs/atngw100_defconfig +++ b/arch/avr32/configs/atngw100_defconfig @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit -# Linux kernel version: 2.6.21-rc6 -# Thu Apr 12 16:35:07 2007 +# Linux kernel version: 2.6.22-rc5 +# Sat Jun 23 15:40:05 2007 # CONFIG_AVR32=y CONFIG_GENERIC_GPIO=y @@ -40,6 +40,7 @@ CONFIG_BSD_PROCESS_ACCT_V3=y # CONFIG_UTS_NS is not set # CONFIG_AUDIT is not set # CONFIG_IKCONFIG is not set +CONFIG_LOG_BUF_SHIFT=14 CONFIG_SYSFS_DEPRECATED=y # CONFIG_RELAY is not set CONFIG_BLK_DEV_INITRD=y @@ -57,14 +58,20 @@ CONFIG_BUG=y CONFIG_ELF_CORE=y # CONFIG_BASE_FULL is not set CONFIG_FUTEX=y +CONFIG_ANON_INODES=y CONFIG_EPOLL=y +CONFIG_SIGNALFD=y +CONFIG_TIMERFD=y +CONFIG_EVENTFD=y CONFIG_SHMEM=y -CONFIG_SLAB=y CONFIG_VM_EVENT_COUNTERS=y +# CONFIG_SLUB_DEBUG is not set +# CONFIG_SLAB is not set +CONFIG_SLUB=y +# CONFIG_SLOB is not set CONFIG_RT_MUTEXES=y # CONFIG_TINY_SHMEM is not set CONFIG_BASE_SMALL=1 -# CONFIG_SLOB is not set # # Loadable module support @@ -148,6 +155,7 @@ CONFIG_CMDLINE="" # # Bus options # +# CONFIG_ARCH_SUPPORTS_MSI is not set # # PCCARD (PCMCIA/CardBus) support @@ -168,7 +176,6 @@ CONFIG_NET=y # # Networking options # -# CONFIG_NETDEBUG is not set CONFIG_PACKET=y CONFIG_PACKET_MMAP=y CONFIG_UNIX=y @@ -212,14 +219,11 @@ CONFIG_INET_TCP_DIAG=y CONFIG_TCP_CONG_CUBIC=y CONFIG_DEFAULT_TCP_CONG="cubic" # CONFIG_TCP_MD5SIG is not set - -# -# IP: Virtual Server Configuration -# # CONFIG_IP_VS is not set CONFIG_IPV6=y # CONFIG_IPV6_PRIVACY is not set # CONFIG_IPV6_ROUTER_PREF is not set +# CONFIG_IPV6_OPTIMISTIC_DAD is not set CONFIG_INET6_AH=y CONFIG_INET6_ESP=y CONFIG_INET6_IPCOMP=y @@ -242,8 +246,6 @@ CONFIG_NETFILTER=y # # CONFIG_NETFILTER_NETLINK is not set CONFIG_NF_CONNTRACK_ENABLED=m -CONFIG_NF_CONNTRACK_SUPPORT=y -# CONFIG_IP_NF_CONNTRACK_SUPPORT is not set CONFIG_NF_CONNTRACK=m CONFIG_NF_CT_ACCT=y CONFIG_NF_CONNTRACK_MARK=y @@ -357,20 +359,8 @@ CONFIG_IP6_NF_TARGET_REJECT=m CONFIG_IP6_NF_MANGLE=m CONFIG_IP6_NF_TARGET_HL=m CONFIG_IP6_NF_RAW=m - -# -# DCCP Configuration (EXPERIMENTAL) -# # CONFIG_IP_DCCP is not set - -# -# SCTP Configuration (EXPERIMENTAL) -# # CONFIG_IP_SCTP is not set - -# -# TIPC Configuration (EXPERIMENTAL) -# # CONFIG_TIPC is not set # CONFIG_ATM is not set # CONFIG_BRIDGE is not set @@ -397,7 +387,16 @@ CONFIG_NET_CLS_ROUTE=y # CONFIG_HAMRADIO is not set # CONFIG_IRDA is not set # CONFIG_BT is not set +# CONFIG_AF_RXRPC is not set + +# +# Wireless +# +# CONFIG_CFG80211 is not set +# CONFIG_WIRELESS_EXT is not set +# CONFIG_MAC80211 is not set # CONFIG_IEEE80211 is not set +# CONFIG_RFKILL is not set # # Device Drivers @@ -417,10 +416,6 @@ CONFIG_STANDALONE=y # Connector - unified userspace <-> kernelspace linker # # CONFIG_CONNECTOR is not set - -# -# Memory Technology Devices (MTD) -# CONFIG_MTD=y # CONFIG_MTD_DEBUG is not set # CONFIG_MTD_CONCAT is not set @@ -464,7 +459,6 @@ CONFIG_MTD_CFI_UTIL=y # CONFIG_MTD_RAM is not set # CONFIG_MTD_ROM is not set # CONFIG_MTD_ABSENT is not set -# CONFIG_MTD_OBSOLETE_CHIPS is not set # # Mapping drivers for chip access @@ -492,16 +486,13 @@ CONFIG_MTD_DATAFLASH=y # CONFIG_MTD_DOC2000 is not set # CONFIG_MTD_DOC2001 is not set # CONFIG_MTD_DOC2001PLUS is not set - -# -# NAND Flash Device Drivers -# # CONFIG_MTD_NAND is not set +# CONFIG_MTD_ONENAND is not set # -# OneNAND Flash Device Drivers +# UBI - Unsorted block images # -# CONFIG_MTD_ONENAND is not set +# CONFIG_MTD_UBI is not set # # Parallel port support @@ -530,10 +521,7 @@ CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 # # Misc devices # - -# -# ATA/ATAPI/MFM/RLL support -# +# CONFIG_BLINK is not set # CONFIG_IDE is not set # @@ -542,10 +530,6 @@ CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 # CONFIG_RAID_ATTRS is not set # CONFIG_SCSI is not set # CONFIG_SCSI_NETLINK is not set - -# -# Serial ATA (prod) and Parallel ATA (experimental) drivers -# # CONFIG_ATA is not set # @@ -554,19 +538,6 @@ CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 # CONFIG_MD is not set # -# Fusion MPT device support -# -# CONFIG_FUSION is not set - -# -# IEEE 1394 (FireWire) support -# - -# -# I2O device support -# - -# # Network device support # CONFIG_NETDEVICES=y @@ -574,10 +545,6 @@ CONFIG_NETDEVICES=y # CONFIG_BONDING is not set # CONFIG_EQUALIZER is not set CONFIG_TUN=m - -# -# PHY device support -# # CONFIG_PHYLIB is not set # @@ -586,27 +553,14 @@ CONFIG_TUN=m CONFIG_NET_ETHERNET=y CONFIG_MII=y CONFIG_MACB=y +# CONFIG_NETDEV_1000 is not set +# CONFIG_NETDEV_10000 is not set # -# Ethernet (1000 Mbit) -# - -# -# Ethernet (10000 Mbit) -# - -# -# Token Ring devices -# - -# -# Wireless LAN (non-hamradio) -# -# CONFIG_NET_RADIO is not set - -# -# Wan interfaces +# Wireless LAN # +# CONFIG_WLAN_PRE80211 is not set +# CONFIG_WLAN_80211 is not set # CONFIG_WAN is not set CONFIG_PPP=m # CONFIG_PPP_MULTILINK is not set @@ -671,15 +625,10 @@ CONFIG_UNIX98_PTYS=y # IPMI # # CONFIG_IPMI_HANDLER is not set - -# -# Watchdog Cards -# # CONFIG_WATCHDOG is not set # CONFIG_HW_RANDOM is not set # CONFIG_RTC is not set # CONFIG_GEN_RTC is not set -# CONFIG_DTLK is not set # CONFIG_R3964 is not set # CONFIG_RAW_DRIVER is not set @@ -687,10 +636,6 @@ CONFIG_UNIX98_PTYS=y # TPM devices # # CONFIG_TCG_TPM is not set - -# -# I2C support -# # CONFIG_I2C is not set # @@ -710,17 +655,13 @@ CONFIG_SPI_ATMEL=y # SPI Protocol Masters # # CONFIG_SPI_AT25 is not set +# CONFIG_SPI_SPIDEV is not set # # Dallas's 1-wire bus # # CONFIG_W1 is not set - -# -# Hardware Monitoring support -# # CONFIG_HWMON is not set -# CONFIG_HWMON_VID is not set # # Multifunction device drivers @@ -731,16 +672,19 @@ CONFIG_SPI_ATMEL=y # Multimedia devices # # CONFIG_VIDEO_DEV is not set +# CONFIG_DVB_CORE is not set +# CONFIG_DAB is not set # -# Digital Video Broadcasting Devices +# Graphics support # -# CONFIG_DVB is not set +# CONFIG_BACKLIGHT_LCD_SUPPORT is not set # -# Graphics support +# Display device support # -# CONFIG_BACKLIGHT_LCD_SUPPORT is not set +# CONFIG_DISPLAY_SUPPORT is not set +# CONFIG_VGASTATE is not set # CONFIG_FB is not set # @@ -763,10 +707,6 @@ CONFIG_SPI_ATMEL=y # USB Gadget Support # # CONFIG_USB_GADGET is not set - -# -# MMC/SD Card support -# # CONFIG_MMC is not set # @@ -809,14 +749,6 @@ CONFIG_SPI_ATMEL=y # # -# Auxiliary Display support -# - -# -# Virtualization -# - -# # File systems # CONFIG_EXT2_FS=y @@ -911,6 +843,7 @@ CONFIG_LOCKD=y CONFIG_LOCKD_V4=y CONFIG_NFS_COMMON=y CONFIG_SUNRPC=y +# CONFIG_SUNRPC_BIND34 is not set # CONFIG_RPCSEC_GSS_KRB5 is not set # CONFIG_RPCSEC_GSS_SPKM3 is not set CONFIG_SMB_FS=m @@ -993,11 +926,9 @@ CONFIG_MAGIC_SYSRQ=y # CONFIG_HEADERS_CHECK is not set CONFIG_DEBUG_KERNEL=y # CONFIG_DEBUG_SHIRQ is not set -CONFIG_LOG_BUF_SHIFT=14 CONFIG_DETECT_SOFTLOCKUP=y # CONFIG_SCHEDSTATS is not set # CONFIG_TIMER_STATS is not set -# CONFIG_DEBUG_SLAB is not set # CONFIG_DEBUG_RT_MUTEXES is not set # CONFIG_RT_MUTEX_TESTER is not set # CONFIG_DEBUG_SPINLOCK is not set @@ -1044,6 +975,7 @@ CONFIG_CRYPTO_ECB=m CONFIG_CRYPTO_CBC=y CONFIG_CRYPTO_PCBC=m # CONFIG_CRYPTO_LRW is not set +# CONFIG_CRYPTO_CRYPTD is not set CONFIG_CRYPTO_DES=y # CONFIG_CRYPTO_FCRYPT is not set # CONFIG_CRYPTO_BLOWFISH is not set @@ -1072,6 +1004,7 @@ CONFIG_CRYPTO_DEFLATE=y CONFIG_BITREVERSE=y CONFIG_CRC_CCITT=m # CONFIG_CRC16 is not set +# CONFIG_CRC_ITU_T is not set CONFIG_CRC32=y # CONFIG_LIBCRC32C is not set CONFIG_ZLIB_INFLATE=y @@ -1083,3 +1016,4 @@ CONFIG_TEXTSEARCH_FSM=m CONFIG_PLIST=y CONFIG_HAS_IOMEM=y CONFIG_HAS_IOPORT=y +CONFIG_HAS_DMA=y diff --git a/arch/avr32/configs/atstk1002_defconfig b/arch/avr32/configs/atstk1002_defconfig index 77dace9d54bc..3b977fdbaa78 100644 --- a/arch/avr32/configs/atstk1002_defconfig +++ b/arch/avr32/configs/atstk1002_defconfig @@ -1,9 +1,10 @@ # # Automatically generated make config: don't edit -# Linux kernel version: 2.6.20-rc6 -# Fri Jan 26 13:12:59 2007 +# Linux kernel version: 2.6.22-rc5 +# Sat Jun 23 15:32:08 2007 # CONFIG_AVR32=y +CONFIG_GENERIC_GPIO=y CONFIG_GENERIC_HARDIRQS=y CONFIG_HARDIRQS_SW_RESEND=y CONFIG_GENERIC_IRQ_PROBE=y @@ -13,6 +14,7 @@ CONFIG_GENERIC_TIME=y # CONFIG_ARCH_HAS_ILOG2_U64 is not set CONFIG_GENERIC_HWEIGHT=y CONFIG_GENERIC_CALIBRATE_DELAY=y +CONFIG_GENERIC_BUG=y CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" # @@ -30,19 +32,22 @@ CONFIG_LOCALVERSION="" CONFIG_SWAP=y CONFIG_SYSVIPC=y # CONFIG_IPC_NS is not set +CONFIG_SYSVIPC_SYSCTL=y CONFIG_POSIX_MQUEUE=y CONFIG_BSD_PROCESS_ACCT=y CONFIG_BSD_PROCESS_ACCT_V3=y CONFIG_TASKSTATS=y CONFIG_TASK_DELAY_ACCT=y +# CONFIG_TASK_XACCT is not set # CONFIG_UTS_NS is not set CONFIG_AUDIT=y # CONFIG_IKCONFIG is not set +CONFIG_LOG_BUF_SHIFT=14 CONFIG_SYSFS_DEPRECATED=y CONFIG_RELAY=y +CONFIG_BLK_DEV_INITRD=y CONFIG_INITRAMFS_SOURCE="" CONFIG_CC_OPTIMIZE_FOR_SIZE=y -# CONFIG_TASK_XACCT is not set CONFIG_SYSCTL=y CONFIG_EMBEDDED=y # CONFIG_SYSCTL_SYSCALL is not set @@ -55,14 +60,20 @@ CONFIG_BUG=y CONFIG_ELF_CORE=y # CONFIG_BASE_FULL is not set CONFIG_FUTEX=y +CONFIG_ANON_INODES=y CONFIG_EPOLL=y +CONFIG_SIGNALFD=y +CONFIG_TIMERFD=y +CONFIG_EVENTFD=y CONFIG_SHMEM=y -CONFIG_SLAB=y CONFIG_VM_EVENT_COUNTERS=y +# CONFIG_SLUB_DEBUG is not set +# CONFIG_SLAB is not set +CONFIG_SLUB=y +# CONFIG_SLOB is not set CONFIG_RT_MUTEXES=y # CONFIG_TINY_SHMEM is not set CONFIG_BASE_SMALL=1 -# CONFIG_SLOB is not set # # Loadable module support @@ -105,7 +116,15 @@ CONFIG_PLATFORM_AT32AP=y CONFIG_CPU_AT32AP7000=y CONFIG_BOARD_ATSTK1002=y CONFIG_BOARD_ATSTK1000=y +# CONFIG_BOARD_ATNGW100 is not set CONFIG_LOADER_U_BOOT=y + +# +# Atmel AVR32 AP options +# +# CONFIG_AP7000_32_BIT_SMC is not set +CONFIG_AP7000_16_BIT_SMC=y +# CONFIG_AP7000_8_BIT_SMC is not set CONFIG_LOAD_ADDRESS=0x10000000 CONFIG_ENTRY_ADDRESS=0x90000000 CONFIG_PHYS_OFFSET=0x10000000 @@ -127,6 +146,7 @@ CONFIG_FLAT_NODE_MEM_MAP=y # CONFIG_SPARSEMEM_STATIC is not set CONFIG_SPLIT_PTLOCK_CPUS=4 # CONFIG_RESOURCES_64BIT is not set +CONFIG_ZONE_DMA_FLAG=0 # CONFIG_OWNERSHIP_TRACE is not set # CONFIG_HZ_100 is not set CONFIG_HZ_250=y @@ -138,6 +158,7 @@ CONFIG_CMDLINE="" # # Bus options # +# CONFIG_ARCH_SUPPORTS_MSI is not set # # PCCARD (PCMCIA/CardBus) support @@ -158,7 +179,6 @@ CONFIG_NET=y # # Networking options # -# CONFIG_NETDEBUG is not set CONFIG_PACKET=y CONFIG_PACKET_MMAP=y CONFIG_UNIX=y @@ -194,20 +214,8 @@ CONFIG_DEFAULT_TCP_CONG="cubic" # CONFIG_INET6_TUNNEL is not set # CONFIG_NETWORK_SECMARK is not set # CONFIG_NETFILTER is not set - -# -# DCCP Configuration (EXPERIMENTAL) -# # CONFIG_IP_DCCP is not set - -# -# SCTP Configuration (EXPERIMENTAL) -# # CONFIG_IP_SCTP is not set - -# -# TIPC Configuration (EXPERIMENTAL) -# # CONFIG_TIPC is not set # CONFIG_ATM is not set # CONFIG_BRIDGE is not set @@ -233,7 +241,16 @@ CONFIG_DEFAULT_TCP_CONG="cubic" # CONFIG_HAMRADIO is not set # CONFIG_IRDA is not set # CONFIG_BT is not set +# CONFIG_AF_RXRPC is not set + +# +# Wireless +# +# CONFIG_CFG80211 is not set +# CONFIG_WIRELESS_EXT is not set +# CONFIG_MAC80211 is not set # CONFIG_IEEE80211 is not set +# CONFIG_RFKILL is not set # # Device Drivers @@ -246,16 +263,13 @@ CONFIG_STANDALONE=y # CONFIG_PREVENT_FIRMWARE_BUILD is not set # CONFIG_FW_LOADER is not set # CONFIG_DEBUG_DRIVER is not set +# CONFIG_DEBUG_DEVRES is not set # CONFIG_SYS_HYPERVISOR is not set # # Connector - unified userspace <-> kernelspace linker # # CONFIG_CONNECTOR is not set - -# -# Memory Technology Devices (MTD) -# CONFIG_MTD=y # CONFIG_MTD_DEBUG is not set # CONFIG_MTD_CONCAT is not set @@ -299,7 +313,6 @@ CONFIG_MTD_CFI_UTIL=y # CONFIG_MTD_RAM is not set # CONFIG_MTD_ROM is not set # CONFIG_MTD_ABSENT is not set -# CONFIG_MTD_OBSOLETE_CHIPS is not set # # Mapping drivers for chip access @@ -325,16 +338,13 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=2 # CONFIG_MTD_DOC2000 is not set # CONFIG_MTD_DOC2001 is not set # CONFIG_MTD_DOC2001PLUS is not set - -# -# NAND Flash Device Drivers -# # CONFIG_MTD_NAND is not set +# CONFIG_MTD_ONENAND is not set # -# OneNAND Flash Device Drivers +# UBI - Unsorted block images # -# CONFIG_MTD_ONENAND is not set +# CONFIG_MTD_UBI is not set # # Parallel port support @@ -344,6 +354,7 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=2 # # Plug and Play support # +# CONFIG_PNPACPI is not set # # Block devices @@ -356,18 +367,13 @@ CONFIG_BLK_DEV_RAM=m CONFIG_BLK_DEV_RAM_COUNT=16 CONFIG_BLK_DEV_RAM_SIZE=4096 CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 -CONFIG_BLK_DEV_INITRD=y # CONFIG_CDROM_PKTCDVD is not set # CONFIG_ATA_OVER_ETH is not set # # Misc devices # -# CONFIG_TIFM_CORE is not set - -# -# ATA/ATAPI/MFM/RLL support -# +# CONFIG_BLINK is not set # CONFIG_IDE is not set # @@ -376,10 +382,6 @@ CONFIG_BLK_DEV_INITRD=y # CONFIG_RAID_ATTRS is not set # CONFIG_SCSI is not set # CONFIG_SCSI_NETLINK is not set - -# -# Serial ATA (prod) and Parallel ATA (experimental) drivers -# # CONFIG_ATA is not set # @@ -388,19 +390,6 @@ CONFIG_BLK_DEV_INITRD=y # CONFIG_MD is not set # -# Fusion MPT device support -# -# CONFIG_FUSION is not set - -# -# IEEE 1394 (FireWire) support -# - -# -# I2O device support -# - -# # Network device support # CONFIG_NETDEVICES=y @@ -408,10 +397,6 @@ CONFIG_DUMMY=y # CONFIG_BONDING is not set # CONFIG_EQUALIZER is not set CONFIG_TUN=m - -# -# PHY device support -# # CONFIG_PHYLIB is not set # @@ -420,27 +405,14 @@ CONFIG_TUN=m CONFIG_NET_ETHERNET=y CONFIG_MII=y CONFIG_MACB=y +# CONFIG_NETDEV_1000 is not set +# CONFIG_NETDEV_10000 is not set # -# Ethernet (1000 Mbit) -# - -# -# Ethernet (10000 Mbit) -# - -# -# Token Ring devices -# - -# -# Wireless LAN (non-hamradio) -# -# CONFIG_NET_RADIO is not set - -# -# Wan interfaces +# Wireless LAN # +# CONFIG_WLAN_PRE80211 is not set +# CONFIG_WLAN_80211 is not set # CONFIG_WAN is not set CONFIG_PPP=m # CONFIG_PPP_MULTILINK is not set @@ -505,15 +477,10 @@ CONFIG_UNIX98_PTYS=y # IPMI # # CONFIG_IPMI_HANDLER is not set - -# -# Watchdog Cards -# # CONFIG_WATCHDOG is not set # CONFIG_HW_RANDOM is not set # CONFIG_RTC is not set # CONFIG_GEN_RTC is not set -# CONFIG_DTLK is not set # CONFIG_R3964 is not set # CONFIG_RAW_DRIVER is not set @@ -521,10 +488,6 @@ CONFIG_UNIX98_PTYS=y # TPM devices # # CONFIG_TCG_TPM is not set - -# -# I2C support -# # CONFIG_I2C is not set # @@ -537,29 +500,31 @@ CONFIG_UNIX98_PTYS=y # Dallas's 1-wire bus # # CONFIG_W1 is not set +# CONFIG_HWMON is not set # -# Hardware Monitoring support +# Multifunction device drivers # -# CONFIG_HWMON is not set -# CONFIG_HWMON_VID is not set +# CONFIG_MFD_SM501 is not set # # Multimedia devices # # CONFIG_VIDEO_DEV is not set +# CONFIG_DVB_CORE is not set +# CONFIG_DAB is not set # -# Digital Video Broadcasting Devices +# Graphics support # -# CONFIG_DVB is not set +# CONFIG_BACKLIGHT_LCD_SUPPORT is not set # -# Graphics support +# Display device support # -# CONFIG_FIRMWARE_EDID is not set +# CONFIG_DISPLAY_SUPPORT is not set +# CONFIG_VGASTATE is not set # CONFIG_FB is not set -# CONFIG_BACKLIGHT_LCD_SUPPORT is not set # # Sound @@ -581,10 +546,6 @@ CONFIG_UNIX98_PTYS=y # USB Gadget Support # # CONFIG_USB_GADGET is not set - -# -# MMC/SD Card support -# # CONFIG_MMC is not set # @@ -627,10 +588,6 @@ CONFIG_UNIX98_PTYS=y # # -# Virtualization -# - -# # File systems # CONFIG_EXT2_FS=m @@ -712,8 +669,20 @@ CONFIG_JFFS2_RTIME=y # # Network File Systems # -# CONFIG_NFS_FS is not set +CONFIG_NFS_FS=y +CONFIG_NFS_V3=y +# CONFIG_NFS_V3_ACL is not set +# CONFIG_NFS_V4 is not set +# CONFIG_NFS_DIRECTIO is not set # CONFIG_NFSD is not set +CONFIG_ROOT_NFS=y +CONFIG_LOCKD=y +CONFIG_LOCKD_V4=y +CONFIG_NFS_COMMON=y +CONFIG_SUNRPC=y +# CONFIG_SUNRPC_BIND34 is not set +# CONFIG_RPCSEC_GSS_KRB5 is not set +# CONFIG_RPCSEC_GSS_SPKM3 is not set # CONFIG_SMB_FS is not set # CONFIG_CIFS is not set # CONFIG_NCP_FS is not set @@ -787,15 +756,14 @@ CONFIG_MAGIC_SYSRQ=y CONFIG_DEBUG_FS=y # CONFIG_HEADERS_CHECK is not set CONFIG_DEBUG_KERNEL=y -CONFIG_LOG_BUF_SHIFT=14 +# CONFIG_DEBUG_SHIRQ is not set CONFIG_DETECT_SOFTLOCKUP=y # CONFIG_SCHEDSTATS is not set -# CONFIG_DEBUG_SLAB is not set +# CONFIG_TIMER_STATS is not set # CONFIG_DEBUG_RT_MUTEXES is not set # CONFIG_RT_MUTEX_TESTER is not set # CONFIG_DEBUG_SPINLOCK is not set # CONFIG_DEBUG_MUTEXES is not set -# CONFIG_DEBUG_RWSEMS is not set # CONFIG_DEBUG_SPINLOCK_SLEEP is not set # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set # CONFIG_DEBUG_KOBJECT is not set @@ -806,6 +774,7 @@ CONFIG_DEBUG_BUGVERBOSE=y CONFIG_FRAME_POINTER=y CONFIG_FORCED_INLINING=y # CONFIG_RCU_TORTURE_TEST is not set +# CONFIG_FAULT_INJECTION is not set # CONFIG_KPROBES is not set # @@ -825,10 +794,13 @@ CONFIG_FORCED_INLINING=y CONFIG_BITREVERSE=y CONFIG_CRC_CCITT=m # CONFIG_CRC16 is not set +# CONFIG_CRC_ITU_T is not set CONFIG_CRC32=y # CONFIG_LIBCRC32C is not set CONFIG_AUDIT_GENERIC=y CONFIG_ZLIB_INFLATE=y CONFIG_ZLIB_DEFLATE=y CONFIG_PLIST=y -CONFIG_IOMAP_COPY=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT=y +CONFIG_HAS_DMA=y diff --git a/arch/avr32/mach-at32ap/at32ap7000.c b/arch/avr32/mach-at32ap/at32ap7000.c index 1d2bf347a1d6..4dda42d3f6d5 100644 --- a/arch/avr32/mach-at32ap/at32ap7000.c +++ b/arch/avr32/mach-at32ap/at32ap7000.c @@ -9,6 +9,7 @@ #include <linux/fb.h> #include <linux/init.h> #include <linux/platform_device.h> +#include <linux/dma-mapping.h> #include <linux/spi/spi.h> #include <asm/io.h> @@ -45,19 +46,30 @@ .flags = IORESOURCE_IRQ, \ } +/* REVISIT these assume *every* device supports DMA, but several + * don't ... tc, smc, pio, rtc, watchdog, pwm, ps2, and more. + */ #define DEFINE_DEV(_name, _id) \ +static u64 _name##_id##_dma_mask = DMA_32BIT_MASK; \ static struct platform_device _name##_id##_device = { \ .name = #_name, \ .id = _id, \ + .dev = { \ + .dma_mask = &_name##_id##_dma_mask, \ + .coherent_dma_mask = DMA_32BIT_MASK, \ + }, \ .resource = _name##_id##_resource, \ .num_resources = ARRAY_SIZE(_name##_id##_resource), \ } #define DEFINE_DEV_DATA(_name, _id) \ +static u64 _name##_id##_dma_mask = DMA_32BIT_MASK; \ static struct platform_device _name##_id##_device = { \ .name = #_name, \ .id = _id, \ .dev = { \ + .dma_mask = &_name##_id##_dma_mask, \ .platform_data = &_name##_id##_data, \ + .coherent_dma_mask = DMA_32BIT_MASK, \ }, \ .resource = _name##_id##_resource, \ .num_resources = ARRAY_SIZE(_name##_id##_resource), \ diff --git a/arch/avr32/mm/cache.c b/arch/avr32/mm/cache.c index 8f7b1c3cd0f9..c1233c615e67 100644 --- a/arch/avr32/mm/cache.c +++ b/arch/avr32/mm/cache.c @@ -23,7 +23,6 @@ void invalidate_dcache_region(void *start, size_t size) { unsigned long v, begin, end, linesz, mask; - int flush = 0; linesz = boot_cpu_data.dcache.linesz; mask = linesz - 1; @@ -32,24 +31,21 @@ void invalidate_dcache_region(void *start, size_t size) * instead of invalidating ... never discard valid data! */ begin = (unsigned long)start; - end = begin + size - 1; + end = begin + size; if (begin & mask) { flush_dcache_line(start); begin += linesz; - flush = 1; } - if ((end & mask) != mask) { + if (end & mask) { flush_dcache_line((void *)end); - end -= linesz; - flush = 1; + end &= ~mask; } /* remaining cachelines only need invalidation */ - for (v = begin; v <= end; v += linesz) + for (v = begin; v < end; v += linesz) invalidate_dcache_line((void *)v); - if (flush) - flush_write_buffer(); + flush_write_buffer(); } void clean_dcache_region(void *start, size_t size) diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig index 8770a5d0b143..d2f6a247414d 100644 --- a/arch/i386/Kconfig +++ b/arch/i386/Kconfig @@ -541,7 +541,7 @@ config HIGHMEM4G config HIGHMEM64G bool "64GB" - depends on X86_CMPXCHG64 + depends on !M386 && !M486 help Select this if you have a 32-bit processor and more than 4 gigabytes of physical RAM. diff --git a/arch/i386/Kconfig.cpu b/arch/i386/Kconfig.cpu index d7f6fb0b30f2..5c95ceb7f122 100644 --- a/arch/i386/Kconfig.cpu +++ b/arch/i386/Kconfig.cpu @@ -299,7 +299,7 @@ config X86_POPAD_OK config X86_CMPXCHG64 bool - depends on !M386 && !M486 + depends on X86_PAE default y config X86_ALIGNMENT_16 diff --git a/arch/i386/kernel/acpi/wakeup.S b/arch/i386/kernel/acpi/wakeup.S index b781b38131c0..a2295a34b2c7 100644 --- a/arch/i386/kernel/acpi/wakeup.S +++ b/arch/i386/kernel/acpi/wakeup.S @@ -230,6 +230,7 @@ bogus_magic: # ENTRY(acpi_copy_wakeup_routine) + pushl %ebx sgdt saved_gdt sidt saved_idt sldt saved_ldt @@ -263,6 +264,7 @@ ENTRY(acpi_copy_wakeup_routine) movl %edx, video_flags - wakeup_start (%eax) movl $0x12345678, real_magic - wakeup_start (%eax) movl $0x12345678, saved_magic + popl %ebx ret save_registers: diff --git a/arch/x86_64/kernel/entry.S b/arch/x86_64/kernel/entry.S index fa984b53e7e6..a67f87bf4015 100644 --- a/arch/x86_64/kernel/entry.S +++ b/arch/x86_64/kernel/entry.S @@ -1163,3 +1163,10 @@ ENTRY(call_softirq) ret CFI_ENDPROC ENDPROC(call_softirq) + +KPROBE_ENTRY(ignore_sysret) + CFI_STARTPROC + mov $-ENOSYS,%eax + sysret + CFI_ENDPROC +ENDPROC(ignore_sysret) diff --git a/arch/x86_64/kernel/mce.c b/arch/x86_64/kernel/mce.c index a14375dd5425..aa1d15991794 100644 --- a/arch/x86_64/kernel/mce.c +++ b/arch/x86_64/kernel/mce.c @@ -497,15 +497,17 @@ static ssize_t mce_read(struct file *filp, char __user *ubuf, size_t usize, loff for (i = 0; i < next; i++) { unsigned long start = jiffies; while (!mcelog.entry[i].finished) { - if (!time_before(jiffies, start + 2)) { + if (time_after_eq(jiffies, start + 2)) { memset(mcelog.entry + i,0, sizeof(struct mce)); - continue; + goto timeout; } cpu_relax(); } smp_rmb(); err |= copy_to_user(buf, mcelog.entry + i, sizeof(struct mce)); buf += sizeof(struct mce); + timeout: + ; } memset(mcelog.entry, 0, next * sizeof(struct mce)); diff --git a/arch/x86_64/kernel/setup64.c b/arch/x86_64/kernel/setup64.c index 64379a80d763..1200aaac403e 100644 --- a/arch/x86_64/kernel/setup64.c +++ b/arch/x86_64/kernel/setup64.c @@ -150,6 +150,8 @@ void pda_init(int cpu) char boot_exception_stacks[(N_EXCEPTION_STACKS - 1) * EXCEPTION_STKSZ + DEBUG_STKSZ] __attribute__((section(".bss.page_aligned"))); +extern asmlinkage void ignore_sysret(void); + /* May not be marked __init: used by software suspend */ void syscall_init(void) { @@ -160,6 +162,7 @@ void syscall_init(void) */ wrmsrl(MSR_STAR, ((u64)__USER32_CS)<<48 | ((u64)__KERNEL_CS)<<32); wrmsrl(MSR_LSTAR, system_call); + wrmsrl(MSR_CSTAR, ignore_sysret); #ifdef CONFIG_IA32_EMULATION syscall32_cpu_init (); diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index ee5759bef945..80ffc7829916 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -332,16 +332,18 @@ static void acpi_processor_idle(void) int sleep_ticks = 0; u32 t1, t2 = 0; - pr = processors[smp_processor_id()]; - if (!pr) - return; - /* * Interrupts must be disabled during bus mastering calculations and * for C2/C3 transitions. */ local_irq_disable(); + pr = processors[smp_processor_id()]; + if (!pr) { + local_irq_enable(); + return; + } + /* * Check whether we truly need to go idle, or should * reschedule: diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 194ecfe8b360..88a6fc7fd271 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c @@ -828,6 +828,8 @@ static int acpi_thermal_trip_seq_show(struct seq_file *seq, void *offset) { struct acpi_thermal *tz = seq->private; struct acpi_device *device; + acpi_status status; + int i = 0; int j = 0; @@ -850,8 +852,10 @@ static int acpi_thermal_trip_seq_show(struct seq_file *seq, void *offset) tz->trips.passive.tc1, tz->trips.passive.tc2, tz->trips.passive.tsp); for (j = 0; j < tz->trips.passive.devices.count; j++) { - acpi_bus_get_device(tz->trips.passive.devices.handles[j], &device); - seq_printf(seq, "%4.4s ", acpi_device_bid(device)); + status = acpi_bus_get_device(tz->trips.passive.devices. + handles[j], &device); + seq_printf(seq, "%4.4s ", status ? "" : + acpi_device_bid(device)); } seq_puts(seq, "\n"); } @@ -863,8 +867,11 @@ static int acpi_thermal_trip_seq_show(struct seq_file *seq, void *offset) i, KELVIN_TO_CELSIUS(tz->trips.active[i].temperature)); for (j = 0; j < tz->trips.active[i].devices.count; j++){ - acpi_bus_get_device(tz->trips.active[i].devices.handles[j], &device); - seq_printf(seq, "%4.4s ", acpi_device_bid(device)); + status = acpi_bus_get_device(tz->trips.active[i]. + devices.handles[j], + &device); + seq_printf(seq, "%4.4s ", status ? "" : + acpi_device_bid(device)); } seq_puts(seq, "\n"); } diff --git a/drivers/acpi/utilities/utobject.c b/drivers/acpi/utilities/utobject.c index db0b9bac7945..76ee766c84f9 100644 --- a/drivers/acpi/utilities/utobject.c +++ b/drivers/acpi/utilities/utobject.c @@ -177,7 +177,7 @@ union acpi_operand_object *acpi_ut_create_package_object(u32 count) package_elements = ACPI_ALLOCATE_ZEROED((acpi_size) (count + 1) * sizeof(void *)); if (!package_elements) { - ACPI_FREE(package_desc); + acpi_ut_remove_reference(package_desc); return_PTR(NULL); } diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c index 45bf2a262a85..8c73ccb8830f 100644 --- a/drivers/char/stallion.c +++ b/drivers/char/stallion.c @@ -4753,13 +4753,14 @@ static int __init stallion_module_init(void) brdp->ioaddr2 = conf.ioaddr2; brdp->irq = conf.irq; brdp->irqtype = conf.irqtype; - if (stl_brdinit(brdp)) + stl_brds[brdp->brdnr] = brdp; + if (stl_brdinit(brdp)) { + stl_brds[brdp->brdnr] = NULL; kfree(brdp); - else { + } else { for (j = 0; j < brdp->nrports; j++) tty_register_device(stl_serial, brdp->brdnr * STL_MAXPORTS + j, NULL); - stl_brds[brdp->brdnr] = brdp; stl_nrbrds = i + 1; } } diff --git a/drivers/char/vt.c b/drivers/char/vt.c index bbd9fc412877..6650ae1c088f 100644 --- a/drivers/char/vt.c +++ b/drivers/char/vt.c @@ -1956,7 +1956,7 @@ char con_buf[CON_BUF_SIZE]; DEFINE_MUTEX(con_buf_mtx); /* is_double_width() is based on the wcwidth() implementation by - * Markus Kuhn -- 2003-05-20 (Unicode 4.0) + * Markus Kuhn -- 2007-05-26 (Unicode 5.0) * Latest version: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c */ struct interval { @@ -1988,8 +1988,8 @@ static int is_double_width(uint32_t ucs) static const struct interval double_width[] = { { 0x1100, 0x115F }, { 0x2329, 0x232A }, { 0x2E80, 0x303E }, { 0x3040, 0xA4CF }, { 0xAC00, 0xD7A3 }, { 0xF900, 0xFAFF }, - { 0xFE30, 0xFE6F }, { 0xFF00, 0xFF60 }, { 0xFFE0, 0xFFE6 }, - { 0x20000, 0x2FFFD }, { 0x30000, 0x3FFFD } + { 0xFE10, 0xFE19 }, { 0xFE30, 0xFE6F }, { 0xFF00, 0xFF60 }, + { 0xFFE0, 0xFFE6 }, { 0x20000, 0x2FFFD }, { 0x30000, 0x3FFFD } }; return bisearch(ucs, double_width, sizeof(double_width) / sizeof(*double_width) - 1); @@ -2187,9 +2187,12 @@ rescan_last_byte: continue; /* nothing to display */ } /* Glyph not found */ - if (!(vc->vc_utf && !vc->vc_disp_ctrl) && !(c & ~charmask)) { + if ((!(vc->vc_utf && !vc->vc_disp_ctrl) || c < 128) && !(c & ~charmask)) { /* In legacy mode use the glyph we get by a 1:1 mapping. - This would make absolutely no sense with Unicode in mind. */ + This would make absolutely no sense with Unicode in mind, + but do this for ASCII characters since a font may lack + Unicode mapping info and we don't want to end up with + having question marks only. */ tc = c; } else { /* Display U+FFFD. If it's not found, display an inverse question mark. */ @@ -2213,6 +2216,7 @@ rescan_last_byte: } else { vc_attr = ((vc->vc_attr) & 0x88) | (((vc->vc_attr) & 0x70) >> 4) | (((vc->vc_attr) & 0x07) << 4); } + FLUSH } while (1) { @@ -2246,6 +2250,10 @@ rescan_last_byte: if (tc < 0) tc = ' '; } + if (inverse) { + FLUSH + } + if (rescan) { rescan = 0; inverse = 0; diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c index 0328382df8fa..6d54c8caed79 100644 --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c @@ -185,6 +185,7 @@ static int __devinit coretemp_probe(struct platform_device *pdev) /* check for microcode update */ rdmsr_on_cpu(data->id, MSR_IA32_UCODE_REV, &eax, &edx); if (edx < 0x39) { + err = -ENODEV; dev_err(&pdev->dev, "Errata AE18 not fixed, update BIOS or " "microcode of the CPU!\n"); diff --git a/drivers/macintosh/Kconfig b/drivers/macintosh/Kconfig index 0852d330c265..dbe96268866e 100644 --- a/drivers/macintosh/Kconfig +++ b/drivers/macintosh/Kconfig @@ -2,7 +2,7 @@ menuconfig MACINTOSH_DRIVERS bool "Macintosh device drivers" depends on PPC || MAC || X86 - default y if MAC + default y if (PPC_PMAC || MAC) if MACINTOSH_DRIVERS diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c index b0b4458ae90b..8135e4c3bf47 100644 --- a/drivers/mfd/sm501.c +++ b/drivers/mfd/sm501.c @@ -41,6 +41,9 @@ struct sm501_devdata { struct resource *regs_claim; struct sm501_platdata *platdata; + unsigned int in_suspend; + unsigned long pm_misc; + int unit_power[20]; unsigned int pdev_id; unsigned int irq; @@ -169,10 +172,41 @@ x "M %ld.%ld (%ld), MX1 %ld.%ld (%ld)\n", fmt_freq(decode_div(pll2, pm1, 8, 1<<12, 15, misc_div)), fmt_freq(decode_div(pll2, pm1, 0, 1<<4, 15, misc_div))); } -#else -static void sm501_dump_clk(struct sm501_devdata *sm) + +static void sm501_dump_regs(struct sm501_devdata *sm) { + void __iomem *regs = sm->regs; + + dev_info(sm->dev, "System Control %08x\n", + readl(regs + SM501_SYSTEM_CONTROL)); + dev_info(sm->dev, "Misc Control %08x\n", + readl(regs + SM501_MISC_CONTROL)); + dev_info(sm->dev, "GPIO Control Low %08x\n", + readl(regs + SM501_GPIO31_0_CONTROL)); + dev_info(sm->dev, "GPIO Control Hi %08x\n", + readl(regs + SM501_GPIO63_32_CONTROL)); + dev_info(sm->dev, "DRAM Control %08x\n", + readl(regs + SM501_DRAM_CONTROL)); + dev_info(sm->dev, "Arbitration Ctrl %08x\n", + readl(regs + SM501_ARBTRTN_CONTROL)); + dev_info(sm->dev, "Misc Timing %08x\n", + readl(regs + SM501_MISC_TIMING)); } + +static void sm501_dump_gate(struct sm501_devdata *sm) +{ + dev_info(sm->dev, "CurrentGate %08x\n", + readl(sm->regs + SM501_CURRENT_GATE)); + dev_info(sm->dev, "CurrentClock %08x\n", + readl(sm->regs + SM501_CURRENT_CLOCK)); + dev_info(sm->dev, "PowerModeControl %08x\n", + readl(sm->regs + SM501_POWER_MODE_CONTROL)); +} + +#else +static inline void sm501_dump_gate(struct sm501_devdata *sm) { } +static inline void sm501_dump_regs(struct sm501_devdata *sm) { } +static inline void sm501_dump_clk(struct sm501_devdata *sm) { } #endif /* sm501_sync_regs @@ -185,9 +219,21 @@ static void sm501_sync_regs(struct sm501_devdata *sm) readl(sm->regs); } +static inline void sm501_mdelay(struct sm501_devdata *sm, unsigned int delay) +{ + /* during suspend/resume, we are currently not allowed to sleep, + * so change to using mdelay() instead of msleep() if we + * are in one of these paths */ + + if (sm->in_suspend) + mdelay(delay); + else + msleep(delay); +} + /* sm501_misc_control * - * alters the misceleneous control parameters + * alters the miscellaneous control parameters */ int sm501_misc_control(struct device *dev, @@ -368,7 +414,7 @@ int sm501_unit_power(struct device *dev, unsigned int unit, unsigned int to) dev_dbg(sm->dev, "gate %08lx, clock %08lx, mode %08lx\n", gate, clock, mode); - msleep(16); + sm501_mdelay(sm, 16); already: mutex_unlock(&sm->clock_lock); @@ -538,7 +584,7 @@ unsigned long sm501_set_clock(struct device *dev, dev_info(sm->dev, "gate %08lx, clock %08lx, mode %08lx\n", gate, clock, mode); - msleep(16); + sm501_mdelay(sm, 16); mutex_unlock(&sm->clock_lock); sm501_dump_clk(sm); @@ -767,6 +813,9 @@ static DEVICE_ATTR(dbg_regs, 0666, sm501_dbg_regs, NULL); /* sm501_init_reg * * Helper function for the init code to setup a register + * + * clear the bits which are set in r->mask, and then set + * the bits set in r->set. */ static inline void sm501_init_reg(struct sm501_devdata *sm, @@ -776,8 +825,8 @@ static inline void sm501_init_reg(struct sm501_devdata *sm, unsigned long tmp; tmp = readl(sm->regs + reg); - tmp |= r->set; tmp &= ~r->mask; + tmp |= r->set; writel(tmp, sm->regs + reg); } @@ -797,15 +846,33 @@ static void sm501_init_regs(struct sm501_devdata *sm, sm501_init_reg(sm, SM501_GPIO31_0_CONTROL, &init->gpio_low); sm501_init_reg(sm, SM501_GPIO63_32_CONTROL, &init->gpio_high); + if (init->m1xclk) { + dev_info(sm->dev, "setting M1XCLK to %ld\n", init->m1xclk); + sm501_set_clock(sm->dev, SM501_CLOCK_M1XCLK, init->m1xclk); + } + if (init->mclk) { dev_info(sm->dev, "setting MCLK to %ld\n", init->mclk); sm501_set_clock(sm->dev, SM501_CLOCK_MCLK, init->mclk); } - if (init->m1xclk) { - dev_info(sm->dev, "setting M1XCLK to %ld\n", init->m1xclk); - sm501_set_clock(sm->dev, SM501_CLOCK_M1XCLK, init->m1xclk); - } +} + +/* Check the PLL sources for the M1CLK and M1XCLK + * + * If the M1CLK and M1XCLKs are not sourced from the same PLL, then + * there is a risk (see errata AB-5) that the SM501 will cease proper + * function. If this happens, then it is likely the SM501 will + * hang the system. +*/ + +static int sm501_check_clocks(struct sm501_devdata *sm) +{ + unsigned long pwrmode = readl(sm->regs + SM501_CURRENT_CLOCK); + unsigned long msrc = (pwrmode & SM501_POWERMODE_M_SRC); + unsigned long m1src = (pwrmode & SM501_POWERMODE_M1_SRC); + + return ((msrc == 0 && m1src != 0) || (msrc != 0 && m1src == 0)); } static unsigned int sm501_mem_local[] = { @@ -826,6 +893,7 @@ static int sm501_init_dev(struct sm501_devdata *sm) { resource_size_t mem_avail; unsigned long dramctrl; + unsigned long devid; int ret; mutex_init(&sm->clock_lock); @@ -833,17 +901,20 @@ static int sm501_init_dev(struct sm501_devdata *sm) INIT_LIST_HEAD(&sm->devices); - dramctrl = readl(sm->regs + SM501_DRAM_CONTROL); + devid = readl(sm->regs + SM501_DEVICEID); + + if ((devid & SM501_DEVICEID_IDMASK) != SM501_DEVICEID_SM501) { + dev_err(sm->dev, "incorrect device id %08lx\n", devid); + return -EINVAL; + } + dramctrl = readl(sm->regs + SM501_DRAM_CONTROL); mem_avail = sm501_mem_local[(dramctrl >> 13) & 0x7]; - dev_info(sm->dev, "SM501 At %p: Version %08x, %ld Mb, IRQ %d\n", - sm->regs, readl(sm->regs + SM501_DEVICEID), - (unsigned long)mem_avail >> 20, sm->irq); + dev_info(sm->dev, "SM501 At %p: Version %08lx, %ld Mb, IRQ %d\n", + sm->regs, devid, (unsigned long)mem_avail >> 20, sm->irq); - dev_info(sm->dev, "CurrentGate %08x\n", readl(sm->regs+0x38)); - dev_info(sm->dev, "CurrentClock %08x\n", readl(sm->regs+0x3c)); - dev_info(sm->dev, "PowerModeControl %08x\n", readl(sm->regs+0x54)); + sm501_dump_gate(sm); ret = device_create_file(sm->dev, &dev_attr_dbg_regs); if (ret) @@ -864,6 +935,13 @@ static int sm501_init_dev(struct sm501_devdata *sm) } } + ret = sm501_check_clocks(sm); + if (ret) { + dev_err(sm->dev, "M1X and M clocks sourced from different " + "PLLs\n"); + return -EINVAL; + } + /* always create a framebuffer */ sm501_register_display(sm, &mem_avail); @@ -933,6 +1011,57 @@ static int sm501_plat_probe(struct platform_device *dev) } +#ifdef CONFIG_PM +/* power management support */ + +static int sm501_plat_suspend(struct platform_device *pdev, pm_message_t state) +{ + struct sm501_devdata *sm = platform_get_drvdata(pdev); + + sm->in_suspend = 1; + sm->pm_misc = readl(sm->regs + SM501_MISC_CONTROL); + + sm501_dump_regs(sm); + return 0; +} + +static int sm501_plat_resume(struct platform_device *pdev) +{ + struct sm501_devdata *sm = platform_get_drvdata(pdev); + + sm501_dump_regs(sm); + sm501_dump_gate(sm); + sm501_dump_clk(sm); + + /* check to see if we are in the same state as when suspended */ + + if (readl(sm->regs + SM501_MISC_CONTROL) != sm->pm_misc) { + dev_info(sm->dev, "SM501_MISC_CONTROL changed over sleep\n"); + writel(sm->pm_misc, sm->regs + SM501_MISC_CONTROL); + + /* our suspend causes the controller state to change, + * either by something attempting setup, power loss, + * or an external reset event on power change */ + + if (sm->platdata && sm->platdata->init) { + sm501_init_regs(sm, sm->platdata->init); + } + } + + /* dump our state from resume */ + + sm501_dump_regs(sm); + sm501_dump_clk(sm); + + sm->in_suspend = 0; + + return 0; +} +#else +#define sm501_plat_suspend NULL +#define sm501_plat_resume NULL +#endif + /* Initialisation data for PCI devices */ static struct sm501_initdata sm501_pci_initdata = { @@ -950,8 +1079,12 @@ static struct sm501_initdata sm501_pci_initdata = { }, .devices = SM501_USE_ALL, - .mclk = 100 * MHZ, - .m1xclk = 160 * MHZ, + + /* Errata AB-3 says that 72MHz is the fastest available + * for 33MHZ PCI with proper bus-mastering operation */ + + .mclk = 72 * MHZ, + .m1xclk = 144 * MHZ, }; static struct sm501_platdata_fbsub sm501_pdata_fbsub = { @@ -1126,6 +1259,8 @@ static struct platform_driver sm501_plat_drv = { }, .probe = sm501_plat_probe, .remove = sm501_plat_remove, + .suspend = sm501_plat_suspend, + .resume = sm501_plat_resume, }; static int __init sm501_base_init(void) diff --git a/fs/ext2/super.c b/fs/ext2/super.c index 16337bff0272..c9fd8cf6eaa9 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c @@ -1038,6 +1038,14 @@ static int ext2_remount (struct super_block * sb, int * flags, char * data) sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | ((sbi->s_mount_opt & EXT2_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0); + ext2_xip_verify_sb(sb); /* see if bdev supports xip, unset + EXT2_MOUNT_XIP if not */ + + if ((ext2_use_xip(sb)) && (sb->s_blocksize != PAGE_SIZE)) { + printk("XIP: Unsupported blocksize\n"); + goto restore_opts; + } + es = sbi->s_es; if (((sbi->s_mount_opt & EXT2_MOUNT_XIP) != (old_mount_opt & EXT2_MOUNT_XIP)) && diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c index a6cb6171c3af..2a85ddee4740 100644 --- a/fs/ext3/inode.c +++ b/fs/ext3/inode.c @@ -2677,8 +2677,10 @@ void ext3_read_inode(struct inode * inode) */ ei->i_extra_isize = le16_to_cpu(raw_inode->i_extra_isize); if (EXT3_GOOD_OLD_INODE_SIZE + ei->i_extra_isize > - EXT3_INODE_SIZE(inode->i_sb)) + EXT3_INODE_SIZE(inode->i_sb)) { + brelse (bh); goto bad_inode; + } if (ei->i_extra_isize == 0) { /* The extra space is currently unused. Use it. */ ei->i_extra_isize = sizeof(struct ext3_inode) - diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 0bcf62a750ff..8416fa28c422 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -2673,8 +2673,10 @@ void ext4_read_inode(struct inode * inode) */ ei->i_extra_isize = le16_to_cpu(raw_inode->i_extra_isize); if (EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize > - EXT4_INODE_SIZE(inode->i_sb)) + EXT4_INODE_SIZE(inode->i_sb)) { + brelse (bh); goto bad_inode; + } if (ei->i_extra_isize == 0) { /* The extra space is currently unused. Use it. */ ei->i_extra_isize = sizeof(struct ext4_inode) - diff --git a/include/asm-um/bug.h b/include/asm-um/bug.h index 3357c5e2468e..9e33b864c359 100644 --- a/include/asm-um/bug.h +++ b/include/asm-um/bug.h @@ -1,6 +1,6 @@ #ifndef __UM_BUG_H #define __UM_BUG_H -#include <asm/arch/bug.h> +#include <asm-generic/bug.h> #endif diff --git a/include/asm-um/common.lds.S b/include/asm-um/common.lds.S index f5de80c31e88..e3f010bd12b3 100644 --- a/include/asm-um/common.lds.S +++ b/include/asm-um/common.lds.S @@ -20,6 +20,8 @@ __ex_table : { *(__ex_table) } __stop___ex_table = .; + BUG_TABLE + __uml_setup_start = .; .uml.setup.init : { *(.uml.setup.init) } __uml_setup_end = .; diff --git a/include/asm-um/paravirt.h b/include/asm-um/paravirt.h new file mode 100644 index 000000000000..9d6aaad80b5f --- /dev/null +++ b/include/asm-um/paravirt.h @@ -0,0 +1,6 @@ +#ifndef __UM_PARAVIRT_H +#define __UM_PARAVIRT_H + +#include "asm/arch/paravirt.h" + +#endif diff --git a/include/linux/fs.h b/include/linux/fs.h index b3ae77cccbb6..6a41f4cab14c 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1211,6 +1211,14 @@ static inline void mark_inode_dirty_sync(struct inode *inode) __mark_inode_dirty(inode, I_DIRTY_SYNC); } +/** + * inc_nlink - directly increment an inode's link count + * @inode: inode + * + * This is a low-level filesystem helper to replace any + * direct filesystem manipulation of i_nlink. Currently, + * it is only here for parity with dec_nlink(). + */ static inline void inc_nlink(struct inode *inode) { inode->i_nlink++; @@ -1222,11 +1230,30 @@ static inline void inode_inc_link_count(struct inode *inode) mark_inode_dirty(inode); } +/** + * drop_nlink - directly drop an inode's link count + * @inode: inode + * + * This is a low-level filesystem helper to replace any + * direct filesystem manipulation of i_nlink. In cases + * where we are attempting to track writes to the + * filesystem, a decrement to zero means an imminent + * write when the file is truncated and actually unlinked + * on the filesystem. + */ static inline void drop_nlink(struct inode *inode) { inode->i_nlink--; } +/** + * clear_nlink - directly zero an inode's link count + * @inode: inode + * + * This is a low-level filesystem helper to replace any + * direct filesystem manipulation of i_nlink. See + * drop_nlink() for why we care about i_nlink hitting zero. + */ static inline void clear_nlink(struct inode *inode) { inode->i_nlink = 0; diff --git a/include/linux/slab.h b/include/linux/slab.h index a015236cc572..cebcd3833c76 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -82,8 +82,8 @@ static inline void *kmem_cache_alloc_node(struct kmem_cache *cachep, * to do various tricks to work around compiler limitations in order to * ensure proper constant folding. */ -#define KMALLOC_SHIFT_HIGH ((MAX_ORDER + PAGE_SHIFT) <= 25 ? \ - (MAX_ORDER + PAGE_SHIFT) : 25) +#define KMALLOC_SHIFT_HIGH ((MAX_ORDER + PAGE_SHIFT - 1) <= 25 ? \ + (MAX_ORDER + PAGE_SHIFT - 1) : 25) #define KMALLOC_MAX_SIZE (1UL << KMALLOC_SHIFT_HIGH) #define KMALLOC_MAX_ORDER (KMALLOC_SHIFT_HIGH - PAGE_SHIFT) diff --git a/include/linux/sm501-regs.h b/include/linux/sm501-regs.h index cc9be4a11861..014e73b31fc0 100644 --- a/include/linux/sm501-regs.h +++ b/include/linux/sm501-regs.h @@ -64,6 +64,11 @@ #define SM501_DEBUG_CONTROL (0x000034) /* power management */ +#define SM501_POWERMODE_P2X_SRC (1<<29) +#define SM501_POWERMODE_V2X_SRC (1<<20) +#define SM501_POWERMODE_M_SRC (1<<12) +#define SM501_POWERMODE_M1_SRC (1<<4) + #define SM501_CURRENT_GATE (0x000038) #define SM501_CURRENT_CLOCK (0x00003C) #define SM501_POWER_MODE_0_GATE (0x000040) @@ -104,6 +109,9 @@ #define SM501_DEVICEID (0x000060) /* 0x050100A0 */ +#define SM501_DEVICEID_SM501 (0x05010000) +#define SM501_DEVICEID_IDMASK (0xffff0000) + #define SM501_PLLCLOCK_COUNT (0x000064) #define SM501_MISC_TIMING (0x000068) #define SM501_CURRENT_SDRAM_CLOCK (0x00006C) diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c index 74cc0fc6bb81..ce61f423542c 100644 --- a/kernel/auditfilter.c +++ b/kernel/auditfilter.c @@ -947,7 +947,7 @@ static void audit_update_watch(struct audit_parent *parent, /* If the update involves invalidating rules, do the inode-based * filtering now, so we don't omit records. */ - if (invalidating && + if (invalidating && current->audit_context && audit_filter_inodes(current, current->audit_context) == AUDIT_RECORD_CONTEXT) audit_set_auditable(current->audit_context); diff --git a/kernel/nsproxy.c b/kernel/nsproxy.c index 1bc4b55241a8..9e83b589f754 100644 --- a/kernel/nsproxy.c +++ b/kernel/nsproxy.c @@ -145,13 +145,11 @@ void free_nsproxy(struct nsproxy *ns) /* * Called from unshare. Unshare all the namespaces part of nsproxy. - * On sucess, returns the new nsproxy and a reference to old nsproxy - * to make sure it stays around. + * On success, returns the new nsproxy. */ int unshare_nsproxy_namespaces(unsigned long unshare_flags, struct nsproxy **new_nsp, struct fs_struct *new_fs) { - struct nsproxy *old_ns = current->nsproxy; int err = 0; if (!(unshare_flags & (CLONE_NEWNS | CLONE_NEWUTS | CLONE_NEWIPC))) @@ -170,13 +168,9 @@ int unshare_nsproxy_namespaces(unsigned long unshare_flags, if (!capable(CAP_SYS_ADMIN)) return -EPERM; - get_nsproxy(old_ns); - *new_nsp = create_new_namespaces(unshare_flags, current, new_fs ? new_fs : current->fs); - if (IS_ERR(*new_nsp)) { + if (IS_ERR(*new_nsp)) err = PTR_ERR(*new_nsp); - put_nsproxy(old_ns); - } return err; } diff --git a/kernel/sched.c b/kernel/sched.c index a7475913b009..50e1a3122699 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -2938,17 +2938,21 @@ static void idle_balance(int this_cpu, struct rq *this_rq) unsigned long next_balance = jiffies + 60 * HZ; for_each_domain(this_cpu, sd) { - if (sd->flags & SD_BALANCE_NEWIDLE) { + unsigned long interval; + + if (!(sd->flags & SD_LOAD_BALANCE)) + continue; + + if (sd->flags & SD_BALANCE_NEWIDLE) /* If we've pulled tasks over stop searching: */ pulled_task = load_balance_newidle(this_cpu, - this_rq, sd); - if (time_after(next_balance, - sd->last_balance + sd->balance_interval)) - next_balance = sd->last_balance - + sd->balance_interval; - if (pulled_task) - break; - } + this_rq, sd); + + interval = msecs_to_jiffies(sd->balance_interval); + if (time_after(next_balance, sd->last_balance + interval)) + next_balance = sd->last_balance + interval; + if (pulled_task) + break; } if (!pulled_task) /* diff --git a/mm/slub.c b/mm/slub.c index fa28b1623644..202049a45764 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -3042,13 +3042,15 @@ static int list_locations(struct kmem_cache *s, char *buf, n += sprintf(buf + n, " pid=%ld", l->min_pid); - if (num_online_cpus() > 1 && !cpus_empty(l->cpus)) { + if (num_online_cpus() > 1 && !cpus_empty(l->cpus) && + n < PAGE_SIZE - 60) { n += sprintf(buf + n, " cpus="); n += cpulist_scnprintf(buf + n, PAGE_SIZE - n - 50, l->cpus); } - if (num_online_nodes() > 1 && !nodes_empty(l->nodes)) { + if (num_online_nodes() > 1 && !nodes_empty(l->nodes) && + n < PAGE_SIZE - 60) { n += sprintf(buf + n, " nodes="); n += nodelist_scnprintf(buf + n, PAGE_SIZE - n - 50, l->nodes); diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index aea90d30d229..277c32647f36 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -9,7 +9,7 @@ use strict; my $P = $0; $P =~ s@.*/@@g; -my $V = '0.04'; +my $V = '0.06'; use Getopt::Long qw(:config no_auto_abbrev); @@ -17,11 +17,13 @@ my $quiet = 0; my $tree = 1; my $chk_signoff = 1; my $chk_patch = 1; +my $tst_type = 0; GetOptions( 'q|quiet' => \$quiet, 'tree!' => \$tree, 'signoff!' => \$chk_signoff, 'patch!' => \$chk_patch, + 'test-type!' => \$tst_type, ) or exit; my $exit = 0; @@ -151,7 +153,7 @@ sub sanitise_line { } sub ctx_block_get { - my ($linenr, $remain, $outer) = @_; + my ($linenr, $remain, $outer, $open, $close) = @_; my $line; my $start = $linenr - 1; my $blk = ''; @@ -165,8 +167,8 @@ sub ctx_block_get { $blk .= $rawlines[$line]; - @o = ($blk =~ /\{/g); - @c = ($blk =~ /\}/g); + @o = ($blk =~ /$open/g); + @c = ($blk =~ /$close/g); if (!$outer || (scalar(@o) - scalar(@c)) == 1) { push(@res, $rawlines[$line]); @@ -180,12 +182,17 @@ sub ctx_block_get { sub ctx_block_outer { my ($linenr, $remain) = @_; - return ctx_block_get($linenr, $remain, 1); + return ctx_block_get($linenr, $remain, 1, '\{', '\}'); } sub ctx_block { my ($linenr, $remain) = @_; - return ctx_block_get($linenr, $remain, 0); + return ctx_block_get($linenr, $remain, 0, '\{', '\}'); +} +sub ctx_statement { + my ($linenr, $remain) = @_; + + return ctx_block_get($linenr, $remain, 0, '\(', '\)'); } sub ctx_locate_comment { @@ -264,9 +271,44 @@ sub process { my $in_comment = 0; my $first_line = 0; + my $Ident = qr{[A-Za-z\d_]+}; + my $Storage = qr{extern|static}; + my $Sparse = qr{__user|__kernel|__force|__iomem}; + my $NonptrType = qr{ + \b + (?:const\s+)? + (?:unsigned\s+)? + (?: + void| + char| + short| + int| + long| + unsigned| + float| + double| + long\s+int| + long\s+long| + long\s+long\s+int| + struct\s+$Ident| + union\s+$Ident| + ${Ident}_t + ) + (?:\s+$Sparse)* + \b + }x; + my $Type = qr{ + \b$NonptrType\b + (?:\s*\*+\s*const|\s*\*+)? + }x; + my $Declare = qr{(?:$Storage\s+)?$Type}; + my $Attribute = qr{__read_mostly|__init|__initdata}; + foreach my $line (@lines) { $linenr++; + my $rawline = $line; + #extract the filename as it passes if ($line=~/^\+\+\+\s+(\S+)/) { $realfile=$1; @@ -293,6 +335,7 @@ sub process { # blank context lines so we need to count that too. if ($line =~ /^( |\+|$)/) { $realline++; + $realcnt-- if ($realcnt != 0); # track any sort of multi-line comment. Obviously if # the added text or context do not include the whole @@ -317,8 +360,9 @@ sub process { # Track the previous line. ($prevline, $stashline) = ($stashline, $line); ($previndent, $stashindent) = ($stashindent, $indent); + } elsif ($realcnt == 1) { + $realcnt--; } - $realcnt-- if ($realcnt != 0); #make up the handle for any error we report on this line $here = "#$linenr: "; @@ -329,14 +373,11 @@ sub process { my $hereprev = "$here\n$prevline\n$line\n\n"; #check the patch for a signoff: - if ($line =~ /^\s*Signed-off-by:\s/) { - $signoff++; - - } elsif ($line =~ /^\s*signed-off-by:/i) { + if ($line =~ /^\s*signed-off-by:/i) { # This is a signoff, if ugly, so do not double report. $signoff++; if (!($line =~ /^\s*Signed-off-by:/)) { - print "use Signed-off-by:\n"; + print "Signed-off-by: is the preferred form\n"; print "$herecurr"; $clean = 0; } @@ -361,7 +402,7 @@ sub process { next if ($realfile !~ /\.(h|c|s|S|pl|sh)$/); #trailing whitespace - if ($line=~/\+.*\S\s+$/) { + if ($line =~ /^\+.*\S\s+$/ || $line =~ /^\+\s+$/) { my $herevet = "$here\n" . cat_vet($line) . "\n\n"; print "trailing whitespace\n"; print "$herevet"; @@ -392,17 +433,20 @@ sub process { # next if ($in_comment); - # Remove comments from the line before processing. +# Remove comments from the line before processing. $line =~ s@/\*.*\*/@@g; $line =~ s@/\*.*@@; $line =~ s@.*\*/@@; - # - # Checks which may be anchored in the context. - # +# Standardise the strings and chars within the input to simplify matching. + $line = sanitise_line($line); - # Check for switch () and associated case and default - # statements should be at the same indent. +# +# Checks which may be anchored in the context. +# + +# Check for switch () and associated case and default +# statements should be at the same indent. if ($line=~/\bswitch\s*\(.*\)/) { my $err = ''; my $sep = ''; @@ -428,9 +472,30 @@ sub process { #ignore lines not being added if ($line=~/^[^\+]/) {next;} - # - # Checks which are anchored on the added line. - # +# TEST: allow direct testing of the type matcher. + if ($tst_type && $line =~ /^.$Declare$/) { + print "TEST: is type $Declare\n"; + print "$herecurr"; + $clean = 0; + next; + } + +# +# Checks which are anchored on the added line. +# + +# check for malformed paths in #include statements (uses RAW line) + if ($rawline =~ m{^.#\s*include\s+[<"](.*)[">]}) { + my $path = $1; + if ($path =~ m{//}) { + print "malformed #include filename\n"; + print "$herecurr"; + $clean = 0; + } + # Sanitise this special form of string. + $path = 'X' x length($path); + $line =~ s{\<.*\>}{<$path>}; + } # no C99 // comments if ($line =~ m{//}) { @@ -441,59 +506,55 @@ sub process { # Remove C99 comments. $line =~ s@//.*@@; - # Standardise the strings and chars within the input - # to simplify matching. - $line = sanitise_line($line); - #EXPORT_SYMBOL should immediately follow its function closing }. - if (($line =~ /EXPORT_SYMBOL.*\(.*\)/) || - ($line =~ /EXPORT_UNUSED_SYMBOL.*\(.*\)/)) { + if (($line =~ /EXPORT_SYMBOL.*\((.*)\)/) || + ($line =~ /EXPORT_UNUSED_SYMBOL.*\((.*)\)/)) { + my $name = $1; if (($prevline !~ /^}/) && ($prevline !~ /^\+}/) && - ($prevline !~ /^ }/)) { - print "EXPORT_SYMBOL(func); should immediately follow its function\n"; + ($prevline !~ /^ }/) && + ($prevline !~ /\s$name(?:\s+$Attribute)?\s*(?:;|=)/)) { + print "EXPORT_SYMBOL(foo); should immediately follow its function/variable\n"; print "$herecurr"; $clean = 0; } } - # check for static initialisers. +# check for static initialisers. if ($line=~/\s*static\s.*=\s+(0|NULL);/) { print "do not initialise statics to 0 or NULL\n"; print "$herecurr"; $clean = 0; } - # check for new typedefs. - if ($line=~/\s*typedef\s/) { +# check for new typedefs, only function parameters and sparse annotations +# make sense. + if ($line =~ /\btypedef\s/ && + $line !~ /\btypedef\s+$Type\s+\(\s*$Ident\s*\)\s*\(/ && + $line !~ /\b__bitwise(?:__|)\b/) { print "do not add new typedefs\n"; print "$herecurr"; $clean = 0; } # * goes on variable not on type - my $type = '(?:char|short|int|long|unsigned|float|double|' . - 'struct\s+[A-Za-z\d_]+|' . - 'union\s+[A-Za-z\d_]+)'; - - if ($line =~ m{[A-Za-z\d_]+(\*+) [A-Za-z\d_]+}) { - print "\"foo$1 bar\" should be \"foo $1bar\"\n"; + if ($line =~ m{\($NonptrType(\*+)(?:\s+const)?\)}) { + print "\"(foo$1)\" should be \"(foo $1)\"\n"; print "$herecurr"; $clean = 0; - } - if ($line =~ m{$type (\*) [A-Za-z\d_]+} || - $line =~ m{[A-Za-z\d_]+ (\*\*+) [A-Za-z\d_]+}) { - print "\"foo $1 bar\" should be \"foo $1bar\"\n"; + + } elsif ($line =~ m{\($NonptrType\s+(\*+)(?!\s+const)\s+\)}) { + print "\"(foo $1 )\" should be \"(foo $1)\"\n"; print "$herecurr"; $clean = 0; - } - if ($line =~ m{\([A-Za-z\d_\s]+[A-Za-z\d_](\*+)\)}) { - print "\"(foo$1)\" should be \"(foo $1)\"\n"; + + } elsif ($line =~ m{$NonptrType(\*+)(?:\s+const)?\s+[A-Za-z\d_]+}) { + print "\"foo$1 bar\" should be \"foo $1bar\"\n"; print "$herecurr"; $clean = 0; - } - if ($line =~ m{\([A-Za-z\d_\s]+[A-Za-z\d_]\s+(\*+)\s+\)}) { - print "\"(foo $1 )\" should be \"(foo $1)\"\n"; + + } elsif ($line =~ m{$NonptrType\s+(\*+)(?!\s+const)\s+[A-Za-z\d_]+}) { + print "\"foo $1 bar\" should be \"foo $1bar\"\n"; print "$herecurr"; $clean = 0; } @@ -530,13 +591,16 @@ sub process { } } -#function brace can't be on same line, except for #defines of do while, or if closed on same line - if (($line=~/[A-Za-z\d_]+\**\s+\**[A-Za-z\d_]+\(.*\).* {/) and +# function brace can't be on same line, except for #defines of do while, +# or if closed on same line + if (($line=~/$Type\s*[A-Za-z\d_]+\(.*\).* {/) and !($line=~/\#define.*do\s{/) and !($line=~/}/)) { print "braces following function declarations go on the next line\n"; print "$herecurr"; $clean = 0; } + +# Check operator spacing. # Note we expand the line with the leading + as the real # line will be displayed with the leading + and the tabs # will therefore also expand that way. @@ -544,7 +608,6 @@ sub process { $opline = expand_tabs($opline); $opline =~ s/^./ /; if (!($line=~/\#\s*include/)) { - # Check operator spacing. my @elements = split(/(<<=|>>=|<=|>=|==|!=|\+=|-=|\*=|\/=|%=|\^=|\|=|&=|->|<<|>>|<|>|=|!|~|&&|\|\||,|\^|\+\+|--|;|&|\||\+|-|\*|\/\/|\/)/, $opline); my $off = 0; for (my $n = 0; $n < $#elements; $n += 2) { @@ -572,8 +635,8 @@ sub process { # Pick up the preceeding and succeeding characters. my $ca = substr($opline, $off - 1, 1); my $cc = ''; - if (length($opline) > ($off + length($elements[$n]))) { - $cc = substr($opline, $off + 1 + length($elements[$n]), 1); + if (length($opline) >= ($off + length($elements[$n + 1]))) { + $cc = substr($opline, $off + length($elements[$n + 1])); } my $ctx = "${a}x${c}"; @@ -585,8 +648,16 @@ sub process { ##print "<$s1:$op:$s2> <$elements[$n]:$elements[$n + 1]:$elements[$n + 2]>\n"; - # We need ; as an operator. // is a comment. - if ($op eq ';' or $op eq '//') { + # ; should have either the end of line or a space or \ after it + if ($op eq ';') { + if ($ctx !~ /.x[WE]/ && $cc !~ /^\\/) { + print "need space after that '$op' $at\n"; + print "$hereptr"; + $clean = 0; + } + + # // is a comment + } elsif ($op eq '//') { # -> should have no spaces } elsif ($op eq '->') { @@ -598,7 +669,7 @@ sub process { # , must have a space on the right. } elsif ($op eq ',') { - if ($ctx !~ /.xW|.xE/) { + if ($ctx !~ /.xW|.xE/ && $cc !~ /^}/) { print "need space after that '$op' $at\n"; print "$hereptr"; $clean = 0; @@ -619,11 +690,16 @@ sub process { # unary ++ and unary -- are allowed no space on one side. } elsif ($op eq '++' or $op eq '--') { - if ($ctx !~ /[WOB]x[^W]|[^W]x[WOB]/) { + if ($ctx !~ /[WOB]x[^W]/ && $ctx !~ /[^W]x[WOBE]/) { print "need space one side of that '$op' $at\n"; print "$hereptr"; $clean = 0; } + if ($ctx =~ /Wx./ && $cc =~ /^;/) { + print "no space before that '$op' $at\n"; + print "$hereptr"; + $clean = 0; + } # & is both unary and binary # unary: @@ -651,12 +727,12 @@ sub process { # } elsif ($op eq '*') { if ($ca eq '*') { - if ($cc =~ /\s/) { + if ($cc =~ /^\s(?!\s*const)/) { print "no space after that '$op' $at\n"; print "$hereptr"; $clean = 0; } - } elsif ($ctx !~ /VxV|[EW]x[WE]|[EWB]x[VO]|OxV|WxB/) { + } elsif ($ctx !~ /VxV|[EW]x[WE]|[EWB]x[VO]|OxV|WxB|BxB/) { print "need space before that '$op' $at\n"; print "$hereptr"; $clean = 0; @@ -705,9 +781,9 @@ sub process { } # Check for illegal assignment in if conditional. - if ($line=~/\b(if|while)\s*\(.*[^<>!=]=[^=].*\)/) { + if ($line=~/\bif\s*\(.*[^<>!=]=[^=].*\)/) { #next if ($line=~/\".*\Q$op\E.*\"/ or $line=~/\'\Q$op\E\'/); - print "do not use assignment in condition\n"; + print "do not use assignment in if condition\n"; print "$herecurr"; $clean = 0; } @@ -735,8 +811,8 @@ sub process { $clean = 0; } -#warn if <asm/foo.h> is #included and <linux/foo.h> is available. - if ($tree && $line =~ qr|\s*\#\s*include\s*\<asm\/(.*)\.h\>|) { +#warn if <asm/foo.h> is #included and <linux/foo.h> is available (uses RAW line) + if ($tree && $rawline =~ m{^.\#\s*include\s*\<asm\/(.*)\.h\>}) { my $checkfile = "include/linux/$1.h"; if (-f $checkfile) { print "Use #include <linux/$1.h> instead of <asm/$1.h>\n"; @@ -745,8 +821,9 @@ sub process { } } -#if/while/etc brace do not go on next line, unless #defining a do while loop, or if that brace on the next line is for something else - if ($prevline=~/\b(if|while|for|switch)\s*\(/) { +# if/while/etc brace do not go on next line, unless defining a do while loop, +# or if that brace on the next line is for something else + if ($prevline=~/\b(?:(if|while|for|switch)\s*\(|do\b|else\b)/) { my @opened = $prevline=~/\(/g; my @closed = $prevline=~/\)/g; my $nr_line = $linenr; @@ -766,26 +843,56 @@ sub process { @closed = $prevline=~/\)/g; } - if (($prevline=~/\b(if|while|for|switch)\s*\(.*\)\s*$/) and ($next_line=~/{/) and - !($next_line=~/\b(if|while|for)/) and !($next_line=~/\#define.*do.*while/)) { + if (($prevline=~/\b(?:(if|while|for|switch)\s*\(.*\)|do|else)\s*$/) and ($next_line=~/{/) and + !($next_line=~/\b(?:if|while|for|switch|do|else)\b/) and !($next_line=~/\#define.*do.*while/)) { print "That { should be on the previous line\n"; print "$here\n$display_segment\n$next_line\n\n"; $clean = 0; } } -#multiline macros should be enclosed in a do while loop - if (($prevline=~/\#define.*\\/) and !($prevline=~/do\s+{/) and - !($prevline=~/\(\{/) and ($line=~/;\s*\\/) and - !($line=~/do.*{/) and !($line=~/\(\{/)) { - print "Macros with multiple statements should be enclosed in a do - while loop\n"; - print "$hereprev"; +# if and else should not have general statements after it + if ($line =~ /^.\s*(?:}\s*)?else\b(.*)/ && + $1 !~ /^\s*(?:\sif|{|$)/) { + print "trailing statements should be on next line\n"; + print "$herecurr"; $clean = 0; } -# don't include deprecated include files +# multi-statement macros should be enclosed in a do while loop, grab the +# first statement and ensure its the whole macro if its not enclosed +# in a known goot container + if (($prevline=~/\#define.*\\/) and + !($prevline=~/do\s+{/) and !($prevline=~/\(\{/) and + !($line=~/do.*{/) and !($line=~/\(\{/) and + !($line=~/^.\s*$Declare\s/)) { + # Grab the first statement, if that is the entire macro + # its ok. This may start either on the #define line + # or the one below. + my $ln = $linenr; + my $cnt = $realcnt; + + # If the macro starts on the define line start there. + if ($prevline !~ m{^.#\s*define\s*$Ident(?:\([^\)]*\))?\s*\\\s*$}) { + $ln--; + $cnt++; + } + my $ctx = join('', ctx_statement($ln, $cnt)); + + if ($ctx =~ /\\$/) { + if ($ctx =~ /;/) { + print "Macros with multiple statements should be enclosed in a do - while loop\n"; + } else { + print "Macros with complex values should be enclosed in parenthesis\n"; + } + print "$hereprev"; + $clean = 0; + } + } + +# don't include deprecated include files (uses RAW line) for my $inc (@dep_includes) { - if ($line =~ m@\#\s*include\s*\<$inc>@) { + if ($rawline =~ m@\#\s*include\s*\<$inc>@) { print "Don't use <$inc>: see Documentation/feature-removal-schedule.txt\n"; print "$herecurr"; $clean = 0; @@ -845,6 +952,13 @@ sub process { print "$herecurr"; $clean = 0; } + + if ($line =~ /$Type\s+(?:inline|__always_inline)\b/ || + $line =~ /\b(?:inline|always_inline)\s+$Storage/) { + print "inline keyword should sit between storage class and type\n"; + print "$herecurr"; + $clean = 0; + } } if ($chk_patch && !$is_patch) { |