diff options
110 files changed, 1305 insertions, 726 deletions
diff --git a/Documentation/ABI/testing/sysfs-block-rssd b/Documentation/ABI/testing/sysfs-block-rssd index 679ce3543122..beef30c046b0 100644 --- a/Documentation/ABI/testing/sysfs-block-rssd +++ b/Documentation/ABI/testing/sysfs-block-rssd | |||
@@ -1,26 +1,5 @@ | |||
1 | What: /sys/block/rssd*/registers | ||
2 | Date: March 2012 | ||
3 | KernelVersion: 3.3 | ||
4 | Contact: Asai Thambi S P <asamymuthupa@micron.com> | ||
5 | Description: This is a read-only file. Dumps below driver information and | ||
6 | hardware registers. | ||
7 | - S ACTive | ||
8 | - Command Issue | ||
9 | - Completed | ||
10 | - PORT IRQ STAT | ||
11 | - HOST IRQ STAT | ||
12 | - Allocated | ||
13 | - Commands in Q | ||
14 | |||
15 | What: /sys/block/rssd*/status | 1 | What: /sys/block/rssd*/status |
16 | Date: April 2012 | 2 | Date: April 2012 |
17 | KernelVersion: 3.4 | 3 | KernelVersion: 3.4 |
18 | Contact: Asai Thambi S P <asamymuthupa@micron.com> | 4 | Contact: Asai Thambi S P <asamymuthupa@micron.com> |
19 | Description: This is a read-only file. Indicates the status of the device. | 5 | Description: This is a read-only file. Indicates the status of the device. |
20 | |||
21 | What: /sys/block/rssd*/flags | ||
22 | Date: May 2012 | ||
23 | KernelVersion: 3.5 | ||
24 | Contact: Asai Thambi S P <asamymuthupa@micron.com> | ||
25 | Description: This is a read-only file. Dumps the flags in port and driver | ||
26 | data structure | ||
diff --git a/Documentation/device-mapper/verity.txt b/Documentation/device-mapper/verity.txt index 32e48797a14f..9884681535ee 100644 --- a/Documentation/device-mapper/verity.txt +++ b/Documentation/device-mapper/verity.txt | |||
@@ -7,39 +7,39 @@ This target is read-only. | |||
7 | 7 | ||
8 | Construction Parameters | 8 | Construction Parameters |
9 | ======================= | 9 | ======================= |
10 | <version> <dev> <hash_dev> <hash_start> | 10 | <version> <dev> <hash_dev> |
11 | <data_block_size> <hash_block_size> | 11 | <data_block_size> <hash_block_size> |
12 | <num_data_blocks> <hash_start_block> | 12 | <num_data_blocks> <hash_start_block> |
13 | <algorithm> <digest> <salt> | 13 | <algorithm> <digest> <salt> |
14 | 14 | ||
15 | <version> | 15 | <version> |
16 | This is the version number of the on-disk format. | 16 | This is the type of the on-disk hash format. |
17 | 17 | ||
18 | 0 is the original format used in the Chromium OS. | 18 | 0 is the original format used in the Chromium OS. |
19 | The salt is appended when hashing, digests are stored continuously and | 19 | The salt is appended when hashing, digests are stored continuously and |
20 | the rest of the block is padded with zeros. | 20 | the rest of the block is padded with zeros. |
21 | 21 | ||
22 | 1 is the current format that should be used for new devices. | 22 | 1 is the current format that should be used for new devices. |
23 | The salt is prepended when hashing and each digest is | 23 | The salt is prepended when hashing and each digest is |
24 | padded with zeros to the power of two. | 24 | padded with zeros to the power of two. |
25 | 25 | ||
26 | <dev> | 26 | <dev> |
27 | This is the device containing the data the integrity of which needs to be | 27 | This is the device containing data, the integrity of which needs to be |
28 | checked. It may be specified as a path, like /dev/sdaX, or a device number, | 28 | checked. It may be specified as a path, like /dev/sdaX, or a device number, |
29 | <major>:<minor>. | 29 | <major>:<minor>. |
30 | 30 | ||
31 | <hash_dev> | 31 | <hash_dev> |
32 | This is the device that that supplies the hash tree data. It may be | 32 | This is the device that supplies the hash tree data. It may be |
33 | specified similarly to the device path and may be the same device. If the | 33 | specified similarly to the device path and may be the same device. If the |
34 | same device is used, the hash_start should be outside of the dm-verity | 34 | same device is used, the hash_start should be outside the configured |
35 | configured device size. | 35 | dm-verity device. |
36 | 36 | ||
37 | <data_block_size> | 37 | <data_block_size> |
38 | The block size on a data device. Each block corresponds to one digest on | 38 | The block size on a data device in bytes. |
39 | the hash device. | 39 | Each block corresponds to one digest on the hash device. |
40 | 40 | ||
41 | <hash_block_size> | 41 | <hash_block_size> |
42 | The size of a hash block. | 42 | The size of a hash block in bytes. |
43 | 43 | ||
44 | <num_data_blocks> | 44 | <num_data_blocks> |
45 | The number of data blocks on the data device. Additional blocks are | 45 | The number of data blocks on the data device. Additional blocks are |
@@ -65,7 +65,7 @@ Construction Parameters | |||
65 | Theory of operation | 65 | Theory of operation |
66 | =================== | 66 | =================== |
67 | 67 | ||
68 | dm-verity is meant to be setup as part of a verified boot path. This | 68 | dm-verity is meant to be set up as part of a verified boot path. This |
69 | may be anything ranging from a boot using tboot or trustedgrub to just | 69 | may be anything ranging from a boot using tboot or trustedgrub to just |
70 | booting from a known-good device (like a USB drive or CD). | 70 | booting from a known-good device (like a USB drive or CD). |
71 | 71 | ||
@@ -73,20 +73,20 @@ When a dm-verity device is configured, it is expected that the caller | |||
73 | has been authenticated in some way (cryptographic signatures, etc). | 73 | has been authenticated in some way (cryptographic signatures, etc). |
74 | After instantiation, all hashes will be verified on-demand during | 74 | After instantiation, all hashes will be verified on-demand during |
75 | disk access. If they cannot be verified up to the root node of the | 75 | disk access. If they cannot be verified up to the root node of the |
76 | tree, the root hash, then the I/O will fail. This should identify | 76 | tree, the root hash, then the I/O will fail. This should detect |
77 | tampering with any data on the device and the hash data. | 77 | tampering with any data on the device and the hash data. |
78 | 78 | ||
79 | Cryptographic hashes are used to assert the integrity of the device on a | 79 | Cryptographic hashes are used to assert the integrity of the device on a |
80 | per-block basis. This allows for a lightweight hash computation on first read | 80 | per-block basis. This allows for a lightweight hash computation on first read |
81 | into the page cache. Block hashes are stored linearly-aligned to the nearest | 81 | into the page cache. Block hashes are stored linearly, aligned to the nearest |
82 | block the size of a page. | 82 | block size. |
83 | 83 | ||
84 | Hash Tree | 84 | Hash Tree |
85 | --------- | 85 | --------- |
86 | 86 | ||
87 | Each node in the tree is a cryptographic hash. If it is a leaf node, the hash | 87 | Each node in the tree is a cryptographic hash. If it is a leaf node, the hash |
88 | is of some block data on disk. If it is an intermediary node, then the hash is | 88 | of some data block on disk is calculated. If it is an intermediary node, |
89 | of a number of child nodes. | 89 | the hash of a number of child nodes is calculated. |
90 | 90 | ||
91 | Each entry in the tree is a collection of neighboring nodes that fit in one | 91 | Each entry in the tree is a collection of neighboring nodes that fit in one |
92 | block. The number is determined based on block_size and the size of the | 92 | block. The number is determined based on block_size and the size of the |
@@ -110,63 +110,23 @@ alg = sha256, num_blocks = 32768, block_size = 4096 | |||
110 | On-disk format | 110 | On-disk format |
111 | ============== | 111 | ============== |
112 | 112 | ||
113 | Below is the recommended on-disk format. The verity kernel code does not | 113 | The verity kernel code does not read the verity metadata on-disk header. |
114 | read the on-disk header. It only reads the hash blocks which directly | 114 | It only reads the hash blocks which directly follow the header. |
115 | follow the header. It is expected that a user-space tool will verify the | 115 | It is expected that a user-space tool will verify the integrity of the |
116 | integrity of the verity_header and then call dmsetup with the correct | 116 | verity header. |
117 | parameters. Alternatively, the header can be omitted and the dmsetup | ||
118 | parameters can be passed via the kernel command-line in a rooted chain | ||
119 | of trust where the command-line is verified. | ||
120 | 117 | ||
121 | The on-disk format is especially useful in cases where the hash blocks | 118 | Alternatively, the header can be omitted and the dmsetup parameters can |
122 | are on a separate partition. The magic number allows easy identification | 119 | be passed via the kernel command-line in a rooted chain of trust where |
123 | of the partition contents. Alternatively, the hash blocks can be stored | 120 | the command-line is verified. |
124 | in the same partition as the data to be verified. In such a configuration | ||
125 | the filesystem on the partition would be sized a little smaller than | ||
126 | the full-partition, leaving room for the hash blocks. | ||
127 | |||
128 | struct superblock { | ||
129 | uint8_t signature[8] | ||
130 | "verity\0\0"; | ||
131 | |||
132 | uint8_t version; | ||
133 | 1 - current format | ||
134 | |||
135 | uint8_t data_block_bits; | ||
136 | log2(data block size) | ||
137 | |||
138 | uint8_t hash_block_bits; | ||
139 | log2(hash block size) | ||
140 | |||
141 | uint8_t pad1[1]; | ||
142 | zero padding | ||
143 | |||
144 | uint16_t salt_size; | ||
145 | big-endian salt size | ||
146 | |||
147 | uint8_t pad2[2]; | ||
148 | zero padding | ||
149 | |||
150 | uint32_t data_blocks_hi; | ||
151 | big-endian high 32 bits of the 64-bit number of data blocks | ||
152 | |||
153 | uint32_t data_blocks_lo; | ||
154 | big-endian low 32 bits of the 64-bit number of data blocks | ||
155 | |||
156 | uint8_t algorithm[16]; | ||
157 | cryptographic algorithm | ||
158 | |||
159 | uint8_t salt[384]; | ||
160 | salt (the salt size is specified above) | ||
161 | |||
162 | uint8_t pad3[88]; | ||
163 | zero padding to 512-byte boundary | ||
164 | } | ||
165 | 121 | ||
166 | Directly following the header (and with sector number padded to the next hash | 122 | Directly following the header (and with sector number padded to the next hash |
167 | block boundary) are the hash blocks which are stored a depth at a time | 123 | block boundary) are the hash blocks which are stored a depth at a time |
168 | (starting from the root), sorted in order of increasing index. | 124 | (starting from the root), sorted in order of increasing index. |
169 | 125 | ||
126 | The full specification of kernel parameters and on-disk metadata format | ||
127 | is available at the cryptsetup project's wiki page | ||
128 | http://code.google.com/p/cryptsetup/wiki/DMVerity | ||
129 | |||
170 | Status | 130 | Status |
171 | ====== | 131 | ====== |
172 | V (for Valid) is returned if every check performed so far was valid. | 132 | V (for Valid) is returned if every check performed so far was valid. |
@@ -174,21 +134,22 @@ If any check failed, C (for Corruption) is returned. | |||
174 | 134 | ||
175 | Example | 135 | Example |
176 | ======= | 136 | ======= |
177 | 137 | Set up a device: | |
178 | Setup a device: | 138 | # dmsetup create vroot --readonly --table \ |
179 | dmsetup create vroot --table \ | 139 | "0 2097152 verity 1 /dev/sda1 /dev/sda2 4096 4096 262144 1 sha256 "\ |
180 | "0 2097152 "\ | ||
181 | "verity 1 /dev/sda1 /dev/sda2 4096 4096 2097152 1 "\ | ||
182 | "4392712ba01368efdf14b05c76f9e4df0d53664630b5d48632ed17a137f39076 "\ | 140 | "4392712ba01368efdf14b05c76f9e4df0d53664630b5d48632ed17a137f39076 "\ |
183 | "1234000000000000000000000000000000000000000000000000000000000000" | 141 | "1234000000000000000000000000000000000000000000000000000000000000" |
184 | 142 | ||
185 | A command line tool veritysetup is available to compute or verify | 143 | A command line tool veritysetup is available to compute or verify |
186 | the hash tree or activate the kernel driver. This is available from | 144 | the hash tree or activate the kernel device. This is available from |
187 | the LVM2 upstream repository and may be supplied as a package called | 145 | the cryptsetup upstream repository http://code.google.com/p/cryptsetup/ |
188 | device-mapper-verity-tools: | 146 | (as a libcryptsetup extension). |
189 | git://sources.redhat.com/git/lvm2 | 147 | |
190 | http://sourceware.org/git/?p=lvm2.git | 148 | Create hash on the device: |
191 | http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/verity?cvsroot=lvm2 | 149 | # veritysetup format /dev/sda1 /dev/sda2 |
192 | 150 | ... | |
193 | veritysetup -a vroot /dev/sda1 /dev/sda2 \ | 151 | Root hash: 4392712ba01368efdf14b05c76f9e4df0d53664630b5d48632ed17a137f39076 |
194 | 4392712ba01368efdf14b05c76f9e4df0d53664630b5d48632ed17a137f39076 | 152 | |
153 | Activate the device: | ||
154 | # veritysetup create vroot /dev/sda1 /dev/sda2 \ | ||
155 | 4392712ba01368efdf14b05c76f9e4df0d53664630b5d48632ed17a137f39076 | ||
diff --git a/Documentation/prctl/no_new_privs.txt b/Documentation/prctl/no_new_privs.txt new file mode 100644 index 000000000000..cb705ec69abe --- /dev/null +++ b/Documentation/prctl/no_new_privs.txt | |||
@@ -0,0 +1,50 @@ | |||
1 | The execve system call can grant a newly-started program privileges that | ||
2 | its parent did not have. The most obvious examples are setuid/setgid | ||
3 | programs and file capabilities. To prevent the parent program from | ||
4 | gaining these privileges as well, the kernel and user code must be | ||
5 | careful to prevent the parent from doing anything that could subvert the | ||
6 | child. For example: | ||
7 | |||
8 | - The dynamic loader handles LD_* environment variables differently if | ||
9 | a program is setuid. | ||
10 | |||
11 | - chroot is disallowed to unprivileged processes, since it would allow | ||
12 | /etc/passwd to be replaced from the point of view of a process that | ||
13 | inherited chroot. | ||
14 | |||
15 | - The exec code has special handling for ptrace. | ||
16 | |||
17 | These are all ad-hoc fixes. The no_new_privs bit (since Linux 3.5) is a | ||
18 | new, generic mechanism to make it safe for a process to modify its | ||
19 | execution environment in a manner that persists across execve. Any task | ||
20 | can set no_new_privs. Once the bit is set, it is inherited across fork, | ||
21 | clone, and execve and cannot be unset. With no_new_privs set, execve | ||
22 | promises not to grant the privilege to do anything that could not have | ||
23 | been done without the execve call. For example, the setuid and setgid | ||
24 | bits will no longer change the uid or gid; file capabilities will not | ||
25 | add to the permitted set, and LSMs will not relax constraints after | ||
26 | execve. | ||
27 | |||
28 | Note that no_new_privs does not prevent privilege changes that do not | ||
29 | involve execve. An appropriately privileged task can still call | ||
30 | setuid(2) and receive SCM_RIGHTS datagrams. | ||
31 | |||
32 | There are two main use cases for no_new_privs so far: | ||
33 | |||
34 | - Filters installed for the seccomp mode 2 sandbox persist across | ||
35 | execve and can change the behavior of newly-executed programs. | ||
36 | Unprivileged users are therefore only allowed to install such filters | ||
37 | if no_new_privs is set. | ||
38 | |||
39 | - By itself, no_new_privs can be used to reduce the attack surface | ||
40 | available to an unprivileged user. If everything running with a | ||
41 | given uid has no_new_privs set, then that uid will be unable to | ||
42 | escalate its privileges by directly attacking setuid, setgid, and | ||
43 | fcap-using binaries; it will need to compromise something without the | ||
44 | no_new_privs bit set first. | ||
45 | |||
46 | In the future, other potentially dangerous kernel features could become | ||
47 | available to unprivileged tasks if no_new_privs is set. In principle, | ||
48 | several options to unshare(2) and clone(2) would be safe when | ||
49 | no_new_privs is set, and no_new_privs + chroot is considerable less | ||
50 | dangerous than chroot by itself. | ||
diff --git a/Documentation/stable_kernel_rules.txt b/Documentation/stable_kernel_rules.txt index f0ab5cf28fca..4a7b54bd37e8 100644 --- a/Documentation/stable_kernel_rules.txt +++ b/Documentation/stable_kernel_rules.txt | |||
@@ -12,6 +12,12 @@ Rules on what kind of patches are accepted, and which ones are not, into the | |||
12 | marked CONFIG_BROKEN), an oops, a hang, data corruption, a real | 12 | marked CONFIG_BROKEN), an oops, a hang, data corruption, a real |
13 | security issue, or some "oh, that's not good" issue. In short, something | 13 | security issue, or some "oh, that's not good" issue. In short, something |
14 | critical. | 14 | critical. |
15 | - Serious issues as reported by a user of a distribution kernel may also | ||
16 | be considered if they fix a notable performance or interactivity issue. | ||
17 | As these fixes are not as obvious and have a higher risk of a subtle | ||
18 | regression they should only be submitted by a distribution kernel | ||
19 | maintainer and include an addendum linking to a bugzilla entry if it | ||
20 | exists and additional information on the user-visible impact. | ||
15 | - New device IDs and quirks are also accepted. | 21 | - New device IDs and quirks are also accepted. |
16 | - No "theoretical race condition" issues, unless an explanation of how the | 22 | - No "theoretical race condition" issues, unless an explanation of how the |
17 | race can be exploited is also provided. | 23 | race can be exploited is also provided. |
diff --git a/MAINTAINERS b/MAINTAINERS index d350dae2ce1c..8da1373bd6d1 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -4655,8 +4655,8 @@ L: netfilter@vger.kernel.org | |||
4655 | L: coreteam@netfilter.org | 4655 | L: coreteam@netfilter.org |
4656 | W: http://www.netfilter.org/ | 4656 | W: http://www.netfilter.org/ |
4657 | W: http://www.iptables.org/ | 4657 | W: http://www.iptables.org/ |
4658 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf-2.6.git | 4658 | T: git git://1984.lsi.us.es/nf |
4659 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf-next-2.6.git | 4659 | T: git git://1984.lsi.us.es/nf-next |
4660 | S: Supported | 4660 | S: Supported |
4661 | F: include/linux/netfilter* | 4661 | F: include/linux/netfilter* |
4662 | F: include/linux/netfilter/ | 4662 | F: include/linux/netfilter/ |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 3 | 1 | VERSION = 3 |
2 | PATCHLEVEL = 5 | 2 | PATCHLEVEL = 5 |
3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
4 | EXTRAVERSION = -rc4 | 4 | EXTRAVERSION = -rc5 |
5 | NAME = Saber-toothed Squirrel | 5 | NAME = Saber-toothed Squirrel |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S index 43a31fb06318..36ff15bbfdd4 100644 --- a/arch/arm/kernel/vmlinux.lds.S +++ b/arch/arm/kernel/vmlinux.lds.S | |||
@@ -183,7 +183,9 @@ SECTIONS | |||
183 | } | 183 | } |
184 | #endif | 184 | #endif |
185 | 185 | ||
186 | #ifdef CONFIG_SMP | ||
186 | PERCPU_SECTION(L1_CACHE_BYTES) | 187 | PERCPU_SECTION(L1_CACHE_BYTES) |
188 | #endif | ||
187 | 189 | ||
188 | #ifdef CONFIG_XIP_KERNEL | 190 | #ifdef CONFIG_XIP_KERNEL |
189 | __data_loc = ALIGN(4); /* location in binary */ | 191 | __data_loc = ALIGN(4); /* location in binary */ |
diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig index 573be57d3d28..6f6d13f91e4c 100644 --- a/arch/arm/mach-exynos/Kconfig +++ b/arch/arm/mach-exynos/Kconfig | |||
@@ -212,7 +212,7 @@ config MACH_SMDKV310 | |||
212 | select EXYNOS_DEV_SYSMMU | 212 | select EXYNOS_DEV_SYSMMU |
213 | select EXYNOS4_DEV_AHCI | 213 | select EXYNOS4_DEV_AHCI |
214 | select SAMSUNG_DEV_KEYPAD | 214 | select SAMSUNG_DEV_KEYPAD |
215 | select EXYNOS4_DEV_DMA | 215 | select EXYNOS_DEV_DMA |
216 | select SAMSUNG_DEV_PWM | 216 | select SAMSUNG_DEV_PWM |
217 | select EXYNOS4_DEV_USB_OHCI | 217 | select EXYNOS4_DEV_USB_OHCI |
218 | select EXYNOS4_SETUP_FIMD0 | 218 | select EXYNOS4_SETUP_FIMD0 |
@@ -264,7 +264,7 @@ config MACH_UNIVERSAL_C210 | |||
264 | select S5P_DEV_ONENAND | 264 | select S5P_DEV_ONENAND |
265 | select S5P_DEV_TV | 265 | select S5P_DEV_TV |
266 | select EXYNOS_DEV_SYSMMU | 266 | select EXYNOS_DEV_SYSMMU |
267 | select EXYNOS4_DEV_DMA | 267 | select EXYNOS_DEV_DMA |
268 | select EXYNOS_DEV_DRM | 268 | select EXYNOS_DEV_DRM |
269 | select EXYNOS4_SETUP_FIMD0 | 269 | select EXYNOS4_SETUP_FIMD0 |
270 | select EXYNOS4_SETUP_I2C1 | 270 | select EXYNOS4_SETUP_I2C1 |
@@ -303,7 +303,7 @@ config MACH_NURI | |||
303 | select S5P_DEV_MFC | 303 | select S5P_DEV_MFC |
304 | select S5P_DEV_USB_EHCI | 304 | select S5P_DEV_USB_EHCI |
305 | select S5P_SETUP_MIPIPHY | 305 | select S5P_SETUP_MIPIPHY |
306 | select EXYNOS4_DEV_DMA | 306 | select EXYNOS_DEV_DMA |
307 | select EXYNOS_DEV_DRM | 307 | select EXYNOS_DEV_DRM |
308 | select EXYNOS4_SETUP_FIMC | 308 | select EXYNOS4_SETUP_FIMC |
309 | select EXYNOS4_SETUP_FIMD0 | 309 | select EXYNOS4_SETUP_FIMD0 |
@@ -341,7 +341,7 @@ config MACH_ORIGEN | |||
341 | select SAMSUNG_DEV_PWM | 341 | select SAMSUNG_DEV_PWM |
342 | select EXYNOS_DEV_DRM | 342 | select EXYNOS_DEV_DRM |
343 | select EXYNOS_DEV_SYSMMU | 343 | select EXYNOS_DEV_SYSMMU |
344 | select EXYNOS4_DEV_DMA | 344 | select EXYNOS_DEV_DMA |
345 | select EXYNOS4_DEV_USB_OHCI | 345 | select EXYNOS4_DEV_USB_OHCI |
346 | select EXYNOS4_SETUP_FIMD0 | 346 | select EXYNOS4_SETUP_FIMD0 |
347 | select EXYNOS4_SETUP_SDHCI | 347 | select EXYNOS4_SETUP_SDHCI |
diff --git a/arch/arm/mach-imx/clk-imx6q.c b/arch/arm/mach-imx/clk-imx6q.c index 17dc66a085a5..e1a17ac7b3b4 100644 --- a/arch/arm/mach-imx/clk-imx6q.c +++ b/arch/arm/mach-imx/clk-imx6q.c | |||
@@ -152,13 +152,14 @@ enum mx6q_clks { | |||
152 | ssi2, ssi3, uart_ipg, uart_serial, usboh3, usdhc1, usdhc2, usdhc3, | 152 | ssi2, ssi3, uart_ipg, uart_serial, usboh3, usdhc1, usdhc2, usdhc3, |
153 | usdhc4, vdo_axi, vpu_axi, cko1, pll1_sys, pll2_bus, pll3_usb_otg, | 153 | usdhc4, vdo_axi, vpu_axi, cko1, pll1_sys, pll2_bus, pll3_usb_otg, |
154 | pll4_audio, pll5_video, pll6_mlb, pll7_usb_host, pll8_enet, ssi1_ipg, | 154 | pll4_audio, pll5_video, pll6_mlb, pll7_usb_host, pll8_enet, ssi1_ipg, |
155 | ssi2_ipg, ssi3_ipg, clk_max | 155 | ssi2_ipg, ssi3_ipg, rom, |
156 | clk_max | ||
156 | }; | 157 | }; |
157 | 158 | ||
158 | static struct clk *clk[clk_max]; | 159 | static struct clk *clk[clk_max]; |
159 | 160 | ||
160 | static enum mx6q_clks const clks_init_on[] __initconst = { | 161 | static enum mx6q_clks const clks_init_on[] __initconst = { |
161 | mmdc_ch0_axi, mmdc_ch1_axi, | 162 | mmdc_ch0_axi, rom, |
162 | }; | 163 | }; |
163 | 164 | ||
164 | int __init mx6q_clocks_init(void) | 165 | int __init mx6q_clocks_init(void) |
@@ -364,6 +365,7 @@ int __init mx6q_clocks_init(void) | |||
364 | clk[gpmi_bch] = imx_clk_gate2("gpmi_bch", "usdhc4", base + 0x78, 26); | 365 | clk[gpmi_bch] = imx_clk_gate2("gpmi_bch", "usdhc4", base + 0x78, 26); |
365 | clk[gpmi_io] = imx_clk_gate2("gpmi_io", "enfc", base + 0x78, 28); | 366 | clk[gpmi_io] = imx_clk_gate2("gpmi_io", "enfc", base + 0x78, 28); |
366 | clk[gpmi_apb] = imx_clk_gate2("gpmi_apb", "usdhc3", base + 0x78, 30); | 367 | clk[gpmi_apb] = imx_clk_gate2("gpmi_apb", "usdhc3", base + 0x78, 30); |
368 | clk[rom] = imx_clk_gate2("rom", "ahb", base + 0x7c, 0); | ||
367 | clk[sata] = imx_clk_gate2("sata", "ipg", base + 0x7c, 4); | 369 | clk[sata] = imx_clk_gate2("sata", "ipg", base + 0x7c, 4); |
368 | clk[sdma] = imx_clk_gate2("sdma", "ahb", base + 0x7c, 6); | 370 | clk[sdma] = imx_clk_gate2("sdma", "ahb", base + 0x7c, 6); |
369 | clk[spba] = imx_clk_gate2("spba", "ipg", base + 0x7c, 12); | 371 | clk[spba] = imx_clk_gate2("spba", "ipg", base + 0x7c, 12); |
diff --git a/arch/arm/mach-omap2/board-flash.c b/arch/arm/mach-omap2/board-flash.c index 70a81f900bb5..53c39d239d6e 100644 --- a/arch/arm/mach-omap2/board-flash.c +++ b/arch/arm/mach-omap2/board-flash.c | |||
@@ -97,11 +97,6 @@ __init board_onenand_init(struct mtd_partition *onenand_parts, | |||
97 | 97 | ||
98 | gpmc_onenand_init(&board_onenand_data); | 98 | gpmc_onenand_init(&board_onenand_data); |
99 | } | 99 | } |
100 | #else | ||
101 | void | ||
102 | __init board_onenand_init(struct mtd_partition *nor_parts, u8 nr_parts, u8 cs) | ||
103 | { | ||
104 | } | ||
105 | #endif /* CONFIG_MTD_ONENAND_OMAP2 || CONFIG_MTD_ONENAND_OMAP2_MODULE */ | 100 | #endif /* CONFIG_MTD_ONENAND_OMAP2 || CONFIG_MTD_ONENAND_OMAP2_MODULE */ |
106 | 101 | ||
107 | #if defined(CONFIG_MTD_NAND_OMAP2) || \ | 102 | #if defined(CONFIG_MTD_NAND_OMAP2) || \ |
diff --git a/arch/arm/mach-omap2/clock44xx_data.c b/arch/arm/mach-omap2/clock44xx_data.c index e2b701e164f6..ba6f9a0a43e9 100644 --- a/arch/arm/mach-omap2/clock44xx_data.c +++ b/arch/arm/mach-omap2/clock44xx_data.c | |||
@@ -3417,9 +3417,12 @@ int __init omap4xxx_clk_init(void) | |||
3417 | if (cpu_is_omap443x()) { | 3417 | if (cpu_is_omap443x()) { |
3418 | cpu_mask = RATE_IN_4430; | 3418 | cpu_mask = RATE_IN_4430; |
3419 | cpu_clkflg = CK_443X; | 3419 | cpu_clkflg = CK_443X; |
3420 | } else if (cpu_is_omap446x()) { | 3420 | } else if (cpu_is_omap446x() || cpu_is_omap447x()) { |
3421 | cpu_mask = RATE_IN_4460 | RATE_IN_4430; | 3421 | cpu_mask = RATE_IN_4460 | RATE_IN_4430; |
3422 | cpu_clkflg = CK_446X | CK_443X; | 3422 | cpu_clkflg = CK_446X | CK_443X; |
3423 | |||
3424 | if (cpu_is_omap447x()) | ||
3425 | pr_warn("WARNING: OMAP4470 clock data incomplete!\n"); | ||
3423 | } else { | 3426 | } else { |
3424 | return 0; | 3427 | return 0; |
3425 | } | 3428 | } |
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c index 9e37026ef9dd..9bd135531d76 100644 --- a/arch/arm/mach-shmobile/board-armadillo800eva.c +++ b/arch/arm/mach-shmobile/board-armadillo800eva.c | |||
@@ -779,6 +779,7 @@ DT_MACHINE_START(ARMADILLO800EVA_DT, "armadillo800eva") | |||
779 | .init_irq = r8a7740_init_irq, | 779 | .init_irq = r8a7740_init_irq, |
780 | .handle_irq = shmobile_handle_irq_intc, | 780 | .handle_irq = shmobile_handle_irq_intc, |
781 | .init_machine = eva_init, | 781 | .init_machine = eva_init, |
782 | .init_late = shmobile_init_late, | ||
782 | .timer = &shmobile_timer, | 783 | .timer = &shmobile_timer, |
783 | .dt_compat = eva_boards_compat_dt, | 784 | .dt_compat = eva_boards_compat_dt, |
784 | MACHINE_END | 785 | MACHINE_END |
diff --git a/arch/arm/mach-shmobile/board-kzm9d.c b/arch/arm/mach-shmobile/board-kzm9d.c index 7bc5e7d39f9b..6a33cf393428 100644 --- a/arch/arm/mach-shmobile/board-kzm9d.c +++ b/arch/arm/mach-shmobile/board-kzm9d.c | |||
@@ -80,6 +80,7 @@ DT_MACHINE_START(KZM9D_DT, "kzm9d") | |||
80 | .init_irq = emev2_init_irq, | 80 | .init_irq = emev2_init_irq, |
81 | .handle_irq = gic_handle_irq, | 81 | .handle_irq = gic_handle_irq, |
82 | .init_machine = kzm9d_add_standard_devices, | 82 | .init_machine = kzm9d_add_standard_devices, |
83 | .init_late = shmobile_init_late, | ||
83 | .timer = &shmobile_timer, | 84 | .timer = &shmobile_timer, |
84 | .dt_compat = kzm9d_boards_compat_dt, | 85 | .dt_compat = kzm9d_boards_compat_dt, |
85 | MACHINE_END | 86 | MACHINE_END |
diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c index d8e33b682832..c0ae815e7beb 100644 --- a/arch/arm/mach-shmobile/board-kzm9g.c +++ b/arch/arm/mach-shmobile/board-kzm9g.c | |||
@@ -455,6 +455,7 @@ DT_MACHINE_START(KZM9G_DT, "kzm9g") | |||
455 | .init_irq = sh73a0_init_irq, | 455 | .init_irq = sh73a0_init_irq, |
456 | .handle_irq = gic_handle_irq, | 456 | .handle_irq = gic_handle_irq, |
457 | .init_machine = kzm_init, | 457 | .init_machine = kzm_init, |
458 | .init_late = shmobile_init_late, | ||
458 | .timer = &shmobile_timer, | 459 | .timer = &shmobile_timer, |
459 | .dt_compat = kzm9g_boards_compat_dt, | 460 | .dt_compat = kzm9g_boards_compat_dt, |
460 | MACHINE_END | 461 | MACHINE_END |
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c index b577f7c44678..150122a44630 100644 --- a/arch/arm/mach-shmobile/board-mackerel.c +++ b/arch/arm/mach-shmobile/board-mackerel.c | |||
@@ -1512,6 +1512,9 @@ static void __init mackerel_init(void) | |||
1512 | gpio_request(GPIO_FN_SDHID0_1, NULL); | 1512 | gpio_request(GPIO_FN_SDHID0_1, NULL); |
1513 | gpio_request(GPIO_FN_SDHID0_0, NULL); | 1513 | gpio_request(GPIO_FN_SDHID0_0, NULL); |
1514 | 1514 | ||
1515 | /* SDHI0 PORT172 card-detect IRQ26 */ | ||
1516 | gpio_request(GPIO_FN_IRQ26_172, NULL); | ||
1517 | |||
1515 | #if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE) | 1518 | #if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE) |
1516 | /* enable SDHI1 */ | 1519 | /* enable SDHI1 */ |
1517 | gpio_request(GPIO_FN_SDHICMD1, NULL); | 1520 | gpio_request(GPIO_FN_SDHICMD1, NULL); |
diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c index 472d1f5361e5..3946c4ba2aa8 100644 --- a/arch/arm/mach-shmobile/clock-sh73a0.c +++ b/arch/arm/mach-shmobile/clock-sh73a0.c | |||
@@ -475,9 +475,9 @@ static struct clk *late_main_clks[] = { | |||
475 | 475 | ||
476 | enum { MSTP001, | 476 | enum { MSTP001, |
477 | MSTP129, MSTP128, MSTP127, MSTP126, MSTP125, MSTP118, MSTP116, MSTP100, | 477 | MSTP129, MSTP128, MSTP127, MSTP126, MSTP125, MSTP118, MSTP116, MSTP100, |
478 | MSTP219, | 478 | MSTP219, MSTP218, |
479 | MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200, | 479 | MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200, |
480 | MSTP331, MSTP329, MSTP325, MSTP323, MSTP318, | 480 | MSTP331, MSTP329, MSTP325, MSTP323, |
481 | MSTP314, MSTP313, MSTP312, MSTP311, | 481 | MSTP314, MSTP313, MSTP312, MSTP311, |
482 | MSTP303, MSTP302, MSTP301, MSTP300, | 482 | MSTP303, MSTP302, MSTP301, MSTP300, |
483 | MSTP411, MSTP410, MSTP403, | 483 | MSTP411, MSTP410, MSTP403, |
@@ -497,6 +497,7 @@ static struct clk mstp_clks[MSTP_NR] = { | |||
497 | [MSTP116] = MSTP(&div4_clks[DIV4_HP], SMSTPCR1, 16, 0), /* IIC0 */ | 497 | [MSTP116] = MSTP(&div4_clks[DIV4_HP], SMSTPCR1, 16, 0), /* IIC0 */ |
498 | [MSTP100] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 0, 0), /* LCDC0 */ | 498 | [MSTP100] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 0, 0), /* LCDC0 */ |
499 | [MSTP219] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 19, 0), /* SCIFA7 */ | 499 | [MSTP219] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 19, 0), /* SCIFA7 */ |
500 | [MSTP218] = MSTP(&div4_clks[DIV4_HP], SMSTPCR2, 18, 0), /* SY-DMAC */ | ||
500 | [MSTP207] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 7, 0), /* SCIFA5 */ | 501 | [MSTP207] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 7, 0), /* SCIFA5 */ |
501 | [MSTP206] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 6, 0), /* SCIFB */ | 502 | [MSTP206] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 6, 0), /* SCIFB */ |
502 | [MSTP204] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 4, 0), /* SCIFA0 */ | 503 | [MSTP204] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 4, 0), /* SCIFA0 */ |
@@ -508,7 +509,6 @@ static struct clk mstp_clks[MSTP_NR] = { | |||
508 | [MSTP329] = MSTP(&r_clk, SMSTPCR3, 29, 0), /* CMT10 */ | 509 | [MSTP329] = MSTP(&r_clk, SMSTPCR3, 29, 0), /* CMT10 */ |
509 | [MSTP325] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR3, 25, 0), /* IrDA */ | 510 | [MSTP325] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR3, 25, 0), /* IrDA */ |
510 | [MSTP323] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 23, 0), /* IIC1 */ | 511 | [MSTP323] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 23, 0), /* IIC1 */ |
511 | [MSTP318] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 18, 0), /* SY-DMAC */ | ||
512 | [MSTP314] = MSTP(&div6_clks[DIV6_SDHI0], SMSTPCR3, 14, 0), /* SDHI0 */ | 512 | [MSTP314] = MSTP(&div6_clks[DIV6_SDHI0], SMSTPCR3, 14, 0), /* SDHI0 */ |
513 | [MSTP313] = MSTP(&div6_clks[DIV6_SDHI1], SMSTPCR3, 13, 0), /* SDHI1 */ | 513 | [MSTP313] = MSTP(&div6_clks[DIV6_SDHI1], SMSTPCR3, 13, 0), /* SDHI1 */ |
514 | [MSTP312] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 12, 0), /* MMCIF0 */ | 514 | [MSTP312] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 12, 0), /* MMCIF0 */ |
@@ -552,6 +552,7 @@ static struct clk_lookup lookups[] = { | |||
552 | CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP116]), /* I2C0 */ | 552 | CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP116]), /* I2C0 */ |
553 | CLKDEV_DEV_ID("sh_mobile_lcdc_fb.0", &mstp_clks[MSTP100]), /* LCDC0 */ | 553 | CLKDEV_DEV_ID("sh_mobile_lcdc_fb.0", &mstp_clks[MSTP100]), /* LCDC0 */ |
554 | CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP219]), /* SCIFA7 */ | 554 | CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP219]), /* SCIFA7 */ |
555 | CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP218]), /* SY-DMAC */ | ||
555 | CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP207]), /* SCIFA5 */ | 556 | CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP207]), /* SCIFA5 */ |
556 | CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP206]), /* SCIFB */ | 557 | CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP206]), /* SCIFB */ |
557 | CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), /* SCIFA0 */ | 558 | CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), /* SCIFA0 */ |
@@ -563,7 +564,6 @@ static struct clk_lookup lookups[] = { | |||
563 | CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[MSTP329]), /* CMT10 */ | 564 | CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[MSTP329]), /* CMT10 */ |
564 | CLKDEV_DEV_ID("sh_irda.0", &mstp_clks[MSTP325]), /* IrDA */ | 565 | CLKDEV_DEV_ID("sh_irda.0", &mstp_clks[MSTP325]), /* IrDA */ |
565 | CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]), /* I2C1 */ | 566 | CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]), /* I2C1 */ |
566 | CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP318]), /* SY-DMAC */ | ||
567 | CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]), /* SDHI0 */ | 567 | CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]), /* SDHI0 */ |
568 | CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]), /* SDHI1 */ | 568 | CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]), /* SDHI1 */ |
569 | CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[MSTP312]), /* MMCIF0 */ | 569 | CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[MSTP312]), /* MMCIF0 */ |
diff --git a/arch/arm/mach-shmobile/intc-r8a7779.c b/arch/arm/mach-shmobile/intc-r8a7779.c index 550b23df4fd4..f04fad4ec4fb 100644 --- a/arch/arm/mach-shmobile/intc-r8a7779.c +++ b/arch/arm/mach-shmobile/intc-r8a7779.c | |||
@@ -35,6 +35,9 @@ | |||
35 | #define INT2SMSKCR3 0xfe7822ac | 35 | #define INT2SMSKCR3 0xfe7822ac |
36 | #define INT2SMSKCR4 0xfe7822b0 | 36 | #define INT2SMSKCR4 0xfe7822b0 |
37 | 37 | ||
38 | #define INT2NTSR0 0xfe700060 | ||
39 | #define INT2NTSR1 0xfe700064 | ||
40 | |||
38 | static int r8a7779_set_wake(struct irq_data *data, unsigned int on) | 41 | static int r8a7779_set_wake(struct irq_data *data, unsigned int on) |
39 | { | 42 | { |
40 | return 0; /* always allow wakeup */ | 43 | return 0; /* always allow wakeup */ |
@@ -49,6 +52,10 @@ void __init r8a7779_init_irq(void) | |||
49 | gic_init(0, 29, gic_dist_base, gic_cpu_base); | 52 | gic_init(0, 29, gic_dist_base, gic_cpu_base); |
50 | gic_arch_extn.irq_set_wake = r8a7779_set_wake; | 53 | gic_arch_extn.irq_set_wake = r8a7779_set_wake; |
51 | 54 | ||
55 | /* route all interrupts to ARM */ | ||
56 | __raw_writel(0xffffffff, INT2NTSR0); | ||
57 | __raw_writel(0x3fffffff, INT2NTSR1); | ||
58 | |||
52 | /* unmask all known interrupts in INTCS2 */ | 59 | /* unmask all known interrupts in INTCS2 */ |
53 | __raw_writel(0xfffffff0, INT2SMSKCR0); | 60 | __raw_writel(0xfffffff0, INT2SMSKCR0); |
54 | __raw_writel(0xfff7ffff, INT2SMSKCR1); | 61 | __raw_writel(0xfff7ffff, INT2SMSKCR1); |
diff --git a/arch/arm/mach-shmobile/platsmp.c b/arch/arm/mach-shmobile/platsmp.c index bacdd667e3b1..e859fcdb3d58 100644 --- a/arch/arm/mach-shmobile/platsmp.c +++ b/arch/arm/mach-shmobile/platsmp.c | |||
@@ -25,7 +25,12 @@ | |||
25 | #define is_sh73a0() (machine_is_ag5evm() || machine_is_kota2() || \ | 25 | #define is_sh73a0() (machine_is_ag5evm() || machine_is_kota2() || \ |
26 | of_machine_is_compatible("renesas,sh73a0")) | 26 | of_machine_is_compatible("renesas,sh73a0")) |
27 | #define is_r8a7779() machine_is_marzen() | 27 | #define is_r8a7779() machine_is_marzen() |
28 | |||
29 | #ifdef CONFIG_ARCH_EMEV2 | ||
28 | #define is_emev2() of_machine_is_compatible("renesas,emev2") | 30 | #define is_emev2() of_machine_is_compatible("renesas,emev2") |
31 | #else | ||
32 | #define is_emev2() (0) | ||
33 | #endif | ||
29 | 34 | ||
30 | static unsigned int __init shmobile_smp_get_core_count(void) | 35 | static unsigned int __init shmobile_smp_get_core_count(void) |
31 | { | 36 | { |
diff --git a/arch/arm/mach-shmobile/setup-sh7372.c b/arch/arm/mach-shmobile/setup-sh7372.c index 6a4bd582c028..fafce9ce8218 100644 --- a/arch/arm/mach-shmobile/setup-sh7372.c +++ b/arch/arm/mach-shmobile/setup-sh7372.c | |||
@@ -484,7 +484,7 @@ static const struct sh_dmae_slave_config sh7372_dmae_slaves[] = { | |||
484 | }, | 484 | }, |
485 | }; | 485 | }; |
486 | 486 | ||
487 | #define SH7372_CHCLR 0x220 | 487 | #define SH7372_CHCLR (0x220 - 0x20) |
488 | 488 | ||
489 | static const struct sh_dmae_channel sh7372_dmae_channels[] = { | 489 | static const struct sh_dmae_channel sh7372_dmae_channels[] = { |
490 | { | 490 | { |
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index e5dad60b558b..cf4528d51774 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c | |||
@@ -791,6 +791,79 @@ void __init iotable_init(struct map_desc *io_desc, int nr) | |||
791 | } | 791 | } |
792 | } | 792 | } |
793 | 793 | ||
794 | #ifndef CONFIG_ARM_LPAE | ||
795 | |||
796 | /* | ||
797 | * The Linux PMD is made of two consecutive section entries covering 2MB | ||
798 | * (see definition in include/asm/pgtable-2level.h). However a call to | ||
799 | * create_mapping() may optimize static mappings by using individual | ||
800 | * 1MB section mappings. This leaves the actual PMD potentially half | ||
801 | * initialized if the top or bottom section entry isn't used, leaving it | ||
802 | * open to problems if a subsequent ioremap() or vmalloc() tries to use | ||
803 | * the virtual space left free by that unused section entry. | ||
804 | * | ||
805 | * Let's avoid the issue by inserting dummy vm entries covering the unused | ||
806 | * PMD halves once the static mappings are in place. | ||
807 | */ | ||
808 | |||
809 | static void __init pmd_empty_section_gap(unsigned long addr) | ||
810 | { | ||
811 | struct vm_struct *vm; | ||
812 | |||
813 | vm = early_alloc_aligned(sizeof(*vm), __alignof__(*vm)); | ||
814 | vm->addr = (void *)addr; | ||
815 | vm->size = SECTION_SIZE; | ||
816 | vm->flags = VM_IOREMAP | VM_ARM_STATIC_MAPPING; | ||
817 | vm->caller = pmd_empty_section_gap; | ||
818 | vm_area_add_early(vm); | ||
819 | } | ||
820 | |||
821 | static void __init fill_pmd_gaps(void) | ||
822 | { | ||
823 | struct vm_struct *vm; | ||
824 | unsigned long addr, next = 0; | ||
825 | pmd_t *pmd; | ||
826 | |||
827 | /* we're still single threaded hence no lock needed here */ | ||
828 | for (vm = vmlist; vm; vm = vm->next) { | ||
829 | if (!(vm->flags & VM_ARM_STATIC_MAPPING)) | ||
830 | continue; | ||
831 | addr = (unsigned long)vm->addr; | ||
832 | if (addr < next) | ||
833 | continue; | ||
834 | |||
835 | /* | ||
836 | * Check if this vm starts on an odd section boundary. | ||
837 | * If so and the first section entry for this PMD is free | ||
838 | * then we block the corresponding virtual address. | ||
839 | */ | ||
840 | if ((addr & ~PMD_MASK) == SECTION_SIZE) { | ||
841 | pmd = pmd_off_k(addr); | ||
842 | if (pmd_none(*pmd)) | ||
843 | pmd_empty_section_gap(addr & PMD_MASK); | ||
844 | } | ||
845 | |||
846 | /* | ||
847 | * Then check if this vm ends on an odd section boundary. | ||
848 | * If so and the second section entry for this PMD is empty | ||
849 | * then we block the corresponding virtual address. | ||
850 | */ | ||
851 | addr += vm->size; | ||
852 | if ((addr & ~PMD_MASK) == SECTION_SIZE) { | ||
853 | pmd = pmd_off_k(addr) + 1; | ||
854 | if (pmd_none(*pmd)) | ||
855 | pmd_empty_section_gap(addr); | ||
856 | } | ||
857 | |||
858 | /* no need to look at any vm entry until we hit the next PMD */ | ||
859 | next = (addr + PMD_SIZE - 1) & PMD_MASK; | ||
860 | } | ||
861 | } | ||
862 | |||
863 | #else | ||
864 | #define fill_pmd_gaps() do { } while (0) | ||
865 | #endif | ||
866 | |||
794 | static void * __initdata vmalloc_min = | 867 | static void * __initdata vmalloc_min = |
795 | (void *)(VMALLOC_END - (240 << 20) - VMALLOC_OFFSET); | 868 | (void *)(VMALLOC_END - (240 << 20) - VMALLOC_OFFSET); |
796 | 869 | ||
@@ -1072,6 +1145,7 @@ static void __init devicemaps_init(struct machine_desc *mdesc) | |||
1072 | */ | 1145 | */ |
1073 | if (mdesc->map_io) | 1146 | if (mdesc->map_io) |
1074 | mdesc->map_io(); | 1147 | mdesc->map_io(); |
1148 | fill_pmd_gaps(); | ||
1075 | 1149 | ||
1076 | /* | 1150 | /* |
1077 | * Finally flush the caches and tlb to ensure that we're in a | 1151 | * Finally flush the caches and tlb to ensure that we're in a |
diff --git a/arch/arm/plat-samsung/include/plat/map-s3c.h b/arch/arm/plat-samsung/include/plat/map-s3c.h index 7d048759b772..c0c70a895ca8 100644 --- a/arch/arm/plat-samsung/include/plat/map-s3c.h +++ b/arch/arm/plat-samsung/include/plat/map-s3c.h | |||
@@ -22,7 +22,7 @@ | |||
22 | #define S3C24XX_VA_WATCHDOG S3C_VA_WATCHDOG | 22 | #define S3C24XX_VA_WATCHDOG S3C_VA_WATCHDOG |
23 | 23 | ||
24 | #define S3C2412_VA_SSMC S3C_ADDR_CPU(0x00000000) | 24 | #define S3C2412_VA_SSMC S3C_ADDR_CPU(0x00000000) |
25 | #define S3C2412_VA_EBI S3C_ADDR_CPU(0x00010000) | 25 | #define S3C2412_VA_EBI S3C_ADDR_CPU(0x00100000) |
26 | 26 | ||
27 | #define S3C2410_PA_UART (0x50000000) | 27 | #define S3C2410_PA_UART (0x50000000) |
28 | #define S3C24XX_PA_UART S3C2410_PA_UART | 28 | #define S3C24XX_PA_UART S3C2410_PA_UART |
diff --git a/arch/arm/plat-samsung/include/plat/watchdog-reset.h b/arch/arm/plat-samsung/include/plat/watchdog-reset.h index f19aff19205c..bc4db9b04e36 100644 --- a/arch/arm/plat-samsung/include/plat/watchdog-reset.h +++ b/arch/arm/plat-samsung/include/plat/watchdog-reset.h | |||
@@ -25,7 +25,7 @@ static inline void arch_wdt_reset(void) | |||
25 | 25 | ||
26 | __raw_writel(0, S3C2410_WTCON); /* disable watchdog, to be safe */ | 26 | __raw_writel(0, S3C2410_WTCON); /* disable watchdog, to be safe */ |
27 | 27 | ||
28 | if (s3c2410_wdtclk) | 28 | if (!IS_ERR(s3c2410_wdtclk)) |
29 | clk_enable(s3c2410_wdtclk); | 29 | clk_enable(s3c2410_wdtclk); |
30 | 30 | ||
31 | /* put initial values into count and data */ | 31 | /* put initial values into count and data */ |
diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/hw_irq.h index 32b394f3b854..6eb75b80488c 100644 --- a/arch/powerpc/include/asm/hw_irq.h +++ b/arch/powerpc/include/asm/hw_irq.h | |||
@@ -103,6 +103,11 @@ static inline void hard_irq_disable(void) | |||
103 | /* include/linux/interrupt.h needs hard_irq_disable to be a macro */ | 103 | /* include/linux/interrupt.h needs hard_irq_disable to be a macro */ |
104 | #define hard_irq_disable hard_irq_disable | 104 | #define hard_irq_disable hard_irq_disable |
105 | 105 | ||
106 | static inline bool lazy_irq_pending(void) | ||
107 | { | ||
108 | return !!(get_paca()->irq_happened & ~PACA_IRQ_HARD_DIS); | ||
109 | } | ||
110 | |||
106 | /* | 111 | /* |
107 | * This is called by asynchronous interrupts to conditionally | 112 | * This is called by asynchronous interrupts to conditionally |
108 | * re-enable hard interrupts when soft-disabled after having | 113 | * re-enable hard interrupts when soft-disabled after having |
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S index ed1718feb9d9..5971c85df136 100644 --- a/arch/powerpc/kernel/entry_64.S +++ b/arch/powerpc/kernel/entry_64.S | |||
@@ -558,27 +558,54 @@ _GLOBAL(ret_from_except_lite) | |||
558 | mtmsrd r10,1 /* Update machine state */ | 558 | mtmsrd r10,1 /* Update machine state */ |
559 | #endif /* CONFIG_PPC_BOOK3E */ | 559 | #endif /* CONFIG_PPC_BOOK3E */ |
560 | 560 | ||
561 | #ifdef CONFIG_PREEMPT | ||
562 | clrrdi r9,r1,THREAD_SHIFT /* current_thread_info() */ | 561 | clrrdi r9,r1,THREAD_SHIFT /* current_thread_info() */ |
563 | li r0,_TIF_NEED_RESCHED /* bits to check */ | ||
564 | ld r3,_MSR(r1) | 562 | ld r3,_MSR(r1) |
565 | ld r4,TI_FLAGS(r9) | 563 | ld r4,TI_FLAGS(r9) |
566 | /* Move MSR_PR bit in r3 to _TIF_SIGPENDING position in r0 */ | ||
567 | rlwimi r0,r3,32+TIF_SIGPENDING-MSR_PR_LG,_TIF_SIGPENDING | ||
568 | and. r0,r4,r0 /* check NEED_RESCHED and maybe SIGPENDING */ | ||
569 | bne do_work | ||
570 | |||
571 | #else /* !CONFIG_PREEMPT */ | ||
572 | ld r3,_MSR(r1) /* Returning to user mode? */ | ||
573 | andi. r3,r3,MSR_PR | 564 | andi. r3,r3,MSR_PR |
574 | beq restore /* if not, just restore regs and return */ | 565 | beq resume_kernel |
575 | 566 | ||
576 | /* Check current_thread_info()->flags */ | 567 | /* Check current_thread_info()->flags */ |
568 | andi. r0,r4,_TIF_USER_WORK_MASK | ||
569 | beq restore | ||
570 | |||
571 | andi. r0,r4,_TIF_NEED_RESCHED | ||
572 | beq 1f | ||
573 | bl .restore_interrupts | ||
574 | bl .schedule | ||
575 | b .ret_from_except_lite | ||
576 | |||
577 | 1: bl .save_nvgprs | ||
578 | bl .restore_interrupts | ||
579 | addi r3,r1,STACK_FRAME_OVERHEAD | ||
580 | bl .do_notify_resume | ||
581 | b .ret_from_except | ||
582 | |||
583 | resume_kernel: | ||
584 | #ifdef CONFIG_PREEMPT | ||
585 | /* Check if we need to preempt */ | ||
586 | andi. r0,r4,_TIF_NEED_RESCHED | ||
587 | beq+ restore | ||
588 | /* Check that preempt_count() == 0 and interrupts are enabled */ | ||
589 | lwz r8,TI_PREEMPT(r9) | ||
590 | cmpwi cr1,r8,0 | ||
591 | ld r0,SOFTE(r1) | ||
592 | cmpdi r0,0 | ||
593 | crandc eq,cr1*4+eq,eq | ||
594 | bne restore | ||
595 | |||
596 | /* | ||
597 | * Here we are preempting the current task. We want to make | ||
598 | * sure we are soft-disabled first | ||
599 | */ | ||
600 | SOFT_DISABLE_INTS(r3,r4) | ||
601 | 1: bl .preempt_schedule_irq | ||
602 | |||
603 | /* Re-test flags and eventually loop */ | ||
577 | clrrdi r9,r1,THREAD_SHIFT | 604 | clrrdi r9,r1,THREAD_SHIFT |
578 | ld r4,TI_FLAGS(r9) | 605 | ld r4,TI_FLAGS(r9) |
579 | andi. r0,r4,_TIF_USER_WORK_MASK | 606 | andi. r0,r4,_TIF_NEED_RESCHED |
580 | bne do_work | 607 | bne 1b |
581 | #endif /* !CONFIG_PREEMPT */ | 608 | #endif /* CONFIG_PREEMPT */ |
582 | 609 | ||
583 | .globl fast_exc_return_irq | 610 | .globl fast_exc_return_irq |
584 | fast_exc_return_irq: | 611 | fast_exc_return_irq: |
@@ -759,50 +786,6 @@ restore_check_irq_replay: | |||
759 | #endif /* CONFIG_PPC_BOOK3E */ | 786 | #endif /* CONFIG_PPC_BOOK3E */ |
760 | 1: b .ret_from_except /* What else to do here ? */ | 787 | 1: b .ret_from_except /* What else to do here ? */ |
761 | 788 | ||
762 | |||
763 | |||
764 | 3: | ||
765 | do_work: | ||
766 | #ifdef CONFIG_PREEMPT | ||
767 | andi. r0,r3,MSR_PR /* Returning to user mode? */ | ||
768 | bne user_work | ||
769 | /* Check that preempt_count() == 0 and interrupts are enabled */ | ||
770 | lwz r8,TI_PREEMPT(r9) | ||
771 | cmpwi cr1,r8,0 | ||
772 | ld r0,SOFTE(r1) | ||
773 | cmpdi r0,0 | ||
774 | crandc eq,cr1*4+eq,eq | ||
775 | bne restore | ||
776 | |||
777 | /* | ||
778 | * Here we are preempting the current task. We want to make | ||
779 | * sure we are soft-disabled first | ||
780 | */ | ||
781 | SOFT_DISABLE_INTS(r3,r4) | ||
782 | 1: bl .preempt_schedule_irq | ||
783 | |||
784 | /* Re-test flags and eventually loop */ | ||
785 | clrrdi r9,r1,THREAD_SHIFT | ||
786 | ld r4,TI_FLAGS(r9) | ||
787 | andi. r0,r4,_TIF_NEED_RESCHED | ||
788 | bne 1b | ||
789 | b restore | ||
790 | |||
791 | user_work: | ||
792 | #endif /* CONFIG_PREEMPT */ | ||
793 | |||
794 | andi. r0,r4,_TIF_NEED_RESCHED | ||
795 | beq 1f | ||
796 | bl .restore_interrupts | ||
797 | bl .schedule | ||
798 | b .ret_from_except_lite | ||
799 | |||
800 | 1: bl .save_nvgprs | ||
801 | bl .restore_interrupts | ||
802 | addi r3,r1,STACK_FRAME_OVERHEAD | ||
803 | bl .do_notify_resume | ||
804 | b .ret_from_except | ||
805 | |||
806 | unrecov_restore: | 789 | unrecov_restore: |
807 | addi r3,r1,STACK_FRAME_OVERHEAD | 790 | addi r3,r1,STACK_FRAME_OVERHEAD |
808 | bl .unrecoverable_exception | 791 | bl .unrecoverable_exception |
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c index 7835a5e1ea5f..1b415027ec0e 100644 --- a/arch/powerpc/kernel/irq.c +++ b/arch/powerpc/kernel/irq.c | |||
@@ -277,7 +277,7 @@ EXPORT_SYMBOL(arch_local_irq_restore); | |||
277 | * NOTE: This is called with interrupts hard disabled but not marked | 277 | * NOTE: This is called with interrupts hard disabled but not marked |
278 | * as such in paca->irq_happened, so we need to resync this. | 278 | * as such in paca->irq_happened, so we need to resync this. |
279 | */ | 279 | */ |
280 | void restore_interrupts(void) | 280 | void notrace restore_interrupts(void) |
281 | { | 281 | { |
282 | if (irqs_disabled()) { | 282 | if (irqs_disabled()) { |
283 | local_paca->irq_happened |= PACA_IRQ_HARD_DIS; | 283 | local_paca->irq_happened |= PACA_IRQ_HARD_DIS; |
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c index 1b488e5305c5..0794a3017b1b 100644 --- a/arch/powerpc/kernel/prom_init.c +++ b/arch/powerpc/kernel/prom_init.c | |||
@@ -1312,7 +1312,7 @@ static struct opal_secondary_data { | |||
1312 | 1312 | ||
1313 | extern char opal_secondary_entry; | 1313 | extern char opal_secondary_entry; |
1314 | 1314 | ||
1315 | static void prom_query_opal(void) | 1315 | static void __init prom_query_opal(void) |
1316 | { | 1316 | { |
1317 | long rc; | 1317 | long rc; |
1318 | 1318 | ||
@@ -1436,7 +1436,7 @@ static void __init prom_opal_hold_cpus(void) | |||
1436 | prom_debug("prom_opal_hold_cpus: end...\n"); | 1436 | prom_debug("prom_opal_hold_cpus: end...\n"); |
1437 | } | 1437 | } |
1438 | 1438 | ||
1439 | static void prom_opal_takeover(void) | 1439 | static void __init prom_opal_takeover(void) |
1440 | { | 1440 | { |
1441 | struct opal_secondary_data *data = &RELOC(opal_secondary_data); | 1441 | struct opal_secondary_data *data = &RELOC(opal_secondary_data); |
1442 | struct opal_takeover_args *args = &data->args; | 1442 | struct opal_takeover_args *args = &data->args; |
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S index a84aafce2a12..a1044f43becd 100644 --- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S +++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S | |||
@@ -810,7 +810,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201) | |||
810 | lwz r3,VCORE_NAPPING_THREADS(r5) | 810 | lwz r3,VCORE_NAPPING_THREADS(r5) |
811 | lwz r4,VCPU_PTID(r9) | 811 | lwz r4,VCPU_PTID(r9) |
812 | li r0,1 | 812 | li r0,1 |
813 | sldi r0,r0,r4 | 813 | sld r0,r0,r4 |
814 | andc. r3,r3,r0 /* no sense IPI'ing ourselves */ | 814 | andc. r3,r3,r0 /* no sense IPI'ing ourselves */ |
815 | beq 43f | 815 | beq 43f |
816 | mulli r4,r4,PACA_SIZE /* get paca for thread 0 */ | 816 | mulli r4,r4,PACA_SIZE /* get paca for thread 0 */ |
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c index b6edbb3b4a54..6e8f677f5646 100644 --- a/arch/powerpc/mm/numa.c +++ b/arch/powerpc/mm/numa.c | |||
@@ -635,7 +635,7 @@ static inline int __init read_usm_ranges(const u32 **usm) | |||
635 | */ | 635 | */ |
636 | static void __init parse_drconf_memory(struct device_node *memory) | 636 | static void __init parse_drconf_memory(struct device_node *memory) |
637 | { | 637 | { |
638 | const u32 *dm, *usm; | 638 | const u32 *uninitialized_var(dm), *usm; |
639 | unsigned int n, rc, ranges, is_kexec_kdump = 0; | 639 | unsigned int n, rc, ranges, is_kexec_kdump = 0; |
640 | unsigned long lmb_size, base, size, sz; | 640 | unsigned long lmb_size, base, size, sz; |
641 | int nid; | 641 | int nid; |
diff --git a/arch/powerpc/net/bpf_jit_64.S b/arch/powerpc/net/bpf_jit_64.S index 55ba3855a97f..7d3a3b5619a2 100644 --- a/arch/powerpc/net/bpf_jit_64.S +++ b/arch/powerpc/net/bpf_jit_64.S | |||
@@ -105,6 +105,7 @@ sk_load_byte_msh_positive_offset: | |||
105 | mr r4, r_addr; \ | 105 | mr r4, r_addr; \ |
106 | li r6, SIZE; \ | 106 | li r6, SIZE; \ |
107 | bl skb_copy_bits; \ | 107 | bl skb_copy_bits; \ |
108 | nop; \ | ||
108 | /* R3 = 0 on success */ \ | 109 | /* R3 = 0 on success */ \ |
109 | addi r1, r1, BPF_PPC_SLOWPATH_FRAME; \ | 110 | addi r1, r1, BPF_PPC_SLOWPATH_FRAME; \ |
110 | ld r0, 16(r1); \ | 111 | ld r0, 16(r1); \ |
@@ -156,6 +157,7 @@ bpf_slow_path_byte_msh: | |||
156 | mr r4, r_addr; \ | 157 | mr r4, r_addr; \ |
157 | li r5, SIZE; \ | 158 | li r5, SIZE; \ |
158 | bl bpf_internal_load_pointer_neg_helper; \ | 159 | bl bpf_internal_load_pointer_neg_helper; \ |
160 | nop; \ | ||
159 | /* R3 != 0 on success */ \ | 161 | /* R3 != 0 on success */ \ |
160 | addi r1, r1, BPF_PPC_SLOWPATH_FRAME; \ | 162 | addi r1, r1, BPF_PPC_SLOWPATH_FRAME; \ |
161 | ld r0, 16(r1); \ | 163 | ld r0, 16(r1); \ |
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c index 0915b1ad66ce..2d311c0caf8e 100644 --- a/arch/powerpc/platforms/pseries/iommu.c +++ b/arch/powerpc/platforms/pseries/iommu.c | |||
@@ -106,7 +106,7 @@ static int tce_build_pSeries(struct iommu_table *tbl, long index, | |||
106 | tcep++; | 106 | tcep++; |
107 | } | 107 | } |
108 | 108 | ||
109 | if (tbl->it_type == TCE_PCI_SWINV_CREATE) | 109 | if (tbl->it_type & TCE_PCI_SWINV_CREATE) |
110 | tce_invalidate_pSeries_sw(tbl, tces, tcep - 1); | 110 | tce_invalidate_pSeries_sw(tbl, tces, tcep - 1); |
111 | return 0; | 111 | return 0; |
112 | } | 112 | } |
@@ -121,7 +121,7 @@ static void tce_free_pSeries(struct iommu_table *tbl, long index, long npages) | |||
121 | while (npages--) | 121 | while (npages--) |
122 | *(tcep++) = 0; | 122 | *(tcep++) = 0; |
123 | 123 | ||
124 | if (tbl->it_type == TCE_PCI_SWINV_FREE) | 124 | if (tbl->it_type & TCE_PCI_SWINV_FREE) |
125 | tce_invalidate_pSeries_sw(tbl, tces, tcep - 1); | 125 | tce_invalidate_pSeries_sw(tbl, tces, tcep - 1); |
126 | } | 126 | } |
127 | 127 | ||
diff --git a/arch/powerpc/platforms/pseries/processor_idle.c b/arch/powerpc/platforms/pseries/processor_idle.c index 41a34bc4a9a2..e61483e8e960 100644 --- a/arch/powerpc/platforms/pseries/processor_idle.c +++ b/arch/powerpc/platforms/pseries/processor_idle.c | |||
@@ -106,7 +106,7 @@ static void check_and_cede_processor(void) | |||
106 | * we first hard disable then check. | 106 | * we first hard disable then check. |
107 | */ | 107 | */ |
108 | hard_irq_disable(); | 108 | hard_irq_disable(); |
109 | if (get_paca()->irq_happened == 0) | 109 | if (!lazy_irq_pending()) |
110 | cede_processor(); | 110 | cede_processor(); |
111 | } | 111 | } |
112 | 112 | ||
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c index 0f3ab06d2222..eab3492a45c5 100644 --- a/arch/powerpc/xmon/xmon.c +++ b/arch/powerpc/xmon/xmon.c | |||
@@ -971,7 +971,7 @@ static int cpu_cmd(void) | |||
971 | /* print cpus waiting or in xmon */ | 971 | /* print cpus waiting or in xmon */ |
972 | printf("cpus stopped:"); | 972 | printf("cpus stopped:"); |
973 | count = 0; | 973 | count = 0; |
974 | for (cpu = 0; cpu < NR_CPUS; ++cpu) { | 974 | for_each_possible_cpu(cpu) { |
975 | if (cpumask_test_cpu(cpu, &cpus_in_xmon)) { | 975 | if (cpumask_test_cpu(cpu, &cpus_in_xmon)) { |
976 | if (count == 0) | 976 | if (count == 0) |
977 | printf(" %x", cpu); | 977 | printf(" %x", cpu); |
diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c index daeca56211e3..673ac9b63d6b 100644 --- a/arch/x86/ia32/ia32_signal.c +++ b/arch/x86/ia32/ia32_signal.c | |||
@@ -38,7 +38,7 @@ | |||
38 | int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from) | 38 | int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from) |
39 | { | 39 | { |
40 | int err = 0; | 40 | int err = 0; |
41 | bool ia32 = is_ia32_task(); | 41 | bool ia32 = test_thread_flag(TIF_IA32); |
42 | 42 | ||
43 | if (!access_ok(VERIFY_WRITE, to, sizeof(compat_siginfo_t))) | 43 | if (!access_ok(VERIFY_WRITE, to, sizeof(compat_siginfo_t))) |
44 | return -EFAULT; | 44 | return -EFAULT; |
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h index 340ee49961a6..f91e80f4f180 100644 --- a/arch/x86/include/asm/cpufeature.h +++ b/arch/x86/include/asm/cpufeature.h | |||
@@ -176,7 +176,7 @@ | |||
176 | #define X86_FEATURE_XSAVEOPT (7*32+ 4) /* Optimized Xsave */ | 176 | #define X86_FEATURE_XSAVEOPT (7*32+ 4) /* Optimized Xsave */ |
177 | #define X86_FEATURE_PLN (7*32+ 5) /* Intel Power Limit Notification */ | 177 | #define X86_FEATURE_PLN (7*32+ 5) /* Intel Power Limit Notification */ |
178 | #define X86_FEATURE_PTS (7*32+ 6) /* Intel Package Thermal Status */ | 178 | #define X86_FEATURE_PTS (7*32+ 6) /* Intel Package Thermal Status */ |
179 | #define X86_FEATURE_DTS (7*32+ 7) /* Digital Thermal Sensor */ | 179 | #define X86_FEATURE_DTHERM (7*32+ 7) /* Digital Thermal Sensor */ |
180 | #define X86_FEATURE_HW_PSTATE (7*32+ 8) /* AMD HW-PState */ | 180 | #define X86_FEATURE_HW_PSTATE (7*32+ 8) /* AMD HW-PState */ |
181 | 181 | ||
182 | /* Virtualization flags: Linux defined, word 8 */ | 182 | /* Virtualization flags: Linux defined, word 8 */ |
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index 8afb69319815..b2297e58c6ed 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c | |||
@@ -422,12 +422,14 @@ acpi_parse_int_src_ovr(struct acpi_subtable_header * header, | |||
422 | return 0; | 422 | return 0; |
423 | } | 423 | } |
424 | 424 | ||
425 | if (intsrc->source_irq == 0 && intsrc->global_irq == 2) { | 425 | if (intsrc->source_irq == 0) { |
426 | if (acpi_skip_timer_override) { | 426 | if (acpi_skip_timer_override) { |
427 | printk(PREFIX "BIOS IRQ0 pin2 override ignored.\n"); | 427 | printk(PREFIX "BIOS IRQ0 override ignored.\n"); |
428 | return 0; | 428 | return 0; |
429 | } | 429 | } |
430 | if (acpi_fix_pin2_polarity && (intsrc->inti_flags & ACPI_MADT_POLARITY_MASK)) { | 430 | |
431 | if ((intsrc->global_irq == 2) && acpi_fix_pin2_polarity | ||
432 | && (intsrc->inti_flags & ACPI_MADT_POLARITY_MASK)) { | ||
431 | intsrc->inti_flags &= ~ACPI_MADT_POLARITY_MASK; | 433 | intsrc->inti_flags &= ~ACPI_MADT_POLARITY_MASK; |
432 | printk(PREFIX "BIOS IRQ0 pin2 override: forcing polarity to high active.\n"); | 434 | printk(PREFIX "BIOS IRQ0 pin2 override: forcing polarity to high active.\n"); |
433 | } | 435 | } |
@@ -1334,17 +1336,12 @@ static int __init dmi_disable_acpi(const struct dmi_system_id *d) | |||
1334 | } | 1336 | } |
1335 | 1337 | ||
1336 | /* | 1338 | /* |
1337 | * Force ignoring BIOS IRQ0 pin2 override | 1339 | * Force ignoring BIOS IRQ0 override |
1338 | */ | 1340 | */ |
1339 | static int __init dmi_ignore_irq0_timer_override(const struct dmi_system_id *d) | 1341 | static int __init dmi_ignore_irq0_timer_override(const struct dmi_system_id *d) |
1340 | { | 1342 | { |
1341 | /* | ||
1342 | * The ati_ixp4x0_rev() early PCI quirk should have set | ||
1343 | * the acpi_skip_timer_override flag already: | ||
1344 | */ | ||
1345 | if (!acpi_skip_timer_override) { | 1343 | if (!acpi_skip_timer_override) { |
1346 | WARN(1, KERN_ERR "ati_ixp4x0 quirk not complete.\n"); | 1344 | pr_notice("%s detected: Ignoring BIOS IRQ0 override\n", |
1347 | pr_notice("%s detected: Ignoring BIOS IRQ0 pin2 override\n", | ||
1348 | d->ident); | 1345 | d->ident); |
1349 | acpi_skip_timer_override = 1; | 1346 | acpi_skip_timer_override = 1; |
1350 | } | 1347 | } |
@@ -1438,7 +1435,7 @@ static struct dmi_system_id __initdata acpi_dmi_table_late[] = { | |||
1438 | * is enabled. This input is incorrectly designated the | 1435 | * is enabled. This input is incorrectly designated the |
1439 | * ISA IRQ 0 via an interrupt source override even though | 1436 | * ISA IRQ 0 via an interrupt source override even though |
1440 | * it is wired to the output of the master 8259A and INTIN0 | 1437 | * it is wired to the output of the master 8259A and INTIN0 |
1441 | * is not connected at all. Force ignoring BIOS IRQ0 pin2 | 1438 | * is not connected at all. Force ignoring BIOS IRQ0 |
1442 | * override in that cases. | 1439 | * override in that cases. |
1443 | */ | 1440 | */ |
1444 | { | 1441 | { |
@@ -1473,6 +1470,14 @@ static struct dmi_system_id __initdata acpi_dmi_table_late[] = { | |||
1473 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq 6715b"), | 1470 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq 6715b"), |
1474 | }, | 1471 | }, |
1475 | }, | 1472 | }, |
1473 | { | ||
1474 | .callback = dmi_ignore_irq0_timer_override, | ||
1475 | .ident = "FUJITSU SIEMENS", | ||
1476 | .matches = { | ||
1477 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), | ||
1478 | DMI_MATCH(DMI_PRODUCT_NAME, "AMILO PRO V2030"), | ||
1479 | }, | ||
1480 | }, | ||
1476 | {} | 1481 | {} |
1477 | }; | 1482 | }; |
1478 | 1483 | ||
diff --git a/arch/x86/kernel/cpu/mkcapflags.pl b/arch/x86/kernel/cpu/mkcapflags.pl index dfea390e1608..c7b3fe2d72e0 100644 --- a/arch/x86/kernel/cpu/mkcapflags.pl +++ b/arch/x86/kernel/cpu/mkcapflags.pl | |||
@@ -1,4 +1,4 @@ | |||
1 | #!/usr/bin/perl | 1 | #!/usr/bin/perl -w |
2 | # | 2 | # |
3 | # Generate the x86_cap_flags[] array from include/asm-x86/cpufeature.h | 3 | # Generate the x86_cap_flags[] array from include/asm-x86/cpufeature.h |
4 | # | 4 | # |
@@ -11,22 +11,35 @@ open(OUT, "> $out\0") or die "$0: cannot create: $out: $!\n"; | |||
11 | print OUT "#include <asm/cpufeature.h>\n\n"; | 11 | print OUT "#include <asm/cpufeature.h>\n\n"; |
12 | print OUT "const char * const x86_cap_flags[NCAPINTS*32] = {\n"; | 12 | print OUT "const char * const x86_cap_flags[NCAPINTS*32] = {\n"; |
13 | 13 | ||
14 | %features = (); | ||
15 | $err = 0; | ||
16 | |||
14 | while (defined($line = <IN>)) { | 17 | while (defined($line = <IN>)) { |
15 | if ($line =~ /^\s*\#\s*define\s+(X86_FEATURE_(\S+))\s+(.*)$/) { | 18 | if ($line =~ /^\s*\#\s*define\s+(X86_FEATURE_(\S+))\s+(.*)$/) { |
16 | $macro = $1; | 19 | $macro = $1; |
17 | $feature = $2; | 20 | $feature = "\L$2"; |
18 | $tail = $3; | 21 | $tail = $3; |
19 | if ($tail =~ /\/\*\s*\"([^"]*)\".*\*\//) { | 22 | if ($tail =~ /\/\*\s*\"([^"]*)\".*\*\//) { |
20 | $feature = $1; | 23 | $feature = "\L$1"; |
21 | } | 24 | } |
22 | 25 | ||
23 | if ($feature ne '') { | 26 | next if ($feature eq ''); |
24 | printf OUT "\t%-32s = \"%s\",\n", | 27 | |
25 | "[$macro]", "\L$feature"; | 28 | if ($features{$feature}++) { |
29 | print STDERR "$in: duplicate feature name: $feature\n"; | ||
30 | $err++; | ||
26 | } | 31 | } |
32 | printf OUT "\t%-32s = \"%s\",\n", "[$macro]", $feature; | ||
27 | } | 33 | } |
28 | } | 34 | } |
29 | print OUT "};\n"; | 35 | print OUT "};\n"; |
30 | 36 | ||
31 | close(IN); | 37 | close(IN); |
32 | close(OUT); | 38 | close(OUT); |
39 | |||
40 | if ($err) { | ||
41 | unlink($out); | ||
42 | exit(1); | ||
43 | } | ||
44 | |||
45 | exit(0); | ||
diff --git a/arch/x86/kernel/cpu/scattered.c b/arch/x86/kernel/cpu/scattered.c index addf9e82a7f2..ee8e9abc859f 100644 --- a/arch/x86/kernel/cpu/scattered.c +++ b/arch/x86/kernel/cpu/scattered.c | |||
@@ -31,7 +31,7 @@ void __cpuinit init_scattered_cpuid_features(struct cpuinfo_x86 *c) | |||
31 | const struct cpuid_bit *cb; | 31 | const struct cpuid_bit *cb; |
32 | 32 | ||
33 | static const struct cpuid_bit __cpuinitconst cpuid_bits[] = { | 33 | static const struct cpuid_bit __cpuinitconst cpuid_bits[] = { |
34 | { X86_FEATURE_DTS, CR_EAX, 0, 0x00000006, 0 }, | 34 | { X86_FEATURE_DTHERM, CR_EAX, 0, 0x00000006, 0 }, |
35 | { X86_FEATURE_IDA, CR_EAX, 1, 0x00000006, 0 }, | 35 | { X86_FEATURE_IDA, CR_EAX, 1, 0x00000006, 0 }, |
36 | { X86_FEATURE_ARAT, CR_EAX, 2, 0x00000006, 0 }, | 36 | { X86_FEATURE_ARAT, CR_EAX, 2, 0x00000006, 0 }, |
37 | { X86_FEATURE_PLN, CR_EAX, 4, 0x00000006, 0 }, | 37 | { X86_FEATURE_PLN, CR_EAX, 4, 0x00000006, 0 }, |
diff --git a/arch/x86/kernel/kgdb.c b/arch/x86/kernel/kgdb.c index 8bfb6146f753..3f61904365cf 100644 --- a/arch/x86/kernel/kgdb.c +++ b/arch/x86/kernel/kgdb.c | |||
@@ -444,12 +444,12 @@ void kgdb_roundup_cpus(unsigned long flags) | |||
444 | 444 | ||
445 | /** | 445 | /** |
446 | * kgdb_arch_handle_exception - Handle architecture specific GDB packets. | 446 | * kgdb_arch_handle_exception - Handle architecture specific GDB packets. |
447 | * @vector: The error vector of the exception that happened. | 447 | * @e_vector: The error vector of the exception that happened. |
448 | * @signo: The signal number of the exception that happened. | 448 | * @signo: The signal number of the exception that happened. |
449 | * @err_code: The error code of the exception that happened. | 449 | * @err_code: The error code of the exception that happened. |
450 | * @remcom_in_buffer: The buffer of the packet we have read. | 450 | * @remcomInBuffer: The buffer of the packet we have read. |
451 | * @remcom_out_buffer: The buffer of %BUFMAX bytes to write a packet into. | 451 | * @remcomOutBuffer: The buffer of %BUFMAX bytes to write a packet into. |
452 | * @regs: The &struct pt_regs of the current process. | 452 | * @linux_regs: The &struct pt_regs of the current process. |
453 | * | 453 | * |
454 | * This function MUST handle the 'c' and 's' command packets, | 454 | * This function MUST handle the 'c' and 's' command packets, |
455 | * as well packets to set / remove a hardware breakpoint, if used. | 455 | * as well packets to set / remove a hardware breakpoint, if used. |
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c index 25b48edb847c..5de92f1abd76 100644 --- a/arch/x86/kernel/reboot.c +++ b/arch/x86/kernel/reboot.c | |||
@@ -451,6 +451,14 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = { | |||
451 | DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 990"), | 451 | DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 990"), |
452 | }, | 452 | }, |
453 | }, | 453 | }, |
454 | { /* Handle problems with rebooting on the Precision M6600. */ | ||
455 | .callback = set_pci_reboot, | ||
456 | .ident = "Dell OptiPlex 990", | ||
457 | .matches = { | ||
458 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | ||
459 | DMI_MATCH(DMI_PRODUCT_NAME, "Precision M6600"), | ||
460 | }, | ||
461 | }, | ||
454 | { } | 462 | { } |
455 | }; | 463 | }; |
456 | 464 | ||
diff --git a/arch/x86/lib/csum-wrappers_64.c b/arch/x86/lib/csum-wrappers_64.c index 459b58a8a15c..25b7ae8d058a 100644 --- a/arch/x86/lib/csum-wrappers_64.c +++ b/arch/x86/lib/csum-wrappers_64.c | |||
@@ -115,7 +115,7 @@ EXPORT_SYMBOL(csum_partial_copy_to_user); | |||
115 | * @src: source address | 115 | * @src: source address |
116 | * @dst: destination address | 116 | * @dst: destination address |
117 | * @len: number of bytes to be copied. | 117 | * @len: number of bytes to be copied. |
118 | * @isum: initial sum that is added into the result (32bit unfolded) | 118 | * @sum: initial sum that is added into the result (32bit unfolded) |
119 | * | 119 | * |
120 | * Returns an 32bit unfolded checksum of the buffer. | 120 | * Returns an 32bit unfolded checksum of the buffer. |
121 | */ | 121 | */ |
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 02cf6335e9bd..e7dee617358e 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c | |||
@@ -125,12 +125,8 @@ static struct blkcg_gq *blkg_alloc(struct blkcg *blkcg, struct request_queue *q) | |||
125 | 125 | ||
126 | blkg->pd[i] = pd; | 126 | blkg->pd[i] = pd; |
127 | pd->blkg = blkg; | 127 | pd->blkg = blkg; |
128 | } | ||
129 | |||
130 | /* invoke per-policy init */ | ||
131 | for (i = 0; i < BLKCG_MAX_POLS; i++) { | ||
132 | struct blkcg_policy *pol = blkcg_policy[i]; | ||
133 | 128 | ||
129 | /* invoke per-policy init */ | ||
134 | if (blkcg_policy_enabled(blkg->q, pol)) | 130 | if (blkcg_policy_enabled(blkg->q, pol)) |
135 | pol->pd_init_fn(blkg); | 131 | pol->pd_init_fn(blkg); |
136 | } | 132 | } |
@@ -245,10 +241,9 @@ EXPORT_SYMBOL_GPL(blkg_lookup_create); | |||
245 | 241 | ||
246 | static void blkg_destroy(struct blkcg_gq *blkg) | 242 | static void blkg_destroy(struct blkcg_gq *blkg) |
247 | { | 243 | { |
248 | struct request_queue *q = blkg->q; | ||
249 | struct blkcg *blkcg = blkg->blkcg; | 244 | struct blkcg *blkcg = blkg->blkcg; |
250 | 245 | ||
251 | lockdep_assert_held(q->queue_lock); | 246 | lockdep_assert_held(blkg->q->queue_lock); |
252 | lockdep_assert_held(&blkcg->lock); | 247 | lockdep_assert_held(&blkcg->lock); |
253 | 248 | ||
254 | /* Something wrong if we are trying to remove same group twice */ | 249 | /* Something wrong if we are trying to remove same group twice */ |
diff --git a/block/blk-core.c b/block/blk-core.c index 3c923a7aeb56..93eb3e4f88ce 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -361,9 +361,10 @@ EXPORT_SYMBOL(blk_put_queue); | |||
361 | */ | 361 | */ |
362 | void blk_drain_queue(struct request_queue *q, bool drain_all) | 362 | void blk_drain_queue(struct request_queue *q, bool drain_all) |
363 | { | 363 | { |
364 | int i; | ||
365 | |||
364 | while (true) { | 366 | while (true) { |
365 | bool drain = false; | 367 | bool drain = false; |
366 | int i; | ||
367 | 368 | ||
368 | spin_lock_irq(q->queue_lock); | 369 | spin_lock_irq(q->queue_lock); |
369 | 370 | ||
@@ -408,6 +409,18 @@ void blk_drain_queue(struct request_queue *q, bool drain_all) | |||
408 | break; | 409 | break; |
409 | msleep(10); | 410 | msleep(10); |
410 | } | 411 | } |
412 | |||
413 | /* | ||
414 | * With queue marked dead, any woken up waiter will fail the | ||
415 | * allocation path, so the wakeup chaining is lost and we're | ||
416 | * left with hung waiters. We need to wake up those waiters. | ||
417 | */ | ||
418 | if (q->request_fn) { | ||
419 | spin_lock_irq(q->queue_lock); | ||
420 | for (i = 0; i < ARRAY_SIZE(q->rq.wait); i++) | ||
421 | wake_up_all(&q->rq.wait[i]); | ||
422 | spin_unlock_irq(q->queue_lock); | ||
423 | } | ||
411 | } | 424 | } |
412 | 425 | ||
413 | /** | 426 | /** |
@@ -467,7 +480,6 @@ void blk_cleanup_queue(struct request_queue *q) | |||
467 | /* mark @q DEAD, no new request or merges will be allowed afterwards */ | 480 | /* mark @q DEAD, no new request or merges will be allowed afterwards */ |
468 | mutex_lock(&q->sysfs_lock); | 481 | mutex_lock(&q->sysfs_lock); |
469 | queue_flag_set_unlocked(QUEUE_FLAG_DEAD, q); | 482 | queue_flag_set_unlocked(QUEUE_FLAG_DEAD, q); |
470 | |||
471 | spin_lock_irq(lock); | 483 | spin_lock_irq(lock); |
472 | 484 | ||
473 | /* | 485 | /* |
@@ -485,10 +497,6 @@ void blk_cleanup_queue(struct request_queue *q) | |||
485 | queue_flag_set(QUEUE_FLAG_NOMERGES, q); | 497 | queue_flag_set(QUEUE_FLAG_NOMERGES, q); |
486 | queue_flag_set(QUEUE_FLAG_NOXMERGES, q); | 498 | queue_flag_set(QUEUE_FLAG_NOXMERGES, q); |
487 | queue_flag_set(QUEUE_FLAG_DEAD, q); | 499 | queue_flag_set(QUEUE_FLAG_DEAD, q); |
488 | |||
489 | if (q->queue_lock != &q->__queue_lock) | ||
490 | q->queue_lock = &q->__queue_lock; | ||
491 | |||
492 | spin_unlock_irq(lock); | 500 | spin_unlock_irq(lock); |
493 | mutex_unlock(&q->sysfs_lock); | 501 | mutex_unlock(&q->sysfs_lock); |
494 | 502 | ||
@@ -499,6 +507,11 @@ void blk_cleanup_queue(struct request_queue *q) | |||
499 | del_timer_sync(&q->backing_dev_info.laptop_mode_wb_timer); | 507 | del_timer_sync(&q->backing_dev_info.laptop_mode_wb_timer); |
500 | blk_sync_queue(q); | 508 | blk_sync_queue(q); |
501 | 509 | ||
510 | spin_lock_irq(lock); | ||
511 | if (q->queue_lock != &q->__queue_lock) | ||
512 | q->queue_lock = &q->__queue_lock; | ||
513 | spin_unlock_irq(lock); | ||
514 | |||
502 | /* @q is and will stay empty, shutdown and put */ | 515 | /* @q is and will stay empty, shutdown and put */ |
503 | blk_put_queue(q); | 516 | blk_put_queue(q); |
504 | } | 517 | } |
diff --git a/block/blk-timeout.c b/block/blk-timeout.c index 780354888958..6e4744cbfb56 100644 --- a/block/blk-timeout.c +++ b/block/blk-timeout.c | |||
@@ -197,44 +197,3 @@ void blk_add_timer(struct request *req) | |||
197 | mod_timer(&q->timeout, expiry); | 197 | mod_timer(&q->timeout, expiry); |
198 | } | 198 | } |
199 | 199 | ||
200 | /** | ||
201 | * blk_abort_queue -- Abort all request on given queue | ||
202 | * @queue: pointer to queue | ||
203 | * | ||
204 | */ | ||
205 | void blk_abort_queue(struct request_queue *q) | ||
206 | { | ||
207 | unsigned long flags; | ||
208 | struct request *rq, *tmp; | ||
209 | LIST_HEAD(list); | ||
210 | |||
211 | /* | ||
212 | * Not a request based block device, nothing to abort | ||
213 | */ | ||
214 | if (!q->request_fn) | ||
215 | return; | ||
216 | |||
217 | spin_lock_irqsave(q->queue_lock, flags); | ||
218 | |||
219 | elv_abort_queue(q); | ||
220 | |||
221 | /* | ||
222 | * Splice entries to local list, to avoid deadlocking if entries | ||
223 | * get readded to the timeout list by error handling | ||
224 | */ | ||
225 | list_splice_init(&q->timeout_list, &list); | ||
226 | |||
227 | list_for_each_entry_safe(rq, tmp, &list, timeout_list) | ||
228 | blk_abort_request(rq); | ||
229 | |||
230 | /* | ||
231 | * Occasionally, blk_abort_request() will return without | ||
232 | * deleting the element from the list. Make sure we add those back | ||
233 | * instead of leaving them on the local stack list. | ||
234 | */ | ||
235 | list_splice(&list, &q->timeout_list); | ||
236 | |||
237 | spin_unlock_irqrestore(q->queue_lock, flags); | ||
238 | |||
239 | } | ||
240 | EXPORT_SYMBOL_GPL(blk_abort_queue); | ||
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index 673c977cc2bf..fb52df9744f5 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
@@ -17,8 +17,6 @@ | |||
17 | #include "blk.h" | 17 | #include "blk.h" |
18 | #include "blk-cgroup.h" | 18 | #include "blk-cgroup.h" |
19 | 19 | ||
20 | static struct blkcg_policy blkcg_policy_cfq __maybe_unused; | ||
21 | |||
22 | /* | 20 | /* |
23 | * tunables | 21 | * tunables |
24 | */ | 22 | */ |
@@ -418,11 +416,6 @@ static inline struct cfq_group *pd_to_cfqg(struct blkg_policy_data *pd) | |||
418 | return pd ? container_of(pd, struct cfq_group, pd) : NULL; | 416 | return pd ? container_of(pd, struct cfq_group, pd) : NULL; |
419 | } | 417 | } |
420 | 418 | ||
421 | static inline struct cfq_group *blkg_to_cfqg(struct blkcg_gq *blkg) | ||
422 | { | ||
423 | return pd_to_cfqg(blkg_to_pd(blkg, &blkcg_policy_cfq)); | ||
424 | } | ||
425 | |||
426 | static inline struct blkcg_gq *cfqg_to_blkg(struct cfq_group *cfqg) | 419 | static inline struct blkcg_gq *cfqg_to_blkg(struct cfq_group *cfqg) |
427 | { | 420 | { |
428 | return pd_to_blkg(&cfqg->pd); | 421 | return pd_to_blkg(&cfqg->pd); |
@@ -572,6 +565,13 @@ static inline void cfqg_stats_update_avg_queue_size(struct cfq_group *cfqg) { } | |||
572 | 565 | ||
573 | #ifdef CONFIG_CFQ_GROUP_IOSCHED | 566 | #ifdef CONFIG_CFQ_GROUP_IOSCHED |
574 | 567 | ||
568 | static struct blkcg_policy blkcg_policy_cfq; | ||
569 | |||
570 | static inline struct cfq_group *blkg_to_cfqg(struct blkcg_gq *blkg) | ||
571 | { | ||
572 | return pd_to_cfqg(blkg_to_pd(blkg, &blkcg_policy_cfq)); | ||
573 | } | ||
574 | |||
575 | static inline void cfqg_get(struct cfq_group *cfqg) | 575 | static inline void cfqg_get(struct cfq_group *cfqg) |
576 | { | 576 | { |
577 | return blkg_get(cfqg_to_blkg(cfqg)); | 577 | return blkg_get(cfqg_to_blkg(cfqg)); |
@@ -3951,10 +3951,11 @@ static void cfq_exit_queue(struct elevator_queue *e) | |||
3951 | 3951 | ||
3952 | cfq_shutdown_timer_wq(cfqd); | 3952 | cfq_shutdown_timer_wq(cfqd); |
3953 | 3953 | ||
3954 | #ifndef CONFIG_CFQ_GROUP_IOSCHED | 3954 | #ifdef CONFIG_CFQ_GROUP_IOSCHED |
3955 | blkcg_deactivate_policy(q, &blkcg_policy_cfq); | ||
3956 | #else | ||
3955 | kfree(cfqd->root_group); | 3957 | kfree(cfqd->root_group); |
3956 | #endif | 3958 | #endif |
3957 | blkcg_deactivate_policy(q, &blkcg_policy_cfq); | ||
3958 | kfree(cfqd); | 3959 | kfree(cfqd); |
3959 | } | 3960 | } |
3960 | 3961 | ||
@@ -4194,14 +4195,15 @@ static int __init cfq_init(void) | |||
4194 | #ifdef CONFIG_CFQ_GROUP_IOSCHED | 4195 | #ifdef CONFIG_CFQ_GROUP_IOSCHED |
4195 | if (!cfq_group_idle) | 4196 | if (!cfq_group_idle) |
4196 | cfq_group_idle = 1; | 4197 | cfq_group_idle = 1; |
4197 | #else | ||
4198 | cfq_group_idle = 0; | ||
4199 | #endif | ||
4200 | 4198 | ||
4201 | ret = blkcg_policy_register(&blkcg_policy_cfq); | 4199 | ret = blkcg_policy_register(&blkcg_policy_cfq); |
4202 | if (ret) | 4200 | if (ret) |
4203 | return ret; | 4201 | return ret; |
4202 | #else | ||
4203 | cfq_group_idle = 0; | ||
4204 | #endif | ||
4204 | 4205 | ||
4206 | ret = -ENOMEM; | ||
4205 | cfq_pool = KMEM_CACHE(cfq_queue, 0); | 4207 | cfq_pool = KMEM_CACHE(cfq_queue, 0); |
4206 | if (!cfq_pool) | 4208 | if (!cfq_pool) |
4207 | goto err_pol_unreg; | 4209 | goto err_pol_unreg; |
@@ -4215,13 +4217,17 @@ static int __init cfq_init(void) | |||
4215 | err_free_pool: | 4217 | err_free_pool: |
4216 | kmem_cache_destroy(cfq_pool); | 4218 | kmem_cache_destroy(cfq_pool); |
4217 | err_pol_unreg: | 4219 | err_pol_unreg: |
4220 | #ifdef CONFIG_CFQ_GROUP_IOSCHED | ||
4218 | blkcg_policy_unregister(&blkcg_policy_cfq); | 4221 | blkcg_policy_unregister(&blkcg_policy_cfq); |
4222 | #endif | ||
4219 | return ret; | 4223 | return ret; |
4220 | } | 4224 | } |
4221 | 4225 | ||
4222 | static void __exit cfq_exit(void) | 4226 | static void __exit cfq_exit(void) |
4223 | { | 4227 | { |
4228 | #ifdef CONFIG_CFQ_GROUP_IOSCHED | ||
4224 | blkcg_policy_unregister(&blkcg_policy_cfq); | 4229 | blkcg_policy_unregister(&blkcg_policy_cfq); |
4230 | #endif | ||
4225 | elv_unregister(&iosched_cfq); | 4231 | elv_unregister(&iosched_cfq); |
4226 | kmem_cache_destroy(cfq_pool); | 4232 | kmem_cache_destroy(cfq_pool); |
4227 | } | 4233 | } |
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c index 260fa80ef575..9a87daa6f4fb 100644 --- a/block/scsi_ioctl.c +++ b/block/scsi_ioctl.c | |||
@@ -721,11 +721,14 @@ int scsi_verify_blk_ioctl(struct block_device *bd, unsigned int cmd) | |||
721 | break; | 721 | break; |
722 | } | 722 | } |
723 | 723 | ||
724 | if (capable(CAP_SYS_RAWIO)) | ||
725 | return 0; | ||
726 | |||
724 | /* In particular, rule out all resets and host-specific ioctls. */ | 727 | /* In particular, rule out all resets and host-specific ioctls. */ |
725 | printk_ratelimited(KERN_WARNING | 728 | printk_ratelimited(KERN_WARNING |
726 | "%s: sending ioctl %x to a partition!\n", current->comm, cmd); | 729 | "%s: sending ioctl %x to a partition!\n", current->comm, cmd); |
727 | 730 | ||
728 | return capable(CAP_SYS_RAWIO) ? 0 : -ENOIOCTLCMD; | 731 | return -ENOIOCTLCMD; |
729 | } | 732 | } |
730 | EXPORT_SYMBOL(scsi_verify_blk_ioctl); | 733 | EXPORT_SYMBOL(scsi_verify_blk_ioctl); |
731 | 734 | ||
diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c index a43fa1a57d57..1502c50273b5 100644 --- a/drivers/acpi/acpi_pad.c +++ b/drivers/acpi/acpi_pad.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #define ACPI_PROCESSOR_AGGREGATOR_DEVICE_NAME "Processor Aggregator" | 36 | #define ACPI_PROCESSOR_AGGREGATOR_DEVICE_NAME "Processor Aggregator" |
37 | #define ACPI_PROCESSOR_AGGREGATOR_NOTIFY 0x80 | 37 | #define ACPI_PROCESSOR_AGGREGATOR_NOTIFY 0x80 |
38 | static DEFINE_MUTEX(isolated_cpus_lock); | 38 | static DEFINE_MUTEX(isolated_cpus_lock); |
39 | static DEFINE_MUTEX(round_robin_lock); | ||
39 | 40 | ||
40 | static unsigned long power_saving_mwait_eax; | 41 | static unsigned long power_saving_mwait_eax; |
41 | 42 | ||
@@ -107,7 +108,7 @@ static void round_robin_cpu(unsigned int tsk_index) | |||
107 | if (!alloc_cpumask_var(&tmp, GFP_KERNEL)) | 108 | if (!alloc_cpumask_var(&tmp, GFP_KERNEL)) |
108 | return; | 109 | return; |
109 | 110 | ||
110 | mutex_lock(&isolated_cpus_lock); | 111 | mutex_lock(&round_robin_lock); |
111 | cpumask_clear(tmp); | 112 | cpumask_clear(tmp); |
112 | for_each_cpu(cpu, pad_busy_cpus) | 113 | for_each_cpu(cpu, pad_busy_cpus) |
113 | cpumask_or(tmp, tmp, topology_thread_cpumask(cpu)); | 114 | cpumask_or(tmp, tmp, topology_thread_cpumask(cpu)); |
@@ -116,7 +117,7 @@ static void round_robin_cpu(unsigned int tsk_index) | |||
116 | if (cpumask_empty(tmp)) | 117 | if (cpumask_empty(tmp)) |
117 | cpumask_andnot(tmp, cpu_online_mask, pad_busy_cpus); | 118 | cpumask_andnot(tmp, cpu_online_mask, pad_busy_cpus); |
118 | if (cpumask_empty(tmp)) { | 119 | if (cpumask_empty(tmp)) { |
119 | mutex_unlock(&isolated_cpus_lock); | 120 | mutex_unlock(&round_robin_lock); |
120 | return; | 121 | return; |
121 | } | 122 | } |
122 | for_each_cpu(cpu, tmp) { | 123 | for_each_cpu(cpu, tmp) { |
@@ -131,7 +132,7 @@ static void round_robin_cpu(unsigned int tsk_index) | |||
131 | tsk_in_cpu[tsk_index] = preferred_cpu; | 132 | tsk_in_cpu[tsk_index] = preferred_cpu; |
132 | cpumask_set_cpu(preferred_cpu, pad_busy_cpus); | 133 | cpumask_set_cpu(preferred_cpu, pad_busy_cpus); |
133 | cpu_weight[preferred_cpu]++; | 134 | cpu_weight[preferred_cpu]++; |
134 | mutex_unlock(&isolated_cpus_lock); | 135 | mutex_unlock(&round_robin_lock); |
135 | 136 | ||
136 | set_cpus_allowed_ptr(current, cpumask_of(preferred_cpu)); | 137 | set_cpus_allowed_ptr(current, cpumask_of(preferred_cpu)); |
137 | } | 138 | } |
diff --git a/drivers/acpi/apei/apei-base.c b/drivers/acpi/apei/apei-base.c index 5577762daee1..6686b1eaf13e 100644 --- a/drivers/acpi/apei/apei-base.c +++ b/drivers/acpi/apei/apei-base.c | |||
@@ -243,7 +243,7 @@ static int pre_map_gar_callback(struct apei_exec_context *ctx, | |||
243 | u8 ins = entry->instruction; | 243 | u8 ins = entry->instruction; |
244 | 244 | ||
245 | if (ctx->ins_table[ins].flags & APEI_EXEC_INS_ACCESS_REGISTER) | 245 | if (ctx->ins_table[ins].flags & APEI_EXEC_INS_ACCESS_REGISTER) |
246 | return acpi_os_map_generic_address(&entry->register_region); | 246 | return apei_map_generic_address(&entry->register_region); |
247 | 247 | ||
248 | return 0; | 248 | return 0; |
249 | } | 249 | } |
@@ -276,7 +276,7 @@ static int post_unmap_gar_callback(struct apei_exec_context *ctx, | |||
276 | u8 ins = entry->instruction; | 276 | u8 ins = entry->instruction; |
277 | 277 | ||
278 | if (ctx->ins_table[ins].flags & APEI_EXEC_INS_ACCESS_REGISTER) | 278 | if (ctx->ins_table[ins].flags & APEI_EXEC_INS_ACCESS_REGISTER) |
279 | acpi_os_unmap_generic_address(&entry->register_region); | 279 | apei_unmap_generic_address(&entry->register_region); |
280 | 280 | ||
281 | return 0; | 281 | return 0; |
282 | } | 282 | } |
@@ -606,6 +606,19 @@ static int apei_check_gar(struct acpi_generic_address *reg, u64 *paddr, | |||
606 | return 0; | 606 | return 0; |
607 | } | 607 | } |
608 | 608 | ||
609 | int apei_map_generic_address(struct acpi_generic_address *reg) | ||
610 | { | ||
611 | int rc; | ||
612 | u32 access_bit_width; | ||
613 | u64 address; | ||
614 | |||
615 | rc = apei_check_gar(reg, &address, &access_bit_width); | ||
616 | if (rc) | ||
617 | return rc; | ||
618 | return acpi_os_map_generic_address(reg); | ||
619 | } | ||
620 | EXPORT_SYMBOL_GPL(apei_map_generic_address); | ||
621 | |||
609 | /* read GAR in interrupt (including NMI) or process context */ | 622 | /* read GAR in interrupt (including NMI) or process context */ |
610 | int apei_read(u64 *val, struct acpi_generic_address *reg) | 623 | int apei_read(u64 *val, struct acpi_generic_address *reg) |
611 | { | 624 | { |
diff --git a/drivers/acpi/apei/apei-internal.h b/drivers/acpi/apei/apei-internal.h index cca240a33038..f220d642136e 100644 --- a/drivers/acpi/apei/apei-internal.h +++ b/drivers/acpi/apei/apei-internal.h | |||
@@ -7,6 +7,8 @@ | |||
7 | #define APEI_INTERNAL_H | 7 | #define APEI_INTERNAL_H |
8 | 8 | ||
9 | #include <linux/cper.h> | 9 | #include <linux/cper.h> |
10 | #include <linux/acpi.h> | ||
11 | #include <linux/acpi_io.h> | ||
10 | 12 | ||
11 | struct apei_exec_context; | 13 | struct apei_exec_context; |
12 | 14 | ||
@@ -68,6 +70,13 @@ static inline int apei_exec_run_optional(struct apei_exec_context *ctx, u8 actio | |||
68 | /* IP has been set in instruction function */ | 70 | /* IP has been set in instruction function */ |
69 | #define APEI_EXEC_SET_IP 1 | 71 | #define APEI_EXEC_SET_IP 1 |
70 | 72 | ||
73 | int apei_map_generic_address(struct acpi_generic_address *reg); | ||
74 | |||
75 | static inline void apei_unmap_generic_address(struct acpi_generic_address *reg) | ||
76 | { | ||
77 | acpi_os_unmap_generic_address(reg); | ||
78 | } | ||
79 | |||
71 | int apei_read(u64 *val, struct acpi_generic_address *reg); | 80 | int apei_read(u64 *val, struct acpi_generic_address *reg); |
72 | int apei_write(u64 val, struct acpi_generic_address *reg); | 81 | int apei_write(u64 val, struct acpi_generic_address *reg); |
73 | 82 | ||
diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index 9b3cac0abecc..1599566ed1fe 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c | |||
@@ -301,7 +301,7 @@ static struct ghes *ghes_new(struct acpi_hest_generic *generic) | |||
301 | if (!ghes) | 301 | if (!ghes) |
302 | return ERR_PTR(-ENOMEM); | 302 | return ERR_PTR(-ENOMEM); |
303 | ghes->generic = generic; | 303 | ghes->generic = generic; |
304 | rc = acpi_os_map_generic_address(&generic->error_status_address); | 304 | rc = apei_map_generic_address(&generic->error_status_address); |
305 | if (rc) | 305 | if (rc) |
306 | goto err_free; | 306 | goto err_free; |
307 | error_block_length = generic->error_block_length; | 307 | error_block_length = generic->error_block_length; |
@@ -321,7 +321,7 @@ static struct ghes *ghes_new(struct acpi_hest_generic *generic) | |||
321 | return ghes; | 321 | return ghes; |
322 | 322 | ||
323 | err_unmap: | 323 | err_unmap: |
324 | acpi_os_unmap_generic_address(&generic->error_status_address); | 324 | apei_unmap_generic_address(&generic->error_status_address); |
325 | err_free: | 325 | err_free: |
326 | kfree(ghes); | 326 | kfree(ghes); |
327 | return ERR_PTR(rc); | 327 | return ERR_PTR(rc); |
@@ -330,7 +330,7 @@ err_free: | |||
330 | static void ghes_fini(struct ghes *ghes) | 330 | static void ghes_fini(struct ghes *ghes) |
331 | { | 331 | { |
332 | kfree(ghes->estatus); | 332 | kfree(ghes->estatus); |
333 | acpi_os_unmap_generic_address(&ghes->generic->error_status_address); | 333 | apei_unmap_generic_address(&ghes->generic->error_status_address); |
334 | } | 334 | } |
335 | 335 | ||
336 | enum { | 336 | enum { |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index f3decb30223f..47a8caa89dbe 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -224,6 +224,7 @@ static void lapic_timer_state_broadcast(struct acpi_processor *pr, | |||
224 | /* | 224 | /* |
225 | * Suspend / resume control | 225 | * Suspend / resume control |
226 | */ | 226 | */ |
227 | static int acpi_idle_suspend; | ||
227 | static u32 saved_bm_rld; | 228 | static u32 saved_bm_rld; |
228 | 229 | ||
229 | static void acpi_idle_bm_rld_save(void) | 230 | static void acpi_idle_bm_rld_save(void) |
@@ -242,13 +243,21 @@ static void acpi_idle_bm_rld_restore(void) | |||
242 | 243 | ||
243 | int acpi_processor_suspend(struct acpi_device * device, pm_message_t state) | 244 | int acpi_processor_suspend(struct acpi_device * device, pm_message_t state) |
244 | { | 245 | { |
246 | if (acpi_idle_suspend == 1) | ||
247 | return 0; | ||
248 | |||
245 | acpi_idle_bm_rld_save(); | 249 | acpi_idle_bm_rld_save(); |
250 | acpi_idle_suspend = 1; | ||
246 | return 0; | 251 | return 0; |
247 | } | 252 | } |
248 | 253 | ||
249 | int acpi_processor_resume(struct acpi_device * device) | 254 | int acpi_processor_resume(struct acpi_device * device) |
250 | { | 255 | { |
256 | if (acpi_idle_suspend == 0) | ||
257 | return 0; | ||
258 | |||
251 | acpi_idle_bm_rld_restore(); | 259 | acpi_idle_bm_rld_restore(); |
260 | acpi_idle_suspend = 0; | ||
252 | return 0; | 261 | return 0; |
253 | } | 262 | } |
254 | 263 | ||
@@ -754,6 +763,12 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev, | |||
754 | 763 | ||
755 | local_irq_disable(); | 764 | local_irq_disable(); |
756 | 765 | ||
766 | if (acpi_idle_suspend) { | ||
767 | local_irq_enable(); | ||
768 | cpu_relax(); | ||
769 | return -EBUSY; | ||
770 | } | ||
771 | |||
757 | lapic_timer_state_broadcast(pr, cx, 1); | 772 | lapic_timer_state_broadcast(pr, cx, 1); |
758 | kt1 = ktime_get_real(); | 773 | kt1 = ktime_get_real(); |
759 | acpi_idle_do_entry(cx); | 774 | acpi_idle_do_entry(cx); |
@@ -823,6 +838,12 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, | |||
823 | 838 | ||
824 | local_irq_disable(); | 839 | local_irq_disable(); |
825 | 840 | ||
841 | if (acpi_idle_suspend) { | ||
842 | local_irq_enable(); | ||
843 | cpu_relax(); | ||
844 | return -EBUSY; | ||
845 | } | ||
846 | |||
826 | if (cx->entry_method != ACPI_CSTATE_FFH) { | 847 | if (cx->entry_method != ACPI_CSTATE_FFH) { |
827 | current_thread_info()->status &= ~TS_POLLING; | 848 | current_thread_info()->status &= ~TS_POLLING; |
828 | /* | 849 | /* |
@@ -907,14 +928,21 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, | |||
907 | drv, drv->safe_state_index); | 928 | drv, drv->safe_state_index); |
908 | } else { | 929 | } else { |
909 | local_irq_disable(); | 930 | local_irq_disable(); |
910 | acpi_safe_halt(); | 931 | if (!acpi_idle_suspend) |
932 | acpi_safe_halt(); | ||
911 | local_irq_enable(); | 933 | local_irq_enable(); |
912 | return -EINVAL; | 934 | return -EBUSY; |
913 | } | 935 | } |
914 | } | 936 | } |
915 | 937 | ||
916 | local_irq_disable(); | 938 | local_irq_disable(); |
917 | 939 | ||
940 | if (acpi_idle_suspend) { | ||
941 | local_irq_enable(); | ||
942 | cpu_relax(); | ||
943 | return -EBUSY; | ||
944 | } | ||
945 | |||
918 | if (cx->entry_method != ACPI_CSTATE_FFH) { | 946 | if (cx->entry_method != ACPI_CSTATE_FFH) { |
919 | current_thread_info()->status &= ~TS_POLLING; | 947 | current_thread_info()->status &= ~TS_POLLING; |
920 | /* | 948 | /* |
diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c index 9f66181c814e..240a24400976 100644 --- a/drivers/acpi/sysfs.c +++ b/drivers/acpi/sysfs.c | |||
@@ -173,7 +173,7 @@ static int param_set_trace_state(const char *val, struct kernel_param *kp) | |||
173 | { | 173 | { |
174 | int result = 0; | 174 | int result = 0; |
175 | 175 | ||
176 | if (!strncmp(val, "enable", strlen("enable") - 1)) { | 176 | if (!strncmp(val, "enable", strlen("enable"))) { |
177 | result = acpi_debug_trace(trace_method_name, trace_debug_level, | 177 | result = acpi_debug_trace(trace_method_name, trace_debug_level, |
178 | trace_debug_layer, 0); | 178 | trace_debug_layer, 0); |
179 | if (result) | 179 | if (result) |
@@ -181,7 +181,7 @@ static int param_set_trace_state(const char *val, struct kernel_param *kp) | |||
181 | goto exit; | 181 | goto exit; |
182 | } | 182 | } |
183 | 183 | ||
184 | if (!strncmp(val, "disable", strlen("disable") - 1)) { | 184 | if (!strncmp(val, "disable", strlen("disable"))) { |
185 | int name = 0; | 185 | int name = 0; |
186 | result = acpi_debug_trace((char *)&name, trace_debug_level, | 186 | result = acpi_debug_trace((char *)&name, trace_debug_level, |
187 | trace_debug_layer, 0); | 187 | trace_debug_layer, 0); |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index a576575617d7..1e0a9e17c31d 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -558,6 +558,8 @@ acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag) | |||
558 | union acpi_object arg0 = { ACPI_TYPE_INTEGER }; | 558 | union acpi_object arg0 = { ACPI_TYPE_INTEGER }; |
559 | struct acpi_object_list args = { 1, &arg0 }; | 559 | struct acpi_object_list args = { 1, &arg0 }; |
560 | 560 | ||
561 | if (!video->cap._DOS) | ||
562 | return 0; | ||
561 | 563 | ||
562 | if (bios_flag < 0 || bios_flag > 3 || lcd_flag < 0 || lcd_flag > 1) | 564 | if (bios_flag < 0 || bios_flag > 3 || lcd_flag < 0 || lcd_flag > 1) |
563 | return -EINVAL; | 565 | return -EINVAL; |
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index e0fb5b0435a3..9cb845e49334 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
@@ -1031,7 +1031,7 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async) | |||
1031 | dpm_wait_for_children(dev, async); | 1031 | dpm_wait_for_children(dev, async); |
1032 | 1032 | ||
1033 | if (async_error) | 1033 | if (async_error) |
1034 | return 0; | 1034 | goto Complete; |
1035 | 1035 | ||
1036 | pm_runtime_get_noresume(dev); | 1036 | pm_runtime_get_noresume(dev); |
1037 | if (pm_runtime_barrier(dev) && device_may_wakeup(dev)) | 1037 | if (pm_runtime_barrier(dev) && device_may_wakeup(dev)) |
@@ -1040,7 +1040,7 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async) | |||
1040 | if (pm_wakeup_pending()) { | 1040 | if (pm_wakeup_pending()) { |
1041 | pm_runtime_put_sync(dev); | 1041 | pm_runtime_put_sync(dev); |
1042 | async_error = -EBUSY; | 1042 | async_error = -EBUSY; |
1043 | return 0; | 1043 | goto Complete; |
1044 | } | 1044 | } |
1045 | 1045 | ||
1046 | device_lock(dev); | 1046 | device_lock(dev); |
@@ -1097,6 +1097,8 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async) | |||
1097 | } | 1097 | } |
1098 | 1098 | ||
1099 | device_unlock(dev); | 1099 | device_unlock(dev); |
1100 | |||
1101 | Complete: | ||
1100 | complete_all(&dev->power.completion); | 1102 | complete_all(&dev->power.completion); |
1101 | 1103 | ||
1102 | if (error) { | 1104 | if (error) { |
diff --git a/drivers/block/drbd/drbd_bitmap.c b/drivers/block/drbd/drbd_bitmap.c index b5c5ff53cb57..fcb956bb4b4c 100644 --- a/drivers/block/drbd/drbd_bitmap.c +++ b/drivers/block/drbd/drbd_bitmap.c | |||
@@ -1475,10 +1475,17 @@ void _drbd_bm_set_bits(struct drbd_conf *mdev, const unsigned long s, const unsi | |||
1475 | first_word = 0; | 1475 | first_word = 0; |
1476 | spin_lock_irq(&b->bm_lock); | 1476 | spin_lock_irq(&b->bm_lock); |
1477 | } | 1477 | } |
1478 | |||
1479 | /* last page (respectively only page, for first page == last page) */ | 1478 | /* last page (respectively only page, for first page == last page) */ |
1480 | last_word = MLPP(el >> LN2_BPL); | 1479 | last_word = MLPP(el >> LN2_BPL); |
1481 | bm_set_full_words_within_one_page(mdev->bitmap, last_page, first_word, last_word); | 1480 | |
1481 | /* consider bitmap->bm_bits = 32768, bitmap->bm_number_of_pages = 1. (or multiples). | ||
1482 | * ==> e = 32767, el = 32768, last_page = 2, | ||
1483 | * and now last_word = 0. | ||
1484 | * We do not want to touch last_page in this case, | ||
1485 | * as we did not allocate it, it is not present in bitmap->bm_pages. | ||
1486 | */ | ||
1487 | if (last_word) | ||
1488 | bm_set_full_words_within_one_page(mdev->bitmap, last_page, first_word, last_word); | ||
1482 | 1489 | ||
1483 | /* possibly trailing bits. | 1490 | /* possibly trailing bits. |
1484 | * example: (e & 63) == 63, el will be e+1. | 1491 | * example: (e & 63) == 63, el will be e+1. |
diff --git a/drivers/block/drbd/drbd_req.c b/drivers/block/drbd/drbd_req.c index 9c5c84946b05..8e93a6ac9bb6 100644 --- a/drivers/block/drbd/drbd_req.c +++ b/drivers/block/drbd/drbd_req.c | |||
@@ -472,12 +472,17 @@ int __req_mod(struct drbd_request *req, enum drbd_req_event what, | |||
472 | req->rq_state |= RQ_LOCAL_COMPLETED; | 472 | req->rq_state |= RQ_LOCAL_COMPLETED; |
473 | req->rq_state &= ~RQ_LOCAL_PENDING; | 473 | req->rq_state &= ~RQ_LOCAL_PENDING; |
474 | 474 | ||
475 | D_ASSERT(!(req->rq_state & RQ_NET_MASK)); | 475 | if (req->rq_state & RQ_LOCAL_ABORTED) { |
476 | _req_may_be_done(req, m); | ||
477 | break; | ||
478 | } | ||
476 | 479 | ||
477 | __drbd_chk_io_error(mdev, false); | 480 | __drbd_chk_io_error(mdev, false); |
478 | 481 | ||
479 | goto_queue_for_net_read: | 482 | goto_queue_for_net_read: |
480 | 483 | ||
484 | D_ASSERT(!(req->rq_state & RQ_NET_MASK)); | ||
485 | |||
481 | /* no point in retrying if there is no good remote data, | 486 | /* no point in retrying if there is no good remote data, |
482 | * or we have no connection. */ | 487 | * or we have no connection. */ |
483 | if (mdev->state.pdsk != D_UP_TO_DATE) { | 488 | if (mdev->state.pdsk != D_UP_TO_DATE) { |
@@ -765,6 +770,40 @@ static int drbd_may_do_local_read(struct drbd_conf *mdev, sector_t sector, int s | |||
765 | return 0 == drbd_bm_count_bits(mdev, sbnr, ebnr); | 770 | return 0 == drbd_bm_count_bits(mdev, sbnr, ebnr); |
766 | } | 771 | } |
767 | 772 | ||
773 | static void maybe_pull_ahead(struct drbd_conf *mdev) | ||
774 | { | ||
775 | int congested = 0; | ||
776 | |||
777 | /* If I don't even have good local storage, we can not reasonably try | ||
778 | * to pull ahead of the peer. We also need the local reference to make | ||
779 | * sure mdev->act_log is there. | ||
780 | * Note: caller has to make sure that net_conf is there. | ||
781 | */ | ||
782 | if (!get_ldev_if_state(mdev, D_UP_TO_DATE)) | ||
783 | return; | ||
784 | |||
785 | if (mdev->net_conf->cong_fill && | ||
786 | atomic_read(&mdev->ap_in_flight) >= mdev->net_conf->cong_fill) { | ||
787 | dev_info(DEV, "Congestion-fill threshold reached\n"); | ||
788 | congested = 1; | ||
789 | } | ||
790 | |||
791 | if (mdev->act_log->used >= mdev->net_conf->cong_extents) { | ||
792 | dev_info(DEV, "Congestion-extents threshold reached\n"); | ||
793 | congested = 1; | ||
794 | } | ||
795 | |||
796 | if (congested) { | ||
797 | queue_barrier(mdev); /* last barrier, after mirrored writes */ | ||
798 | |||
799 | if (mdev->net_conf->on_congestion == OC_PULL_AHEAD) | ||
800 | _drbd_set_state(_NS(mdev, conn, C_AHEAD), 0, NULL); | ||
801 | else /*mdev->net_conf->on_congestion == OC_DISCONNECT */ | ||
802 | _drbd_set_state(_NS(mdev, conn, C_DISCONNECTING), 0, NULL); | ||
803 | } | ||
804 | put_ldev(mdev); | ||
805 | } | ||
806 | |||
768 | static int drbd_make_request_common(struct drbd_conf *mdev, struct bio *bio, unsigned long start_time) | 807 | static int drbd_make_request_common(struct drbd_conf *mdev, struct bio *bio, unsigned long start_time) |
769 | { | 808 | { |
770 | const int rw = bio_rw(bio); | 809 | const int rw = bio_rw(bio); |
@@ -972,29 +1011,8 @@ allocate_barrier: | |||
972 | _req_mod(req, queue_for_send_oos); | 1011 | _req_mod(req, queue_for_send_oos); |
973 | 1012 | ||
974 | if (remote && | 1013 | if (remote && |
975 | mdev->net_conf->on_congestion != OC_BLOCK && mdev->agreed_pro_version >= 96) { | 1014 | mdev->net_conf->on_congestion != OC_BLOCK && mdev->agreed_pro_version >= 96) |
976 | int congested = 0; | 1015 | maybe_pull_ahead(mdev); |
977 | |||
978 | if (mdev->net_conf->cong_fill && | ||
979 | atomic_read(&mdev->ap_in_flight) >= mdev->net_conf->cong_fill) { | ||
980 | dev_info(DEV, "Congestion-fill threshold reached\n"); | ||
981 | congested = 1; | ||
982 | } | ||
983 | |||
984 | if (mdev->act_log->used >= mdev->net_conf->cong_extents) { | ||
985 | dev_info(DEV, "Congestion-extents threshold reached\n"); | ||
986 | congested = 1; | ||
987 | } | ||
988 | |||
989 | if (congested) { | ||
990 | queue_barrier(mdev); /* last barrier, after mirrored writes */ | ||
991 | |||
992 | if (mdev->net_conf->on_congestion == OC_PULL_AHEAD) | ||
993 | _drbd_set_state(_NS(mdev, conn, C_AHEAD), 0, NULL); | ||
994 | else /*mdev->net_conf->on_congestion == OC_DISCONNECT */ | ||
995 | _drbd_set_state(_NS(mdev, conn, C_DISCONNECTING), 0, NULL); | ||
996 | } | ||
997 | } | ||
998 | 1016 | ||
999 | spin_unlock_irq(&mdev->req_lock); | 1017 | spin_unlock_irq(&mdev->req_lock); |
1000 | kfree(b); /* if someone else has beaten us to it... */ | 1018 | kfree(b); /* if someone else has beaten us to it... */ |
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index cce7df367b79..553f43a90953 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
@@ -671,6 +671,7 @@ static void __reschedule_timeout(int drive, const char *message) | |||
671 | 671 | ||
672 | if (drive == current_reqD) | 672 | if (drive == current_reqD) |
673 | drive = current_drive; | 673 | drive = current_drive; |
674 | __cancel_delayed_work(&fd_timeout); | ||
674 | 675 | ||
675 | if (drive < 0 || drive >= N_DRIVE) { | 676 | if (drive < 0 || drive >= N_DRIVE) { |
676 | delay = 20UL * HZ; | 677 | delay = 20UL * HZ; |
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index 264bc77dcb91..a8fddeb3d638 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/kthread.h> | 37 | #include <linux/kthread.h> |
38 | #include <../drivers/ata/ahci.h> | 38 | #include <../drivers/ata/ahci.h> |
39 | #include <linux/export.h> | 39 | #include <linux/export.h> |
40 | #include <linux/debugfs.h> | ||
40 | #include "mtip32xx.h" | 41 | #include "mtip32xx.h" |
41 | 42 | ||
42 | #define HW_CMD_SLOT_SZ (MTIP_MAX_COMMAND_SLOTS * 32) | 43 | #define HW_CMD_SLOT_SZ (MTIP_MAX_COMMAND_SLOTS * 32) |
@@ -85,6 +86,7 @@ static int instance; | |||
85 | * allocated in mtip_init(). | 86 | * allocated in mtip_init(). |
86 | */ | 87 | */ |
87 | static int mtip_major; | 88 | static int mtip_major; |
89 | static struct dentry *dfs_parent; | ||
88 | 90 | ||
89 | static DEFINE_SPINLOCK(rssd_index_lock); | 91 | static DEFINE_SPINLOCK(rssd_index_lock); |
90 | static DEFINE_IDA(rssd_index_ida); | 92 | static DEFINE_IDA(rssd_index_ida); |
@@ -2546,7 +2548,7 @@ static struct scatterlist *mtip_hw_get_scatterlist(struct driver_data *dd, | |||
2546 | } | 2548 | } |
2547 | 2549 | ||
2548 | /* | 2550 | /* |
2549 | * Sysfs register/status dump. | 2551 | * Sysfs status dump. |
2550 | * | 2552 | * |
2551 | * @dev Pointer to the device structure, passed by the kernrel. | 2553 | * @dev Pointer to the device structure, passed by the kernrel. |
2552 | * @attr Pointer to the device_attribute structure passed by the kernel. | 2554 | * @attr Pointer to the device_attribute structure passed by the kernel. |
@@ -2555,45 +2557,68 @@ static struct scatterlist *mtip_hw_get_scatterlist(struct driver_data *dd, | |||
2555 | * return value | 2557 | * return value |
2556 | * The size, in bytes, of the data copied into buf. | 2558 | * The size, in bytes, of the data copied into buf. |
2557 | */ | 2559 | */ |
2558 | static ssize_t mtip_hw_show_registers(struct device *dev, | 2560 | static ssize_t mtip_hw_show_status(struct device *dev, |
2559 | struct device_attribute *attr, | 2561 | struct device_attribute *attr, |
2560 | char *buf) | 2562 | char *buf) |
2561 | { | 2563 | { |
2562 | u32 group_allocated; | ||
2563 | struct driver_data *dd = dev_to_disk(dev)->private_data; | 2564 | struct driver_data *dd = dev_to_disk(dev)->private_data; |
2564 | int size = 0; | 2565 | int size = 0; |
2566 | |||
2567 | if (test_bit(MTIP_DDF_OVER_TEMP_BIT, &dd->dd_flag)) | ||
2568 | size += sprintf(buf, "%s", "thermal_shutdown\n"); | ||
2569 | else if (test_bit(MTIP_DDF_WRITE_PROTECT_BIT, &dd->dd_flag)) | ||
2570 | size += sprintf(buf, "%s", "write_protect\n"); | ||
2571 | else | ||
2572 | size += sprintf(buf, "%s", "online\n"); | ||
2573 | |||
2574 | return size; | ||
2575 | } | ||
2576 | |||
2577 | static DEVICE_ATTR(status, S_IRUGO, mtip_hw_show_status, NULL); | ||
2578 | |||
2579 | static ssize_t mtip_hw_read_registers(struct file *f, char __user *ubuf, | ||
2580 | size_t len, loff_t *offset) | ||
2581 | { | ||
2582 | struct driver_data *dd = (struct driver_data *)f->private_data; | ||
2583 | char buf[MTIP_DFS_MAX_BUF_SIZE]; | ||
2584 | u32 group_allocated; | ||
2585 | int size = *offset; | ||
2565 | int n; | 2586 | int n; |
2566 | 2587 | ||
2567 | size += sprintf(&buf[size], "Hardware\n--------\n"); | 2588 | if (!len || size) |
2568 | size += sprintf(&buf[size], "S ACTive : [ 0x"); | 2589 | return 0; |
2590 | |||
2591 | if (size < 0) | ||
2592 | return -EINVAL; | ||
2593 | |||
2594 | size += sprintf(&buf[size], "H/ S ACTive : [ 0x"); | ||
2569 | 2595 | ||
2570 | for (n = dd->slot_groups-1; n >= 0; n--) | 2596 | for (n = dd->slot_groups-1; n >= 0; n--) |
2571 | size += sprintf(&buf[size], "%08X ", | 2597 | size += sprintf(&buf[size], "%08X ", |
2572 | readl(dd->port->s_active[n])); | 2598 | readl(dd->port->s_active[n])); |
2573 | 2599 | ||
2574 | size += sprintf(&buf[size], "]\n"); | 2600 | size += sprintf(&buf[size], "]\n"); |
2575 | size += sprintf(&buf[size], "Command Issue : [ 0x"); | 2601 | size += sprintf(&buf[size], "H/ Command Issue : [ 0x"); |
2576 | 2602 | ||
2577 | for (n = dd->slot_groups-1; n >= 0; n--) | 2603 | for (n = dd->slot_groups-1; n >= 0; n--) |
2578 | size += sprintf(&buf[size], "%08X ", | 2604 | size += sprintf(&buf[size], "%08X ", |
2579 | readl(dd->port->cmd_issue[n])); | 2605 | readl(dd->port->cmd_issue[n])); |
2580 | 2606 | ||
2581 | size += sprintf(&buf[size], "]\n"); | 2607 | size += sprintf(&buf[size], "]\n"); |
2582 | size += sprintf(&buf[size], "Completed : [ 0x"); | 2608 | size += sprintf(&buf[size], "H/ Completed : [ 0x"); |
2583 | 2609 | ||
2584 | for (n = dd->slot_groups-1; n >= 0; n--) | 2610 | for (n = dd->slot_groups-1; n >= 0; n--) |
2585 | size += sprintf(&buf[size], "%08X ", | 2611 | size += sprintf(&buf[size], "%08X ", |
2586 | readl(dd->port->completed[n])); | 2612 | readl(dd->port->completed[n])); |
2587 | 2613 | ||
2588 | size += sprintf(&buf[size], "]\n"); | 2614 | size += sprintf(&buf[size], "]\n"); |
2589 | size += sprintf(&buf[size], "PORT IRQ STAT : [ 0x%08X ]\n", | 2615 | size += sprintf(&buf[size], "H/ PORT IRQ STAT : [ 0x%08X ]\n", |
2590 | readl(dd->port->mmio + PORT_IRQ_STAT)); | 2616 | readl(dd->port->mmio + PORT_IRQ_STAT)); |
2591 | size += sprintf(&buf[size], "HOST IRQ STAT : [ 0x%08X ]\n", | 2617 | size += sprintf(&buf[size], "H/ HOST IRQ STAT : [ 0x%08X ]\n", |
2592 | readl(dd->mmio + HOST_IRQ_STAT)); | 2618 | readl(dd->mmio + HOST_IRQ_STAT)); |
2593 | size += sprintf(&buf[size], "\n"); | 2619 | size += sprintf(&buf[size], "\n"); |
2594 | 2620 | ||
2595 | size += sprintf(&buf[size], "Local\n-----\n"); | 2621 | size += sprintf(&buf[size], "L/ Allocated : [ 0x"); |
2596 | size += sprintf(&buf[size], "Allocated : [ 0x"); | ||
2597 | 2622 | ||
2598 | for (n = dd->slot_groups-1; n >= 0; n--) { | 2623 | for (n = dd->slot_groups-1; n >= 0; n--) { |
2599 | if (sizeof(long) > sizeof(u32)) | 2624 | if (sizeof(long) > sizeof(u32)) |
@@ -2605,7 +2630,7 @@ static ssize_t mtip_hw_show_registers(struct device *dev, | |||
2605 | } | 2630 | } |
2606 | size += sprintf(&buf[size], "]\n"); | 2631 | size += sprintf(&buf[size], "]\n"); |
2607 | 2632 | ||
2608 | size += sprintf(&buf[size], "Commands in Q: [ 0x"); | 2633 | size += sprintf(&buf[size], "L/ Commands in Q : [ 0x"); |
2609 | 2634 | ||
2610 | for (n = dd->slot_groups-1; n >= 0; n--) { | 2635 | for (n = dd->slot_groups-1; n >= 0; n--) { |
2611 | if (sizeof(long) > sizeof(u32)) | 2636 | if (sizeof(long) > sizeof(u32)) |
@@ -2617,44 +2642,53 @@ static ssize_t mtip_hw_show_registers(struct device *dev, | |||
2617 | } | 2642 | } |
2618 | size += sprintf(&buf[size], "]\n"); | 2643 | size += sprintf(&buf[size], "]\n"); |
2619 | 2644 | ||
2620 | return size; | 2645 | *offset = size <= len ? size : len; |
2646 | size = copy_to_user(ubuf, buf, *offset); | ||
2647 | if (size) | ||
2648 | return -EFAULT; | ||
2649 | |||
2650 | return *offset; | ||
2621 | } | 2651 | } |
2622 | 2652 | ||
2623 | static ssize_t mtip_hw_show_status(struct device *dev, | 2653 | static ssize_t mtip_hw_read_flags(struct file *f, char __user *ubuf, |
2624 | struct device_attribute *attr, | 2654 | size_t len, loff_t *offset) |
2625 | char *buf) | ||
2626 | { | 2655 | { |
2627 | struct driver_data *dd = dev_to_disk(dev)->private_data; | 2656 | struct driver_data *dd = (struct driver_data *)f->private_data; |
2628 | int size = 0; | 2657 | char buf[MTIP_DFS_MAX_BUF_SIZE]; |
2658 | int size = *offset; | ||
2629 | 2659 | ||
2630 | if (test_bit(MTIP_DDF_OVER_TEMP_BIT, &dd->dd_flag)) | 2660 | if (!len || size) |
2631 | size += sprintf(buf, "%s", "thermal_shutdown\n"); | 2661 | return 0; |
2632 | else if (test_bit(MTIP_DDF_WRITE_PROTECT_BIT, &dd->dd_flag)) | ||
2633 | size += sprintf(buf, "%s", "write_protect\n"); | ||
2634 | else | ||
2635 | size += sprintf(buf, "%s", "online\n"); | ||
2636 | |||
2637 | return size; | ||
2638 | } | ||
2639 | 2662 | ||
2640 | static ssize_t mtip_hw_show_flags(struct device *dev, | 2663 | if (size < 0) |
2641 | struct device_attribute *attr, | 2664 | return -EINVAL; |
2642 | char *buf) | ||
2643 | { | ||
2644 | struct driver_data *dd = dev_to_disk(dev)->private_data; | ||
2645 | int size = 0; | ||
2646 | 2665 | ||
2647 | size += sprintf(&buf[size], "Flag in port struct : [ %08lX ]\n", | 2666 | size += sprintf(&buf[size], "Flag-port : [ %08lX ]\n", |
2648 | dd->port->flags); | 2667 | dd->port->flags); |
2649 | size += sprintf(&buf[size], "Flag in dd struct : [ %08lX ]\n", | 2668 | size += sprintf(&buf[size], "Flag-dd : [ %08lX ]\n", |
2650 | dd->dd_flag); | 2669 | dd->dd_flag); |
2651 | 2670 | ||
2652 | return size; | 2671 | *offset = size <= len ? size : len; |
2672 | size = copy_to_user(ubuf, buf, *offset); | ||
2673 | if (size) | ||
2674 | return -EFAULT; | ||
2675 | |||
2676 | return *offset; | ||
2653 | } | 2677 | } |
2654 | 2678 | ||
2655 | static DEVICE_ATTR(registers, S_IRUGO, mtip_hw_show_registers, NULL); | 2679 | static const struct file_operations mtip_regs_fops = { |
2656 | static DEVICE_ATTR(status, S_IRUGO, mtip_hw_show_status, NULL); | 2680 | .owner = THIS_MODULE, |
2657 | static DEVICE_ATTR(flags, S_IRUGO, mtip_hw_show_flags, NULL); | 2681 | .open = simple_open, |
2682 | .read = mtip_hw_read_registers, | ||
2683 | .llseek = no_llseek, | ||
2684 | }; | ||
2685 | |||
2686 | static const struct file_operations mtip_flags_fops = { | ||
2687 | .owner = THIS_MODULE, | ||
2688 | .open = simple_open, | ||
2689 | .read = mtip_hw_read_flags, | ||
2690 | .llseek = no_llseek, | ||
2691 | }; | ||
2658 | 2692 | ||
2659 | /* | 2693 | /* |
2660 | * Create the sysfs related attributes. | 2694 | * Create the sysfs related attributes. |
@@ -2671,15 +2705,9 @@ static int mtip_hw_sysfs_init(struct driver_data *dd, struct kobject *kobj) | |||
2671 | if (!kobj || !dd) | 2705 | if (!kobj || !dd) |
2672 | return -EINVAL; | 2706 | return -EINVAL; |
2673 | 2707 | ||
2674 | if (sysfs_create_file(kobj, &dev_attr_registers.attr)) | ||
2675 | dev_warn(&dd->pdev->dev, | ||
2676 | "Error creating 'registers' sysfs entry\n"); | ||
2677 | if (sysfs_create_file(kobj, &dev_attr_status.attr)) | 2708 | if (sysfs_create_file(kobj, &dev_attr_status.attr)) |
2678 | dev_warn(&dd->pdev->dev, | 2709 | dev_warn(&dd->pdev->dev, |
2679 | "Error creating 'status' sysfs entry\n"); | 2710 | "Error creating 'status' sysfs entry\n"); |
2680 | if (sysfs_create_file(kobj, &dev_attr_flags.attr)) | ||
2681 | dev_warn(&dd->pdev->dev, | ||
2682 | "Error creating 'flags' sysfs entry\n"); | ||
2683 | return 0; | 2711 | return 0; |
2684 | } | 2712 | } |
2685 | 2713 | ||
@@ -2698,13 +2726,39 @@ static int mtip_hw_sysfs_exit(struct driver_data *dd, struct kobject *kobj) | |||
2698 | if (!kobj || !dd) | 2726 | if (!kobj || !dd) |
2699 | return -EINVAL; | 2727 | return -EINVAL; |
2700 | 2728 | ||
2701 | sysfs_remove_file(kobj, &dev_attr_registers.attr); | ||
2702 | sysfs_remove_file(kobj, &dev_attr_status.attr); | 2729 | sysfs_remove_file(kobj, &dev_attr_status.attr); |
2703 | sysfs_remove_file(kobj, &dev_attr_flags.attr); | ||
2704 | 2730 | ||
2705 | return 0; | 2731 | return 0; |
2706 | } | 2732 | } |
2707 | 2733 | ||
2734 | static int mtip_hw_debugfs_init(struct driver_data *dd) | ||
2735 | { | ||
2736 | if (!dfs_parent) | ||
2737 | return -1; | ||
2738 | |||
2739 | dd->dfs_node = debugfs_create_dir(dd->disk->disk_name, dfs_parent); | ||
2740 | if (IS_ERR_OR_NULL(dd->dfs_node)) { | ||
2741 | dev_warn(&dd->pdev->dev, | ||
2742 | "Error creating node %s under debugfs\n", | ||
2743 | dd->disk->disk_name); | ||
2744 | dd->dfs_node = NULL; | ||
2745 | return -1; | ||
2746 | } | ||
2747 | |||
2748 | debugfs_create_file("flags", S_IRUGO, dd->dfs_node, dd, | ||
2749 | &mtip_flags_fops); | ||
2750 | debugfs_create_file("registers", S_IRUGO, dd->dfs_node, dd, | ||
2751 | &mtip_regs_fops); | ||
2752 | |||
2753 | return 0; | ||
2754 | } | ||
2755 | |||
2756 | static void mtip_hw_debugfs_exit(struct driver_data *dd) | ||
2757 | { | ||
2758 | debugfs_remove_recursive(dd->dfs_node); | ||
2759 | } | ||
2760 | |||
2761 | |||
2708 | /* | 2762 | /* |
2709 | * Perform any init/resume time hardware setup | 2763 | * Perform any init/resume time hardware setup |
2710 | * | 2764 | * |
@@ -3730,6 +3784,7 @@ skip_create_disk: | |||
3730 | mtip_hw_sysfs_init(dd, kobj); | 3784 | mtip_hw_sysfs_init(dd, kobj); |
3731 | kobject_put(kobj); | 3785 | kobject_put(kobj); |
3732 | } | 3786 | } |
3787 | mtip_hw_debugfs_init(dd); | ||
3733 | 3788 | ||
3734 | if (dd->mtip_svc_handler) { | 3789 | if (dd->mtip_svc_handler) { |
3735 | set_bit(MTIP_DDF_INIT_DONE_BIT, &dd->dd_flag); | 3790 | set_bit(MTIP_DDF_INIT_DONE_BIT, &dd->dd_flag); |
@@ -3755,6 +3810,8 @@ start_service_thread: | |||
3755 | return rv; | 3810 | return rv; |
3756 | 3811 | ||
3757 | kthread_run_error: | 3812 | kthread_run_error: |
3813 | mtip_hw_debugfs_exit(dd); | ||
3814 | |||
3758 | /* Delete our gendisk. This also removes the device from /dev */ | 3815 | /* Delete our gendisk. This also removes the device from /dev */ |
3759 | del_gendisk(dd->disk); | 3816 | del_gendisk(dd->disk); |
3760 | 3817 | ||
@@ -3805,6 +3862,7 @@ static int mtip_block_remove(struct driver_data *dd) | |||
3805 | kobject_put(kobj); | 3862 | kobject_put(kobj); |
3806 | } | 3863 | } |
3807 | } | 3864 | } |
3865 | mtip_hw_debugfs_exit(dd); | ||
3808 | 3866 | ||
3809 | /* | 3867 | /* |
3810 | * Delete our gendisk structure. This also removes the device | 3868 | * Delete our gendisk structure. This also removes the device |
@@ -4152,10 +4210,20 @@ static int __init mtip_init(void) | |||
4152 | } | 4210 | } |
4153 | mtip_major = error; | 4211 | mtip_major = error; |
4154 | 4212 | ||
4213 | if (!dfs_parent) { | ||
4214 | dfs_parent = debugfs_create_dir("rssd", NULL); | ||
4215 | if (IS_ERR_OR_NULL(dfs_parent)) { | ||
4216 | printk(KERN_WARNING "Error creating debugfs parent\n"); | ||
4217 | dfs_parent = NULL; | ||
4218 | } | ||
4219 | } | ||
4220 | |||
4155 | /* Register our PCI operations. */ | 4221 | /* Register our PCI operations. */ |
4156 | error = pci_register_driver(&mtip_pci_driver); | 4222 | error = pci_register_driver(&mtip_pci_driver); |
4157 | if (error) | 4223 | if (error) { |
4224 | debugfs_remove(dfs_parent); | ||
4158 | unregister_blkdev(mtip_major, MTIP_DRV_NAME); | 4225 | unregister_blkdev(mtip_major, MTIP_DRV_NAME); |
4226 | } | ||
4159 | 4227 | ||
4160 | return error; | 4228 | return error; |
4161 | } | 4229 | } |
@@ -4172,6 +4240,8 @@ static int __init mtip_init(void) | |||
4172 | */ | 4240 | */ |
4173 | static void __exit mtip_exit(void) | 4241 | static void __exit mtip_exit(void) |
4174 | { | 4242 | { |
4243 | debugfs_remove_recursive(dfs_parent); | ||
4244 | |||
4175 | /* Release the allocated major block device number. */ | 4245 | /* Release the allocated major block device number. */ |
4176 | unregister_blkdev(mtip_major, MTIP_DRV_NAME); | 4246 | unregister_blkdev(mtip_major, MTIP_DRV_NAME); |
4177 | 4247 | ||
diff --git a/drivers/block/mtip32xx/mtip32xx.h b/drivers/block/mtip32xx/mtip32xx.h index b2c88da26b2a..f51fc23d17bb 100644 --- a/drivers/block/mtip32xx/mtip32xx.h +++ b/drivers/block/mtip32xx/mtip32xx.h | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/ata.h> | 26 | #include <linux/ata.h> |
27 | #include <linux/interrupt.h> | 27 | #include <linux/interrupt.h> |
28 | #include <linux/genhd.h> | 28 | #include <linux/genhd.h> |
29 | #include <linux/version.h> | ||
30 | 29 | ||
31 | /* Offset of Subsystem Device ID in pci confoguration space */ | 30 | /* Offset of Subsystem Device ID in pci confoguration space */ |
32 | #define PCI_SUBSYSTEM_DEVICEID 0x2E | 31 | #define PCI_SUBSYSTEM_DEVICEID 0x2E |
@@ -111,6 +110,8 @@ | |||
111 | #define dbg_printk(format, arg...) | 110 | #define dbg_printk(format, arg...) |
112 | #endif | 111 | #endif |
113 | 112 | ||
113 | #define MTIP_DFS_MAX_BUF_SIZE 1024 | ||
114 | |||
114 | #define __force_bit2int (unsigned int __force) | 115 | #define __force_bit2int (unsigned int __force) |
115 | 116 | ||
116 | enum { | 117 | enum { |
@@ -447,6 +448,8 @@ struct driver_data { | |||
447 | unsigned long dd_flag; /* NOTE: use atomic bit operations on this */ | 448 | unsigned long dd_flag; /* NOTE: use atomic bit operations on this */ |
448 | 449 | ||
449 | struct task_struct *mtip_svc_handler; /* task_struct of svc thd */ | 450 | struct task_struct *mtip_svc_handler; /* task_struct of svc thd */ |
451 | |||
452 | struct dentry *dfs_node; | ||
450 | }; | 453 | }; |
451 | 454 | ||
452 | #endif | 455 | #endif |
diff --git a/drivers/block/umem.c b/drivers/block/umem.c index aa2712060bfb..9a72277a31df 100644 --- a/drivers/block/umem.c +++ b/drivers/block/umem.c | |||
@@ -513,6 +513,44 @@ static void process_page(unsigned long data) | |||
513 | } | 513 | } |
514 | } | 514 | } |
515 | 515 | ||
516 | struct mm_plug_cb { | ||
517 | struct blk_plug_cb cb; | ||
518 | struct cardinfo *card; | ||
519 | }; | ||
520 | |||
521 | static void mm_unplug(struct blk_plug_cb *cb) | ||
522 | { | ||
523 | struct mm_plug_cb *mmcb = container_of(cb, struct mm_plug_cb, cb); | ||
524 | |||
525 | spin_lock_irq(&mmcb->card->lock); | ||
526 | activate(mmcb->card); | ||
527 | spin_unlock_irq(&mmcb->card->lock); | ||
528 | kfree(mmcb); | ||
529 | } | ||
530 | |||
531 | static int mm_check_plugged(struct cardinfo *card) | ||
532 | { | ||
533 | struct blk_plug *plug = current->plug; | ||
534 | struct mm_plug_cb *mmcb; | ||
535 | |||
536 | if (!plug) | ||
537 | return 0; | ||
538 | |||
539 | list_for_each_entry(mmcb, &plug->cb_list, cb.list) { | ||
540 | if (mmcb->cb.callback == mm_unplug && mmcb->card == card) | ||
541 | return 1; | ||
542 | } | ||
543 | /* Not currently on the callback list */ | ||
544 | mmcb = kmalloc(sizeof(*mmcb), GFP_ATOMIC); | ||
545 | if (!mmcb) | ||
546 | return 0; | ||
547 | |||
548 | mmcb->card = card; | ||
549 | mmcb->cb.callback = mm_unplug; | ||
550 | list_add(&mmcb->cb.list, &plug->cb_list); | ||
551 | return 1; | ||
552 | } | ||
553 | |||
516 | static void mm_make_request(struct request_queue *q, struct bio *bio) | 554 | static void mm_make_request(struct request_queue *q, struct bio *bio) |
517 | { | 555 | { |
518 | struct cardinfo *card = q->queuedata; | 556 | struct cardinfo *card = q->queuedata; |
@@ -523,6 +561,8 @@ static void mm_make_request(struct request_queue *q, struct bio *bio) | |||
523 | *card->biotail = bio; | 561 | *card->biotail = bio; |
524 | bio->bi_next = NULL; | 562 | bio->bi_next = NULL; |
525 | card->biotail = &bio->bi_next; | 563 | card->biotail = &bio->bi_next; |
564 | if (bio->bi_rw & REQ_SYNC || !mm_check_plugged(card)) | ||
565 | activate(card); | ||
526 | spin_unlock_irq(&card->lock); | 566 | spin_unlock_irq(&card->lock); |
527 | 567 | ||
528 | return; | 568 | return; |
diff --git a/drivers/block/xen-blkback/common.h b/drivers/block/xen-blkback/common.h index 773cf27dc23f..9ad3b5ec1dc1 100644 --- a/drivers/block/xen-blkback/common.h +++ b/drivers/block/xen-blkback/common.h | |||
@@ -257,6 +257,7 @@ static inline void blkif_get_x86_32_req(struct blkif_request *dst, | |||
257 | break; | 257 | break; |
258 | case BLKIF_OP_DISCARD: | 258 | case BLKIF_OP_DISCARD: |
259 | dst->u.discard.flag = src->u.discard.flag; | 259 | dst->u.discard.flag = src->u.discard.flag; |
260 | dst->u.discard.id = src->u.discard.id; | ||
260 | dst->u.discard.sector_number = src->u.discard.sector_number; | 261 | dst->u.discard.sector_number = src->u.discard.sector_number; |
261 | dst->u.discard.nr_sectors = src->u.discard.nr_sectors; | 262 | dst->u.discard.nr_sectors = src->u.discard.nr_sectors; |
262 | break; | 263 | break; |
@@ -287,6 +288,7 @@ static inline void blkif_get_x86_64_req(struct blkif_request *dst, | |||
287 | break; | 288 | break; |
288 | case BLKIF_OP_DISCARD: | 289 | case BLKIF_OP_DISCARD: |
289 | dst->u.discard.flag = src->u.discard.flag; | 290 | dst->u.discard.flag = src->u.discard.flag; |
291 | dst->u.discard.id = src->u.discard.id; | ||
290 | dst->u.discard.sector_number = src->u.discard.sector_number; | 292 | dst->u.discard.sector_number = src->u.discard.sector_number; |
291 | dst->u.discard.nr_sectors = src->u.discard.nr_sectors; | 293 | dst->u.discard.nr_sectors = src->u.discard.nr_sectors; |
292 | break; | 294 | break; |
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index 60eed4bdd2e4..e4fb3374dcd2 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c | |||
@@ -141,14 +141,36 @@ static int get_id_from_freelist(struct blkfront_info *info) | |||
141 | return free; | 141 | return free; |
142 | } | 142 | } |
143 | 143 | ||
144 | static void add_id_to_freelist(struct blkfront_info *info, | 144 | static int add_id_to_freelist(struct blkfront_info *info, |
145 | unsigned long id) | 145 | unsigned long id) |
146 | { | 146 | { |
147 | if (info->shadow[id].req.u.rw.id != id) | ||
148 | return -EINVAL; | ||
149 | if (info->shadow[id].request == NULL) | ||
150 | return -EINVAL; | ||
147 | info->shadow[id].req.u.rw.id = info->shadow_free; | 151 | info->shadow[id].req.u.rw.id = info->shadow_free; |
148 | info->shadow[id].request = NULL; | 152 | info->shadow[id].request = NULL; |
149 | info->shadow_free = id; | 153 | info->shadow_free = id; |
154 | return 0; | ||
150 | } | 155 | } |
151 | 156 | ||
157 | static const char *op_name(int op) | ||
158 | { | ||
159 | static const char *const names[] = { | ||
160 | [BLKIF_OP_READ] = "read", | ||
161 | [BLKIF_OP_WRITE] = "write", | ||
162 | [BLKIF_OP_WRITE_BARRIER] = "barrier", | ||
163 | [BLKIF_OP_FLUSH_DISKCACHE] = "flush", | ||
164 | [BLKIF_OP_DISCARD] = "discard" }; | ||
165 | |||
166 | if (op < 0 || op >= ARRAY_SIZE(names)) | ||
167 | return "unknown"; | ||
168 | |||
169 | if (!names[op]) | ||
170 | return "reserved"; | ||
171 | |||
172 | return names[op]; | ||
173 | } | ||
152 | static int xlbd_reserve_minors(unsigned int minor, unsigned int nr) | 174 | static int xlbd_reserve_minors(unsigned int minor, unsigned int nr) |
153 | { | 175 | { |
154 | unsigned int end = minor + nr; | 176 | unsigned int end = minor + nr; |
@@ -746,20 +768,36 @@ static irqreturn_t blkif_interrupt(int irq, void *dev_id) | |||
746 | 768 | ||
747 | bret = RING_GET_RESPONSE(&info->ring, i); | 769 | bret = RING_GET_RESPONSE(&info->ring, i); |
748 | id = bret->id; | 770 | id = bret->id; |
771 | /* | ||
772 | * The backend has messed up and given us an id that we would | ||
773 | * never have given to it (we stamp it up to BLK_RING_SIZE - | ||
774 | * look in get_id_from_freelist. | ||
775 | */ | ||
776 | if (id >= BLK_RING_SIZE) { | ||
777 | WARN(1, "%s: response to %s has incorrect id (%ld)\n", | ||
778 | info->gd->disk_name, op_name(bret->operation), id); | ||
779 | /* We can't safely get the 'struct request' as | ||
780 | * the id is busted. */ | ||
781 | continue; | ||
782 | } | ||
749 | req = info->shadow[id].request; | 783 | req = info->shadow[id].request; |
750 | 784 | ||
751 | if (bret->operation != BLKIF_OP_DISCARD) | 785 | if (bret->operation != BLKIF_OP_DISCARD) |
752 | blkif_completion(&info->shadow[id]); | 786 | blkif_completion(&info->shadow[id]); |
753 | 787 | ||
754 | add_id_to_freelist(info, id); | 788 | if (add_id_to_freelist(info, id)) { |
789 | WARN(1, "%s: response to %s (id %ld) couldn't be recycled!\n", | ||
790 | info->gd->disk_name, op_name(bret->operation), id); | ||
791 | continue; | ||
792 | } | ||
755 | 793 | ||
756 | error = (bret->status == BLKIF_RSP_OKAY) ? 0 : -EIO; | 794 | error = (bret->status == BLKIF_RSP_OKAY) ? 0 : -EIO; |
757 | switch (bret->operation) { | 795 | switch (bret->operation) { |
758 | case BLKIF_OP_DISCARD: | 796 | case BLKIF_OP_DISCARD: |
759 | if (unlikely(bret->status == BLKIF_RSP_EOPNOTSUPP)) { | 797 | if (unlikely(bret->status == BLKIF_RSP_EOPNOTSUPP)) { |
760 | struct request_queue *rq = info->rq; | 798 | struct request_queue *rq = info->rq; |
761 | printk(KERN_WARNING "blkfront: %s: discard op failed\n", | 799 | printk(KERN_WARNING "blkfront: %s: %s op failed\n", |
762 | info->gd->disk_name); | 800 | info->gd->disk_name, op_name(bret->operation)); |
763 | error = -EOPNOTSUPP; | 801 | error = -EOPNOTSUPP; |
764 | info->feature_discard = 0; | 802 | info->feature_discard = 0; |
765 | info->feature_secdiscard = 0; | 803 | info->feature_secdiscard = 0; |
@@ -771,18 +809,14 @@ static irqreturn_t blkif_interrupt(int irq, void *dev_id) | |||
771 | case BLKIF_OP_FLUSH_DISKCACHE: | 809 | case BLKIF_OP_FLUSH_DISKCACHE: |
772 | case BLKIF_OP_WRITE_BARRIER: | 810 | case BLKIF_OP_WRITE_BARRIER: |
773 | if (unlikely(bret->status == BLKIF_RSP_EOPNOTSUPP)) { | 811 | if (unlikely(bret->status == BLKIF_RSP_EOPNOTSUPP)) { |
774 | printk(KERN_WARNING "blkfront: %s: write %s op failed\n", | 812 | printk(KERN_WARNING "blkfront: %s: %s op failed\n", |
775 | info->flush_op == BLKIF_OP_WRITE_BARRIER ? | 813 | info->gd->disk_name, op_name(bret->operation)); |
776 | "barrier" : "flush disk cache", | ||
777 | info->gd->disk_name); | ||
778 | error = -EOPNOTSUPP; | 814 | error = -EOPNOTSUPP; |
779 | } | 815 | } |
780 | if (unlikely(bret->status == BLKIF_RSP_ERROR && | 816 | if (unlikely(bret->status == BLKIF_RSP_ERROR && |
781 | info->shadow[id].req.u.rw.nr_segments == 0)) { | 817 | info->shadow[id].req.u.rw.nr_segments == 0)) { |
782 | printk(KERN_WARNING "blkfront: %s: empty write %s op failed\n", | 818 | printk(KERN_WARNING "blkfront: %s: empty %s op failed\n", |
783 | info->flush_op == BLKIF_OP_WRITE_BARRIER ? | 819 | info->gd->disk_name, op_name(bret->operation)); |
784 | "barrier" : "flush disk cache", | ||
785 | info->gd->disk_name); | ||
786 | error = -EOPNOTSUPP; | 820 | error = -EOPNOTSUPP; |
787 | } | 821 | } |
788 | if (unlikely(error)) { | 822 | if (unlikely(error)) { |
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index dcbe05616090..9a1eb0cfa95f 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c | |||
@@ -1067,26 +1067,24 @@ static int __clk_set_parent(struct clk *clk, struct clk *parent) | |||
1067 | 1067 | ||
1068 | old_parent = clk->parent; | 1068 | old_parent = clk->parent; |
1069 | 1069 | ||
1070 | /* find index of new parent clock using cached parent ptrs */ | 1070 | if (!clk->parents) |
1071 | if (clk->parents) | ||
1072 | for (i = 0; i < clk->num_parents; i++) | ||
1073 | if (clk->parents[i] == parent) | ||
1074 | break; | ||
1075 | else | ||
1076 | clk->parents = kzalloc((sizeof(struct clk*) * clk->num_parents), | 1071 | clk->parents = kzalloc((sizeof(struct clk*) * clk->num_parents), |
1077 | GFP_KERNEL); | 1072 | GFP_KERNEL); |
1078 | 1073 | ||
1079 | /* | 1074 | /* |
1080 | * find index of new parent clock using string name comparison | 1075 | * find index of new parent clock using cached parent ptrs, |
1081 | * also try to cache the parent to avoid future calls to __clk_lookup | 1076 | * or if not yet cached, use string name comparison and cache |
1077 | * them now to avoid future calls to __clk_lookup. | ||
1082 | */ | 1078 | */ |
1083 | if (i == clk->num_parents) | 1079 | for (i = 0; i < clk->num_parents; i++) { |
1084 | for (i = 0; i < clk->num_parents; i++) | 1080 | if (clk->parents && clk->parents[i] == parent) |
1085 | if (!strcmp(clk->parent_names[i], parent->name)) { | 1081 | break; |
1086 | if (clk->parents) | 1082 | else if (!strcmp(clk->parent_names[i], parent->name)) { |
1087 | clk->parents[i] = __clk_lookup(parent->name); | 1083 | if (clk->parents) |
1088 | break; | 1084 | clk->parents[i] = __clk_lookup(parent->name); |
1089 | } | 1085 | break; |
1086 | } | ||
1087 | } | ||
1090 | 1088 | ||
1091 | if (i == clk->num_parents) { | 1089 | if (i == clk->num_parents) { |
1092 | pr_debug("%s: clock %s is not a possible parent of clock %s\n", | 1090 | pr_debug("%s: clock %s is not a possible parent of clock %s\n", |
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 5873e481e5d2..a8743c399e83 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c | |||
@@ -1039,6 +1039,24 @@ mode_in_range(const struct drm_display_mode *mode, struct edid *edid, | |||
1039 | return true; | 1039 | return true; |
1040 | } | 1040 | } |
1041 | 1041 | ||
1042 | static bool valid_inferred_mode(const struct drm_connector *connector, | ||
1043 | const struct drm_display_mode *mode) | ||
1044 | { | ||
1045 | struct drm_display_mode *m; | ||
1046 | bool ok = false; | ||
1047 | |||
1048 | list_for_each_entry(m, &connector->probed_modes, head) { | ||
1049 | if (mode->hdisplay == m->hdisplay && | ||
1050 | mode->vdisplay == m->vdisplay && | ||
1051 | drm_mode_vrefresh(mode) == drm_mode_vrefresh(m)) | ||
1052 | return false; /* duplicated */ | ||
1053 | if (mode->hdisplay <= m->hdisplay && | ||
1054 | mode->vdisplay <= m->vdisplay) | ||
1055 | ok = true; | ||
1056 | } | ||
1057 | return ok; | ||
1058 | } | ||
1059 | |||
1042 | static int | 1060 | static int |
1043 | drm_dmt_modes_for_range(struct drm_connector *connector, struct edid *edid, | 1061 | drm_dmt_modes_for_range(struct drm_connector *connector, struct edid *edid, |
1044 | struct detailed_timing *timing) | 1062 | struct detailed_timing *timing) |
@@ -1048,7 +1066,8 @@ drm_dmt_modes_for_range(struct drm_connector *connector, struct edid *edid, | |||
1048 | struct drm_device *dev = connector->dev; | 1066 | struct drm_device *dev = connector->dev; |
1049 | 1067 | ||
1050 | for (i = 0; i < drm_num_dmt_modes; i++) { | 1068 | for (i = 0; i < drm_num_dmt_modes; i++) { |
1051 | if (mode_in_range(drm_dmt_modes + i, edid, timing)) { | 1069 | if (mode_in_range(drm_dmt_modes + i, edid, timing) && |
1070 | valid_inferred_mode(connector, drm_dmt_modes + i)) { | ||
1052 | newmode = drm_mode_duplicate(dev, &drm_dmt_modes[i]); | 1071 | newmode = drm_mode_duplicate(dev, &drm_dmt_modes[i]); |
1053 | if (newmode) { | 1072 | if (newmode) { |
1054 | drm_mode_probed_add(connector, newmode); | 1073 | drm_mode_probed_add(connector, newmode); |
@@ -1088,7 +1107,8 @@ drm_gtf_modes_for_range(struct drm_connector *connector, struct edid *edid, | |||
1088 | return modes; | 1107 | return modes; |
1089 | 1108 | ||
1090 | fixup_mode_1366x768(newmode); | 1109 | fixup_mode_1366x768(newmode); |
1091 | if (!mode_in_range(newmode, edid, timing)) { | 1110 | if (!mode_in_range(newmode, edid, timing) || |
1111 | !valid_inferred_mode(connector, newmode)) { | ||
1092 | drm_mode_destroy(dev, newmode); | 1112 | drm_mode_destroy(dev, newmode); |
1093 | continue; | 1113 | continue; |
1094 | } | 1114 | } |
@@ -1116,7 +1136,8 @@ drm_cvt_modes_for_range(struct drm_connector *connector, struct edid *edid, | |||
1116 | return modes; | 1136 | return modes; |
1117 | 1137 | ||
1118 | fixup_mode_1366x768(newmode); | 1138 | fixup_mode_1366x768(newmode); |
1119 | if (!mode_in_range(newmode, edid, timing)) { | 1139 | if (!mode_in_range(newmode, edid, timing) || |
1140 | !valid_inferred_mode(connector, newmode)) { | ||
1120 | drm_mode_destroy(dev, newmode); | 1141 | drm_mode_destroy(dev, newmode); |
1121 | continue; | 1142 | continue; |
1122 | } | 1143 | } |
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index f94792626b94..36822b924eb1 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -1401,6 +1401,27 @@ i915_mtrr_setup(struct drm_i915_private *dev_priv, unsigned long base, | |||
1401 | } | 1401 | } |
1402 | } | 1402 | } |
1403 | 1403 | ||
1404 | static void i915_kick_out_firmware_fb(struct drm_i915_private *dev_priv) | ||
1405 | { | ||
1406 | struct apertures_struct *ap; | ||
1407 | struct pci_dev *pdev = dev_priv->dev->pdev; | ||
1408 | bool primary; | ||
1409 | |||
1410 | ap = alloc_apertures(1); | ||
1411 | if (!ap) | ||
1412 | return; | ||
1413 | |||
1414 | ap->ranges[0].base = dev_priv->dev->agp->base; | ||
1415 | ap->ranges[0].size = | ||
1416 | dev_priv->mm.gtt->gtt_mappable_entries << PAGE_SHIFT; | ||
1417 | primary = | ||
1418 | pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW; | ||
1419 | |||
1420 | remove_conflicting_framebuffers(ap, "inteldrmfb", primary); | ||
1421 | |||
1422 | kfree(ap); | ||
1423 | } | ||
1424 | |||
1404 | /** | 1425 | /** |
1405 | * i915_driver_load - setup chip and create an initial config | 1426 | * i915_driver_load - setup chip and create an initial config |
1406 | * @dev: DRM device | 1427 | * @dev: DRM device |
@@ -1446,6 +1467,15 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
1446 | goto free_priv; | 1467 | goto free_priv; |
1447 | } | 1468 | } |
1448 | 1469 | ||
1470 | dev_priv->mm.gtt = intel_gtt_get(); | ||
1471 | if (!dev_priv->mm.gtt) { | ||
1472 | DRM_ERROR("Failed to initialize GTT\n"); | ||
1473 | ret = -ENODEV; | ||
1474 | goto put_bridge; | ||
1475 | } | ||
1476 | |||
1477 | i915_kick_out_firmware_fb(dev_priv); | ||
1478 | |||
1449 | pci_set_master(dev->pdev); | 1479 | pci_set_master(dev->pdev); |
1450 | 1480 | ||
1451 | /* overlay on gen2 is broken and can't address above 1G */ | 1481 | /* overlay on gen2 is broken and can't address above 1G */ |
@@ -1471,13 +1501,6 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
1471 | goto put_bridge; | 1501 | goto put_bridge; |
1472 | } | 1502 | } |
1473 | 1503 | ||
1474 | dev_priv->mm.gtt = intel_gtt_get(); | ||
1475 | if (!dev_priv->mm.gtt) { | ||
1476 | DRM_ERROR("Failed to initialize GTT\n"); | ||
1477 | ret = -ENODEV; | ||
1478 | goto out_rmmap; | ||
1479 | } | ||
1480 | |||
1481 | aperture_size = dev_priv->mm.gtt->gtt_mappable_entries << PAGE_SHIFT; | 1504 | aperture_size = dev_priv->mm.gtt->gtt_mappable_entries << PAGE_SHIFT; |
1482 | 1505 | ||
1483 | dev_priv->mm.gtt_mapping = | 1506 | dev_priv->mm.gtt_mapping = |
diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c index 59d44937dd9f..84b648a7ddd8 100644 --- a/drivers/gpu/drm/radeon/radeon_gart.c +++ b/drivers/gpu/drm/radeon/radeon_gart.c | |||
@@ -289,8 +289,9 @@ int radeon_vm_manager_init(struct radeon_device *rdev) | |||
289 | rdev->vm_manager.enabled = false; | 289 | rdev->vm_manager.enabled = false; |
290 | 290 | ||
291 | /* mark first vm as always in use, it's the system one */ | 291 | /* mark first vm as always in use, it's the system one */ |
292 | /* allocate enough for 2 full VM pts */ | ||
292 | r = radeon_sa_bo_manager_init(rdev, &rdev->vm_manager.sa_manager, | 293 | r = radeon_sa_bo_manager_init(rdev, &rdev->vm_manager.sa_manager, |
293 | rdev->vm_manager.max_pfn * 8, | 294 | rdev->vm_manager.max_pfn * 8 * 2, |
294 | RADEON_GEM_DOMAIN_VRAM); | 295 | RADEON_GEM_DOMAIN_VRAM); |
295 | if (r) { | 296 | if (r) { |
296 | dev_err(rdev->dev, "failed to allocate vm bo (%dKB)\n", | 297 | dev_err(rdev->dev, "failed to allocate vm bo (%dKB)\n", |
@@ -633,7 +634,15 @@ int radeon_vm_init(struct radeon_device *rdev, struct radeon_vm *vm) | |||
633 | mutex_init(&vm->mutex); | 634 | mutex_init(&vm->mutex); |
634 | INIT_LIST_HEAD(&vm->list); | 635 | INIT_LIST_HEAD(&vm->list); |
635 | INIT_LIST_HEAD(&vm->va); | 636 | INIT_LIST_HEAD(&vm->va); |
636 | vm->last_pfn = 0; | 637 | /* SI requires equal sized PTs for all VMs, so always set |
638 | * last_pfn to max_pfn. cayman allows variable sized | ||
639 | * pts so we can grow then as needed. Once we switch | ||
640 | * to two level pts we can unify this again. | ||
641 | */ | ||
642 | if (rdev->family >= CHIP_TAHITI) | ||
643 | vm->last_pfn = rdev->vm_manager.max_pfn; | ||
644 | else | ||
645 | vm->last_pfn = 0; | ||
637 | /* map the ib pool buffer at 0 in virtual address space, set | 646 | /* map the ib pool buffer at 0 in virtual address space, set |
638 | * read only | 647 | * read only |
639 | */ | 648 | */ |
diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c index f28bd4b7ef98..21ec9f5653ce 100644 --- a/drivers/gpu/drm/radeon/radeon_gem.c +++ b/drivers/gpu/drm/radeon/radeon_gem.c | |||
@@ -292,6 +292,7 @@ int radeon_gem_mmap_ioctl(struct drm_device *dev, void *data, | |||
292 | int radeon_gem_busy_ioctl(struct drm_device *dev, void *data, | 292 | int radeon_gem_busy_ioctl(struct drm_device *dev, void *data, |
293 | struct drm_file *filp) | 293 | struct drm_file *filp) |
294 | { | 294 | { |
295 | struct radeon_device *rdev = dev->dev_private; | ||
295 | struct drm_radeon_gem_busy *args = data; | 296 | struct drm_radeon_gem_busy *args = data; |
296 | struct drm_gem_object *gobj; | 297 | struct drm_gem_object *gobj; |
297 | struct radeon_bo *robj; | 298 | struct radeon_bo *robj; |
@@ -317,13 +318,14 @@ int radeon_gem_busy_ioctl(struct drm_device *dev, void *data, | |||
317 | break; | 318 | break; |
318 | } | 319 | } |
319 | drm_gem_object_unreference_unlocked(gobj); | 320 | drm_gem_object_unreference_unlocked(gobj); |
320 | r = radeon_gem_handle_lockup(robj->rdev, r); | 321 | r = radeon_gem_handle_lockup(rdev, r); |
321 | return r; | 322 | return r; |
322 | } | 323 | } |
323 | 324 | ||
324 | int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data, | 325 | int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data, |
325 | struct drm_file *filp) | 326 | struct drm_file *filp) |
326 | { | 327 | { |
328 | struct radeon_device *rdev = dev->dev_private; | ||
327 | struct drm_radeon_gem_wait_idle *args = data; | 329 | struct drm_radeon_gem_wait_idle *args = data; |
328 | struct drm_gem_object *gobj; | 330 | struct drm_gem_object *gobj; |
329 | struct radeon_bo *robj; | 331 | struct radeon_bo *robj; |
@@ -336,10 +338,10 @@ int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data, | |||
336 | robj = gem_to_radeon_bo(gobj); | 338 | robj = gem_to_radeon_bo(gobj); |
337 | r = radeon_bo_wait(robj, NULL, false); | 339 | r = radeon_bo_wait(robj, NULL, false); |
338 | /* callback hw specific functions if any */ | 340 | /* callback hw specific functions if any */ |
339 | if (robj->rdev->asic->ioctl_wait_idle) | 341 | if (rdev->asic->ioctl_wait_idle) |
340 | robj->rdev->asic->ioctl_wait_idle(robj->rdev, robj); | 342 | robj->rdev->asic->ioctl_wait_idle(rdev, robj); |
341 | drm_gem_object_unreference_unlocked(gobj); | 343 | drm_gem_object_unreference_unlocked(gobj); |
342 | r = radeon_gem_handle_lockup(robj->rdev, r); | 344 | r = radeon_gem_handle_lockup(rdev, r); |
343 | return r; | 345 | return r; |
344 | } | 346 | } |
345 | 347 | ||
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index c7b61f16ecfd..0b0279291a73 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c | |||
@@ -2365,12 +2365,12 @@ int si_pcie_gart_enable(struct radeon_device *rdev) | |||
2365 | WREG32(0x15DC, 0); | 2365 | WREG32(0x15DC, 0); |
2366 | 2366 | ||
2367 | /* empty context1-15 */ | 2367 | /* empty context1-15 */ |
2368 | /* FIXME start with 1G, once using 2 level pt switch to full | 2368 | /* FIXME start with 4G, once using 2 level pt switch to full |
2369 | * vm size space | 2369 | * vm size space |
2370 | */ | 2370 | */ |
2371 | /* set vm size, must be a multiple of 4 */ | 2371 | /* set vm size, must be a multiple of 4 */ |
2372 | WREG32(VM_CONTEXT1_PAGE_TABLE_START_ADDR, 0); | 2372 | WREG32(VM_CONTEXT1_PAGE_TABLE_START_ADDR, 0); |
2373 | WREG32(VM_CONTEXT1_PAGE_TABLE_END_ADDR, (1 << 30) / RADEON_GPU_PAGE_SIZE); | 2373 | WREG32(VM_CONTEXT1_PAGE_TABLE_END_ADDR, rdev->vm_manager.max_pfn); |
2374 | for (i = 1; i < 16; i++) { | 2374 | for (i = 1; i < 16; i++) { |
2375 | if (i < 8) | 2375 | if (i < 8) |
2376 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (i << 2), | 2376 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (i << 2), |
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c index 7f1feb2f467a..637c51c11b44 100644 --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c | |||
@@ -693,7 +693,7 @@ static void __cpuinit get_core_online(unsigned int cpu) | |||
693 | * sensors. We check this bit only, all the early CPUs | 693 | * sensors. We check this bit only, all the early CPUs |
694 | * without thermal sensors will be filtered out. | 694 | * without thermal sensors will be filtered out. |
695 | */ | 695 | */ |
696 | if (!cpu_has(c, X86_FEATURE_DTS)) | 696 | if (!cpu_has(c, X86_FEATURE_DTHERM)) |
697 | return; | 697 | return; |
698 | 698 | ||
699 | if (!pdev) { | 699 | if (!pdev) { |
@@ -794,7 +794,7 @@ static struct notifier_block coretemp_cpu_notifier __refdata = { | |||
794 | }; | 794 | }; |
795 | 795 | ||
796 | static const struct x86_cpu_id coretemp_ids[] = { | 796 | static const struct x86_cpu_id coretemp_ids[] = { |
797 | { X86_VENDOR_INTEL, X86_FAMILY_ANY, X86_MODEL_ANY, X86_FEATURE_DTS }, | 797 | { X86_VENDOR_INTEL, X86_FAMILY_ANY, X86_MODEL_ANY, X86_FEATURE_DTHERM }, |
798 | {} | 798 | {} |
799 | }; | 799 | }; |
800 | MODULE_DEVICE_TABLE(x86cpu, coretemp_ids); | 800 | MODULE_DEVICE_TABLE(x86cpu, coretemp_ids); |
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index 37fdaf81bd1f..ce59824fb414 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c | |||
@@ -2292,6 +2292,13 @@ static int process_reserve_metadata_snap_mesg(unsigned argc, char **argv, struct | |||
2292 | if (r) | 2292 | if (r) |
2293 | return r; | 2293 | return r; |
2294 | 2294 | ||
2295 | r = dm_pool_commit_metadata(pool->pmd); | ||
2296 | if (r) { | ||
2297 | DMERR("%s: dm_pool_commit_metadata() failed, error = %d", | ||
2298 | __func__, r); | ||
2299 | return r; | ||
2300 | } | ||
2301 | |||
2295 | r = dm_pool_reserve_metadata_snap(pool->pmd); | 2302 | r = dm_pool_reserve_metadata_snap(pool->pmd); |
2296 | if (r) | 2303 | if (r) |
2297 | DMWARN("reserve_metadata_snap message failed."); | 2304 | DMWARN("reserve_metadata_snap message failed."); |
diff --git a/drivers/md/md.c b/drivers/md/md.c index 1c2f9048e1ae..a4c219e3c859 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -5784,8 +5784,7 @@ static int add_new_disk(struct mddev * mddev, mdu_disk_info_t *info) | |||
5784 | super_types[mddev->major_version]. | 5784 | super_types[mddev->major_version]. |
5785 | validate_super(mddev, rdev); | 5785 | validate_super(mddev, rdev); |
5786 | if ((info->state & (1<<MD_DISK_SYNC)) && | 5786 | if ((info->state & (1<<MD_DISK_SYNC)) && |
5787 | (!test_bit(In_sync, &rdev->flags) || | 5787 | rdev->raid_disk != info->raid_disk) { |
5788 | rdev->raid_disk != info->raid_disk)) { | ||
5789 | /* This was a hot-add request, but events doesn't | 5788 | /* This was a hot-add request, but events doesn't |
5790 | * match, so reject it. | 5789 | * match, so reject it. |
5791 | */ | 5790 | */ |
@@ -6751,7 +6750,7 @@ struct md_thread *md_register_thread(void (*run) (struct mddev *), struct mddev | |||
6751 | thread->tsk = kthread_run(md_thread, thread, | 6750 | thread->tsk = kthread_run(md_thread, thread, |
6752 | "%s_%s", | 6751 | "%s_%s", |
6753 | mdname(thread->mddev), | 6752 | mdname(thread->mddev), |
6754 | name ?: mddev->pers->name); | 6753 | name); |
6755 | if (IS_ERR(thread->tsk)) { | 6754 | if (IS_ERR(thread->tsk)) { |
6756 | kfree(thread); | 6755 | kfree(thread); |
6757 | return NULL; | 6756 | return NULL; |
@@ -7298,6 +7297,7 @@ void md_do_sync(struct mddev *mddev) | |||
7298 | int skipped = 0; | 7297 | int skipped = 0; |
7299 | struct md_rdev *rdev; | 7298 | struct md_rdev *rdev; |
7300 | char *desc; | 7299 | char *desc; |
7300 | struct blk_plug plug; | ||
7301 | 7301 | ||
7302 | /* just incase thread restarts... */ | 7302 | /* just incase thread restarts... */ |
7303 | if (test_bit(MD_RECOVERY_DONE, &mddev->recovery)) | 7303 | if (test_bit(MD_RECOVERY_DONE, &mddev->recovery)) |
@@ -7447,6 +7447,7 @@ void md_do_sync(struct mddev *mddev) | |||
7447 | } | 7447 | } |
7448 | mddev->curr_resync_completed = j; | 7448 | mddev->curr_resync_completed = j; |
7449 | 7449 | ||
7450 | blk_start_plug(&plug); | ||
7450 | while (j < max_sectors) { | 7451 | while (j < max_sectors) { |
7451 | sector_t sectors; | 7452 | sector_t sectors; |
7452 | 7453 | ||
@@ -7552,6 +7553,7 @@ void md_do_sync(struct mddev *mddev) | |||
7552 | * this also signals 'finished resyncing' to md_stop | 7553 | * this also signals 'finished resyncing' to md_stop |
7553 | */ | 7554 | */ |
7554 | out: | 7555 | out: |
7556 | blk_finish_plug(&plug); | ||
7555 | wait_event(mddev->recovery_wait, !atomic_read(&mddev->recovery_active)); | 7557 | wait_event(mddev->recovery_wait, !atomic_read(&mddev->recovery_active)); |
7556 | 7558 | ||
7557 | /* tell personality that we are finished */ | 7559 | /* tell personality that we are finished */ |
diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c index 9339e67fcc79..61a1833ebaf3 100644 --- a/drivers/md/multipath.c +++ b/drivers/md/multipath.c | |||
@@ -474,7 +474,8 @@ static int multipath_run (struct mddev *mddev) | |||
474 | } | 474 | } |
475 | 475 | ||
476 | { | 476 | { |
477 | mddev->thread = md_register_thread(multipathd, mddev, NULL); | 477 | mddev->thread = md_register_thread(multipathd, mddev, |
478 | "multipath"); | ||
478 | if (!mddev->thread) { | 479 | if (!mddev->thread) { |
479 | printk(KERN_ERR "multipath: couldn't allocate thread" | 480 | printk(KERN_ERR "multipath: couldn't allocate thread" |
480 | " for %s\n", mdname(mddev)); | 481 | " for %s\n", mdname(mddev)); |
diff --git a/drivers/md/persistent-data/dm-space-map-checker.c b/drivers/md/persistent-data/dm-space-map-checker.c index 50ed53bf4aa2..fc90c11620ad 100644 --- a/drivers/md/persistent-data/dm-space-map-checker.c +++ b/drivers/md/persistent-data/dm-space-map-checker.c | |||
@@ -8,6 +8,7 @@ | |||
8 | 8 | ||
9 | #include <linux/device-mapper.h> | 9 | #include <linux/device-mapper.h> |
10 | #include <linux/export.h> | 10 | #include <linux/export.h> |
11 | #include <linux/vmalloc.h> | ||
11 | 12 | ||
12 | #ifdef CONFIG_DM_DEBUG_SPACE_MAPS | 13 | #ifdef CONFIG_DM_DEBUG_SPACE_MAPS |
13 | 14 | ||
@@ -89,13 +90,23 @@ static int ca_create(struct count_array *ca, struct dm_space_map *sm) | |||
89 | 90 | ||
90 | ca->nr = nr_blocks; | 91 | ca->nr = nr_blocks; |
91 | ca->nr_free = nr_blocks; | 92 | ca->nr_free = nr_blocks; |
92 | ca->counts = kzalloc(sizeof(*ca->counts) * nr_blocks, GFP_KERNEL); | 93 | |
93 | if (!ca->counts) | 94 | if (!nr_blocks) |
94 | return -ENOMEM; | 95 | ca->counts = NULL; |
96 | else { | ||
97 | ca->counts = vzalloc(sizeof(*ca->counts) * nr_blocks); | ||
98 | if (!ca->counts) | ||
99 | return -ENOMEM; | ||
100 | } | ||
95 | 101 | ||
96 | return 0; | 102 | return 0; |
97 | } | 103 | } |
98 | 104 | ||
105 | static void ca_destroy(struct count_array *ca) | ||
106 | { | ||
107 | vfree(ca->counts); | ||
108 | } | ||
109 | |||
99 | static int ca_load(struct count_array *ca, struct dm_space_map *sm) | 110 | static int ca_load(struct count_array *ca, struct dm_space_map *sm) |
100 | { | 111 | { |
101 | int r; | 112 | int r; |
@@ -126,12 +137,14 @@ static int ca_load(struct count_array *ca, struct dm_space_map *sm) | |||
126 | static int ca_extend(struct count_array *ca, dm_block_t extra_blocks) | 137 | static int ca_extend(struct count_array *ca, dm_block_t extra_blocks) |
127 | { | 138 | { |
128 | dm_block_t nr_blocks = ca->nr + extra_blocks; | 139 | dm_block_t nr_blocks = ca->nr + extra_blocks; |
129 | uint32_t *counts = kzalloc(sizeof(*counts) * nr_blocks, GFP_KERNEL); | 140 | uint32_t *counts = vzalloc(sizeof(*counts) * nr_blocks); |
130 | if (!counts) | 141 | if (!counts) |
131 | return -ENOMEM; | 142 | return -ENOMEM; |
132 | 143 | ||
133 | memcpy(counts, ca->counts, sizeof(*counts) * ca->nr); | 144 | if (ca->counts) { |
134 | kfree(ca->counts); | 145 | memcpy(counts, ca->counts, sizeof(*counts) * ca->nr); |
146 | ca_destroy(ca); | ||
147 | } | ||
135 | ca->nr = nr_blocks; | 148 | ca->nr = nr_blocks; |
136 | ca->nr_free += extra_blocks; | 149 | ca->nr_free += extra_blocks; |
137 | ca->counts = counts; | 150 | ca->counts = counts; |
@@ -151,11 +164,6 @@ static int ca_commit(struct count_array *old, struct count_array *new) | |||
151 | return 0; | 164 | return 0; |
152 | } | 165 | } |
153 | 166 | ||
154 | static void ca_destroy(struct count_array *ca) | ||
155 | { | ||
156 | kfree(ca->counts); | ||
157 | } | ||
158 | |||
159 | /*----------------------------------------------------------------*/ | 167 | /*----------------------------------------------------------------*/ |
160 | 168 | ||
161 | struct sm_checker { | 169 | struct sm_checker { |
@@ -343,25 +351,25 @@ struct dm_space_map *dm_sm_checker_create(struct dm_space_map *sm) | |||
343 | int r; | 351 | int r; |
344 | struct sm_checker *smc; | 352 | struct sm_checker *smc; |
345 | 353 | ||
346 | if (!sm) | 354 | if (IS_ERR_OR_NULL(sm)) |
347 | return NULL; | 355 | return ERR_PTR(-EINVAL); |
348 | 356 | ||
349 | smc = kmalloc(sizeof(*smc), GFP_KERNEL); | 357 | smc = kmalloc(sizeof(*smc), GFP_KERNEL); |
350 | if (!smc) | 358 | if (!smc) |
351 | return NULL; | 359 | return ERR_PTR(-ENOMEM); |
352 | 360 | ||
353 | memcpy(&smc->sm, &ops_, sizeof(smc->sm)); | 361 | memcpy(&smc->sm, &ops_, sizeof(smc->sm)); |
354 | r = ca_create(&smc->old_counts, sm); | 362 | r = ca_create(&smc->old_counts, sm); |
355 | if (r) { | 363 | if (r) { |
356 | kfree(smc); | 364 | kfree(smc); |
357 | return NULL; | 365 | return ERR_PTR(r); |
358 | } | 366 | } |
359 | 367 | ||
360 | r = ca_create(&smc->counts, sm); | 368 | r = ca_create(&smc->counts, sm); |
361 | if (r) { | 369 | if (r) { |
362 | ca_destroy(&smc->old_counts); | 370 | ca_destroy(&smc->old_counts); |
363 | kfree(smc); | 371 | kfree(smc); |
364 | return NULL; | 372 | return ERR_PTR(r); |
365 | } | 373 | } |
366 | 374 | ||
367 | smc->real_sm = sm; | 375 | smc->real_sm = sm; |
@@ -371,7 +379,7 @@ struct dm_space_map *dm_sm_checker_create(struct dm_space_map *sm) | |||
371 | ca_destroy(&smc->counts); | 379 | ca_destroy(&smc->counts); |
372 | ca_destroy(&smc->old_counts); | 380 | ca_destroy(&smc->old_counts); |
373 | kfree(smc); | 381 | kfree(smc); |
374 | return NULL; | 382 | return ERR_PTR(r); |
375 | } | 383 | } |
376 | 384 | ||
377 | r = ca_commit(&smc->old_counts, &smc->counts); | 385 | r = ca_commit(&smc->old_counts, &smc->counts); |
@@ -379,7 +387,7 @@ struct dm_space_map *dm_sm_checker_create(struct dm_space_map *sm) | |||
379 | ca_destroy(&smc->counts); | 387 | ca_destroy(&smc->counts); |
380 | ca_destroy(&smc->old_counts); | 388 | ca_destroy(&smc->old_counts); |
381 | kfree(smc); | 389 | kfree(smc); |
382 | return NULL; | 390 | return ERR_PTR(r); |
383 | } | 391 | } |
384 | 392 | ||
385 | return &smc->sm; | 393 | return &smc->sm; |
@@ -391,25 +399,25 @@ struct dm_space_map *dm_sm_checker_create_fresh(struct dm_space_map *sm) | |||
391 | int r; | 399 | int r; |
392 | struct sm_checker *smc; | 400 | struct sm_checker *smc; |
393 | 401 | ||
394 | if (!sm) | 402 | if (IS_ERR_OR_NULL(sm)) |
395 | return NULL; | 403 | return ERR_PTR(-EINVAL); |
396 | 404 | ||
397 | smc = kmalloc(sizeof(*smc), GFP_KERNEL); | 405 | smc = kmalloc(sizeof(*smc), GFP_KERNEL); |
398 | if (!smc) | 406 | if (!smc) |
399 | return NULL; | 407 | return ERR_PTR(-ENOMEM); |
400 | 408 | ||
401 | memcpy(&smc->sm, &ops_, sizeof(smc->sm)); | 409 | memcpy(&smc->sm, &ops_, sizeof(smc->sm)); |
402 | r = ca_create(&smc->old_counts, sm); | 410 | r = ca_create(&smc->old_counts, sm); |
403 | if (r) { | 411 | if (r) { |
404 | kfree(smc); | 412 | kfree(smc); |
405 | return NULL; | 413 | return ERR_PTR(r); |
406 | } | 414 | } |
407 | 415 | ||
408 | r = ca_create(&smc->counts, sm); | 416 | r = ca_create(&smc->counts, sm); |
409 | if (r) { | 417 | if (r) { |
410 | ca_destroy(&smc->old_counts); | 418 | ca_destroy(&smc->old_counts); |
411 | kfree(smc); | 419 | kfree(smc); |
412 | return NULL; | 420 | return ERR_PTR(r); |
413 | } | 421 | } |
414 | 422 | ||
415 | smc->real_sm = sm; | 423 | smc->real_sm = sm; |
diff --git a/drivers/md/persistent-data/dm-space-map-disk.c b/drivers/md/persistent-data/dm-space-map-disk.c index fc469ba9f627..3d0ed5332883 100644 --- a/drivers/md/persistent-data/dm-space-map-disk.c +++ b/drivers/md/persistent-data/dm-space-map-disk.c | |||
@@ -290,7 +290,16 @@ struct dm_space_map *dm_sm_disk_create(struct dm_transaction_manager *tm, | |||
290 | dm_block_t nr_blocks) | 290 | dm_block_t nr_blocks) |
291 | { | 291 | { |
292 | struct dm_space_map *sm = dm_sm_disk_create_real(tm, nr_blocks); | 292 | struct dm_space_map *sm = dm_sm_disk_create_real(tm, nr_blocks); |
293 | return dm_sm_checker_create_fresh(sm); | 293 | struct dm_space_map *smc; |
294 | |||
295 | if (IS_ERR_OR_NULL(sm)) | ||
296 | return sm; | ||
297 | |||
298 | smc = dm_sm_checker_create_fresh(sm); | ||
299 | if (IS_ERR(smc)) | ||
300 | dm_sm_destroy(sm); | ||
301 | |||
302 | return smc; | ||
294 | } | 303 | } |
295 | EXPORT_SYMBOL_GPL(dm_sm_disk_create); | 304 | EXPORT_SYMBOL_GPL(dm_sm_disk_create); |
296 | 305 | ||
diff --git a/drivers/md/persistent-data/dm-transaction-manager.c b/drivers/md/persistent-data/dm-transaction-manager.c index 400fe144c0cd..e5604b32d91f 100644 --- a/drivers/md/persistent-data/dm-transaction-manager.c +++ b/drivers/md/persistent-data/dm-transaction-manager.c | |||
@@ -138,6 +138,9 @@ EXPORT_SYMBOL_GPL(dm_tm_create_non_blocking_clone); | |||
138 | 138 | ||
139 | void dm_tm_destroy(struct dm_transaction_manager *tm) | 139 | void dm_tm_destroy(struct dm_transaction_manager *tm) |
140 | { | 140 | { |
141 | if (!tm->is_clone) | ||
142 | wipe_shadow_table(tm); | ||
143 | |||
141 | kfree(tm); | 144 | kfree(tm); |
142 | } | 145 | } |
143 | EXPORT_SYMBOL_GPL(dm_tm_destroy); | 146 | EXPORT_SYMBOL_GPL(dm_tm_destroy); |
@@ -344,8 +347,10 @@ static int dm_tm_create_internal(struct dm_block_manager *bm, | |||
344 | } | 347 | } |
345 | 348 | ||
346 | *sm = dm_sm_checker_create(inner); | 349 | *sm = dm_sm_checker_create(inner); |
347 | if (!*sm) | 350 | if (IS_ERR(*sm)) { |
351 | r = PTR_ERR(*sm); | ||
348 | goto bad2; | 352 | goto bad2; |
353 | } | ||
349 | 354 | ||
350 | } else { | 355 | } else { |
351 | r = dm_bm_write_lock(dm_tm_get_bm(*tm), sb_location, | 356 | r = dm_bm_write_lock(dm_tm_get_bm(*tm), sb_location, |
@@ -364,8 +369,10 @@ static int dm_tm_create_internal(struct dm_block_manager *bm, | |||
364 | } | 369 | } |
365 | 370 | ||
366 | *sm = dm_sm_checker_create(inner); | 371 | *sm = dm_sm_checker_create(inner); |
367 | if (!*sm) | 372 | if (IS_ERR(*sm)) { |
373 | r = PTR_ERR(*sm); | ||
368 | goto bad2; | 374 | goto bad2; |
375 | } | ||
369 | } | 376 | } |
370 | 377 | ||
371 | return 0; | 378 | return 0; |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index a9c7981ddd24..8c2754f835ef 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -517,8 +517,8 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sect | |||
517 | int bad_sectors; | 517 | int bad_sectors; |
518 | 518 | ||
519 | int disk = start_disk + i; | 519 | int disk = start_disk + i; |
520 | if (disk >= conf->raid_disks) | 520 | if (disk >= conf->raid_disks * 2) |
521 | disk -= conf->raid_disks; | 521 | disk -= conf->raid_disks * 2; |
522 | 522 | ||
523 | rdev = rcu_dereference(conf->mirrors[disk].rdev); | 523 | rdev = rcu_dereference(conf->mirrors[disk].rdev); |
524 | if (r1_bio->bios[disk] == IO_BLOCKED | 524 | if (r1_bio->bios[disk] == IO_BLOCKED |
@@ -883,7 +883,6 @@ static void make_request(struct mddev *mddev, struct bio * bio) | |||
883 | const unsigned long do_sync = (bio->bi_rw & REQ_SYNC); | 883 | const unsigned long do_sync = (bio->bi_rw & REQ_SYNC); |
884 | const unsigned long do_flush_fua = (bio->bi_rw & (REQ_FLUSH | REQ_FUA)); | 884 | const unsigned long do_flush_fua = (bio->bi_rw & (REQ_FLUSH | REQ_FUA)); |
885 | struct md_rdev *blocked_rdev; | 885 | struct md_rdev *blocked_rdev; |
886 | int plugged; | ||
887 | int first_clone; | 886 | int first_clone; |
888 | int sectors_handled; | 887 | int sectors_handled; |
889 | int max_sectors; | 888 | int max_sectors; |
@@ -1034,7 +1033,6 @@ read_again: | |||
1034 | * the bad blocks. Each set of writes gets it's own r1bio | 1033 | * the bad blocks. Each set of writes gets it's own r1bio |
1035 | * with a set of bios attached. | 1034 | * with a set of bios attached. |
1036 | */ | 1035 | */ |
1037 | plugged = mddev_check_plugged(mddev); | ||
1038 | 1036 | ||
1039 | disks = conf->raid_disks * 2; | 1037 | disks = conf->raid_disks * 2; |
1040 | retry_write: | 1038 | retry_write: |
@@ -1191,6 +1189,8 @@ read_again: | |||
1191 | bio_list_add(&conf->pending_bio_list, mbio); | 1189 | bio_list_add(&conf->pending_bio_list, mbio); |
1192 | conf->pending_count++; | 1190 | conf->pending_count++; |
1193 | spin_unlock_irqrestore(&conf->device_lock, flags); | 1191 | spin_unlock_irqrestore(&conf->device_lock, flags); |
1192 | if (!mddev_check_plugged(mddev)) | ||
1193 | md_wakeup_thread(mddev->thread); | ||
1194 | } | 1194 | } |
1195 | /* Mustn't call r1_bio_write_done before this next test, | 1195 | /* Mustn't call r1_bio_write_done before this next test, |
1196 | * as it could result in the bio being freed. | 1196 | * as it could result in the bio being freed. |
@@ -1213,9 +1213,6 @@ read_again: | |||
1213 | 1213 | ||
1214 | /* In case raid1d snuck in to freeze_array */ | 1214 | /* In case raid1d snuck in to freeze_array */ |
1215 | wake_up(&conf->wait_barrier); | 1215 | wake_up(&conf->wait_barrier); |
1216 | |||
1217 | if (do_sync || !bitmap || !plugged) | ||
1218 | md_wakeup_thread(mddev->thread); | ||
1219 | } | 1216 | } |
1220 | 1217 | ||
1221 | static void status(struct seq_file *seq, struct mddev *mddev) | 1218 | static void status(struct seq_file *seq, struct mddev *mddev) |
@@ -2621,7 +2618,7 @@ static struct r1conf *setup_conf(struct mddev *mddev) | |||
2621 | goto abort; | 2618 | goto abort; |
2622 | } | 2619 | } |
2623 | err = -ENOMEM; | 2620 | err = -ENOMEM; |
2624 | conf->thread = md_register_thread(raid1d, mddev, NULL); | 2621 | conf->thread = md_register_thread(raid1d, mddev, "raid1"); |
2625 | if (!conf->thread) { | 2622 | if (!conf->thread) { |
2626 | printk(KERN_ERR | 2623 | printk(KERN_ERR |
2627 | "md/raid1:%s: couldn't allocate thread\n", | 2624 | "md/raid1:%s: couldn't allocate thread\n", |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 99ae6068e456..8da6282254c3 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -1039,7 +1039,6 @@ static void make_request(struct mddev *mddev, struct bio * bio) | |||
1039 | const unsigned long do_fua = (bio->bi_rw & REQ_FUA); | 1039 | const unsigned long do_fua = (bio->bi_rw & REQ_FUA); |
1040 | unsigned long flags; | 1040 | unsigned long flags; |
1041 | struct md_rdev *blocked_rdev; | 1041 | struct md_rdev *blocked_rdev; |
1042 | int plugged; | ||
1043 | int sectors_handled; | 1042 | int sectors_handled; |
1044 | int max_sectors; | 1043 | int max_sectors; |
1045 | int sectors; | 1044 | int sectors; |
@@ -1239,7 +1238,6 @@ read_again: | |||
1239 | * of r10_bios is recored in bio->bi_phys_segments just as with | 1238 | * of r10_bios is recored in bio->bi_phys_segments just as with |
1240 | * the read case. | 1239 | * the read case. |
1241 | */ | 1240 | */ |
1242 | plugged = mddev_check_plugged(mddev); | ||
1243 | 1241 | ||
1244 | r10_bio->read_slot = -1; /* make sure repl_bio gets freed */ | 1242 | r10_bio->read_slot = -1; /* make sure repl_bio gets freed */ |
1245 | raid10_find_phys(conf, r10_bio); | 1243 | raid10_find_phys(conf, r10_bio); |
@@ -1396,6 +1394,8 @@ retry_write: | |||
1396 | bio_list_add(&conf->pending_bio_list, mbio); | 1394 | bio_list_add(&conf->pending_bio_list, mbio); |
1397 | conf->pending_count++; | 1395 | conf->pending_count++; |
1398 | spin_unlock_irqrestore(&conf->device_lock, flags); | 1396 | spin_unlock_irqrestore(&conf->device_lock, flags); |
1397 | if (!mddev_check_plugged(mddev)) | ||
1398 | md_wakeup_thread(mddev->thread); | ||
1399 | 1399 | ||
1400 | if (!r10_bio->devs[i].repl_bio) | 1400 | if (!r10_bio->devs[i].repl_bio) |
1401 | continue; | 1401 | continue; |
@@ -1423,6 +1423,8 @@ retry_write: | |||
1423 | bio_list_add(&conf->pending_bio_list, mbio); | 1423 | bio_list_add(&conf->pending_bio_list, mbio); |
1424 | conf->pending_count++; | 1424 | conf->pending_count++; |
1425 | spin_unlock_irqrestore(&conf->device_lock, flags); | 1425 | spin_unlock_irqrestore(&conf->device_lock, flags); |
1426 | if (!mddev_check_plugged(mddev)) | ||
1427 | md_wakeup_thread(mddev->thread); | ||
1426 | } | 1428 | } |
1427 | 1429 | ||
1428 | /* Don't remove the bias on 'remaining' (one_write_done) until | 1430 | /* Don't remove the bias on 'remaining' (one_write_done) until |
@@ -1448,9 +1450,6 @@ retry_write: | |||
1448 | 1450 | ||
1449 | /* In case raid10d snuck in to freeze_array */ | 1451 | /* In case raid10d snuck in to freeze_array */ |
1450 | wake_up(&conf->wait_barrier); | 1452 | wake_up(&conf->wait_barrier); |
1451 | |||
1452 | if (do_sync || !mddev->bitmap || !plugged) | ||
1453 | md_wakeup_thread(mddev->thread); | ||
1454 | } | 1453 | } |
1455 | 1454 | ||
1456 | static void status(struct seq_file *seq, struct mddev *mddev) | 1455 | static void status(struct seq_file *seq, struct mddev *mddev) |
@@ -2310,7 +2309,7 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10 | |||
2310 | if (r10_sync_page_io(rdev, | 2309 | if (r10_sync_page_io(rdev, |
2311 | r10_bio->devs[sl].addr + | 2310 | r10_bio->devs[sl].addr + |
2312 | sect, | 2311 | sect, |
2313 | s<<9, conf->tmppage, WRITE) | 2312 | s, conf->tmppage, WRITE) |
2314 | == 0) { | 2313 | == 0) { |
2315 | /* Well, this device is dead */ | 2314 | /* Well, this device is dead */ |
2316 | printk(KERN_NOTICE | 2315 | printk(KERN_NOTICE |
@@ -2349,7 +2348,7 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10 | |||
2349 | switch (r10_sync_page_io(rdev, | 2348 | switch (r10_sync_page_io(rdev, |
2350 | r10_bio->devs[sl].addr + | 2349 | r10_bio->devs[sl].addr + |
2351 | sect, | 2350 | sect, |
2352 | s<<9, conf->tmppage, | 2351 | s, conf->tmppage, |
2353 | READ)) { | 2352 | READ)) { |
2354 | case 0: | 2353 | case 0: |
2355 | /* Well, this device is dead */ | 2354 | /* Well, this device is dead */ |
@@ -2512,7 +2511,7 @@ read_more: | |||
2512 | slot = r10_bio->read_slot; | 2511 | slot = r10_bio->read_slot; |
2513 | printk_ratelimited( | 2512 | printk_ratelimited( |
2514 | KERN_ERR | 2513 | KERN_ERR |
2515 | "md/raid10:%s: %s: redirecting" | 2514 | "md/raid10:%s: %s: redirecting " |
2516 | "sector %llu to another mirror\n", | 2515 | "sector %llu to another mirror\n", |
2517 | mdname(mddev), | 2516 | mdname(mddev), |
2518 | bdevname(rdev->bdev, b), | 2517 | bdevname(rdev->bdev, b), |
@@ -2661,7 +2660,8 @@ static void raid10d(struct mddev *mddev) | |||
2661 | blk_start_plug(&plug); | 2660 | blk_start_plug(&plug); |
2662 | for (;;) { | 2661 | for (;;) { |
2663 | 2662 | ||
2664 | flush_pending_writes(conf); | 2663 | if (atomic_read(&mddev->plug_cnt) == 0) |
2664 | flush_pending_writes(conf); | ||
2665 | 2665 | ||
2666 | spin_lock_irqsave(&conf->device_lock, flags); | 2666 | spin_lock_irqsave(&conf->device_lock, flags); |
2667 | if (list_empty(head)) { | 2667 | if (list_empty(head)) { |
@@ -2890,6 +2890,12 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, | |||
2890 | /* want to reconstruct this device */ | 2890 | /* want to reconstruct this device */ |
2891 | rb2 = r10_bio; | 2891 | rb2 = r10_bio; |
2892 | sect = raid10_find_virt(conf, sector_nr, i); | 2892 | sect = raid10_find_virt(conf, sector_nr, i); |
2893 | if (sect >= mddev->resync_max_sectors) { | ||
2894 | /* last stripe is not complete - don't | ||
2895 | * try to recover this sector. | ||
2896 | */ | ||
2897 | continue; | ||
2898 | } | ||
2893 | /* Unless we are doing a full sync, or a replacement | 2899 | /* Unless we are doing a full sync, or a replacement |
2894 | * we only need to recover the block if it is set in | 2900 | * we only need to recover the block if it is set in |
2895 | * the bitmap | 2901 | * the bitmap |
@@ -3421,7 +3427,7 @@ static struct r10conf *setup_conf(struct mddev *mddev) | |||
3421 | spin_lock_init(&conf->resync_lock); | 3427 | spin_lock_init(&conf->resync_lock); |
3422 | init_waitqueue_head(&conf->wait_barrier); | 3428 | init_waitqueue_head(&conf->wait_barrier); |
3423 | 3429 | ||
3424 | conf->thread = md_register_thread(raid10d, mddev, NULL); | 3430 | conf->thread = md_register_thread(raid10d, mddev, "raid10"); |
3425 | if (!conf->thread) | 3431 | if (!conf->thread) |
3426 | goto out; | 3432 | goto out; |
3427 | 3433 | ||
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index d26767246d26..04348d76bb30 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -196,12 +196,14 @@ static void __release_stripe(struct r5conf *conf, struct stripe_head *sh) | |||
196 | BUG_ON(!list_empty(&sh->lru)); | 196 | BUG_ON(!list_empty(&sh->lru)); |
197 | BUG_ON(atomic_read(&conf->active_stripes)==0); | 197 | BUG_ON(atomic_read(&conf->active_stripes)==0); |
198 | if (test_bit(STRIPE_HANDLE, &sh->state)) { | 198 | if (test_bit(STRIPE_HANDLE, &sh->state)) { |
199 | if (test_bit(STRIPE_DELAYED, &sh->state)) | 199 | if (test_bit(STRIPE_DELAYED, &sh->state) && |
200 | !test_bit(STRIPE_PREREAD_ACTIVE, &sh->state)) | ||
200 | list_add_tail(&sh->lru, &conf->delayed_list); | 201 | list_add_tail(&sh->lru, &conf->delayed_list); |
201 | else if (test_bit(STRIPE_BIT_DELAY, &sh->state) && | 202 | else if (test_bit(STRIPE_BIT_DELAY, &sh->state) && |
202 | sh->bm_seq - conf->seq_write > 0) | 203 | sh->bm_seq - conf->seq_write > 0) |
203 | list_add_tail(&sh->lru, &conf->bitmap_list); | 204 | list_add_tail(&sh->lru, &conf->bitmap_list); |
204 | else { | 205 | else { |
206 | clear_bit(STRIPE_DELAYED, &sh->state); | ||
205 | clear_bit(STRIPE_BIT_DELAY, &sh->state); | 207 | clear_bit(STRIPE_BIT_DELAY, &sh->state); |
206 | list_add_tail(&sh->lru, &conf->handle_list); | 208 | list_add_tail(&sh->lru, &conf->handle_list); |
207 | } | 209 | } |
@@ -606,6 +608,12 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s) | |||
606 | * a chance*/ | 608 | * a chance*/ |
607 | md_check_recovery(conf->mddev); | 609 | md_check_recovery(conf->mddev); |
608 | } | 610 | } |
611 | /* | ||
612 | * Because md_wait_for_blocked_rdev | ||
613 | * will dec nr_pending, we must | ||
614 | * increment it first. | ||
615 | */ | ||
616 | atomic_inc(&rdev->nr_pending); | ||
609 | md_wait_for_blocked_rdev(rdev, conf->mddev); | 617 | md_wait_for_blocked_rdev(rdev, conf->mddev); |
610 | } else { | 618 | } else { |
611 | /* Acknowledged bad block - skip the write */ | 619 | /* Acknowledged bad block - skip the write */ |
@@ -1737,6 +1745,7 @@ static void raid5_end_read_request(struct bio * bi, int error) | |||
1737 | } else { | 1745 | } else { |
1738 | const char *bdn = bdevname(rdev->bdev, b); | 1746 | const char *bdn = bdevname(rdev->bdev, b); |
1739 | int retry = 0; | 1747 | int retry = 0; |
1748 | int set_bad = 0; | ||
1740 | 1749 | ||
1741 | clear_bit(R5_UPTODATE, &sh->dev[i].flags); | 1750 | clear_bit(R5_UPTODATE, &sh->dev[i].flags); |
1742 | atomic_inc(&rdev->read_errors); | 1751 | atomic_inc(&rdev->read_errors); |
@@ -1748,7 +1757,8 @@ static void raid5_end_read_request(struct bio * bi, int error) | |||
1748 | mdname(conf->mddev), | 1757 | mdname(conf->mddev), |
1749 | (unsigned long long)s, | 1758 | (unsigned long long)s, |
1750 | bdn); | 1759 | bdn); |
1751 | else if (conf->mddev->degraded >= conf->max_degraded) | 1760 | else if (conf->mddev->degraded >= conf->max_degraded) { |
1761 | set_bad = 1; | ||
1752 | printk_ratelimited( | 1762 | printk_ratelimited( |
1753 | KERN_WARNING | 1763 | KERN_WARNING |
1754 | "md/raid:%s: read error not correctable " | 1764 | "md/raid:%s: read error not correctable " |
@@ -1756,8 +1766,9 @@ static void raid5_end_read_request(struct bio * bi, int error) | |||
1756 | mdname(conf->mddev), | 1766 | mdname(conf->mddev), |
1757 | (unsigned long long)s, | 1767 | (unsigned long long)s, |
1758 | bdn); | 1768 | bdn); |
1759 | else if (test_bit(R5_ReWrite, &sh->dev[i].flags)) | 1769 | } else if (test_bit(R5_ReWrite, &sh->dev[i].flags)) { |
1760 | /* Oh, no!!! */ | 1770 | /* Oh, no!!! */ |
1771 | set_bad = 1; | ||
1761 | printk_ratelimited( | 1772 | printk_ratelimited( |
1762 | KERN_WARNING | 1773 | KERN_WARNING |
1763 | "md/raid:%s: read error NOT corrected!! " | 1774 | "md/raid:%s: read error NOT corrected!! " |
@@ -1765,7 +1776,7 @@ static void raid5_end_read_request(struct bio * bi, int error) | |||
1765 | mdname(conf->mddev), | 1776 | mdname(conf->mddev), |
1766 | (unsigned long long)s, | 1777 | (unsigned long long)s, |
1767 | bdn); | 1778 | bdn); |
1768 | else if (atomic_read(&rdev->read_errors) | 1779 | } else if (atomic_read(&rdev->read_errors) |
1769 | > conf->max_nr_stripes) | 1780 | > conf->max_nr_stripes) |
1770 | printk(KERN_WARNING | 1781 | printk(KERN_WARNING |
1771 | "md/raid:%s: Too many read errors, failing device %s.\n", | 1782 | "md/raid:%s: Too many read errors, failing device %s.\n", |
@@ -1777,7 +1788,11 @@ static void raid5_end_read_request(struct bio * bi, int error) | |||
1777 | else { | 1788 | else { |
1778 | clear_bit(R5_ReadError, &sh->dev[i].flags); | 1789 | clear_bit(R5_ReadError, &sh->dev[i].flags); |
1779 | clear_bit(R5_ReWrite, &sh->dev[i].flags); | 1790 | clear_bit(R5_ReWrite, &sh->dev[i].flags); |
1780 | md_error(conf->mddev, rdev); | 1791 | if (!(set_bad |
1792 | && test_bit(In_sync, &rdev->flags) | ||
1793 | && rdev_set_badblocks( | ||
1794 | rdev, sh->sector, STRIPE_SECTORS, 0))) | ||
1795 | md_error(conf->mddev, rdev); | ||
1781 | } | 1796 | } |
1782 | } | 1797 | } |
1783 | rdev_dec_pending(rdev, conf->mddev); | 1798 | rdev_dec_pending(rdev, conf->mddev); |
@@ -3582,8 +3597,18 @@ static void handle_stripe(struct stripe_head *sh) | |||
3582 | 3597 | ||
3583 | finish: | 3598 | finish: |
3584 | /* wait for this device to become unblocked */ | 3599 | /* wait for this device to become unblocked */ |
3585 | if (conf->mddev->external && unlikely(s.blocked_rdev)) | 3600 | if (unlikely(s.blocked_rdev)) { |
3586 | md_wait_for_blocked_rdev(s.blocked_rdev, conf->mddev); | 3601 | if (conf->mddev->external) |
3602 | md_wait_for_blocked_rdev(s.blocked_rdev, | ||
3603 | conf->mddev); | ||
3604 | else | ||
3605 | /* Internal metadata will immediately | ||
3606 | * be written by raid5d, so we don't | ||
3607 | * need to wait here. | ||
3608 | */ | ||
3609 | rdev_dec_pending(s.blocked_rdev, | ||
3610 | conf->mddev); | ||
3611 | } | ||
3587 | 3612 | ||
3588 | if (s.handle_bad_blocks) | 3613 | if (s.handle_bad_blocks) |
3589 | for (i = disks; i--; ) { | 3614 | for (i = disks; i--; ) { |
@@ -3881,8 +3906,6 @@ static int chunk_aligned_read(struct mddev *mddev, struct bio * raid_bio) | |||
3881 | raid_bio->bi_next = (void*)rdev; | 3906 | raid_bio->bi_next = (void*)rdev; |
3882 | align_bi->bi_bdev = rdev->bdev; | 3907 | align_bi->bi_bdev = rdev->bdev; |
3883 | align_bi->bi_flags &= ~(1 << BIO_SEG_VALID); | 3908 | align_bi->bi_flags &= ~(1 << BIO_SEG_VALID); |
3884 | /* No reshape active, so we can trust rdev->data_offset */ | ||
3885 | align_bi->bi_sector += rdev->data_offset; | ||
3886 | 3909 | ||
3887 | if (!bio_fits_rdev(align_bi) || | 3910 | if (!bio_fits_rdev(align_bi) || |
3888 | is_badblock(rdev, align_bi->bi_sector, align_bi->bi_size>>9, | 3911 | is_badblock(rdev, align_bi->bi_sector, align_bi->bi_size>>9, |
@@ -3893,6 +3916,9 @@ static int chunk_aligned_read(struct mddev *mddev, struct bio * raid_bio) | |||
3893 | return 0; | 3916 | return 0; |
3894 | } | 3917 | } |
3895 | 3918 | ||
3919 | /* No reshape active, so we can trust rdev->data_offset */ | ||
3920 | align_bi->bi_sector += rdev->data_offset; | ||
3921 | |||
3896 | spin_lock_irq(&conf->device_lock); | 3922 | spin_lock_irq(&conf->device_lock); |
3897 | wait_event_lock_irq(conf->wait_for_stripe, | 3923 | wait_event_lock_irq(conf->wait_for_stripe, |
3898 | conf->quiesce == 0, | 3924 | conf->quiesce == 0, |
@@ -3971,7 +3997,6 @@ static void make_request(struct mddev *mddev, struct bio * bi) | |||
3971 | struct stripe_head *sh; | 3997 | struct stripe_head *sh; |
3972 | const int rw = bio_data_dir(bi); | 3998 | const int rw = bio_data_dir(bi); |
3973 | int remaining; | 3999 | int remaining; |
3974 | int plugged; | ||
3975 | 4000 | ||
3976 | if (unlikely(bi->bi_rw & REQ_FLUSH)) { | 4001 | if (unlikely(bi->bi_rw & REQ_FLUSH)) { |
3977 | md_flush_request(mddev, bi); | 4002 | md_flush_request(mddev, bi); |
@@ -3990,7 +4015,6 @@ static void make_request(struct mddev *mddev, struct bio * bi) | |||
3990 | bi->bi_next = NULL; | 4015 | bi->bi_next = NULL; |
3991 | bi->bi_phys_segments = 1; /* over-loaded to count active stripes */ | 4016 | bi->bi_phys_segments = 1; /* over-loaded to count active stripes */ |
3992 | 4017 | ||
3993 | plugged = mddev_check_plugged(mddev); | ||
3994 | for (;logical_sector < last_sector; logical_sector += STRIPE_SECTORS) { | 4018 | for (;logical_sector < last_sector; logical_sector += STRIPE_SECTORS) { |
3995 | DEFINE_WAIT(w); | 4019 | DEFINE_WAIT(w); |
3996 | int previous; | 4020 | int previous; |
@@ -4092,6 +4116,7 @@ static void make_request(struct mddev *mddev, struct bio * bi) | |||
4092 | if ((bi->bi_rw & REQ_SYNC) && | 4116 | if ((bi->bi_rw & REQ_SYNC) && |
4093 | !test_and_set_bit(STRIPE_PREREAD_ACTIVE, &sh->state)) | 4117 | !test_and_set_bit(STRIPE_PREREAD_ACTIVE, &sh->state)) |
4094 | atomic_inc(&conf->preread_active_stripes); | 4118 | atomic_inc(&conf->preread_active_stripes); |
4119 | mddev_check_plugged(mddev); | ||
4095 | release_stripe(sh); | 4120 | release_stripe(sh); |
4096 | } else { | 4121 | } else { |
4097 | /* cannot get stripe for read-ahead, just give-up */ | 4122 | /* cannot get stripe for read-ahead, just give-up */ |
@@ -4099,10 +4124,7 @@ static void make_request(struct mddev *mddev, struct bio * bi) | |||
4099 | finish_wait(&conf->wait_for_overlap, &w); | 4124 | finish_wait(&conf->wait_for_overlap, &w); |
4100 | break; | 4125 | break; |
4101 | } | 4126 | } |
4102 | |||
4103 | } | 4127 | } |
4104 | if (!plugged) | ||
4105 | md_wakeup_thread(mddev->thread); | ||
4106 | 4128 | ||
4107 | spin_lock_irq(&conf->device_lock); | 4129 | spin_lock_irq(&conf->device_lock); |
4108 | remaining = raid5_dec_bi_phys_segments(bi); | 4130 | remaining = raid5_dec_bi_phys_segments(bi); |
@@ -4823,6 +4845,7 @@ static struct r5conf *setup_conf(struct mddev *mddev) | |||
4823 | int raid_disk, memory, max_disks; | 4845 | int raid_disk, memory, max_disks; |
4824 | struct md_rdev *rdev; | 4846 | struct md_rdev *rdev; |
4825 | struct disk_info *disk; | 4847 | struct disk_info *disk; |
4848 | char pers_name[6]; | ||
4826 | 4849 | ||
4827 | if (mddev->new_level != 5 | 4850 | if (mddev->new_level != 5 |
4828 | && mddev->new_level != 4 | 4851 | && mddev->new_level != 4 |
@@ -4946,7 +4969,8 @@ static struct r5conf *setup_conf(struct mddev *mddev) | |||
4946 | printk(KERN_INFO "md/raid:%s: allocated %dkB\n", | 4969 | printk(KERN_INFO "md/raid:%s: allocated %dkB\n", |
4947 | mdname(mddev), memory); | 4970 | mdname(mddev), memory); |
4948 | 4971 | ||
4949 | conf->thread = md_register_thread(raid5d, mddev, NULL); | 4972 | sprintf(pers_name, "raid%d", mddev->new_level); |
4973 | conf->thread = md_register_thread(raid5d, mddev, pers_name); | ||
4950 | if (!conf->thread) { | 4974 | if (!conf->thread) { |
4951 | printk(KERN_ERR | 4975 | printk(KERN_ERR |
4952 | "md/raid:%s: couldn't allocate thread.\n", | 4976 | "md/raid:%s: couldn't allocate thread.\n", |
@@ -5465,10 +5489,9 @@ static int raid5_add_disk(struct mddev *mddev, struct md_rdev *rdev) | |||
5465 | if (rdev->saved_raid_disk >= 0 && | 5489 | if (rdev->saved_raid_disk >= 0 && |
5466 | rdev->saved_raid_disk >= first && | 5490 | rdev->saved_raid_disk >= first && |
5467 | conf->disks[rdev->saved_raid_disk].rdev == NULL) | 5491 | conf->disks[rdev->saved_raid_disk].rdev == NULL) |
5468 | disk = rdev->saved_raid_disk; | 5492 | first = rdev->saved_raid_disk; |
5469 | else | 5493 | |
5470 | disk = first; | 5494 | for (disk = first; disk <= last; disk++) { |
5471 | for ( ; disk <= last ; disk++) { | ||
5472 | p = conf->disks + disk; | 5495 | p = conf->disks + disk; |
5473 | if (p->rdev == NULL) { | 5496 | if (p->rdev == NULL) { |
5474 | clear_bit(In_sync, &rdev->flags); | 5497 | clear_bit(In_sync, &rdev->flags); |
@@ -5477,8 +5500,11 @@ static int raid5_add_disk(struct mddev *mddev, struct md_rdev *rdev) | |||
5477 | if (rdev->saved_raid_disk != disk) | 5500 | if (rdev->saved_raid_disk != disk) |
5478 | conf->fullsync = 1; | 5501 | conf->fullsync = 1; |
5479 | rcu_assign_pointer(p->rdev, rdev); | 5502 | rcu_assign_pointer(p->rdev, rdev); |
5480 | break; | 5503 | goto out; |
5481 | } | 5504 | } |
5505 | } | ||
5506 | for (disk = first; disk <= last; disk++) { | ||
5507 | p = conf->disks + disk; | ||
5482 | if (test_bit(WantReplacement, &p->rdev->flags) && | 5508 | if (test_bit(WantReplacement, &p->rdev->flags) && |
5483 | p->replacement == NULL) { | 5509 | p->replacement == NULL) { |
5484 | clear_bit(In_sync, &rdev->flags); | 5510 | clear_bit(In_sync, &rdev->flags); |
@@ -5490,6 +5516,7 @@ static int raid5_add_disk(struct mddev *mddev, struct md_rdev *rdev) | |||
5490 | break; | 5516 | break; |
5491 | } | 5517 | } |
5492 | } | 5518 | } |
5519 | out: | ||
5493 | print_raid5_conf(conf); | 5520 | print_raid5_conf(conf); |
5494 | return err; | 5521 | return err; |
5495 | } | 5522 | } |
diff --git a/drivers/net/ethernet/intel/e1000e/defines.h b/drivers/net/ethernet/intel/e1000e/defines.h index 351a4097b2ba..76edbc1be33b 100644 --- a/drivers/net/ethernet/intel/e1000e/defines.h +++ b/drivers/net/ethernet/intel/e1000e/defines.h | |||
@@ -103,6 +103,7 @@ | |||
103 | #define E1000_RXD_ERR_SEQ 0x04 /* Sequence Error */ | 103 | #define E1000_RXD_ERR_SEQ 0x04 /* Sequence Error */ |
104 | #define E1000_RXD_ERR_CXE 0x10 /* Carrier Extension Error */ | 104 | #define E1000_RXD_ERR_CXE 0x10 /* Carrier Extension Error */ |
105 | #define E1000_RXD_ERR_TCPE 0x20 /* TCP/UDP Checksum Error */ | 105 | #define E1000_RXD_ERR_TCPE 0x20 /* TCP/UDP Checksum Error */ |
106 | #define E1000_RXD_ERR_IPE 0x40 /* IP Checksum Error */ | ||
106 | #define E1000_RXD_ERR_RXE 0x80 /* Rx Data Error */ | 107 | #define E1000_RXD_ERR_RXE 0x80 /* Rx Data Error */ |
107 | #define E1000_RXD_SPC_VLAN_MASK 0x0FFF /* VLAN ID is in lower 12 bits */ | 108 | #define E1000_RXD_SPC_VLAN_MASK 0x0FFF /* VLAN ID is in lower 12 bits */ |
108 | 109 | ||
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index ba86b3f8a404..a166efc2fead 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c | |||
@@ -496,7 +496,7 @@ static void e1000_receive_skb(struct e1000_adapter *adapter, | |||
496 | * @sk_buff: socket buffer with received data | 496 | * @sk_buff: socket buffer with received data |
497 | **/ | 497 | **/ |
498 | static void e1000_rx_checksum(struct e1000_adapter *adapter, u32 status_err, | 498 | static void e1000_rx_checksum(struct e1000_adapter *adapter, u32 status_err, |
499 | __le16 csum, struct sk_buff *skb) | 499 | struct sk_buff *skb) |
500 | { | 500 | { |
501 | u16 status = (u16)status_err; | 501 | u16 status = (u16)status_err; |
502 | u8 errors = (u8)(status_err >> 24); | 502 | u8 errors = (u8)(status_err >> 24); |
@@ -511,8 +511,8 @@ static void e1000_rx_checksum(struct e1000_adapter *adapter, u32 status_err, | |||
511 | if (status & E1000_RXD_STAT_IXSM) | 511 | if (status & E1000_RXD_STAT_IXSM) |
512 | return; | 512 | return; |
513 | 513 | ||
514 | /* TCP/UDP checksum error bit is set */ | 514 | /* TCP/UDP checksum error bit or IP checksum error bit is set */ |
515 | if (errors & E1000_RXD_ERR_TCPE) { | 515 | if (errors & (E1000_RXD_ERR_TCPE | E1000_RXD_ERR_IPE)) { |
516 | /* let the stack verify checksum errors */ | 516 | /* let the stack verify checksum errors */ |
517 | adapter->hw_csum_err++; | 517 | adapter->hw_csum_err++; |
518 | return; | 518 | return; |
@@ -523,19 +523,7 @@ static void e1000_rx_checksum(struct e1000_adapter *adapter, u32 status_err, | |||
523 | return; | 523 | return; |
524 | 524 | ||
525 | /* It must be a TCP or UDP packet with a valid checksum */ | 525 | /* It must be a TCP or UDP packet with a valid checksum */ |
526 | if (status & E1000_RXD_STAT_TCPCS) { | 526 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
527 | /* TCP checksum is good */ | ||
528 | skb->ip_summed = CHECKSUM_UNNECESSARY; | ||
529 | } else { | ||
530 | /* | ||
531 | * IP fragment with UDP payload | ||
532 | * Hardware complements the payload checksum, so we undo it | ||
533 | * and then put the value in host order for further stack use. | ||
534 | */ | ||
535 | __sum16 sum = (__force __sum16)swab16((__force u16)csum); | ||
536 | skb->csum = csum_unfold(~sum); | ||
537 | skb->ip_summed = CHECKSUM_COMPLETE; | ||
538 | } | ||
539 | adapter->hw_csum_good++; | 527 | adapter->hw_csum_good++; |
540 | } | 528 | } |
541 | 529 | ||
@@ -954,8 +942,7 @@ static bool e1000_clean_rx_irq(struct e1000_ring *rx_ring, int *work_done, | |||
954 | skb_put(skb, length); | 942 | skb_put(skb, length); |
955 | 943 | ||
956 | /* Receive Checksum Offload */ | 944 | /* Receive Checksum Offload */ |
957 | e1000_rx_checksum(adapter, staterr, | 945 | e1000_rx_checksum(adapter, staterr, skb); |
958 | rx_desc->wb.lower.hi_dword.csum_ip.csum, skb); | ||
959 | 946 | ||
960 | e1000_rx_hash(netdev, rx_desc->wb.lower.hi_dword.rss, skb); | 947 | e1000_rx_hash(netdev, rx_desc->wb.lower.hi_dword.rss, skb); |
961 | 948 | ||
@@ -1341,8 +1328,7 @@ copydone: | |||
1341 | total_rx_bytes += skb->len; | 1328 | total_rx_bytes += skb->len; |
1342 | total_rx_packets++; | 1329 | total_rx_packets++; |
1343 | 1330 | ||
1344 | e1000_rx_checksum(adapter, staterr, | 1331 | e1000_rx_checksum(adapter, staterr, skb); |
1345 | rx_desc->wb.lower.hi_dword.csum_ip.csum, skb); | ||
1346 | 1332 | ||
1347 | e1000_rx_hash(netdev, rx_desc->wb.lower.hi_dword.rss, skb); | 1333 | e1000_rx_hash(netdev, rx_desc->wb.lower.hi_dword.rss, skb); |
1348 | 1334 | ||
@@ -1512,9 +1498,8 @@ static bool e1000_clean_jumbo_rx_irq(struct e1000_ring *rx_ring, int *work_done, | |||
1512 | } | 1498 | } |
1513 | } | 1499 | } |
1514 | 1500 | ||
1515 | /* Receive Checksum Offload XXX recompute due to CRC strip? */ | 1501 | /* Receive Checksum Offload */ |
1516 | e1000_rx_checksum(adapter, staterr, | 1502 | e1000_rx_checksum(adapter, staterr, skb); |
1517 | rx_desc->wb.lower.hi_dword.csum_ip.csum, skb); | ||
1518 | 1503 | ||
1519 | e1000_rx_hash(netdev, rx_desc->wb.lower.hi_dword.rss, skb); | 1504 | e1000_rx_hash(netdev, rx_desc->wb.lower.hi_dword.rss, skb); |
1520 | 1505 | ||
@@ -3098,19 +3083,10 @@ static void e1000_configure_rx(struct e1000_adapter *adapter) | |||
3098 | 3083 | ||
3099 | /* Enable Receive Checksum Offload for TCP and UDP */ | 3084 | /* Enable Receive Checksum Offload for TCP and UDP */ |
3100 | rxcsum = er32(RXCSUM); | 3085 | rxcsum = er32(RXCSUM); |
3101 | if (adapter->netdev->features & NETIF_F_RXCSUM) { | 3086 | if (adapter->netdev->features & NETIF_F_RXCSUM) |
3102 | rxcsum |= E1000_RXCSUM_TUOFL; | 3087 | rxcsum |= E1000_RXCSUM_TUOFL; |
3103 | 3088 | else | |
3104 | /* | ||
3105 | * IPv4 payload checksum for UDP fragments must be | ||
3106 | * used in conjunction with packet-split. | ||
3107 | */ | ||
3108 | if (adapter->rx_ps_pages) | ||
3109 | rxcsum |= E1000_RXCSUM_IPPCSE; | ||
3110 | } else { | ||
3111 | rxcsum &= ~E1000_RXCSUM_TUOFL; | 3089 | rxcsum &= ~E1000_RXCSUM_TUOFL; |
3112 | /* no need to clear IPPCSE as it defaults to 0 */ | ||
3113 | } | ||
3114 | ew32(RXCSUM, rxcsum); | 3090 | ew32(RXCSUM, rxcsum); |
3115 | 3091 | ||
3116 | if (adapter->hw.mac.type == e1000_pch2lan) { | 3092 | if (adapter->hw.mac.type == e1000_pch2lan) { |
@@ -5241,22 +5217,10 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu) | |||
5241 | int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN; | 5217 | int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN; |
5242 | 5218 | ||
5243 | /* Jumbo frame support */ | 5219 | /* Jumbo frame support */ |
5244 | if (max_frame > ETH_FRAME_LEN + ETH_FCS_LEN) { | 5220 | if ((max_frame > ETH_FRAME_LEN + ETH_FCS_LEN) && |
5245 | if (!(adapter->flags & FLAG_HAS_JUMBO_FRAMES)) { | 5221 | !(adapter->flags & FLAG_HAS_JUMBO_FRAMES)) { |
5246 | e_err("Jumbo Frames not supported.\n"); | 5222 | e_err("Jumbo Frames not supported.\n"); |
5247 | return -EINVAL; | 5223 | return -EINVAL; |
5248 | } | ||
5249 | |||
5250 | /* | ||
5251 | * IP payload checksum (enabled with jumbos/packet-split when | ||
5252 | * Rx checksum is enabled) and generation of RSS hash is | ||
5253 | * mutually exclusive in the hardware. | ||
5254 | */ | ||
5255 | if ((netdev->features & NETIF_F_RXCSUM) && | ||
5256 | (netdev->features & NETIF_F_RXHASH)) { | ||
5257 | e_err("Jumbo frames cannot be enabled when both receive checksum offload and receive hashing are enabled. Disable one of the receive offload features before enabling jumbos.\n"); | ||
5258 | return -EINVAL; | ||
5259 | } | ||
5260 | } | 5224 | } |
5261 | 5225 | ||
5262 | /* Supported frame sizes */ | 5226 | /* Supported frame sizes */ |
@@ -6030,17 +5994,6 @@ static int e1000_set_features(struct net_device *netdev, | |||
6030 | NETIF_F_RXALL))) | 5994 | NETIF_F_RXALL))) |
6031 | return 0; | 5995 | return 0; |
6032 | 5996 | ||
6033 | /* | ||
6034 | * IP payload checksum (enabled with jumbos/packet-split when Rx | ||
6035 | * checksum is enabled) and generation of RSS hash is mutually | ||
6036 | * exclusive in the hardware. | ||
6037 | */ | ||
6038 | if (adapter->rx_ps_pages && | ||
6039 | (features & NETIF_F_RXCSUM) && (features & NETIF_F_RXHASH)) { | ||
6040 | e_err("Enabling both receive checksum offload and receive hashing is not possible with jumbo frames. Disable jumbos or enable only one of the receive offload features.\n"); | ||
6041 | return -EINVAL; | ||
6042 | } | ||
6043 | |||
6044 | if (changed & NETIF_F_RXFCS) { | 5997 | if (changed & NETIF_F_RXFCS) { |
6045 | if (features & NETIF_F_RXFCS) { | 5998 | if (features & NETIF_F_RXFCS) { |
6046 | adapter->flags2 &= ~FLAG2_CRC_STRIPPING; | 5999 | adapter->flags2 &= ~FLAG2_CRC_STRIPPING; |
diff --git a/drivers/net/ethernet/intel/igbvf/ethtool.c b/drivers/net/ethernet/intel/igbvf/ethtool.c index 8ce67064b9c5..90eef07943f4 100644 --- a/drivers/net/ethernet/intel/igbvf/ethtool.c +++ b/drivers/net/ethernet/intel/igbvf/ethtool.c | |||
@@ -357,21 +357,28 @@ static int igbvf_set_coalesce(struct net_device *netdev, | |||
357 | struct igbvf_adapter *adapter = netdev_priv(netdev); | 357 | struct igbvf_adapter *adapter = netdev_priv(netdev); |
358 | struct e1000_hw *hw = &adapter->hw; | 358 | struct e1000_hw *hw = &adapter->hw; |
359 | 359 | ||
360 | if ((ec->rx_coalesce_usecs > IGBVF_MAX_ITR_USECS) || | 360 | if ((ec->rx_coalesce_usecs >= IGBVF_MIN_ITR_USECS) && |
361 | ((ec->rx_coalesce_usecs > 3) && | 361 | (ec->rx_coalesce_usecs <= IGBVF_MAX_ITR_USECS)) { |
362 | (ec->rx_coalesce_usecs < IGBVF_MIN_ITR_USECS)) || | 362 | adapter->current_itr = ec->rx_coalesce_usecs << 2; |
363 | (ec->rx_coalesce_usecs == 2)) | 363 | adapter->requested_itr = 1000000000 / |
364 | return -EINVAL; | 364 | (adapter->current_itr * 256); |
365 | 365 | } else if ((ec->rx_coalesce_usecs == 3) || | |
366 | /* convert to rate of irq's per second */ | 366 | (ec->rx_coalesce_usecs == 2)) { |
367 | if (ec->rx_coalesce_usecs && ec->rx_coalesce_usecs <= 3) { | ||
368 | adapter->current_itr = IGBVF_START_ITR; | 367 | adapter->current_itr = IGBVF_START_ITR; |
369 | adapter->requested_itr = ec->rx_coalesce_usecs; | 368 | adapter->requested_itr = ec->rx_coalesce_usecs; |
370 | } else { | 369 | } else if (ec->rx_coalesce_usecs == 0) { |
371 | adapter->current_itr = ec->rx_coalesce_usecs << 2; | 370 | /* |
371 | * The user's desire is to turn off interrupt throttling | ||
372 | * altogether, but due to HW limitations, we can't do that. | ||
373 | * Instead we set a very small value in EITR, which would | ||
374 | * allow ~967k interrupts per second, but allow the adapter's | ||
375 | * internal clocking to still function properly. | ||
376 | */ | ||
377 | adapter->current_itr = 4; | ||
372 | adapter->requested_itr = 1000000000 / | 378 | adapter->requested_itr = 1000000000 / |
373 | (adapter->current_itr * 256); | 379 | (adapter->current_itr * 256); |
374 | } | 380 | } else |
381 | return -EINVAL; | ||
375 | 382 | ||
376 | writel(adapter->current_itr, | 383 | writel(adapter->current_itr, |
377 | hw->hw_addr + adapter->rx_ring->itr_register); | 384 | hw->hw_addr + adapter->rx_ring->itr_register); |
diff --git a/drivers/oprofile/oprofile_perf.c b/drivers/oprofile/oprofile_perf.c index da14432806c6..efc4b7f308cf 100644 --- a/drivers/oprofile/oprofile_perf.c +++ b/drivers/oprofile/oprofile_perf.c | |||
@@ -25,7 +25,7 @@ static int oprofile_perf_enabled; | |||
25 | static DEFINE_MUTEX(oprofile_perf_mutex); | 25 | static DEFINE_MUTEX(oprofile_perf_mutex); |
26 | 26 | ||
27 | static struct op_counter_config *counter_config; | 27 | static struct op_counter_config *counter_config; |
28 | static struct perf_event **perf_events[nr_cpumask_bits]; | 28 | static struct perf_event **perf_events[NR_CPUS]; |
29 | static int num_counters; | 29 | static int num_counters; |
30 | 30 | ||
31 | /* | 31 | /* |
diff --git a/fs/splice.c b/fs/splice.c index c9f1318a3b82..7bf08fa22ec9 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
@@ -273,13 +273,16 @@ void spd_release_page(struct splice_pipe_desc *spd, unsigned int i) | |||
273 | * Check if we need to grow the arrays holding pages and partial page | 273 | * Check if we need to grow the arrays holding pages and partial page |
274 | * descriptions. | 274 | * descriptions. |
275 | */ | 275 | */ |
276 | int splice_grow_spd(struct pipe_inode_info *pipe, struct splice_pipe_desc *spd) | 276 | int splice_grow_spd(const struct pipe_inode_info *pipe, struct splice_pipe_desc *spd) |
277 | { | 277 | { |
278 | if (pipe->buffers <= PIPE_DEF_BUFFERS) | 278 | unsigned int buffers = ACCESS_ONCE(pipe->buffers); |
279 | |||
280 | spd->nr_pages_max = buffers; | ||
281 | if (buffers <= PIPE_DEF_BUFFERS) | ||
279 | return 0; | 282 | return 0; |
280 | 283 | ||
281 | spd->pages = kmalloc(pipe->buffers * sizeof(struct page *), GFP_KERNEL); | 284 | spd->pages = kmalloc(buffers * sizeof(struct page *), GFP_KERNEL); |
282 | spd->partial = kmalloc(pipe->buffers * sizeof(struct partial_page), GFP_KERNEL); | 285 | spd->partial = kmalloc(buffers * sizeof(struct partial_page), GFP_KERNEL); |
283 | 286 | ||
284 | if (spd->pages && spd->partial) | 287 | if (spd->pages && spd->partial) |
285 | return 0; | 288 | return 0; |
@@ -289,10 +292,9 @@ int splice_grow_spd(struct pipe_inode_info *pipe, struct splice_pipe_desc *spd) | |||
289 | return -ENOMEM; | 292 | return -ENOMEM; |
290 | } | 293 | } |
291 | 294 | ||
292 | void splice_shrink_spd(struct pipe_inode_info *pipe, | 295 | void splice_shrink_spd(struct splice_pipe_desc *spd) |
293 | struct splice_pipe_desc *spd) | ||
294 | { | 296 | { |
295 | if (pipe->buffers <= PIPE_DEF_BUFFERS) | 297 | if (spd->nr_pages_max <= PIPE_DEF_BUFFERS) |
296 | return; | 298 | return; |
297 | 299 | ||
298 | kfree(spd->pages); | 300 | kfree(spd->pages); |
@@ -315,6 +317,7 @@ __generic_file_splice_read(struct file *in, loff_t *ppos, | |||
315 | struct splice_pipe_desc spd = { | 317 | struct splice_pipe_desc spd = { |
316 | .pages = pages, | 318 | .pages = pages, |
317 | .partial = partial, | 319 | .partial = partial, |
320 | .nr_pages_max = PIPE_DEF_BUFFERS, | ||
318 | .flags = flags, | 321 | .flags = flags, |
319 | .ops = &page_cache_pipe_buf_ops, | 322 | .ops = &page_cache_pipe_buf_ops, |
320 | .spd_release = spd_release_page, | 323 | .spd_release = spd_release_page, |
@@ -326,7 +329,7 @@ __generic_file_splice_read(struct file *in, loff_t *ppos, | |||
326 | index = *ppos >> PAGE_CACHE_SHIFT; | 329 | index = *ppos >> PAGE_CACHE_SHIFT; |
327 | loff = *ppos & ~PAGE_CACHE_MASK; | 330 | loff = *ppos & ~PAGE_CACHE_MASK; |
328 | req_pages = (len + loff + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; | 331 | req_pages = (len + loff + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; |
329 | nr_pages = min(req_pages, pipe->buffers); | 332 | nr_pages = min(req_pages, spd.nr_pages_max); |
330 | 333 | ||
331 | /* | 334 | /* |
332 | * Lookup the (hopefully) full range of pages we need. | 335 | * Lookup the (hopefully) full range of pages we need. |
@@ -497,7 +500,7 @@ fill_it: | |||
497 | if (spd.nr_pages) | 500 | if (spd.nr_pages) |
498 | error = splice_to_pipe(pipe, &spd); | 501 | error = splice_to_pipe(pipe, &spd); |
499 | 502 | ||
500 | splice_shrink_spd(pipe, &spd); | 503 | splice_shrink_spd(&spd); |
501 | return error; | 504 | return error; |
502 | } | 505 | } |
503 | 506 | ||
@@ -598,6 +601,7 @@ ssize_t default_file_splice_read(struct file *in, loff_t *ppos, | |||
598 | struct splice_pipe_desc spd = { | 601 | struct splice_pipe_desc spd = { |
599 | .pages = pages, | 602 | .pages = pages, |
600 | .partial = partial, | 603 | .partial = partial, |
604 | .nr_pages_max = PIPE_DEF_BUFFERS, | ||
601 | .flags = flags, | 605 | .flags = flags, |
602 | .ops = &default_pipe_buf_ops, | 606 | .ops = &default_pipe_buf_ops, |
603 | .spd_release = spd_release_page, | 607 | .spd_release = spd_release_page, |
@@ -608,8 +612,8 @@ ssize_t default_file_splice_read(struct file *in, loff_t *ppos, | |||
608 | 612 | ||
609 | res = -ENOMEM; | 613 | res = -ENOMEM; |
610 | vec = __vec; | 614 | vec = __vec; |
611 | if (pipe->buffers > PIPE_DEF_BUFFERS) { | 615 | if (spd.nr_pages_max > PIPE_DEF_BUFFERS) { |
612 | vec = kmalloc(pipe->buffers * sizeof(struct iovec), GFP_KERNEL); | 616 | vec = kmalloc(spd.nr_pages_max * sizeof(struct iovec), GFP_KERNEL); |
613 | if (!vec) | 617 | if (!vec) |
614 | goto shrink_ret; | 618 | goto shrink_ret; |
615 | } | 619 | } |
@@ -617,7 +621,7 @@ ssize_t default_file_splice_read(struct file *in, loff_t *ppos, | |||
617 | offset = *ppos & ~PAGE_CACHE_MASK; | 621 | offset = *ppos & ~PAGE_CACHE_MASK; |
618 | nr_pages = (len + offset + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; | 622 | nr_pages = (len + offset + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; |
619 | 623 | ||
620 | for (i = 0; i < nr_pages && i < pipe->buffers && len; i++) { | 624 | for (i = 0; i < nr_pages && i < spd.nr_pages_max && len; i++) { |
621 | struct page *page; | 625 | struct page *page; |
622 | 626 | ||
623 | page = alloc_page(GFP_USER); | 627 | page = alloc_page(GFP_USER); |
@@ -665,7 +669,7 @@ ssize_t default_file_splice_read(struct file *in, loff_t *ppos, | |||
665 | shrink_ret: | 669 | shrink_ret: |
666 | if (vec != __vec) | 670 | if (vec != __vec) |
667 | kfree(vec); | 671 | kfree(vec); |
668 | splice_shrink_spd(pipe, &spd); | 672 | splice_shrink_spd(&spd); |
669 | return res; | 673 | return res; |
670 | 674 | ||
671 | err: | 675 | err: |
@@ -1614,6 +1618,7 @@ static long vmsplice_to_pipe(struct file *file, const struct iovec __user *iov, | |||
1614 | struct splice_pipe_desc spd = { | 1618 | struct splice_pipe_desc spd = { |
1615 | .pages = pages, | 1619 | .pages = pages, |
1616 | .partial = partial, | 1620 | .partial = partial, |
1621 | .nr_pages_max = PIPE_DEF_BUFFERS, | ||
1617 | .flags = flags, | 1622 | .flags = flags, |
1618 | .ops = &user_page_pipe_buf_ops, | 1623 | .ops = &user_page_pipe_buf_ops, |
1619 | .spd_release = spd_release_page, | 1624 | .spd_release = spd_release_page, |
@@ -1629,13 +1634,13 @@ static long vmsplice_to_pipe(struct file *file, const struct iovec __user *iov, | |||
1629 | 1634 | ||
1630 | spd.nr_pages = get_iovec_page_array(iov, nr_segs, spd.pages, | 1635 | spd.nr_pages = get_iovec_page_array(iov, nr_segs, spd.pages, |
1631 | spd.partial, false, | 1636 | spd.partial, false, |
1632 | pipe->buffers); | 1637 | spd.nr_pages_max); |
1633 | if (spd.nr_pages <= 0) | 1638 | if (spd.nr_pages <= 0) |
1634 | ret = spd.nr_pages; | 1639 | ret = spd.nr_pages; |
1635 | else | 1640 | else |
1636 | ret = splice_to_pipe(pipe, &spd); | 1641 | ret = splice_to_pipe(pipe, &spd); |
1637 | 1642 | ||
1638 | splice_shrink_spd(pipe, &spd); | 1643 | splice_shrink_spd(&spd); |
1639 | return ret; | 1644 | return ret; |
1640 | } | 1645 | } |
1641 | 1646 | ||
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index ba43f408baa3..07954b05b86c 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -827,7 +827,6 @@ extern bool __blk_end_request_err(struct request *rq, int error); | |||
827 | extern void blk_complete_request(struct request *); | 827 | extern void blk_complete_request(struct request *); |
828 | extern void __blk_complete_request(struct request *); | 828 | extern void __blk_complete_request(struct request *); |
829 | extern void blk_abort_request(struct request *); | 829 | extern void blk_abort_request(struct request *); |
830 | extern void blk_abort_queue(struct request_queue *); | ||
831 | extern void blk_unprep_request(struct request *); | 830 | extern void blk_unprep_request(struct request *); |
832 | 831 | ||
833 | /* | 832 | /* |
diff --git a/include/linux/irq.h b/include/linux/irq.h index 61f5cec031e0..a5261e3d2e3c 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
@@ -301,8 +301,6 @@ static inline irq_hw_number_t irqd_to_hwirq(struct irq_data *d) | |||
301 | * @irq_pm_shutdown: function called from core code on shutdown once per chip | 301 | * @irq_pm_shutdown: function called from core code on shutdown once per chip |
302 | * @irq_print_chip: optional to print special chip info in show_interrupts | 302 | * @irq_print_chip: optional to print special chip info in show_interrupts |
303 | * @flags: chip specific flags | 303 | * @flags: chip specific flags |
304 | * | ||
305 | * @release: release function solely used by UML | ||
306 | */ | 304 | */ |
307 | struct irq_chip { | 305 | struct irq_chip { |
308 | const char *name; | 306 | const char *name; |
diff --git a/include/linux/splice.h b/include/linux/splice.h index 26e5b613deda..09a545a7dfa3 100644 --- a/include/linux/splice.h +++ b/include/linux/splice.h | |||
@@ -51,7 +51,8 @@ struct partial_page { | |||
51 | struct splice_pipe_desc { | 51 | struct splice_pipe_desc { |
52 | struct page **pages; /* page map */ | 52 | struct page **pages; /* page map */ |
53 | struct partial_page *partial; /* pages[] may not be contig */ | 53 | struct partial_page *partial; /* pages[] may not be contig */ |
54 | int nr_pages; /* number of pages in map */ | 54 | int nr_pages; /* number of populated pages in map */ |
55 | unsigned int nr_pages_max; /* pages[] & partial[] arrays size */ | ||
55 | unsigned int flags; /* splice flags */ | 56 | unsigned int flags; /* splice flags */ |
56 | const struct pipe_buf_operations *ops;/* ops associated with output pipe */ | 57 | const struct pipe_buf_operations *ops;/* ops associated with output pipe */ |
57 | void (*spd_release)(struct splice_pipe_desc *, unsigned int); | 58 | void (*spd_release)(struct splice_pipe_desc *, unsigned int); |
@@ -85,9 +86,8 @@ extern ssize_t splice_direct_to_actor(struct file *, struct splice_desc *, | |||
85 | /* | 86 | /* |
86 | * for dynamic pipe sizing | 87 | * for dynamic pipe sizing |
87 | */ | 88 | */ |
88 | extern int splice_grow_spd(struct pipe_inode_info *, struct splice_pipe_desc *); | 89 | extern int splice_grow_spd(const struct pipe_inode_info *, struct splice_pipe_desc *); |
89 | extern void splice_shrink_spd(struct pipe_inode_info *, | 90 | extern void splice_shrink_spd(struct splice_pipe_desc *); |
90 | struct splice_pipe_desc *); | ||
91 | extern void spd_release_page(struct splice_pipe_desc *, unsigned int); | 91 | extern void spd_release_page(struct splice_pipe_desc *, unsigned int); |
92 | 92 | ||
93 | extern const struct pipe_buf_operations page_cache_pipe_buf_ops; | 93 | extern const struct pipe_buf_operations page_cache_pipe_buf_ops; |
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index e4652fe58958..fecdf31816f2 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h | |||
@@ -912,6 +912,9 @@ struct sctp_transport { | |||
912 | /* Is this structure kfree()able? */ | 912 | /* Is this structure kfree()able? */ |
913 | malloced:1; | 913 | malloced:1; |
914 | 914 | ||
915 | /* Has this transport moved the ctsn since we last sacked */ | ||
916 | __u32 sack_generation; | ||
917 | |||
915 | struct flowi fl; | 918 | struct flowi fl; |
916 | 919 | ||
917 | /* This is the peer's IP address and port. */ | 920 | /* This is the peer's IP address and port. */ |
@@ -1584,6 +1587,7 @@ struct sctp_association { | |||
1584 | */ | 1587 | */ |
1585 | __u8 sack_needed; /* Do we need to sack the peer? */ | 1588 | __u8 sack_needed; /* Do we need to sack the peer? */ |
1586 | __u32 sack_cnt; | 1589 | __u32 sack_cnt; |
1590 | __u32 sack_generation; | ||
1587 | 1591 | ||
1588 | /* These are capabilities which our peer advertised. */ | 1592 | /* These are capabilities which our peer advertised. */ |
1589 | __u8 ecn_capable:1, /* Can peer do ECN? */ | 1593 | __u8 ecn_capable:1, /* Can peer do ECN? */ |
diff --git a/include/net/sctp/tsnmap.h b/include/net/sctp/tsnmap.h index e7728bc14ccf..2c5d2b4d5d1e 100644 --- a/include/net/sctp/tsnmap.h +++ b/include/net/sctp/tsnmap.h | |||
@@ -117,7 +117,8 @@ void sctp_tsnmap_free(struct sctp_tsnmap *map); | |||
117 | int sctp_tsnmap_check(const struct sctp_tsnmap *, __u32 tsn); | 117 | int sctp_tsnmap_check(const struct sctp_tsnmap *, __u32 tsn); |
118 | 118 | ||
119 | /* Mark this TSN as seen. */ | 119 | /* Mark this TSN as seen. */ |
120 | int sctp_tsnmap_mark(struct sctp_tsnmap *, __u32 tsn); | 120 | int sctp_tsnmap_mark(struct sctp_tsnmap *, __u32 tsn, |
121 | struct sctp_transport *trans); | ||
121 | 122 | ||
122 | /* Mark this TSN and all lower as seen. */ | 123 | /* Mark this TSN and all lower as seen. */ |
123 | void sctp_tsnmap_skip(struct sctp_tsnmap *map, __u32 tsn); | 124 | void sctp_tsnmap_skip(struct sctp_tsnmap *map, __u32 tsn); |
diff --git a/kernel/printk.c b/kernel/printk.c index a2276b916769..dba18211685e 100644 --- a/kernel/printk.c +++ b/kernel/printk.c | |||
@@ -193,12 +193,19 @@ static int console_may_schedule; | |||
193 | * separated by ',', and find the message after the ';' character. | 193 | * separated by ',', and find the message after the ';' character. |
194 | */ | 194 | */ |
195 | 195 | ||
196 | enum log_flags { | ||
197 | LOG_DEFAULT = 0, | ||
198 | LOG_NOCONS = 1, /* already flushed, do not print to console */ | ||
199 | }; | ||
200 | |||
196 | struct log { | 201 | struct log { |
197 | u64 ts_nsec; /* timestamp in nanoseconds */ | 202 | u64 ts_nsec; /* timestamp in nanoseconds */ |
198 | u16 len; /* length of entire record */ | 203 | u16 len; /* length of entire record */ |
199 | u16 text_len; /* length of text buffer */ | 204 | u16 text_len; /* length of text buffer */ |
200 | u16 dict_len; /* length of dictionary buffer */ | 205 | u16 dict_len; /* length of dictionary buffer */ |
201 | u16 level; /* syslog level + facility */ | 206 | u8 facility; /* syslog facility */ |
207 | u8 flags:5; /* internal record flags */ | ||
208 | u8 level:3; /* syslog level */ | ||
202 | }; | 209 | }; |
203 | 210 | ||
204 | /* | 211 | /* |
@@ -286,6 +293,7 @@ static u32 log_next(u32 idx) | |||
286 | 293 | ||
287 | /* insert record into the buffer, discard old ones, update heads */ | 294 | /* insert record into the buffer, discard old ones, update heads */ |
288 | static void log_store(int facility, int level, | 295 | static void log_store(int facility, int level, |
296 | enum log_flags flags, u64 ts_nsec, | ||
289 | const char *dict, u16 dict_len, | 297 | const char *dict, u16 dict_len, |
290 | const char *text, u16 text_len) | 298 | const char *text, u16 text_len) |
291 | { | 299 | { |
@@ -329,8 +337,13 @@ static void log_store(int facility, int level, | |||
329 | msg->text_len = text_len; | 337 | msg->text_len = text_len; |
330 | memcpy(log_dict(msg), dict, dict_len); | 338 | memcpy(log_dict(msg), dict, dict_len); |
331 | msg->dict_len = dict_len; | 339 | msg->dict_len = dict_len; |
332 | msg->level = (facility << 3) | (level & 7); | 340 | msg->facility = facility; |
333 | msg->ts_nsec = local_clock(); | 341 | msg->level = level & 7; |
342 | msg->flags = flags & 0x1f; | ||
343 | if (ts_nsec > 0) | ||
344 | msg->ts_nsec = ts_nsec; | ||
345 | else | ||
346 | msg->ts_nsec = local_clock(); | ||
334 | memset(log_dict(msg) + dict_len, 0, pad_len); | 347 | memset(log_dict(msg) + dict_len, 0, pad_len); |
335 | msg->len = sizeof(struct log) + text_len + dict_len + pad_len; | 348 | msg->len = sizeof(struct log) + text_len + dict_len + pad_len; |
336 | 349 | ||
@@ -446,7 +459,7 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf, | |||
446 | ts_usec = msg->ts_nsec; | 459 | ts_usec = msg->ts_nsec; |
447 | do_div(ts_usec, 1000); | 460 | do_div(ts_usec, 1000); |
448 | len = sprintf(user->buf, "%u,%llu,%llu;", | 461 | len = sprintf(user->buf, "%u,%llu,%llu;", |
449 | msg->level, user->seq, ts_usec); | 462 | (msg->facility << 3) | msg->level, user->seq, ts_usec); |
450 | 463 | ||
451 | /* escape non-printable characters */ | 464 | /* escape non-printable characters */ |
452 | for (i = 0; i < msg->text_len; i++) { | 465 | for (i = 0; i < msg->text_len; i++) { |
@@ -787,6 +800,21 @@ static bool printk_time; | |||
787 | #endif | 800 | #endif |
788 | module_param_named(time, printk_time, bool, S_IRUGO | S_IWUSR); | 801 | module_param_named(time, printk_time, bool, S_IRUGO | S_IWUSR); |
789 | 802 | ||
803 | static size_t print_time(u64 ts, char *buf) | ||
804 | { | ||
805 | unsigned long rem_nsec; | ||
806 | |||
807 | if (!printk_time) | ||
808 | return 0; | ||
809 | |||
810 | if (!buf) | ||
811 | return 15; | ||
812 | |||
813 | rem_nsec = do_div(ts, 1000000000); | ||
814 | return sprintf(buf, "[%5lu.%06lu] ", | ||
815 | (unsigned long)ts, rem_nsec / 1000); | ||
816 | } | ||
817 | |||
790 | static size_t print_prefix(const struct log *msg, bool syslog, char *buf) | 818 | static size_t print_prefix(const struct log *msg, bool syslog, char *buf) |
791 | { | 819 | { |
792 | size_t len = 0; | 820 | size_t len = 0; |
@@ -803,18 +831,7 @@ static size_t print_prefix(const struct log *msg, bool syslog, char *buf) | |||
803 | } | 831 | } |
804 | } | 832 | } |
805 | 833 | ||
806 | if (printk_time) { | 834 | len += print_time(msg->ts_nsec, buf ? buf + len : NULL); |
807 | if (buf) { | ||
808 | unsigned long long ts = msg->ts_nsec; | ||
809 | unsigned long rem_nsec = do_div(ts, 1000000000); | ||
810 | |||
811 | len += sprintf(buf + len, "[%5lu.%06lu] ", | ||
812 | (unsigned long) ts, rem_nsec / 1000); | ||
813 | } else { | ||
814 | len += 15; | ||
815 | } | ||
816 | } | ||
817 | |||
818 | return len; | 835 | return len; |
819 | } | 836 | } |
820 | 837 | ||
@@ -862,28 +879,49 @@ static int syslog_print(char __user *buf, int size) | |||
862 | { | 879 | { |
863 | char *text; | 880 | char *text; |
864 | struct log *msg; | 881 | struct log *msg; |
865 | int len; | 882 | int len = 0; |
866 | 883 | ||
867 | text = kmalloc(LOG_LINE_MAX, GFP_KERNEL); | 884 | text = kmalloc(LOG_LINE_MAX, GFP_KERNEL); |
868 | if (!text) | 885 | if (!text) |
869 | return -ENOMEM; | 886 | return -ENOMEM; |
870 | 887 | ||
871 | raw_spin_lock_irq(&logbuf_lock); | 888 | while (size > 0) { |
872 | if (syslog_seq < log_first_seq) { | 889 | size_t n; |
873 | /* messages are gone, move to first one */ | ||
874 | syslog_seq = log_first_seq; | ||
875 | syslog_idx = log_first_idx; | ||
876 | } | ||
877 | msg = log_from_idx(syslog_idx); | ||
878 | len = msg_print_text(msg, true, text, LOG_LINE_MAX); | ||
879 | syslog_idx = log_next(syslog_idx); | ||
880 | syslog_seq++; | ||
881 | raw_spin_unlock_irq(&logbuf_lock); | ||
882 | 890 | ||
883 | if (len > size) | 891 | raw_spin_lock_irq(&logbuf_lock); |
884 | len = -EINVAL; | 892 | if (syslog_seq < log_first_seq) { |
885 | else if (len > 0 && copy_to_user(buf, text, len)) | 893 | /* messages are gone, move to first one */ |
886 | len = -EFAULT; | 894 | syslog_seq = log_first_seq; |
895 | syslog_idx = log_first_idx; | ||
896 | } | ||
897 | if (syslog_seq == log_next_seq) { | ||
898 | raw_spin_unlock_irq(&logbuf_lock); | ||
899 | break; | ||
900 | } | ||
901 | msg = log_from_idx(syslog_idx); | ||
902 | n = msg_print_text(msg, true, text, LOG_LINE_MAX); | ||
903 | if (n <= size) { | ||
904 | syslog_idx = log_next(syslog_idx); | ||
905 | syslog_seq++; | ||
906 | } else | ||
907 | n = 0; | ||
908 | raw_spin_unlock_irq(&logbuf_lock); | ||
909 | |||
910 | if (!n) | ||
911 | break; | ||
912 | |||
913 | len += n; | ||
914 | size -= n; | ||
915 | buf += n; | ||
916 | n = copy_to_user(buf - n, text, n); | ||
917 | |||
918 | if (n) { | ||
919 | len -= n; | ||
920 | if (!len) | ||
921 | len = -EFAULT; | ||
922 | break; | ||
923 | } | ||
924 | } | ||
887 | 925 | ||
888 | kfree(text); | 926 | kfree(text); |
889 | return len; | 927 | return len; |
@@ -1040,6 +1078,7 @@ int do_syslog(int type, char __user *buf, int len, bool from_file) | |||
1040 | /* Clear ring buffer */ | 1078 | /* Clear ring buffer */ |
1041 | case SYSLOG_ACTION_CLEAR: | 1079 | case SYSLOG_ACTION_CLEAR: |
1042 | syslog_print_all(NULL, 0, true); | 1080 | syslog_print_all(NULL, 0, true); |
1081 | break; | ||
1043 | /* Disable logging to console */ | 1082 | /* Disable logging to console */ |
1044 | case SYSLOG_ACTION_CONSOLE_OFF: | 1083 | case SYSLOG_ACTION_CONSOLE_OFF: |
1045 | if (saved_console_loglevel == -1) | 1084 | if (saved_console_loglevel == -1) |
@@ -1272,15 +1311,92 @@ static inline void printk_delay(void) | |||
1272 | } | 1311 | } |
1273 | } | 1312 | } |
1274 | 1313 | ||
1314 | /* | ||
1315 | * Continuation lines are buffered, and not committed to the record buffer | ||
1316 | * until the line is complete, or a race forces it. The line fragments | ||
1317 | * though, are printed immediately to the consoles to ensure everything has | ||
1318 | * reached the console in case of a kernel crash. | ||
1319 | */ | ||
1320 | static struct cont { | ||
1321 | char buf[LOG_LINE_MAX]; | ||
1322 | size_t len; /* length == 0 means unused buffer */ | ||
1323 | size_t cons; /* bytes written to console */ | ||
1324 | struct task_struct *owner; /* task of first print*/ | ||
1325 | u64 ts_nsec; /* time of first print */ | ||
1326 | u8 level; /* log level of first message */ | ||
1327 | u8 facility; /* log level of first message */ | ||
1328 | bool flushed:1; /* buffer sealed and committed */ | ||
1329 | } cont; | ||
1330 | |||
1331 | static void cont_flush(void) | ||
1332 | { | ||
1333 | if (cont.flushed) | ||
1334 | return; | ||
1335 | if (cont.len == 0) | ||
1336 | return; | ||
1337 | |||
1338 | log_store(cont.facility, cont.level, LOG_NOCONS, cont.ts_nsec, | ||
1339 | NULL, 0, cont.buf, cont.len); | ||
1340 | |||
1341 | cont.flushed = true; | ||
1342 | } | ||
1343 | |||
1344 | static bool cont_add(int facility, int level, const char *text, size_t len) | ||
1345 | { | ||
1346 | if (cont.len && cont.flushed) | ||
1347 | return false; | ||
1348 | |||
1349 | if (cont.len + len > sizeof(cont.buf)) { | ||
1350 | cont_flush(); | ||
1351 | return false; | ||
1352 | } | ||
1353 | |||
1354 | if (!cont.len) { | ||
1355 | cont.facility = facility; | ||
1356 | cont.level = level; | ||
1357 | cont.owner = current; | ||
1358 | cont.ts_nsec = local_clock(); | ||
1359 | cont.cons = 0; | ||
1360 | cont.flushed = false; | ||
1361 | } | ||
1362 | |||
1363 | memcpy(cont.buf + cont.len, text, len); | ||
1364 | cont.len += len; | ||
1365 | return true; | ||
1366 | } | ||
1367 | |||
1368 | static size_t cont_print_text(char *text, size_t size) | ||
1369 | { | ||
1370 | size_t textlen = 0; | ||
1371 | size_t len; | ||
1372 | |||
1373 | if (cont.cons == 0) { | ||
1374 | textlen += print_time(cont.ts_nsec, text); | ||
1375 | size -= textlen; | ||
1376 | } | ||
1377 | |||
1378 | len = cont.len - cont.cons; | ||
1379 | if (len > 0) { | ||
1380 | if (len+1 > size) | ||
1381 | len = size-1; | ||
1382 | memcpy(text + textlen, cont.buf + cont.cons, len); | ||
1383 | textlen += len; | ||
1384 | cont.cons = cont.len; | ||
1385 | } | ||
1386 | |||
1387 | if (cont.flushed) { | ||
1388 | text[textlen++] = '\n'; | ||
1389 | /* got everything, release buffer */ | ||
1390 | cont.len = 0; | ||
1391 | } | ||
1392 | return textlen; | ||
1393 | } | ||
1394 | |||
1275 | asmlinkage int vprintk_emit(int facility, int level, | 1395 | asmlinkage int vprintk_emit(int facility, int level, |
1276 | const char *dict, size_t dictlen, | 1396 | const char *dict, size_t dictlen, |
1277 | const char *fmt, va_list args) | 1397 | const char *fmt, va_list args) |
1278 | { | 1398 | { |
1279 | static int recursion_bug; | 1399 | static int recursion_bug; |
1280 | static char cont_buf[LOG_LINE_MAX]; | ||
1281 | static size_t cont_len; | ||
1282 | static int cont_level; | ||
1283 | static struct task_struct *cont_task; | ||
1284 | static char textbuf[LOG_LINE_MAX]; | 1400 | static char textbuf[LOG_LINE_MAX]; |
1285 | char *text = textbuf; | 1401 | char *text = textbuf; |
1286 | size_t text_len; | 1402 | size_t text_len; |
@@ -1326,7 +1442,8 @@ asmlinkage int vprintk_emit(int facility, int level, | |||
1326 | recursion_bug = 0; | 1442 | recursion_bug = 0; |
1327 | printed_len += strlen(recursion_msg); | 1443 | printed_len += strlen(recursion_msg); |
1328 | /* emit KERN_CRIT message */ | 1444 | /* emit KERN_CRIT message */ |
1329 | log_store(0, 2, NULL, 0, recursion_msg, printed_len); | 1445 | log_store(0, 2, LOG_DEFAULT, 0, |
1446 | NULL, 0, recursion_msg, printed_len); | ||
1330 | } | 1447 | } |
1331 | 1448 | ||
1332 | /* | 1449 | /* |
@@ -1364,55 +1481,37 @@ asmlinkage int vprintk_emit(int facility, int level, | |||
1364 | } | 1481 | } |
1365 | 1482 | ||
1366 | if (!newline) { | 1483 | if (!newline) { |
1367 | if (cont_len && (prefix || cont_task != current)) { | 1484 | /* |
1368 | /* | 1485 | * Flush the conflicting buffer. An earlier newline was missing, |
1369 | * Flush earlier buffer, which is either from a | 1486 | * or another task also prints continuation lines. |
1370 | * different thread, or when we got a new prefix. | 1487 | */ |
1371 | */ | 1488 | if (cont.len && (prefix || cont.owner != current)) |
1372 | log_store(facility, cont_level, NULL, 0, cont_buf, cont_len); | 1489 | cont_flush(); |
1373 | cont_len = 0; | ||
1374 | } | ||
1375 | |||
1376 | if (!cont_len) { | ||
1377 | cont_level = level; | ||
1378 | cont_task = current; | ||
1379 | } | ||
1380 | 1490 | ||
1381 | /* buffer or append to earlier buffer from the same thread */ | 1491 | /* buffer line if possible, otherwise store it right away */ |
1382 | if (cont_len + text_len > sizeof(cont_buf)) | 1492 | if (!cont_add(facility, level, text, text_len)) |
1383 | text_len = sizeof(cont_buf) - cont_len; | 1493 | log_store(facility, level, LOG_DEFAULT, 0, |
1384 | memcpy(cont_buf + cont_len, text, text_len); | 1494 | dict, dictlen, text, text_len); |
1385 | cont_len += text_len; | ||
1386 | } else { | 1495 | } else { |
1387 | if (cont_len && cont_task == current) { | 1496 | bool stored = false; |
1388 | if (prefix) { | ||
1389 | /* | ||
1390 | * New prefix from the same thread; flush. We | ||
1391 | * either got no earlier newline, or we race | ||
1392 | * with an interrupt. | ||
1393 | */ | ||
1394 | log_store(facility, cont_level, | ||
1395 | NULL, 0, cont_buf, cont_len); | ||
1396 | cont_len = 0; | ||
1397 | } | ||
1398 | 1497 | ||
1399 | /* append to the earlier buffer and flush */ | 1498 | /* |
1400 | if (cont_len + text_len > sizeof(cont_buf)) | 1499 | * If an earlier newline was missing and it was the same task, |
1401 | text_len = sizeof(cont_buf) - cont_len; | 1500 | * either merge it with the current buffer and flush, or if |
1402 | memcpy(cont_buf + cont_len, text, text_len); | 1501 | * there was a race with interrupts (prefix == true) then just |
1403 | cont_len += text_len; | 1502 | * flush it out and store this line separately. |
1404 | log_store(facility, cont_level, | 1503 | */ |
1405 | NULL, 0, cont_buf, cont_len); | 1504 | if (cont.len && cont.owner == current) { |
1406 | cont_len = 0; | 1505 | if (!prefix) |
1407 | cont_task = NULL; | 1506 | stored = cont_add(facility, level, text, text_len); |
1408 | printed_len = cont_len; | 1507 | cont_flush(); |
1409 | } else { | ||
1410 | /* ordinary single and terminated line */ | ||
1411 | log_store(facility, level, | ||
1412 | dict, dictlen, text, text_len); | ||
1413 | printed_len = text_len; | ||
1414 | } | 1508 | } |
1509 | |||
1510 | if (!stored) | ||
1511 | log_store(facility, level, LOG_DEFAULT, 0, | ||
1512 | dict, dictlen, text, text_len); | ||
1415 | } | 1513 | } |
1514 | printed_len += text_len; | ||
1416 | 1515 | ||
1417 | /* | 1516 | /* |
1418 | * Try to acquire and then immediately release the console semaphore. | 1517 | * Try to acquire and then immediately release the console semaphore. |
@@ -1499,11 +1598,18 @@ EXPORT_SYMBOL(printk); | |||
1499 | #else | 1598 | #else |
1500 | 1599 | ||
1501 | #define LOG_LINE_MAX 0 | 1600 | #define LOG_LINE_MAX 0 |
1601 | static struct cont { | ||
1602 | size_t len; | ||
1603 | size_t cons; | ||
1604 | u8 level; | ||
1605 | bool flushed:1; | ||
1606 | } cont; | ||
1502 | static struct log *log_from_idx(u32 idx) { return NULL; } | 1607 | static struct log *log_from_idx(u32 idx) { return NULL; } |
1503 | static u32 log_next(u32 idx) { return 0; } | 1608 | static u32 log_next(u32 idx) { return 0; } |
1504 | static void call_console_drivers(int level, const char *text, size_t len) {} | 1609 | static void call_console_drivers(int level, const char *text, size_t len) {} |
1505 | static size_t msg_print_text(const struct log *msg, bool syslog, | 1610 | static size_t msg_print_text(const struct log *msg, bool syslog, |
1506 | char *buf, size_t size) { return 0; } | 1611 | char *buf, size_t size) { return 0; } |
1612 | static size_t cont_print_text(char *text, size_t size) { return 0; } | ||
1507 | 1613 | ||
1508 | #endif /* CONFIG_PRINTK */ | 1614 | #endif /* CONFIG_PRINTK */ |
1509 | 1615 | ||
@@ -1795,6 +1901,7 @@ static u32 console_idx; | |||
1795 | */ | 1901 | */ |
1796 | void console_unlock(void) | 1902 | void console_unlock(void) |
1797 | { | 1903 | { |
1904 | static char text[LOG_LINE_MAX]; | ||
1798 | static u64 seen_seq; | 1905 | static u64 seen_seq; |
1799 | unsigned long flags; | 1906 | unsigned long flags; |
1800 | bool wake_klogd = false; | 1907 | bool wake_klogd = false; |
@@ -1807,10 +1914,23 @@ void console_unlock(void) | |||
1807 | 1914 | ||
1808 | console_may_schedule = 0; | 1915 | console_may_schedule = 0; |
1809 | 1916 | ||
1917 | /* flush buffered message fragment immediately to console */ | ||
1918 | raw_spin_lock_irqsave(&logbuf_lock, flags); | ||
1919 | if (cont.len && (cont.cons < cont.len || cont.flushed)) { | ||
1920 | size_t len; | ||
1921 | |||
1922 | len = cont_print_text(text, sizeof(text)); | ||
1923 | raw_spin_unlock(&logbuf_lock); | ||
1924 | stop_critical_timings(); | ||
1925 | call_console_drivers(cont.level, text, len); | ||
1926 | start_critical_timings(); | ||
1927 | local_irq_restore(flags); | ||
1928 | } else | ||
1929 | raw_spin_unlock_irqrestore(&logbuf_lock, flags); | ||
1930 | |||
1810 | again: | 1931 | again: |
1811 | for (;;) { | 1932 | for (;;) { |
1812 | struct log *msg; | 1933 | struct log *msg; |
1813 | static char text[LOG_LINE_MAX]; | ||
1814 | size_t len; | 1934 | size_t len; |
1815 | int level; | 1935 | int level; |
1816 | 1936 | ||
@@ -1825,13 +1945,22 @@ again: | |||
1825 | console_seq = log_first_seq; | 1945 | console_seq = log_first_seq; |
1826 | console_idx = log_first_idx; | 1946 | console_idx = log_first_idx; |
1827 | } | 1947 | } |
1828 | 1948 | skip: | |
1829 | if (console_seq == log_next_seq) | 1949 | if (console_seq == log_next_seq) |
1830 | break; | 1950 | break; |
1831 | 1951 | ||
1832 | msg = log_from_idx(console_idx); | 1952 | msg = log_from_idx(console_idx); |
1833 | level = msg->level & 7; | 1953 | if (msg->flags & LOG_NOCONS) { |
1954 | /* | ||
1955 | * Skip record we have buffered and already printed | ||
1956 | * directly to the console when we received it. | ||
1957 | */ | ||
1958 | console_idx = log_next(console_idx); | ||
1959 | console_seq++; | ||
1960 | goto skip; | ||
1961 | } | ||
1834 | 1962 | ||
1963 | level = msg->level; | ||
1835 | len = msg_print_text(msg, false, text, sizeof(text)); | 1964 | len = msg_print_text(msg, false, text, sizeof(text)); |
1836 | 1965 | ||
1837 | console_idx = log_next(console_idx); | 1966 | console_idx = log_next(console_idx); |
@@ -2409,7 +2538,7 @@ EXPORT_SYMBOL_GPL(kmsg_dump_get_line); | |||
2409 | * kmsg_dump_get_buffer - copy kmsg log lines | 2538 | * kmsg_dump_get_buffer - copy kmsg log lines |
2410 | * @dumper: registered kmsg dumper | 2539 | * @dumper: registered kmsg dumper |
2411 | * @syslog: include the "<4>" prefixes | 2540 | * @syslog: include the "<4>" prefixes |
2412 | * @line: buffer to copy the line to | 2541 | * @buf: buffer to copy the line to |
2413 | * @size: maximum size of the buffer | 2542 | * @size: maximum size of the buffer |
2414 | * @len: length of line placed into buffer | 2543 | * @len: length of line placed into buffer |
2415 | * | 2544 | * |
diff --git a/kernel/rcutree.c b/kernel/rcutree.c index 3b0f1337f75b..38ecdda3f55f 100644 --- a/kernel/rcutree.c +++ b/kernel/rcutree.c | |||
@@ -1530,7 +1530,7 @@ static void rcu_do_batch(struct rcu_state *rsp, struct rcu_data *rdp) | |||
1530 | { | 1530 | { |
1531 | unsigned long flags; | 1531 | unsigned long flags; |
1532 | struct rcu_head *next, *list, **tail; | 1532 | struct rcu_head *next, *list, **tail; |
1533 | int bl, count, count_lazy; | 1533 | int bl, count, count_lazy, i; |
1534 | 1534 | ||
1535 | /* If no callbacks are ready, just return.*/ | 1535 | /* If no callbacks are ready, just return.*/ |
1536 | if (!cpu_has_callbacks_ready_to_invoke(rdp)) { | 1536 | if (!cpu_has_callbacks_ready_to_invoke(rdp)) { |
@@ -1553,9 +1553,9 @@ static void rcu_do_batch(struct rcu_state *rsp, struct rcu_data *rdp) | |||
1553 | rdp->nxtlist = *rdp->nxttail[RCU_DONE_TAIL]; | 1553 | rdp->nxtlist = *rdp->nxttail[RCU_DONE_TAIL]; |
1554 | *rdp->nxttail[RCU_DONE_TAIL] = NULL; | 1554 | *rdp->nxttail[RCU_DONE_TAIL] = NULL; |
1555 | tail = rdp->nxttail[RCU_DONE_TAIL]; | 1555 | tail = rdp->nxttail[RCU_DONE_TAIL]; |
1556 | for (count = RCU_NEXT_SIZE - 1; count >= 0; count--) | 1556 | for (i = RCU_NEXT_SIZE - 1; i >= 0; i--) |
1557 | if (rdp->nxttail[count] == rdp->nxttail[RCU_DONE_TAIL]) | 1557 | if (rdp->nxttail[i] == rdp->nxttail[RCU_DONE_TAIL]) |
1558 | rdp->nxttail[count] = &rdp->nxtlist; | 1558 | rdp->nxttail[i] = &rdp->nxtlist; |
1559 | local_irq_restore(flags); | 1559 | local_irq_restore(flags); |
1560 | 1560 | ||
1561 | /* Invoke callbacks. */ | 1561 | /* Invoke callbacks. */ |
@@ -1583,9 +1583,9 @@ static void rcu_do_batch(struct rcu_state *rsp, struct rcu_data *rdp) | |||
1583 | if (list != NULL) { | 1583 | if (list != NULL) { |
1584 | *tail = rdp->nxtlist; | 1584 | *tail = rdp->nxtlist; |
1585 | rdp->nxtlist = list; | 1585 | rdp->nxtlist = list; |
1586 | for (count = 0; count < RCU_NEXT_SIZE; count++) | 1586 | for (i = 0; i < RCU_NEXT_SIZE; i++) |
1587 | if (&rdp->nxtlist == rdp->nxttail[count]) | 1587 | if (&rdp->nxtlist == rdp->nxttail[i]) |
1588 | rdp->nxttail[count] = tail; | 1588 | rdp->nxttail[i] = tail; |
1589 | else | 1589 | else |
1590 | break; | 1590 | break; |
1591 | } | 1591 | } |
diff --git a/kernel/relay.c b/kernel/relay.c index ab56a1764d4d..e8cd2027abbd 100644 --- a/kernel/relay.c +++ b/kernel/relay.c | |||
@@ -1235,6 +1235,7 @@ static ssize_t subbuf_splice_actor(struct file *in, | |||
1235 | struct splice_pipe_desc spd = { | 1235 | struct splice_pipe_desc spd = { |
1236 | .pages = pages, | 1236 | .pages = pages, |
1237 | .nr_pages = 0, | 1237 | .nr_pages = 0, |
1238 | .nr_pages_max = PIPE_DEF_BUFFERS, | ||
1238 | .partial = partial, | 1239 | .partial = partial, |
1239 | .flags = flags, | 1240 | .flags = flags, |
1240 | .ops = &relay_pipe_buf_ops, | 1241 | .ops = &relay_pipe_buf_ops, |
@@ -1302,8 +1303,8 @@ static ssize_t subbuf_splice_actor(struct file *in, | |||
1302 | ret += padding; | 1303 | ret += padding; |
1303 | 1304 | ||
1304 | out: | 1305 | out: |
1305 | splice_shrink_spd(pipe, &spd); | 1306 | splice_shrink_spd(&spd); |
1306 | return ret; | 1307 | return ret; |
1307 | } | 1308 | } |
1308 | 1309 | ||
1309 | static ssize_t relay_file_splice_read(struct file *in, | 1310 | static ssize_t relay_file_splice_read(struct file *in, |
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 49249c28690d..a7fa0702be1c 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -3609,6 +3609,7 @@ static ssize_t tracing_splice_read_pipe(struct file *filp, | |||
3609 | .pages = pages_def, | 3609 | .pages = pages_def, |
3610 | .partial = partial_def, | 3610 | .partial = partial_def, |
3611 | .nr_pages = 0, /* This gets updated below. */ | 3611 | .nr_pages = 0, /* This gets updated below. */ |
3612 | .nr_pages_max = PIPE_DEF_BUFFERS, | ||
3612 | .flags = flags, | 3613 | .flags = flags, |
3613 | .ops = &tracing_pipe_buf_ops, | 3614 | .ops = &tracing_pipe_buf_ops, |
3614 | .spd_release = tracing_spd_release_pipe, | 3615 | .spd_release = tracing_spd_release_pipe, |
@@ -3680,7 +3681,7 @@ static ssize_t tracing_splice_read_pipe(struct file *filp, | |||
3680 | 3681 | ||
3681 | ret = splice_to_pipe(pipe, &spd); | 3682 | ret = splice_to_pipe(pipe, &spd); |
3682 | out: | 3683 | out: |
3683 | splice_shrink_spd(pipe, &spd); | 3684 | splice_shrink_spd(&spd); |
3684 | return ret; | 3685 | return ret; |
3685 | 3686 | ||
3686 | out_err: | 3687 | out_err: |
@@ -4231,6 +4232,7 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos, | |||
4231 | struct splice_pipe_desc spd = { | 4232 | struct splice_pipe_desc spd = { |
4232 | .pages = pages_def, | 4233 | .pages = pages_def, |
4233 | .partial = partial_def, | 4234 | .partial = partial_def, |
4235 | .nr_pages_max = PIPE_DEF_BUFFERS, | ||
4234 | .flags = flags, | 4236 | .flags = flags, |
4235 | .ops = &buffer_pipe_buf_ops, | 4237 | .ops = &buffer_pipe_buf_ops, |
4236 | .spd_release = buffer_spd_release, | 4238 | .spd_release = buffer_spd_release, |
@@ -4318,7 +4320,7 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos, | |||
4318 | } | 4320 | } |
4319 | 4321 | ||
4320 | ret = splice_to_pipe(pipe, &spd); | 4322 | ret = splice_to_pipe(pipe, &spd); |
4321 | splice_shrink_spd(pipe, &spd); | 4323 | splice_shrink_spd(&spd); |
4322 | out: | 4324 | out: |
4323 | return ret; | 4325 | return ret; |
4324 | } | 4326 | } |
diff --git a/mm/shmem.c b/mm/shmem.c index a15a466d0d1d..4ce02e0673db 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -1594,6 +1594,7 @@ static ssize_t shmem_file_splice_read(struct file *in, loff_t *ppos, | |||
1594 | struct splice_pipe_desc spd = { | 1594 | struct splice_pipe_desc spd = { |
1595 | .pages = pages, | 1595 | .pages = pages, |
1596 | .partial = partial, | 1596 | .partial = partial, |
1597 | .nr_pages_max = PIPE_DEF_BUFFERS, | ||
1597 | .flags = flags, | 1598 | .flags = flags, |
1598 | .ops = &page_cache_pipe_buf_ops, | 1599 | .ops = &page_cache_pipe_buf_ops, |
1599 | .spd_release = spd_release_page, | 1600 | .spd_release = spd_release_page, |
@@ -1682,7 +1683,7 @@ static ssize_t shmem_file_splice_read(struct file *in, loff_t *ppos, | |||
1682 | if (spd.nr_pages) | 1683 | if (spd.nr_pages) |
1683 | error = splice_to_pipe(pipe, &spd); | 1684 | error = splice_to_pipe(pipe, &spd); |
1684 | 1685 | ||
1685 | splice_shrink_spd(pipe, &spd); | 1686 | splice_shrink_spd(&spd); |
1686 | 1687 | ||
1687 | if (error > 0) { | 1688 | if (error > 0) { |
1688 | *ppos += error; | 1689 | *ppos += error; |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 5b21522ed0e1..5a789a807ec3 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -1755,6 +1755,7 @@ int skb_splice_bits(struct sk_buff *skb, unsigned int offset, | |||
1755 | struct splice_pipe_desc spd = { | 1755 | struct splice_pipe_desc spd = { |
1756 | .pages = pages, | 1756 | .pages = pages, |
1757 | .partial = partial, | 1757 | .partial = partial, |
1758 | .nr_pages_max = MAX_SKB_FRAGS, | ||
1758 | .flags = flags, | 1759 | .flags = flags, |
1759 | .ops = &sock_pipe_buf_ops, | 1760 | .ops = &sock_pipe_buf_ops, |
1760 | .spd_release = sock_spd_release, | 1761 | .spd_release = sock_spd_release, |
diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c index 819c342f5b30..9730882697aa 100644 --- a/net/netfilter/ipset/ip_set_core.c +++ b/net/netfilter/ipset/ip_set_core.c | |||
@@ -640,6 +640,14 @@ find_free_id(const char *name, ip_set_id_t *index, struct ip_set **set) | |||
640 | } | 640 | } |
641 | 641 | ||
642 | static int | 642 | static int |
643 | ip_set_none(struct sock *ctnl, struct sk_buff *skb, | ||
644 | const struct nlmsghdr *nlh, | ||
645 | const struct nlattr * const attr[]) | ||
646 | { | ||
647 | return -EOPNOTSUPP; | ||
648 | } | ||
649 | |||
650 | static int | ||
643 | ip_set_create(struct sock *ctnl, struct sk_buff *skb, | 651 | ip_set_create(struct sock *ctnl, struct sk_buff *skb, |
644 | const struct nlmsghdr *nlh, | 652 | const struct nlmsghdr *nlh, |
645 | const struct nlattr * const attr[]) | 653 | const struct nlattr * const attr[]) |
@@ -1539,6 +1547,10 @@ nlmsg_failure: | |||
1539 | } | 1547 | } |
1540 | 1548 | ||
1541 | static const struct nfnl_callback ip_set_netlink_subsys_cb[IPSET_MSG_MAX] = { | 1549 | static const struct nfnl_callback ip_set_netlink_subsys_cb[IPSET_MSG_MAX] = { |
1550 | [IPSET_CMD_NONE] = { | ||
1551 | .call = ip_set_none, | ||
1552 | .attr_count = IPSET_ATTR_CMD_MAX, | ||
1553 | }, | ||
1542 | [IPSET_CMD_CREATE] = { | 1554 | [IPSET_CMD_CREATE] = { |
1543 | .call = ip_set_create, | 1555 | .call = ip_set_create, |
1544 | .attr_count = IPSET_ATTR_CMD_MAX, | 1556 | .attr_count = IPSET_ATTR_CMD_MAX, |
diff --git a/net/netfilter/ipset/ip_set_hash_netiface.c b/net/netfilter/ipset/ip_set_hash_netiface.c index ee863943c826..d5d3607ae7bc 100644 --- a/net/netfilter/ipset/ip_set_hash_netiface.c +++ b/net/netfilter/ipset/ip_set_hash_netiface.c | |||
@@ -38,30 +38,6 @@ struct iface_node { | |||
38 | 38 | ||
39 | #define iface_data(n) (rb_entry(n, struct iface_node, node)->iface) | 39 | #define iface_data(n) (rb_entry(n, struct iface_node, node)->iface) |
40 | 40 | ||
41 | static inline long | ||
42 | ifname_compare(const char *_a, const char *_b) | ||
43 | { | ||
44 | const long *a = (const long *)_a; | ||
45 | const long *b = (const long *)_b; | ||
46 | |||
47 | BUILD_BUG_ON(IFNAMSIZ > 4 * sizeof(unsigned long)); | ||
48 | if (a[0] != b[0]) | ||
49 | return a[0] - b[0]; | ||
50 | if (IFNAMSIZ > sizeof(long)) { | ||
51 | if (a[1] != b[1]) | ||
52 | return a[1] - b[1]; | ||
53 | } | ||
54 | if (IFNAMSIZ > 2 * sizeof(long)) { | ||
55 | if (a[2] != b[2]) | ||
56 | return a[2] - b[2]; | ||
57 | } | ||
58 | if (IFNAMSIZ > 3 * sizeof(long)) { | ||
59 | if (a[3] != b[3]) | ||
60 | return a[3] - b[3]; | ||
61 | } | ||
62 | return 0; | ||
63 | } | ||
64 | |||
65 | static void | 41 | static void |
66 | rbtree_destroy(struct rb_root *root) | 42 | rbtree_destroy(struct rb_root *root) |
67 | { | 43 | { |
@@ -99,7 +75,7 @@ iface_test(struct rb_root *root, const char **iface) | |||
99 | 75 | ||
100 | while (n) { | 76 | while (n) { |
101 | const char *d = iface_data(n); | 77 | const char *d = iface_data(n); |
102 | long res = ifname_compare(*iface, d); | 78 | int res = strcmp(*iface, d); |
103 | 79 | ||
104 | if (res < 0) | 80 | if (res < 0) |
105 | n = n->rb_left; | 81 | n = n->rb_left; |
@@ -121,7 +97,7 @@ iface_add(struct rb_root *root, const char **iface) | |||
121 | 97 | ||
122 | while (*n) { | 98 | while (*n) { |
123 | char *ifname = iface_data(*n); | 99 | char *ifname = iface_data(*n); |
124 | long res = ifname_compare(*iface, ifname); | 100 | int res = strcmp(*iface, ifname); |
125 | 101 | ||
126 | p = *n; | 102 | p = *n; |
127 | if (res < 0) | 103 | if (res < 0) |
@@ -366,7 +342,7 @@ hash_netiface4_uadt(struct ip_set *set, struct nlattr *tb[], | |||
366 | struct hash_netiface4_elem data = { .cidr = HOST_MASK }; | 342 | struct hash_netiface4_elem data = { .cidr = HOST_MASK }; |
367 | u32 ip = 0, ip_to, last; | 343 | u32 ip = 0, ip_to, last; |
368 | u32 timeout = h->timeout; | 344 | u32 timeout = h->timeout; |
369 | char iface[IFNAMSIZ] = {}; | 345 | char iface[IFNAMSIZ]; |
370 | int ret; | 346 | int ret; |
371 | 347 | ||
372 | if (unlikely(!tb[IPSET_ATTR_IP] || | 348 | if (unlikely(!tb[IPSET_ATTR_IP] || |
@@ -663,7 +639,7 @@ hash_netiface6_uadt(struct ip_set *set, struct nlattr *tb[], | |||
663 | ipset_adtfn adtfn = set->variant->adt[adt]; | 639 | ipset_adtfn adtfn = set->variant->adt[adt]; |
664 | struct hash_netiface6_elem data = { .cidr = HOST_MASK }; | 640 | struct hash_netiface6_elem data = { .cidr = HOST_MASK }; |
665 | u32 timeout = h->timeout; | 641 | u32 timeout = h->timeout; |
666 | char iface[IFNAMSIZ] = {}; | 642 | char iface[IFNAMSIZ]; |
667 | int ret; | 643 | int ret; |
668 | 644 | ||
669 | if (unlikely(!tb[IPSET_ATTR_IP] || | 645 | if (unlikely(!tb[IPSET_ATTR_IP] || |
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c index dd811b8dd97c..d43e3c122f7b 100644 --- a/net/netfilter/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c | |||
@@ -76,19 +76,19 @@ static void __ip_vs_del_service(struct ip_vs_service *svc); | |||
76 | 76 | ||
77 | #ifdef CONFIG_IP_VS_IPV6 | 77 | #ifdef CONFIG_IP_VS_IPV6 |
78 | /* Taken from rt6_fill_node() in net/ipv6/route.c, is there a better way? */ | 78 | /* Taken from rt6_fill_node() in net/ipv6/route.c, is there a better way? */ |
79 | static int __ip_vs_addr_is_local_v6(struct net *net, | 79 | static bool __ip_vs_addr_is_local_v6(struct net *net, |
80 | const struct in6_addr *addr) | 80 | const struct in6_addr *addr) |
81 | { | 81 | { |
82 | struct rt6_info *rt; | ||
83 | struct flowi6 fl6 = { | 82 | struct flowi6 fl6 = { |
84 | .daddr = *addr, | 83 | .daddr = *addr, |
85 | }; | 84 | }; |
85 | struct dst_entry *dst = ip6_route_output(net, NULL, &fl6); | ||
86 | bool is_local; | ||
86 | 87 | ||
87 | rt = (struct rt6_info *)ip6_route_output(net, NULL, &fl6); | 88 | is_local = !dst->error && dst->dev && (dst->dev->flags & IFF_LOOPBACK); |
88 | if (rt && rt->dst.dev && (rt->dst.dev->flags & IFF_LOOPBACK)) | ||
89 | return 1; | ||
90 | 89 | ||
91 | return 0; | 90 | dst_release(dst); |
91 | return is_local; | ||
92 | } | 92 | } |
93 | #endif | 93 | #endif |
94 | 94 | ||
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c index 5a2132b97fe9..465539d43a0a 100644 --- a/net/netfilter/nfnetlink.c +++ b/net/netfilter/nfnetlink.c | |||
@@ -178,8 +178,10 @@ replay: | |||
178 | 178 | ||
179 | err = nla_parse(cda, ss->cb[cb_id].attr_count, | 179 | err = nla_parse(cda, ss->cb[cb_id].attr_count, |
180 | attr, attrlen, ss->cb[cb_id].policy); | 180 | attr, attrlen, ss->cb[cb_id].policy); |
181 | if (err < 0) | 181 | if (err < 0) { |
182 | rcu_read_unlock(); | ||
182 | return err; | 183 | return err; |
184 | } | ||
183 | 185 | ||
184 | if (nc->call_rcu) { | 186 | if (nc->call_rcu) { |
185 | err = nc->call_rcu(net->nfnl, skb, nlh, | 187 | err = nc->call_rcu(net->nfnl, skb, nlh, |
diff --git a/net/sctp/associola.c b/net/sctp/associola.c index 5bc9ab161b37..b16517ee1aaf 100644 --- a/net/sctp/associola.c +++ b/net/sctp/associola.c | |||
@@ -271,6 +271,7 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a | |||
271 | */ | 271 | */ |
272 | asoc->peer.sack_needed = 1; | 272 | asoc->peer.sack_needed = 1; |
273 | asoc->peer.sack_cnt = 0; | 273 | asoc->peer.sack_cnt = 0; |
274 | asoc->peer.sack_generation = 1; | ||
274 | 275 | ||
275 | /* Assume that the peer will tell us if he recognizes ASCONF | 276 | /* Assume that the peer will tell us if he recognizes ASCONF |
276 | * as part of INIT exchange. | 277 | * as part of INIT exchange. |
diff --git a/net/sctp/output.c b/net/sctp/output.c index f1b7d4bb591e..6ae47acaaec6 100644 --- a/net/sctp/output.c +++ b/net/sctp/output.c | |||
@@ -248,6 +248,11 @@ static sctp_xmit_t sctp_packet_bundle_sack(struct sctp_packet *pkt, | |||
248 | /* If the SACK timer is running, we have a pending SACK */ | 248 | /* If the SACK timer is running, we have a pending SACK */ |
249 | if (timer_pending(timer)) { | 249 | if (timer_pending(timer)) { |
250 | struct sctp_chunk *sack; | 250 | struct sctp_chunk *sack; |
251 | |||
252 | if (pkt->transport->sack_generation != | ||
253 | pkt->transport->asoc->peer.sack_generation) | ||
254 | return retval; | ||
255 | |||
251 | asoc->a_rwnd = asoc->rwnd; | 256 | asoc->a_rwnd = asoc->rwnd; |
252 | sack = sctp_make_sack(asoc); | 257 | sack = sctp_make_sack(asoc); |
253 | if (sack) { | 258 | if (sack) { |
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index a85eeeb55dd0..b6de71efb140 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c | |||
@@ -734,8 +734,10 @@ struct sctp_chunk *sctp_make_sack(const struct sctp_association *asoc) | |||
734 | int len; | 734 | int len; |
735 | __u32 ctsn; | 735 | __u32 ctsn; |
736 | __u16 num_gabs, num_dup_tsns; | 736 | __u16 num_gabs, num_dup_tsns; |
737 | struct sctp_association *aptr = (struct sctp_association *)asoc; | ||
737 | struct sctp_tsnmap *map = (struct sctp_tsnmap *)&asoc->peer.tsn_map; | 738 | struct sctp_tsnmap *map = (struct sctp_tsnmap *)&asoc->peer.tsn_map; |
738 | struct sctp_gap_ack_block gabs[SCTP_MAX_GABS]; | 739 | struct sctp_gap_ack_block gabs[SCTP_MAX_GABS]; |
740 | struct sctp_transport *trans; | ||
739 | 741 | ||
740 | memset(gabs, 0, sizeof(gabs)); | 742 | memset(gabs, 0, sizeof(gabs)); |
741 | ctsn = sctp_tsnmap_get_ctsn(map); | 743 | ctsn = sctp_tsnmap_get_ctsn(map); |
@@ -805,6 +807,20 @@ struct sctp_chunk *sctp_make_sack(const struct sctp_association *asoc) | |||
805 | sctp_addto_chunk(retval, sizeof(__u32) * num_dup_tsns, | 807 | sctp_addto_chunk(retval, sizeof(__u32) * num_dup_tsns, |
806 | sctp_tsnmap_get_dups(map)); | 808 | sctp_tsnmap_get_dups(map)); |
807 | 809 | ||
810 | /* Once we have a sack generated, check to see what our sack | ||
811 | * generation is, if its 0, reset the transports to 0, and reset | ||
812 | * the association generation to 1 | ||
813 | * | ||
814 | * The idea is that zero is never used as a valid generation for the | ||
815 | * association so no transport will match after a wrap event like this, | ||
816 | * Until the next sack | ||
817 | */ | ||
818 | if (++aptr->peer.sack_generation == 0) { | ||
819 | list_for_each_entry(trans, &asoc->peer.transport_addr_list, | ||
820 | transports) | ||
821 | trans->sack_generation = 0; | ||
822 | aptr->peer.sack_generation = 1; | ||
823 | } | ||
808 | nodata: | 824 | nodata: |
809 | return retval; | 825 | return retval; |
810 | } | 826 | } |
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c index c96d1a81cf42..8716da1a8592 100644 --- a/net/sctp/sm_sideeffect.c +++ b/net/sctp/sm_sideeffect.c | |||
@@ -1268,7 +1268,7 @@ static int sctp_cmd_interpreter(sctp_event_t event_type, | |||
1268 | case SCTP_CMD_REPORT_TSN: | 1268 | case SCTP_CMD_REPORT_TSN: |
1269 | /* Record the arrival of a TSN. */ | 1269 | /* Record the arrival of a TSN. */ |
1270 | error = sctp_tsnmap_mark(&asoc->peer.tsn_map, | 1270 | error = sctp_tsnmap_mark(&asoc->peer.tsn_map, |
1271 | cmd->obj.u32); | 1271 | cmd->obj.u32, NULL); |
1272 | break; | 1272 | break; |
1273 | 1273 | ||
1274 | case SCTP_CMD_REPORT_FWDTSN: | 1274 | case SCTP_CMD_REPORT_FWDTSN: |
diff --git a/net/sctp/transport.c b/net/sctp/transport.c index b026ba0c6992..1dcceb6e0ce6 100644 --- a/net/sctp/transport.c +++ b/net/sctp/transport.c | |||
@@ -68,6 +68,8 @@ static struct sctp_transport *sctp_transport_init(struct sctp_transport *peer, | |||
68 | peer->af_specific = sctp_get_af_specific(addr->sa.sa_family); | 68 | peer->af_specific = sctp_get_af_specific(addr->sa.sa_family); |
69 | memset(&peer->saddr, 0, sizeof(union sctp_addr)); | 69 | memset(&peer->saddr, 0, sizeof(union sctp_addr)); |
70 | 70 | ||
71 | peer->sack_generation = 0; | ||
72 | |||
71 | /* From 6.3.1 RTO Calculation: | 73 | /* From 6.3.1 RTO Calculation: |
72 | * | 74 | * |
73 | * C1) Until an RTT measurement has been made for a packet sent to the | 75 | * C1) Until an RTT measurement has been made for a packet sent to the |
diff --git a/net/sctp/tsnmap.c b/net/sctp/tsnmap.c index f1e40cebc981..b5fb7c409023 100644 --- a/net/sctp/tsnmap.c +++ b/net/sctp/tsnmap.c | |||
@@ -114,7 +114,8 @@ int sctp_tsnmap_check(const struct sctp_tsnmap *map, __u32 tsn) | |||
114 | 114 | ||
115 | 115 | ||
116 | /* Mark this TSN as seen. */ | 116 | /* Mark this TSN as seen. */ |
117 | int sctp_tsnmap_mark(struct sctp_tsnmap *map, __u32 tsn) | 117 | int sctp_tsnmap_mark(struct sctp_tsnmap *map, __u32 tsn, |
118 | struct sctp_transport *trans) | ||
118 | { | 119 | { |
119 | u16 gap; | 120 | u16 gap; |
120 | 121 | ||
@@ -133,6 +134,9 @@ int sctp_tsnmap_mark(struct sctp_tsnmap *map, __u32 tsn) | |||
133 | */ | 134 | */ |
134 | map->max_tsn_seen++; | 135 | map->max_tsn_seen++; |
135 | map->cumulative_tsn_ack_point++; | 136 | map->cumulative_tsn_ack_point++; |
137 | if (trans) | ||
138 | trans->sack_generation = | ||
139 | trans->asoc->peer.sack_generation; | ||
136 | map->base_tsn++; | 140 | map->base_tsn++; |
137 | } else { | 141 | } else { |
138 | /* Either we already have a gap, or about to record a gap, so | 142 | /* Either we already have a gap, or about to record a gap, so |
diff --git a/net/sctp/ulpevent.c b/net/sctp/ulpevent.c index 8a84017834c2..33d894776192 100644 --- a/net/sctp/ulpevent.c +++ b/net/sctp/ulpevent.c | |||
@@ -715,7 +715,8 @@ struct sctp_ulpevent *sctp_ulpevent_make_rcvmsg(struct sctp_association *asoc, | |||
715 | * can mark it as received so the tsn_map is updated correctly. | 715 | * can mark it as received so the tsn_map is updated correctly. |
716 | */ | 716 | */ |
717 | if (sctp_tsnmap_mark(&asoc->peer.tsn_map, | 717 | if (sctp_tsnmap_mark(&asoc->peer.tsn_map, |
718 | ntohl(chunk->subh.data_hdr->tsn))) | 718 | ntohl(chunk->subh.data_hdr->tsn), |
719 | chunk->transport)) | ||
719 | goto fail_mark; | 720 | goto fail_mark; |
720 | 721 | ||
721 | /* First calculate the padding, so we don't inadvertently | 722 | /* First calculate the padding, so we don't inadvertently |
diff --git a/net/sctp/ulpqueue.c b/net/sctp/ulpqueue.c index f2d1de7f2ffb..f5a6a4f4faf7 100644 --- a/net/sctp/ulpqueue.c +++ b/net/sctp/ulpqueue.c | |||
@@ -1051,7 +1051,7 @@ void sctp_ulpq_renege(struct sctp_ulpq *ulpq, struct sctp_chunk *chunk, | |||
1051 | if (chunk && (freed >= needed)) { | 1051 | if (chunk && (freed >= needed)) { |
1052 | __u32 tsn; | 1052 | __u32 tsn; |
1053 | tsn = ntohl(chunk->subh.data_hdr->tsn); | 1053 | tsn = ntohl(chunk->subh.data_hdr->tsn); |
1054 | sctp_tsnmap_mark(&asoc->peer.tsn_map, tsn); | 1054 | sctp_tsnmap_mark(&asoc->peer.tsn_map, tsn, chunk->transport); |
1055 | sctp_ulpq_tail_data(ulpq, chunk, gfp); | 1055 | sctp_ulpq_tail_data(ulpq, chunk, gfp); |
1056 | 1056 | ||
1057 | sctp_ulpq_partial_delivery(ulpq, chunk, gfp); | 1057 | sctp_ulpq_partial_delivery(ulpq, chunk, gfp); |
diff --git a/security/security.c b/security/security.c index 3efc9b12aef4..860aeb349cb3 100644 --- a/security/security.c +++ b/security/security.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/mman.h> | 23 | #include <linux/mman.h> |
24 | #include <linux/mount.h> | 24 | #include <linux/mount.h> |
25 | #include <linux/personality.h> | 25 | #include <linux/personality.h> |
26 | #include <linux/backing-dev.h> | ||
26 | #include <net/flow.h> | 27 | #include <net/flow.h> |
27 | 28 | ||
28 | #define MAX_LSM_EVM_XATTR 2 | 29 | #define MAX_LSM_EVM_XATTR 2 |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 5ccf10a4d593..aa4c25e0f327 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -6688,6 +6688,31 @@ static const struct alc_model_fixup alc662_fixup_models[] = { | |||
6688 | {} | 6688 | {} |
6689 | }; | 6689 | }; |
6690 | 6690 | ||
6691 | static void alc662_fill_coef(struct hda_codec *codec) | ||
6692 | { | ||
6693 | int val, coef; | ||
6694 | |||
6695 | coef = alc_get_coef0(codec); | ||
6696 | |||
6697 | switch (codec->vendor_id) { | ||
6698 | case 0x10ec0662: | ||
6699 | if ((coef & 0x00f0) == 0x0030) { | ||
6700 | val = alc_read_coef_idx(codec, 0x4); /* EAPD Ctrl */ | ||
6701 | alc_write_coef_idx(codec, 0x4, val & ~(1<<10)); | ||
6702 | } | ||
6703 | break; | ||
6704 | case 0x10ec0272: | ||
6705 | case 0x10ec0273: | ||
6706 | case 0x10ec0663: | ||
6707 | case 0x10ec0665: | ||
6708 | case 0x10ec0670: | ||
6709 | case 0x10ec0671: | ||
6710 | case 0x10ec0672: | ||
6711 | val = alc_read_coef_idx(codec, 0xd); /* EAPD Ctrl */ | ||
6712 | alc_write_coef_idx(codec, 0xd, val | (1<<14)); | ||
6713 | break; | ||
6714 | } | ||
6715 | } | ||
6691 | 6716 | ||
6692 | /* | 6717 | /* |
6693 | */ | 6718 | */ |
@@ -6707,6 +6732,9 @@ static int patch_alc662(struct hda_codec *codec) | |||
6707 | 6732 | ||
6708 | alc_fix_pll_init(codec, 0x20, 0x04, 15); | 6733 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
6709 | 6734 | ||
6735 | spec->init_hook = alc662_fill_coef; | ||
6736 | alc662_fill_coef(codec); | ||
6737 | |||
6710 | alc_pick_fixup(codec, alc662_fixup_models, | 6738 | alc_pick_fixup(codec, alc662_fixup_models, |
6711 | alc662_fixup_tbl, alc662_fixups); | 6739 | alc662_fixup_tbl, alc662_fixups); |
6712 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); | 6740 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c index 64d2a4fa34b2..e9b62b5ea637 100644 --- a/sound/soc/codecs/tlv320aic3x.c +++ b/sound/soc/codecs/tlv320aic3x.c | |||
@@ -935,9 +935,7 @@ static int aic3x_hw_params(struct snd_pcm_substream *substream, | |||
935 | } | 935 | } |
936 | 936 | ||
937 | found: | 937 | found: |
938 | data = snd_soc_read(codec, AIC3X_PLL_PROGA_REG); | 938 | snd_soc_update_bits(codec, AIC3X_PLL_PROGA_REG, PLLP_MASK, pll_p); |
939 | snd_soc_write(codec, AIC3X_PLL_PROGA_REG, | ||
940 | data | (pll_p << PLLP_SHIFT)); | ||
941 | snd_soc_write(codec, AIC3X_OVRF_STATUS_AND_PLLR_REG, | 939 | snd_soc_write(codec, AIC3X_OVRF_STATUS_AND_PLLR_REG, |
942 | pll_r << PLLR_SHIFT); | 940 | pll_r << PLLR_SHIFT); |
943 | snd_soc_write(codec, AIC3X_PLL_PROGB_REG, pll_j << PLLJ_SHIFT); | 941 | snd_soc_write(codec, AIC3X_PLL_PROGB_REG, pll_j << PLLJ_SHIFT); |
diff --git a/sound/soc/codecs/tlv320aic3x.h b/sound/soc/codecs/tlv320aic3x.h index 6f097fb60683..08c7f6685ff0 100644 --- a/sound/soc/codecs/tlv320aic3x.h +++ b/sound/soc/codecs/tlv320aic3x.h | |||
@@ -166,6 +166,7 @@ | |||
166 | 166 | ||
167 | /* PLL registers bitfields */ | 167 | /* PLL registers bitfields */ |
168 | #define PLLP_SHIFT 0 | 168 | #define PLLP_SHIFT 0 |
169 | #define PLLP_MASK 7 | ||
169 | #define PLLQ_SHIFT 3 | 170 | #define PLLQ_SHIFT 3 |
170 | #define PLLR_SHIFT 0 | 171 | #define PLLR_SHIFT 0 |
171 | #define PLLJ_SHIFT 2 | 172 | #define PLLJ_SHIFT 2 |
diff --git a/sound/soc/codecs/wm2200.c b/sound/soc/codecs/wm2200.c index acbdc5fde923..32682c1b7cde 100644 --- a/sound/soc/codecs/wm2200.c +++ b/sound/soc/codecs/wm2200.c | |||
@@ -1491,6 +1491,7 @@ static int wm2200_bclk_rates_dat[WM2200_NUM_BCLK_RATES] = { | |||
1491 | 1491 | ||
1492 | static int wm2200_bclk_rates_cd[WM2200_NUM_BCLK_RATES] = { | 1492 | static int wm2200_bclk_rates_cd[WM2200_NUM_BCLK_RATES] = { |
1493 | 5644800, | 1493 | 5644800, |
1494 | 3763200, | ||
1494 | 2882400, | 1495 | 2882400, |
1495 | 1881600, | 1496 | 1881600, |
1496 | 1411200, | 1497 | 1411200, |