<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/mm/percpu.c, branch v3.0.44</title>
<subtitle>Linux kernel source tree</subtitle>
<id>https://git.amat.us/linux/atom/mm/percpu.c?h=v3.0.44</id>
<link rel='self' href='https://git.amat.us/linux/atom/mm/percpu.c?h=v3.0.44'/>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/'/>
<updated>2012-05-21T16:40:02Z</updated>
<entry>
<title>percpu: pcpu_embed_first_chunk() should free unused parts after all allocs are complete</title>
<updated>2012-05-21T16:40:02Z</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2012-04-27T15:42:53Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=4f5e387650ca965426a7b4681120988b4ba0e116'/>
<id>urn:sha1:4f5e387650ca965426a7b4681120988b4ba0e116</id>
<content type='text'>
commit 42b64281453249dac52861f9b97d18552a7ec62b upstream.

pcpu_embed_first_chunk() allocates memory for each node, copies percpu
data and frees unused portions of it before proceeding to the next
group.  This assumes that allocations for different nodes doesn't
overlap; however, depending on memory topology, the bootmem allocator
may end up allocating memory from a different node than the requested
one which may overlap with the portion freed from one of the previous
percpu areas.  This leads to percpu groups for different nodes
overlapping which is a serious bug.

This patch separates out copy &amp; partial free from the allocation loop
such that all allocations are complete before partial frees happen.

This also fixes overlapping frees which could happen on allocation
failure path - out_free_areas path frees whole groups but the groups
could have portions freed at that point.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Reported-by: "Pavel V. Panteleev" &lt;pp_84@mail.ru&gt;
Tested-by: "Pavel V. Panteleev" &lt;pp_84@mail.ru&gt;
LKML-Reference: &lt;E1SNhwY-0007ui-V7.pp_84-mail-ru@f220.mail.ru&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>percpu: fix per_cpu_ptr_to_phys() handling of non-page-aligned addresses</title>
<updated>2012-01-06T22:13:50Z</updated>
<author>
<name>Eugene Surovegin</name>
<email>ebs@ebshome.net</email>
</author>
<published>2011-12-15T19:25:59Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=d051424f29eac6b4c173365a3ba5b9bb76870ce6'/>
<id>urn:sha1:d051424f29eac6b4c173365a3ba5b9bb76870ce6</id>
<content type='text'>
commit 9f57bd4d6dc69a4e3bf43044fa00fcd24dd363e3 upstream.

per_cpu_ptr_to_phys() incorrectly rounds up its result for non-kmalloc
case to the page boundary, which is bogus for any non-page-aligned
address.

This affects the only in-tree user of this function - sysfs handler
for per-cpu 'crash_notes' physical address.  The trouble is that the
crash_notes per-cpu variable is not page-aligned:

crash_notes = 0xc08e8ed4
PER-CPU OFFSET VALUES:
 CPU 0: 3711f000
 CPU 1: 37129000
 CPU 2: 37133000
 CPU 3: 3713d000

So, the per-cpu addresses are:
 crash_notes on CPU 0: f7a07ed4 =&gt; phys 36b57ed4
 crash_notes on CPU 1: f7a11ed4 =&gt; phys 36b4ded4
 crash_notes on CPU 2: f7a1bed4 =&gt; phys 36b43ed4
 crash_notes on CPU 3: f7a25ed4 =&gt; phys 36b39ed4

However, /sys/devices/system/cpu/cpu*/crash_notes says:
 /sys/devices/system/cpu/cpu0/crash_notes: 36b57000
 /sys/devices/system/cpu/cpu1/crash_notes: 36b4d000
 /sys/devices/system/cpu/cpu2/crash_notes: 36b43000
 /sys/devices/system/cpu/cpu3/crash_notes: 36b39000

As you can see, all values are rounded down to a page
boundary. Consequently, this is where kexec sets up the NOTE segments,
and thus where the secondary kernel is looking for them. However, when
the first kernel crashes, it saves the notes to the unaligned
addresses, where they are not found.

Fix it by adding offset_in_page() to the translated page address.

-tj: Combined Eugene's and Petr's commit messages.

Signed-off-by: Eugene Surovegin &lt;ebs@ebshome.net&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Reported-by: Petr Tesarik &lt;ptesarik@suse.cz&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>percpu: fix chunk range calculation</title>
<updated>2011-12-21T20:57:37Z</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2011-11-18T18:55:35Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=6400c8a382ded237df5dc1605f0d06e7939ff4da'/>
<id>urn:sha1:6400c8a382ded237df5dc1605f0d06e7939ff4da</id>
<content type='text'>
commit a855b84c3d8c73220d4d3cd392a7bee7c83de70e upstream.

