<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/arch/arc/include, branch v3.12</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v3.12</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v3.12'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2013-09-27T10:58:48Z</updated>
<entry>
<title>ARC: Workaround spinlock livelock in SMP SystemC simulation</title>
<updated>2013-09-27T10:58:48Z</updated>
<author>
<name>Vineet Gupta</name>
<email>vgupta@synopsys.com</email>
</author>
<published>2013-09-25T11:23:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=6c00350b573c0bd3635436e43e8696951dd6e1b6'/>
<id>urn:sha1:6c00350b573c0bd3635436e43e8696951dd6e1b6</id>
<content type='text'>
Some ARC SMP systems lack native atomic R-M-W (LLOCK/SCOND) insns and
can only use atomic EX insn (reg with mem) to build higher level R-M-W
primitives. This includes a SystemC based SMP simulation model.

So rwlocks need to use a protecting spinlock for atomic cmp-n-exchange
operation to update reader(s)/writer count.

The spinlock operation itself looks as follows:

	mov reg, 1		; 1=locked, 0=unlocked
retry:
	EX reg, [lock]		; load existing, store 1, atomically
	BREQ reg, 1, rety	; if already locked, retry

In single-threaded simulation, SystemC alternates between the 2 cores
with "N" insn each based scheduling. Additionally for insn with global
side effect, such as EX writing to shared mem, a core switch is
enforced too.

Given that, 2 cores doing a repeated EX on same location, Linux often
got into a livelock e.g. when both cores were fiddling with tasklist
lock (gdbserver / hackbench) for read/write respectively as the
sequence diagram below shows:

           core1                                   core2
         --------                                --------
1. spin lock [EX r=0, w=1] - LOCKED
2. rwlock(Read)            - LOCKED
3. spin unlock  [ST 0]     - UNLOCKED
                                         spin lock [EX r=0,w=1] - LOCKED
                      -- resched core 1----

5. spin lock [EX r=1] - ALREADY-LOCKED

                      -- resched core 2----
6.                                       rwlock(Write) - READER-LOCKED
7.                                       spin unlock [ST 0]
8.                                       rwlock failed, retry again

9.                                       spin lock  [EX r=0, w=1]
                      -- resched core 1----

10  spinlock locked in #9, retry #5
11. spin lock [EX gets 1]
                      -- resched core 2----
...
...

The fix was to unlock using the EX insn too (step 7), to trigger another
SystemC scheduling pass which would let core1 proceed, eliding the
livelock.

Signed-off-by: Vineet Gupta &lt;vgupta@synopsys.com&gt;
</content>
</entry>
<entry>
<title>ARC: Fix 32-bit wrap around in access_ok()</title>
<updated>2013-09-27T10:58:47Z</updated>
<author>
<name>Vineet Gupta</name>
<email>vgupta@synopsys.com</email>
</author>
<published>2013-09-26T13:20:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=0752adfda15f0eca9859a76da3db1800e129ad43'/>
<id>urn:sha1:0752adfda15f0eca9859a76da3db1800e129ad43</id>
<content type='text'>
Anton reported

 | LTP tests syscalls/process_vm_readv01 and process_vm_writev01 fail
 | similarly in one testcase test_iov_invalid -&gt; lvec-&gt;iov_base.
 | Testcase expects errno EFAULT and return code -1,
 | but it gets return code 1 and ERRNO is 0 what means success.

Essentially test case was passing a pointer of -1 which access_ok()
was not catching. It was doing [@addr + @sz &lt;= TASK_SIZE] which would
pass for @addr == -1

Fixed that by rewriting as [@addr &lt;= TASK_SIZE - @sz]

Reported-by: Anton Kolesov &lt;Anton.Kolesov@synopsys.com&gt;
Signed-off-by: Vineet Gupta &lt;vgupta@synopsys.com&gt;
</content>
</entry>
<entry>
<title>ARC: SMP failed to boot due to missing IVT setup</title>
<updated>2013-09-12T14:40:08Z</updated>
<author>
<name>Noam Camus</name>
<email>noamc@ezchip.com</email>
</author>
<published>2013-09-12T07:37:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c3567f8a359b7917dcffa442301f88ed0a75211f'/>
<id>urn:sha1:c3567f8a359b7917dcffa442301f88ed0a75211f</id>
<content type='text'>
Commit 05b016ecf5e7a "ARC: Setup Vector Table Base in early boot" moved
the Interrupt vector Table setup out of arc_init_IRQ() which is called
for all CPUs, to entry point of boot cpu only, breaking booting of others.

