<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/arch/arm/mm/context.c, branch linux-3.10.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.10.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.10.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2013-07-22T01:21:34Z</updated>
<entry>
<title>ARM: 7769/1: Cortex-A15: fix erratum 798181 implementation</title>
<updated>2013-07-22T01:21:34Z</updated>
<author>
<name>Marc Zyngier</name>
</author>
<published>2013-06-21T11:07:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e6a01df4cd3a38e8dcc05d763c0f793b2f30c5f2'/>
<id>urn:sha1:e6a01df4cd3a38e8dcc05d763c0f793b2f30c5f2</id>
<content type='text'>
commit 0d0752bca1f9a91fb646647aa4abbb21156f316c upstream.

Looking into the active_asids array is not enough, as we also need
to look into the reserved_asids array (they both represent processes
that are currently running).

Also, not holding the ASID allocator lock is racy, as another CPU
could schedule that process and trigger a rollover, making the erratum
workaround miss an IPI.

Exposing this outside of context.c is a little ugly on the side, so
let's define a new entry point that the erratum workaround can call
to obtain the cpumask.

Acked-by: Will Deacon &lt;will.deacon@arm.com&gt;
Acked-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
Signed-off-by: Marc Zyngier &lt;marc.zyngier@arm.com&gt;
Signed-off-by: Russell King &lt;rmk+kernel@arm.linux.org.uk&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>ARM: 7768/1: prevent risks of out-of-bound access in ASID allocator</title>
<updated>2013-07-22T01:21:34Z</updated>
<author>
<name>Marc Zyngier</name>
</author>
<published>2013-06-21T11:06:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4aa6022129a8b5e0b0e42815521071ce7a766a84'/>
<id>urn:sha1:4aa6022129a8b5e0b0e42815521071ce7a766a84</id>
<content type='text'>
commit b8e4a4740fa2b17c0a447b3ab783b3dc10702e27 upstream.

On a CPU that never ran anything, both the active and reserved ASID
fields are set to zero. In this case the ASID_TO_IDX() macro will
return -1, which is not a very useful value to index a bitmap.

Instead of trying to offset the ASID so that ASID #1 is actually
bit 0 in the asid_map bitmap, just always ignore bit 0 and start
the search from bit 1. This makes the code a bit more readable,
and without risk of OoB access.

Acked-by: Will Deacon &lt;will.deacon@arm.com&gt;
Acked-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
Reported-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
Signed-off-by: Marc Zyngier &lt;marc.zyngier@arm.com&gt;
Signed-off-by: Russell King &lt;rmk+kernel@arm.linux.org.uk&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>ARM: 7767/1: let the ASID allocator handle suspended animation</title>
<updated>2013-07-22T01:21:33Z</updated>
<author>
<name>Marc Zyngier</name>
</author>
<published>2013-06-21T11:06:19Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b7dc4032cd44843ea93119adb00a5f15b7b05943'/>
<id>urn:sha1:b7dc4032cd44843ea93119adb00a5f15b7b05943</id>
<content type='text'>
commit ae120d9edfe96628f03d87634acda0bfa7110632 upstream.

When a CPU is running a process, the ASID for that process is
held in a per-CPU variable (the "active ASIDs" array). When
the ASID allocator handles a rollover, it copies the active
ASIDs into a "reserved ASIDs" array to ensure that a process
currently running on another CPU will continue to run unaffected.
The active array is zero-ed to indicate that a rollover occurred.

Because of this mechanism, a reserved ASID is only remembered for
a single rollover. A subsequent rollover will completely refill
the reserved ASIDs array.

In a severely oversubscribed environment where a CPU can be
prevented from running for extended periods of time (think virtual
machines), the above has a horrible side effect:

[P{a} denotes process P running with ASID a]

	CPU-0		CPU-1

	A{x}				[active = &lt;x 0&gt;]

	[suspended]	runs B{y}	[active = &lt;x y&gt;]

					[rollover:
					 active = &lt;0 0&gt;
					 reserved = &lt;x y&gt;]

			runs B{y}	[active = &lt;0 y&gt;
					 reserved = &lt;x y&gt;]

					[rollover:
					 active = &lt;0 0&gt;
					 reserved = &lt;0 y&gt;]

			runs C{x}	[active = &lt;0 x&gt;]

	[resumes]

	runs A{x}