Percpu allocator recorded the cpus which map to the first and last
units in pcpu_first/last_unit_cpu respectively and used them to
determine the address range of a chunk - e.g. it assumed that the
first unit has the lowest address in a chunk while the last unit has
the highest address.

This simply isn't true.  Groups in a chunk can have arbitrary positive
or negative offsets from the previous one and there is no guarantee
that the first unit occupies the lowest offset while the last one the
highest.

Fix it by actually comparing unit offsets to determine cpus occupying
the lowest and highest offsets.  Also, rename pcu_first/last_unit_cpu
to pcpu_low/high_unit_cpu to avoid confusion.

The chunk address range is used to flush cache on vmalloc area
map/unmap and decide whether a given address is in the first chunk by
per_cpu_ptr_to_phys() and the bug was discovered by invalid
per_cpu_ptr_to_phys() translation for crash_note.

Kudos to Dave Young for tracking down the problem.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Reported-by: WANG Cong &lt;xiyou.wangcong@gmail.com&gt;
Reported-by: Dave Young &lt;dyoung@redhat.com&gt;
Tested-by: Dave Young &lt;dyoung@redhat.com&gt;
LKML-Reference: &lt;4EC21F67.10905@redhat.com&gt;
Signed-off-by: Thomas Renninger &lt;trenn@suse.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>Merge branch 'for-2.6.40' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu</title>
<updated>2011-05-24T18:53:42Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2011-05-24T18:53:42Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=5129df03d0c44b2d5a5f9d7d52f3b079706b9a8f'/>
<id>urn:sha1:5129df03d0c44b2d5a5f9d7d52f3b079706b9a8f</id>
<content type='text'>
* 'for-2.6.40' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu:
  percpu: Unify input section names
  percpu: Avoid extra NOP in percpu_cmpxchg16b_double
  percpu: Cast away printk format warning
  percpu: Always align percpu output section to PAGE_SIZE

Fix up fairly trivial conflict in arch/x86/include/asm/percpu.h as per Tejun
</content>
</entry>
<entry>
<title>Merge branch 'fixes-2.6.39' into for-2.6.40</title>
<updated>2011-05-24T07:59:36Z</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2011-05-24T07:59:36Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=6988f20fe04e9ef3aea488cb8ab57fbeb78e12f0'/>
<id>urn:sha1:6988f20fe04e9ef3aea488cb8ab57fbeb78e12f0</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Fix common misspellings</title>
<updated>2011-03-31T14:26:23Z</updated>
<author>
<name>Lucas De Marchi</name>
<email>lucas.demarchi@profusion.mobi</email>
</author>
<published>2011-03-31T01:57:33Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=25985edcedea6396277003854657b5f3cb31a628'/>
<id>urn:sha1:25985edcedea6396277003854657b5f3cb31a628</id>
<content type='text'>
Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi &lt;lucas.demarchi@profusion.mobi&gt;
</content>
</entry>
<entry>
<title>percpu: Cast away printk format warning</title>
<updated>2011-03-28T16:03:34Z</updated>
<author>
<name>Mike Frysinger</name>
<email>vapier@gentoo.org</email>
</author>
<published>2011-03-23T07:23:52Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=787e5b06a80e7fc9dc02d9b53a9d8d2ac63b7ace'/>
<id>urn:sha1:787e5b06a80e7fc9dc02d9b53a9d8d2ac63b7ace</id>
<content type='text'>
On 32-bit systems which don't happen to implicitly define or cast
VMALLOC_START and/or VMALLOC_END to long in their arch headers, the
printk in the percpu code will cause a warning to be emitted:

mm/percpu.c: In function 'pcpu_embed_first_chunk':
mm/percpu.c:1648: warning: format '%lx' expects type 'long unsigned int',
        but argument 3 has type 'unsigned int'

So add an explicit cast to unsigned long here.

Signed-off-by: Mike Frysinger &lt;vapier@gentoo.org&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
<entry>
<title>NOMMU: percpu should use is_vmalloc_addr().</title>
<updated>2011-03-28T11:53:29Z</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2011-03-28T11:53:29Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=eac522ef438f8ea173569fd0469371bc5d317947'/>
<id>urn:sha1:eac522ef438f8ea173569fd0469371bc5d317947</id>
<content type='text'>
per_cpu_ptr_to_phys() uses VMALLOC_START and VMALLOC_END to determine if an
address is in the vmalloc() region or not.  This is incorrect on NOMMU as
there is no real vmalloc() capability (vmalloc() is emulated by kmalloc()).