Fix by adding the same to entry point of non-boot CPUs too.

read_arc_build_cfg_regs() printing IVT Base Register didn't help the
casue since it prints a synthetic value if zero which is totally bogus,
so fix that to print the exact Register.

[vgupta: Remove the now stale comment from header of arc_init_IRQ and
also added the commentary for halt-on-reset]

Cc: Gilad Ben-Yossef &lt;gilad@benyossef.com&gt;
Cc: Cc: &lt;stable@vger.kernel.org&gt; #3.11
Signed-off-by: Noam Camus &lt;noamc@ezchip.com&gt;
Signed-off-by: Vineet Gupta &lt;vgupta@synopsys.com&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>ARC: fix new Section mismatches in build (post __cpuinit cleanup)</title>
<updated>2013-09-05T13:49:06Z</updated>
<author>
<name>Vineet Gupta</name>
<email>vgupta@synopsys.com</email>
</author>
<published>2013-09-05T13:49:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=07b9b65147d1d7cc03b9ff1e1f3b1c163ba4d067'/>
<id>urn:sha1:07b9b65147d1d7cc03b9ff1e1f3b1c163ba4d067</id>
<content type='text'>
---------------&gt;8--------------------
WARNING: vmlinux.o(.text+0x708): Section mismatch in reference from the
function read_arc_build_cfg_regs() to the function
.init.text:read_decode_cache_bcr()

WARNING: vmlinux.o(.text+0x702): Section mismatch in reference from the
function read_arc_build_cfg_regs() to the function
.init.text:read_decode_mmu_bcr()
---------------&gt;8--------------------

Signed-off-by: Vineet Gupta &lt;vgupta@synopsys.com&gt;
</content>
</entry>
<entry>
<title>ARC: Fix __udelay calculation</title>
<updated>2013-09-05T05:01:12Z</updated>
<author>
<name>Mischa Jonker</name>
<email>mjonker@synopsys.com</email>
</author>
<published>2013-08-30T09:56:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7efd0da2d17360e1cef91507dbe619db0ee2c691'/>
<id>urn:sha1:7efd0da2d17360e1cef91507dbe619db0ee2c691</id>
<content type='text'>
Cast usecs to u64, to ensure that the (usecs * 4295 * HZ)
multiplication is 64 bit.

Initially, the (usecs * 4295 * HZ) part was done as a 32 bit
multiplication, with the result casted to 64 bit. This led to some bits
falling off, causing a "DMA initialization error" in the stmmac Ethernet
driver, due to a premature timeout.

Signed-off-by: Mischa Jonker &lt;mjonker@synopsys.com&gt;
Signed-off-by: Vineet Gupta &lt;vgupta@synopsys.com&gt;
</content>
</entry>
<entry>
<title>ARC: Add read*_relaxed to asm/io.h</title>
<updated>2013-09-05T05:01:11Z</updated>
<author>
<name>Mischa Jonker</name>
<email>mjonker@synopsys.com</email>
</author>
<published>2013-08-28T18:32:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=6532b02fe5affb962b267e3c12e87ec16311aebf'/>
<id>urn:sha1:6532b02fe5affb962b267e3c12e87ec16311aebf</id>
<content type='text'>
Some drivers require these, and ARC didn't had them yet.

Signed-off-by: Mischa Jonker &lt;mjonker@synopsys.com&gt;
Signed-off-by: Vineet Gupta &lt;vgupta@synopsys.com&gt;
</content>
</entry>
<entry>
<title>ARC: [ASID] Track ASID allocation cycles/generations</title>
<updated>2013-08-30T16:12:19Z</updated>
<author>
<name>Vineet Gupta</name>
<email>vgupta@synopsys.com</email>
</author>
<published>2013-07-25T22:45:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=947bf103fcd2defa3bc4b7ebc6b05d0427bcde2d'/>
<id>urn:sha1:947bf103fcd2defa3bc4b7ebc6b05d0427bcde2d</id>
<content type='text'>
This helps remove asid-to-mm reverse map

