diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/cnt32_to_63.h | 80 | ||||
| -rw-r--r-- | include/linux/hrtimer.h | 18 | ||||
| -rw-r--r-- | include/linux/pci.h | 8 | ||||
| -rw-r--r-- | include/linux/ramfs.h | 1 | ||||
| -rw-r--r-- | include/linux/smb.h | 2 | ||||
| -rw-r--r-- | include/linux/stacktrace.h | 2 |
6 files changed, 103 insertions, 8 deletions
diff --git a/include/linux/cnt32_to_63.h b/include/linux/cnt32_to_63.h new file mode 100644 index 000000000000..8c0f9505b48c --- /dev/null +++ b/include/linux/cnt32_to_63.h | |||
| @@ -0,0 +1,80 @@ | |||
| 1 | /* | ||
| 2 | * Extend a 32-bit counter to 63 bits | ||
| 3 | * | ||
| 4 | * Author: Nicolas Pitre | ||
| 5 | * Created: December 3, 2006 | ||
| 6 | * Copyright: MontaVista Software, Inc. | ||
| 7 | * | ||
| 8 | * This program is free software; you can redistribute it and/or modify | ||
| 9 | * it under the terms of the GNU General Public License version 2 | ||
| 10 | * as published by the Free Software Foundation. | ||
| 11 | */ | ||
| 12 | |||
| 13 | #ifndef __LINUX_CNT32_TO_63_H__ | ||
| 14 | #define __LINUX_CNT32_TO_63_H__ | ||
| 15 | |||
| 16 | #include <linux/compiler.h> | ||
| 17 | #include <linux/types.h> | ||
| 18 | #include <asm/byteorder.h> | ||
| 19 | |||
| 20 | /* this is used only to give gcc a clue about good code generation */ | ||
| 21 | union cnt32_to_63 { | ||
| 22 | struct { | ||
| 23 | #if defined(__LITTLE_ENDIAN) | ||
| 24 | u32 lo, hi; | ||
| 25 | #elif defined(__BIG_ENDIAN) | ||
| 26 | u32 hi, lo; | ||
| 27 | #endif | ||
| 28 | }; | ||
| 29 | u64 val; | ||
| 30 | }; | ||
| 31 | |||
| 32 | |||
| 33 | /** | ||
| 34 | * cnt32_to_63 - Expand a 32-bit counter to a 63-bit counter | ||
| 35 | * @cnt_lo: The low part of the counter | ||
| 36 | * | ||
| 37 | * Many hardware clock counters are only 32 bits wide and therefore have | ||
| 38 | * a relatively short period making wrap-arounds rather frequent. This | ||
| 39 | * is a problem when implementing sched_clock() for example, where a 64-bit | ||
| 40 | * non-wrapping monotonic value is expected to be returned. | ||
| 41 | * | ||
| 42 | * To overcome that limitation, let's extend a 32-bit counter to 63 bits | ||
| 43 | * in a completely lock free fashion. Bits 0 to 31 of the clock are provided | ||
| 44 | * by the hardware while bits 32 to 62 are stored in memory. The top bit in | ||
| 45 | * memory is used to synchronize with the hardware clock half-period. When | ||
| 46 | * the top bit of both counters (hardware and in memory) differ then the | ||
| 47 | * memory is updated with a new value, incrementing it when the hardware | ||
| 48 | * counter wraps around. | ||
| 49 | * | ||
| 50 | * Because a word store in memory is atomic then the incremented value will | ||
| 51 | * always be in synch with the top bit indicating to any potential concurrent | ||
| 52 | * reader if the value in memory is up to date or not with regards to the | ||
| 53 | * needed increment. And any race in updating the value in memory is harmless | ||
| 54 | * as the same value would simply be stored more than once. | ||
| 55 | * | ||
| 56 | * The only restriction for the algorithm to work properly is that this | ||
| 57 | * code must be executed at least once per each half period of the 32-bit | ||
| 58 | * counter to properly update the state bit in memory. This is usually not a | ||
| 59 | * problem in practice, but if it is then a kernel timer could be scheduled | ||
| 60 | * to manage for this code to be executed often enough. | ||
| 61 | * | ||
| 62 | * Note that the top bit (bit 63) in the returned value should be considered | ||
| 63 | * as garbage. It is not cleared here because callers are likely to use a | ||
| 64 | * multiplier on the returned value which can get rid of the top bit | ||
| 65 | * implicitly by making the multiplier even, therefore saving on a runtime | ||
| 66 | * clear-bit instruction. Otherwise caller must remember to clear the top | ||
| 67 | * bit explicitly. | ||
| 68 | */ | ||
| 69 | #define cnt32_to_63(cnt_lo) \ | ||
| 70 | ({ \ | ||
| 71 | static volatile u32 __m_cnt_hi; \ | ||
| 72 | union cnt32_to_63 __x; \ | ||
| 73 | __x.hi = __m_cnt_hi; \ | ||
| 74 | __x.lo = (cnt_lo); \ | ||
| 75 | if (unlikely((s32)(__x.hi ^ __x.lo) < 0)) \ | ||
| 76 | __m_cnt_hi = __x.hi = (__x.hi ^ 0x80000000) + (__x.hi >> 31); \ | ||
| 77 | __x.val; \ | ||
| 78 | }) | ||
| 79 | |||
| 80 | #endif | ||
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index 6d93dce61cbb..2f245fe63bda 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h | |||
| @@ -47,14 +47,22 @@ enum hrtimer_restart { | |||
| 47 | * HRTIMER_CB_IRQSAFE: Callback may run in hardirq context | 47 | * HRTIMER_CB_IRQSAFE: Callback may run in hardirq context |
| 48 | * HRTIMER_CB_IRQSAFE_NO_RESTART: Callback may run in hardirq context and | 48 | * HRTIMER_CB_IRQSAFE_NO_RESTART: Callback may run in hardirq context and |
| 49 | * does not restart the timer | 49 | * does not restart the timer |
| 50 | * HRTIMER_CB_IRQSAFE_NO_SOFTIRQ: Callback must run in hardirq context | 50 | * HRTIMER_CB_IRQSAFE_PERCPU: Callback must run in hardirq context |
| 51 | * Special mode for tick emultation | 51 | * Special mode for tick emulation and |
| 52 | * scheduler timer. Such timers are per | ||
| 53 | * cpu and not allowed to be migrated on | ||
| 54 | * cpu unplug. | ||
| 55 | * HRTIMER_CB_IRQSAFE_UNLOCKED: Callback should run in hardirq context | ||
| 56 | * with timer->base lock unlocked | ||
| 57 | * used for timers which call wakeup to | ||
| 58 | * avoid lock order problems with rq->lock | ||
| 52 | */ | 59 | */ |
| 53 | enum hrtimer_cb_mode { | 60 | enum hrtimer_cb_mode { |
| 54 | HRTIMER_CB_SOFTIRQ, | 61 | HRTIMER_CB_SOFTIRQ, |
| 55 | HRTIMER_CB_IRQSAFE, | 62 | HRTIMER_CB_IRQSAFE, |
| 56 | HRTIMER_CB_IRQSAFE_NO_RESTART, | 63 | HRTIMER_CB_IRQSAFE_NO_RESTART, |
| 57 | HRTIMER_CB_IRQSAFE_NO_SOFTIRQ, | 64 | HRTIMER_CB_IRQSAFE_PERCPU, |
| 65 | HRTIMER_CB_IRQSAFE_UNLOCKED, | ||
| 58 | }; | 66 | }; |
| 59 | 67 | ||
| 60 | /* | 68 | /* |
| @@ -67,9 +75,10 @@ enum hrtimer_cb_mode { | |||
| 67 | * 0x02 callback function running | 75 | * 0x02 callback function running |
| 68 | * 0x04 callback pending (high resolution mode) | 76 | * 0x04 callback pending (high resolution mode) |
| 69 | * | 77 | * |
| 70 | * Special case: | 78 | * Special cases: |
| 71 | * 0x03 callback function running and enqueued | 79 | * 0x03 callback function running and enqueued |
| 72 | * (was requeued on another CPU) | 80 | * (was requeued on another CPU) |
| 81 | * 0x09 timer was migrated on CPU hotunplug | ||
| 73 | * The "callback function running and enqueued" status is only possible on | 82 | * The "callback function running and enqueued" status is only possible on |
| 74 | * SMP. It happens for example when a posix timer expired and the callback | 83 | * SMP. It happens for example when a posix timer expired and the callback |
| 75 | * queued a signal. Between dropping the lock which protects the posix timer | 84 | * queued a signal. Between dropping the lock which protects the posix timer |
| @@ -87,6 +96,7 @@ enum hrtimer_cb_mode { | |||
| 87 | #define HRTIMER_STATE_ENQUEUED 0x01 | 96 | #define HRTIMER_STATE_ENQUEUED 0x01 |
| 88 | #define HRTIMER_STATE_CALLBACK 0x02 | 97 | #define HRTIMER_STATE_CALLBACK 0x02 |
| 89 | #define HRTIMER_STATE_PENDING 0x04 | 98 | #define HRTIMER_STATE_PENDING 0x04 |
| 99 | #define HRTIMER_STATE_MIGRATE 0x08 | ||
| 90 | 100 | ||
| 91 | /** | 101 | /** |
| 92 | * struct hrtimer - the basic hrtimer structure | 102 | * struct hrtimer - the basic hrtimer structure |
diff --git a/include/linux/pci.h b/include/linux/pci.h index c0e14008a3c2..98dc6243a706 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
| @@ -534,7 +534,7 @@ extern void pci_sort_breadthfirst(void); | |||
| 534 | #ifdef CONFIG_PCI_LEGACY | 534 | #ifdef CONFIG_PCI_LEGACY |
| 535 | struct pci_dev __deprecated *pci_find_device(unsigned int vendor, | 535 | struct pci_dev __deprecated *pci_find_device(unsigned int vendor, |
| 536 | unsigned int device, | 536 | unsigned int device, |
| 537 | const struct pci_dev *from); | 537 | struct pci_dev *from); |
| 538 | struct pci_dev __deprecated *pci_find_slot(unsigned int bus, | 538 | struct pci_dev __deprecated *pci_find_slot(unsigned int bus, |
| 539 | unsigned int devfn); | 539 | unsigned int devfn); |
| 540 | #endif /* CONFIG_PCI_LEGACY */ | 540 | #endif /* CONFIG_PCI_LEGACY */ |
| @@ -550,7 +550,7 @@ struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device, | |||
| 550 | struct pci_dev *from); | 550 | struct pci_dev *from); |
| 551 | struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device, | 551 | struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device, |
| 552 | unsigned int ss_vendor, unsigned int ss_device, | 552 | unsigned int ss_vendor, unsigned int ss_device, |
| 553 | const struct pci_dev *from); | 553 | struct pci_dev *from); |
| 554 | struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn); | 554 | struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn); |
| 555 | struct pci_dev *pci_get_bus_and_slot(unsigned int bus, unsigned int devfn); | 555 | struct pci_dev *pci_get_bus_and_slot(unsigned int bus, unsigned int devfn); |
| 556 | struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from); | 556 | struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from); |
| @@ -816,7 +816,7 @@ _PCI_NOP_ALL(write,) | |||
| 816 | 816 | ||
| 817 | static inline struct pci_dev *pci_find_device(unsigned int vendor, | 817 | static inline struct pci_dev *pci_find_device(unsigned int vendor, |
| 818 | unsigned int device, | 818 | unsigned int device, |
| 819 | const struct pci_dev *from) | 819 | struct pci_dev *from) |
| 820 | { | 820 | { |
| 821 | return NULL; | 821 | return NULL; |
| 822 | } | 822 | } |
| @@ -838,7 +838,7 @@ static inline struct pci_dev *pci_get_subsys(unsigned int vendor, | |||
| 838 | unsigned int device, | 838 | unsigned int device, |
| 839 | unsigned int ss_vendor, | 839 | unsigned int ss_vendor, |
| 840 | unsigned int ss_device, | 840 | unsigned int ss_device, |
| 841 | const struct pci_dev *from) | 841 | struct pci_dev *from) |
| 842 | { | 842 | { |
| 843 | return NULL; | 843 | return NULL; |
| 844 | } | 844 | } |
diff --git a/include/linux/ramfs.h b/include/linux/ramfs.h index b160fb18e8d6..37aaf2b39863 100644 --- a/include/linux/ramfs.h +++ b/include/linux/ramfs.h | |||
| @@ -6,6 +6,7 @@ extern int ramfs_get_sb(struct file_system_type *fs_type, | |||
| 6 | int flags, const char *dev_name, void *data, struct vfsmount *mnt); | 6 | int flags, const char *dev_name, void *data, struct vfsmount *mnt); |
| 7 | 7 | ||
| 8 | #ifndef CONFIG_MMU | 8 | #ifndef CONFIG_MMU |
| 9 | extern int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize); | ||
| 9 | extern unsigned long ramfs_nommu_get_unmapped_area(struct file *file, | 10 | extern unsigned long ramfs_nommu_get_unmapped_area(struct file *file, |
| 10 | unsigned long addr, | 11 | unsigned long addr, |
| 11 | unsigned long len, | 12 | unsigned long len, |
diff --git a/include/linux/smb.h b/include/linux/smb.h index caa43b2370cb..82fefddc5987 100644 --- a/include/linux/smb.h +++ b/include/linux/smb.h | |||
| @@ -11,7 +11,9 @@ | |||
| 11 | 11 | ||
| 12 | #include <linux/types.h> | 12 | #include <linux/types.h> |
| 13 | #include <linux/magic.h> | 13 | #include <linux/magic.h> |
| 14 | #ifdef __KERNEL__ | ||
| 14 | #include <linux/time.h> | 15 | #include <linux/time.h> |
| 16 | #endif | ||
| 15 | 17 | ||
| 16 | enum smb_protocol { | 18 | enum smb_protocol { |
| 17 | SMB_PROTOCOL_NONE, | 19 | SMB_PROTOCOL_NONE, |
diff --git a/include/linux/stacktrace.h b/include/linux/stacktrace.h index 5da9794b2d78..b106fd8e0d5c 100644 --- a/include/linux/stacktrace.h +++ b/include/linux/stacktrace.h | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | #ifndef __LINUX_STACKTRACE_H | 1 | #ifndef __LINUX_STACKTRACE_H |
| 2 | #define __LINUX_STACKTRACE_H | 2 | #define __LINUX_STACKTRACE_H |
| 3 | 3 | ||
| 4 | struct task_struct; | ||
| 5 | |||
| 4 | #ifdef CONFIG_STACKTRACE | 6 | #ifdef CONFIG_STACKTRACE |
| 5 | struct stack_trace { | 7 | struct stack_trace { |
| 6 | unsigned int nr_entries, max_entries; | 8 | unsigned int nr_entries, max_entries; |