At that stage, both A and C have the same ASID, with deadly
consequences.

The fix is to preserve reserved ASIDs across rollovers if
the CPU doesn't have an active ASID when the rollover occurs.

Acked-by: Will Deacon &lt;will.deacon@arm.com&gt;
Acked-by: Catalin Carinas &lt;catalin.marinas@arm.com&gt;
Signed-off-by: Marc Zyngier &lt;marc.zyngier@arm.com&gt;
Signed-off-by: Russell King &lt;rmk+kernel@arm.linux.org.uk&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>ARM: 7684/1: errata: Workaround for Cortex-A15 erratum 798181 (TLBI/DSB operations)</title>
<updated>2013-04-03T15:45:49Z</updated>
<author>
<name>Catalin Marinas</name>
</author>
<published>2013-03-26T22:35:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=93dc68876b608da041fe40ed39424b0fcd5aa2fb'/>
<id>urn:sha1:93dc68876b608da041fe40ed39424b0fcd5aa2fb</id>
<content type='text'>
On Cortex-A15 (r0p0..r3p2) the TLBI/DSB are not adequately shooting down
all use of the old entries. This patch implements the erratum workaround
which consists of:

1. Dummy TLBIMVAIS and DSB on the CPU doing the TLBI operation.
2. Send IPI to the CPUs that are running the same mm (and ASID) as the
   one being invalidated (or all the online CPUs for global pages).
3. CPU receiving the IPI executes a DMB and CLREX (part of the exception
   return code already).

Signed-off-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
Signed-off-by: Russell King &lt;rmk+kernel@arm.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>ARM: 7661/1: mm: perform explicit branch predictor maintenance when required</title>
<updated>2013-03-03T22:54:16Z</updated>
<author>
<name>Will Deacon</name>
</author>
<published>2013-02-28T16:48:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=89c7e4b8bbb3d4fa52df5746a8ad38e610143651'/>
<id>urn:sha1:89c7e4b8bbb3d4fa52df5746a8ad38e610143651</id>
<content type='text'>
The ARM ARM requires branch predictor maintenance if, for a given ASID,
the instructions at a specific virtual address appear to change.

From the kernel's point of view, that means:

	- Changing the kernel's view of memory (e.g. switching to the
	  identity map)
	- ASID rollover (since ASIDs will be re-allocated to new tasks)

This patch adds explicit branch predictor maintenance when either of the
two conditions above are met.

Reviewed-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
Signed-off-by: Will Deacon &lt;will.deacon@arm.com&gt;
Signed-off-by: Russell King &lt;rmk+kernel@arm.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>ARM: 7659/1: mm: make mm-&gt;context.id an atomic64_t variable</title>
<updated>2013-03-03T22:54:14Z</updated>
<author>
<name>Will Deacon</name>
</author>
<published>2013-02-28T16:47:36Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8a4e3a9ead7e37ce1505602b564c15da09ac039f'/>
<id>urn:sha1:8a4e3a9ead7e37ce1505602b564c15da09ac039f</id>
<content type='text'>
mm-&gt;context.id is updated under asid_lock when a new ASID is allocated
to an mm_struct. However, it is also read without the lock when a task
is being scheduled and checking whether or not the current ASID
generation is up-to-date.

If two threads of the same process are being scheduled in parallel and
the bottom bits of the generation in their mm-&gt;context.id match the
current generation (that is, the mm_struct has not been used for ~2^24
rollovers) then the non-atomic, lockless access to mm-&gt;context.id may
yield the incorrect ASID.

This patch fixes this issue by making mm-&gt;context.id and atomic64_t,
ensuring that the generation is always read consistently. For code that
only requires access to the ASID bits (e.g. TLB flushing by mm), then
the value is accessed directly, which GCC converts to an ldrb.

Cc: &lt;stable@vger.kernel.org&gt; # 3.8
Reviewed-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
Signed-off-by: Will Deacon &lt;will.deacon@arm.com&gt;
Signed-off-by: Russell King &lt;rmk+kernel@arm.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>ARM: 7658/1: mm: fix race updating mm-&gt;context.id on ASID rollover</title>
<updated>2013-03-03T22:54:13Z</updated>
<author>
<name>Will Deacon</name>
</author>
<published>2013-02-28T16:47:20Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=37f47e3d62533c931b04cb409f2eb299e6342331'/>
<id>urn:sha1:37f47e3d62533c931b04cb409f2eb299e6342331</id>
<content type='text'>
If a thread triggers an ASID rollover, other threads of the same process
must be made to wait until the mm-&gt;context.id for the shared mm_struct
has been updated to new generation and associated book-keeping (e.g.
TLB invalidation) has ben performed.