While mm-&gt;context.id contains the ASID assigned to a process, our ASID
allocator also used asid_mm_map[] reverse map. In a new allocation
cycle (mm-&gt;ASID &gt;= @asid_cache), the Round Robin ASID allocator used this
to check if new @asid_cache belonged to some mm2 (from prev cycle).
If so, it could locate that mm using the ASID reverse map, and mark that
mm as unallocated ASID, to force it to refresh at the time of switch_mm()

However, for SMP, the reverse map has to be maintained per CPU, so
becomes 2 dimensional, hence got rid of it.

With reverse map gone, it is NOT possible to reach out to current
assignee. So we track the ASID allocation generation/cycle and
on every switch_mm(), check if the current generation of CPU ASID is
same as mm's ASID; If not it is refreshed.

(Based loosely on arch/sh implementation)

Signed-off-by: Vineet Gupta &lt;vgupta@synopsys.com&gt;
</content>
</entry>
<entry>
<title>ARC: [ASID] activate_mm() == switch_mm()</title>
<updated>2013-08-30T16:12:19Z</updated>
<author>
<name>Vineet Gupta</name>
<email>vgupta@synopsys.com</email>
</author>
<published>2013-07-25T00:31:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c60115537c96d78a884d2a4bd78839a57266d48b'/>
<id>urn:sha1:c60115537c96d78a884d2a4bd78839a57266d48b</id>
<content type='text'>
ASID allocation changes/2

Use the fact that switch_mm() and activate_mm() are exactly same code
now while acknowledging the semantical difference in comment

Signed-off-by: Vineet Gupta &lt;vgupta@synopsys.com&gt;
</content>
</entry>
<entry>
<title>ARC: [ASID] get_new_mmu_context() to conditionally allocate new ASID</title>
<updated>2013-08-30T16:12:18Z</updated>
<author>
<name>Vineet Gupta</name>
<email>vgupta@synopsys.com</email>
</author>
<published>2013-07-24T20:53:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=3daa48d1d9bc44baa079d65e72ef2e3f1139ac03'/>
<id>urn:sha1:3daa48d1d9bc44baa079d65e72ef2e3f1139ac03</id>
<content type='text'>
ASID allocation changes/1

This patch does 2 things:

(1) get_new_mmu_context() NOW moves mm-&gt;ASID to a new value ONLY if it
    was from a prev allocation cycle/generation OR if mm had no ASID
    allocated (vs. before would unconditionally moving to a new ASID)

    Callers desiring unconditional update of ASID, e.g.local_flush_tlb_mm()
    (for parent's address space invalidation at fork) need to first force
    the parent to an unallocated ASID.

(2) get_new_mmu_context() always sets the MMU PID reg with unchanged/new
    ASID value.

The gains are:
- consolidation of all asid alloc logic into get_new_mmu_context()
- avoiding code duplication in switch_mm() for PID reg setting
- Enables future change to fold activate_mm() into switch_mm()

Signed-off-by: Vineet Gupta &lt;vgupta@synopsys.com&gt;
</content>
</entry>
<entry>
<title>ARC: [ASID] Refactor the TLB paranoid debug code</title>
<updated>2013-08-30T16:12:18Z</updated>
<author>
<name>Vineet Gupta</name>
<email>vgupta@synopsys.com</email>
</author>
<published>2013-08-23T12:07:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5bd87adf9b2ae5fa1bb469c68029b4eec06d6e03'/>
<id>urn:sha1:5bd87adf9b2ae5fa1bb469c68029b4eec06d6e03</id>
<content type='text'>
-Asm code already has values of SW and HW ASID values, so they can be
 passed to the printing routine.

Signed-off-by: Vineet Gupta &lt;vgupta@synopsys.com&gt;
</content>
</entry>
</feed>
