Commit 0532ec6d authored by Wei Li's avatar Wei Li Committed by Zheng Zengkai
Browse files

locking/qspinlock: Add CNA support for ARM64



hulk inclusion
category: feature
bugzilla: 169576
CVE: NA

-------------------------------------------------

Enabling CNA is controlled via a new configuration option
(NUMA_AWARE_SPINLOCKS). Add it for arm64.

Signed-off-by: default avatarWei Li <liwei391@huawei.com>
Reviewed-by: default avatarXie XiuQi <xiexiuqi@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent 5a868a49
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -1075,6 +1075,22 @@ config NODES_SHIFT
	  Specify the maximum number of NUMA Nodes available on the target
	  system.  Increases memory reserved to accommodate various tables.

config NUMA_AWARE_SPINLOCKS
	bool "Numa-aware spinlocks"
	depends on NUMA
	depends on QUEUED_SPINLOCKS
	depends on PARAVIRT_SPINLOCKS
	default y
	help
	  Introduce NUMA (Non Uniform Memory Access) awareness into
	  the slow path of spinlocks.

	  In this variant of qspinlock, the kernel will try to keep the lock
	  on the same node, thus reducing the number of remote cache misses,
	  while trading some of the short term fairness for better performance.

	  Say N if you want absolute first come first serve fairness.

config USE_PERCPU_NUMA_NODE_ID
	def_bool y
	depends on NUMA
+4 −0
Original line number Diff line number Diff line
@@ -14,6 +14,10 @@

#define _Q_PENDING_LOOPS	(1 << 9)

#ifdef CONFIG_NUMA_AWARE_SPINLOCKS
extern void cna_configure_spin_lock_slowpath(void);
#endif

#ifdef CONFIG_PARAVIRT_SPINLOCKS
extern void native_queued_spin_lock_slowpath(struct qspinlock *lock, u32 val);
extern void __pv_init_lock_hash(void);
+0 −4
Original line number Diff line number Diff line
@@ -741,10 +741,6 @@ void __init alternative_instructions(void)
	}
#endif

#if defined(CONFIG_NUMA_AWARE_SPINLOCKS)
	cna_configure_spin_lock_slowpath();
#endif

	apply_paravirt(__parainstructions, __parainstructions_end);

	restart_nmi();
+4 −0
Original line number Diff line number Diff line
@@ -2823,6 +2823,10 @@ void __init numa_policy_init(void)
		pr_err("%s: interleaving failed\n", __func__);

	check_numabalancing_enable();

#if defined(CONFIG_NUMA_AWARE_SPINLOCKS)
	cna_configure_spin_lock_slowpath();
#endif
}

/* Reset policy of current process to default */