From 93a97bce23d6b4a7955e71e2881e4bad70657b13 Mon Sep 17 00:00:00 2001
From: Juergen Gross <jgross@suse.com>
Date: Thu, 25 Mar 2021 12:01:19 +0100
Patch-mainline: never, SUSE debugging
References: bsc#1180846
Subject: [PATCH v2 2/2] kernel/smp: make csdlock timeout depend on boot
parameter
Add a csdlock_timeout parameter for being able to specify csdlock
timeout in milliseconds. Default is 5000 (5 seconds).
Signed-off-by: Juergen Gross <jgross@suse.com>
---
kernel/smp.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -25,6 +25,7 @@
#include <linux/nmi.h>
#include <linux/sched/debug.h>
#include <linux/jump_label.h>
+#include <linux/moduleparam.h>
#define CREATE_TRACE_POINTS
#include <trace/events/csd.h>
@@ -190,12 +191,14 @@ static int __init csdlock_debug(char *st
}
early_param("csdlock_debug", csdlock_debug);
+static int csdlock_timeout = 5000;
+core_param(csdlock_timeout, csdlock_timeout, int, 0644);
+
static DEFINE_PER_CPU(call_single_data_t *, cur_csd);
static DEFINE_PER_CPU(smp_call_func_t, cur_csd_func);
static DEFINE_PER_CPU(void *, cur_csd_info);
static DEFINE_PER_CPU(struct cfd_seq_local, cfd_seq_local);
-#define CSD_LOCK_TIMEOUT (5ULL * NSEC_PER_SEC)
static atomic_t csd_bug_count = ATOMIC_INIT(0);
static u64 cfd_seq;
@@ -353,7 +356,7 @@ static bool csd_lock_wait_toolong(struct
ts2 = sched_clock();
ts_delta = ts2 - *ts1;
- if (likely(ts_delta <= CSD_LOCK_TIMEOUT))
+ if (likely(ts_delta <= (u64)csdlock_timeout * NSEC_PER_MSEC))
return false;
firsttime = !*bug_id;