Skip to content

Commit 5cdbde4

Browse files
committed
ARCv2: guard SLC DMA ops with spinlock
SLC maintenance ops need to be serialized by software as there is no inherent buffering / quequing of aux commands. It can silently ignore a new aux operation if previous one is still ongoing (SLC_CTRL_BUSY) So gaurd the SLC op using a spin lock The spin lock doesn't seem to be contended even in heavy workloads such as iperf. On FPGA @ 75 MHz. [1] Before this change: ============================================================ # iperf -c 10.42.0.1 ------------------------------------------------------------ Client connecting to 10.42.0.1, TCP port 5001 TCP window size: 43.8 KByte (default) ------------------------------------------------------------ [ 3] local 10.42.0.110 port 38935 connected with 10.42.0.1 port 5001 [ ID] Interval Transfer Bandwidth [ 3] 0.0-10.0 sec 48.4 MBytes 40.6 Mbits/sec ============================================================ [2] After this change: ============================================================ # iperf -c 10.42.0.1 ------------------------------------------------------------ Client connecting to 10.42.0.1, TCP port 5001 TCP window size: 43.8 KByte (default) ------------------------------------------------------------ [ 3] local 10.42.0.243 port 60248 connected with 10.42.0.1 port 5001 [ ID] Interval Transfer Bandwidth [ 3] 0.0-10.0 sec 47.5 MBytes 39.8 Mbits/sec # iperf -c 10.42.0.1 ------------------------------------------------------------ Client connecting to 10.42.0.1, TCP port 5001 TCP window size: 43.8 KByte (default) ------------------------------------------------------------ [ 3] local 10.42.0.243 port 60249 connected with 10.42.0.1 port 5001 [ ID] Interval Transfer Bandwidth [ 3] 0.0-10.0 sec 54.9 MBytes 46.0 Mbits/sec ============================================================ Signed-off-by: Alexey Brodkin <[email protected]> Cc: [email protected] Signed-off-by: Vineet Gupta <[email protected]>
1 parent 6312e11 commit 5cdbde4

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

arch/arc/mm/cache_arc700.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -560,10 +560,18 @@ static void inline __ic_line_inv_vaddr(unsigned long paddr, unsigned long vaddr,
560560
void noinline slc_op(unsigned long paddr, unsigned long sz, const int op)
561561
{
562562
#ifdef CONFIG_ISA_ARCV2
563+
/*
564+
* SLC is shared between all cores and concurrent aux operations from
565+
* multiple cores need to be serialized using a spinlock
566+
* A concurrent operation can be silently ignored and/or the old/new
567+
* operation can remain incomplete forever (lockup in SLC_CTRL_BUSY loop
568+
* below)
569+
*/
570+
static DEFINE_SPINLOCK(lock);
563571
unsigned long flags;
564572
unsigned int ctrl;
565573

566-
local_irq_save(flags);
574+
spin_lock_irqsave(&lock, flags);
567575

568576
/*
569577
* The Region Flush operation is specified by CTRL.RGN_OP[11..9]
@@ -596,7 +604,7 @@ void noinline slc_op(unsigned long paddr, unsigned long sz, const int op)
596604

597605
while (read_aux_reg(ARC_REG_SLC_CTRL) & SLC_CTRL_BUSY);
598606

599-
local_irq_restore(flags);
607+
spin_unlock_irqrestore(&lock, flags);
600608
#endif
601609
}
602610

0 commit comments

Comments
 (0)