From 158544b165d362c23acdde0104d9aab505a262a6 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Wed, 10 Oct 2012 15:53:52 -0700 Subject: arch/powerpc/platforms/pseries/hotplug-memory.c: fix section handling code Fix arch/powerpc/platforms/pseries/hotplug-memory.c: In function 'pseries_remove_memblock': arch/powerpc/platforms/pseries/hotplug-memory.c:103:17: error: unused variable 'pfn' [-Werror=unused-variable] Caused by commit d760afd4d257 ("memory-hotplug: suppress "Trying to free nonexistent resource " warning"). Reported-by: Stephen Rothwell Cc: Yasuaki Ishimatsu Tested-by: Stephen Rothwell Signed-off-by: Andrew Morton Tested-by: Nathan Fontenot Tested-by: Benjamin Herrenschmidt Signed-off-by: Linus Torvalds diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c index dc0a035..2fe690f 100644 --- a/arch/powerpc/platforms/pseries/hotplug-memory.c +++ b/arch/powerpc/platforms/pseries/hotplug-memory.c @@ -101,7 +101,7 @@ static int pseries_remove_memblock(unsigned long base, unsigned int memblock_siz sections_to_remove = (memblock_size >> PAGE_SHIFT) / PAGES_PER_SECTION; for (i = 0; i < sections_to_remove; i++) { unsigned long pfn = start_pfn + i * PAGES_PER_SECTION; - ret = __remove_pages(zone, start_pfn, PAGES_PER_SECTION); + ret = __remove_pages(zone, pfn, PAGES_PER_SECTION); if (ret) return ret; } -- cgit v0.10.2 From 1633dbbacbaa3a2f95ef901caf9d0b32728c10b6 Mon Sep 17 00:00:00 2001 From: Yasuaki Ishimatsu Date: Wed, 10 Oct 2012 15:53:53 -0700 Subject: arch/powerpc/platforms/pseries/hotplug-memory.c: section removal cleanups Followups to d760afd4d257 ("memory-hotplug: suppress "Trying to free nonexistent resource " warning"). - use unsigned long type, as overflows are conceivable - rename `i' to the less-misleading and more informative `section' Cc: Benjamin Herrenschmidt Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c index 2fe690f..ecdb0a6 100644 --- a/arch/powerpc/platforms/pseries/hotplug-memory.c +++ b/arch/powerpc/platforms/pseries/hotplug-memory.c @@ -77,8 +77,9 @@ static int pseries_remove_memblock(unsigned long base, unsigned int memblock_siz { unsigned long start, start_pfn; struct zone *zone; - int i, ret; - int sections_to_remove; + int ret; + unsigned long section; + unsigned long sections_to_remove; start_pfn = base >> PAGE_SHIFT; @@ -99,8 +100,8 @@ static int pseries_remove_memblock(unsigned long base, unsigned int memblock_siz * while writing to it. So we have to defer it to here. */ sections_to_remove = (memblock_size >> PAGE_SHIFT) / PAGES_PER_SECTION; - for (i = 0; i < sections_to_remove; i++) { - unsigned long pfn = start_pfn + i * PAGES_PER_SECTION; + for (section = 0; section < sections_to_remove; section++) { + unsigned long pfn = start_pfn + section * PAGES_PER_SECTION; ret = __remove_pages(zone, pfn, PAGES_PER_SECTION); if (ret) return ret; -- cgit v0.10.2 From 627260595ca6abcb16d68a3732bac6b547e112d6 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Wed, 10 Oct 2012 15:53:55 -0700 Subject: mm: compaction: fix bit ranges in {get,clear,set}_pageblock_skip() {get,clear,set}_pageblock_skip() use incorrect bit ranges (please compare to bit ranges used by {get,set}_pageblock_flags() used for migration types) and can overwrite pageblock migratetype of the next pageblock in the bitmap. Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Kyungmin Park Acked-by: Mel Gorman Tested-by: Thierry Reding Acked-by: Minchan Kim Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds diff --git a/include/linux/pageblock-flags.h b/include/linux/pageblock-flags.h index eed27f4..be655e4 100644 --- a/include/linux/pageblock-flags.h +++ b/include/linux/pageblock-flags.h @@ -71,13 +71,13 @@ void set_pageblock_flags_group(struct page *page, unsigned long flags, #ifdef CONFIG_COMPACTION #define get_pageblock_skip(page) \ get_pageblock_flags_group(page, PB_migrate_skip, \ - PB_migrate_skip + 1) + PB_migrate_skip) #define clear_pageblock_skip(page) \ set_pageblock_flags_group(page, 0, PB_migrate_skip, \ - PB_migrate_skip + 1) + PB_migrate_skip) #define set_pageblock_skip(page) \ set_pageblock_flags_group(page, 1, PB_migrate_skip, \ - PB_migrate_skip + 1) + PB_migrate_skip) #endif /* CONFIG_COMPACTION */ #define get_pageblock_flags(page) \ -- cgit v0.10.2 From f4c9c0e83bdfab6d3de7bc9ad728d99bf6adde92 Mon Sep 17 00:00:00 2001 From: Alexandre Bounine Date: Wed, 10 Oct 2012 15:53:58 -0700 Subject: rapidio: use msleep in discovery wait Use msleep() for code clarity as suggested by Andrew Morton in his comments for the original patch: https://lkml.org/lkml/2012/10/3/546. Signed-off-by: Alexandre Bounine Cc: Matt Porter Cc: Li Yang Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds diff --git a/drivers/rapidio/rio-scan.c b/drivers/rapidio/rio-scan.c index 48e9041..05f0ed9 100644 --- a/drivers/rapidio/rio-scan.c +++ b/drivers/rapidio/rio-scan.c @@ -1391,7 +1391,7 @@ int __devinit rio_disc_mport(struct rio_mport *mport) while (time_before(jiffies, to_end)) { if (rio_enum_complete(mport)) goto enum_done; - schedule_timeout_uninterruptible(msecs_to_jiffies(10)); + msleep(10); } pr_debug("RIO: discovery timeout on mport %d %s\n", -- cgit v0.10.2 From 2574740d1fe946803caa6b0c06fbb4bf397af35d Mon Sep 17 00:00:00 2001 From: Alexandre Bounine Date: Wed, 10 Oct 2012 15:53:59 -0700 Subject: rapidio: update asynchronous discovery initialization Update discovery process initialization based on Andrew Morton's comments: https://lkml.org/lkml/2012/10/3/552. This update processes all enumerating mports first and schedules discovery work after that. If the initialization routine fails to allocate resources needed to execute discovery, it abandons discovery for all ports. Signed-off-by: Alexandre Bounine Cc: Matt Porter Cc: Li Yang Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds diff --git a/drivers/rapidio/rio.c b/drivers/rapidio/rio.c index d4bd690..c17ae22 100644 --- a/drivers/rapidio/rio.c +++ b/drivers/rapidio/rio.c @@ -1275,49 +1275,68 @@ static void __devinit disc_work_handler(struct work_struct *_work) pr_debug("RIO: discovery work for mport %d %s\n", work->mport->id, work->mport->name); rio_disc_mport(work->mport); - - kfree(work); } int __devinit rio_init_mports(void) { struct rio_mport *port; struct rio_disc_work *work; - int no_disc = 0; + int n = 0; + + if (!next_portid) + return -ENODEV; + /* + * First, run enumerations and check if we need to perform discovery + * on any of the registered mports. + */ list_for_each_entry(port, &rio_mports, node) { if (port->host_deviceid >= 0) rio_enum_mport(port); - else if (!no_disc) { - if (!rio_wq) { - rio_wq = alloc_workqueue("riodisc", 0, 0); - if (!rio_wq) { - pr_err("RIO: unable allocate rio_wq\n"); - no_disc = 1; - continue; - } - } - - work = kzalloc(sizeof *work, GFP_KERNEL); - if (!work) { - pr_err("RIO: no memory for work struct\n"); - no_disc = 1; - continue; - } - - work->mport = port; - INIT_WORK(&work->work, disc_work_handler); - queue_work(rio_wq, &work->work); - } + else + n++; + } + + if (!n) + goto no_disc; + + /* + * If we have mports that require discovery schedule a discovery work + * for each of them. If the code below fails to allocate needed + * resources, exit without error to keep results of enumeration + * process (if any). + * TODO: Implement restart of dicovery process for all or + * individual discovering mports. + */ + rio_wq = alloc_workqueue("riodisc", 0, 0); + if (!rio_wq) { + pr_err("RIO: unable allocate rio_wq\n"); + goto no_disc; } - if (rio_wq) { - pr_debug("RIO: flush discovery workqueue\n"); - flush_workqueue(rio_wq); - pr_debug("RIO: flush discovery workqueue finished\n"); + work = kcalloc(n, sizeof *work, GFP_KERNEL); + if (!work) { + pr_err("RIO: no memory for work struct\n"); destroy_workqueue(rio_wq); + goto no_disc; } + n = 0; + list_for_each_entry(port, &rio_mports, node) { + if (port->host_deviceid < 0) { + work[n].mport = port; + INIT_WORK(&work[n].work, disc_work_handler); + queue_work(rio_wq, &work[n].work); + n++; + } + } + + flush_workqueue(rio_wq); + pr_debug("RIO: destroy discovery workqueue\n"); + destroy_workqueue(rio_wq); + kfree(work); + +no_disc: rio_init(); return 0; -- cgit v0.10.2 From 4ed134beee42a5c9fc4b439f1e498363066e2516 Mon Sep 17 00:00:00 2001 From: Alexandre Bounine Date: Wed, 10 Oct 2012 15:54:01 -0700 Subject: rapidio: update for destination ID allocation Address comments provided by Andrew Morton: https://lkml.org/lkml/2012/10/3/550 - Keeps consistent kerneldoc compatible comments style for new static functions. - Removes unnecessary complexity from destination ID allocation routine. - Uses kcalloc() for code clarity. Signed-off-by: Alexandre Bounine Cc: Matt Porter Cc: Li Yang Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds diff --git a/drivers/rapidio/rio-scan.c b/drivers/rapidio/rio-scan.c index 05f0ed9..07da58b 100644 --- a/drivers/rapidio/rio-scan.c +++ b/drivers/rapidio/rio-scan.c @@ -55,9 +55,9 @@ static int rio_mport_phys_table[] = { }; -/* +/** * rio_destid_alloc - Allocate next available destID for given network - * net: RIO network + * @net: RIO network * * Returns next available device destination ID for the specified RIO network. * Marks allocated ID as one in use. @@ -69,14 +69,9 @@ static u16 rio_destid_alloc(struct rio_net *net) struct rio_id_table *idtab = &net->destid_table; spin_lock(&idtab->lock); - destid = find_next_zero_bit(idtab->table, idtab->max, idtab->next); - if (destid >= idtab->max) - destid = find_first_zero_bit(idtab->table, idtab->max); + destid = find_first_zero_bit(idtab->table, idtab->max); if (destid < idtab->max) { - idtab->next = destid + 1; - if (idtab->next >= idtab->max) - idtab->next = 0; set_bit(destid, idtab->table); destid += idtab->start; } else @@ -86,10 +81,10 @@ static u16 rio_destid_alloc(struct rio_net *net) return (u16)destid; } -/* +/** * rio_destid_reserve - Reserve the specivied destID - * net: RIO network - * destid: destID to reserve + * @net: RIO network + * @destid: destID to reserve * * Tries to reserve the specified destID. * Returns 0 if successfull. @@ -106,10 +101,10 @@ static int rio_destid_reserve(struct rio_net *net, u16 destid) return oldbit; } -/* +/** * rio_destid_free - free a previously allocated destID - * net: RIO network - * destid: destID to free + * @net: RIO network + * @destid: destID to free * * Makes the specified destID available for use. */ @@ -123,9 +118,9 @@ static void rio_destid_free(struct rio_net *net, u16 destid) spin_unlock(&idtab->lock); } -/* +/** * rio_destid_first - return first destID in use - * net: RIO network + * @net: RIO network */ static u16 rio_destid_first(struct rio_net *net) { @@ -142,10 +137,10 @@ static u16 rio_destid_first(struct rio_net *net) return (u16)destid; } -/* +/** * rio_destid_next - return next destID in use - * net: RIO network - * from: destination ID from which search shall continue + * @net: RIO network + * @from: destination ID from which search shall continue */ static u16 rio_destid_next(struct rio_net *net, u16 from) { @@ -1163,8 +1158,8 @@ static struct rio_net __devinit *rio_alloc_net(struct rio_mport *port, net = kzalloc(sizeof(struct rio_net), GFP_KERNEL); if (net && do_enum) { - net->destid_table.table = kzalloc( - BITS_TO_LONGS(RIO_MAX_ROUTE_ENTRIES(port->sys_size)) * + net->destid_table.table = kcalloc( + BITS_TO_LONGS(RIO_MAX_ROUTE_ENTRIES(port->sys_size)), sizeof(long), GFP_KERNEL); @@ -1174,7 +1169,6 @@ static struct rio_net __devinit *rio_alloc_net(struct rio_mport *port, net = NULL; } else { net->destid_table.start = start; - net->destid_table.next = 0; net->destid_table.max = RIO_MAX_ROUTE_ENTRIES(port->sys_size); spin_lock_init(&net->destid_table.lock); diff --git a/include/linux/rio.h b/include/linux/rio.h index d2dff22..ac21ac6 100644 --- a/include/linux/rio.h +++ b/include/linux/rio.h @@ -266,7 +266,6 @@ struct rio_mport { struct rio_id_table { u16 start; /* logical minimal id */ - u16 next; /* hint for find */ u32 max; /* max number of IDs in table */ spinlock_t lock; unsigned long *table; -- cgit v0.10.2 From 3e1aa66bd423950aa69c3d50d91818af1d16e0a7 Mon Sep 17 00:00:00 2001 From: Ezequiel Garcia Date: Wed, 10 Oct 2012 15:54:04 -0700 Subject: lib/kasprintf.c: use kmalloc_track_caller() to get accurate traces for kvasprintf Previously kvasprintf() allocation was being done through kmalloc(), thus producing an inaccurate trace report. This is a common problem: in order to get accurate callsite tracing, a lib/utils function shouldn't allocate kmalloc but instead use kmalloc_track_caller. Signed-off-by: Ezequiel Garcia Cc: Sam Ravnborg Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds diff --git a/lib/kasprintf.c b/lib/kasprintf.c index ae0de80..32f1215 100644 --- a/lib/kasprintf.c +++ b/lib/kasprintf.c @@ -21,7 +21,7 @@ char *kvasprintf(gfp_t gfp, const char *fmt, va_list ap) len = vsnprintf(NULL, 0, fmt, aq); va_end(aq); - p = kmalloc(len+1, gfp); + p = kmalloc_track_caller(len+1, gfp); if (!p) return NULL; -- cgit v0.10.2 From fdb8d561e6fb8538e320554b991ed183b19ddc83 Mon Sep 17 00:00:00 2001 From: Chad Reese Date: Wed, 10 Oct 2012 15:54:05 -0700 Subject: rapidio: fix comment The resource index for the mailboxes was incorrect. Signed-off-by: Chad Reese Acked-by: Alexandre Bounine Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds diff --git a/include/linux/rio.h b/include/linux/rio.h index ac21ac6..4187da5 100644 --- a/include/linux/rio.h +++ b/include/linux/rio.h @@ -63,7 +63,7 @@ * * 0 RapidIO inbound doorbells * 1 RapidIO inbound mailboxes - * 1 RapidIO outbound mailboxes + * 2 RapidIO outbound mailboxes */ #define RIO_DOORBELL_RESOURCE 0 #define RIO_INB_MBOX_RESOURCE 1 -- cgit v0.10.2 From 8dc0839510ed4a7c594386ef58446b014fb4c27a Mon Sep 17 00:00:00 2001 From: Kevin Hilman Date: Wed, 10 Oct 2012 15:54:06 -0700 Subject: rtc: kconfig: fix RTC_INTF defaults connected to RTC_CLASS Commit 6b8029fab641 ("rtc: kconfig: remove unnecessary dependencies") removed various 'depends on RTC_CLASS' dependencies but also removed a few 'default RTC_CLASS' statements, which actually changed default behavior. This resulted in the various RTC interfaces (sysfs, proc, dev) all being disabled by default, even when RTC_CLASS is enabled: # CONFIG_RTC_INTF_SYSFS is not set # CONFIG_RTC_INTF_PROC is not set # CONFIG_RTC_INTF_DEV is not set which is different from previous behavior (all of these where enabled.) To fix, add back the 'default RTC_CLASS' statments to each of the RTC_INTF_* options. I noticed this because some RTC tests started failing on my TI OMAP platforms because /dev/rtc0 was not present anymore, even though the driver was present and RTC_CLASS was enabled. Signed-off-by: Kevin Hilman Acked-by: Venu Byravarasu Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index e069f17..19c03ab 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig @@ -59,6 +59,7 @@ comment "RTC interfaces" config RTC_INTF_SYSFS boolean "/sys/class/rtc/rtcN (sysfs)" depends on SYSFS + default RTC_CLASS help Say yes here if you want to use your RTCs using sysfs interfaces, /sys/class/rtc/rtc0 through /sys/.../rtcN. @@ -68,6 +69,7 @@ config RTC_INTF_SYSFS config RTC_INTF_PROC boolean "/proc/driver/rtc (procfs for rtcN)" depends on PROC_FS + default RTC_CLASS help Say yes here if you want to use your system clock RTC through the proc interface, /proc/driver/rtc. @@ -79,6 +81,7 @@ config RTC_INTF_PROC config RTC_INTF_DEV boolean "/dev/rtcN (character devices)" + default RTC_CLASS help Say yes here if you want to use your RTCs using the /dev interfaces, which "udev" sets up as /dev/rtc0 through -- cgit v0.10.2 From cd59085a9b89585f20b4765f74c04e8c527f09f2 Mon Sep 17 00:00:00 2001 From: David Rientjes Date: Wed, 10 Oct 2012 15:54:08 -0700 Subject: memcg, kmem: fix build error when CONFIG_INET is disabled Commit e1aab161e013 ("socket: initial cgroup code.") causes a build error when CONFIG_INET is disabled in Linus' tree: net/built-in.o: In function `sk_update_clone': net/core/sock.c:1336: undefined reference to `sock_update_memcg' sock_update_memcg() is only defined when CONFIG_INET is enabled, so fix it by defining the dummy function without this option. Signed-off-by: David Rientjes Reported-by: Randy Dunlap Cc: Glauber Costa Cc: Michal Hocko Cc: Fengguang Wu Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index fd0e6d5..11ddc7f 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -396,7 +396,7 @@ enum { }; struct sock; -#ifdef CONFIG_MEMCG_KMEM +#if defined(CONFIG_INET) && defined(CONFIG_MEMCG_KMEM) void sock_update_memcg(struct sock *sk); void sock_release_memcg(struct sock *sk); #else @@ -406,6 +406,6 @@ static inline void sock_update_memcg(struct sock *sk) static inline void sock_release_memcg(struct sock *sk) { } -#endif /* CONFIG_MEMCG_KMEM */ +#endif /* CONFIG_INET && CONFIG_MEMCG_KMEM */ #endif /* _LINUX_MEMCONTROL_H */ -- cgit v0.10.2 From ec073619cdda99ffb6a07d3b8000569f5210815a Mon Sep 17 00:00:00 2001 From: Michel Lespinasse Date: Wed, 10 Oct 2012 15:54:11 -0700 Subject: perf: fix duplicate header inclusion #include somehow got duplicated on its way to linus's tree (probably as a conflict resolution as things got sent through multiple trees) Signed-off-by: Michel Lespinasse Cc: Adrian Hunter Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds diff --git a/tools/perf/util/include/linux/rbtree.h b/tools/perf/util/include/linux/rbtree.h index 9bcdc84..2a030c5 100644 --- a/tools/perf/util/include/linux/rbtree.h +++ b/tools/perf/util/include/linux/rbtree.h @@ -1,3 +1,2 @@ #include -#include #include "../../../../include/linux/rbtree.h" -- cgit v0.10.2