Re: ext3 issue on 3.6.1

2012-10-18 Thread Fabio Coatti
2012/10/19 NeilBrown :
> On Fri, 19 Oct 2012 00:08:09 +0200 Jan Kara  wrote:
>
>> On Thu 18-10-12 23:40:25, Paul Bolle wrote:
>> > On Thu, 2012-10-18 at 23:23 +0200, Jan Kara wrote:
>> > > On Fri 12-10-12 14:57:55, Fabio Coatti wrote:
>> > > > [13031.051521] [ cut here ]
>> > > > [13031.051576] WARNING: at fs/inode.c:280 drop_nlink+0x1b/0x35()
>> > > > [13031.051624] Hardware name: ProLiant BL465c G7
>> > > > [13031.051668] Pid: 3344, comm: php Tainted: GW
>> > > > 3.6.1-1000hz-preempt #2
>> > > > [13031.051746] Call Trace:
>> > > > [13031.051787]  [] ? warn_slowpath_common+0x73/0x87
>> > > > [13031.051837]  [] ? drop_nlink+0x1b/0x35
>> > > > [13031.051885]  [] ? nfs_dentry_iput+0x33/0x49
>> > > > [13031.051934]  [] ? d_kill+0xe8/0x108
>> > > > [13031.051980]  [] ? dput+0x147/0x154
>> > > > [13031.052027]  [] ? __fput+0x19a/0x1b2
>> > > > [13031.052073]  [] ? task_work_run+0x4c/0x60
>> > > > [13031.052123]  [] ? int_signal+0x12/0x17
>> > > > [13031.052169] ---[ end trace e60232a455c8e2dd ]---
>> > >   And this seems unrelated - likely an NFS problem... Let's sort this out
>> > > if you still see it after ext3 issue is solved.
>> >
>> > Looks rather similar too https://lkml.org/lkml/2012/8/29/165 , doesn't
>> > it?
>>   Yup. I wonder why that patch didn't get merged. Neil?
>>
>>   Honza
>
> Don't know.  Maybe I slipped under Trond's radar some how.
>
> Trond:  can you comment on and hopefully apply this patch?
>
> Subject of original email was "WARNING: at fs/inode.c:280 
> drop_nlink+0x31/0x33()

I'll apply this patch and see what happens, I guess it applies also to
3.6.2 where I still see the warning. Could this be a culprit for
several server lockups that we are seeing in 3.6.X machines and not in
2.6.39.X? I'm running some tests with 3.6.X with same setup of other
machines wth 2.6.39.X and where the new kernel is installed at least
once a day the machines lockups (not a reassuring thing :) . To answer
to previous questions, yes, the server has a ext3 read only mount and
no, the logs shows no other weird things besides the one I posted
before (see below for a fresh one on 3.6.2). The server has several
nfs mounts, all R/W.

[  207.558585] [ cut here ]
[  207.558692] WARNING: at fs/ext3/inode.c:1754
ext3_journalled_writepage+0x55/0x1a7()
[  207.558816] Hardware name: ProLiant BL465c G7
[  207.558905] Pid: 2741, comm: flush-8:0 Not tainted 3.6.2-hll-2scsi #1
[  207.559000] Call Trace:
[  207.559087]  [] ? warn_slowpath_common+0x73/0x87
[  207.559183]  [] ? ext3_journalled_writepage+0x55/0x1a7
[  207.559282]  [] ? __writepage+0xa/0x21
[  207.559375]  [] ? write_cache_pages+0x206/0x2f8
[  207.559470]  [] ? set_page_dirty+0x5e/0x5e
[  207.559565]  [] ? load_balance+0xd7/0x5cc
[  207.559658]  [] ? generic_writepages+0x3e/0x55
[  207.559755]  [] ? __writeback_single_inode+0x39/0xd1
[  207.559851]  [] ? writeback_sb_inodes+0x206/0x392
[  207.559946]  [] ? __writeback_inodes_wb+0x67/0xa2
[  207.560040]  [] ? wb_writeback+0xfd/0x18b
[  207.560134]  [] ? bdi_dirty_limit+0x27/0x81
[  207.560227]  [] ? wb_do_writeback+0x13d/0x1a2
[  207.560322]  [] ? add_timer_on+0x61/0x61
[  207.560414]  [] ? bdi_writeback_thread+0x7f/0x13e
[  207.560509]  [] ? wb_do_writeback+0x1a2/0x1a2
[  207.560603]  [] ? wb_do_writeback+0x1a2/0x1a2
[  207.560698]  [] ? kthread+0x81/0x89
[  207.560791]  [] ? kernel_thread_helper+0x4/0x10
[  207.560886]  [] ? kthread_worker_fn+0xe0/0xe0
[  207.560979]  [] ? gs_change+0xb/0xb
[  207.561069] ---[ end trace 5de5f6a314770eda ]---


Thanks for all the answers!


-- 
Fabio
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 2/9] suppress "Device nodeX does not have a release() function" warning

2012-10-18 Thread KOSAKI Motohiro
On Fri, Oct 19, 2012 at 2:46 AM,   wrote:
> From: Yasuaki Ishimatsu 
>
> When calling unregister_node(), the function shows following message at
> device_release().
>
> "Device 'node2' does not have a release() function, it is broken and must
> be fixed."
>
> The reason is node's device struct does not have a release() function.
>
> So the patch registers node_device_release() to the device's release()
> function for suppressing the warning message. Additionally, the patch adds
> memset() to initialize a node struct into register_node(). Because the node
> struct is part of node_devices[] array and it cannot be freed by
> node_device_release(). So if system reuses the node struct, it has a garbage.
>
> CC: David Rientjes 
> CC: Jiang Liu 
> Cc: Minchan Kim 
> CC: Andrew Morton 
> CC: KOSAKI Motohiro 
> Signed-off-by: Yasuaki Ishimatsu 
> Signed-off-by: Wen Congyang 

I still think node array should be converted node pointer array and
node_device_release() free memory as other typical drivers.
However, this is acceptable as first step.

Acked-by: KOSAKI Motohiro 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] pwm: add spear pwm driver support

2012-10-18 Thread viresh kumar
On Fri, Oct 19, 2012 at 11:29 AM, Shiraz Hashim  wrote:
> On Thu, Oct 18, 2012 at 11:11:06PM +0530, viresh kumar wrote:
>> On Thu, Oct 18, 2012 at 4:58 PM, Shiraz Hashim  wrote:

>> > +static int __devexit spear_pwm_remove(struct platform_device *pdev)
>> > +{
>> > +   struct spear_pwm_chip *pc = platform_get_drvdata(pdev);
>> > +   int i;
>> > +
>> > +   if (WARN_ON(!pc))
>> > +   return -ENODEV;
>> > +
>> > +   for (i = 0; i < NUM_PWM; i++) {
>> > +   struct pwm_device *pwmd = &pc->chip.pwms[i];
>> > +
>> > +   if (!test_bit(PWMF_ENABLED, &pwmd->flags))

One point here: If i am not wrong you want to disable pwmd if it is enabled.
Shouldn't you check for if (test_bit(PWMF_ENABLED, &pwmd->flags)) instead?

>> > +   if (clk_prepare_enable(pc->clk) < 0)
>> > +   continue;
>> > +
>> > +   spear_pwm_writel(pc, i, PWMCR, 0);
>> > +   clk_disable_unprepare(pc->clk);
>> > +   }
>>
>> You are enabling/disabling clock N times here and each of these will
>> write to an register. Do something better.
>>
>
> I need to shut down all active pwms, how else would you suggest that ?

Sorry, i misread the code on the second go :(

I am proposing something like:

static int __devexit spear_pwm_remove(struct platform_device *pdev)
{
   struct spear_pwm_chip *pc = platform_get_drvdata(pdev);
   int i, clk_enabled = 0;

   if (WARN_ON(!pc))
   return -ENODEV;

   for (i = 0; i < NUM_PWM; i++) {
   struct pwm_device *pwmd = &pc->chip.pwms[i];

   if (!test_bit(PWMF_ENABLED, &pwmd->flags) && !clk_enabled)
   if (clk_prepare_enable(pc->clk) < 0)
   continue;
   else
   clk_enabled++;

   spear_pwm_writel(pc, i, PWMCR, 0);
   }

   if (clk_enabled)
   clk_disable_unprepare(pc->clk);
   ...
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch for-3.7 v2] mm, mempolicy: avoid taking mutex inside spinlock when reading numa_maps

2012-10-18 Thread KOSAKI Motohiro
>> Can't we have another way to fix ? like this ? too ugly ?
>> Again, I'm sorry if I misunderstand the points.
>>
> Sorry this patch itself may be buggy. please don't test..
> I missed that kernel/exit.c sets task->mempolicy to be NULL.
> fixed one here.
>
> --
> From 5581c71e68a7f50e52fd67cca00148911023f9f5 Mon Sep 17 00:00:00 2001
> From: KAMEZAWA Hiroyuki 
> Date: Thu, 18 Oct 2012 13:50:29 +0900
>
> Subject: [PATCH] hold task->mempolicy while numa_maps scans.
>
>  /proc//numa_maps scans vma and show mempolicy under
>  mmap_sem. It sometimes accesses task->mempolicy which can
>  be freed without mmap_sem and numa_maps can show some
>  garbage while scanning.
>
> This patch tries to take reference count of task->mempolicy at reading
> numa_maps before calling get_vma_policy(). By this, task->mempolicy
> will not be freed until numa_maps reaches its end.
>
> Signed-off-by: KAMEZAWA Hiroyuki 
>
> V1->V2
>  -  access task->mempolicy only once and remember it.  Becase kernel/exit.c
> can overwrite it.
>
> Signed-off-by: KAMEZAWA Hiroyuki 

Ok, this is acceptable to me. go ahead.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Xen-devel] [PATCH V3 2/6]: PVH: use native irq, enable callback, use HVM ring ops, smp, ...

2012-10-18 Thread Ian Campbell
On Thu, 2012-10-18 at 23:03 +0100, Mukesh Rathor wrote:
> On Thu, 18 Oct 2012 11:44:37 +0100
> Ian Campbell  wrote:
> 
> > On Thu, 2012-10-18 at 01:30 +0100, Mukesh Rathor wrote:
> > > PVH: make gdt_frames[]/gdt_ents into a union with {gdtaddr, gdtsz},
> > > PVH only needs to send down gdtaddr and gdtsz. irq.c: PVH uses
> > > native_irq_ops. vcpu hotplug is currently not available for PVH.
> > > events.c: setup callback vector for PVH. smp.c: This pertains to
> > > bringing up smp vcpus. PVH runs in ring 0, so syscalls are native.
> > > Also, the vcpu context is send down via the hcall to be set in the
> > > vmcs. gdtaddr and gdtsz are unionionized as PVH only needs to send
> > > these two to be set in the vmcs. Finally, PVH ring ops uses HVM
> > > paths for xenbus.
> > > 
> > > Signed-off-by: Mukesh Rathor 
> > > ---
> > >  arch/x86/include/asm/xen/interface.h |   11 +-
> > >  arch/x86/xen/irq.c   |5 ++-
> > >  arch/x86/xen/p2m.c   |2 +-
> > >  arch/x86/xen/smp.c   |   75
> > > ++ drivers/xen/cpu_hotplug.c
> > > |4 +- drivers/xen/events.c |9 -
> > >  drivers/xen/xenbus/xenbus_client.c   |3 +-
> > 
> > This patch seems to have been horribly whitespace damaged.
> 
> Hmm.. not sure what happened. Resending. See another email.
> 
> > Have you seen "git send-email" ? It's very useful for avoiding this
> > sort of thing and also takes a lot of the grunt work out of reposting
> > a series.
> 
> > It also chains the patches as replies to the introductory zero-th mail
> > -- which is something I've been meaning to ask you to do for a while.
> > It's useful because it joins the series together in a thread which
> > makes it easier to keep track of in my INBOX.
> 
> I prefer different thread-sets for different version. Otherwise too
> many emails makes much harder to manage and figure. Besides, as
> comments come in, path x of y,  may contain different files/changes in
> a subsequent version.

I meant one thread per posting, not one thread for all all them. Which
seems to be what you are saying you prefer but not what you are doing.

Ian.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 4/9] clear the memory to store struct page

2012-10-18 Thread wency
From: Wen Congyang 

If sparse memory vmemmap is enabled, we can't free the memory to store
struct page when a memory device is hotremoved, because we may store
struct page in the memory to manage the memory which doesn't belong
to this memory device. When we hotadded this memory device again, we
will reuse this memory to store struct page, and struct page may
contain some obsolete information, and we will get bad-page state:

[   59.611278] init_memory_mapping: [mem 0x8000-0x9fff]
[   59.637836] Built 2 zonelists in Node order, mobility grouping on.  Total 
pages: 547617
[   59.638739] Policy zone: Normal
[   59.650840] BUG: Bad page state in process bash  pfn:9b6dc
[   59.651124] page:ea0002200020 count:0 mapcount:0 mapping:  
(null) index:0xfdfdfdfdfdfdfdfd
[   59.651494] page flags: 
0x2fdfdfdfd5df9fd(locked|referenced|uptodate|dirty|lru|active|slab|owner_priv_1|private|private_2|writeback|head|tail|swapcache|reclaim|swapbacked|unevictable|uncached|compound_lock)
[   59.653604] Modules linked in: netconsole acpiphp pci_hotplug 
acpi_memhotplug loop kvm_amd kvm microcode tpm_tis tpm tpm_bios evdev psmouse 
serio_raw i2c_piix4 i2c_core parport_pc parport processor button thermal_sys 
ext3 jbd mbcache sg sr_mod cdrom ata_generic virtio_net ata_piix virtio_blk 
libata virtio_pci virtio_ring virtio scsi_mod
[   59.656998] Pid: 988, comm: bash Not tainted 3.6.0-rc7-guest #12
[   59.657172] Call Trace:
[   59.657275]  [] ? bad_page+0xb0/0x100
[   59.657434]  [] ? free_pages_prepare+0xb3/0x100
[   59.657610]  [] ? free_hot_cold_page+0x48/0x1a0
[   59.657787]  [] ? online_pages_range+0x68/0xa0
[   59.657961]  [] ? 
__online_page_increment_counters+0x10/0x10
[   59.658162]  [] ? walk_system_ram_range+0x101/0x110
[   59.658346]  [] ? online_pages+0x1a5/0x2b0
[   59.658515]  [] ? __memory_block_change_state+0x20d/0x270
[   59.658710]  [] ? store_mem_state+0xb6/0xf0
[   59.658878]  [] ? sysfs_write_file+0xd2/0x160
[   59.659052]  [] ? vfs_write+0xaa/0x160
[   59.659212]  [] ? sys_write+0x47/0x90
[   59.659371]  [] ? async_page_fault+0x25/0x30
[   59.659543]  [] ? system_call_fastpath+0x16/0x1b
[   59.659720] Disabling lock debugging due to kernel taint

This patch clears the memory to store struct page to avoid unexpected error.

CC: David Rientjes 
CC: Jiang Liu 
Cc: Minchan Kim 
CC: Andrew Morton 
CC: KOSAKI Motohiro 
CC: Yasuaki Ishimatsu 
Reported-by: Vasilis Liaskovitis 
Signed-off-by: Wen Congyang 
---
 mm/sparse.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/mm/sparse.c b/mm/sparse.c
index fac95f2..0021265 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -638,7 +638,6 @@ static struct page *__kmalloc_section_memmap(unsigned long 
nr_pages)
 got_map_page:
ret = (struct page *)pfn_to_kaddr(page_to_pfn(page));
 got_map_ptr:
-   memset(ret, 0, memmap_size);
 
return ret;
 }
@@ -760,6 +759,8 @@ int __meminit sparse_add_one_section(struct zone *zone, 
unsigned long start_pfn,
goto out;
}
 
+   memset(memmap, 0, sizeof(struct page) * nr_pages);
+
ms->section_mem_map |= SECTION_MARKED_PRESENT;
 
ret = sparse_init_one_section(ms, section_nr, memmap, usemap);
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 6/9] memory-hotplug: update mce_bad_pages when removing the memory

2012-10-18 Thread wency
From: Wen Congyang 

When we hotremove a memory device, we will free the memory to store
struct page. If the page is hwpoisoned page, we should decrease
mce_bad_pages.

CC: David Rientjes 
CC: Jiang Liu 
CC: Len Brown 
CC: Benjamin Herrenschmidt 
CC: Paul Mackerras 
CC: Christoph Lameter 
Cc: Minchan Kim 
CC: Andrew Morton 
CC: KOSAKI Motohiro 
CC: Yasuaki Ishimatsu 
Signed-off-by: Wen Congyang 
---
 mm/sparse.c |   19 +++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/mm/sparse.c b/mm/sparse.c
index 0021265..77d6a93 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -774,6 +774,24 @@ out:
return ret;
 }
 
+#ifdef CONFIG_MEMORY_FAILURE
+static void clear_hwpoisoned_pages(struct page *memmap, int nr_pages)
+{
+   int i;
+
+   for (i = 0; i < PAGES_PER_SECTION; i++) {
+   if (PageHWPoison(&memmap[i])) {
+   atomic_long_sub(1, &mce_bad_pages);
+   ClearPageHWPoison(&memmap[i]);
+   }
+   }
+}
+#else
+static void clear_hwpoisoned_pages(struct page *memmap, int nr_pages)
+{
+}
+#endif
+
 void sparse_remove_one_section(struct zone *zone, struct mem_section *ms)
 {
struct page *memmap = NULL;
@@ -785,6 +803,7 @@ void sparse_remove_one_section(struct zone *zone, struct 
mem_section *ms)
__section_nr(ms));
ms->section_mem_map = 0;
ms->pageblock_flags = NULL;
+   clear_hwpoisoned_pages(memmap, PAGES_PER_SECTION);
}
 
free_section_usemap(memmap, usemap);
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 5/9] memory-hotplug: skip HWPoisoned page when offlining pages

2012-10-18 Thread wency
From: Wen Congyang 

hwpoisoned may be set when we offline a page by the sysfs interface
/sys/devices/system/memory/soft_offline_page or
/sys/devices/system/memory/hard_offline_page. We use __free_page() to put
a page to buddy system when onlining pages. If the page is hwpoisoned page,
we can't put it to buddy system, and the page is not in free list. Such
page can't be isolated and offlined. So we should skip such pages when
offlining pages.

CC: David Rientjes 
CC: Jiang Liu 
CC: Len Brown 
CC: Benjamin Herrenschmidt 
CC: Paul Mackerras 
CC: Christoph Lameter 
Cc: Minchan Kim 
CC: Andrew Morton 
CC: KOSAKI Motohiro 
CC: Yasuaki Ishimatsu 
Signed-off-by: Wen Congyang 
---
 include/linux/page-isolation.h |   10 ++
 mm/memory-failure.c|2 +-
 mm/memory_hotplug.c|4 ++--
 mm/page_alloc.c|   27 +++
 mm/page_isolation.c|   27 ---
 5 files changed, 52 insertions(+), 18 deletions(-)

diff --git a/include/linux/page-isolation.h b/include/linux/page-isolation.h
index 76a9539..a92061e 100644
--- a/include/linux/page-isolation.h
+++ b/include/linux/page-isolation.h
@@ -2,7 +2,8 @@
 #define __LINUX_PAGEISOLATION_H
 
 
-bool has_unmovable_pages(struct zone *zone, struct page *page, int count);
+bool has_unmovable_pages(struct zone *zone, struct page *page, int count,
+bool skip_hwpoisoned_pages);
 void set_pageblock_migratetype(struct page *page, int migratetype);
 int move_freepages_block(struct zone *zone, struct page *page,
int migratetype);
@@ -21,7 +22,7 @@ int move_freepages(struct zone *zone,
  */
 int
 start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn,
-unsigned migratetype);
+unsigned migratetype, bool skip_hwpoisoned_pages);
 
 /*
  * Changes MIGRATE_ISOLATE to MIGRATE_MOVABLE.
@@ -34,12 +35,13 @@ undo_isolate_page_range(unsigned long start_pfn, unsigned 
long end_pfn,
 /*
  * Test all pages in [start_pfn, end_pfn) are isolated or not.
  */
-int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn);
+int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn,
+   bool skip_hwpoisoned_pages);
 
 /*
  * Internal functions. Changes pageblock's migrate type.
  */
-int set_migratetype_isolate(struct page *page);
+int set_migratetype_isolate(struct page *page, bool skip_hwpoisoned_pages);
 void unset_migratetype_isolate(struct page *page, unsigned migratetype);
 struct page *alloc_migrate_target(struct page *page, unsigned long private,
int **resultp);
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 6c5899b..1abffee 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1385,7 +1385,7 @@ static int get_any_page(struct page *p, unsigned long 
pfn, int flags)
 * Isolate the page, so that it doesn't get reallocated if it
 * was free.
 */
-   set_migratetype_isolate(p);
+   set_migratetype_isolate(p, true);
/*
 * When the target page is a free hugepage, just remove it
 * from free hugepage list.
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 56b758a..ec899a2 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -854,7 +854,7 @@ check_pages_isolated_cb(unsigned long start_pfn, unsigned 
long nr_pages,
 {
int ret;
long offlined = *(long *)data;
-   ret = test_pages_isolated(start_pfn, start_pfn + nr_pages);
+   ret = test_pages_isolated(start_pfn, start_pfn + nr_pages, true);
offlined = nr_pages;
if (!ret)
*(long *)data += offlined;
@@ -901,7 +901,7 @@ static int __ref __offline_pages(unsigned long start_pfn,
nr_pages = end_pfn - start_pfn;
 
/* set above range as isolated */
-   ret = start_isolate_page_range(start_pfn, end_pfn, MIGRATE_MOVABLE);
+   ret = start_isolate_page_range(start_pfn, end_pfn, MIGRATE_MOVABLE, 
true);
if (ret)
goto out;
 
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index bb90971..e33d0fb 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5575,7 +5575,8 @@ void set_pageblock_flags_group(struct page *page, 
unsigned long flags,
  * MIGRATE_MOVABLE block might include unmovable pages. It means you can't
  * expect this function should be exact.
  */
-bool has_unmovable_pages(struct zone *zone, struct page *page, int count)
+bool has_unmovable_pages(struct zone *zone, struct page *page, int count,
+bool skip_hwpoisoned_pages)
 {
unsigned long pfn, iter, found;
int mt;
@@ -5610,6 +5611,13 @@ bool has_unmovable_pages(struct zone *zone, struct page 
*page, int count)
continue;
}
 
+   /*
+* The HWPoisoned page may be not in buddy system, and
+* page_count() is no

[PATCH v3 7/9] memory-hotplug: auto offline page_cgroup when onlining memory block failed

2012-10-18 Thread wency
From: Wen Congyang 

When a memory block is onlined, we will try allocate memory on that node
to store page_cgroup. If onlining the memory block failed, we don't
offline the page cgroup, and we have no chance to offline this page cgroup
unless the memory block is onlined successfully again. It will cause
that we can't hot-remove the memory device on that node, because some
memory is used to store page cgroup. If onlining the memory block
is failed, there is no need to stort page cgroup for this memory. So
auto offline page_cgroup when onlining memory block failed.

CC: David Rientjes 
CC: Jiang Liu 
CC: Len Brown 
CC: Benjamin Herrenschmidt 
CC: Paul Mackerras 
CC: Christoph Lameter 
Cc: Minchan Kim 
CC: Andrew Morton 
CC: KOSAKI Motohiro 
CC: Yasuaki Ishimatsu 
Signed-off-by: Wen Congyang 
Acked-by: KOSAKI Motohiro 
---
 mm/page_cgroup.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/mm/page_cgroup.c b/mm/page_cgroup.c
index 5ddad0c..44db00e 100644
--- a/mm/page_cgroup.c
+++ b/mm/page_cgroup.c
@@ -251,6 +251,9 @@ static int __meminit page_cgroup_callback(struct 
notifier_block *self,
mn->nr_pages, mn->status_change_nid);
break;
case MEM_CANCEL_ONLINE:
+   offline_page_cgroup(mn->start_pfn,
+   mn->nr_pages, mn->status_change_nid);
+   break;
case MEM_GOING_OFFLINE:
break;
case MEM_ONLINE:
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 8/9] memory-hotplug: fix NR_FREE_PAGES mismatch

2012-10-18 Thread wency
From: Wen Congyang 

NR_FREE_PAGES will be wrong after offlining pages. We add/dec NR_FREE_PAGES
like this now:
1. mova all pages in buddy system to MIGRATE_ISOLATE, and dec NR_FREE_PAGES
2. don't add NR_FREE_PAGES when it is freed and the migratetype is 
MIGRATE_ISOLATE
3. dec NR_FREE_PAGES when offlining isolated pages.
4. add NR_FREE_PAGES when undoing isolate pages.

When we come to step 3, all pages are in MIGRATE_ISOLATE list, and NR_FREE_PAGES
are right. When we come to step4, all pages are not in buddy system, so we don't
change NR_FREE_PAGES in this step, but we change NR_FREE_PAGES in step3. So
NR_FREE_PAGES is wrong after offlining pages. So there is no need to change
NR_FREE_PAGES in step3.

This patch also fixs a problem in step2: if the migratetype is MIGRATE_ISOLATE,
we should not add NR_FRR_PAGES when we remove pages from pcppages.

CC: David Rientjes 
CC: Jiang Liu 
CC: Len Brown 
CC: Benjamin Herrenschmidt 
CC: Paul Mackerras 
CC: Christoph Lameter 
Cc: Minchan Kim 
CC: Andrew Morton 
CC: KOSAKI Motohiro 
CC: Yasuaki Ishimatsu 
Signed-off-by: Wen Congyang 
---
 mm/page_alloc.c |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index e33d0fb..9aa9490 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -667,11 +667,13 @@ static void free_pcppages_bulk(struct zone *zone, int 
count,
/* MIGRATE_MOVABLE list may include MIGRATE_RESERVEs */
__free_one_page(page, zone, 0, mt);
trace_mm_page_pcpu_drain(page, 0, mt);
-   if (is_migrate_cma(mt))
-   __mod_zone_page_state(zone, NR_FREE_CMA_PAGES, 
1);
+   if (likely(mt != MIGRATE_ISOLATE)) {
+   __mod_zone_page_state(zone, NR_FREE_PAGES, 1);
+   if (is_migrate_cma(mt))
+   __mod_zone_page_state(zone, 
NR_FREE_CMA_PAGES, 1);
+   }
} while (--to_free && --batch_free && !list_empty(list));
}
-   __mod_zone_page_state(zone, NR_FREE_PAGES, count);
spin_unlock(&zone->lock);
 }
 
@@ -6006,8 +6008,6 @@ __offline_isolated_pages(unsigned long start_pfn, 
unsigned long end_pfn)
list_del(&page->lru);
rmv_page_order(page);
zone->free_area[order].nr_free--;
-   __mod_zone_page_state(zone, NR_FREE_PAGES,
- - (1UL << order));
for (i = 0; i < (1 << order); i++)
SetPageReserved((page+i));
pfn += (1 << order);
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 9/9] memory-hotplug: allocate zone's pcp before onlining pages

2012-10-18 Thread wency
From: Wen Congyang 

We use __free_page() to put a page to buddy system when onlining pages.
__free_page() will store NR_FREE_PAGES in zone's pcp.vm_stat_diff, so we
should allocate zone's pcp before onlining pages, otherwise we will lose
some free pages.

CC: David Rientjes 
CC: Jiang Liu 
CC: Len Brown 
CC: Benjamin Herrenschmidt 
CC: Paul Mackerras 
CC: Christoph Lameter 
Cc: Minchan Kim 
CC: Andrew Morton 
CC: KOSAKI Motohiro 
CC: Yasuaki Ishimatsu 
Signed-off-by: Wen Congyang 
---
 mm/memory_hotplug.c |   10 ++
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index ec899a2..eb4c132 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -505,12 +505,16 @@ int __ref online_pages(unsigned long pfn, unsigned long 
nr_pages)
 * So, zonelist must be updated after online.
 */
mutex_lock(&zonelists_mutex);
-   if (!populated_zone(zone))
+   if (!populated_zone(zone)) {
need_zonelists_rebuild = 1;
+   build_all_zonelists(NULL, zone);
+   }
 
ret = walk_system_ram_range(pfn, nr_pages, &onlined_pages,
online_pages_range);
if (ret) {
+   if (need_zonelists_rebuild)
+   zone_pcp_reset(zone);
mutex_unlock(&zonelists_mutex);
printk(KERN_DEBUG "online_pages [mem %#010llx-%#010llx] 
failed\n",
   (unsigned long long) pfn << PAGE_SHIFT,
@@ -525,9 +529,7 @@ int __ref online_pages(unsigned long pfn, unsigned long 
nr_pages)
zone->zone_pgdat->node_present_pages += onlined_pages;
if (onlined_pages) {
node_set_state(zone_to_nid(zone), N_HIGH_MEMORY);
-   if (need_zonelists_rebuild)
-   build_all_zonelists(NULL, zone);
-   else
+   if (!need_zonelists_rebuild)
zone_pcp_update(zone);
}
 
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 2/9] suppress "Device nodeX does not have a release() function" warning

2012-10-18 Thread wency
From: Yasuaki Ishimatsu 

When calling unregister_node(), the function shows following message at
device_release().

"Device 'node2' does not have a release() function, it is broken and must
be fixed."

The reason is node's device struct does not have a release() function.

So the patch registers node_device_release() to the device's release()
function for suppressing the warning message. Additionally, the patch adds
memset() to initialize a node struct into register_node(). Because the node
struct is part of node_devices[] array and it cannot be freed by
node_device_release(). So if system reuses the node struct, it has a garbage.

CC: David Rientjes 
CC: Jiang Liu 
Cc: Minchan Kim 
CC: Andrew Morton 
CC: KOSAKI Motohiro 
Signed-off-by: Yasuaki Ishimatsu 
Signed-off-by: Wen Congyang 
---
 drivers/base/node.c |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/base/node.c b/drivers/base/node.c
index af1a177..2baa73a 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -252,6 +252,9 @@ static inline void hugetlb_register_node(struct node *node) 
{}
 static inline void hugetlb_unregister_node(struct node *node) {}
 #endif
 
+static void node_device_release(struct device *dev)
+{
+}
 
 /*
  * register_node - Setup a sysfs device for a node.
@@ -263,8 +266,11 @@ int register_node(struct node *node, int num, struct node 
*parent)
 {
int error;
 
+   memset(node, 0, sizeof(*node));
+
node->dev.id = num;
node->dev.bus = &node_subsys;
+   node->dev.release = node_device_release;
error = device_register(&node->dev);
 
if (!error){
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 0/9] bugfix for memory hotplug

2012-10-18 Thread wency
From: Wen Congyang 

Changes from v2 to v3:
  Merge the bug fix from ishimatsu to this patchset(Patch 1-3)
  Patch 3: split it from patch as it fixes another bug.
  Patch 4: new patch, and fix bad-page state when hotadding a memory
   device after hotremoving it. I forgot to post this patch in v2.
  Patch 6: update it according to Dave Hansen's comment.

Changes from v1 to v2:
  Patch 1: updated according to kosaki's suggestion

  Patch 2: new patch, and update mce_bad_pages when removing memory.

  Patch 4: new patch, and fix a NR_FREE_PAGES mismatch, and this bug
   cause oom in my test.

  Patch 5: new patch, and fix a new bug. When repeating to online/offline
   pages, the free pages will continue to decrease. 

Wen Congyang (6):
  clear the memory to store struct page
  memory-hotplug: skip HWPoisoned page when offlining pages
  memory-hotplug: update mce_bad_pages when removing the memory
  memory-hotplug: auto offline page_cgroup when onlining memory block
failed
  memory-hotplug: fix NR_FREE_PAGES mismatch
  memory-hotplug: allocate zone's pcp before onlining pages

Yasuaki Ishimatsu (3):
  suppress "Device memoryX does not have a release() function" warning
  suppress "Device nodeX does not have a release() function" warning
  memory-hotplug: flush the work for the node when the node is offlined

 drivers/base/memory.c  |9 -
 drivers/base/node.c|   11 +++
 include/linux/page-isolation.h |   10 ++
 mm/memory-failure.c|2 +-
 mm/memory_hotplug.c|   14 --
 mm/page_alloc.c|   37 -
 mm/page_cgroup.c   |3 +++
 mm/page_isolation.c|   27 ---
 mm/sparse.c|   22 +-
 9 files changed, 106 insertions(+), 29 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 3/9] memory-hotplug: flush the work for the node when the node is offlined

2012-10-18 Thread wency
From: Yasuaki Ishimatsu 

If the node is onlined after it is offlined, we will clear the memory
to store the node's information. This structure contains struct work,
so we should flush work before the work's information is cleared.

CC: David Rientjes 
CC: Jiang Liu 
Cc: Minchan Kim 
CC: Andrew Morton 
CC: KOSAKI Motohiro 
Signed-off-by: Yasuaki Ishimatsu 
Signed-off-by: Wen Congyang 
---
 drivers/base/node.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/base/node.c b/drivers/base/node.c
index 2baa73a..13c0ddf 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -254,6 +254,11 @@ static inline void hugetlb_unregister_node(struct node 
*node) {}
 
 static void node_device_release(struct device *dev)
 {
+#if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HUGETLBFS)
+   struct node *node_dev = to_node(dev);
+
+   flush_work(&node_dev->node_work);
+#endif
 }
 
 /*
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 1/9] suppress "Device memoryX does not have a release() function" warning

2012-10-18 Thread wency
From: Yasuaki Ishimatsu 

When calling remove_memory_block(), the function shows following message at
device_release().

"Device 'memory528' does not have a release() function, it is broken and must
be fixed."

The reason is memory_block's device struct does not have a release() function.

So the patch registers memory_block_release() to the device's release() function
for suppressing the warning message. Additionally, the patch moves kfree(mem)
into the release function since the release function is prepared as a means
to free a memory_block struct.

CC: Jiang Liu 
Cc: Minchan Kim 
CC: Andrew Morton 
CC: Wen Congyang 
Signed-off-by: Yasuaki Ishimatsu 
Acked-by: David Rientjes 
Acked-by: KOSAKI Motohiro 
---
 drivers/base/memory.c |9 -
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index 86c8821..7eb1211 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -70,6 +70,13 @@ void unregister_memory_isolate_notifier(struct 
notifier_block *nb)
 }
 EXPORT_SYMBOL(unregister_memory_isolate_notifier);
 
+static void memory_block_release(struct device *dev)
+{
+   struct memory_block *mem = container_of(dev, struct memory_block, dev);
+
+   kfree(mem);
+}
+
 /*
  * register_memory - Setup a sysfs device for a memory block
  */
@@ -80,6 +87,7 @@ int register_memory(struct memory_block *memory)
 
memory->dev.bus = &memory_subsys;
memory->dev.id = memory->start_section_nr / sections_per_block;
+   memory->dev.release = memory_block_release;
 
error = device_register(&memory->dev);
return error;
@@ -635,7 +643,6 @@ int remove_memory_block(unsigned long node_id, struct 
mem_section *section,
mem_remove_simple_file(mem, phys_device);
mem_remove_simple_file(mem, removable);
unregister_memory(mem);
-   kfree(mem);
} else
kobject_put(&mem->dev.kobj);
 
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH] x86/ioapic: Fix that not all allocated irqs are ioapic type irqs