The correct way to do this is to use is_vmalloc_addr().  This encapsulates the
vmalloc() region test in MMU mode and just returns 0 in NOMMU mode.

On FRV in NOMMU mode, the percpu compilation fails without this patch:

mm/percpu.c: In function 'per_cpu_ptr_to_phys':
mm/percpu.c:1011: error: 'VMALLOC_START' undeclared (first use in this function)
mm/percpu.c:1011: error: (Each undeclared identifier is reported only once
mm/percpu.c:1011: error: for each function it appears in.)
mm/percpu.c:1012: error: 'VMALLOC_END' undeclared (first use in this function)
mm/percpu.c:1018: warning: control reaches end of non-void function

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
</content>
</entry>
<entry>
<title>percpu: Always align percpu output section to PAGE_SIZE</title>
<updated>2011-03-24T17:50:09Z</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2011-03-24T17:50:09Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=0415b00d175e0d8945e6785aad21b5f157976ce0'/>
<id>urn:sha1:0415b00d175e0d8945e6785aad21b5f157976ce0</id>
<content type='text'>
Percpu allocator honors alignment request upto PAGE_SIZE and both the
percpu addresses in the percpu address space and the translated kernel
addresses should be aligned accordingly.  The calculation of the
former depends on the alignment of percpu output section in the kernel
image.

The linker script macros PERCPU_VADDR() and PERCPU() are used to
define this output section and the latter takes @align parameter.
Several architectures are using @align smaller than PAGE_SIZE breaking
percpu memory alignment.

This patch removes @align parameter from PERCPU(), renames it to
PERCPU_SECTION() and makes it always align to PAGE_SIZE.  While at it,
add PCPU_SETUP_BUG_ON() checks such that alignment problems are
reliably detected and remove percpu alignment comment recently added
in workqueue.c as the condition would trigger BUG way before reaching
there.

For um, this patch raises the alignment of percpu area.  As the area
is in .init, there shouldn't be any noticeable difference.

This problem was discovered by David Howells while debugging boot
failure on mn10300.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Acked-by: Mike Frysinger &lt;vapier@gentoo.org&gt;
Cc: uclinux-dist-devel@blackfin.uclinux.org
Cc: David Howells &lt;dhowells@redhat.com&gt;
Cc: Jeff Dike &lt;jdike@addtoit.com&gt;
Cc: user-mode-linux-devel@lists.sourceforge.net
</content>
</entry>
<entry>
<title>Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial</title>
<updated>2011-01-13T18:05:56Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2011-01-13T18:05:56Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=008d23e4852d78bb2618f2035f8b2110b6a6b968'/>
<id>urn:sha1:008d23e4852d78bb2618f2035f8b2110b6a6b968</id>
<content type='text'>
* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (43 commits)
  Documentation/trace/events.txt: Remove obsolete sched_signal_send.
  writeback: fix global_dirty_limits comment runtime -&gt; real-time
  ppc: fix comment typo singal -&gt; signal
  drivers: fix comment typo diable -&gt; disable.
  m68k: fix comment typo diable -&gt; disable.
  wireless: comment typo fix diable -&gt; disable.
  media: comment typo fix diable -&gt; disable.
  remove doc for obsolete dynamic-printk kernel-parameter
  remove extraneous 'is' from Documentation/iostats.txt
  Fix spelling milisec -&gt; ms in snd_ps3 module parameter description
  Fix spelling mistakes in comments
  Revert conflicting V4L changes
  i7core_edac: fix typos in comments
  mm/rmap.c: fix comment
  sound, ca0106: Fix assignment to 'channel'.
  hrtimer: fix a typo in comment
  init/Kconfig: fix typo
  anon_inodes: fix wrong function name in comment
  fix comment typos concerning "consistent"
  poll: fix a typo in comment
  ...

Fix up trivial conflicts in:
 - drivers/net/wireless/iwlwifi/iwl-core.c (moved to iwl-legacy.c)
 - fs/ext4/ext4.h

Also fix missed 'diabled' typo in drivers/net/bnx2x/bnx2x.h while at it.
</content>
</entry>
</feed>