However, there is a *tiny* window where both mm-&gt;context.id and the
relevant active_asids entry are updated to the new generation, but the
TLB flush has not been performed, which could allow another thread to
return to userspace with a dirty TLB, potentially leading to data
corruption. In reality this will never occur because one CPU would need
to perform a context-switch in the time it takes another to do a couple
of atomic test/set operations but we should plug the race anyway.

This patch moves the active_asids update until after the potential TLB
flush on context-switch.

Cc: &lt;stable@vger.kernel.org&gt; # 3.8
Reviewed-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
Signed-off-by: Will Deacon &lt;will.deacon@arm.com&gt;
Signed-off-by: Russell King &lt;rmk+kernel@arm.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>ARM: 7649/1: mm: mm-&gt;context.id fix for big-endian</title>
<updated>2013-02-16T17:54:26Z</updated>
<author>
<name>Ben Dooks</name>
</author>
<published>2013-02-11T11:25:06Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9520a5bece13b7382f4b0059180f61530c423c81'/>
<id>urn:sha1:9520a5bece13b7382f4b0059180f61530c423c81</id>
<content type='text'>
Since the new ASID code in b5466f8728527a05a493cc4abe9e6f034a1bbaab
("ARM: mm: remove IPI broadcasting on ASID rollover") was changed to
use 64bit operations it has broken the BE operation due to an issue
with the MM code accessing sub-fields of mm-&gt;context.id.

When running in BE mode we see the values in mm-&gt;context.id are stored
with the highest value first, so the LDR in the arch/arm/mm/proc-macros.S
reads the wrong part of this field. To resolve this, change the LDR in
the mmid macro to load from +4.

Acked-by: Will Deacon &lt;will.deacon@arm.com&gt;
Signed-off-by: Ben Dooks &lt;ben.dooks@codethink.co.uk&gt;
Signed-off-by: Russell King &lt;rmk+kernel@arm.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>ARM: 7582/2: rename kvm_seq to vmalloc_seq so to avoid confusion with KVM</title>
<updated>2012-11-26T12:23:53Z</updated>
<author>
<name>Nicolas Pitre</name>
</author>
<published>2012-11-25T02:24:32Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3e99675af1b25a191c467700499b1cbe5585a778'/>
<id>urn:sha1:3e99675af1b25a191c467700499b1cbe5585a778</id>
<content type='text'>
The kvm_seq value has nothing to do what so ever with this other KVM.
Given that KVM support on ARM is imminent, it's best to rename kvm_seq
into something else to clearly identify what it is about i.e. a sequence
number for vmalloc section mappings.

Signed-off-by: Nicolas Pitre &lt;nico@linaro.org&gt;
Signed-off-by: Russell King &lt;rmk+kernel@arm.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>ARM: mm: use bitmap operations when allocating new ASIDs</title>
<updated>2012-11-05T16:25:25Z</updated>
<author>
<name>Will Deacon</name>
</author>
<published>2012-08-01T13:57:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=bf51bb82ccd9a74e9702d06107b23e54b27a5707'/>
<id>urn:sha1:bf51bb82ccd9a74e9702d06107b23e54b27a5707</id>
<content type='text'>
When allocating a new ASID, we must take care not to re-assign a
reserved ASID-value to a new mm. This requires us to check each
candidate ASID against those currently reserved by other cores before
assigning a new ASID to the current mm.

This patch improves the ASID allocation algorithm by using a
bitmap-based approach. Rather than iterating over the reserved ASID
array for each candidate ASID, we simply find the first zero bit,
ensuring that those indices corresponding to reserved ASIDs are set
when flushing during a rollover event.

Tested-by: Marc Zyngier &lt;marc.zyngier@arm.com&gt;
Signed-off-by: Will Deacon &lt;will.deacon@arm.com&gt;
</content>
</entry>
</feed>