2012-10-18 Thread Liu, Chuansheng


> -Original Message-
> From: yhlu.ker...@gmail.com [mailto:yhlu.ker...@gmail.com] On Behalf Of
> Yinghai Lu
> impossible !
> 
> where is the irq_desc coming from. ?
Any other chip can call function irq_alloc_descs/irq_alloc_desc() to get 
irq_desc,
and other chip can has their own chip data.
It is this patch want to point out.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5 1/2] x86, pci: Reset PCIe devices at boot time

2012-10-18 Thread Takao Indoh
(2012/10/19 0:32), Khalid Aziz wrote:
> On Wed, 2012-10-17 at 15:23 +0900, Takao Indoh wrote:
>> This patch resets PCIe devices at boot time by hot reset when
>> "reset_devices" is specified.
>>
>> Signed-off-by: Takao Indoh 
>> ---
>>   arch/x86/include/asm/pci-direct.h |1
>>   arch/x86/kernel/setup.c   |3
>>   arch/x86/pci/early.c  |  353 
>>   include/linux/pci.h   |2
>>   init/main.c   |4
>>   5 files changed, 361 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/x86/include/asm/pci-direct.h 
>> b/arch/x86/include/asm/pci-direct.h
>> index b1e7a45..de30db2 100644
>> --- a/arch/x86/include/asm/pci-direct.h
>> +++ b/arch/x86/include/asm/pci-direct.h
>> @@ -18,4 +18,5 @@ extern int early_pci_allowed(void);
>>   extern unsigned int pci_early_dump_regs;
>>   extern void early_dump_pci_device(u8 bus, u8 slot, u8 func);
>>   extern void early_dump_pci_devices(void);
>> +extern void early_reset_pcie_devices(void);
>>   #endif /* _ASM_X86_PCI_DIRECT_H */
>> diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
>> index a2bb18e..73d3425 100644
>> --- a/arch/x86/kernel/setup.c
>> +++ b/arch/x86/kernel/setup.c
>> @@ -987,6 +987,9 @@ void __init setup_arch(char **cmdline_p)
>>  generic_apic_probe();
>>
>>  early_quirks();
>> +#ifdef CONFIG_PCI
>> +early_reset_pcie_devices();
>> +#endif
>>
>>  /*
>>   * Read APIC and some other early information from ACPI tables.
>> diff --git a/arch/x86/pci/early.c b/arch/x86/pci/early.c
>> index d1067d5..df7f4fc 100644
>> --- a/arch/x86/pci/early.c
>> +++ b/arch/x86/pci/early.c
>> @@ -1,5 +1,6 @@
>>   #include 
>>   #include 
>> +#include 
>>   #include 
>>   #include 
>>   #include 
>> @@ -109,3 +110,355 @@ void early_dump_pci_devices(void)
>>  }
>>  }
>>   }
>> +
>> +#define PCI_EXP_SAVE_REGS   7
>> +#define pcie_cap_has_devctl(type, flags)1
>> +#define pcie_cap_has_lnkctl(type, flags)\
>> +((flags & PCI_EXP_FLAGS_VERS) > 1 ||\
>> + (type == PCI_EXP_TYPE_ROOT_PORT || \
>> +  type == PCI_EXP_TYPE_ENDPOINT ||  \
>> +  type == PCI_EXP_TYPE_LEG_END))
>> +#define pcie_cap_has_sltctl(type, flags)\
>> +((flags & PCI_EXP_FLAGS_VERS) > 1 ||\
>> + ((type == PCI_EXP_TYPE_ROOT_PORT) ||   \
>> +  (type == PCI_EXP_TYPE_DOWNSTREAM &&   \
>> +   (flags & PCI_EXP_FLAGS_SLOT
>> +#define pcie_cap_has_rtctl(type, flags) \
>> +((flags & PCI_EXP_FLAGS_VERS) > 1 ||\
>> + (type == PCI_EXP_TYPE_ROOT_PORT || \
>> +  type == PCI_EXP_TYPE_RC_EC))
>> +
>> +struct save_config {
>> +u32 pci[16];
>> +u16 pcie[PCI_EXP_SAVE_REGS];
>> +};
>> +
>> +struct pcie_dev {
>> +int cap;   /* position of PCI Express capability */
>> +int flags; /* PCI_EXP_FLAGS */
>> +struct save_config save; /* saved configration register */
>> +};
>> +
>> +struct pcie_port {
>> +struct list_head dev;
>> +u8 bus;
>> +u8 slot;
>> +u8 func;
>> +u8 secondary;
>> +struct pcie_dev child[PCI_MAX_FUNCTIONS];
>> +};
>> +
>> +static LIST_HEAD(device_list);
>> +static void __init pci_udelay(int loops)
>> +{
>> +while (loops--) {
>> +/* Approximately 1 us */
>> +native_io_delay();
>> +}
>> +}
>> +
>> +/* Derived from drivers/pci/pci.c */
>> +#define PCI_FIND_CAP_TTL48
>> +static int __init __pci_find_next_cap_ttl(u8 bus, u8 slot, u8 func,
>> +  u8 pos, int cap, int *ttl)
>> +{
>> +u8 id;
>> +
>> +while ((*ttl)--) {
>> +pos = read_pci_config_byte(bus, slot, func, pos);
>> +if (pos < 0x40)
>> +break;
>> +pos &= ~3;
>> +id = read_pci_config_byte(bus, slot, func,
>> +pos + PCI_CAP_LIST_ID);
>> +if (id == 0xff)
>> +break;
>> +if (id == cap)
>> +return pos;
>> +pos += PCI_CAP_LIST_NEXT;
>> +}
>> +return 0;
>> +}
>> +
>> +static int __init __pci_find_next_cap(u8 bus, u8 slot, u8 func, u8 pos, int 
>> cap)
>> +{
>> +int ttl = PCI_FIND_CAP_TTL;
>> +
>> +return __pci_find_next_cap_ttl(bus, slot, func, pos, cap, &ttl);
>> +}
>> +
>> +static int __init __pci_bus_find_cap_start(u8 bus, u8 slot, u8 func,
>> +   u8 hdr_type)
>> +{
>> +u16 status;
>> +
>> +status = read_pci_config_16(bus, slot, func, PCI_STATUS);
>> +if (!(status & PCI_STATUS_CAP_LIST))
>> +return 0;
>> +
>> +switch (hdr_type) {
>> +case PCI_HEADER_TYPE_NORMAL:
>> +case PCI_HEADER_TYPE_BRIDGE:
>> +return PCI_CAPABILITY_LIST;
>> +case PCI_HEADER_TYPE_CARDBUS:
>> +return PCI_CB_CAPABILITY_LIST;
>> +default:
>> +return 0;
>> + 

Re: [PATCH] ptp_pch: release chip->mem_base and chip->regs on error

2012-10-18 Thread Richard Cochran
On Thu, Oct 18, 2012 at 05:48:52PM +0800, Yuanhan Liu wrote:
> Fix smatch warnings catched by Fengguang's 0-DAY system:
> + drivers/ptp/ptp_pch.c:641 pch_probe() warn: 'chip->mem_base' was not 
> released on error
> + drivers/ptp/ptp_pch.c:641 pch_probe() warn: 'chip->regs' was not released 
> on error
> 
> Cc: Richard Cochran 
> Cc: David S. Miller 
> Signed-off-by: Yuanhan Liu 

Acked-by: Richard Cochran 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH] x86/ioapic: Fix that not all allocated irqs are ioapic type irqs

2012-10-18 Thread Liu, Chuansheng


> -Original Message-
> From: yhlu.ker...@gmail.com [mailto:yhlu.ker...@gmail.com] On Behalf Of
> Yinghai Lu
> Sent: Friday, October 19, 2012 2:11 PM
> To: Liu, Chuansheng
> Cc: t...@linutronix.de; mi...@redhat.com; h...@zytor.com; Siddha, Suresh B;
> mathias.ny...@linux.intel.com; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH] x86/ioapic: Fix that not all allocated irqs are ioapic 
> type
> irqs
> 
> On Fri, Oct 19, 2012 at 3:41 AM, Chuansheng Liu
>  wrote:
> >
> > When debugging our system issues related with __setup_vector_irq(),
> > found there is a real wrong code that:
> > for_each_active_irq(irq) {
> > cfg = irq_get_chip_data(irq);
> > if (!cfg)
> > continue;
> >
> > These codes presume all allocated irqs are ioapic irqs, but it is not
> > like that, in our system there are many GPIO interrupts also.
> >
> > When one irq is not ioapic type irq, the chip_data will not be the
> > type of struct irq_cfg in most cases.
> 
> impossible !
> 
> where is the irq_desc coming from. ?
> 
> after alloc_irq_from, alloc_irq_cfg get called too.
Maybe I do not describe the issue clearly.
When I offlined CPU3 and online it again, __setup_vector_irq will be called.
But  for_each_active_irq(irq) will list all active irqs, many irqs are not 
IOAPIC type.
And the chip data is not struct irq_cfg at all, it is set by other chips.

For example, in file gpio-omap.c:
irq_set_chip_data(j, bank); the bank is the type of struct gpio_bank.

And in this case, __setup_vector_irq can not go on the below code due to the 
wrong type variable:
/*
 * If it is a legacy IRQ handled by the legacy PIC, this cpu
 * will be part of the irq_cfg's domain.
 */
if (irq < legacy_pic->nr_legacy_irqs && !IO_APIC_IRQ(irq))
cpumask_set_cpu(cpu, cfg->domain);

if (!cpumask_test_cpu(cpu, cfg->domain))
continue;
vector = cfg->vector;
per_cpu(vector_irq, cpu)[vector] = irq;

> 
> >
> > So in function __setup_vector_irq(), it will cause some strange issues,
> > moreover, if I added some prints(cfg->...) inside it, it can always
> > cause system panic.
> >
> > Here using the struct irq_chip->flags to help identify if the irq
> > is ioapic type or not.
> >
> > Looked forward all codes with for_each_active_irq(), found there is
> > a commit 6fd36ba02 indicates the similar case in print_IO_APICs().
> 
> that is for not printing wrong for MSI etc.
No, it is for avoidingcrash if it is not IOAPIC chip. I can reproduce it in my 
system.
> 
> >
> > Signed-off-by: liu chuansheng 
> > ---
> >  arch/x86/kernel/apic/io_apic.c |   25 ++---
> >  1 files changed, 22 insertions(+), 3 deletions(-)
> >
> > diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
> > index c265593..f0355e6 100644
> > --- a/arch/x86/kernel/apic/io_apic.c
> > +++ b/arch/x86/kernel/apic/io_apic.c
> > @@ -68,6 +68,18 @@
> >  #define for_each_irq_pin(entry, head) \
> > for (entry = head; entry; entry = entry->next)
> >
> > +/* need more thoughts ... */
> > +#define CHIP_FLAG_IOAPIC   0x1000
> > +static inline bool is_ioapic_irq(int irq)
> > +{
> > +   struct irq_chip *chip;
> > +   chip = irq_get_chip(irq);
> > +   if ((chip) && (chip->flags == CHIP_FLAG_IOAPIC))
> > +   return true;
> > +
> > +   return false;
> > +}
> > +
> >  #ifdef CONFIG_IRQ_REMAP
> >  static void irq_remap_modify_chip_defaults(struct irq_chip *chip);
> >  static inline bool irq_remapped(struct irq_cfg *cfg)
> > @@ -1238,6 +1250,9 @@ void __setup_vector_irq(int cpu)
> > raw_spin_lock(&vector_lock);
> > /* Mark the inuse vectors */
> > for_each_active_irq(irq) {
> > +   if (!is_ioapic_irq(irq))
> > +   continue;
> > +
> > cfg = irq_get_chip_data(irq);
> > if (!cfg)
> > continue;
> > @@ -1641,7 +1656,6 @@ __apicdebuginit(void) print_IO_APICs(void)
> > int ioapic_idx;
> > struct irq_cfg *cfg;
> > unsigned int irq;
> > -   struct irq_chip *chip;
> >
> > printk(KERN_DEBUG "number of MP IRQ sources: %d.\n",
> mp_irq_entries);
> > for (ioapic_idx = 0; ioapic_idx < nr_ioapics; ioapic_idx++)
> > @@ -1662,8 +1676,7 @@ __apicdebuginit(void) print_IO_APICs(void)
> > for_each_active_irq(irq) {
> > struct irq_pin_list *entry;
> >
> > -   chip = irq_get_chip(irq);
> > -   if (chip != &ioapic_chip)
> > +   if (!is_ioapic_irq(irq))
> > continue;
> >
> > cfg = irq_get_chip_data(irq);
> 
> if the irq is not using ioapic_chip such as msi_chip etc, that irq
> should be skip.
Print MSI chip is not making sense?
--
To unsubscribe from this list: send the line "unsubscr

Re: "read_current_timer" undefined!

2012-10-18 Thread Alexander Holler

Hello,

Am 18.10.2012 14:16, schrieb Thomas Meyer:


ERROR: "read_current_timer" [drivers/gpu/drm/udl/udl.ko] undefined!
ERROR: "read_current_timer" [crypto/tcrypt.ko] undefined!


There is already a long thread about that, along with patches:

https://lkml.org/lkml/2012/10/9/393

If you need a patch for 3.6, here is what I did before I found the above 
thread:


--
From a026451fdc98a5981e10a18ffa394e53a40b0691 Mon Sep 17 00:00:00 2001
From: Alexander Holler 
Date: Thu, 18 Oct 2012 07:29:39 +0200
Subject: [PATCH] arm: arch timer: export read_current_timer()

Exporting read_current_timmer is needed e.g. for users of get_cycles()
like udlfb which otherwise can't be build as a module.

This seems to have been forgotten in
commit 923df96b9f31b7d08d8438ff9677326d9537accf.

Cc: sta...@vger.kernel.org
Signed-off-by: Alexander Holler 
---
 arch/arm/kernel/arch_timer.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/arm/kernel/arch_timer.c b/arch/arm/kernel/arch_timer.c
index cf25880..7f24d1f 100644
--- a/arch/arm/kernel/arch_timer.c
+++ b/arch/arm/kernel/arch_timer.c
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 

 #include 
 #include 
@@ -232,6 +233,7 @@ int read_current_timer(unsigned long *timer_val)
*timer_val = arch_counter_get_cntpct();
return 0;
 }
+EXPORT_SYMBOL(read_current_timer);

 static struct clocksource clocksource_counter = {
.name   = "arch_sys_counter",
--
1.7.3.4
--

Regards,

Alexander
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] x86/ioapic: Fix that not all allocated irqs are ioapic type irqs

2012-10-18 Thread Yinghai Lu
On Fri, Oct 19, 2012 at 3:41 AM, Chuansheng Liu
 wrote:
>
> When debugging our system issues related with __setup_vector_irq(),
> found there is a real wrong code that:
> for_each_active_irq(irq) {
> cfg = irq_get_chip_data(irq);
> if (!cfg)
> continue;
>
> These codes presume all allocated irqs are ioapic irqs, but it is not
> like that, in our system there are many GPIO interrupts also.
>
> When one irq is not ioapic type irq, the chip_data will not be the
> type of struct irq_cfg in most cases.

impossible !

where is the irq_desc coming from. ?

after alloc_irq_from, alloc_irq_cfg get called too.

>
> So in function __setup_vector_irq(), it will cause some strange issues,
> moreover, if I added some prints(cfg->...) inside it, it can always
> cause system panic.
>
> Here using the struct irq_chip->flags to help identify if the irq
> is ioapic type or not.
>
> Looked forward all codes with for_each_active_irq(), found there is
> a commit 6fd36ba02 indicates the similar case in print_IO_APICs().

that is for not printing wrong for MSI etc.

>
> Signed-off-by: liu chuansheng 
> ---
>  arch/x86/kernel/apic/io_apic.c |   25 ++---
>  1 files changed, 22 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
> index c265593..f0355e6 100644
> --- a/arch/x86/kernel/apic/io_apic.c
> +++ b/arch/x86/kernel/apic/io_apic.c
> @@ -68,6 +68,18 @@
>  #define for_each_irq_pin(entry, head) \
> for (entry = head; entry; entry = entry->next)
>
> +/* need more thoughts ... */
> +#define CHIP_FLAG_IOAPIC   0x1000
> +static inline bool is_ioapic_irq(int irq)
> +{
> +   struct irq_chip *chip;
> +   chip = irq_get_chip(irq);
> +   if ((chip) && (chip->flags == CHIP_FLAG_IOAPIC))
> +   return true;
> +
> +   return false;
> +}
> +
>  #ifdef CONFIG_IRQ_REMAP
>  static void irq_remap_modify_chip_defaults(struct irq_chip *chip);
>  static inline bool irq_remapped(struct irq_cfg *cfg)
> @@ -1238,6 +1250,9 @@ void __setup_vector_irq(int cpu)
> raw_spin_lock(&vector_lock);
> /* Mark the inuse vectors */
> for_each_active_irq(irq) {
> +   if (!is_ioapic_irq(irq))
> +   continue;
> +
> cfg = irq_get_chip_data(irq);
> if (!cfg)
> continue;
> @@ -1641,7 +1656,6 @@ __apicdebuginit(void) print_IO_APICs(void)
> int ioapic_idx;
> struct irq_cfg *cfg;
> unsigned int irq;
> -   struct irq_chip *chip;
>
> printk(KERN_DEBUG "number of MP IRQ sources: %d.\n", mp_irq_entries);
> for (ioapic_idx = 0; ioapic_idx < nr_ioapics; ioapic_idx++)
> @@ -1662,8 +1676,7 @@ __apicdebuginit(void) print_IO_APICs(void)
> for_each_active_irq(irq) {
> struct irq_pin_list *entry;
>
> -   chip = irq_get_chip(irq);
> -   if (chip != &ioapic_chip)
> +   if (!is_ioapic_irq(irq))
> continue;
>
> cfg = irq_get_chip_data(irq);

if the irq is not using ioapic_chip such as msi_chip etc, that irq
should be skip.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] pwm: add spear pwm driver support

2012-10-18 Thread Viresh Kumar
On 19 October 2012 11:29, Shiraz Hashim  wrote:
>> > +   clk_disable_unprepare(pc->clk);
>>
>> call only disable from here. Leave it prepared for ever.
>>
>
> and unprepare only in _remove. Okay.

yes.

> I need to shut down all active pwms, how else would you suggest that ?

I misread the code. Leave this comment.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] pwm: add spear pwm driver support

2012-10-18 Thread Shiraz Hashim
Hi Viresh,

On Thu, Oct 18, 2012 at 11:11:06PM +0530, viresh kumar wrote:
> On Thu, Oct 18, 2012 at 4:58 PM, Shiraz Hashim  wrote:
> > diff --git a/Documentation/devicetree/bindings/pwm/st-spear-pwm.txt 
> > b/Documentation/devicetree/bindings/pwm/st-spear-pwm.txt
> > +== ST SPEAr SoC PWM controller ==
> > +
> > +Required properties:
> > +- compatible: should be one of:
> > +  - "st,spear-pwm"
> > +  - "st,spear13xx-pwm"
> 
> This has be matching with an version of the IP, as discussed earlier for many
> driver.
> 
> Because ST hasn't released any specific version numbers, you must mention
> name of the SoC where the IP first appeared. That will mark its version. So,
> in short don't use generic names like spear or spear13xx :)
> 

Okay. So I would rename compatible fields and accordingly as suggested
by Thierry, I would choose doc file name as 'spear-pwm.txt'.

> > +- reg: physical base address and length of the controller's registers
> > +- #pwm-cells: number of cells used to specify PWM which is fixed to 2 on 
> > SPEAr. The
> > +  first cell specifies the per-chip index of the PWM to use and the second
> > +  cell is the duty cycle in nanoseconds.
> > +
> > +Example:
> > +
> > +pwm: pwm@a800 {
> > +compatible ="st,spear-pwm";
> > +reg = <0xa800 0x1000>;
> > +#pwm-cells = <2>;
> > +status = "disabled";
> > +};
> 
> An example on how other nodes will link to it by passing id and duty cycle
> would be better.
> 

I don't think it is required here, it is already covered in pwm.txt.

> > diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
> > index ed81720..3ff3e6f 100644
> > --- a/drivers/pwm/Kconfig
> > +++ b/drivers/pwm/Kconfig
> > @@ -112,6 +112,16 @@ config PWM_SAMSUNG
> >   To compile this driver as a module, choose M here: the module
> >   will be called pwm-samsung.
> >
> > +config PWM_SPEAR
> > +   tristate "STMicroelectronics SPEAR PWM support"
> 
> SPEAr
> 

Yes, already pointed by Thierry.

> > +   depends on PLAT_SPEAR
> > +   help
> > + Generic PWM framework driver for the PWM controller on ST
> > + SPEAr SoCs.
> > +
> > + To compile this driver as a module, choose M here: the module
> > + will be called pwm-spear.
> > +
> >  config PWM_TEGRA
> > tristate "NVIDIA Tegra PWM support"
> > depends on ARCH_TEGRA
> > diff --git a/drivers/pwm/Makefile b/drivers/pwm/Makefile
> > index acfe482..6512786 100644
> > --- a/drivers/pwm/Makefile
> > +++ b/drivers/pwm/Makefile
> > @@ -9,6 +9,7 @@ obj-$(CONFIG_PWM_PUV3)  += pwm-puv3.o
> >  obj-$(CONFIG_PWM_PXA)  += pwm-pxa.o
> >  obj-$(CONFIG_PWM_SAMSUNG)  += pwm-samsung.o
> >  obj-$(CONFIG_PWM_TEGRA)+= pwm-tegra.o
> > +obj-$(CONFIG_PWM_SPEAR)+= pwm-spear.o
> >  obj-$(CONFIG_PWM_TIECAP)   += pwm-tiecap.o
> >  obj-$(CONFIG_PWM_TIEHRPWM) += pwm-tiehrpwm.o
> >  obj-$(CONFIG_PWM_TWL6030)  += pwm-twl6030.o
> > diff --git a/drivers/pwm/pwm-spear.c b/drivers/pwm/pwm-spear.c
> > new file mode 100644
> > index 000..814395b
> > --- /dev/null
> > +++ b/drivers/pwm/pwm-spear.c
> > @@ -0,0 +1,287 @@
> > +/*
> > + * ST Microelectronics SPEAr Pulse Width Modulator driver
> > + *
> > + * Copyright (C) 2012 ST Microelectronics
> > + * Shiraz Hashim 
> > + *
> > + * This file is licensed under the terms of the GNU General Public
> > + * License version 2. This program is licensed "as is" without any
> > + * warranty of any kind, whether express or implied.
> > + */
> > +
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +/* PWM registers and bits definitions */
> > +#define PWMCR  0x00/* Control Register */
> > +#define PWMDCR 0x04/* Duty Cycle Register */
> > +#define PWMPCR 0x08/* Period Register */
> > +/* Following only available on 13xx SoCs */
> > +#define PWMMCR 0x3C/* Master Control Register */
> > +
> > +#define PWM_ENABLE 0x1
> > +
> > +#define MIN_PRESCALE   0x00
> > +#define MAX_PRESCALE   0x3FFF
> > +#define PRESCALE_SHIFT 2
> > +
> > +#define MIN_DUTY   0x0001
> > +#define MAX_DUTY   0x
> > +
> > +#define MIN_PERIOD 0x0001
> > +#define MAX_PERIOD 0x
> > +
> > +#define NUM_PWM4
> > +
> > +/**
> > + * struct pwm: struct representing pwm ip
> 
> spear_pwm_chip: struct representing pwm chip
> 

The whole kernel doc requires a fix, would do that.

> > + * mmio_base: base address of pwm
> 
> base would be enough.
> 

mmio_base isn't too bad.

> > + * clk: pointer to clk structure of pwm ip
> > + * chip: linux pwm chip representation
> > + * dev: pointer to device structure of pwm
> > + */
> > +struct spear_pwm_chip {
> > +   void __iome

[PATCH] ARM: dt: tegra: ventana: define pinmux for ddc

2012-10-18 Thread Mark Zhang
Define pinmux for DDC. The DDC pinmux in Ventana is 2 pins in I2C2.

Signed-off-by: Mark Zhang 
---
 arch/arm/boot/dts/tegra20-ventana.dts |   70 ++---
 1 file changed, 65 insertions(+), 5 deletions(-)

diff --git a/arch/arm/boot/dts/tegra20-ventana.dts 
b/arch/arm/boot/dts/tegra20-ventana.dts
index bec8bb2..b6b3af4 100644
--- a/arch/arm/boot/dts/tegra20-ventana.dts
+++ b/arch/arm/boot/dts/tegra20-ventana.dts
@@ -64,11 +64,6 @@
nvidia,pins = "dap4";
nvidia,function = "dap4";
};
-   ddc {
-   nvidia,pins = "ddc", "owc", "spdi", "spdo",
-   "uac";
-   nvidia,function = "rsvd2";
-   };
dta {
nvidia,pins = "dta", "dtb", "dtc", "dtd", "dte";
nvidia,function = "vi";
@@ -248,6 +243,39 @@
nvidia,slew-rate-falling = <3>;
};
};
+
+   state_i2cmux_ddc: pinmux_i2cmux_ddc {
+   ddc {
+   nvidia,pins = "ddc";
+   nvidia,function = "i2c2";
+   };
+   pta {
+   nvidia,pins = "pta";
+   nvidia,function = "rsvd4";
+   };
+   };
+
+   state_i2cmux_pta: pinmux_i2cmux_pta {
+   ddc {
+   nvidia,pins = "ddc";
+   nvidia,function = "rsvd4";
+   };
+   pta {
+   nvidia,pins = "pta";
+   nvidia,function = "i2c2";
+   };
+   };
+
+   state_i2cmux_idle: pinmux_i2cmux_idle {
+   ddc {
+   nvidia,pins = "ddc";
+   nvidia,function = "rsvd4";
+   };
+   pta {
+   nvidia,pins = "pta";
+   nvidia,function = "rsvd4";
+   };
+   };
};
 
i2s@70002800 {
@@ -291,6 +319,38 @@
clock-frequency = <40>;
};
 
+   i2cmux {
+   compatible = "i2c-mux-pinctrl";
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   i2c-parent = <&{/i2c@7000c400}>;
+
+   pinctrl-names = "ddc", "pta", "idle";
+   pinctrl-0 = <&state_i2cmux_ddc>;
+   pinctrl-1 = <&state_i2cmux_pta>;
+   pinctrl-2 = <&state_i2cmux_idle>;
+
+   i2c@0 {
+   reg = <0>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+   };
+
+   i2c@1 {
+   reg = <1>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   smart-battery@b {
+   compatible = "ti,bq24617", "smart-battery-1.1";
+   reg = <0xb>;
+   ti,i2c-retry-count = <2>;
+   ti,poll-retry-count = <10>;
+   };
+   };
+   };
+
i2c@7000c500 {
status = "okay";
clock-frequency = <40>;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] KVM: make crash_clear_loaded_vmcss valid when loading kvm_intel module

2012-10-18 Thread Zhang Yanfei
Signed-off-by: zhangyanfei 
---
 arch/x86/kvm/vmx.c |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 4ff0ab9..f6a16b2 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -41,6 +41,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "trace.h"
 
@@ -7230,6 +7231,10 @@ static int __init vmx_init(void)
if (r)
goto out3;
 
+#ifdef CONFIG_KEXEC
+   crash_clear_loaded_vmcss = vmclear_local_loaded_vmcss;
+#endif
+
vmx_disable_intercept_for_msr(MSR_FS_BASE, false);
vmx_disable_intercept_for_msr(MSR_GS_BASE, false);
vmx_disable_intercept_for_msr(MSR_KERNEL_GS_BASE, true);
@@ -7265,6 +7270,10 @@ static void __exit vmx_exit(void)
free_page((unsigned long)vmx_io_bitmap_b);
free_page((unsigned long)vmx_io_bitmap_a);
 
+#ifdef CONFIG_KEXEC
+   crash_clear_loaded_vmcss = NULL;
+#endif
+
kvm_exit();
 }
 
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 1/2] Replace if statement with WARN_ON_ONCE() in cmci_rediscover().

2012-10-18 Thread Tang Chen
cmci_rediscover() is only called by the CPU_POST_DEAD event handler,
which means the corresponding cpu has already dead. As a result, it
won't be accessed in the for_each_online_cpu loop.
So, we could change the if(cpu == dying) statement into a WARN_ON_ONCE().

Signed-off-by: Tang Chen 
---
 arch/x86/kernel/cpu/mcheck/mce_intel.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/mcheck/mce_intel.c 
b/arch/x86/kernel/cpu/mcheck/mce_intel.c
index 38e49bc..481d152 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_intel.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_intel.c
@@ -180,8 +180,8 @@ void cmci_rediscover(int dying)
cpumask_copy(old, ¤t->cpus_allowed);
 
for_each_online_cpu(cpu) {
-   if (cpu == dying)
-   continue;
+   WARN_ON_ONCE(cpu == dying);
+
if (set_cpus_allowed_ptr(current, cpumask_of(cpu)))
continue;
/* Recheck banks in case CPUs don't all have the same */
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 0/2] Do not change worker's running cpu in cmci_rediscover().

2012-10-18 Thread Tang Chen
1. cmci_rediscover() is only called by the CPU_POST_DEAD event handler, which
means the corresponding cpu has already dead. As a result, it won't be accessed
in the for_each_online_cpu loop.
So, we could change the if(cpu == dying) statement into a WARN_ON_ONCE().

2. cmci_rediscover() used set_cpus_allowed_ptr() to change the current process's
running cpu, and migrate itself to the dest cpu. But worker processes are not
allowed to be migrated. If current is a worker, the worker will be migrated to
another cpu, but the corresponding  worker_pool is still on the original cpu.

In this case, the following BUG_ON in try_to_wake_up_local() will be triggered:
BUG_ON(rq != this_rq());

This will cause the kernel panic.

This patch removes the set_cpus_allowed_ptr() call, and put the cmci rediscover
jobs onto all the other cpus using system_wq. This could bring some delay for
the jobs.

The following is call trace.

