Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'akpm' (fixes from Andrew)

Merge misc fixes from Andrew Morton.

* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
mqueue: sys_mq_open: do not call mnt_drop_write() if read-only
mm/hotplug: only free wait_table if it's allocated by vmalloc
dma-debug: update DMA debug API to better handle multiple mappings of a buffer
dma-debug: fix locking bug in check_unmap()
drivers/rtc/rtc-at91rm9200.c: use a variable for storing IMR
drivers/video/ep93xx-fb.c: include <linux/io.h> for devm_ioremap()
drivers/rtc/rtc-da9052.c: fix for rtc device registration
mm: zone_end_pfn is too small
poweroff: change orderly_poweroff() to use schedule_work()
mm/hugetlb: fix total hugetlbfs pages count when using memory overcommit accouting
printk: Provide a wake_up_klogd() off-case
irq_work.h: fix warning when CONFIG_IRQ_WORK=n

+160 -115
+31 -19
drivers/rtc/rtc-at91rm9200.c
··· 44 44 static unsigned int at91_alarm_year = AT91_RTC_EPOCH; 45 45 static void __iomem *at91_rtc_regs; 46 46 static int irq; 47 + static u32 at91_rtc_imr; 47 48 48 49 /* 49 50 * Decode time/date into rtc_time structure ··· 109 108 cr = at91_rtc_read(AT91_RTC_CR); 110 109 at91_rtc_write(AT91_RTC_CR, cr | AT91_RTC_UPDCAL | AT91_RTC_UPDTIM); 111 110 111 + at91_rtc_imr |= AT91_RTC_ACKUPD; 112 112 at91_rtc_write(AT91_RTC_IER, AT91_RTC_ACKUPD); 113 113 wait_for_completion(&at91_rtc_updated); /* wait for ACKUPD interrupt */ 114 114 at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD); 115 + at91_rtc_imr &= ~AT91_RTC_ACKUPD; 115 116 116 117 at91_rtc_write(AT91_RTC_TIMR, 117 118 bin2bcd(tm->tm_sec) << 0 ··· 145 142 tm->tm_yday = rtc_year_days(tm->tm_mday, tm->tm_mon, tm->tm_year); 146 143 tm->tm_year = at91_alarm_year - 1900; 147 144 148 - alrm->enabled = (at91_rtc_read(AT91_RTC_IMR) & AT91_RTC_ALARM) 145 + alrm->enabled = (at91_rtc_imr & AT91_RTC_ALARM) 149 146 ? 1 : 0; 150 147 151 148 dev_dbg(dev, "%s(): %4d-%02d-%02d %02d:%02d:%02d\n", __func__, ··· 171 168 tm.tm_sec = alrm->time.tm_sec; 172 169 173 170 at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ALARM); 171 + at91_rtc_imr &= ~AT91_RTC_ALARM; 174 172 at91_rtc_write(AT91_RTC_TIMALR, 175 173 bin2bcd(tm.tm_sec) << 0 176 174 | bin2bcd(tm.tm_min) << 8 ··· 184 180 185 181 if (alrm->enabled) { 186 182 at91_rtc_write(AT91_RTC_SCCR, AT91_RTC_ALARM); 183 + at91_rtc_imr |= AT91_RTC_ALARM; 187 184 at91_rtc_write(AT91_RTC_IER, AT91_RTC_ALARM); 188 185 } 189 186 ··· 201 196 202 197 if (enabled) { 203 198 at91_rtc_write(AT91_RTC_SCCR, AT91_RTC_ALARM); 199 + at91_rtc_imr |= AT91_RTC_ALARM; 204 200 at91_rtc_write(AT91_RTC_IER, AT91_RTC_ALARM); 205 - } else 201 + } else { 206 202 at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ALARM); 203 + at91_rtc_imr &= ~AT91_RTC_ALARM; 204 + } 207 205 208 206 return 0; 209 207 } ··· 215 207 */ 216 208 static int at91_rtc_proc(struct device *dev, struct seq_file *seq) 217 209 { 218 - unsigned long imr = at91_rtc_read(AT91_RTC_IMR); 219 - 220 210 seq_printf(seq, "update_IRQ\t: %s\n", 221 - (imr & AT91_RTC_ACKUPD) ? "yes" : "no"); 211 + (at91_rtc_imr & AT91_RTC_ACKUPD) ? "yes" : "no"); 222 212 seq_printf(seq, "periodic_IRQ\t: %s\n", 223 - (imr & AT91_RTC_SECEV) ? "yes" : "no"); 213 + (at91_rtc_imr & AT91_RTC_SECEV) ? "yes" : "no"); 224 214 225 215 return 0; 226 216 } ··· 233 227 unsigned int rtsr; 234 228 unsigned long events = 0; 235 229 236 - rtsr = at91_rtc_read(AT91_RTC_SR) & at91_rtc_read(AT91_RTC_IMR); 230 + rtsr = at91_rtc_read(AT91_RTC_SR) & at91_rtc_imr; 237 231 if (rtsr) { /* this interrupt is shared! Is it ours? */ 238 232 if (rtsr & AT91_RTC_ALARM) 239 233 events |= (RTC_AF | RTC_IRQF); ··· 297 291 at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD | AT91_RTC_ALARM | 298 292 AT91_RTC_SECEV | AT91_RTC_TIMEV | 299 293 AT91_RTC_CALEV); 294 + at91_rtc_imr = 0; 300 295 301 296 ret = request_irq(irq, at91_rtc_interrupt, 302 297 IRQF_SHARED, ··· 336 329 at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD | AT91_RTC_ALARM | 337 330 AT91_RTC_SECEV | AT91_RTC_TIMEV | 338 331 AT91_RTC_CALEV); 332 + at91_rtc_imr = 0; 339 333 free_irq(irq, pdev); 340 334 341 335 rtc_device_unregister(rtc); ··· 349 341 350 342 /* AT91RM9200 RTC Power management control */ 351 343 352 - static u32 at91_rtc_imr; 344 + static u32 at91_rtc_bkpimr; 345 + 353 346 354 347 static int at91_rtc_suspend(struct device *dev) 355 348 { 356 349 /* this IRQ is shared with DBGU and other hardware which isn't 357 350 * necessarily doing PM like we are... 358 351 */ 359 - at91_rtc_imr = at91_rtc_read(AT91_RTC_IMR) 360 - & (AT91_RTC_ALARM|AT91_RTC_SECEV); 361 - if (at91_rtc_imr) { 362 - if (device_may_wakeup(dev)) 352 + at91_rtc_bkpimr = at91_rtc_imr & (AT91_RTC_ALARM|AT91_RTC_SECEV); 353 + if (at91_rtc_bkpimr) { 354 + if (device_may_wakeup(dev)) { 363 355 enable_irq_wake(irq); 364 - else 365 - at91_rtc_write(AT91_RTC_IDR, at91_rtc_imr); 366 - } 356 + } else { 357 + at91_rtc_write(AT91_RTC_IDR, at91_rtc_bkpimr); 358 + at91_rtc_imr &= ~at91_rtc_bkpimr; 359 + } 360 + } 367 361 return 0; 368 362 } 369 363 370 364 static int at91_rtc_resume(struct device *dev) 371 365 { 372 - if (at91_rtc_imr) { 373 - if (device_may_wakeup(dev)) 366 + if (at91_rtc_bkpimr) { 367 + if (device_may_wakeup(dev)) { 374 368 disable_irq_wake(irq); 375 - else 376 - at91_rtc_write(AT91_RTC_IER, at91_rtc_imr); 369 + } else { 370 + at91_rtc_imr |= at91_rtc_bkpimr; 371 + at91_rtc_write(AT91_RTC_IER, at91_rtc_bkpimr); 372 + } 377 373 } 378 374 return 0; 379 375 }
-1
drivers/rtc/rtc-at91rm9200.h
··· 64 64 #define AT91_RTC_SCCR 0x1c /* Status Clear Command Register */ 65 65 #define AT91_RTC_IER 0x20 /* Interrupt Enable Register */ 66 66 #define AT91_RTC_IDR 0x24 /* Interrupt Disable Register */ 67 - #define AT91_RTC_IMR 0x28 /* Interrupt Mask Register */ 68 67 69 68 #define AT91_RTC_VER 0x2c /* Valid Entry Register */ 70 69 #define AT91_RTC_NVTIM (1 << 0) /* Non valid Time */
+3 -5
drivers/rtc/rtc-da9052.c
··· 239 239 240 240 rtc->da9052 = dev_get_drvdata(pdev->dev.parent); 241 241 platform_set_drvdata(pdev, rtc); 242 - rtc->irq = platform_get_irq_byname(pdev, "ALM"); 243 - ret = devm_request_threaded_irq(&pdev->dev, rtc->irq, NULL, 244 - da9052_rtc_irq, 245 - IRQF_TRIGGER_LOW | IRQF_ONESHOT, 246 - "ALM", rtc); 242 + rtc->irq = DA9052_IRQ_ALARM; 243 + ret = da9052_request_irq(rtc->da9052, rtc->irq, "ALM", 244 + da9052_rtc_irq, rtc); 247 245 if (ret != 0) { 248 246 rtc_err(rtc->da9052, "irq registration failed: %d\n", ret); 249 247 return ret;
+1
drivers/video/ep93xx-fb.c
··· 23 23 #include <linux/slab.h> 24 24 #include <linux/clk.h> 25 25 #include <linux/fb.h> 26 + #include <linux/io.h> 26 27 27 28 #include <linux/platform_data/video-ep93xx.h> 28 29
+1 -1
include/linux/irq_work.h
··· 37 37 #ifdef CONFIG_IRQ_WORK 38 38 bool irq_work_needs_cpu(void); 39 39 #else 40 - static bool irq_work_needs_cpu(void) { return false; } 40 + static inline bool irq_work_needs_cpu(void) { return false; } 41 41 #endif 42 42 43 43 #endif /* _LINUX_IRQ_WORK_H */
-1
include/linux/kernel.h
··· 390 390 unsigned long int_sqrt(unsigned long); 391 391 392 392 extern void bust_spinlocks(int yes); 393 - extern void wake_up_klogd(void); 394 393 extern int oops_in_progress; /* If set, an oops, panic(), BUG() or die() is in progress */ 395 394 extern int panic_timeout; 396 395 extern int panic_on_oops;
+1 -1
include/linux/mmzone.h
··· 527 527 return test_bit(ZONE_OOM_LOCKED, &zone->flags); 528 528 } 529 529 530 - static inline unsigned zone_end_pfn(const struct zone *zone) 530 + static inline unsigned long zone_end_pfn(const struct zone *zone) 531 531 { 532 532 return zone->zone_start_pfn + zone->spanned_pages; 533 533 }
+6
include/linux/printk.h
··· 134 134 extern int dmesg_restrict; 135 135 extern int kptr_restrict; 136 136 137 + extern void wake_up_klogd(void); 138 + 137 139 void log_buf_kexec_setup(void); 138 140 void __init setup_log_buf(int early); 139 141 #else ··· 162 160 unsigned int interval_msec) 163 161 { 164 162 return false; 163 + } 164 + 165 + static inline void wake_up_klogd(void) 166 + { 165 167 } 166 168 167 169 static inline void log_buf_kexec_setup(void)
+2 -1
ipc/mqueue.c
··· 840 840 fd = error; 841 841 } 842 842 mutex_unlock(&root->d_inode->i_mutex); 843 - mnt_drop_write(mnt); 843 + if (!ro) 844 + mnt_drop_write(mnt); 844 845 out_putname: 845 846 putname(name); 846 847 return fd;
+39 -41
kernel/printk.c
··· 63 63 #define MINIMUM_CONSOLE_LOGLEVEL 1 /* Minimum loglevel we let people use */ 64 64 #define DEFAULT_CONSOLE_LOGLEVEL 7 /* anything MORE serious than KERN_DEBUG */ 65 65 66 - DECLARE_WAIT_QUEUE_HEAD(log_wait); 67 - 68 66 int console_printk[4] = { 69 67 DEFAULT_CONSOLE_LOGLEVEL, /* console_loglevel */ 70 68 DEFAULT_MESSAGE_LOGLEVEL, /* default_message_loglevel */ ··· 222 224 static DEFINE_RAW_SPINLOCK(logbuf_lock); 223 225 224 226 #ifdef CONFIG_PRINTK 227 + DECLARE_WAIT_QUEUE_HEAD(log_wait); 225 228 /* the next printk record to read by syslog(READ) or /proc/kmsg */ 226 229 static u64 syslog_seq; 227 230 static u32 syslog_idx; ··· 1956 1957 return console_locked; 1957 1958 } 1958 1959 1959 - /* 1960 - * Delayed printk version, for scheduler-internal messages: 1961 - */ 1962 - #define PRINTK_BUF_SIZE 512 1963 - 1964 - #define PRINTK_PENDING_WAKEUP 0x01 1965 - #define PRINTK_PENDING_SCHED 0x02 1966 - 1967 - static DEFINE_PER_CPU(int, printk_pending); 1968 - static DEFINE_PER_CPU(char [PRINTK_BUF_SIZE], printk_sched_buf); 1969 - 1970 - static void wake_up_klogd_work_func(struct irq_work *irq_work) 1971 - { 1972 - int pending = __this_cpu_xchg(printk_pending, 0); 1973 - 1974 - if (pending & PRINTK_PENDING_SCHED) { 1975 - char *buf = __get_cpu_var(printk_sched_buf); 1976 - printk(KERN_WARNING "[sched_delayed] %s", buf); 1977 - } 1978 - 1979 - if (pending & PRINTK_PENDING_WAKEUP) 1980 - wake_up_interruptible(&log_wait); 1981 - } 1982 - 1983 - static DEFINE_PER_CPU(struct irq_work, wake_up_klogd_work) = { 1984 - .func = wake_up_klogd_work_func, 1985 - .flags = IRQ_WORK_LAZY, 1986 - }; 1987 - 1988 - void wake_up_klogd(void) 1989 - { 1990 - preempt_disable(); 1991 - if (waitqueue_active(&log_wait)) { 1992 - this_cpu_or(printk_pending, PRINTK_PENDING_WAKEUP); 1993 - irq_work_queue(&__get_cpu_var(wake_up_klogd_work)); 1994 - } 1995 - preempt_enable(); 1996 - } 1997 - 1998 1960 static void console_cont_flush(char *text, size_t size) 1999 1961 { 2000 1962 unsigned long flags; ··· 2418 2458 late_initcall(printk_late_init); 2419 2459 2420 2460 #if defined CONFIG_PRINTK 2461 + /* 2462 + * Delayed printk version, for scheduler-internal messages: 2463 + */ 2464 + #define PRINTK_BUF_SIZE 512 2465 + 2466 + #define PRINTK_PENDING_WAKEUP 0x01 2467 + #define PRINTK_PENDING_SCHED 0x02 2468 + 2469 + static DEFINE_PER_CPU(int, printk_pending); 2470 + static DEFINE_PER_CPU(char [PRINTK_BUF_SIZE], printk_sched_buf); 2471 + 2472 + static void wake_up_klogd_work_func(struct irq_work *irq_work) 2473 + { 2474 + int pending = __this_cpu_xchg(printk_pending, 0); 2475 + 2476 + if (pending & PRINTK_PENDING_SCHED) { 2477 + char *buf = __get_cpu_var(printk_sched_buf); 2478 + printk(KERN_WARNING "[sched_delayed] %s", buf); 2479 + } 2480 + 2481 + if (pending & PRINTK_PENDING_WAKEUP) 2482 + wake_up_interruptible(&log_wait); 2483 + } 2484 + 2485 + static DEFINE_PER_CPU(struct irq_work, wake_up_klogd_work) = { 2486 + .func = wake_up_klogd_work_func, 2487 + .flags = IRQ_WORK_LAZY, 2488 + }; 2489 + 2490 + void wake_up_klogd(void) 2491 + { 2492 + preempt_disable(); 2493 + if (waitqueue_active(&log_wait)) { 2494 + this_cpu_or(printk_pending, PRINTK_PENDING_WAKEUP); 2495 + irq_work_queue(&__get_cpu_var(wake_up_klogd_work)); 2496 + } 2497 + preempt_enable(); 2498 + } 2421 2499 2422 2500 int printk_sched(const char *fmt, ...) 2423 2501 {
+33 -26
kernel/sys.c
··· 2185 2185 2186 2186 char poweroff_cmd[POWEROFF_CMD_PATH_LEN] = "/sbin/poweroff"; 2187 2187 2188 - static int __orderly_poweroff(void) 2188 + static int __orderly_poweroff(bool force) 2189 2189 { 2190 - int argc; 2191 2190 char **argv; 2192 2191 static char *envp[] = { 2193 2192 "HOME=/", ··· 2195 2196 }; 2196 2197 int ret; 2197 2198 2198 - argv = argv_split(GFP_ATOMIC, poweroff_cmd, &argc); 2199 - if (argv == NULL) { 2199 + argv = argv_split(GFP_KERNEL, poweroff_cmd, NULL); 2200 + if (argv) { 2201 + ret = call_usermodehelper(argv[0], argv, envp, UMH_WAIT_EXEC); 2202 + argv_free(argv); 2203 + } else { 2200 2204 printk(KERN_WARNING "%s failed to allocate memory for \"%s\"\n", 2201 - __func__, poweroff_cmd); 2202 - return -ENOMEM; 2205 + __func__, poweroff_cmd); 2206 + ret = -ENOMEM; 2203 2207 } 2204 - 2205 - ret = call_usermodehelper_fns(argv[0], argv, envp, UMH_WAIT_EXEC, 2206 - NULL, NULL, NULL); 2207 - argv_free(argv); 2208 - 2209 - return ret; 2210 - } 2211 - 2212 - /** 2213 - * orderly_poweroff - Trigger an orderly system poweroff 2214 - * @force: force poweroff if command execution fails 2215 - * 2216 - * This may be called from any context to trigger a system shutdown. 2217 - * If the orderly shutdown fails, it will force an immediate shutdown. 2218 - */ 2219 - int orderly_poweroff(bool force) 2220 - { 2221 - int ret = __orderly_poweroff(); 2222 2208 2223 2209 if (ret && force) { 2224 2210 printk(KERN_WARNING "Failed to start orderly shutdown: " 2225 - "forcing the issue\n"); 2226 - 2211 + "forcing the issue\n"); 2227 2212 /* 2228 2213 * I guess this should try to kick off some daemon to sync and 2229 2214 * poweroff asap. Or not even bother syncing if we're doing an ··· 2218 2235 } 2219 2236 2220 2237 return ret; 2238 + } 2239 + 2240 + static bool poweroff_force; 2241 + 2242 + static void poweroff_work_func(struct work_struct *work) 2243 + { 2244 + __orderly_poweroff(poweroff_force); 2245 + } 2246 + 2247 + static DECLARE_WORK(poweroff_work, poweroff_work_func); 2248 + 2249 + /** 2250 + * orderly_poweroff - Trigger an orderly system poweroff 2251 + * @force: force poweroff if command execution fails 2252 + * 2253 + * This may be called from any context to trigger a system shutdown. 2254 + * If the orderly shutdown fails, it will force an immediate shutdown. 2255 + */ 2256 + int orderly_poweroff(bool force) 2257 + { 2258 + if (force) /* do not override the pending "true" */ 2259 + poweroff_force = true; 2260 + schedule_work(&poweroff_work); 2261 + return 0; 2221 2262 } 2222 2263 EXPORT_SYMBOL_GPL(orderly_poweroff);
+1 -2
lib/bust_spinlocks.c
··· 8 8 */ 9 9 10 10 #include <linux/kernel.h> 11 + #include <linux/printk.h> 11 12 #include <linux/spinlock.h> 12 13 #include <linux/tty.h> 13 14 #include <linux/wait.h> ··· 29 28 wake_up_klogd(); 30 29 } 31 30 } 32 - 33 -
+31 -14
lib/dma-debug.c
··· 862 862 entry = bucket_find_exact(bucket, ref); 863 863 864 864 if (!entry) { 865 + /* must drop lock before calling dma_mapping_error */ 866 + put_hash_bucket(bucket, &flags); 867 + 865 868 if (dma_mapping_error(ref->dev, ref->dev_addr)) { 866 869 err_printk(ref->dev, NULL, 867 - "DMA-API: device driver tries " 868 - "to free an invalid DMA memory address\n"); 869 - return; 870 + "DMA-API: device driver tries to free an " 871 + "invalid DMA memory address\n"); 872 + } else { 873 + err_printk(ref->dev, NULL, 874 + "DMA-API: device driver tries to free DMA " 875 + "memory it has not allocated [device " 876 + "address=0x%016llx] [size=%llu bytes]\n", 877 + ref->dev_addr, ref->size); 870 878 } 871 - err_printk(ref->dev, NULL, "DMA-API: device driver tries " 872 - "to free DMA memory it has not allocated " 873 - "[device address=0x%016llx] [size=%llu bytes]\n", 874 - ref->dev_addr, ref->size); 875 - goto out; 879 + return; 876 880 } 877 881 878 882 if (ref->size != entry->size) { ··· 940 936 hash_bucket_del(entry); 941 937 dma_entry_free(entry); 942 938 943 - out: 944 939 put_hash_bucket(bucket, &flags); 945 940 } 946 941 ··· 1085 1082 ref.dev = dev; 1086 1083 ref.dev_addr = dma_addr; 1087 1084 bucket = get_hash_bucket(&ref, &flags); 1088 - entry = bucket_find_exact(bucket, &ref); 1089 1085 1090 - if (!entry) 1091 - goto out; 1086 + list_for_each_entry(entry, &bucket->list, list) { 1087 + if (!exact_match(&ref, entry)) 1088 + continue; 1092 1089 1093 - entry->map_err_type = MAP_ERR_CHECKED; 1094 - out: 1090 + /* 1091 + * The same physical address can be mapped multiple 1092 + * times. Without a hardware IOMMU this results in the 1093 + * same device addresses being put into the dma-debug 1094 + * hash multiple times too. This can result in false 1095 + * positives being reported. Therefore we implement a 1096 + * best-fit algorithm here which updates the first entry 1097 + * from the hash which fits the reference value and is 1098 + * not currently listed as being checked. 1099 + */ 1100 + if (entry->map_err_type == MAP_ERR_NOT_CHECKED) { 1101 + entry->map_err_type = MAP_ERR_CHECKED; 1102 + break; 1103 + } 1104 + } 1105 + 1095 1106 put_hash_bucket(bucket, &flags); 1096 1107 } 1097 1108 EXPORT_SYMBOL(debug_dma_mapping_error);
+6 -2
mm/hugetlb.c
··· 2124 2124 /* Return the number pages of memory we physically have, in PAGE_SIZE units. */ 2125 2125 unsigned long hugetlb_total_pages(void) 2126 2126 { 2127 - struct hstate *h = &default_hstate; 2128 - return h->nr_huge_pages * pages_per_huge_page(h); 2127 + struct hstate *h; 2128 + unsigned long nr_total_pages = 0; 2129 + 2130 + for_each_hstate(h) 2131 + nr_total_pages += h->nr_huge_pages * pages_per_huge_page(h); 2132 + return nr_total_pages; 2129 2133 } 2130 2134 2131 2135 static int hugetlb_acct_memory(struct hstate *h, long delta)
+5 -1
mm/memory_hotplug.c
··· 1779 1779 for (i = 0; i < MAX_NR_ZONES; i++) { 1780 1780 struct zone *zone = pgdat->node_zones + i; 1781 1781 1782 - if (zone->wait_table) 1782 + /* 1783 + * wait_table may be allocated from boot memory, 1784 + * here only free if it's allocated by vmalloc. 1785 + */ 1786 + if (is_vmalloc_addr(zone->wait_table)) 1783 1787 vfree(zone->wait_table); 1784 1788 } 1785 1789