[ 6155.451107] [ cut here ]
[ 6155.452019] kernel BUG at kernel/sched/core.c:1654!
..
[ 6155.452019] RIP: 0010:[]  [] 
try_to_wake_up_local+0x115/0x130
..
[ 6155.452019] Call Trace:
[ 6155.452019]  [] __schedule+0x764/0x880
[ 6155.452019]  [] schedule+0x29/0x70
[ 6155.452019]  [] schedule_timeout+0x235/0x2d0
[ 6155.452019]  [] ? mark_held_locks+0x8d/0x140
[ 6155.452019]  [] ? __lock_release+0x133/0x1a0
[ 6155.452019]  [] ? _raw_spin_unlock_irq+0x30/0x50
[ 6155.452019]  [] ? trace_hardirqs_on_caller+0x105/0x190
[ 6155.452019]  [] wait_for_common+0x12b/0x180
[ 6155.452019]  [] ? try_to_wake_up+0x2f0/0x2f0
[ 6155.452019]  [] wait_for_completion+0x1d/0x20
[ 6155.452019]  [] stop_one_cpu+0x8a/0xc0
[ 6155.452019]  [] ? __migrate_task+0x1a0/0x1a0
[ 6155.452019]  [] ? complete+0x28/0x60
[ 6155.452019]  [] set_cpus_allowed_ptr+0x128/0x130
[ 6155.452019]  [] cmci_rediscover+0xf5/0x140
[ 6155.452019]  [] mce_cpu_callback+0x18d/0x19d
[ 6155.452019]  [] notifier_call_chain+0x67/0x150
[ 6155.452019]  [] __raw_notifier_call_chain+0xe/0x10
[ 6155.452019]  [] __cpu_notify+0x20/0x40
[ 6155.452019]  [] cpu_notify_nofail+0x15/0x30
[ 6155.452019]  [] _cpu_down+0x262/0x2e0
[ 6155.452019]  [] cpu_down+0x36/0x50
[ 6155.452019]  [] acpi_processor_remove+0x50/0x11e
[ 6155.452019]  [] acpi_device_remove+0x90/0xb2
[ 6155.452019]  [] __device_release_driver+0x7c/0xf0
[ 6155.452019]  [] device_release_driver+0x2f/0x50
[ 6155.452019]  [] acpi_bus_remove+0x32/0x6d
[ 6155.452019]  [] acpi_bus_trim+0x87/0xee
[ 6155.452019]  [] acpi_bus_hot_remove_device+0x88/0x16b
[ 6155.452019]  [] acpi_os_execute_deferred+0x27/0x34
[ 6155.452019]  [] process_one_work+0x219/0x680
[ 6155.452019]  [] ? process_one_work+0x1b8/0x680
[ 6155.452019]  [] ? acpi_os_wait_events_complete+0x23/0x23
[ 6155.452019]  [] worker_thread+0x12e/0x320
[ 6155.452019]  [] ? manage_workers+0x110/0x110
[ 6155.452019]  [] kthread+0xc6/0xd0
[ 6155.452019]  [] kernel_thread_helper+0x4/0x10
[ 6155.452019]  [] ? retint_restore_args+0x13/0x13
[ 6155.452019]  [] ? __init_kthread_worker+0x70/0x70
[ 6155.452019]  [] ? gs_change+0x13/0x13


Tang Chen (2):
  Replace if statement with WARN_ON_ONCE() in cmci_rediscover().
  Do not change worker's running cpu in cmci_rediscover().

 arch/x86/kernel/cpu/mcheck/mce_intel.c |   34 +--
 1 files changed, 19 insertions(+), 15 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 2/2] Do not change worker's running cpu in cmci_rediscover().

2012-10-18 Thread Tang Chen
cmci_rediscover() used set_cpus_allowed_ptr() to change the current process's
running cpu, and migrate itself to the dest cpu. But worker processes are not
allowed to be migrated. If current is a worker, the worker will be migrated to
another cpu, but the corresponding  worker_pool is still on the original cpu.

In this case, the following BUG_ON in try_to_wake_up_local() will be triggered:
BUG_ON(rq != this_rq());

This will cause the kernel panic.

This patch removes the set_cpus_allowed_ptr() call, and put the cmci rediscover
jobs onto all the other cpus using system_wq. This could bring some delay for
the jobs.

Signed-off-by: Tang Chen 
Signed-off-by: Miao Xie 
---
 arch/x86/kernel/cpu/mcheck/mce_intel.c |   30 +-
 1 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/arch/x86/kernel/cpu/mcheck/mce_intel.c 
b/arch/x86/kernel/cpu/mcheck/mce_intel.c
index 481d152..d8f0da6 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_intel.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_intel.c
@@ -163,34 +163,38 @@ void cmci_clear(void)
raw_spin_unlock_irqrestore(&cmci_discover_lock, flags);
 }
 
+static long cmci_rediscover_work_func(void *arg)
+{
+   int banks;
+
+   /* Recheck banks in case CPUs don't all have the same */
+   if (cmci_supported(&banks))
+   cmci_discover(banks, 0);
+
+   return 0;
+}
+
 /*
  * After a CPU went down cycle through all the others and rediscover
  * Must run in process context.
  */
 void cmci_rediscover(int dying)
 {
-   int banks;
-   int cpu;
-   cpumask_var_t old;
+   int cpu, banks;
 
if (!cmci_supported(&banks))
return;
-   if (!alloc_cpumask_var(&old, GFP_KERNEL))
-   return;
-   cpumask_copy(old, ¤t->cpus_allowed);
 
for_each_online_cpu(cpu) {
WARN_ON_ONCE(cpu == dying);
 
-   if (set_cpus_allowed_ptr(current, cpumask_of(cpu)))
+   if (cpu == smp_processor_id()) {
+   cmci_rediscover_work_func(NULL);
continue;
-   /* Recheck banks in case CPUs don't all have the same */
-   if (cmci_supported(&banks))
-   cmci_discover(banks, 0);
-   }
+   }
 
-   set_cpus_allowed_ptr(current, old);
-   free_cpumask_var(old);
+   work_on_cpu(cpu, cmci_rediscover_work_func, NULL);
+   }
 }
 
 /*
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] x86/kexec: VMCLEAR vmcss on all cpus if necessary

2012-10-18 Thread Zhang Yanfei
This patch provides a way to VMCLEAR vmcss related to guests
on all cpus before executing the VMXOFF when doing kdump. This
is used to ensure the VMCSs in the vmcore updated and
non-corrupted.

Signed-off-by: zhangyanfei 
---
 arch/x86/include/asm/kexec.h |2 ++
 arch/x86/kernel/crash.c  |   27 +++
 2 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/arch/x86/include/asm/kexec.h b/arch/x86/include/asm/kexec.h
index 317ff17..fc05440 100644
--- a/arch/x86/include/asm/kexec.h
+++ b/arch/x86/include/asm/kexec.h
@@ -163,6 +163,8 @@ struct kimage_arch {
 };
 #endif
 
+extern void (*crash_clear_loaded_vmcss)(void);
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* _ASM_X86_KEXEC_H */
diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c
index 13ad899..7289976 100644
--- a/arch/x86/kernel/crash.c
+++ b/arch/x86/kernel/crash.c
@@ -16,6 +16,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -30,6 +31,22 @@
 
 int in_crash_kexec;
 
+/*
+ * This is used to VMCLEAR vmcss loaded on all
+ * cpus. And when loading kvm_intel module, the
+ * function pointer will be made valid.
+ */
+void (*crash_clear_loaded_vmcss)(void) = NULL;
+EXPORT_SYMBOL_GPL(crash_clear_loaded_vmcss);
+
+static void cpu_emergency_clear_loaded_vmcss(void)
+{
+   if (crash_clear_loaded_vmcss &&
+   cpu_has_vmx() && cpu_vmx_enabled()) {
+   crash_clear_loaded_vmcss();
+   }
+}
+
 #if defined(CONFIG_SMP) && defined(CONFIG_X86_LOCAL_APIC)
 
 static void kdump_nmi_callback(int cpu, struct pt_regs *regs)
@@ -46,6 +63,11 @@ static void kdump_nmi_callback(int cpu, struct pt_regs *regs)
 #endif
crash_save_cpu(regs, cpu);
 
+   /*
+* VMCLEAR vmcss loaded on all cpus if needed.
+*/
+   cpu_emergency_clear_loaded_vmcss();
+
/* Disable VMX or SVM if needed.
 *
 * We need to disable virtualization on all CPUs.
@@ -88,6 +110,11 @@ void native_machine_crash_shutdown(struct pt_regs *regs)
 
kdump_nmi_shootdown_cpus();
 
+   /*
+* VMCLEAR vmcss loaded on this cpu if needed.
+*/
+   cpu_emergency_clear_loaded_vmcss();
+
/* Booting kdump kernel with VMX or SVM enabled won't work,
 * because (among other limitations) we can't disable paging
 * with the virt flags.
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 0/2] x86: clear vmcss on all cpus when doing kdump if necessary

2012-10-18 Thread Zhang Yanfei
Currently, kdump just makes all the logical processors leave VMX operation by
executing VMXOFF instruction, so any VMCSs active on the logical processors may
be corrupted. But, sometimes, we need the VMCSs to debug guest images contained
in the host vmcore. To prevent the corruption, we should VMCLEAR the VMCSs 
before
executing the VMXOFF instruction.

The patch set provides a way to VMCLEAR vmcss related to guests on all cpus 
before
executing the VMXOFF when doing kdump. This is used to ensure the VMCSs in the
vmcore updated and non-corrupted.

Changelog from v1 to v2:
1. remove the sysctl and clear VMCSs unconditionally.

zhangyanfei (2):
  x86/kexec: VMCLEAR vmcss on all cpus if necessary
  KVM: make crash_clear_loaded_vmcss valid when loading kvm_intel
module

 arch/x86/include/asm/kexec.h |2 ++
 arch/x86/kernel/crash.c  |   27 +++
 arch/x86/kvm/vmx.c   |9 +
 3 files changed, 38 insertions(+), 0 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH RFC] [x86] Optimize small size memcpy by avoding long latency from decode stage

2012-10-18 Thread ling . ma . program
From: Ma Ling 

CISC code has higher instruction density, saving memory and
improving i-cache hit rate. However decode become challenge,
only one mulitple-uops(2~3)instruction could be decoded in one cycle,
and instructions containing more 4 uops(rep movsq/b) have to be handled by 
MS-ROM,
the process take long time and eat up the advantage from it for small size. 

In order to avoid this disavantage, we take use of general instruction code
for small size copy. The result shows it can get 1~2x improvement
on Core2, Nehalem, Sandy Bridge, Ivy Bridge, Atom, and Bulldozer as well.

Signed-off-by: Ma Ling 
---
 arch/x86/lib/memcpy_64.S |   14 +-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/arch/x86/lib/memcpy_64.S b/arch/x86/lib/memcpy_64.S
index 1c273be..6a24c8c 100644
--- a/arch/x86/lib/memcpy_64.S
+++ b/arch/x86/lib/memcpy_64.S
@@ -5,7 +5,6 @@
 #include 
 #include 
 #include 
-
 /*
  * memcpy - Copy a memory block.
  *
@@ -19,6 +18,15 @@
  */
 
 /*
+ * memcpy_c() and memcpy_c_e() use rep movsq/movsb respectively,
+ * the instruction have to get micro ops from Microcode Sequencser Rom.
+ * And the decode  process take long latency, in order to avoid it, 
+ * we choose loop unrolling routine for small size.
+ * Could vary the warm up  distance.
+ */
+
+
+/*
  * memcpy_c() - fast string ops (REP MOVSQ) based variant.
  *
  * This gets patched over the unrolled variant (below) via the
@@ -26,6 +34,8 @@
  */
.section .altinstr_replacement, "ax", @progbits
 .Lmemcpy_c:
+   cmpq $512, %rdx
+   jbe  memcpy 
movq %rdi, %rax
movq %rdx, %rcx
shrq $3, %rcx
@@ -46,6 +56,8 @@
  */
.section .altinstr_replacement, "ax", @progbits
 .Lmemcpy_c_e:
+   cmpq $512, %rdx
+   jbe  memcpy
movq %rdi, %rax
movq %rdx, %rcx
rep movsb
-- 
1.6.5.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2]suppress "Device nodeX does not have a release() function" warning

2012-10-18 Thread Wen Congyang
At 10/17/2012 04:50 PM, KOSAKI Motohiro Wrote:
> On Wed, Oct 17, 2012 at 2:24 AM, Wen Congyang  wrote:
>> At 10/12/2012 06:33 AM, KOSAKI Motohiro Wrote:
>>> On Thu, Oct 11, 2012 at 1:26 AM, Yasuaki Ishimatsu
>>>  wrote:
 When calling unregister_node(), the function shows following message at
 device_release().

 "Device 'node2' does not have a release() function, it is broken and must
 be fixed."

 The reason is node's device struct does not have a release() function.

 So the patch registers node_device_release() to the device's release()
 function for suppressing the warning message. Additionally, the patch adds
 memset() to initialize a node struct into register_node(). Because the node
 struct is part of node_devices[] array and it cannot be freed by
 node_device_release(). So if system reuses the node struct, it has a 
 garbage.

 CC: David Rientjes 
 CC: Jiang Liu 
 Cc: Minchan Kim 
 CC: Andrew Morton 
 CC: KOSAKI Motohiro 
 Signed-off-by: Yasuaki Ishimatsu 
 Signed-off-by: Wen Congyang 
 ---
  drivers/base/node.c |   11 +++
  1 file changed, 11 insertions(+)

 Index: linux-3.6/drivers/base/node.c
 ===
 --- linux-3.6.orig/drivers/base/node.c  2012-10-11 10:04:02.149758748 +0900
 +++ linux-3.6/drivers/base/node.c   2012-10-11 10:20:34.111806931 +0900
 @@ -252,6 +252,14 @@ static inline void hugetlb_register_node
  static inline void hugetlb_unregister_node(struct node *node) {}
  #endif

 +static void node_device_release(struct device *dev)
 +{
 +#if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HUGETLBFS)
 +   struct node *node_dev = to_node(dev);
 +
 +   flush_work(&node_dev->node_work);
 +#endif
 +}
>>>
>>> The patch description don't explain why this flush_work() is needed.
>>
>> If the node is onlined after it is offlined, we will clear the memory,
>> so we should flush_work() before node_dev is set to 0.
> 
> So then, it is irrelevant from warning supressness. You should make an
> another patch.
> 

OK, I will update it soon.

Thanks
Wen Congyang

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] remove untouched code in kfifo_in

2012-10-18 Thread Stefani Seibold

Am Freitag, den 19.10.2012, 00:37 +0200 schrieb richard -rw- weinberger:
> On Thu, Oct 18, 2012 at 3:59 PM, Wei Yang  wrote:
> > In kfifo_in marco, one piece of code is arounded by if(0). This code in
> > introduced by Stefani Seibold  to suppress a compiler
> > warning. This warning is not there with the upgrade of gcc version.
> >
> > This patch just remove this code.
> 
> Are you sure?
> This code fragment looks like a compiler bomb to detect type mismatch to me...
> 

Yes, you are great! That was the reason why i made this peace of code.
So don't remove it!

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: MAX_LOCKDEP_ENTRIES too low (called from ioc_release_fn)

2012-10-18 Thread Dave Jones
On Thu, Oct 18, 2012 at 07:53:08AM +0200, Jens Axboe wrote:
 > On 2012-10-18 03:53, Dave Jones wrote:
 > > Triggered while fuzz testing..
 > > 
 > > 
 > > BUG: MAX_LOCKDEP_ENTRIES too low!
 > > turning off the locking correctness validator.
 > > Pid: 22788, comm: kworker/2:1 Not tainted 3.7.0-rc1+ #34
 > > Call Trace:
 > >  [] add_lock_to_list.isra.29.constprop.45+0xdd/0xf0
 > >  [] __lock_acquire+0x1121/0x1ba0
 > >  [] lock_acquire+0xa2/0x220
 > >  [] ? free_one_page+0x32/0x450
 > >  [] ? sub_preempt_count+0x79/0xd0
 > >  [] _raw_spin_lock+0x40/0x80
 > >  [] ? free_one_page+0x32/0x450
 > >  [] free_one_page+0x32/0x450
 > >  [] ? __free_pages_ok.part.58+0x51/0x110
 > >  [] __free_pages_ok.part.58+0xac/0x110
 > >  [] __free_pages+0x73/0x90
 > >  [] __free_slab+0xd3/0x1b0
 > >  [] discard_slab+0x39/0x50
 > >  [] __slab_free+0x378/0x3a3
 > >  [] ? ioc_release_fn+0x99/0xe0
 > >  [] ? ioc_release_fn+0x99/0xe0
 > >  [] kmem_cache_free+0x2f2/0x320
 > >  [] ? sub_preempt_count+0x79/0xd0
 > >  [] ioc_release_fn+0x99/0xe0
 > >  [] process_one_work+0x207/0x780
 > >  [] ? process_one_work+0x197/0x780
 > >  [] ? get_io_context+0x20/0x20
 > >  [] worker_thread+0x15e/0x440
 > >  [] ? rescuer_thread+0x240/0x240
 > >  [] kthread+0xed/0x100
 > >  [] ? put_lock_stats.isra.25+0xe/0x40
 > >  [] ? kthread_create_on_node+0x160/0x160
 > >  [] ret_from_fork+0x7c/0xb0
 > >  [] ? kthread_create_on_node+0x160/0x160
 > 
 > Not sure why you are CC'ing a call site, rather than the maintainers of
 > the code. Just looks like lockdep is using too small a static value.
 > Though it is pretty darn large...

You're right, it's a huge chunk of memory.
It looks like I can trigger this from multiple callsites..
Another different trace below.

Not sure why this suddenly got a lot worse in 3.7

Peter, Ingo ?

Dave

BUG: MAX_LOCKDEP_ENTRIES too low!
turning off the locking correctness validator.
Pid: 22350, comm: trinity-child0 Not tainted 3.7.0-rc1+ #36
Call Trace:
 [] add_lock_to_list.isra.29.constprop.45+0xdd/0xf0
 [] __lock_acquire+0x1121/0x1ba0
 [] ? local_clock+0x89/0xa0
 [] ? __swap_duplicate+0xb5/0x190
 [] ? trace_hardirqs_off_caller+0x28/0xd0
 [] lock_acquire+0xa2/0x220
 [] ? __add_to_swap_cache+0x6d/0x180
 [] ? _raw_spin_lock_irq+0x29/0x90
 [] _raw_spin_lock_irq+0x56/0x90
 [] ? __add_to_swap_cache+0x6d/0x180
 [] __add_to_swap_cache+0x6d/0x180
 [] read_swap_cache_async+0xb5/0x220
 [] swapin_readahead+0x9e/0xf0
 [] handle_pte_fault+0x6d6/0xae0
 [] ? sub_preempt_count+0x79/0xd0
 [] ? delay_tsc+0xae/0x120
 [] ? __const_udelay+0x28/0x30
 [] handle_mm_fault+0x289/0x350
 [] __do_page_fault+0x18e/0x530
 [] ? local_clock+0x89/0xa0
 [] ? __slab_free+0x32e/0x3a3
 [] ? rcu_user_exit+0xc9/0xf0
 [] ? 0xa01f
 [] ? 0xa01f
 [] do_page_fault+0x2b/0x50
 [] page_fault+0x28/0x30
 [] ? 0xa01f
 [] ? strncpy_from_user+0x6c/0x120
 [] ? 0xa01f
 [] setxattr+0x6f/0x1d0
 [] ? sub_preempt_count+0x79/0xd0
 [] ? __percpu_counter_add+0x75/0xc0
 [] ? __sb_start_write+0x101/0x1d0
 [] ? mnt_want_write+0x24/0x50
 [] ? mnt_want_write+0x24/0x50
 [] ? get_parent_ip+0x11/0x50
 [] ? sub_preempt_count+0x79/0xd0
 [] ? __mnt_want_write+0x60/0xa0
 [] ? 0xa01f
 [] sys_setxattr+0x95/0xb0
 [] tracesys+0xe1/0xe6
 [] ? 0xa01f

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


MDaemon Notification -- Attachment Removed

2012-10-18 Thread Postmaster
The following message contained restricted attachment(s) which have been 
removed:

>From  : linux-kernel@vger.kernel.org
To: charter...@jnab.se
Subject   : vsz zkaioojcrfuqg
Message-ID: 

Attachment(s) removed:
-
document.zip (document.scr)


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


MAINTAINERS: Add Rafael's address to ACPI maintainers

2012-10-18 Thread Rafael J. Wysocki
From: Rafael J. Wysocki 

Since I will be maintaining ACPI together with Len from now on, add my
address to the ACPI maintainers list in the MAINTAINERS file (this is
the address to send patches to).

Signed-off-by: Rafael J. Wysocki 
---
 MAINTAINERS |1 +
 1 file changed, 1 insertion(+)

Index: linux-pm/MAINTAINERS
===
--- linux-pm.orig/MAINTAINERS
+++ linux-pm/MAINTAINERS
@@ -235,6 +235,7 @@ F:  drivers/platform/x86/acer-wmi.c
 
 ACPI
 M: Len Brown 
+M: Rafael J. Wysocki 
 L: linux-a...@vger.kernel.org
 W: http://www.lesswatts.org/projects/acpi/
 Q: http://patchwork.kernel.org/project/linux-acpi/list/

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC PATCH 0/2] sched: Load Balancing using Per-entity-Load-tracking

2012-10-18 Thread preeti
Sorry guys this mail had problems getting sent.hence the repost.

Hi Morten,
Thank you very much for your review.

>> 1.Consider a scenario,where there are two 10% tasks running on a cpu.The
>>   present code will consider the load on this queue to be 2048,while
>>   using PJT's metric the load is calculated to be <1000,rarely exceeding this
>>   limit.Although the tasks are not contributing much to the cpu load,they are
>>   decided to be moved by the scheduler.
>
> I guess that you assume, for now, that all tasks have default (nice 0)
> priority? Both the old load and the PJT metric (tracked load) depends on
> priority.

Thats right.I have assumed default priority of the tasks.
>>
>>   But one could argue that 'not moving one of these tasks could throttle
>>   them.If there was an idle cpu,perhaps we could have moved them'.While the
>>   power save mode would have been fine with not moving the task,the
>>   performance mode would prefer not to throttle the tasks.We could strive
>>   to strike a balance by making this decision tunable with certain 
>> parameters.
>>   This patchset includes such tunables.This issue is addressed in Patch[1/2].
>>
>
> One could also argue that long as there are spare cpu cycles in each
> schedule period then all tasks have received the cpu time they needed.
> So from that point of view performance isn't affected by not balancing
> the tasks as long as the cpu is not fully utilized. If we look at the
> problem from a latency point of view then packing tasks on a single cpu
> will increase latency but the increase will be bounded by the schedule
> period.
>
Assume that at the end of one scheduling period,there are a few spare
cycles on the cpu.this is fine from both the performance and latency
point of view at *this* point.nobody is waiting for the cpu.

The issue arises if it is detected that these spare cycles are due to
*sleeping tasks* and not due to no tasks.

At this point a decision needs to be made as to: if a scenario arises
where all these tasks wake up at the same time in the future,and wait on
the cpu,then are we ok with them waiting.Both performance and latency
views could be against this,as this also means less throughput.But
performance view could go slightly easy on this to argue,that its ok if
2-3 tasks wait,if more,then there is a need to move them.

>>   This patchset therefore has two primary aims.
>>  Patch[1/2]: This patch aims at detecting short running tasks and
>>   prevent their movement.In update_sg_lb_stats,dismiss a sched group
>>   as a candidate for load balancing,if load calculated by PJT's metric
>>   says that the average load on the sched_group <= 1024+(.15*1024).
>>   This is a tunable,which can be varied after sufficient experiments.
>
> Your current threshold implies that there must be at least two (nice 0)
> tasks running breach the threshold and they need to be quite busy. This
> makes sense to me. When you have more tasks they are more likely to be
> waiting on the runqueue even if it is only 10% tasks. Let's say you have
> five 10% tasks and they all become runnable at the same instant. In that
> case some of the tasks would have a tracked load which is much higher
> than if we only had two 10% tasks running. So if I'm not mistaken, it
> would be possible to breach the threshold even though the overall cpu
> utilization is only 50% and it would have been safe not to load-balance
> that cpu.
>
> Do you think it would make sense to let the threshold depend on the
> number of task on the cpu somehow? 
> 
You are right,Morten.In fact I have included this viewpoint in both my
first and second patch enclosed by this. So lets take up the above
scenario.if there are 5 10% tasks running,they will surely cross the
threshold,but the cpu might have spare cycles at the end of a scheduling
period.Now that is your concern.

Again we have two different viewpoints.This threshold is like a tuning
knob.we could increase it if we feel that this threshold gets reached
very quickly with as few tasks as 5, although the cpu utilization is
poor.we prefer not to wake up another cpu unless the present cpu is
aptly loaded.we could call this the power saving view.

Else we could say that,we are not intending to affect the throughput of
tasks,so we prefer the knob be at this value,so that we qualify such a
load as a candidate for load balancing.we could call this the
performance view.

> Alternative, the decision could be based on the cpu idle time over the
> last schedule period. A cpu with no or very few spare cycles in the last
> schedule period would be a good candidate for load-balancing. Latency
> would be affected as mentioned earlier.
>
Exactly.idle_time == spare_cpu_cycles == less cpu_utilization.I hope i
am not wrong in drawing this equivalence.if thats the case then the same
explanation as above holds good here too.

> Morten

Thank you

Regards
Preeti


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" i

Re: [PATCH 0/3] x86: clear vmcss on all cpus when doing kdump if necessary

2012-10-18 Thread Zhang Yanfei
于 2012年10月18日 18:55, Avi Kivity 写道:
> On 10/18/2012 03:12 AM, Zhang Yanfei wrote:
>> 于 2012年10月17日 18:16, Avi Kivity 写道:
>>> On 10/17/2012 04:28 AM, Zhang Yanfei wrote:
 于 2012年10月15日 23:43, Avi Kivity 写道:
> On 10/12/2012 08:40 AM, Zhang Yanfei wrote:
>> Currently, kdump just makes all the logical processors leave VMX 
>> operation by
>> executing VMXOFF instruction, so any VMCSs active on the logical 
>> processors may
>> be corrupted. But, sometimes, we need the VMCSs to debug guest images 
>> contained
>> in the host vmcore. To prevent the corruption, we should VMCLEAR the 
>> VMCSs before
>> executing the VMXOFF instruction.
>
> How have you verified that VMXOFF doesn't flush cached VMCSs already?
>

 I tried some tests, for example, I made copies for every vmcs, and in the 
 kdump
 path, I backed up all the loaded vmcs into the copies before vmxoff.
 After generating the vmcore, I retrieve the vmcss and their copies, and 
 compare them,
 no differences.

 Another test is using VMCLEAR to clear all the loaded vmcs before VMXOFF,
 and compare the vmcss and their copies, there are indeed differences 
 between the
 vmcs and its copy.

 I know the tests may be not so convincing, for example, I used memcpy to 
 back up
 the vmcss and it is an ordinary memory operation. But to ensure the 
 non-corruption
 of the vmcss in the vmcore, I think we should VMCLEAR the vmcss before 
 VMXOFF just
 as the Intel spec says.
>>>
>>> Sorry, I was unclear -- I was referring to the spec, I wasn't sure
>>> whether VMXOFF is defined to flush VMCSes or whether it just invalidates
>>> on-chip caches so that it won't flush them out in the future, corrupting
>>> memory.  We don't want to depend on actual behaviour as it may change
>>> with future version.
>>>
>>> Copying some Intel folk, maybe they can clarify it.
>>>
>>
>> Yes, the Intel spec says "may be" about the VMCS-corruption thing. From
>> chapter 24.10.1 in Intel® 64 and IA-32 Architectures Software Developer’s
>> Manual Volume 3C:System Programming Guide, Part 3, there is the description:
>>
>> "If a logical processor leaves VMX operation, any VMCSs active on that 
>> logical
>> processor may be corrupted (see below). To prevent such corruption of a VMCS 
>> that
>> may be used either after a return to VMX operation or on another logical 
>> processor,
>> software should VMCLEAR that VMCS before executing the VMXOFF instruction or
>> removing power from the processor (e.g., as part of a transition to the S3 
>> and S4
>> power states)."
>>
>> Our purpose is to make sure the VMCSs in the vmcore are updated and 
>> non-corrupted. So
>> according to the description above, no matter whether VMXOFF is defined to 
>> flush
>> VMCSs or whether it just invalidates on-chip caches, we'd better VMCLEAR the
>> VMCSs before executing the VMXOFF.
> 
> Ok, that's clear then.  So all we need is to remove the sysctl and clear
> VMCSs unconditionally.
> 

OK, I'll make the new patch and resend it again.

Thanks
Zhang Yanfei

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 5/6] udf: implement extent caching while reading-writing to a file

2012-10-18 Thread Namjae Jeon
2012/10/19, Jan Kara :
>   Hello,
>
> On Wed 10-10-12 00:10:01, Namjae Jeon wrote:
>> From: Namjae Jeon 
>>
>> This patch implements extent caching.
>> Instead of reading metadata everytime from file's starting position,
>> now we read from the cached extent.
>> This speeds up the transformation of file logical offsets to
>> corresponding on-disk blocks.
>   I have some mostly minor comments to the patch. But when reading the
> extent code it is just ugly and hard to follow. So I'm thinking how to
> improve that before making things even harder with the extent cache. So
> give me a few more days please.
Hi Jan.
Okay, I see. Thanks!
>
>   Honza
>
>>
>> Signed-off-by: Namjae Jeon 
>> Signed-off-by: Ashish Sangwan 
>> Signed-off-by: Bonggil Bak 
>> ---
>>  fs/udf/ialloc.c  |2 +
>>  fs/udf/inode.c   |  147
>> +-
>>  fs/udf/udf_i.h   |   17 +++
>>  fs/udf/udfdecl.h |   10 ++--
>>  4 files changed, 159 insertions(+), 17 deletions(-)
>>
>> diff --git a/fs/udf/ialloc.c b/fs/udf/ialloc.c
>> index 7e5aae4..7dd86a4a 100644
>> --- a/fs/udf/ialloc.c
>> +++ b/fs/udf/ialloc.c
>> @@ -117,6 +117,8 @@ struct inode *udf_new_inode(struct inode *dir, umode_t
>> mode, int *err)
>>  iinfo->i_lenAlloc = 0;
>>  iinfo->i_use = 0;
>>  iinfo->i_checkpoint = 1;
>> +memset(&iinfo->cached_extent, 0, sizeof(struct udf_ext_cache));
>> +mutex_init(&(iinfo->i_extent_cache_lock));
>>  if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_AD_IN_ICB))
>>  iinfo->i_alloc_type = ICBTAG_FLAG_AD_IN_ICB;
>>  else if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD))
>> diff --git a/fs/udf/inode.c b/fs/udf/inode.c
>> index 6fd9dc5..38aee74 100644
>> --- a/fs/udf/inode.c
>> +++ b/fs/udf/inode.c
>> @@ -90,6 +90,7 @@ void udf_evict_inode(struct inode *inode)
>>  }
>>  kfree(iinfo->i_ext.i_data);
>>  iinfo->i_ext.i_data = NULL;
>> +udf_clear_extent_cache(iinfo);
>>  if (want_delete) {
>>  udf_free_inode(inode);
>>  }
>> @@ -105,6 +106,7 @@ static void udf_write_failed(struct address_space
>> *mapping, loff_t to)
>>  truncate_pagecache(inode, to, isize);
>>  if (iinfo->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB) {
>>  down_write(&iinfo->i_data_sem);
>> +udf_clear_extent_cache(iinfo);
>>  udf_truncate_extents(inode);
>>  up_write(&iinfo->i_data_sem);
>>  }
>> @@ -588,27 +590,32 @@ static sector_t inode_getblk(struct inode *inode,
>> sector_t block,
>>   int *err, int *new)
>>  {
>>  struct kernel_long_ad laarr[EXTENT_MERGE_SIZE];
>> -struct extent_position prev_epos, cur_epos, next_epos;
>> -int count = 0, startnum = 0, endnum = 0;
>> +struct extent_position prev_epos, cur_epos, next_epos, cache_epos;
>> +int count = 0, startnum = 0, endnum = 0, epos_count;
>>  uint32_t elen = 0, tmpelen;
>>  struct kernel_lb_addr eloc, tmpeloc;
>>  int c = 1;
>>  loff_t lbcount = 0, b_off = 0;
>> +loff_t cur_ext_lbcount = 0, prev_ext_lbcount = 0;
>>  uint32_t newblocknum, newblock;
>>  sector_t offset = 0;
>>  int8_t etype;
>>  struct udf_inode_info *iinfo = UDF_I(inode);
>>  int goal = 0, pgoal = iinfo->i_location.logicalBlockNum;
>> -int lastblock = 0;
>> +int lastblock = 0, check_endnum = 0;
>>  bool isBeyondEOF;
>>
>>  *err = 0;
>>  *new = 0;
>> -prev_epos.offset = udf_file_entry_alloc_offset(inode);
>> -prev_epos.block = iinfo->i_location;
>> -prev_epos.bh = NULL;
>> -cur_epos = next_epos = prev_epos;
>>  b_off = (loff_t)block << inode->i_sb->s_blocksize_bits;
>> +if (!udf_read_extent_cache(inode, b_off, &lbcount, &prev_epos)) {
>> +prev_epos.offset = udf_file_entry_alloc_offset(inode);
>> +prev_epos.block = iinfo->i_location;
>> +prev_epos.bh = NULL;
>> +} else {
>> +cur_ext_lbcount = prev_ext_lbcount = lbcount;
>> +}
>> +cur_epos = next_epos = prev_epos;
>>
>>  /* find the extent which contains the block we are looking for.
>> alternate between laarr[0] and laarr[1] for locations of the
>> @@ -626,6 +633,8 @@ static sector_t inode_getblk(struct inode *inode,
>> sector_t block,
>>  }
>>
>>  lbcount += elen;
>> +prev_ext_lbcount = cur_ext_lbcount;
>> +cur_ext_lbcount += elen;
>>
>>  prev_epos.block = cur_epos.block;
>>  cur_epos.block = next_epos.block;
>> @@ -649,6 +658,9 @@ static sector_t inode_getblk(struct inode *inode,
>> sector_t block,
>>
>>  count++;
>>  } while (lbcount + elen <= b_off);
>> +memcpy(&cache_epos, &prev_epos, sizeof(struct extent_position));
>> +if (cache_epos.bh != NULL)
>> +get_bh(cache_epos.bh);
>>
>>  b_off -= lbcount;
>>  offset = b_

Re: [PATCH 1/2] acpi : cpu hot-remove returns error when cpu_down() fails

2012-10-18 Thread Yasuaki Ishimatsu

Hi Rafael,

2012/10/19 10:06, Rafael J. Wysocki wrote:

On Friday 28 of September 2012 19:36:02 Yasuaki Ishimatsu wrote:

Even if cpu_down() fails, acpi_processor_remove() continues to remove the cpu.
But in this case, it should return error number since some process may run on
the cpu. If the cpu has a running process and the cpu is turned the power off,
the system may not work well.

Reviewed-by: Srivatsa S. Bhat 
Reviewed-by: Toshi Kani 
Signed-off-by: Yasuaki Ishimatsu 

---
  drivers/acpi/processor_driver.c |   18 --
  1 file changed, 12 insertions(+), 6 deletions(-)

Index: linux-3.6-rc7/drivers/acpi/processor_driver.c
===
--- linux-3.6-rc7.orig/drivers/acpi/processor_driver.c  2012-09-24 
10:10:57.0 +0900
+++ linux-3.6-rc7/drivers/acpi/processor_driver.c   2012-09-28 
19:16:33.207858261 +0900
@@ -605,7 +605,7 @@ err_free_pr:
  static int acpi_processor_remove(struct acpi_device *device, int type)
  {
struct acpi_processor *pr = NULL;
-
+   int ret;

if (!device || !acpi_driver_data(device))
return -EINVAL;
@@ -616,8 +616,9 @@ static int acpi_processor_remove(struct
goto free;

if (type == ACPI_BUS_REMOVAL_EJECT) {
-   if (acpi_processor_handle_eject(pr))
-   return -EINVAL;
+   ret = acpi_processor_handle_eject(pr);
+   if (ret)
+   return ret;
}

acpi_processor_power_exit(pr, device);
@@ -848,12 +849,17 @@ static acpi_status acpi_processor_hotadd

  static int acpi_processor_handle_eject(struct acpi_processor *pr)
  {
-   if (cpu_online(pr->id))
-   cpu_down(pr->id);
+   int ret = 0;
+
+   if (cpu_online(pr->id)) {
+   ret = cpu_down(pr->id);


If you defined ret here ...


+   if (ret)
+   return ret;
+   }




arch_unregister_cpu(pr->id);
acpi_unmap_lsapic(pr->id);
-   return (0);
+   return ret;


... this line wouldn't need to be changed.


Thank you for your review.
O.K. I'll put the return code back.

Thanks,
Yasuaki Ishimatsu




  }
  #else
  static acpi_status acpi_processor_hotadd_init(struct acpi_processor *pr)


Thanks,
Rafael





--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2] acpi : acpi_bus_trim() stops removing devices when failing to remove the device

2012-10-18 Thread Rafael J. Wysocki
On Thursday 11 of October 2012 19:12:28 Yasuaki Ishimatsu wrote:
> acpi_bus_trim() stops removing devices, when acpi_bus_remove() return error
> number. But acpi_bus_remove() cannot return error number correctly.
> acpi_bus_remove() only return -EINVAL, when dev argument is NULL. Thus even if
> device cannot be removed correctly, acpi_bus_trim() ignores and continues to
> remove devices. acpi_bus_hot_remove_device() uses acpi_bus_trim() for removing
> devices. Therefore acpi_bus_hot_remove_device() can send "_EJ0" to firmware,
> even if the device is running on the system. In this case, the system cannot
> work well.
> 
> Vasilis hit the bug at memory hotplug and reported it as follow:
> https://lkml.org/lkml/2012/9/26/318
> 
> So acpi_bus_trim() should check whether device was removed or not correctly.
> The patch adds error check into some functions to remove the device.
> 
> Applying the patch, acpi_bus_trim() stops removing devices when failing
> to remove the device. But I think there is no impact with the
> exceptionof CPU and Memory hotplug path. Because other device also fails
> but the fail is an irregular case like device is NULL.
> 
> v1->v2
> - add a rollback for reinstalling a notify handler.
> 
> Signed-off-by: Yasuaki Ishimatsu 

Greg, do you think there may be any problems with the changes in dd.c?

Rafael


> ---
>  drivers/acpi/scan.c|   21 ++---
>  drivers/base/dd.c  |   22 +-
>  include/linux/device.h |2 +-
>  3 files changed, 36 insertions(+), 9 deletions(-)
> 
> Index: linux-3.6/drivers/acpi/scan.c
> ===
> --- linux-3.6.orig/drivers/acpi/scan.c2012-10-11 18:31:40.189019503 
> +0900
> +++ linux-3.6/drivers/acpi/scan.c 2012-10-11 18:42:35.669041641 +0900
> @@ -445,18 +445,29 @@ static int acpi_device_remove(struct dev
>  {
>   struct acpi_device *acpi_dev = to_acpi_device(dev);
>   struct acpi_driver *acpi_drv = acpi_dev->driver;
> + int ret;
>  
>   if (acpi_drv) {
>   if (acpi_drv->ops.notify)
>   acpi_device_remove_notify_handler(acpi_dev);
> - if (acpi_drv->ops.remove)
> - acpi_drv->ops.remove(acpi_dev, acpi_dev->removal_type);
> + if (acpi_drv->ops.remove) {
> + ret = acpi_drv->ops.remove(acpi_dev,
> +acpi_dev->removal_type);
> + if (ret)
> + goto rollback;
> + }
>   }
>   acpi_dev->driver = NULL;
>   acpi_dev->driver_data = NULL;
>  
>   put_device(dev);
>   return 0;
> +
> +rollback:
> + if (acpi_drv->ops.notify)
> + acpi_device_install_notify_handler(acpi_dev);
> +
> + return ret;
>  }
>  
>  struct bus_type acpi_bus_type = {
> @@ -1226,11 +1237,15 @@ static int acpi_device_set_context(struc
>  
>  static int acpi_bus_remove(struct acpi_device *dev, int rmdevice)
>  {
> + int ret;
> +
>   if (!dev)
>   return -EINVAL;
>  
>   dev->removal_type = ACPI_BUS_REMOVAL_EJECT;
> - device_release_driver(&dev->dev);
> + ret = device_release_driver(&dev->dev);
> + if (ret)
> + return ret;
>  
>   if (!rmdevice)
>   return 0;
> Index: linux-3.6/drivers/base/dd.c
> ===
> --- linux-3.6.orig/drivers/base/dd.c  2012-10-11 18:31:40.191019505 +0900
> +++ linux-3.6/drivers/base/dd.c   2012-10-11 18:31:46.873020548 +0900
> @@ -475,9 +475,10 @@ EXPORT_SYMBOL_GPL(driver_attach);
>   * __device_release_driver() must be called with @dev lock held.
>   * When called for a USB interface, @dev->parent lock must be held as well.
>   */
> -static void __device_release_driver(struct device *dev)
> +static int __device_release_driver(struct device *dev)
>  {
>   struct device_driver *drv;
> + int ret = 0;
>  
>   drv = dev->driver;
>   if (drv) {
> @@ -493,9 +494,11 @@ static void __device_release_driver(stru
>   pm_runtime_put_sync(dev);
>  
>   if (dev->bus && dev->bus->remove)
> - dev->bus->remove(dev);
> + ret = dev->bus->remove(dev);
>   else if (drv->remove)
> - drv->remove(dev);
> + ret = drv->remove(dev);
> + if (ret)
> + goto rollback;
>   devres_release_all(dev);
>   dev->driver = NULL;
>   dev_set_drvdata(dev, NULL);
> @@ -506,6 +509,12 @@ static void __device_release_driver(stru
>dev);
>  
>   }
> +
> + return ret;
> +
> +rollback:
> + driver_sysfs_add(dev);
> + return ret;
>  }
>  
>  /**
> @@ -515,16 +524,19 @@ static void __device_release_driver(stru
>   * Manually detach device from driver.
>   * When called for a USB interf

[PATCH 2/2 v4] block/throttle: Add IO queued information in blkio.throttle

2012-10-18 Thread Robin Dong
From: Robin Dong 

Currently, if the IO is throttled by io-throttle, the system admin has no idea
of the situation and can't report it to the real application user about that
he/she has to do something.

So this patch adds a new interface named blkio.throttle.io_queued which
exposes the number of bios that have been sent to blk-throttle therefore the
user could calculate the difference from throttle.io_serviced to see how many
IOs are currently throttled.

Cc: Tejun Heo 
Cc: Vivek Goyal 
Cc: Jens Axboe 
Signed-off-by: Tao Ma 
Signed-off-by: Robin Dong 
---
v3 <-- v2:
 - Use nr-queued[] of struct throtl_grp for stats instaed of adding new 
blkg_rwstat.

v4 <-- v3:
 - Add two new blkg_rwstat arguments to count total bios be sent in 
blk_throttle.

 block/blk-throttle.c |   44 
 1 files changed, 44 insertions(+), 0 deletions(-)

diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index 46ddeff..b122b0c 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -70,6 +70,10 @@ struct throtl_grp {
/* Number of queued bios on READ and WRITE lists */
unsigned int nr_queued[2];
 
+   /* The stats of total number queued in blk-throtlle */
+   struct blkg_rwstat io_queue_bytes;
+   struct blkg_rwstat io_queued;
+
/* bytes per second rate limits */
uint64_t bps[2];
 
@@ -267,6 +271,8 @@ static void throtl_pd_reset_stats(struct blkcg_gq *blkg)
blkg_rwstat_reset(&sc->service_bytes);
blkg_rwstat_reset(&sc->serviced);
}
+   blkg_rwstat_reset(&tg->io_queued);
+   blkg_rwstat_reset(&tg->io_queue_bytes);
 }
 
 static struct throtl_grp *throtl_lookup_tg(struct throtl_data *td,
@@ -699,6 +705,12 @@ static void throtl_update_dispatch_stats(struct throtl_grp 
*tg, u64 bytes,
local_irq_restore(flags);
 }
 
+static void throtl_update_queued_stats(struct throtl_grp *tg, u64 bytes, int 
rw)
+{
+   blkg_rwstat_add(&tg->io_queued, rw, 1);
+   blkg_rwstat_add(&tg->io_queue_bytes, rw, bytes);
+}
+
 static void throtl_charge_bio(struct throtl_grp *tg, struct bio *bio)
 {
bool rw = bio_data_dir(bio);
@@ -952,6 +964,15 @@ static u64 tg_prfill_cpu_rwstat(struct seq_file *sf,
return __blkg_prfill_rwstat(sf, pd, &rwstat);
 }
 
+static u64 tg_prfill_io_queued(struct seq_file *sf,
+   struct blkg_policy_data *pd, int off)
+{
+   struct throtl_grp *tg = pd_to_tg(pd);
+   struct blkg_rwstat *rwstat = (void *)tg + off;
+
+   return __blkg_prfill_rwstat(sf, pd, rwstat);
+}
+
 static int tg_print_cpu_rwstat(struct cgroup *cgrp, struct cftype *cft,
   struct seq_file *sf)
 {
@@ -962,6 +983,16 @@ static int tg_print_cpu_rwstat(struct cgroup *cgrp, struct 
cftype *cft,
return 0;
 }
 
+static int tg_print_io_queued(struct cgroup *cgrp, struct cftype *cft,
+  struct seq_file *sf)
+{
+   struct blkcg *blkcg = cgroup_to_blkcg(cgrp);
+
+   blkcg_print_blkgs(sf, blkcg, tg_prfill_io_queued, &blkcg_policy_throtl,
+ cft->private, true);
+   return 0;
+}
+
 static u64 tg_prfill_conf_u64(struct seq_file *sf, struct blkg_policy_data *pd,
  int off)
 {
@@ -1084,6 +1115,16 @@ static struct cftype throtl_files[] = {
.private = offsetof(struct tg_stats_cpu, serviced),
.read_seq_string = tg_print_cpu_rwstat,
},
+   {
+   .name = "throttle.io_queue_bytes",
+   .private = offsetof(struct throtl_grp, io_queue_bytes),
+   .read_seq_string = tg_print_io_queued,
+   },
+   {
+   .name = "throttle.io_queued",
+   .private = offsetof(struct throtl_grp, io_queued),
+   .read_seq_string = tg_print_io_queued,
+   },
{ } /* terminate */
 };
 
@@ -1128,6 +1169,8 @@ bool blk_throtl_bio(struct request_queue *q, struct bio 
*bio)
if (tg_no_rule_group(tg, rw)) {
throtl_update_dispatch_stats(tg,
 bio->bi_size, bio->bi_rw);
+   throtl_update_queued_stats(tg,
+   bio->bi_size, bio->bi_rw);
goto out_unlock_rcu;
}
}
@@ -1141,6 +1184,7 @@ bool blk_throtl_bio(struct request_queue *q, struct bio 
*bio)
if (unlikely(!tg))
goto out_unlock;
 
+   throtl_update_queued_stats(tg, bio->bi_size, bio->bi_rw);
if (tg->nr_queued[rw]) {
/*
 * There is already another bio queued in same dir. No
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2 v4] block/throttle: remove redundant type transition

2012-10-18 Thread Robin Dong
From: Robin Dong 

We don't need to convert tg to blkg and then convert it back in
throtl_update_dispatch_stats().

Signed-off-by: Robin Dong 
---
 block/blk-throttle.c |7 +++
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index a9664fa..46ddeff 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -674,10 +674,9 @@ static bool tg_may_dispatch(struct throtl_data *td, struct 
throtl_grp *tg,
return 0;
 }
 
-static void throtl_update_dispatch_stats(struct blkcg_gq *blkg, u64 bytes,
+static void throtl_update_dispatch_stats(struct throtl_grp *tg, u64 bytes,
 int rw)
 {
-   struct throtl_grp *tg = blkg_to_tg(blkg);
struct tg_stats_cpu *stats_cpu;
unsigned long flags;
 
@@ -708,7 +707,7 @@ static void throtl_charge_bio(struct throtl_grp *tg, struct 
bio *bio)
tg->bytes_disp[rw] += bio->bi_size;
tg->io_disp[rw]++;
 
-   throtl_update_dispatch_stats(tg_to_blkg(tg), bio->bi_size, bio->bi_rw);
+   throtl_update_dispatch_stats(tg, bio->bi_size, bio->bi_rw);
 }
 
 static void throtl_add_bio_tg(struct throtl_data *td, struct throtl_grp *tg,
@@ -1127,7 +1126,7 @@ bool blk_throtl_bio(struct request_queue *q, struct bio 
*bio)
tg = throtl_lookup_tg(td, blkcg);
if (tg) {
if (tg_no_rule_group(tg, rw)) {
-   throtl_update_dispatch_stats(tg_to_blkg(tg),
+   throtl_update_dispatch_stats(tg,
 bio->bi_size, bio->bi_rw);
goto out_unlock_rcu;
}
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH net-next 07/21] infiniband: Convert is__ether_addr uses to eth_addr_

2012-10-18 Thread Joe Perches
Convert the old ether_addr tests to eth_addr_.
Adds api consistency.

Signed-off-by: Joe Perches 
---
 drivers/infiniband/hw/amso1100/c2.c |2 +-
 drivers/infiniband/hw/nes/nes_nic.c |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/amso1100/c2.c 
b/drivers/infiniband/hw/amso1100/c2.c
index 5ce7b9e..3bb307c 100644
--- a/drivers/infiniband/hw/amso1100/c2.c
+++ b/drivers/infiniband/hw/amso1100/c2.c
@@ -908,7 +908,7 @@ static struct net_device *c2_devinit(struct c2_dev *c2dev,
memcpy_fromio(netdev->dev_addr, mmio_addr + C2_REGS_ENADDR, 6);
 
/* Validate the MAC address */
-   if (!is_valid_ether_addr(netdev->dev_addr)) {
+   if (!eth_addr_valid(netdev->dev_addr)) {
pr_debug("Invalid MAC Address\n");
c2_print_macaddr(netdev);
free_netdev(netdev);
diff --git a/drivers/infiniband/hw/nes/nes_nic.c 
b/drivers/infiniband/hw/nes/nes_nic.c
index 0564be7..3cd7d38 100644
--- a/drivers/infiniband/hw/nes/nes_nic.c
+++ b/drivers/infiniband/hw/nes/nes_nic.c
@@ -809,7 +809,7 @@ static int nes_netdev_set_mac_address(struct net_device 
*netdev, void *p)
u32 macaddr_low;
u16 macaddr_high;
 
-   if (!is_valid_ether_addr(mac_addr->sa_data))
+   if (!eth_addr_valid(mac_addr->sa_data))
return -EADDRNOTAVAIL;
 
memcpy(netdev->dev_addr, mac_addr->sa_data, netdev->addr_len);
-- 
1.7.8.111.gad25c.dirty

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC PATCH 0/2] sched: Load Balancing using Per-entity-Load-tracking

2012-10-18 Thread preeti
Hi Morten,
Thank you very much for your review.

>> 1.Consider a scenario,where there are two 10% tasks running on a cpu.The
>>   present code will consider the load on this queue to be 2048,while
>>   using PJT's metric the load is calculated to be <1000,rarely exceeding this
>>   limit.Although the tasks are not contributing much to the cpu load,they are
>>   decided to be moved by the scheduler.
> 
> I guess that you assume, for now, that all tasks have default (nice 0)
> priority? Both the old load and the PJT metric (tracked load) depends on
> priority.
Thats right.I have assumed default priority of the tasks.
> 
>>
>>   But one could argue that 'not moving one of these tasks could throttle
>>   them.If there was an idle cpu,perhaps we could have moved them'.While the
>>   power save mode would have been fine with not moving the task,the
>>   performance mode would prefer not to throttle the tasks.We could strive
>>   to strike a balance by making this decision tunable with certain 
>> parameters.
>>   This patchset includes such tunables.This issue is addressed in Patch[1/2].
>>
> 
> One could also argue that long as there are spare cpu cycles in each
> schedule period then all tasks have received the cpu time they needed.
> So from that point of view performance isn't affected by not balancing
> the tasks as long as the cpu is not fully utilized. If we look at the
> problem from a latency point of view then packing tasks on a single cpu
> will increase latency but the increase will be bounded by the schedule
> period.
> 
Assume that at the end of one scheduling period,there are a few spare
cycles on the cpu.this is fine from both the performance and latency
point of view at *this* point.nobody is waiting for the cpu.

The issue arises if it is detected that these spare cycles are due to
*sleeping tasks* and not due to no tasks.

At this point a decision needs to be made as to: if a scenario arises
where all these tasks wake up at the same time in the future,and wait on
the cpu,then are we ok with them waiting.Both performance and latency
views could be against this,as this also means less throughput.But
performance view could go slightly easy on this to argue,that its ok if
2-3 tasks wait,if more,then there is a need to move them.
>>   This patchset therefore has two primary aims.
>>  Patch[1/2]: This patch aims at detecting short running tasks and
>>   prevent their movement.In update_sg_lb_stats,dismiss a sched group
>>   as a candidate for load balancing,if load calculated by PJT's metric
>>   says that the average load on the sched_group <= 1024+(.15*1024).
>>   This is a tunable,which can be varied after sufficient experiments.
> 
> Your current threshold implies that there must be at least two (nice 0)
> tasks running breach the threshold and they need to be quite busy. This
> makes sense to me. When you have more tasks they are more likely to be
> waiting on the runqueue even if it is only 10% tasks. Let's say you have
> five 10% tasks and they all become runnable at the same instant. In that
> case some of the tasks would have a tracked load which is much higher
> than if we only had two 10% tasks running. So if I'm not mistaken, it
> would be possible to breach the threshold even though the overall cpu
> utilization is only 50% and it would have been safe not to load-balance
> that cpu.
> 
> Do you think it would make sense to let the threshold depend on the
> number of task on the cpu somehow? 

You are right,Morten.In fact I have included this viewpoint in both my
first and second patch enclosed by this. So lets take up the above
scenario.if there are 5 10% tasks running,they will surely cross the
threshold,but the cpu might have spare cycles at the end of a scheduling
period.Now that is your concern.

Again we have two different viewpoints.This threshold is like a tuning
knob.we could increase it if we feel that this threshold gets reached
very quickly with as few tasks as 5, although the cpu utilization is
poor.we prefer not to wake up another cpu unless the present cpu is
aptly loaded.we could call this the power saving view.

Else we could say that,we are not intending to affect the throughput of
tasks,so we prefer the knob be at this value,so that we qualify such a
load as a candidate for load balancing.we could call this the
performance view.
> 
> Alternative, the decision could be based on the cpu idle time over the
> last schedule period. A cpu with no or very few spare cycles in the last
> schedule period would be a good candidate for load-balancing. Latency
> would be affected as mentioned earlier.
> 
Exactly.idle_time == spare_cpu_cycles == less cpu_utilization.I hope i
am not wrong in drawing this equivalence.if thats the case then the same
explanation as above holds good here too.
> 
> Morten

Thank you

Regards
Preeti

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More 

[PATCH net-next 21/21] sctp: Convert ipv4_is_ uses to ipv4_addr_

2012-10-18 Thread Joe Perches
Use the new ipv4_addr_ functions to be consistent with
the ipv6_addr_ and eth_addr_ style.

Signed-off-by: Joe Perches 
---
 include/net/sctp/constants.h |   12 ++--
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h
index d053d2e..31bae2f 100644
--- a/include/net/sctp/constants.h
+++ b/include/net/sctp/constants.h
@@ -365,12 +365,12 @@ typedef enum {
  * Also, RFC 8.4, non-unicast addresses are not considered valid SCTP
  * addresses.
  */
-#define IS_IPV4_UNUSABLE_ADDRESS(a)\
-   ((htonl(INADDR_BROADCAST) == a) ||  \
-ipv4_is_multicast(a) ||\
-ipv4_is_zeronet(a) ||  \
-ipv4_is_test_198(a) || \
-ipv4_is_anycast_6to4(a))
+#define IS_IPV4_UNUSABLE_ADDRESS(a)\
+   ((htonl(INADDR_BROADCAST) == a) ||  \
+ipv4_addr_multicast(a) ||  \
+ipv4_addr_zeronet(a) ||\
+ipv4_addr_test_198(a) ||   \
+ipv4_addr_anycast_6to4(a))
 
 /* Flags used for the bind address copy functions.  */
 #define SCTP_ADDR6_ALLOWED 0x0001  /* IPv6 address is allowed by
-- 
1.7.8.111.gad25c.dirty

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH net-next 20/21] lockd: Convert ipv4_is_ uses to ipv4_addr_

2012-10-18 Thread Joe Perches
Use the new ipv4_addr_ functions to be consistent with
the ipv6_addr_ and eth_addr_ style.

Signed-off-by: Joe Perches 
---
 include/linux/lockd/lockd.h |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index f5a051a..8fa00e0 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -301,7 +301,7 @@ static inline int __nlm_privileged_request4(const struct 
sockaddr *sap)
if (ntohs(sin->sin_port) > 1023)
return 0;
 
-   return ipv4_is_loopback(sin->sin_addr.s_addr);
+   return ipv4_addr_loopback(sin->sin_addr.s_addr);
 }
 
 #if IS_ENABLED(CONFIG_IPV6)
@@ -313,7 +313,7 @@ static inline int __nlm_privileged_request6(const struct 
sockaddr *sap)
return 0;
 
if (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_MAPPED)
-   return ipv4_is_loopback(sin6->sin6_addr.s6_addr32[3]);
+   return ipv4_addr_loopback(sin6->sin6_addr.s6_addr32[3]);
 
return ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LOOPBACK;
 }
-- 
1.7.8.111.gad25c.dirty

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH net-next 19/21] parisc: Convert ipv4_is_ uses to ipv4_addr_

2012-10-18 Thread Joe Perches
Use the new ipv4_addr_ functions to be consistent with
the ipv6_addr_ and eth_addr_ style.

Signed-off-by: Joe Perches 
---
 drivers/parisc/led.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/parisc/led.c b/drivers/parisc/led.c
index f2f501e..8951fd1 100644
--- a/drivers/parisc/led.c
+++ b/drivers/parisc/led.c
@@ -369,7 +369,7 @@ static __inline__ int led_get_net_activity(void)
struct in_device *in_dev = __in_dev_get_rcu(dev);
if (!in_dev || !in_dev->ifa_list)
continue;
-   if (ipv4_is_loopback(in_dev->ifa_list->ifa_local))
+   if (ipv4_addr_loopback(in_dev->ifa_list->ifa_local))
continue;
stats = dev_get_stats(dev, &temp);
rx_total += stats->rx_packets;
-- 
1.7.8.111.gad25c.dirty

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH net-next 18/21] ath6kl: Convert ipv4_is_ uses to ipv4_addr_

2012-10-18 Thread Joe Perches
Use the new ipv4_addr_ functions to be consistent with
the ipv6_addr_ and eth_addr_ style.

Signed-off-by: Joe Perches 
---
 drivers/net/wireless/ath/ath6kl/wmi.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath6kl/wmi.c 
b/drivers/net/wireless/ath/ath6kl/wmi.c
index c30ab4b..a5624f5 100644
--- a/drivers/net/wireless/ath/ath6kl/wmi.c
+++ b/drivers/net/wireless/ath/ath6kl/wmi.c
@@ -2547,8 +2547,8 @@ int ath6kl_wmi_set_ip_cmd(struct wmi *wmi, u8 if_idx,
int ret;
 
/* Multicast address are not valid */
-   if (ipv4_is_multicast(ips0) ||
-   ipv4_is_multicast(ips1))
+   if (ipv4_addr_multicast(ips0) ||
+   ipv4_addr_multicast(ips1))
return -EINVAL;
 
skb = ath6kl_wmi_get_new_buf(sizeof(struct wmi_set_ip_cmd));
-- 
1.7.8.111.gad25c.dirty

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH net-next 17/21] infiniband: Convert ipv4_is_ uses to ipv4_addr_

2012-10-18 Thread Joe Perches
Use the new ipv4_addr_ functions to be consistent with
the ipv6_addr_ and eth_addr_ style.

Signed-off-by: Joe Perches 
---
 drivers/infiniband/core/cma.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index a7568c3..108f96f 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -683,7 +683,7 @@ static inline int cma_zero_addr(struct sockaddr *addr)
struct in6_addr *ip6;
 
if (addr->sa_family == AF_INET)
-   return ipv4_is_zeronet(
+   return ipv4_addr_zeronet(
((struct sockaddr_in *)addr)->sin_addr.s_addr);
else {
ip6 = &((struct sockaddr_in6 *) addr)->sin6_addr;
@@ -695,7 +695,7 @@ static inline int cma_zero_addr(struct sockaddr *addr)
 static inline int cma_loopback_addr(struct sockaddr *addr)
 {
if (addr->sa_family == AF_INET)
-   return ipv4_is_loopback(
+   return ipv4_addr_loopback(
((struct sockaddr_in *) addr)->sin_addr.s_addr);
else
return ipv6_addr_loopback(
-- 
1.7.8.111.gad25c.dirty

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH net-next 16/21] net: Convert ipv4_is_ uses to ipv4_addr_

2012-10-18 Thread Joe Perches
Use the new ipv4_addr_ functions to be consistent with
the ipv6_addr_ and eth_addr_ style.

Signed-off-by: Joe Perches 
---
 net/bridge/br_multicast.c |4 +-
 net/core/netpoll.c|2 +-
 net/core/pktgen.c |   10 +++---
 net/ipv4/arp.c|4 +-
 net/ipv4/datagram.c   |2 +-
 net/ipv4/devinet.c|4 +-
 net/ipv4/fib_frontend.c   |   12 
 net/ipv4/igmp.c   |   12 
 net/ipv4/ip_gre.c |   20 ++--
 net/ipv4/ipmr.c   |4 +-
 net/ipv4/netfilter/ipt_rpfilter.c |   10 +++---
 net/ipv4/ping.c   |2 +-
 net/ipv4/raw.c|2 +-
 net/ipv4/route.c  |   58 ++--
 net/ipv4/udp.c|2 +-
 net/ipv6/addrconf.c   |   12 
 net/l2tp/l2tp_ip.c|2 +-
 net/l2tp/l2tp_ip6.c   |2 +-
 net/netfilter/ipvs/ip_vs_xmit.c   |6 ++--
 net/netfilter/xt_cluster.c|2 +-
 net/netfilter/xt_pkttype.c|2 +-
 net/sctp/protocol.c   |   10 +++---
 22 files changed, 92 insertions(+), 92 deletions(-)

diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
index 2417434..1a58375 100644
--- a/net/bridge/br_multicast.c
+++ b/net/bridge/br_multicast.c
@@ -696,7 +696,7 @@ static int br_ip4_multicast_add_group(struct net_bridge *br,
 {
struct br_ip br_group;
 
-   if (ipv4_is_local_multicast(group))
+   if (ipv4_addr_local_multicast(group))
return 0;
 
br_group.u.ip4 = group;
@@ -1266,7 +1266,7 @@ static void br_ip4_multicast_leave_group(struct 
net_bridge *br,
 {
struct br_ip br_group;
 
-   if (ipv4_is_local_multicast(group))
+   if (ipv4_addr_local_multicast(group))
return;
 
br_group.u.ip4 = group;
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 77a0388..7a84b2a 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -495,7 +495,7 @@ static void netpoll_arp_reply(struct sk_buff *skb, struct 
netpoll_info *npinfo)
memcpy(&tip, arp_ptr, 4);
 
/* Should we ignore arp? */
-   if (ipv4_is_loopback(tip) || ipv4_is_multicast(tip))
+   if (ipv4_addr_loopback(tip) || ipv4_addr_multicast(tip))
return;
 
size = arp_hdr_len(skb->dev);
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 3422af7..8327f05 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -2396,11 +2396,11 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
t = random32() % (imx - imn) + imn;
s = htonl(t);
 
-   while (ipv4_is_loopback(s) ||
-  ipv4_is_multicast(s) ||
-  ipv4_is_lbcast(s) ||
-  ipv4_is_zeronet(s) ||
-  ipv4_is_local_multicast(s)) {
+   while (ipv4_addr_loopback(s) ||
+  ipv4_addr_multicast(s) ||
+  ipv4_addr_lbcast(s) ||
+  ipv4_addr_zeronet(s) ||
+  ipv4_addr_local_multicast(s)) {
t = random32() % (imx - imn) + 
imn;
s = htonl(t);
}
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 4780045..b03e5e4 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -789,8 +789,8 @@ static int arp_process(struct sk_buff *skb)
  * Check for bad requests for 127.x.x.x and requests for multicast
  * addresses.  If this is one such, delete it.
  */
-   if (ipv4_is_multicast(tip) ||
-   (!IN_DEV_ROUTE_LOCALNET(in_dev) && ipv4_is_loopback(tip)))
+   if (ipv4_addr_multicast(tip) ||
+   (!IN_DEV_ROUTE_LOCALNET(in_dev) && ipv4_addr_loopback(tip)))
goto out;
 
 /*
diff --git a/net/ipv4/datagram.c b/net/ipv4/datagram.c
index 424fafb..83b51ad 100644
--- a/net/ipv4/datagram.c
+++ b/net/ipv4/datagram.c
@@ -43,7 +43,7 @@ int ip4_datagram_connect(struct sock *sk, struct sockaddr 
*uaddr, int addr_len)
 
oif = sk->sk_bound_dev_if;
saddr = inet->inet_saddr;
-   if (ipv4_is_multicast(usin->sin_addr.s_addr)) {
+   if (ipv4_addr_multicast(usin->sin_addr.s_addr)) {
if (!oif)
oif = inet->mc_index;
if (!saddr)
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 2a6abc1..f217d83 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -491,7 +491,7 @@ static int inet_set_ifa(struct net_device *dev, struct 
in_ifaddr *ifa)

[PATCH net-next 15/21] in.h: Rename ipv4_is_ functions to ipv4_addr_

2012-10-18 Thread Joe Perches
Make the ipv4_is_ tests use a similar style to ipv6_ tests.
Add backward compatibility #defines to keep current ipv4_is_
code working until completely converted.

Signed-off-by: Joe Perches 
---
 include/linux/in.h |   40 
 1 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/include/linux/in.h b/include/linux/in.h
index 31b4937..2116ce8 100644
--- a/include/linux/in.h
+++ b/include/linux/in.h
@@ -39,66 +39,82 @@ static inline int proto_ports_offset(int proto)
}
 }
 
-static inline bool ipv4_is_loopback(__be32 addr)
+static inline bool ipv4_addr_loopback(__be32 addr)
 {
return (addr & htonl(0xff00)) == htonl(0x7f00);
 }
 
-static inline bool ipv4_is_multicast(__be32 addr)
+static inline bool ipv4_addr_multicast(__be32 addr)
 {
return (addr & htonl(0xf000)) == htonl(0xe000);
 }
 
-static inline bool ipv4_is_local_multicast(__be32 addr)
+static inline bool ipv4_addr_local_multicast(__be32 addr)
 {
return (addr & htonl(0xff00)) == htonl(0xe000);
 }
 
-static inline bool ipv4_is_lbcast(__be32 addr)
+static inline bool ipv4_addr_lbcast(__be32 addr)
 {
/* limited broadcast */
return addr == htonl(INADDR_BROADCAST);
 }
 
-static inline bool ipv4_is_zeronet(__be32 addr)
+static inline bool ipv4_addr_zeronet(__be32 addr)
 {
return (addr & htonl(0xff00)) == htonl(0x);
 }
 
 /* Special-Use IPv4 Addresses (RFC3330) */
 
-static inline bool ipv4_is_private_10(__be32 addr)
+static inline bool ipv4_addr_private_10(__be32 addr)
 {
return (addr & htonl(0xff00)) == htonl(0x0a00);
 }
 
-static inline bool ipv4_is_private_172(__be32 addr)
+static inline bool ipv4_addr_private_172(__be32 addr)
 {
return (addr & htonl(0xfff0)) == htonl(0xac10);
 }
 
-static inline bool ipv4_is_private_192(__be32 addr)
+static inline bool ipv4_addr_private_192(__be32 addr)
 {
return (addr & htonl(0x)) == htonl(0xc0a8);
 }
 
-static inline bool ipv4_is_linklocal_169(__be32 addr)
+static inline bool ipv4_addr_linklocal_169(__be32 addr)
 {
return (addr & htonl(0x)) == htonl(0xa9fe);
 }
 
-static inline bool ipv4_is_anycast_6to4(__be32 addr)
+static inline bool ipv4_addr_anycast_6to4(__be32 addr)
 {
return (addr & htonl(0xff00)) == htonl(0xc0586300);
 }
 
-static inline bool ipv4_is_test_192(__be32 addr)
+static inline bool ipv4_addr_test_192(__be32 addr)
 {
return (addr & htonl(0xff00)) == htonl(0xc200);
 }
 
-static inline bool ipv4_is_test_198(__be32 addr)
+static inline bool ipv4_addr_test_198(__be32 addr)
 {
return (addr & htonl(0xfffe)) == htonl(0xc612);
 }
+
+/* Some #defines to make old ipv4_is_ tests work for awhile */
+
+#define ipv4_is_loopback(addr) ipv4_addr_loopback(addr)
+#define ipv4_is_multicast(addr)ipv4_addr_multicast(addr)
+#define ipv4_is_local_multicast(addr)  ipv4_addr_local_multicast(addr)
+#define ipv4_is_lbcast(addr)   ipv4_addr_lbcast(addr)
+#define ipv4_is_zeronet(addr)  ipv4_addr_zeronet(addr)
+#define ipv4_is_private_10(addr)   ipv4_addr_private_10(addr)
+#define ipv4_is_private_172(addr)  ipv4_addr_private_172(addr)
+#define ipv4_is_private_192(addr)  ipv4_addr_private_192(addr)
+#define ipv4_is_linklocal_169(addr)ipv4_addr_linklocal_169(addr)
+#define ipv4_is_anycast_6to4(addr) ipv4_addr_anycast_6to4(addr)
+#define ipv4_is_test_192(addr) ipv4_addr_test_192(addr)
+#define ipv4_is_test_198(addr) ipv4_addr_test_198(addr)
+
 #endif /* _LINUX_IN_H */
-- 
1.7.8.111.gad25c.dirty

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH net-next 14/21] llc_if.h: Convert is__ether_addr uses to eth_addr_

2012-10-18 Thread Joe Perches
Convert the old ether_addr tests to eth_addr_.
Adds api consistency.

Signed-off-by: Joe Perches 
---
 include/net/llc_if.h |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/net/llc_if.h b/include/net/llc_if.h
index b595a00..cce2942 100644
--- a/include/net/llc_if.h
+++ b/include/net/llc_if.h
@@ -71,12 +71,12 @@
  */
 static inline int llc_mac_null(const u8 *mac)
 {
-   return is_zero_ether_addr(mac);
+   return eth_addr_zero(mac);
 }
 
 static inline int llc_mac_multicast(const u8 *mac)
 {
-   return is_multicast_ether_addr(mac);
+   return eth_addr_multicast(mac);
 }
 /**
  * llc_mac_match - determines if two mac addresses are the same
-- 
1.7.8.111.gad25c.dirty

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH net-next 13/21] Documentation: networking: Convert is__ether_addr uses to eth_addr_

2012-10-18 Thread Joe Perches
Convert the old ether_addr tests to eth_addr_.
Adds api consistency.

Signed-off-by: Joe Perches 
---
 Documentation/networking/driver.txt |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Documentation/networking/driver.txt 
b/Documentation/networking/driver.txt
index da59e28..4db39f4 100644
--- a/Documentation/networking/driver.txt
+++ b/Documentation/networking/driver.txt
@@ -80,7 +80,7 @@ Probing guidelines:
 
 1) Any hardware layer address you obtain for your device should
be verified.  For example, for ethernet check it with
-   linux/etherdevice.h:is_valid_ether_addr()
+   linux/etherdevice.h:eth_addr_valid()
 
 Close/stop guidelines:
 
-- 
1.7.8.111.gad25c.dirty

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH net-next 12/21] uwb: Convert is__ether_addr uses to eth_addr_

2012-10-18 Thread Joe Perches
Convert the old ether_addr tests to eth_addr_.
Adds api consistency.

Signed-off-by: Joe Perches 
---
 drivers/uwb/address.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/uwb/address.c b/drivers/uwb/address.c
index 8739c4f..ba4e4cf 100644
--- a/drivers/uwb/address.c
+++ b/drivers/uwb/address.c
@@ -343,7 +343,7 @@ static ssize_t uwb_rc_mac_addr_store(struct device *dev,
result = -EINVAL;
goto out;
}
-   if (is_multicast_ether_addr(addr.data)) {
+   if (eth_addr_multicast(addr.data)) {
dev_err(&rc->uwb_dev.dev, "refusing to set multicast "
"MAC address %s\n", buf);
result = -EINVAL;
-- 
1.7.8.111.gad25c.dirty

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH net-next 11/21] usb: Convert is__ether_addr uses to eth_addr_

2012-10-18 Thread Joe Perches
Convert the old ether_addr tests to eth_addr_.
Adds api consistency.

Signed-off-by: Joe Perches 
---
 drivers/usb/gadget/u_ether.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/gadget/u_ether.c b/drivers/usb/gadget/u_ether.c
index 6458764..d6a5577 100644
--- a/drivers/usb/gadget/u_ether.c
+++ b/drivers/usb/gadget/u_ether.c
@@ -510,13 +510,13 @@ static netdev_tx_t eth_start_xmit(struct sk_buff *skb,
if (!is_promisc(cdc_filter)) {
u8  *dest = skb->data;
 
-   if (is_multicast_ether_addr(dest)) {
+   if (eth_addr_multicast(dest)) {
u16 type;
 
/* ignores USB_CDC_PACKET_TYPE_MULTICAST and host
 * SET_ETHERNET_MULTICAST_FILTERS requests
 */
-   if (is_broadcast_ether_addr(dest))
+   if (eth_addr_broadcast(dest))
type = USB_CDC_PACKET_TYPE_BROADCAST;
else
type = USB_CDC_PACKET_TYPE_ALL_MULTICAST;
@@ -721,7 +721,7 @@ static int get_ether_addr(const char *str, u8 *dev_addr)
num |= hex_to_bin(*str++);
dev_addr [i] = num;
}
-   if (is_valid_ether_addr(dev_addr))
+   if (eth_addr_valid(dev_addr))
return 0;
}
eth_random_addr(dev_addr);
-- 
1.7.8.111.gad25c.dirty

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH net-next 10/21] s390: Convert is__ether_addr uses to eth_addr_

2012-10-18 Thread Joe Perches
Convert the old ether_addr tests to eth_addr_.
Adds api consistency.

Signed-off-by: Joe Perches 
---
 drivers/s390/net/qeth_l2_main.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index e67e025..58324dc 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -227,9 +227,9 @@ static inline int qeth_l2_get_cast_type(struct qeth_card 
*card,
 {
if (card->info.type == QETH_CARD_TYPE_OSN)
return RTN_UNSPEC;
-   if (is_broadcast_ether_addr(skb->data))
+   if (eth_addr_broadcast(skb->data))
return RTN_BROADCAST;
-   if (is_multicast_ether_addr(skb->data))
+   if (eth_addr_multicast(skb->data))
return RTN_MULTICAST;
return RTN_UNSPEC;
 }
-- 
1.7.8.111.gad25c.dirty

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH net-next 09/21] of: Convert is__ether_addr uses to eth_addr_

2012-10-18 Thread Joe Perches
Convert the old ether_addr tests to eth_addr_.
Adds api consistency.

Signed-off-by: Joe Perches 
---
 drivers/of/of_net.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/of/of_net.c b/drivers/of/of_net.c
index ffab033..452dcf6 100644
--- a/drivers/of/of_net.c
+++ b/drivers/of/of_net.c
@@ -78,15 +78,15 @@ const void *of_get_mac_address(struct device_node *np)
struct property *pp;
 
pp = of_find_property(np, "mac-address", NULL);
-   if (pp && (pp->length == 6) && is_valid_ether_addr(pp->value))
+   if (pp && (pp->length == 6) && eth_addr_valid(pp->value))
return pp->value;
 
pp = of_find_property(np, "local-mac-address", NULL);
-   if (pp && (pp->length == 6) && is_valid_ether_addr(pp->value))
+   if (pp && (pp->length == 6) && eth_addr_valid(pp->value))
return pp->value;
 
pp = of_find_property(np, "address", NULL);
-   if (pp && (pp->length == 6) && is_valid_ether_addr(pp->value))
+   if (pp && (pp->length == 6) && eth_addr_valid(pp->value))
return pp->value;
 
return NULL;
-- 
1.7.8.111.gad25c.dirty

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH net-next 08/21] scsi: Convert is__ether_addr uses to eth_addr_

2012-10-18 Thread Joe Perches
Convert the old ether_addr tests to eth_addr_.
Adds api consistency.

Signed-off-by: Joe Perches 
---
 drivers/scsi/bnx2fc/bnx2fc_els.c  |4 ++--
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c |2 +-
 drivers/scsi/fcoe/fcoe.c  |   12 ++--
 drivers/scsi/fcoe/fcoe_ctlr.c |8 
 drivers/scsi/fnic/fnic_fcs.c  |6 +++---
 5 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc_els.c b/drivers/scsi/bnx2fc/bnx2fc_els.c
index bdbbb13..e611fe5 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_els.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_els.c
@@ -860,7 +860,7 @@ static void bnx2fc_flogi_resp(struct fc_seq *seq, struct 
fc_frame *fp,
goto done;
 
mac = fr_cb(fp)->granted_mac;
-   if (is_zero_ether_addr(mac)) {
+   if (eth_addr_zero(mac)) {
op = fc_frame_payload_op(fp);
if (lport->vport) {
if (op == ELS_LS_RJT) {
@@ -872,7 +872,7 @@ static void bnx2fc_flogi_resp(struct fc_seq *seq, struct 
fc_frame *fp,
}
fcoe_ctlr_recv_flogi(fip, lport, fp);
}
-   if (!is_zero_ether_addr(mac))
+   if (!eth_addr_zero(mac))
fip->update_mac(lport, mac);
 done:
fc_lport_flogi_resp(seq, fp, lport);
diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c 
b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index e055865..e888418 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -1216,7 +1216,7 @@ static int bnx2fc_interface_setup(struct bnx2fc_interface 
*interface)
ha->addr[4], ha->addr[5]);
 
if ((ha->type == NETDEV_HW_ADDR_T_SAN) &&
-   (is_valid_ether_addr(ha->addr))) {
+   (eth_addr_valid(ha->addr))) {
memcpy(ctlr->ctl_src_addr, ha->addr,
   ETH_ALEN);
sel_san_mac = 1;
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index 666b7ac..876b99c 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -328,7 +328,7 @@ static int fcoe_interface_setup(struct fcoe_interface *fcoe,
rcu_read_lock();
for_each_dev_addr(real_dev, ha) {
if ((ha->type == NETDEV_HW_ADDR_T_SAN) &&
-   (is_valid_ether_addr(ha->addr))) {
+   (eth_addr_valid(ha->addr))) {
memcpy(fip->ctl_src_addr, ha->addr, ETH_ALEN);
fip->spma = 1;
break;
@@ -563,9 +563,9 @@ static void fcoe_update_src_mac(struct fc_lport *lport, u8 
*addr)
struct fcoe_port *port = lport_priv(lport);
struct fcoe_interface *fcoe = port->priv;
 
-   if (!is_zero_ether_addr(port->data_src_addr))
+   if (!eth_addr_zero(port->data_src_addr))
dev_uc_del(fcoe->netdev, port->data_src_addr);
-   if (!is_zero_ether_addr(addr))
+   if (!eth_addr_zero(addr))
dev_uc_add(fcoe->netdev, addr);
memcpy(port->data_src_addr, addr, ETH_ALEN);
 }
@@ -980,7 +980,7 @@ static void fcoe_if_destroy(struct fc_lport *lport)
fcoe_clean_pending_queue(lport);
 
rtnl_lock();
-   if (!is_zero_ether_addr(port->data_src_addr))
+   if (!eth_addr_zero(port->data_src_addr))
dev_uc_del(netdev, port->data_src_addr);
if (lport->vport)
synchronize_net();
@@ -2587,9 +2587,9 @@ static void fcoe_flogi_resp(struct fc_seq *seq, struct 
fc_frame *fp, void *arg)
 
mac = fr_cb(fp)->granted_mac;
/* pre-FIP */
-   if (is_zero_ether_addr(mac))
+   if (eth_addr_zero(mac))
fcoe_ctlr_recv_flogi(fip, lport, fp);
-   if (!is_zero_ether_addr(mac))
+   if (!eth_addr_zero(mac))
fcoe_update_src_mac(lport, mac);
 done:
fc_lport_flogi_resp(seq, fp, lport);
diff --git a/drivers/scsi/fcoe/fcoe_ctlr.c b/drivers/scsi/fcoe/fcoe_ctlr.c
index 2ebe03a..5f230a0 100644
--- a/drivers/scsi/fcoe/fcoe_ctlr.c
+++ b/drivers/scsi/fcoe/fcoe_ctlr.c
@@ -302,7 +302,7 @@ static void fcoe_ctlr_announce(struct fcoe_ctlr *fip)
 
if (sel && !compare_ether_addr(sel->fcf_mac, fip->dest_addr))
goto unlock;
-   if (!is_zero_ether_addr(fip->dest_addr)) {
+   if (!eth_addr_zero(fip->dest_addr)) {
printk(KERN_NOTICE "libfcoe: host%d: "
   "FIP Fibre-Channel Forwarder MAC %pM deselected\n",
   fip->lp->host->host_no, fip->dest_addr);
@@ -907,7 +907,7 @@ static int fcoe_ctlr_parse_adv(struct fcoe_ctlr *fip,
   ((struct fip_mac_desc *)desc)->fd_mac,
   ETH_ALEN);
memcpy(fcf->fcoe_mac, fcf->fcf_mac, ETH_ALEN);
-   if (!is_valid_ether_addr(fcf->fcf_mac)) {
+   if (!eth_addr_valid(fcf->fcf_mac)) {
LIBFCOE_FIP_DBG(fip,
 

[PATCH net-next 06/21] staging: Convert is__ether_addr uses to eth_addr_

2012-10-18 Thread Joe Perches
Convert the old ether_addr tests to eth_addr_.
Adds api consistency.

Signed-off-by: Joe Perches 
---
 drivers/staging/ccg/u_ether.c  |6 +++---
 drivers/staging/csr/sme_wext.c |2 +-
 drivers/staging/et131x/et131x.c|4 ++--
 drivers/staging/gdm72xx/gdm_wimax.c|2 +-
 drivers/staging/octeon/ethernet.c  |2 +-
 drivers/staging/ozwpan/ozcdev.c|2 +-
 .../rtl8187se/ieee80211/ieee80211_softmac.c|2 +-
 .../rtl8187se/ieee80211/ieee80211_softmac_wx.c |2 +-
 drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c |2 +-
 drivers/staging/rtl8187se/r8180_core.c |2 +-
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c   |6 +++---
 drivers/staging/rtl8192e/rtl819x_TSProc.c  |2 +-
 drivers/staging/rtl8192e/rtllib_rx.c   |8 
 drivers/staging/rtl8192e/rtllib_softmac.c  |4 ++--
 drivers/staging/rtl8192e/rtllib_softmac_wx.c   |4 ++--
 drivers/staging/rtl8192e/rtllib_tx.c   |   12 ++--
 drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c  |4 ++--
 .../staging/rtl8192u/ieee80211/ieee80211_softmac.c |2 +-
 .../rtl8192u/ieee80211/ieee80211_softmac_wx.c  |2 +-
 drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c  |   12 ++--
 .../staging/rtl8192u/ieee80211/rtl819x_TSProc.c|2 +-
 drivers/staging/rtl8192u/r8192U_core.c |8 
 drivers/staging/rtl8712/rtl871x_ioctl_linux.c  |2 +-
 drivers/staging/rtl8712/rtl871x_ioctl_set.c|2 +-
 drivers/staging/rtl8712/rtl871x_mlme.c |2 +-
 drivers/staging/rtl8712/rtl871x_recv.c |8 
 drivers/staging/slicoss/slicoss.c  |2 +-
 drivers/staging/vt6655/bssdb.c |2 +-
 drivers/staging/vt6655/card.c  |2 +-
 drivers/staging/vt6655/device_main.c   |2 +-
 drivers/staging/vt6655/dpc.c   |4 ++--
 drivers/staging/vt6655/hostap.c|4 ++--
 drivers/staging/vt6655/iwctl.c |2 +-
 drivers/staging/vt6655/key.c   |2 +-
 drivers/staging/vt6655/mib.c   |8 
 drivers/staging/vt6655/rxtx.c  |   10 +-
 drivers/staging/vt6655/wpactl.c|4 ++--
 drivers/staging/vt6656/bssdb.c |2 +-
 drivers/staging/vt6656/dpc.c   |4 ++--
 drivers/staging/vt6656/hostap.c|4 ++--
 drivers/staging/vt6656/iwctl.c |2 +-
 drivers/staging/vt6656/key.c   |2 +-
 drivers/staging/vt6656/rxtx.c  |   14 +++---
 drivers/staging/vt6656/wpactl.c|2 +-
 drivers/staging/wlags49_h2/wl_wext.c   |2 +-
 45 files changed, 90 insertions(+), 90 deletions(-)

diff --git a/drivers/staging/ccg/u_ether.c b/drivers/staging/ccg/u_ether.c
index d0dabcf..0f1a1b7 100644
--- a/drivers/staging/ccg/u_ether.c
+++ b/drivers/staging/ccg/u_ether.c
@@ -509,13 +509,13 @@ static netdev_tx_t eth_start_xmit(struct sk_buff *skb,
if (!is_promisc(cdc_filter)) {
u8  *dest = skb->data;
 
-   if (is_multicast_ether_addr(dest)) {
+   if (eth_addr_multicast(dest)) {
u16 type;
 
/* ignores USB_CDC_PACKET_TYPE_MULTICAST and host
 * SET_ETHERNET_MULTICAST_FILTERS requests
 */
-   if (is_broadcast_ether_addr(dest))
+   if (eth_addr_broadcast(dest))
type = USB_CDC_PACKET_TYPE_BROADCAST;
else
type = USB_CDC_PACKET_TYPE_ALL_MULTICAST;
@@ -714,7 +714,7 @@ static int get_ether_addr(const char *str, u8 *dev_addr)
num |= hex_to_bin(*str++);
dev_addr [i] = num;
}
-   if (is_valid_ether_addr(dev_addr))
+   if (eth_addr_valid(dev_addr))
return 0;
}
eth_random_addr(dev_addr);
diff --git a/drivers/staging/csr/sme_wext.c b/drivers/staging/csr/sme_wext.c
index b58c0c6..0aea381 100644
--- a/drivers/staging/csr/sme_wext.c
+++ b/drivers/staging/csr/sme_wext.c
@@ -1211,7 +1211,7 @@ unifi_siwap(struct net_device *dev, struct 
iw_request_info *info,
unifi_trace(priv, UDBG1, "unifi_siwap: asked for %pM\n",
wrqu->ap_addr.sa_data);
 
-if (is_zero_ether_addr(wrqu->ap_addr.sa_data)) {
+if (eth_addr_zero(wrqu->ap_addr.sa_data)) {
 priv->ignore_bssid_join = FALSE;
 err = sme_mgt_disconnect(priv);
 if (err) {
diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et

Re: [PATCH] oom, memcg: handle sysctl oom_kill_allocating_task while memcg oom happening

2012-10-18 Thread Sha Zhengju

On 10/18/2012 11:32 PM, Michal Hocko wrote:

On Thu 18-10-12 21:51:57, Sha Zhengju wrote:

On 10/18/2012 07:56 PM, Michal Hocko wrote:

On Wed 17-10-12 01:14:48, Sha Zhengju wrote:

On Tuesday, October 16, 2012, Michal Hocko   wrote:

[...]

Could you be more specific about the motivation for this patch? Is it
"let's be consistent with the global oom" or you have a real use case
for this knob.


In our environment(rhel6), we encounter a memcg oom 'deadlock'
problem.  Simply speaking, suppose process A is selected to be killed
by memcg oom killer, but A is uninterruptible sleeping on a page
lock. What's worse, the exact page lock is holding by another memcg
process B which is trapped in mem_croup_oom_lock(proves to be a
livelock).

Hmm, this is strange. How can you get down that road with the page lock
held? Is it possible this is related to the issue fixed by: 1d65f86d
(mm: preallocate page before lock_page() at filemap COW)?

No, it has nothing with the cow page. By checking stack of the process A
selected to be killed(uninterruptible sleeping), it was stuck at:
__do_fault->filemap_fault->__lock_page_or_retry->wait_on_page_bit--(D
state).
The person B holding the exactly page lock is on the following path:
__do_fault->filemap_fault->__do_page_cache_readahead->..->mpage_readpages
->add_to_page_cache_locked >(in memcg oom and cannot exit)

Hmm filemap_fault locks the page after the read ahead is triggered
already so it doesn't call mpage_readpages with any page locked - the
add_to_page_cache_lru is called without any page locked.


It's not the page being fault in filemap_fault that causing the problem, 
but those
pages handling by readhead. To clarify the point, the more detailed call 
stack is:

filemap_fault->do_async/sync_mmap_readahead->ondemand_readahead->
__do_page_cache_readahead->read_pages->ext3/4_readpages->*mpage_readpages*

It is because mpage_readpages that bring the risk:
for each of readahead pages
 (1)add_to_page_cache_lru (--> *will lock page and go through memcg 
charging*)

 add the page to a big bio
submit_bio (So those locked pages will be unlocked in end_bio after swapin)

So if a page is being charged and cannot exit from memcg oom successfully
(following I'll explain the reason) in step (1), it will cause the 
submit_bio indefinitely

postponed while holding the PageLock of previous pages.


This is at least the current code. It might be different in rhel6 but
calling memcg charging with a page lock is definitely a bug.



The current code (mm repo since-3.6) here remains unchanged. Through we 
may need
to take care of page lock and memcg charging in mpage_readpages, it 
dives to fs level.
Besides 37b23e05 have already fixed the deadlock from the other side: 
process still can be
killed even waiting for pagelock. But considering other potential 
problem, we may as well do
something in mpage_readpages to avoid calling add_to_page_cache_lru with 
any page locked.



In mpage_readpages, B tends to read a dozen of pages in: for each of
page will do
locking, charging, and then send out a big bio. And A is waiting for
one of the pages
and stuck.

As I said, 37b23e05 has made pagefault killable by changing
uninterruptible sleeping to killable sleeping. So A can be woke up to
exit successfully and free the memory which can in turn help B pass
memcg charging period.

(By the way, it seems commit 37b23e05 and 7d9fdac need to be

79dfdaccd1d5 you mean, right? That one just helps when there are too
many tasks trashing oom killer so it is not related to what you are
trying to achieve. Besides that make sure you take 23751be0 if you
take it.



Here is the reason why I said a process may go though memcg oom and cannot
exit. It's just the phenomenon described in the commit log of 79dfdaccd:
the old version of memcg oom lock can lead to serious starvation and make
many tasks trash oom killer but nothing useful can be done.


It is for these two reasons that cause the bug and can make the memcg 
unusable

(sys up to almost 100%)for hours even days... Once we give some extra memory
to the memcg(such as increase hardlimit a little), the processes tending 
into oom killer
will pass the charging and send bio out eventually, which will unlock 
those pages and

wake up the D sleeper.



backported to --stable tree to deliver RHEL users. ;-) )

I am not sure the first one qualifies the stable tree inclusion as it is
a feature.



When debugging the problem, we indeed found 37b23e05 is the key
enemy of the deadlock bug.



Then A can not exit successfully to free the memory and both of them
can not moving on.
Indeed, we should dig into these locks to find the solution and
in fact the 37b23e05 (x86, mm: make pagefault killable) and
7d9fdac(Memcg: make oom_lock 0 and 1 based other than counter) have
already solved the problem, but if oom_killing_allocating_task is
memcg aware, enabling this suicide oom behavior will be a simpler
workaround. What's more, enabling the sysctl can avoid other potenti

Re: [PATCH 1/2] acpi : cpu hot-remove returns error when cpu_down() fails

2012-10-18 Thread Rafael J. Wysocki
On Friday 28 of September 2012 19:36:02 Yasuaki Ishimatsu wrote:
> Even if cpu_down() fails, acpi_processor_remove() continues to remove the cpu.
> But in this case, it should return error number since some process may run on
> the cpu. If the cpu has a running process and the cpu is turned the power off,
> the system may not work well.
> 
> Reviewed-by: Srivatsa S. Bhat 
> Reviewed-by: Toshi Kani 
> Signed-off-by: Yasuaki Ishimatsu 
> 
> ---
>  drivers/acpi/processor_driver.c |   18 --
>  1 file changed, 12 insertions(+), 6 deletions(-)
> 
> Index: linux-3.6-rc7/drivers/acpi/processor_driver.c
> ===
> --- linux-3.6-rc7.orig/drivers/acpi/processor_driver.c2012-09-24 
> 10:10:57.0 +0900
> +++ linux-3.6-rc7/drivers/acpi/processor_driver.c 2012-09-28 
> 19:16:33.207858261 +0900
> @@ -605,7 +605,7 @@ err_free_pr:
>  static int acpi_processor_remove(struct acpi_device *device, int type)
>  {
>   struct acpi_processor *pr = NULL;
> -
> + int ret;
>  
>   if (!device || !acpi_driver_data(device))
>   return -EINVAL;
> @@ -616,8 +616,9 @@ static int acpi_processor_remove(struct 
>   goto free;
>  
>   if (type == ACPI_BUS_REMOVAL_EJECT) {
> - if (acpi_processor_handle_eject(pr))
> - return -EINVAL;
> + ret = acpi_processor_handle_eject(pr);
> + if (ret)
> + return ret;
>   }
>  
>   acpi_processor_power_exit(pr, device);
> @@ -848,12 +849,17 @@ static acpi_status acpi_processor_hotadd
>  
>  static int acpi_processor_handle_eject(struct acpi_processor *pr)
>  {
> - if (cpu_online(pr->id))
> - cpu_down(pr->id);
> + int ret = 0;
> +
> + if (cpu_online(pr->id)) {
> + ret = cpu_down(pr->id);

If you defined ret here ...

> + if (ret)
> + return ret;
> + }
>  
>   arch_unregister_cpu(pr->id);
>   acpi_unmap_lsapic(pr->id);
> - return (0);
> + return ret;

... this line wouldn't need to be changed.

>  }
>  #else
>  static acpi_status acpi_processor_hotadd_init(struct acpi_processor *pr)

Thanks,
Rafael


-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH net-next 04/21] wireless: Convert is__ether_addr uses to eth_addr_

2012-10-18 Thread Joe Perches
Convert the old ether_addr tests to eth_addr_.
Adds api consistency.

Signed-off-by: Joe Perches 
---
 drivers/net/wireless/adm8211.c |2 +-
 drivers/net/wireless/airo.c|4 ++--
 drivers/net/wireless/at76c50x-usb.c|8 
 drivers/net/wireless/ath/ath6kl/cfg80211.c |8 
 drivers/net/wireless/ath/ath6kl/main.c |8 
 drivers/net/wireless/ath/ath6kl/txrx.c |   10 +-
 drivers/net/wireless/ath/ath9k/recv.c  |8 
 drivers/net/wireless/b43/main.c|2 +-
 drivers/net/wireless/b43legacy/main.c  |2 +-
 .../net/wireless/brcm80211/brcmfmac/dhd_linux.c|4 ++--
 .../net/wireless/brcm80211/brcmfmac/wl_cfg80211.c  |2 +-
 .../net/wireless/brcm80211/brcmsmac/mac80211_if.c  |2 +-
 drivers/net/wireless/brcm80211/brcmsmac/main.c |   16 
 drivers/net/wireless/hostap/hostap_info.c  |2 +-
 drivers/net/wireless/hostap/hostap_ioctl.c |8 
 drivers/net/wireless/hostap/hostap_main.c  |2 +-
 drivers/net/wireless/ipw2x00/ipw2100.c |6 +++---
 drivers/net/wireless/ipw2x00/ipw2200.c |   18 +-
 drivers/net/wireless/ipw2x00/libipw_rx.c   |   12 ++--
 drivers/net/wireless/ipw2x00/libipw_tx.c   |4 ++--
 drivers/net/wireless/iwlegacy/3945-mac.c   |2 +-
 drivers/net/wireless/iwlegacy/4965-mac.c   |2 +-
 drivers/net/wireless/iwlegacy/common.c |2 +-
 drivers/net/wireless/iwlwifi/dvm/sta.c |2 +-
 drivers/net/wireless/libertas_tf/main.c|2 +-
 drivers/net/wireless/mwifiex/join.c|2 +-
 drivers/net/wireless/mwifiex/scan.c|2 +-
 drivers/net/wireless/mwifiex/sta_cmd.c |2 +-
 drivers/net/wireless/mwifiex/sta_cmdresp.c |2 +-
 drivers/net/wireless/mwifiex/uap_txrx.c|2 +-
 drivers/net/wireless/mwl8k.c   |2 +-
 drivers/net/wireless/orinoco/wext.c|4 ++--
 drivers/net/wireless/p54/eeprom.c  |2 +-
 drivers/net/wireless/rndis_wlan.c  |   18 +-
 drivers/net/wireless/rt2x00/rt2400pci.c|2 +-
 drivers/net/wireless/rt2x00/rt2500pci.c|2 +-
 drivers/net/wireless/rt2x00/rt2500usb.c|2 +-
 drivers/net/wireless/rt2x00/rt2800lib.c|8 
 drivers/net/wireless/rt2x00/rt61pci.c  |2 +-
 drivers/net/wireless/rt2x00/rt73usb.c  |2 +-
 drivers/net/wireless/rtl818x/rtl8180/dev.c |4 ++--
 drivers/net/wireless/rtl818x/rtl8187/dev.c |4 ++--
 drivers/net/wireless/rtlwifi/base.c|6 +++---
 drivers/net/wireless/rtlwifi/cam.c |2 +-
 drivers/net/wireless/rtlwifi/pci.c |8 
 drivers/net/wireless/rtlwifi/rc.c  |4 ++--
 drivers/net/wireless/rtlwifi/rtl8192ce/trx.c   |4 ++--
 drivers/net/wireless/rtlwifi/rtl8192cu/trx.c   |4 ++--
 drivers/net/wireless/rtlwifi/usb.c |   12 ++--
 drivers/net/wireless/ti/wl1251/main.c  |   12 ++--
 drivers/net/wireless/ti/wlcore/cmd.c   |2 +-
 drivers/net/wireless/ti/wlcore/main.c  |6 +++---
 drivers/net/wireless/ti/wlcore/tx.c|2 +-
 drivers/net/wireless/wl3501_cs.c   |2 +-
 drivers/net/wireless/zd1211rw/zd_mac.c |2 +-
 55 files changed, 133 insertions(+), 133 deletions(-)

diff --git a/drivers/net/wireless/adm8211.c b/drivers/net/wireless/adm8211.c
index 154a496..2fd62a0 100644
--- a/drivers/net/wireless/adm8211.c
+++ b/drivers/net/wireless/adm8211.c
@@ -1853,7 +1853,7 @@ static int __devinit adm8211_probe(struct pci_dev *pdev,
*(__le16 *)&perm_addr[4] =
cpu_to_le16(ADM8211_CSR_READ(PAR1) & 0x);
 
-   if (!is_valid_ether_addr(perm_addr)) {
+   if (!eth_addr_valid(perm_addr)) {
printk(KERN_WARNING "%s (adm8211): Invalid hwaddr in EEPROM!\n",
   pci_name(pdev));
eth_random_addr(perm_addr);
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index 3cd05a71..b0afd59 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -5986,8 +5986,8 @@ static int airo_set_wap(struct net_device *dev,
 
if (awrq->sa_family != ARPHRD_ETHER)
return -EINVAL;
-   else if (is_broadcast_ether_addr(awrq->sa_data) ||
-is_zero_ether_addr(awrq->sa_data)) {
+   else if (eth_addr_broadcast(awrq->sa_data) ||
+eth_addr_zero(awrq->sa_data)) {
memset(&cmd, 0, sizeof(cmd));
cmd.cmd=CMD_LOSE_SYNC;
if (down_interruptible(&lo

[PATCH net-next 03/21] arch: Convert is__ether_addr uses to eth_addr_

2012-10-18 Thread Joe Perches
Convert the old ether_addr tests to eth_addr_.
Adds api consistency.

Signed-off-by: Joe Perches 
---
 arch/arm/mach-davinci/board-mityomapl138.c |2 +-
 arch/arm/mach-pxa/colibri-pxa3xx.c |2 +-
 arch/avr32/boards/atngw100/setup.c |2 +-
 arch/avr32/boards/atstk1000/atstk1002.c|2 +-
 arch/avr32/boards/favr-32/setup.c  |2 +-
 arch/avr32/boards/hammerhead/setup.c   |2 +-
 arch/avr32/boards/merisc/setup.c   |2 +-
 arch/avr32/boards/mimc200/setup.c  |2 +-
 arch/mips/alchemy/common/platform.c|4 ++--
 arch/um/drivers/net_kern.c |6 +++---
 10 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/arch/arm/mach-davinci/board-mityomapl138.c 
b/arch/arm/mach-davinci/board-mityomapl138.c
index 43e4a0d..df45c9c 100644
--- a/arch/arm/mach-davinci/board-mityomapl138.c
+++ b/arch/arm/mach-davinci/board-mityomapl138.c
@@ -138,7 +138,7 @@ static void read_factory_config(struct memory_accessor *a, 
void *context)
}
 
pr_info("MityOMAPL138: Found MAC = %pM\n", factory_config.mac);
-   if (is_valid_ether_addr(factory_config.mac))
+   if (eth_addr_valid(factory_config.mac))
memcpy(soc_info->emac_pdata->mac_addr,
factory_config.mac, ETH_ALEN);
else
diff --git a/arch/arm/mach-pxa/colibri-pxa3xx.c 
b/arch/arm/mach-pxa/colibri-pxa3xx.c
index 8240291..839040c 100644
--- a/arch/arm/mach-pxa/colibri-pxa3xx.c
+++ b/arch/arm/mach-pxa/colibri-pxa3xx.c
@@ -52,7 +52,7 @@ void __init colibri_pxa3xx_init_eth(struct ax_plat_data 
*plat_data)
serial >>= 8;
}
 
-   if (is_valid_ether_addr(ether_mac_addr)) {
+   if (eth_addr_valid(ether_mac_addr)) {
plat_data->flags |= AXFLG_MAC_FROMPLATFORM;
plat_data->mac_addr = ether_mac_addr;
printk(KERN_INFO "%s(): taking MAC from serial boot tag\n",
diff --git a/arch/avr32/boards/atngw100/setup.c 
b/arch/avr32/boards/atngw100/setup.c
index afeae89..5f7d86d 100644
--- a/arch/avr32/boards/atngw100/setup.c
+++ b/arch/avr32/boards/atngw100/setup.c
@@ -175,7 +175,7 @@ static void __init set_hw_addr(struct platform_device *pdev)
return;
 
addr = hw_addr[pdev->id].addr;
-   if (!is_valid_ether_addr(addr))
+   if (!eth_addr_valid(addr))
return;
 
/*
diff --git a/arch/avr32/boards/atstk1000/atstk1002.c 
b/arch/avr32/boards/atstk1000/atstk1002.c
index 6c80aba..7334686 100644
--- a/arch/avr32/boards/atstk1000/atstk1002.c
+++ b/arch/avr32/boards/atstk1000/atstk1002.c
@@ -189,7 +189,7 @@ static void __init set_hw_addr(struct platform_device *pdev)
return;
 
addr = hw_addr[pdev->id].addr;
-   if (!is_valid_ether_addr(addr))
+   if (!eth_addr_valid(addr))
return;
 
/*
diff --git a/arch/avr32/boards/favr-32/setup.c 
b/arch/avr32/boards/favr-32/setup.c
index 27bd6fb..0b76aa7 100644
--- a/arch/avr32/boards/favr-32/setup.c
+++ b/arch/avr32/boards/favr-32/setup.c
@@ -196,7 +196,7 @@ static void __init set_hw_addr(struct platform_device *pdev)
return;
 
addr = hw_addr[pdev->id].addr;
-   if (!is_valid_ether_addr(addr))
+   if (!eth_addr_valid(addr))
return;
 
/*
diff --git a/arch/avr32/boards/hammerhead/setup.c 
b/arch/avr32/boards/hammerhead/setup.c
index 9d1efd1..d64fa9f 100644
--- a/arch/avr32/boards/hammerhead/setup.c
+++ b/arch/avr32/boards/hammerhead/setup.c
@@ -139,7 +139,7 @@ static void __init set_hw_addr(struct platform_device *pdev)
 
addr = hw_addr[pdev->id].addr;
 
-   if (!is_valid_ether_addr(addr))
+   if (!eth_addr_valid(addr))
return;
 
/*
diff --git a/arch/avr32/boards/merisc/setup.c b/arch/avr32/boards/merisc/setup.c
index ed137e3..817d2d8 100644
--- a/arch/avr32/boards/merisc/setup.c
+++ b/arch/avr32/boards/merisc/setup.c
@@ -129,7 +129,7 @@ static void __init set_hw_addr(struct platform_device *pdev)
return;
 
addr = hw_addr[pdev->id].addr;
-   if (!is_valid_ether_addr(addr))
+   if (!eth_addr_valid(addr))
return;
 
regs = (void __iomem __force *)res->start;
diff --git a/arch/avr32/boards/mimc200/setup.c 
b/arch/avr32/boards/mimc200/setup.c
index 05358aa..31cd87e 100644
--- a/arch/avr32/boards/mimc200/setup.c
+++ b/arch/avr32/boards/mimc200/setup.c
@@ -152,7 +152,7 @@ static void __init set_hw_addr(struct platform_device *pdev)
return;
 
addr = hw_addr[pdev->id].addr;
-   if (!is_valid_ether_addr(addr))
+   if (!eth_addr_valid(addr))
return;
 
/*
diff --git a/arch/mips/alchemy/common/platform.c 
b/arch/mips/alchemy/common/platform.c
index c0f3ce6..5f07da3 100644
--- a/arch/mips/alchemy/common/platform.c
+++ b/arch/mips/alchemy/common/platform.c
@@ -343,7 +343,7 @@ static void __init alchemy_setup_macs(int ctype)
au1xxx

[PATCH net-next 02/21] net: Convert is__ether_addr uses to eth_addr_

2012-10-18 Thread Joe Perches
Convert the old ether_addr tests to eth_addr_.
Adds api consistency.

Signed-off-by: Joe Perches 
---
 net/802/stp.c  |4 +-
 net/8021q/vlan_dev.c   |6 ++--
 net/8021q/vlan_netlink.c   |2 +-
 net/batman-adv/bat_iv_ogm.c|2 +-
 net/batman-adv/bridge_loop_avoidance.c |8 ++--
 net/batman-adv/routing.c   |   20 ++--
 net/batman-adv/soft-interface.c|4 +-
 net/batman-adv/unicast.c   |2 +-
 net/batman-adv/vis.c   |4 +-
 net/bridge/br_device.c |6 ++--
 net/bridge/br_fdb.c|2 +-
 net/bridge/br_if.c |2 +-
 net/bridge/br_input.c  |8 ++--
 net/bridge/br_netlink.c|2 +-
 net/core/pktgen.c  |4 +-
 net/core/rtnetlink.c   |2 +-
 net/dsa/slave.c|2 +-
 net/ethernet/eth.c |6 ++--
 net/ipv4/ip_gre.c  |2 +-
 net/ipv6/ip6_gre.c |2 +-
 net/mac80211/cfg.c |2 +-
 net/mac80211/ibss.c|8 ++--
 net/mac80211/ieee80211_i.h |2 +-
 net/mac80211/iface.c   |   12 
 net/mac80211/mesh.c|2 +-
 net/mac80211/mesh_hwmp.c   |4 +-
 net/mac80211/mesh_pathtbl.c|4 +-
 net/mac80211/mesh_plink.c  |2 +-
 net/mac80211/mlme.c|4 +-
 net/mac80211/rx.c  |   50 
 net/mac80211/sta_info.c|2 +-
 net/mac80211/status.c  |6 ++--
 net/mac80211/tx.c  |   22 +++---
 net/mac80211/wme.c |4 +-
 net/openvswitch/flow.c |4 +-
 net/openvswitch/vport-internal_dev.c   |2 +-
 net/wireless/core.c|2 +-
 net/wireless/ibss.c|2 +-
 net/wireless/nl80211.c |4 +-
 net/wireless/util.c|4 +-
 net/wireless/wext-compat.c |2 +-
 net/wireless/wext-sme.c|2 +-
 42 files changed, 118 insertions(+), 118 deletions(-)

diff --git a/net/802/stp.c b/net/802/stp.c
index 2c40ba0..80a253c 100644
--- a/net/802/stp.c
+++ b/net/802/stp.c
@@ -74,7 +74,7 @@ int stp_proto_register(const struct stp_proto *proto)
goto out;
}
}
-   if (is_zero_ether_addr(proto->group_address))
+   if (eth_addr_zero(proto->group_address))
rcu_assign_pointer(stp_proto, proto);
else
rcu_assign_pointer(garp_protos[proto->group_address[5] -
@@ -88,7 +88,7 @@ EXPORT_SYMBOL_GPL(stp_proto_register);
 void stp_proto_unregister(const struct stp_proto *proto)
 {
mutex_lock(&stp_proto_mutex);
-   if (is_zero_ether_addr(proto->group_address))
+   if (eth_addr_zero(proto->group_address))
RCU_INIT_POINTER(stp_proto, NULL);
else
RCU_INIT_POINTER(garp_protos[proto->group_address[5] -
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 4024424..5c330c9 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -352,7 +352,7 @@ static int vlan_dev_set_mac_address(struct net_device *dev, 
void *p)
struct sockaddr *addr = p;
int err;
 
-   if (!is_valid_ether_addr(addr->sa_data))
+   if (!eth_addr_valid(addr->sa_data))
return -EADDRNOTAVAIL;
 
if (!(dev->flags & IFF_UP))
@@ -559,9 +559,9 @@ static int vlan_dev_init(struct net_device *dev)
/* ipv6 shared card related stuff */
dev->dev_id = real_dev->dev_id;
 
-   if (is_zero_ether_addr(dev->dev_addr))
+   if (eth_addr_zero(dev->dev_addr))
memcpy(dev->dev_addr, real_dev->dev_addr, dev->addr_len);
-   if (is_zero_ether_addr(dev->broadcast))
+   if (eth_addr_zero(dev->broadcast))
memcpy(dev->broadcast, real_dev->broadcast, dev->addr_len);
 
 #if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
diff --git a/net/8021q/vlan_netlink.c b/net/8021q/vlan_netlink.c
index 708c80e..c79bba9 100644
--- a/net/8021q/vlan_netlink.c
+++ b/net/8021q/vlan_netlink.c
@@ -46,7 +46,7 @@ static int vlan_validate(struct nlattr *tb[], struct nlattr 
*data[])
if (tb[IFLA_ADDRESS]) {
if (nla_len(tb[IFLA_ADDRESS]) != ETH_ALEN)
return -EINVAL;
-   if (!is_valid_ether_addr(nla_data(tb[IFLA_ADDRESS])))
+   if (!eth_addr_valid(nla_data(tb[IFLA_ADDRESS])))
return -EADDRNOTAVAIL;
}
 
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index b02b75d..5e07dbc 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -1056,7 +1056,7 @@ static void batadv_iv_og

[PATCH net-next 00/21] treewide: Use consistent api style for address testing

2012-10-18 Thread Joe Perches
ethernet, ipv4, and ipv6 address testing uses 3 different api naming styles.

ethernet uses:  is__ether_addr
ipv4 uses:  ipv4_is_
ipv6 uses:  ipv6_addr_

Standardize on the ipv6 style of _addr_ to reduce
the number of styles to remember.

The new consistent styles are:

eth_addr_(const u8 *)
ipv4_addr_(__be32)
ipv6_addr_(const struct in6_addr *)

Add temporary backward compatibility #defines for the old names too.

Joe Perches (21):
  etherdevice: Rename is__ether_addr tests to eth_addr_
  net: Convert is__ether_addr uses to eth_addr_
  arch: Convert is__ether_addr uses to eth_addr_
  wireless: Convert is__ether_addr uses to eth_addr_
  drivers: net: Convert is__ether_addr uses to eth_addr_
  staging: Convert is__ether_addr uses to eth_addr_
  infiniband: Convert is__ether_addr uses to eth_addr_
  scsi: Convert is__ether_addr uses to eth_addr_
  of: Convert is__ether_addr uses to eth_addr_
  s390: Convert is__ether_addr uses to eth_addr_
  usb: Convert is__ether_addr uses to eth_addr_
  uwb: Convert is__ether_addr uses to eth_addr_
  Documentation: networking: Convert is__ether_addr uses to eth_addr_
  llc_if.h: Convert is__ether_addr uses to eth_addr_
  in.h: Rename ipv4_is_ functions to ipv4_addr_
  net: Convert ipv4_is_ uses to ipv4_addr_
  infiniband: Convert ipv4_is_ uses to ipv4_addr_
  ath6kl: Convert ipv4_is_ uses to ipv4_addr_
  parisc: Convert ipv4_is_ uses to ipv4_addr_
  lockd: Convert ipv4_is_ uses to ipv4_addr_
  sctp: Convert ipv4_is_ uses to ipv4_addr_

 Documentation/networking/driver.txt|2 +-
 arch/arm/mach-davinci/board-mityomapl138.c |2 +-
 arch/arm/mach-pxa/colibri-pxa3xx.c |2 +-
 arch/avr32/boards/atngw100/setup.c |2 +-
 arch/avr32/boards/atstk1000/atstk1002.c|2 +-
 arch/avr32/boards/favr-32/setup.c  |2 +-
 arch/avr32/boards/hammerhead/setup.c   |2 +-
 arch/avr32/boards/merisc/setup.c   |2 +-
 arch/avr32/boards/mimc200/setup.c  |2 +-
 arch/mips/alchemy/common/platform.c|4 +-
 arch/um/drivers/net_kern.c |6 +-
 drivers/infiniband/core/cma.c  |4 +-
 drivers/infiniband/hw/amso1100/c2.c|2 +-
 drivers/infiniband/hw/nes/nes_nic.c|2 +-
 drivers/net/bonding/bond_3ad.c |2 +-
 drivers/net/bonding/bond_alb.c |2 +-
 drivers/net/bonding/bond_main.c|6 +-
 drivers/net/dummy.c|2 +-
 drivers/net/ethernet/3com/3c59x.c  |2 +-
 drivers/net/ethernet/3com/typhoon.c|2 +-
 drivers/net/ethernet/8390/etherh.c |2 +-
 drivers/net/ethernet/adi/bfin_mac.c|6 +-
 drivers/net/ethernet/aeroflex/greth.c  |4 +-
 drivers/net/ethernet/amd/au1000_eth.c  |2 +-
 drivers/net/ethernet/amd/depca.c   |4 +-
 drivers/net/ethernet/amd/pcnet32.c |8 ++--
 drivers/net/ethernet/atheros/atl1c/atl1c_hw.c  |2 +-
 drivers/net/ethernet/atheros/atl1c/atl1c_main.c|2 +-
 drivers/net/ethernet/atheros/atl1e/atl1e_hw.c  |4 +-
 drivers/net/ethernet/atheros/atl1e/atl1e_main.c|2 +-
 drivers/net/ethernet/atheros/atlx/atl1.c   |   10 ++--
 drivers/net/ethernet/atheros/atlx/atl2.c   |   14 +++---
 drivers/net/ethernet/atheros/atlx/atlx.c   |2 +-
 drivers/net/ethernet/broadcom/b44.c|4 +-
 drivers/net/ethernet/broadcom/bnx2.c   |2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c|6 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h|4 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c   |6 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c |2 +-
 drivers/net/ethernet/broadcom/cnic.c   |2 +-
 drivers/net/ethernet/broadcom/tg3.c|6 +-
 drivers/net/ethernet/brocade/bna/bnad.c|6 +-
 drivers/net/ethernet/cadence/at91_ether.c  |6 +-
 drivers/net/ethernet/cadence/macb.c|4 +-
 drivers/net/ethernet/calxeda/xgmac.c   |6 +-
 drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c|2 +-
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c|2 +-
 .../net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c|2 +-
 drivers/net/ethernet/cirrus/ep93xx_eth.c   |2 +-
 drivers/net/ethernet/cirrus/mac89x0.c  |2 +-
 drivers/net/ethernet/cisco/enic/enic_dev.c |4 +-
 drivers/net/ethernet/cisco/enic/enic_main.c|   10 ++--
 drivers/net/ethernet/cisco/enic/enic_pp.c  |   10 ++--
 drivers/net/ethernet/davicom/dm9000.c  |6 +-
 drivers/net/ethernet/dec/ewrk3.c   |4 +-
 drivers/net/ethernet/dec/tulip/de4x5.c |4 +-
 drivers/net/

[PATCH net-next 01/21] etherdevice: Rename is__ether_addr tests to eth_addr_

2012-10-18 Thread Joe Perches
Make the ether_addr tests use a similar style to ipv6_ tests.
Add backward compatibility #defines to keep current is__ether_addr
code working until completely converted.

Signed-off-by: Joe Perches 
---
 include/linux/etherdevice.h |   36 ++--
 1 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index b006ba0..969efa5 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -52,63 +52,63 @@ extern struct net_device *alloc_etherdev_mqs(int 
sizeof_priv, unsigned int txqs,
 #define alloc_etherdev_mq(sizeof_priv, count) alloc_etherdev_mqs(sizeof_priv, 
count, count)
 
 /**
- * is_zero_ether_addr - Determine if give Ethernet address is all zeros.
+ * eth_addr_zero - Determine if give Ethernet address is all zeros.
  * @addr: Pointer to a six-byte array containing the Ethernet address
  *
  * Return true if the address is all zeroes.
  */
-static inline bool is_zero_ether_addr(const u8 *addr)
+static inline bool eth_addr_zero(const u8 *addr)
 {
return !(addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5]);
 }
 
 /**
- * is_multicast_ether_addr - Determine if the Ethernet address is a multicast.
+ * eth_addr_multicast - Determine if the Ethernet address is a multicast.
  * @addr: Pointer to a six-byte array containing the Ethernet address
  *
  * Return true if the address is a multicast address.
  * By definition the broadcast address is also a multicast address.
  */
-static inline bool is_multicast_ether_addr(const u8 *addr)
+static inline bool eth_addr_multicast(const u8 *addr)
 {
return 0x01 & addr[0];
 }
 
 /**
- * is_local_ether_addr - Determine if the Ethernet address is locally-assigned 
one (IEEE 802).
+ * eth_addr_local - Determine if the Ethernet address is locally-assigned one 
(IEEE 802).
  * @addr: Pointer to a six-byte array containing the Ethernet address
  *
  * Return true if the address is a local address.
  */
-static inline bool is_local_ether_addr(const u8 *addr)
+static inline bool eth_addr_local(const u8 *addr)
 {
return 0x02 & addr[0];
 }
 
 /**
- * is_broadcast_ether_addr - Determine if the Ethernet address is broadcast
+ * eth_addr_broadcast - Determine if the Ethernet address is broadcast
  * @addr: Pointer to a six-byte array containing the Ethernet address
  *
  * Return true if the address is the broadcast address.
  */
-static inline bool is_broadcast_ether_addr(const u8 *addr)
+static inline bool eth_addr_broadcast(const u8 *addr)
 {
return (addr[0] & addr[1] & addr[2] & addr[3] & addr[4] & addr[5]) == 
0xff;
 }
 
 /**
- * is_unicast_ether_addr - Determine if the Ethernet address is unicast
+ * eth_addr_unicast - Determine if the Ethernet address is unicast
  * @addr: Pointer to a six-byte array containing the Ethernet address
  *
  * Return true if the address is a unicast address.
  */
-static inline bool is_unicast_ether_addr(const u8 *addr)
+static inline bool eth_addr_unicast(const u8 *addr)
 {
-   return !is_multicast_ether_addr(addr);
+   return !eth_addr_multicast(addr);
 }
 
 /**
- * is_valid_ether_addr - Determine if the given Ethernet address is valid
+ * eth_addr_valid - Determine if the given Ethernet address is valid
  * @addr: Pointer to a six-byte array containing the Ethernet address
  *
  * Check that the Ethernet address (MAC) is not 00:00:00:00:00:00, is not
@@ -116,13 +116,21 @@ static inline bool is_unicast_ether_addr(const u8 *addr)
  *
  * Return true if the address is valid.
  */
-static inline bool is_valid_ether_addr(const u8 *addr)
+static inline bool eth_addr_valid(const u8 *addr)
 {
/* FF:FF:FF:FF:FF:FF is a multicast address so we don't need to
 * explicitly check for it here. */
-   return !is_multicast_ether_addr(addr) && !is_zero_ether_addr(addr);
+   return !eth_addr_multicast(addr) && !eth_addr_zero(addr);
 }
 
+/* Some #defines to make old is__ether_addr tests work for awhile */
+#define is_zero_ether_addr(addr)   eth_addr_zero(addr)
+#define is_multicast_ether_addr(addr)  eth_addr_multicast(addr)
+#define is_local_ether_addr(addr)  eth_addr_local(addr)
+#define is_broadcast_ether_addr(addr)  eth_addr_broadcast(addr)
+#define is_unicast_ether_addr(addr)eth_addr_unicast(addr)
+#define is_valid_ether_addr(addr)  eth_addr_valid(addr)
+
 /**
  * eth_random_addr - Generate software assigned random Ethernet address
  * @addr: Pointer to a six-byte array containing the Ethernet address
-- 
1.7.8.111.gad25c.dirty

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH net-next] pktgen: Use ipv6_addr_any

2012-10-18 Thread Joe Perches
Use the standard test for a non-zero ipv6 address.

Signed-off-by: Joe Perches 
---
 net/core/pktgen.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index d1dc14c..1d1c216 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -2427,11 +2427,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
}
} else {/* IPV6 * */
 
-   if (pkt_dev->min_in6_daddr.s6_addr32[0] == 0 &&
-   pkt_dev->min_in6_daddr.s6_addr32[1] == 0 &&
-   pkt_dev->min_in6_daddr.s6_addr32[2] == 0 &&
-   pkt_dev->min_in6_daddr.s6_addr32[3] == 0) ;
-   else {
+   if (!ipv6_addr_any(&pkt_dev->min_in6_daddr)) {
int i;
 
/* Only random destinations yet */
-- 
1.8.0.rc2.dirty

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC PATCH v1 1/3] mm: teach mm by current context info to not do I/O during memory allocation

2012-10-18 Thread Ming Lei
On Thu, Oct 18, 2012 at 7:54 AM, Andrew Morton
 wrote:
>
> local_irq_save() and local_irq_restore() were mistakes :( It's silly to
> write what appears to be a C function and then have it operate like
> Pascal (warning: I last wrote some Pascal in 66 B.C.).

Considered that spin_lock_irqsave/spin_unlock_irqrestore also follow
the style, kernel guys have been accustomed to the usage, I am
inclined to keep that as macro, :-)

>> IMO, renaming as memalloc_noio_set() might not be better than _save
>> because the _set name doesn't indicate that the flag should be stored first.
>
> You could add __must_check to the function definition to ensure that
> all callers save its return value.

Yes, we can do that, but the function name is not better than _save
from readability.

Thanks,
--
Ming Lei
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[ 03/62] NFSD: pass null terminated buf to kstrtouint()

2012-10-18 Thread Greg Kroah-Hartman
3.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Malahal Naineni 

commit 9959ba0c241a71c7ed8133401cfbbee2720da0b5 upstream.

The 'buf' is prepared with null termination with intention of using it for
this purpose, but 'name' is passed instead!

Signed-off-by: Malahal Naineni 
Signed-off-by: J. Bruce Fields 
Signed-off-by: Greg Kroah-Hartman 

---
 fs/nfsd/nfs4idmap.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/fs/nfsd/nfs4idmap.c
+++ b/fs/nfsd/nfs4idmap.c
@@ -581,7 +581,7 @@ numeric_name_to_id(struct svc_rqst *rqst
/* Just to make sure it's null-terminated: */
memcpy(buf, name, namelen);
buf[namelen] = '\0';
-   ret = kstrtouint(name, 10, id);
+   ret = kstrtouint(buf, 10, id);
return ret == 0;
 }
 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[ 01/62] ARM: vfp: fix saving d16-d31 vfp registers on v6+ kernels

2012-10-18 Thread Greg Kroah-Hartman
3.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Russell King 

commit 846a136881b8f73c1f74250bf6acfaa309cab1f2 upstream.

Michael Olbrich reported that his test program fails when built with
-O2 -mcpu=cortex-a8 -mfpu=neon, and a kernel which supports v6 and v7
CPUs:

volatile int x = 2;
volatile int64_t y = 2;

int main() {
volatile int a = 0;
volatile int64_t b = 0;
while (1) {
a = (a + x) % (1 << 30);
b = (b + y) % (1 << 30);
assert(a == b);
}
}

and two instances are run.  When built for just v7 CPUs, this program
works fine.  It uses the "vadd.i64 d19, d18, d16" VFP instruction.

It appears that we do not save the high-16 double VFP registers across
context switches when the kernel is built for v6 CPUs.  Fix that.

Tested-By: Michael Olbrich 
Signed-off-by: Russell King 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/arm/include/asm/vfpmacros.h |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/arch/arm/include/asm/vfpmacros.h
+++ b/arch/arm/include/asm/vfpmacros.h
@@ -28,7 +28,7 @@
ldr \tmp, =elf_hwcap@ may not have MVFR regs
ldr \tmp, [\tmp, #0]
tst \tmp, #HWCAP_VFPv3D16
-   ldceq   p11, cr0, [\base],#32*4 @ FLDMIAD \base!, {d16-d31}
+   ldceql  p11, cr0, [\base],#32*4 @ FLDMIAD \base!, {d16-d31}
addne   \base, \base, #32*4 @ step over unused register 
space
 #else
VFPFMRX \tmp, MVFR0 @ Media and VFP Feature 
Register 0
@@ -52,7 +52,7 @@
ldr \tmp, =elf_hwcap@ may not have MVFR regs
ldr \tmp, [\tmp, #0]
tst \tmp, #HWCAP_VFPv3D16
-   stceq   p11, cr0, [\base],#32*4 @ FSTMIAD \base!, {d16-d31}
+   stceql  p11, cr0, [\base],#32*4 @ FSTMIAD \base!, {d16-d31}
addne   \base, \base, #32*4 @ step over unused register 
space
 #else
VFPFMRX \tmp, MVFR0 @ Media and VFP Feature 
Register 0


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[ 04/62] lockd: use rpc clients cl_nodename for id encoding

2012-10-18 Thread Greg Kroah-Hartman
3.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Stanislav Kinsbursky 

commit 303a7ce92064c285a04c870f2dc0192fdb2968cb upstream.

Taking hostname from uts namespace if not safe, because this cuold be
performind during umount operation on child reaper death. And in this case
current->nsproxy is NULL already.

Signed-off-by: Stanislav Kinsbursky 
Signed-off-by: Trond Myklebust 
Signed-off-by: Greg Kroah-Hartman 

---
 fs/lockd/mon.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/fs/lockd/mon.c
+++ b/fs/lockd/mon.c
@@ -40,6 +40,7 @@ struct nsm_args {
u32 proc;
 
char*mon_name;
+   char*nodename;
 };
 
 struct nsm_res {
@@ -94,6 +95,7 @@ static int nsm_mon_unmon(struct nsm_hand
.vers   = 3,
.proc   = NLMPROC_NSM_NOTIFY,
.mon_name   = nsm->sm_mon_name,
+   .nodename   = utsname()->nodename,
};
struct rpc_message msg = {
.rpc_argp   = &args,
@@ -430,7 +432,7 @@ static void encode_my_id(struct xdr_stre
 {
__be32 *p;
 
-   encode_nsm_string(xdr, utsname()->nodename);
+   encode_nsm_string(xdr, argp->nodename);
p = xdr_reserve_space(xdr, 4 + 4 + 4);
*p++ = cpu_to_be32(argp->prog);
*p++ = cpu_to_be32(argp->vers);


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[ 08/62] ALSA: hda - Fix memory leaks at error path in patch_cirrus.c

2012-10-18 Thread Greg Kroah-Hartman
3.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Takashi Iwai 

commit c5e0b6dbad9b4d18c561af90b384d02373f1c994 upstream.

The proper destructor should be called at the error path.

Signed-off-by: Takashi Iwai 
Signed-off-by: Greg Kroah-Hartman 

---
 sound/pci/hda/patch_cirrus.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/sound/pci/hda/patch_cirrus.c
+++ b/sound/pci/hda/patch_cirrus.c
@@ -1427,7 +1427,7 @@ static int patch_cs420x(struct hda_codec
return 0;
 
  error:
-   kfree(codec->spec);
+   cs_free(codec);
codec->spec = NULL;
return err;
 }
@@ -1984,7 +1984,7 @@ static int patch_cs4210(struct hda_codec
return 0;
 
  error:
-   kfree(codec->spec);
+   cs_free(codec);
codec->spec = NULL;
return err;
 }
@@ -2009,7 +2009,7 @@ static int patch_cs4213(struct hda_codec
return 0;
 
  error:
-   kfree(codec->spec);
+   cs_free(codec);
codec->spec = NULL;
return err;
 }


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[ 12/62] iscsi-target: Correctly set 0xffffffff field within ISCSI_OP_REJECT PDU

2012-10-18 Thread Greg Kroah-Hartman
3.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Nicholas Bellinger 

commit f25590f39d543272f7ae7b00d533359c8d7ff331 upstream.

This patch adds a missing iscsi_reject-> assignment within
iscsit_send_reject() code to properly follow RFC-3720 Section 10.17
Bytes 16 -> 19 for the PDU format definition of ISCSI_OP_REJECT.

We've not seen any initiators care about this bytes in practice, but
as Ronnie reported this was causing trouble with wireshark packet
decoding lets go ahead and fix this up now.

Reported-by: Ronnie Sahlberg 
Signed-off-by: Nicholas Bellinger 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/target/iscsi/iscsi_target.c |1 +
 1 file changed, 1 insertion(+)

--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -3349,6 +3349,7 @@ static int iscsit_send_reject(
hdr->opcode = ISCSI_OP_REJECT;
hdr->flags  |= ISCSI_FLAG_CMD_FINAL;
hton24(hdr->dlength, ISCSI_HDR_LEN);
+   hdr->   = 0x;
cmd->stat_sn= conn->stat_sn++;
hdr->statsn = cpu_to_be32(cmd->stat_sn);
hdr->exp_cmdsn  = cpu_to_be32(conn->sess->exp_cmd_sn);


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[ 13/62] iscsit: remove incorrect unlock in iscsit_build_sendtargets_resp

2012-10-18 Thread Greg Kroah-Hartman
3.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Christoph Hellwig 

commit 904753da183566c71211d23c169a80184648c121 upstream.

Fix a potential multiple spin-unlock -> deadlock scenario during the
overflow check within iscsit_build_sendtargets_resp() as found by
sparse static checking.

Signed-off-by: Christoph Hellwig 
Signed-off-by: Nicholas Bellinger 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/target/iscsi/iscsi_target.c |1 -
 1 file changed, 1 deletion(-)

--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -3196,7 +3196,6 @@ static int iscsit_build_sendtargets_resp
len += 1;
 
if ((len + payload_len) > buffer_len) {
-   spin_unlock(&tiqn->tiqn_tpg_lock);
end_of_buf = 1;
goto eob;
}


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[ 09/62] mips,kgdb: fix recursive page fault with CONFIG_KPROBES

2012-10-18 Thread Greg Kroah-Hartman
3.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Jason Wessel 

commit f0a996eeeda214f4293e234df33b29bec003b536 upstream.

This fault was detected using the kgdb test suite on boot and it
crashes recursively due to the fact that CONFIG_KPROBES on mips adds
an extra die notifier in the page fault handler.  The crash signature
looks like this:

kgdbts:RUN bad memory access test
KGDB: re-enter exception: ALL breakpoints killed
Call Trace:
[<807b7548>] dump_stack+0x20/0x54
[<807b7548>] dump_stack+0x20/0x54

The fix for now is to have kgdb return immediately if the fault type
is DIE_PAGE_FAULT and allow the kprobe code to decide what is supposed
to happen.

Signed-off-by: Jason Wessel 
Cc: Masami Hiramatsu 
Cc: David S. Miller 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/mips/kernel/kgdb.c |9 +
 1 file changed, 9 insertions(+)

--- a/arch/mips/kernel/kgdb.c
+++ b/arch/mips/kernel/kgdb.c
@@ -283,6 +283,15 @@ static int kgdb_mips_notify(struct notif
struct pt_regs *regs = args->regs;
int trap = (regs->cp0_cause & 0x7c) >> 2;
 
+#ifdef CONFIG_KPROBES
+   /*
+* Return immediately if the kprobes fault notifier has set
+* DIE_PAGE_FAULT.
+*/
+   if (cmd == DIE_PAGE_FAULT)
+   return NOTIFY_DONE;
+#endif /* CONFIG_KPROBES */
+
/* Userspace events, ignore. */
if (user_mode(regs))
return NOTIFY_DONE;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[ 06/62] ACPI: EC: Add a quirk for CLEVO M720T/M730T laptop

2012-10-18 Thread Greg Kroah-Hartman
3.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Feng Tang 

commit 67bfa9b60bd689601554526d144b21d529f78a09 upstream.

By enlarging the GPE storm threshold back to 20, that laptop's
EC works fine with interrupt mode instead of polling mode.

https://bugzilla.kernel.org/show_bug.cgi?id=45151

Reported-and-Tested-by: Francesco 
Signed-off-by: Feng Tang 
Signed-off-by: Len Brown 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/acpi/ec.c |   16 +++-
 1 file changed, 15 insertions(+), 1 deletion(-)

--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -930,6 +930,17 @@ static int ec_flag_msi(const struct dmi_
return 0;
 }
 
+/*
+ * Clevo M720 notebook actually works ok with IRQ mode, if we lifted
+ * the GPE storm threshold back to 20
+ */
+static int ec_enlarge_storm_threshold(const struct dmi_system_id *id)
+{
+   pr_debug("Setting the EC GPE storm threshold to 20\n");
+   ec_storm_threshold  = 20;
+   return 0;
+}
+
 static struct dmi_system_id __initdata ec_dmi_table[] = {
{
ec_skip_dsdt_scan, "Compal JFL92", {
@@ -961,10 +972,13 @@ static struct dmi_system_id __initdata e
{
ec_validate_ecdt, "ASUS hardware", {
DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer Inc.") }, NULL},
+   {
+   ec_enlarge_storm_threshold, "CLEVO hardware", {
+   DMI_MATCH(DMI_SYS_VENDOR, "CLEVO Co."),
+   DMI_MATCH(DMI_PRODUCT_NAME, "M720T/M730T"),}, NULL},
{},
 };
 
-
 int __init acpi_ec_ecdt_probe(void)
 {
acpi_status status;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[ 02/62] nfsd4: fix nfs4 stateid leak

2012-10-18 Thread Greg Kroah-Hartman
3.4-stable review patch.  If anyone has any objections, please let me know.

--

From: "J. Bruce Fields" 

commit cf9182e90b2af04245ac4fae497fe73fc71285b4 upstream.

Processes that open and close multiple files may end up setting this
oo_last_closed_stid without freeing what was previously pointed to.
This can result in a major leak, visible for example by watching the
nfsd4_stateids line of /proc/slabinfo.

Reported-by: Cyril B. 
Tested-by: Cyril B. 
Signed-off-by: J. Bruce Fields 
Signed-off-by: Greg Kroah-Hartman 

---
 fs/nfsd/nfs4state.c |1 +
 1 file changed, 1 insertion(+)

--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -3783,6 +3783,7 @@ nfsd4_close(struct svc_rqst *rqstp, stru
memcpy(&close->cl_stateid, &stp->st_stid.sc_stateid, sizeof(stateid_t));
 
nfsd4_close_open_stateid(stp);
+   release_last_closed_stateid(oo);
oo->oo_last_closed_stid = stp;
 
/* place unused nfs4_stateowners on so_close_lru list to be


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[ 00/62] 3.4.15-stable review

2012-10-18 Thread Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.4.15 release.
There are 62 patches in this series, all will be posted as a response
to this one.  If anyone has any issues with these being applied, please
let me know.

Responses should be made by Sun Oct 21 02:42:38 UTC 2012.
Anything received after that time might be too late.

The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.4.15-rc1.gz
and the diffstat can be found below.

thanks,

greg k-h

-
Pseudo-Shortlog of commits:

Maxim Kachur 
ALSA: emu10k1: add chip details for E-mu 1010 PCIe card

Takashi Iwai 
ALSA: ac97 - Fix missing NULL check in snd_ac97_cvol_new()

Peter Ujfalusi 
ASoC: omap-abe-twl6040: Fix typo of Vibrator

Mark Brown 
ASoC: wm2200: Fix non-inverted OUT2 mute control

Mark Brown 
ASoC: wm2200: Use rev A register patches on rev B

Guennadi Liakhovetski 
ASoC: fsi: don't reschedule DMA from an atomic context

David Henningsson 
ALSA: hda - Always check array bounds in alc_get_line_out_pfx

Fabio Porcedda 
usb: gadget: at91_udc: fix dt support

Tyler Hicks 
eCryptfs: Call lower ->flush() from ecryptfs_flush()

Tyler Hicks 
eCryptfs: Write out all dirty pages just before releasing the lower file

Tyler Hicks 
eCryptfs: Revert to a writethrough cache model

Tyler Hicks 
eCryptfs: Initialize empty lower files when opening them

Tyler Hicks 
eCryptfs: Unlink lower inode when ecryptfs_create() fails

Peter Huewe 
tpm: Propagate error from tpm_transmit to fix a timeout hang

Hiroaki SHIMODA 
e1000e: Change wthresh to 1 to avoid possible Tx stalls

Jan Kara 
jbd: Fix assertion failure in commit code due to lacking transaction credits

Jani Nikula 
drm/i915: use adjusted_mode instead of mode for checking the 6bpc force flag

Egbert Eich 
drm/radeon: Don't destroy I2C Bus Rec in radeon_ext_tmds_enc_destroy().

Jean-Christian de Rivaz 
Add CDC-ACM support for the CX93010-2x UCMxx USB Modem

Jan Engelhardt 
netfilter: xt_limit: have r->cost != 0 case work

Florian Westphal 
netfilter: limit, hashlimit: avoid duplicated inline

Pablo Neira Ayuso 
netfilter: nf_ct_expect: fix possible access to uninitialized timer

Patrick McHardy 
netfilter: nf_nat_sip: fix via header translation with multiple parameters

Pablo Neira Ayuso 
netfilter: nf_nat_sip: fix incorrect handling of EBUSY for RTCP expectation

Lin Ming 
ipvs: fix oops on NAT reply in br_nf context

Jozsef Kadlecsik 
netfilter: ipset: timeout fixing bug broke SET target special timeout value

Jozsef Kadlecsik 
netfilter: ipset: fix timeout value overflow bug

Pablo Neira Ayuso 
netfilter: nf_conntrack: fix racy timer handling with reliable events

Julian Anastasov 
ipvs: fix oops in ip_vs_dst_event on rmmod

Amerigo Wang 
pktgen: fix crash when generating IPv6 packets

Jason Wessel 
kdb,vt_console: Fix missed data due to pager overruns

Dan Carpenter 
md/raid10: use correct limit variable

Felix Fietkau 
ath9k: use ieee80211_free_txskb

Hildner, Christian 
timers: Fix endless looping between cascade() and internal_add_timer()

Daniel Drake 
viafb: don't touch clock state on OLPC XO-1.5

Alexander Holler 
video/udlfb: fix line counting in fb_write

Matthew Garrett 
module: taint kernel when lve module is loaded

Ian Kent 
autofs4 - fix reset pending flag on mount fail

Tejun Heo 
block: fix request_queue->flags initialization

Konrad Rzeszutek Wilk 
xen/bootup: allow read_tscp call for Xen PV guests.

Konrad Rzeszutek Wilk 
xen/bootup: allow {read|write}_cr8 pvops call.

Peter Senna Tschudin 
target: fix return code in target_core_init_configfs error path

Trond Myklebust 
SUNRPC: Ensure that the TCP socket is closed when in CLOSE_WAIT

Stefan Richter 
firewire: cdev: fix user memory corruption (i386 userland on amd64 kernel)

Simon Horman 
ARM: 7541/1: Add ARM ERRATA 775420 workaround

Lukas Czerner 
SCSI: scsi_debug: Fix off-by-one bug when unmapping region

K. Y. Srinivasan 
SCSI: storvsc: Account for in-transit packets in the RESET path

Nicholas Bellinger 
iscsi-target: Bump defaults for nopin_timeout + nopin_response_timeout 
values

Nicholas Bellinger 
iscsi-target: Add explicit set of cache_dynamic_acls=1 for TPG demo-mode

Christoph Hellwig 
iscsit: remove incorrect unlock in iscsit_build_sendtargets_resp

Nicholas Bellinger 
iscsi-target: Correctly set 0x field within ISCSI_OP_REJECT PDU

Stephen M. Cameron 
SCSI: hpsa: dial down lockup detection during firmware flash

Hugh Dickins 
tmpfs,ceph,gfs2,isofs,reiserfs,xfs: fix fh_len checking

Jason Wessel 
mips,kgdb: fix recursive page fault with CONFIG_KPROBES

Takashi Iwai 
ALSA: hda - Fix memory leaks at error path in patch_cirrus.c

David Henningsson 
ALSA: hda - do not detect jack on internal speakers for Realtek

Feng Tang 

[ 10/62] tmpfs,ceph,gfs2,isofs,reiserfs,xfs: fix fh_len checking

2012-10-18 Thread Greg Kroah-Hartman
3.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Hugh Dickins 

commit 35c2a7f4908d404c9124c2efc6ada4640ca4d5d5 upstream.

Fuzzing with trinity oopsed on the 1st instruction of shmem_fh_to_dentry(),
u64 inum = fid->raw[2];
which is unhelpfully reported as at the end of shmem_alloc_inode():

BUG: unable to handle kernel paging request at 880061cd3000
IP: [] shmem_alloc_inode+0x40/0x40
Oops:  [#1] PREEMPT SMP DEBUG_PAGEALLOC
Call Trace:
 [] ? exportfs_decode_fh+0x79/0x2d0
 [] do_handle_open+0x163/0x2c0
 [] sys_open_by_handle_at+0xc/0x10
 [] tracesys+0xe1/0xe6

Right, tmpfs is being stupid to access fid->raw[2] before validating that
fh_len includes it: the buffer kmalloc'ed by do_sys_name_to_handle() may
fall at the end of a page, and the next page not be present.

But some other filesystems (ceph, gfs2, isofs, reiserfs, xfs) are being
careless about fh_len too, in fh_to_dentry() and/or fh_to_parent(), and
could oops in the same way: add the missing fh_len checks to those.

Reported-by: Sasha Levin 
Signed-off-by: Hugh Dickins 
Cc: Al Viro 
Cc: Sage Weil 
Cc: Steven Whitehouse 
Cc: Christoph Hellwig 
Signed-off-by: Al Viro 
Signed-off-by: Greg Kroah-Hartman 

---
 fs/ceph/export.c|   18 ++
 fs/gfs2/export.c|4 
 fs/isofs/export.c   |2 +-
 fs/reiserfs/inode.c |6 +-
 fs/xfs/xfs_export.c |3 +++
 mm/shmem.c  |6 --
 6 files changed, 31 insertions(+), 8 deletions(-)

--- a/fs/ceph/export.c
+++ b/fs/ceph/export.c
@@ -89,7 +89,7 @@ static int ceph_encode_fh(struct dentry
  * FIXME: we should try harder by querying the mds for the ino.
  */
 static struct dentry *__fh_to_dentry(struct super_block *sb,
-struct ceph_nfs_fh *fh)
+struct ceph_nfs_fh *fh, int fh_len)
 {
struct ceph_mds_client *mdsc = ceph_sb_to_client(sb)->mdsc;
struct inode *inode;
@@ -97,6 +97,9 @@ static struct dentry *__fh_to_dentry(str
struct ceph_vino vino;
int err;
 
+   if (fh_len < sizeof(*fh) / 4)
+   return ERR_PTR(-ESTALE);
+
dout("__fh_to_dentry %llx\n", fh->ino);
vino.ino = fh->ino;
vino.snap = CEPH_NOSNAP;
@@ -140,7 +143,7 @@ static struct dentry *__fh_to_dentry(str
  * convert connectable fh to dentry
  */
 static struct dentry *__cfh_to_dentry(struct super_block *sb,
- struct ceph_nfs_confh *cfh)
+ struct ceph_nfs_confh *cfh, int fh_len)
 {
struct ceph_mds_client *mdsc = ceph_sb_to_client(sb)->mdsc;
struct inode *inode;
@@ -148,6 +151,9 @@ static struct dentry *__cfh_to_dentry(st
struct ceph_vino vino;
int err;
 
+   if (fh_len < sizeof(*cfh) / 4)
+   return ERR_PTR(-ESTALE);
+
dout("__cfh_to_dentry %llx (%llx/%x)\n",
 cfh->ino, cfh->parent_ino, cfh->parent_name_hash);
 
@@ -197,9 +203,11 @@ static struct dentry *ceph_fh_to_dentry(
int fh_len, int fh_type)
 {
if (fh_type == 1)
-   return __fh_to_dentry(sb, (struct ceph_nfs_fh *)fid->raw);
+   return __fh_to_dentry(sb, (struct ceph_nfs_fh *)fid->raw,
+   fh_len);
else
-   return __cfh_to_dentry(sb, (struct ceph_nfs_confh *)fid->raw);
+   return __cfh_to_dentry(sb, (struct ceph_nfs_confh *)fid->raw,
+   fh_len);
 }
 
 /*
@@ -220,6 +228,8 @@ static struct dentry *ceph_fh_to_parent(
 
if (fh_type == 1)
return ERR_PTR(-ESTALE);
+   if (fh_len < sizeof(*cfh) / 4)
+   return ERR_PTR(-ESTALE);
 
pr_debug("fh_to_parent %llx/%d\n", cfh->parent_ino,
 cfh->parent_name_hash);
--- a/fs/gfs2/export.c
+++ b/fs/gfs2/export.c
@@ -168,6 +168,8 @@ static struct dentry *gfs2_fh_to_dentry(
case GFS2_SMALL_FH_SIZE:
case GFS2_LARGE_FH_SIZE:
case GFS2_OLD_FH_SIZE:
+   if (fh_len < GFS2_SMALL_FH_SIZE)
+   return NULL;
this.no_formal_ino = ((u64)be32_to_cpu(fh[0])) << 32;
this.no_formal_ino |= be32_to_cpu(fh[1]);
this.no_addr = ((u64)be32_to_cpu(fh[2])) << 32;
@@ -187,6 +189,8 @@ static struct dentry *gfs2_fh_to_parent(
switch (fh_type) {
case GFS2_LARGE_FH_SIZE:
case GFS2_OLD_FH_SIZE:
+   if (fh_len < GFS2_LARGE_FH_SIZE)
+   return NULL;
parent.no_formal_ino = ((u64)be32_to_cpu(fh[4])) << 32;
parent.no_formal_ino |= be32_to_cpu(fh[5]);
parent.no_addr = ((u64)be32_to_cpu(fh[6])) << 32;
--- a/fs/isofs/export.c
+++ b/fs/isofs/export.c
@@ -179,7 +179,7 @@ static struct dentry *isofs_fh_to_parent
 {
struct isofs_fid

[ 14/62] iscsi-target: Add explicit set of cache_dynamic_acls=1 for TPG demo-mode

2012-10-18 Thread Greg Kroah-Hartman
3.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Nicholas Bellinger 

commit 38b11bae6ba02da352340aff12ee25755977b222 upstream.

We've had reports in the past about this specific case, so it's time to
go ahead and explicitly set cache_dynamic_acls=1 for generate_node_acls=1
(TPG demo-mode) operation.

During normal generate_node_acls=0 operation with explicit NodeACLs ->
se_node_acl memory is persistent to the configfs group located at
/sys/kernel/config/target/$TARGETNAME/$TPGT/acls/$INITIATORNAME, so in
the generate_node_acls=1 case we want the reservation logic to reference
existing per initiator IQN se_node_acl memory (not to generate a new
se_node_acl), so go ahead and always set cache_dynamic_acls=1 when
TPG demo-mode is enabled.

Reported-by: Ronnie Sahlberg 
Signed-off-by: Nicholas Bellinger 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/target/iscsi/iscsi_target_tpg.c |   12 
 1 file changed, 12 insertions(+)

--- a/drivers/target/iscsi/iscsi_target_tpg.c
+++ b/drivers/target/iscsi/iscsi_target_tpg.c
@@ -672,6 +672,12 @@ int iscsit_ta_generate_node_acls(
pr_debug("iSCSI_TPG[%hu] - Generate Initiator Portal Group ACLs: %s\n",
tpg->tpgt, (a->generate_node_acls) ? "Enabled" : "Disabled");
 
+   if (flag == 1 && a->cache_dynamic_acls == 0) {
+   pr_debug("Explicitly setting cache_dynamic_acls=1 when "
+   "generate_node_acls=1\n");
+   a->cache_dynamic_acls = 1;
+   }
+
return 0;
 }
 
@@ -711,6 +717,12 @@ int iscsit_ta_cache_dynamic_acls(
return -EINVAL;
}
 
+   if (a->generate_node_acls == 1 && flag == 0) {
+   pr_debug("Skipping cache_dynamic_acls=0 when"
+   " generate_node_acls=1\n");
+   return 0;
+   }
+
a->cache_dynamic_acls = flag;
pr_debug("iSCSI_TPG[%hu] - Cache Dynamic Initiator Portal Group"
" ACLs %s\n", tpg->tpgt, (a->cache_dynamic_acls) ?


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[ 25/62] autofs4 - fix reset pending flag on mount fail

2012-10-18 Thread Greg Kroah-Hartman
3.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Ian Kent 

commit 4ab27eab6289a8e4f450e148bdab521361b2 upstream.

In autofs4_d_automount(), if a mount fail occurs the AUTOFS_INF_PENDING
mount pending flag is not cleared.

One effect of this is when using the "browse" option, directory entry
attributes show up with all "?"s due to the incorrect callback and
subsequent failure return (when in fact no callback should be made).

Signed-off-by: Ian Kent 
Signed-off-by: Linus Torvalds 
Signed-off-by: Greg Kroah-Hartman 

---
 fs/autofs4/root.c |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -392,10 +392,12 @@ static struct vfsmount *autofs4_d_automo
ino->flags |= AUTOFS_INF_PENDING;
spin_unlock(&sbi->fs_lock);
status = autofs4_mount_wait(dentry);
-   if (status)
-   return ERR_PTR(status);
spin_lock(&sbi->fs_lock);
ino->flags &= ~AUTOFS_INF_PENDING;
+   if (status) {
+   spin_unlock(&sbi->fs_lock);
+   return ERR_PTR(status);
+   }
}
 done:
if (!(ino->flags & AUTOFS_INF_EXPIRING)) {


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[ 05/62] ACPI: EC: Make the GPE storm threshold a module parameter

2012-10-18 Thread Greg Kroah-Hartman
3.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Feng Tang 

commit a520d52e99b14ba7db135e916348f12f2a6e09be upstream.

The Linux EC driver includes a mechanism to detect GPE storms,
and switch from interrupt-mode to polling mode.  However, polling
mode sometimes doesn't work, so the workaround is problematic.
Also, different systems seem to need the threshold for detecting
the GPE storm at different levels.

ACPI_EC_STORM_THRESHOLD was initially 20 when it's created, and
was changed to 8 in 2.6.28 commit 06cf7d3c7 "ACPI: EC: lower interrupt storm
threshold" to fix kernel bug 11892 by forcing the laptop in that bug to
work in polling mode. However in bug 45151, it works fine in interrupt
mode if we lift the threshold back to 20.

This patch makes the threshold a module parameter so that user has a
flexible option to debug/workaround this issue.

The default is unchanged.

This is also a preparation patch to fix specific systems:
https://bugzilla.kernel.org/show_bug.cgi?id=45151

Signed-off-by: Feng Tang 
Signed-off-by: Len Brown 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/acpi/ec.c |   14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -71,9 +71,6 @@ enum ec_command {
 #define ACPI_EC_UDELAY_GLK 1000/* Wait 1ms max. to get global lock */
 #define ACPI_EC_MSI_UDELAY 550 /* Wait 550us for MSI EC */
 
-#define ACPI_EC_STORM_THRESHOLD 8  /* number of false interrupts
-  per one transaction */
-
 enum {
EC_FLAGS_QUERY_PENDING, /* Query is pending */
EC_FLAGS_GPE_STORM, /* GPE storm detected */
@@ -87,6 +84,15 @@ static unsigned int ec_delay __read_most
 module_param(ec_delay, uint, 0644);
 MODULE_PARM_DESC(ec_delay, "Timeout(ms) waited until an EC command completes");
 
+/*
+ * If the number of false interrupts per one transaction exceeds
+ * this threshold, will think there is a GPE storm happened and
+ * will disable the GPE for normal transaction.
+ */
+static unsigned int ec_storm_threshold  __read_mostly = 8;
+module_param(ec_storm_threshold, uint, 0644);
+MODULE_PARM_DESC(ec_storm_threshold, "Maxim false GPE numbers not considered 
as GPE storm");
+
 /* If we find an EC via the ECDT, we need to keep a ptr to its context */
 /* External interfaces use first EC only, so remember */
 typedef int (*acpi_ec_query_func) (void *data);
@@ -319,7 +325,7 @@ static int acpi_ec_transaction(struct ac
msleep(1);
/* It is safe to enable the GPE outside of the transaction. */
acpi_enable_gpe(NULL, ec->gpe);
-   } else if (t->irq_count > ACPI_EC_STORM_THRESHOLD) {
+   } else if (t->irq_count > ec_storm_threshold) {
pr_info(PREFIX "GPE storm detected, "
"transactions will use polling mode\n");
set_bit(EC_FLAGS_GPE_STORM, &ec->flags);


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[ 17/62] SCSI: scsi_debug: Fix off-by-one bug when unmapping region

2012-10-18 Thread Greg Kroah-Hartman
3.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Lukas Czerner 

commit bc977749e967daa56de1922cf4cb38525631c51c upstream.

Currently it is possible to unmap one more block than user requested to
due to the off-by-one error in unmap_region(). This is probably due to
the fact that the end variable despite its name actually points to the
last block to unmap + 1. However in the condition it is handled as the
last block of the region to unmap.

The bug was not previously spotted probably due to the fact that the
region was not zeroed, which has changed with commit
be1dd78de5686c062bb3103f9e86d444a10ed783. With that commit we were able
to corrupt the ext4 file system on 256M scsi_debug device with LBPRZ
enabled using fstrim.

Since the 'end' semantic is the same in several functions there this
commit just fixes the condition to use the 'end' variable correctly in
that context.

Reported-by: Paolo Bonzini 
Signed-off-by: Lukas Czerner 
Reviewed-by: Martin K. Petersen 
Acked-by: Douglas Gilbert 
Signed-off-by: James Bottomley 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/scsi/scsi_debug.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -2054,7 +2054,7 @@ static void unmap_region(sector_t lba, u
block = lba + alignment;
rem = do_div(block, granularity);
 
-   if (rem == 0 && lba + granularity <= end && block < map_size) {
+   if (rem == 0 && lba + granularity < end && block < map_size) {
clear_bit(block, map_storep);
if (scsi_debug_lbprz)
memset(fake_storep +


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[ 20/62] SUNRPC: Ensure that the TCP socket is closed when in CLOSE_WAIT

2012-10-18 Thread Greg Kroah-Hartman
3.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Trond Myklebust 

commit a519fc7a70d1a918574bb826cc6905b87b482eb9 upstream.

Instead of doing a shutdown() call, we need to do an actual close().
Ditto if/when the server is sending us junk RPC headers.

Signed-off-by: Trond Myklebust 
Tested-by: Simon Kirby 
Signed-off-by: Greg Kroah-Hartman 

---
 net/sunrpc/xprtsock.c |   21 -
 1 file changed, 16 insertions(+), 5 deletions(-)

--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -1028,6 +1028,16 @@ static void xs_udp_data_ready(struct soc
read_unlock_bh(&sk->sk_callback_lock);
 }
 
+/*
+ * Helper function to force a TCP close if the server is sending
+ * junk and/or it has put us in CLOSE_WAIT
+ */
+static void xs_tcp_force_close(struct rpc_xprt *xprt)
+{
+   set_bit(XPRT_CONNECTION_CLOSE, &xprt->state);
+   xprt_force_disconnect(xprt);
+}
+
 static inline void xs_tcp_read_fraghdr(struct rpc_xprt *xprt, struct 
xdr_skb_reader *desc)
 {
struct sock_xprt *transport = container_of(xprt, struct sock_xprt, 
xprt);
@@ -1054,7 +1064,7 @@ static inline void xs_tcp_read_fraghdr(s
/* Sanity check of the record length */
if (unlikely(transport->tcp_reclen < 8)) {
dprintk("RPC:   invalid TCP record fragment length\n");
-   xprt_force_disconnect(xprt);
+   xs_tcp_force_close(xprt);
return;
}
dprintk("RPC:   reading TCP record fragment of length %d\n",
@@ -1135,7 +1145,7 @@ static inline void xs_tcp_read_calldir(s
break;
default:
dprintk("RPC:   invalid request message type\n");
-   xprt_force_disconnect(&transport->xprt);
+   xs_tcp_force_close(&transport->xprt);
}
xs_tcp_check_fraghdr(transport);
 }
@@ -1458,6 +1468,8 @@ static void xs_tcp_cancel_linger_timeout
 static void xs_sock_mark_closed(struct rpc_xprt *xprt)
 {
smp_mb__before_clear_bit();
+   clear_bit(XPRT_CONNECTION_ABORT, &xprt->state);
+   clear_bit(XPRT_CONNECTION_CLOSE, &xprt->state);
clear_bit(XPRT_CLOSE_WAIT, &xprt->state);
clear_bit(XPRT_CLOSING, &xprt->state);
smp_mb__after_clear_bit();
@@ -1515,8 +1527,8 @@ static void xs_tcp_state_change(struct s
break;
case TCP_CLOSE_WAIT:
/* The server initiated a shutdown of the socket */
-   xprt_force_disconnect(xprt);
xprt->connect_cookie++;
+   xs_tcp_force_close(xprt);
case TCP_CLOSING:
/*
 * If the server closed down the connection, make sure that
@@ -2159,8 +2171,7 @@ static void xs_tcp_setup_socket(struct w
/* We're probably in TIME_WAIT. Get rid of existing socket,
 * and retry
 */
-   set_bit(XPRT_CONNECTION_CLOSE, &xprt->state);
-   xprt_force_disconnect(xprt);
+   xs_tcp_force_close(xprt);
break;
case -ECONNREFUSED:
case -ECONNRESET:


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[ 21/62] target: fix return code in target_core_init_configfs error path

2012-10-18 Thread Greg Kroah-Hartman
3.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Peter Senna Tschudin 

commit 37bb7899ca366dc212b71b150e78566d04808cc0 upstream.

This patch fixes error cases within target_core_init_configfs() to
properly set ret = -ENOMEM before jumping to the out_global exception
path.

This was originally discovered with the following Coccinelle semantic
match information:

Convert a nonnegative error return code to a negative one, as returned
elsewhere in the function.  A simplified version of the semantic match
that finds this problem is as follows: (http://coccinelle.lip6.fr/)

// 
(
if@p1 (\(ret < 0\|ret != 0\))
 { ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
when != &ret
*if(...)
{
  ... when != ret = e2
  when forall
 return ret;
}
// 

Signed-off-by: Peter Senna Tschudin 
Signed-off-by: Nicholas Bellinger 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/target/target_core_configfs.c |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -3115,6 +3115,7 @@ static int __init target_core_init_confi
GFP_KERNEL);
if (!target_cg->default_groups) {
pr_err("Unable to allocate target_cg->default_groups\n");
+   ret = -ENOMEM;
goto out_global;
}
 
@@ -3130,6 +3131,7 @@ static int __init target_core_init_confi
GFP_KERNEL);
if (!hba_cg->default_groups) {
pr_err("Unable to allocate hba_cg->default_groups\n");
+   ret = -ENOMEM;
goto out_global;
}
config_group_init_type_name(&alua_group,
@@ -3145,6 +3147,7 @@ static int __init target_core_init_confi
GFP_KERNEL);
if (!alua_cg->default_groups) {
pr_err("Unable to allocate alua_cg->default_groups\n");
+   ret = -ENOMEM;
goto out_global;
}
 
@@ -3156,14 +3159,17 @@ static int __init target_core_init_confi
 * Add core/alua/lu_gps/default_lu_gp
 */
lu_gp = core_alua_allocate_lu_gp("default_lu_gp", 1);
-   if (IS_ERR(lu_gp))
+   if (IS_ERR(lu_gp)) {
+   ret = -ENOMEM;
goto out_global;
+   }
 
lu_gp_cg = &alua_lu_gps_group;
lu_gp_cg->default_groups = kzalloc(sizeof(struct config_group) * 2,
GFP_KERNEL);
if (!lu_gp_cg->default_groups) {
pr_err("Unable to allocate lu_gp_cg->default_groups\n");
+   ret = -ENOMEM;
goto out_global;
}
 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[ 22/62] xen/bootup: allow {read|write}_cr8 pvops call.

2012-10-18 Thread Greg Kroah-Hartman
3.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Konrad Rzeszutek Wilk 

commit 1a7bbda5b1ab0e02622761305a32dc38735b90b2 upstream.

We actually do not do anything about it. Just return a default
value of zero and if the kernel tries to write anything but 0
we BUG_ON.

This fixes the case when an user tries to suspend the machine
and it blows up in save_processor_state b/c 'read_cr8' is set
to NULL and we get:

kernel BUG at /home/konrad/ssd/linux/arch/x86/include/asm/paravirt.h:100!
invalid opcode:  [#1] SMP
Pid: 2687, comm: init.late Tainted: G   O 
3.6.0upstream-2-gac264ac-dirty #4 Bochs Bochs
RIP: e030:[]  [] 
save_processor_state+0x212/0x270

.. snip..
Call Trace:
 [] do_suspend_lowlevel+0xf/0xac
 [] ? x86_acpi_suspend_lowlevel+0x10c/0x150
 [] acpi_suspend_enter+0x57/0xd5

Signed-off-by: Konrad Rzeszutek Wilk 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/x86/xen/enlighten.c |   16 +++-
 1 file changed, 15 insertions(+), 1 deletion(-)

--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -942,7 +942,16 @@ static void xen_write_cr4(unsigned long
 
native_write_cr4(cr4);
 }
-
+#ifdef CONFIG_X86_64
+static inline unsigned long xen_read_cr8(void)
+{
+   return 0;
+}
+static inline void xen_write_cr8(unsigned long val)
+{
+   BUG_ON(val);
+}
+#endif
 static int xen_write_msr_safe(unsigned int msr, unsigned low, unsigned high)
 {
int ret;
@@ -,6 +1120,11 @@ static const struct pv_cpu_ops xen_cpu_o
.read_cr4_safe = native_read_cr4_safe,
.write_cr4 = xen_write_cr4,
 
+#ifdef CONFIG_X86_64
+   .read_cr8 = xen_read_cr8,
+   .write_cr8 = xen_write_cr8,
+#endif
+
.wbinvd = native_wbinvd,
 
.read_msr = native_read_msr_safe,


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[ 27/62] video/udlfb: fix line counting in fb_write

2012-10-18 Thread Greg Kroah-Hartman
3.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Alexander Holler 

commit b8c4321f3d194469007f5f5f2b34ec278c264a04 upstream.

Line 0 and 1 were both written to line 0 (on the display) and all subsequent
lines had an offset of -1. The result was that the last line on the display
was never overwritten by writes to /dev/fbN.

Signed-off-by: Alexander Holler 
Acked-by: Bernie Thompson 
Signed-off-by: Florian Tobias Schandinat 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/video/udlfb.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/video/udlfb.c
+++ b/drivers/video/udlfb.c
@@ -647,7 +647,7 @@ static ssize_t dlfb_ops_write(struct fb_
result = fb_sys_write(info, buf, count, ppos);
 
if (result > 0) {
-   int start = max((int)(offset / info->fix.line_length) - 1, 0);
+   int start = max((int)(offset / info->fix.line_length), 0);
int lines = min((u32)((result / info->fix.line_length) + 1),
(u32)info->var.yres);
 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[ 29/62] timers: Fix endless looping between cascade() and internal_add_timer()

2012-10-18 Thread Greg Kroah-Hartman
3.4-stable review patch.  If anyone has any objections, please let me know.

--

From: "Hildner, Christian" 

commit 26cff4e2aa4d666dc6a120ea34336b5057e3e187 upstream.

Adding two (or more) timers with large values for "expires" (they have
to reside within tv5 in the same list) leads to endless looping
between cascade() and internal_add_timer() in case CONFIG_BASE_SMALL
is one and jiffies are crossing the value 1 << 18. The bug was
introduced between 2.6.11 and 2.6.12 (and survived for quite some
time).

This patch ensures that when cascade() is called timers within tv5 are
not added endlessly to their own list again, instead they are added to
the next lower tv level tv4 (as expected).

Signed-off-by: Christian Hildner 
Reviewed-by: Jan Kiszka 
Link: 
http://lkml.kernel.org/r/98673c87cb31274881cffe0b65ecc87b0f5fc19...@defthw99ea4msx.ww902.siemens.net
Signed-off-by: Thomas Gleixner 
Signed-off-by: Greg Kroah-Hartman 

---
 kernel/timer.c |   10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -63,6 +63,7 @@ EXPORT_SYMBOL(jiffies_64);
 #define TVR_SIZE (1 << TVR_BITS)
 #define TVN_MASK (TVN_SIZE - 1)
 #define TVR_MASK (TVR_SIZE - 1)
+#define MAX_TVAL ((unsigned long)((1ULL << (TVR_BITS + 4*TVN_BITS)) - 1))
 
 struct tvec {
struct list_head vec[TVN_SIZE];
@@ -356,11 +357,12 @@ static void internal_add_timer(struct tv
vec = base->tv1.vec + (base->timer_jiffies & TVR_MASK);
} else {
int i;
-   /* If the timeout is larger than 0x on 64-bit
-* architectures then we use the maximum timeout:
+   /* If the timeout is larger than MAX_TVAL (on 64-bit
+* architectures or with CONFIG_BASE_SMALL=1) then we
+* use the maximum timeout.
 */
-   if (idx > 0xUL) {
-   idx = 0xUL;
+   if (idx > MAX_TVAL) {
+   idx = MAX_TVAL;
expires = idx + base->timer_jiffies;
}
i = (expires >> (TVR_BITS + 3 * TVN_BITS)) & TVN_MASK;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[ 30/62] ath9k: use ieee80211_free_txskb

2012-10-18 Thread Greg Kroah-Hartman
3.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Felix Fietkau 

commit 249ee72249140fe5b9adc988f97298f0aa5db2fc upstream.

Using ieee80211_free_txskb for tx frames is required, since mac80211 clones
skbs for which socket tx status is requested.

Signed-off-by: Felix Fietkau 
Signed-off-by: John W. Linville 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/net/wireless/ath/ath9k/beacon.c |2 -
 drivers/net/wireless/ath/ath9k/main.c   |2 -
 drivers/net/wireless/ath/ath9k/xmit.c   |   53 +---
 3 files changed, 31 insertions(+), 26 deletions(-)

--- a/drivers/net/wireless/ath/ath9k/beacon.c
+++ b/drivers/net/wireless/ath/ath9k/beacon.c
@@ -121,7 +121,7 @@ static void ath_tx_cabq(struct ieee80211
 
if (ath_tx_start(hw, skb, &txctl) != 0) {
ath_dbg(common, XMIT, "CABQ TX failed\n");
-   dev_kfree_skb_any(skb);
+   ieee80211_free_txskb(hw, skb);
}
 }
 
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1147,7 +1147,7 @@ static void ath9k_tx(struct ieee80211_hw
 
return;
 exit:
-   dev_kfree_skb_any(skb);
+   ieee80211_free_txskb(hw, skb);
 }
 
 static void ath9k_stop(struct ieee80211_hw *hw)
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -64,8 +64,7 @@ static void ath_tx_update_baw(struct ath
 static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc,
   struct ath_txq *txq,
   struct ath_atx_tid *tid,
-  struct sk_buff *skb,
-  bool dequeue);
+  struct sk_buff *skb);
 
 enum {
MCS_HT20,
@@ -201,7 +200,15 @@ static void ath_tx_flush_tid(struct ath_
fi = get_frame_info(skb);
bf = fi->bf;
 
-   if (bf && fi->retries) {
+   if (!bf) {
+   bf = ath_tx_setup_buffer(sc, txq, tid, skb);
+   if (!bf) {
+   ieee80211_free_txskb(sc->hw, skb);
+   continue;
+   }
+   }
+
+   if (fi->retries) {
list_add_tail(&bf->list, &bf_head);
ath_tx_update_baw(sc, tid, bf->bf_state.seqno);
ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0);
@@ -812,10 +819,13 @@ static enum ATH_AGGR_STATUS ath_tx_form_
fi = get_frame_info(skb);
bf = fi->bf;
if (!fi->bf)
-   bf = ath_tx_setup_buffer(sc, txq, tid, skb, true);
+   bf = ath_tx_setup_buffer(sc, txq, tid, skb);
 
-   if (!bf)
+   if (!bf) {
+   __skb_unlink(skb, &tid->buf_q);
+   ieee80211_free_txskb(sc->hw, skb);
continue;
+   }
 
bf->bf_state.bf_type = BUF_AMPDU | BUF_AGGR;
seqno = bf->bf_state.seqno;
@@ -1717,9 +1727,11 @@ static void ath_tx_send_ampdu(struct ath
return;
}
 
-   bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb, false);
-   if (!bf)
+   bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb);
+   if (!bf) {
+   ieee80211_free_txskb(sc->hw, skb);
return;
+   }
 
bf->bf_state.bf_type = BUF_AMPDU;
INIT_LIST_HEAD(&bf_head);
@@ -1743,11 +1755,6 @@ static void ath_tx_send_normal(struct at
struct ath_buf *bf;
 
bf = fi->bf;
-   if (!bf)
-   bf = ath_tx_setup_buffer(sc, txq, tid, skb, false);
-
-   if (!bf)
-   return;
 
INIT_LIST_HEAD(&bf_head);
list_add_tail(&bf->list, &bf_head);
@@ -1820,8 +1827,7 @@ u8 ath_txchainmask_reduction(struct ath_
 static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc,
   struct ath_txq *txq,
   struct ath_atx_tid *tid,
-  struct sk_buff *skb,
-  bool dequeue)
+  struct sk_buff *skb)
 {
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
struct ath_frame_info *fi = get_frame_info(skb);
@@ -1833,7 +1839,7 @@ static struct ath_buf *ath_tx_setup_buff
bf = ath_tx_get_buffer(sc);
if (!bf) {
ath_dbg(common, XMIT, "TX buffers are full\n");
-   goto error;
+   return NULL;
}
 
ATH_TXBUF_RESET(bf);
@@ -1862,18 +1868,12 @@ static struct ath_buf *ath_tx_setup_buff
ath_err(ath9k_hw_common(sc->sc_ah),
"dma_mapping_error() on TX\n");
ath_tx

[ 31/62] md/raid10: use correct limit variable

2012-10-18 Thread Greg Kroah-Hartman
3.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Dan Carpenter 

commit 91502f099dfc5a1e8812898e26ee280713e1d002 upstream.

Clang complains that we are assigning a variable to itself.  This should
be using bad_sectors like the similar earlier check does.

Bug has been present since 3.1-rc1.  It is minor but could
conceivably cause corruption or other bad behaviour.

Signed-off-by: Dan Carpenter 
Signed-off-by: NeilBrown 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/md/raid10.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -3019,7 +3019,7 @@ static sector_t sync_request(struct mdde
else {
bad_sectors -= (sector - first_bad);
if (max_sync > bad_sectors)
-   max_sync = max_sync;
+   max_sync = bad_sectors;
continue;
}
}


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[ 01/37] ARM: vfp: fix saving d16-d31 vfp registers on v6+ kernels

2012-10-18 Thread Greg Kroah-Hartman
3.0-stable review patch.  If anyone has any objections, please let me know.

--

From: Russell King 

commit 846a136881b8f73c1f74250bf6acfaa309cab1f2 upstream.

Michael Olbrich reported that his test program fails when built with
-O2 -mcpu=cortex-a8 -mfpu=neon, and a kernel which supports v6 and v7
CPUs:

volatile int x = 2;
volatile int64_t y = 2;

int main() {
volatile int a = 0;
volatile int64_t b = 0;
while (1) {
a = (a + x) % (1 << 30);
b = (b + y) % (1 << 30);
assert(a == b);
}
}

and two instances are run.  When built for just v7 CPUs, this program
works fine.  It uses the "vadd.i64 d19, d18, d16" VFP instruction.

It appears that we do not save the high-16 double VFP registers across
context switches when the kernel is built for v6 CPUs.  Fix that.

Tested-By: Michael Olbrich 
Signed-off-by: Russell King 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/arm/include/asm/vfpmacros.h |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/arch/arm/include/asm/vfpmacros.h
+++ b/arch/arm/include/asm/vfpmacros.h
@@ -28,7 +28,7 @@
ldr \tmp, =elf_hwcap@ may not have MVFR regs
ldr \tmp, [\tmp, #0]
tst \tmp, #HWCAP_VFPv3D16
-   ldceq   p11, cr0, [\base],#32*4 @ FLDMIAD \base!, {d16-d31}
+   ldceql  p11, cr0, [\base],#32*4 @ FLDMIAD \base!, {d16-d31}
addne   \base, \base, #32*4 @ step over unused register 
space
 #else
VFPFMRX \tmp, MVFR0 @ Media and VFP Feature 
Register 0
@@ -52,7 +52,7 @@
ldr \tmp, =elf_hwcap@ may not have MVFR regs
ldr \tmp, [\tmp, #0]
tst \tmp, #HWCAP_VFPv3D16
-   stceq   p11, cr0, [\base],#32*4 @ FSTMIAD \base!, {d16-d31}
+   stceql  p11, cr0, [\base],#32*4 @ FSTMIAD \base!, {d16-d31}
addne   \base, \base, #32*4 @ step over unused register 
space
 #else
VFPFMRX \tmp, MVFR0 @ Media and VFP Feature 
Register 0


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[ 04/37] ACPI: EC: Add a quirk for CLEVO M720T/M730T laptop

2012-10-18 Thread Greg Kroah-Hartman
3.0-stable review patch.  If anyone has any objections, please let me know.

--

From: Feng Tang 

commit 67bfa9b60bd689601554526d144b21d529f78a09 upstream.

By enlarging the GPE storm threshold back to 20, that laptop's
EC works fine with interrupt mode instead of polling mode.

https://bugzilla.kernel.org/show_bug.cgi?id=45151

Reported-and-Tested-by: Francesco 
Signed-off-by: Feng Tang 
Signed-off-by: Len Brown 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/acpi/ec.c |   16 +++-
 1 file changed, 15 insertions(+), 1 deletion(-)

--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -920,6 +920,17 @@ static int ec_flag_msi(const struct dmi_
return 0;
 }
 
+/*
+ * Clevo M720 notebook actually works ok with IRQ mode, if we lifted
+ * the GPE storm threshold back to 20
+ */
+static int ec_enlarge_storm_threshold(const struct dmi_system_id *id)
+{
+   pr_debug("Setting the EC GPE storm threshold to 20\n");
+   ec_storm_threshold  = 20;
+   return 0;
+}
+
 static struct dmi_system_id __initdata ec_dmi_table[] = {
{
ec_skip_dsdt_scan, "Compal JFL92", {
@@ -951,10 +962,13 @@ static struct dmi_system_id __initdata e
{
ec_validate_ecdt, "ASUS hardware", {
DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer Inc.") }, NULL},
+   {
+   ec_enlarge_storm_threshold, "CLEVO hardware", {
+   DMI_MATCH(DMI_SYS_VENDOR, "CLEVO Co."),
+   DMI_MATCH(DMI_PRODUCT_NAME, "M720T/M730T"),}, NULL},
{},
 };
 
-
 int __init acpi_ec_ecdt_probe(void)
 {
acpi_status status;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[ 06/37] tmpfs,ceph,gfs2,isofs,reiserfs,xfs: fix fh_len checking

2012-10-18 Thread Greg Kroah-Hartman
3.0-stable review patch.  If anyone has any objections, please let me know.

--

From: Hugh Dickins 

commit 35c2a7f4908d404c9124c2efc6ada4640ca4d5d5 upstream.

Fuzzing with trinity oopsed on the 1st instruction of shmem_fh_to_dentry(),
u64 inum = fid->raw[2];
which is unhelpfully reported as at the end of shmem_alloc_inode():

BUG: unable to handle kernel paging request at 880061cd3000
IP: [] shmem_alloc_inode+0x40/0x40
Oops:  [#1] PREEMPT SMP DEBUG_PAGEALLOC
Call Trace:
 [] ? exportfs_decode_fh+0x79/0x2d0
 [] do_handle_open+0x163/0x2c0
 [] sys_open_by_handle_at+0xc/0x10
 [] tracesys+0xe1/0xe6

Right, tmpfs is being stupid to access fid->raw[2] before validating that
fh_len includes it: the buffer kmalloc'ed by do_sys_name_to_handle() may
fall at the end of a page, and the next page not be present.

But some other filesystems (ceph, gfs2, isofs, reiserfs, xfs) are being
careless about fh_len too, in fh_to_dentry() and/or fh_to_parent(), and
could oops in the same way: add the missing fh_len checks to those.

Reported-by: Sasha Levin 
Signed-off-by: Hugh Dickins 
Cc: Al Viro 
Cc: Sage Weil 
Cc: Steven Whitehouse 
Cc: Christoph Hellwig 
Signed-off-by: Al Viro 
Signed-off-by: Greg Kroah-Hartman 

---
 fs/ceph/export.c  |   18 ++
 fs/gfs2/export.c  |4 
 fs/isofs/export.c |2 +-
 fs/reiserfs/inode.c   |6 +-
 fs/xfs/linux-2.6/xfs_export.c |3 +++
 mm/shmem.c|6 --
 6 files changed, 31 insertions(+), 8 deletions(-)

--- a/fs/ceph/export.c
+++ b/fs/ceph/export.c
@@ -84,7 +84,7 @@ static int ceph_encode_fh(struct dentry
  * FIXME: we should try harder by querying the mds for the ino.
  */
 static struct dentry *__fh_to_dentry(struct super_block *sb,
-struct ceph_nfs_fh *fh)
+struct ceph_nfs_fh *fh, int fh_len)
 {
struct ceph_mds_client *mdsc = ceph_sb_to_client(sb)->mdsc;
struct inode *inode;
@@ -92,6 +92,9 @@ static struct dentry *__fh_to_dentry(str
struct ceph_vino vino;
int err;
 
+   if (fh_len < sizeof(*fh) / 4)
+   return ERR_PTR(-ESTALE);
+
dout("__fh_to_dentry %llx\n", fh->ino);
vino.ino = fh->ino;
vino.snap = CEPH_NOSNAP;
@@ -136,7 +139,7 @@ static struct dentry *__fh_to_dentry(str
  * convert connectable fh to dentry
  */
 static struct dentry *__cfh_to_dentry(struct super_block *sb,
- struct ceph_nfs_confh *cfh)
+ struct ceph_nfs_confh *cfh, int fh_len)
 {
struct ceph_mds_client *mdsc = ceph_sb_to_client(sb)->mdsc;
struct inode *inode;
@@ -144,6 +147,9 @@ static struct dentry *__cfh_to_dentry(st
struct ceph_vino vino;
int err;
 
+   if (fh_len < sizeof(*cfh) / 4)
+   return ERR_PTR(-ESTALE);
+
dout("__cfh_to_dentry %llx (%llx/%x)\n",
 cfh->ino, cfh->parent_ino, cfh->parent_name_hash);
 
@@ -193,9 +199,11 @@ static struct dentry *ceph_fh_to_dentry(
int fh_len, int fh_type)
 {
if (fh_type == 1)
-   return __fh_to_dentry(sb, (struct ceph_nfs_fh *)fid->raw);
+   return __fh_to_dentry(sb, (struct ceph_nfs_fh *)fid->raw,
+   fh_len);
else
-   return __cfh_to_dentry(sb, (struct ceph_nfs_confh *)fid->raw);
+   return __cfh_to_dentry(sb, (struct ceph_nfs_confh *)fid->raw,
+   fh_len);
 }
 
 /*
@@ -216,6 +224,8 @@ static struct dentry *ceph_fh_to_parent(
 
if (fh_type == 1)
return ERR_PTR(-ESTALE);
+   if (fh_len < sizeof(*cfh) / 4)
+   return ERR_PTR(-ESTALE);
 
pr_debug("fh_to_parent %llx/%d\n", cfh->parent_ino,
 cfh->parent_name_hash);
--- a/fs/gfs2/export.c
+++ b/fs/gfs2/export.c
@@ -167,6 +167,8 @@ static struct dentry *gfs2_fh_to_dentry(
case GFS2_SMALL_FH_SIZE:
case GFS2_LARGE_FH_SIZE:
case GFS2_OLD_FH_SIZE:
+   if (fh_len < GFS2_SMALL_FH_SIZE)
+   return NULL;
this.no_formal_ino = ((u64)be32_to_cpu(fh[0])) << 32;
this.no_formal_ino |= be32_to_cpu(fh[1]);
this.no_addr = ((u64)be32_to_cpu(fh[2])) << 32;
@@ -186,6 +188,8 @@ static struct dentry *gfs2_fh_to_parent(
switch (fh_type) {
case GFS2_LARGE_FH_SIZE:
case GFS2_OLD_FH_SIZE:
+   if (fh_len < GFS2_LARGE_FH_SIZE)
+   return NULL;
parent.no_formal_ino = ((u64)be32_to_cpu(fh[4])) << 32;
parent.no_formal_ino |= be32_to_cpu(fh[5]);
parent.no_addr = ((u64)be32_to_cpu(fh[6])) << 32;
--- a/fs/isofs/export.c
+++ b/fs/isofs/export.c
@@ -179,7 +179,7 @@ static s

[ 33/62] pktgen: fix crash when generating IPv6 packets

2012-10-18 Thread Greg Kroah-Hartman
3.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Amerigo Wang 

commit 5aa8b572007c4bca1e6d3dd4c4820f1ae49d6bb2 upstream.

For IPv6, sizeof(struct ipv6hdr) = 40, thus the following
expression will result negative:

datalen = pkt_dev->cur_pkt_size - 14 -
  sizeof(struct ipv6hdr) - sizeof(struct udphdr) -
  pkt_dev->pkt_overhead;

And,  the check "if (datalen < sizeof(struct pktgen_hdr))" will be
passed as "datalen" is promoted to unsigned, therefore will cause
a crash later.

This is a quick fix by checking if "datalen" is negative. The following
patch will increase the default value of 'min_pkt_size' for IPv6.

This bug should exist for a long time, so Cc -stable too.

Signed-off-by: Cong Wang 
Signed-off-by: David S. Miller 
Signed-off-by: Greg Kroah-Hartman 

---
 net/core/pktgen.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -2932,7 +2932,7 @@ static struct sk_buff *fill_packet_ipv6(
  sizeof(struct ipv6hdr) - sizeof(struct udphdr) -
  pkt_dev->pkt_overhead;
 
-   if (datalen < sizeof(struct pktgen_hdr)) {
+   if (datalen < 0 || datalen < sizeof(struct pktgen_hdr)) {
datalen = sizeof(struct pktgen_hdr);
if (net_ratelimit())
pr_info("increased datalen to %d\n", datalen);


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[ 23/62] xen/bootup: allow read_tscp call for Xen PV guests.

2012-10-18 Thread Greg Kroah-Hartman
3.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Konrad Rzeszutek Wilk 

commit cd0608e71e9757f4dae35bcfb4e88f4d1a03a8ab upstream.

The hypervisor will trap it. However without this patch,
we would crash as the .read_tscp is set to NULL. This patch
fixes it and sets it to the native_read_tscp call.

Signed-off-by: Konrad Rzeszutek Wilk 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/x86/xen/enlighten.c |2 ++
 1 file changed, 2 insertions(+)

--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1135,6 +1135,8 @@ static const struct pv_cpu_ops xen_cpu_o
.read_tsc = native_read_tsc,
.read_pmc = native_read_pmc,
 
+   .read_tscp = native_read_tscp,
+
.iret = xen_iret,
.irq_enable_sysexit = xen_sysexit,
 #ifdef CONFIG_X86_64


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[ 15/62] iscsi-target: Bump defaults for nopin_timeout + nopin_response_timeout values

2012-10-18 Thread Greg Kroah-Hartman
3.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Nicholas Bellinger 

commit cf0eb28d3ba60098865bf7dbcbfdd6b1cc483e3b upstream.

This patch increases the default for nopin_timeout to 15 seconds (wait
between sending a new NopIN ping) and nopin_response_timeout to 30 seconds
(wait for NopOUT response before failing the connection) in order to avoid
false positives by iSCSI Initiators who are not always able (under load) to
respond to NopIN echo PING requests within the current 5 second window.

False positives have been observed recently using Open-iSCSI code on v3.3.x
with heavy large-block READ workloads over small MTU 1 Gb/sec ports, and
increasing these values to more reasonable defaults significantly reduces
the possibility of false positive NopIN response timeout events under
this specific workload.

Historically these have been set low to initiate connection recovery as
soon as possible if we don't hear a ping back, but for modern v3.x code
on 1 -> 10 Gb/sec ports these new defaults make alot more sense.

Signed-off-by: Nicholas Bellinger 
Cc: Christoph Hellwig 
Cc: Andy Grover 
Cc: Mike Christie 
Cc: Hannes Reinecke 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/target/iscsi/iscsi_target_core.h |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/target/iscsi/iscsi_target_core.h
+++ b/drivers/target/iscsi/iscsi_target_core.h
@@ -25,10 +25,10 @@
 #define NA_DATAOUT_TIMEOUT_RETRIES 5
 #define NA_DATAOUT_TIMEOUT_RETRIES_MAX 15
 #define NA_DATAOUT_TIMEOUT_RETRIES_MIN 1
-#define NA_NOPIN_TIMEOUT   5
+#define NA_NOPIN_TIMEOUT   15
 #define NA_NOPIN_TIMEOUT_MAX   60
 #define NA_NOPIN_TIMEOUT_MIN   3
-#define NA_NOPIN_RESPONSE_TIMEOUT  5
+#define NA_NOPIN_RESPONSE_TIMEOUT  30
 #define NA_NOPIN_RESPONSE_TIMEOUT_MAX  60
 #define NA_NOPIN_RESPONSE_TIMEOUT_MIN  3
 #define NA_RANDOM_DATAIN_PDU_OFFSETS   0


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[ 24/62] block: fix request_queue->flags initialization

2012-10-18 Thread Greg Kroah-Hartman
3.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Tejun Heo 

commit 60ea8226cbd5c8301f9a39edc574ddabcb8150e0 upstream.

A queue newly allocated with blk_alloc_queue_node() has only
QUEUE_FLAG_BYPASS set.  For request-based drivers,
blk_init_allocated_queue() is called and q->queue_flags is overwritten
with QUEUE_FLAG_DEFAULT which doesn't include BYPASS even though the
initial bypass is still in effect.

In blk_init_allocated_queue(), or QUEUE_FLAG_DEFAULT to q->queue_flags
instead of overwriting.

Signed-off-by: Tejun Heo 
Acked-by: Vivek Goyal 
Signed-off-by: Jens Axboe 
Signed-off-by: Greg Kroah-Hartman 

---
 block/blk-core.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -601,7 +601,7 @@ blk_init_allocated_queue(struct request_
q->request_fn   = rfn;
q->prep_rq_fn   = NULL;
q->unprep_rq_fn = NULL;
-   q->queue_flags  = QUEUE_FLAG_DEFAULT;
+   q->queue_flags  |= QUEUE_FLAG_DEFAULT;
 
/* Override internal queue lock with supplied lock pointer */
if (lock)


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[ 11/62] SCSI: hpsa: dial down lockup detection during firmware flash

2012-10-18 Thread Greg Kroah-Hartman
3.4-stable review patch.  If anyone has any objections, please let me know.

--

From: "Stephen M. Cameron" 

commit e85c59746957fd6e3595d02cf614370056b5816e upstream.

Dial back the aggressiveness of the controller lockup detection thread.
Currently it will declare the controller to be locked up if it goes
for 10 seconds with no interrupts and no change in the heartbeat
register.  Dial back this to 30 seconds with no heartbeat change, and
also snoop the ioctl path and if a firmware flash command is detected,
dial it back further to 4 minutes until the firmware flash command
completes.  The reason for this is that during the firmware flash
operation, the controller apparently doesn't update the heartbeat
register as frequently as it is supposed to, and we can get a false
positive.

Signed-off-by: Stephen M. Cameron 
Signed-off-by: James Bottomley 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/scsi/hpsa.c |   39 ++-
 drivers/scsi/hpsa.h |2 ++
 drivers/scsi/hpsa_cmd.h |1 +
 3 files changed, 37 insertions(+), 5 deletions(-)

--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -548,12 +548,42 @@ static void set_performant_mode(struct c
c->busaddr |= 1 | (h->blockFetchTable[c->Header.SGList] << 1);
 }
 
+static int is_firmware_flash_cmd(u8 *cdb)
+{
+   return cdb[0] == BMIC_WRITE && cdb[6] == BMIC_FLASH_FIRMWARE;
+}
+
+/*
+ * During firmware flash, the heartbeat register may not update as frequently
+ * as it should.  So we dial down lockup detection during firmware flash. and
+ * dial it back up when firmware flash completes.
+ */
+#define HEARTBEAT_SAMPLE_INTERVAL_DURING_FLASH (240 * HZ)
+#define HEARTBEAT_SAMPLE_INTERVAL (30 * HZ)
+static void dial_down_lockup_detection_during_fw_flash(struct ctlr_info *h,
+   struct CommandList *c)
+{
+   if (!is_firmware_flash_cmd(c->Request.CDB))
+   return;
+   atomic_inc(&h->firmware_flash_in_progress);
+   h->heartbeat_sample_interval = HEARTBEAT_SAMPLE_INTERVAL_DURING_FLASH;
+}
+
+static void dial_up_lockup_detection_on_fw_flash_complete(struct ctlr_info *h,
+   struct CommandList *c)
+{
+   if (is_firmware_flash_cmd(c->Request.CDB) &&
+   atomic_dec_and_test(&h->firmware_flash_in_progress))
+   h->heartbeat_sample_interval = HEARTBEAT_SAMPLE_INTERVAL;
+}
+
 static void enqueue_cmd_and_start_io(struct ctlr_info *h,
struct CommandList *c)
 {
unsigned long flags;
 
set_performant_mode(h, c);
+   dial_down_lockup_detection_during_fw_flash(h, c);
spin_lock_irqsave(&h->lock, flags);
addQ(&h->reqQ, c);
h->Qdepth++;
@@ -3049,6 +3079,7 @@ static inline int bad_tag(struct ctlr_in
 static inline void finish_cmd(struct CommandList *c, u32 raw_tag)
 {
removeQ(c);
+   dial_up_lockup_detection_on_fw_flash_complete(c->h, c);
if (likely(c->cmd_type == CMD_SCSI))
complete_scsi_command(c);
else if (c->cmd_type == CMD_IOCTL_PEND)
@@ -4189,9 +4220,6 @@ static void controller_lockup_detected(s
spin_unlock_irqrestore(&h->lock, flags);
 }
 
-#define HEARTBEAT_SAMPLE_INTERVAL (10 * HZ)
-#define HEARTBEAT_CHECK_MINIMUM_INTERVAL (HEARTBEAT_SAMPLE_INTERVAL / 2)
-
 static void detect_controller_lockup(struct ctlr_info *h)
 {
u64 now;
@@ -4202,7 +4230,7 @@ static void detect_controller_lockup(str
now = get_jiffies_64();
/* If we've received an interrupt recently, we're ok. */
if (time_after64(h->last_intr_timestamp +
-   (HEARTBEAT_CHECK_MINIMUM_INTERVAL), now))
+   (h->heartbeat_sample_interval), now))
return;
 
/*
@@ -4211,7 +4239,7 @@ static void detect_controller_lockup(str
 * otherwise don't care about signals in this thread.
 */
if (time_after64(h->last_heartbeat_timestamp +
-   (HEARTBEAT_CHECK_MINIMUM_INTERVAL), now))
+   (h->heartbeat_sample_interval), now))
return;
 
/* If heartbeat has not changed since we last looked, we're not ok. */
@@ -4253,6 +4281,7 @@ static void add_ctlr_to_lockup_detector_
 {
unsigned long flags;
 
+   h->heartbeat_sample_interval = HEARTBEAT_SAMPLE_INTERVAL;
spin_lock_irqsave(&lockup_detector_lock, flags);
list_add_tail(&h->lockup_list, &hpsa_ctlr_list);
spin_unlock_irqrestore(&lockup_detector_lock, flags);
--- a/drivers/scsi/hpsa.h
+++ b/drivers/scsi/hpsa.h
@@ -123,6 +123,8 @@ struct ctlr_info {
u64 last_intr_timestamp;
u32 last_heartbeat;
u64 last_heartbeat_timestamp;
+   u32 heartbeat_sample_interval;
+   atomic_t firmware_flash_in_progress;
u32 lockup_detected;
struct list_head lockup_list;
 };
--- a/drivers/scsi/hpsa_cmd.h
+++ b/drivers/scsi/hpsa_cmd.h
@@ -162,6 +162,7 @@ struct SenseSubsyste

[ 07/37] ARM: 7541/1: Add ARM ERRATA 775420 workaround

2012-10-18 Thread Greg Kroah-Hartman
3.0-stable review patch.  If anyone has any objections, please let me know.

--

From: Simon Horman 

commit 7253b85cc62d6ff84143d96fe6cd54f73736f4d7 upstream.

arm: Add ARM ERRATA 775420 workaround

Workaround for the 775420 Cortex-A9 (r2p2, r2p6,r2p8,r2p10,r3p0) erratum.
In case a date cache maintenance operation aborts with MMU exception, it
might cause the processor to deadlock. This workaround puts DSB before
executing ISB if an abort may occur on cache maintenance.

Based on work by Kouei Abe and feedback from Catalin Marinas.

Signed-off-by: Kouei Abe 
[ ho...@verge.net.au: Changed to implementation
  suggested by catalin.mari...@arm.com ]
Acked-by: Catalin Marinas 
Signed-off-by: Simon Horman 
Signed-off-by: Russell King 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/arm/Kconfig   |   10 ++
 arch/arm/mm/cache-v7.S |3 +++
 2 files changed, 13 insertions(+)

--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1260,6 +1260,16 @@ config PL310_ERRATA_769419
  on systems with an outer cache, the store buffer is drained
  explicitly.
 
+config ARM_ERRATA_775420
+   bool "ARM errata: A data cache maintenance operation which aborts, 
might lead to deadlock"
+   depends on CPU_V7
+   help
+This option enables the workaround for the 775420 Cortex-A9 (r2p2,
+r2p6,r2p8,r2p10,r3p0) erratum. In case a date cache maintenance
+operation aborts with MMU exception, it might cause the processor
+to deadlock. This workaround puts DSB before executing ISB if
+an abort may occur on cache maintenance.
+
 endmenu
 
 source "arch/arm/common/Kconfig"
--- a/arch/arm/mm/cache-v7.S
+++ b/arch/arm/mm/cache-v7.S
@@ -211,6 +211,9 @@ ENTRY(v7_coherent_user_range)
  * isn't mapped, just try the next page.
  */
 9001:
+#ifdef CONFIG_ARM_ERRATA_775420
+   dsb
+#endif
mov r12, r12, lsr #12
mov r12, r12, lsl #12
add r12, r12, #4096


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


  1   2   3   4   5   6   7   8   9   >