From nobody Mon Nov 25 00:30:49 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6D05B1A38F9 for ; Thu, 31 Oct 2024 15:15:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730387706; cv=none; b=n57zsIQ6WX0zbCkQlcWFUyaezoIysfshyObydinRDPJT/jZutufcQUa+p5YbhiiyFiS++SQ5dNCLdvXIf7o14eNzi/3uYxVC0UstXoDsuKT+DnRDqS0Qy0JldnpZ3ZYDzCpYhEj7/gNtEY5zet0Ku32M5CnARNl6GZebQfpk6hI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730387706; c=relaxed/simple; bh=0uiAuhLaJEr2R/9XhjcBgZa33ofCJ6EQiNLRnnuwd2M=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=iPpsAqoJU8SktQE9B65yTla5uEFAMb06GAq6uA+Li2MA+rtnObpRwBf8BdDfsZAyzRi//kxXllPBPOGS9045mLW3CgN6dM0iJhJYQtd+ly5JzIVQLNRZab+r8qM2uzOKjBS/YzDvcDZjy76sQuF+o9xB76NYD6NLKOzsc5k4Wns= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=m7c5u4BO; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=lsfsbwDP; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="m7c5u4BO"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="lsfsbwDP" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730387701; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8k2q3BNvsX24wBPWJnUHxsX8d4S+j4p8fnj9V0y3pL0=; b=m7c5u4BOWGV7ZOKjHlH3os+peLHipi+QLOgKQN/Pb7W2RSXPyw2A/mkrolTEkhM1VXSKTe +dgOzv5Ff8y+VjT2oe/o7BDFHCUBID3T2oB+YHI+ims2keEe+EKVUcOkRWJ426ZM+MtpiW iOMavTn9t4lA6ONCCuPo1BWkAwDGdb74eQc48o/e3j7X6Og8ZeBgN2xUrujihkaMXZzxlC sHnh3tdAdthv+mE+kG+SILfIx6whfY0iz3PSlUK99JrHwflQOKaVIy4P8dhCxVAKq6p4Oq 6oQLWjLo+YVpWSDQPCtEY2h/+0SY/eBJivfBXhu15SZ7ux2muWd4vmWGfwZzVw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730387701; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8k2q3BNvsX24wBPWJnUHxsX8d4S+j4p8fnj9V0y3pL0=; b=lsfsbwDP96j26QVLk+Y+tq+vSjKRYFALvEarfS5aNMF9mRtpkU9eORENLi03FuqV/3ZOB4 VzpRX9Tbn4an+7CQ== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Jani Nikula , intel-gfx@lists.freedesktop.org, Sean Christopherson , Paolo Bonzini , x86@kernel.org, Jakub Kicinski , Kalle Valo , Jens Axboe , Christian Brauner , Peter Zijlstra , John Stultz , Nam Cao , Oliver Hartkopp Subject: [RESEND PATCH v2 01/19] hrtimers: Add missing hrtimer_init() trace points Date: Thu, 31 Oct 2024 16:14:15 +0100 Message-Id: <74528e8abf2bb96e8bee85ffacbf14e15cf89f0d.1730386209.git.namcao@linutronix.de> In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" hrtimer_init*_on_stack() is not covered by tracing when CONFIG_DEBUG_OBJECTS_TIMERS=3Dy. Rework the functions similar to hrtimer_init() and hrtimer_init_sleeper() so that the hrtimer_init() tracepoint is unconditionally available. The rework makes hrtimer_init_sleeper() unused. Delete it. Signed-off-by: Nam Cao --- include/linux/hrtimer.h | 19 +----------- kernel/time/hrtimer.c | 65 +++++++++++++++++++++++------------------ 2 files changed, 37 insertions(+), 47 deletions(-) diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index aa1e65ccb615..5aa9d57528c4 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h @@ -228,32 +228,15 @@ static inline void hrtimer_cancel_wait_running(struct= hrtimer *timer) /* Initialize timers: */ extern void hrtimer_init(struct hrtimer *timer, clockid_t which_clock, enum hrtimer_mode mode); -extern void hrtimer_init_sleeper(struct hrtimer_sleeper *sl, clockid_t clo= ck_id, - enum hrtimer_mode mode); - -#ifdef CONFIG_DEBUG_OBJECTS_TIMERS extern void hrtimer_init_on_stack(struct hrtimer *timer, clockid_t which_c= lock, enum hrtimer_mode mode); extern void hrtimer_init_sleeper_on_stack(struct hrtimer_sleeper *sl, clockid_t clock_id, enum hrtimer_mode mode); =20 +#ifdef CONFIG_DEBUG_OBJECTS_TIMERS extern void destroy_hrtimer_on_stack(struct hrtimer *timer); #else -static inline void hrtimer_init_on_stack(struct hrtimer *timer, - clockid_t which_clock, - enum hrtimer_mode mode) -{ - hrtimer_init(timer, which_clock, mode); -} - -static inline void hrtimer_init_sleeper_on_stack(struct hrtimer_sleeper *s= l, - clockid_t clock_id, - enum hrtimer_mode mode) -{ - hrtimer_init_sleeper(sl, clock_id, mode); -} - static inline void destroy_hrtimer_on_stack(struct hrtimer *timer) { } #endif =20 diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index 04f7d8a392c3..4b0507cf38ea 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c @@ -417,6 +417,11 @@ static inline void debug_hrtimer_init(struct hrtimer *= timer) debug_object_init(timer, &hrtimer_debug_descr); } =20 +static inline void debug_hrtimer_init_on_stack(struct hrtimer *timer) +{ + debug_object_init_on_stack(timer, &hrtimer_debug_descr); +} + static inline void debug_hrtimer_activate(struct hrtimer *timer, enum hrtimer_mode mode) { @@ -428,28 +433,6 @@ static inline void debug_hrtimer_deactivate(struct hrt= imer *timer) debug_object_deactivate(timer, &hrtimer_debug_descr); } =20 -static void __hrtimer_init(struct hrtimer *timer, clockid_t clock_id, - enum hrtimer_mode mode); - -void hrtimer_init_on_stack(struct hrtimer *timer, clockid_t clock_id, - enum hrtimer_mode mode) -{ - debug_object_init_on_stack(timer, &hrtimer_debug_descr); - __hrtimer_init(timer, clock_id, mode); -} -EXPORT_SYMBOL_GPL(hrtimer_init_on_stack); - -static void __hrtimer_init_sleeper(struct hrtimer_sleeper *sl, - clockid_t clock_id, enum hrtimer_mode mode); - -void hrtimer_init_sleeper_on_stack(struct hrtimer_sleeper *sl, - clockid_t clock_id, enum hrtimer_mode mode) -{ - debug_object_init_on_stack(&sl->timer, &hrtimer_debug_descr); - __hrtimer_init_sleeper(sl, clock_id, mode); -} -EXPORT_SYMBOL_GPL(hrtimer_init_sleeper_on_stack); - void destroy_hrtimer_on_stack(struct hrtimer *timer) { debug_object_free(timer, &hrtimer_debug_descr); @@ -459,6 +442,7 @@ EXPORT_SYMBOL_GPL(destroy_hrtimer_on_stack); #else =20 static inline void debug_hrtimer_init(struct hrtimer *timer) { } +static inline void debug_hrtimer_init_on_stack(struct hrtimer *timer) { } static inline void debug_hrtimer_activate(struct hrtimer *timer, enum hrtimer_mode mode) { } static inline void debug_hrtimer_deactivate(struct hrtimer *timer) { } @@ -472,6 +456,13 @@ debug_init(struct hrtimer *timer, clockid_t clockid, trace_hrtimer_init(timer, clockid, mode); } =20 +static inline void debug_init_on_stack(struct hrtimer *timer, clockid_t cl= ockid, + enum hrtimer_mode mode) +{ + debug_hrtimer_init_on_stack(timer); + trace_hrtimer_init(timer, clockid, mode); +} + static inline void debug_activate(struct hrtimer *timer, enum hrtimer_mode mode) { @@ -1600,6 +1591,23 @@ void hrtimer_init(struct hrtimer *timer, clockid_t c= lock_id, } EXPORT_SYMBOL_GPL(hrtimer_init); =20 +/** + * hrtimer_init_on_stack - initialize a timer in stack memory + * @timer: The timer to be initialized + * @clock_id: The clock to be used + * @mode: The timer mode + * + * Similar to hrtimer_init(), except that this one must be used if struct = hrtimer is in stack + * memory. + */ +void hrtimer_init_on_stack(struct hrtimer *timer, clockid_t clock_id, + enum hrtimer_mode mode) +{ + debug_init_on_stack(timer, clock_id, mode); + __hrtimer_init(timer, clock_id, mode); +} +EXPORT_SYMBOL_GPL(hrtimer_init_on_stack); + /* * A timer is active, when it is enqueued into the rbtree or the * callback function is running or it's in the state of being migrated @@ -1944,7 +1952,7 @@ void hrtimer_sleeper_start_expires(struct hrtimer_sle= eper *sl, * Make the enqueue delivery mode check work on RT. If the sleeper * was initialized for hard interrupt delivery, force the mode bit. * This is a special case for hrtimer_sleepers because - * hrtimer_init_sleeper() determines the delivery mode on RT so the + * __hrtimer_init_sleeper() determines the delivery mode on RT so the * fiddling with this decision is avoided at the call sites. */ if (IS_ENABLED(CONFIG_PREEMPT_RT) && sl->timer.is_hard) @@ -1987,19 +1995,18 @@ static void __hrtimer_init_sleeper(struct hrtimer_s= leeper *sl, } =20 /** - * hrtimer_init_sleeper - initialize sleeper to the given clock + * hrtimer_init_sleeper_on_stack - initialize a sleeper in stack memory * @sl: sleeper to be initialized * @clock_id: the clock to be used * @mode: timer mode abs/rel */ -void hrtimer_init_sleeper(struct hrtimer_sleeper *sl, clockid_t clock_id, - enum hrtimer_mode mode) +void hrtimer_init_sleeper_on_stack(struct hrtimer_sleeper *sl, + clockid_t clock_id, enum hrtimer_mode mode) { - debug_init(&sl->timer, clock_id, mode); + debug_init_on_stack(&sl->timer, clock_id, mode); __hrtimer_init_sleeper(sl, clock_id, mode); - } -EXPORT_SYMBOL_GPL(hrtimer_init_sleeper); +EXPORT_SYMBOL_GPL(hrtimer_init_sleeper_on_stack); =20 int nanosleep_copyout(struct restart_block *restart, struct timespec64 *ts) { --=20 2.39.5 From nobody Mon Nov 25 00:30:49 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A66FC1A3029 for ; Thu, 31 Oct 2024 15:15:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730387705; cv=none; b=bZ6Pe13JkX+cZ4wWYkAg/JxYs+T9FI/XSHRIF9Fq0O5prYlLWR+QwI/9/uYHvY7Ph4wNqMDgU+zPZciXedJqHf3FISQGPGjfxDQPUZTRwg2+6Qx7o0dLkalVqYUsz/LXjVeAcbrEQrG4NolbkAAKOdpnB/LXcrX3rBXzIwgAVuY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730387705; c=relaxed/simple; bh=yG4v5dLEQDMShfyJJzF9b9CF/EvKVy0NAXyVUG7j5N0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=gznJRZmkR74zX63oNbXoR7LHkSX+PsNx43tEFdYzzDNYkTrqP9pIGzIOqM2dmfHfdUBXC3+UBf8OWwxb30xIjA+vt0bq9sYZ2SrJmIxqODMLxgI5b4oBgCxJGvg4g8vtpsLHHkdn24BgKQPgVB9g3X6yQc0yBCMCuryAPzzriWM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=ea2gljGc; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=CqstlxLr; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="ea2gljGc"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="CqstlxLr" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730387702; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3OpuVlVfGmDS4KDeN2Jbqf77TDzf3Zc1fr7oejFCTSM=; b=ea2gljGc/BV+BoVMvgLFNEi8043sU9vyqQDpS0h+ftCl0Wo6cCP6sHwDIGQrOTV95ZvkTy 9lJYGcmCAJJaLxAmMOdTboAmsH3HAOERGu7XsxcKIGqxJ8VsWL9AqZ2KQmXwuBU/0cMPsb nFn0+qyC03e1F931j/X2DBldlmMJQqe0AFutcjqtyQi3xooASdmfqqAw4F63/+fGF299+x SeSwZ06mK7IEVX42pHSFi+kzM6odRmdXbCd+m1r1J4bte8XJaFVR5gW+Sagirx10tlc7F0 QBiXvt9n2O+uGEqNpTvA0iRzAsZxQiQtdDIzHn/cFQM4c9ISdF+dvS+/GT5nmA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730387702; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3OpuVlVfGmDS4KDeN2Jbqf77TDzf3Zc1fr7oejFCTSM=; b=CqstlxLr48wIYSYPze9/lcB0CHD7PTlEaV2YbBlsmr81hdWcaBWQN3POAvCfgwPaaNUEDK j3818nENSXCm8yCg== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Jani Nikula , intel-gfx@lists.freedesktop.org, Sean Christopherson , Paolo Bonzini , x86@kernel.org, Jakub Kicinski , Kalle Valo , Jens Axboe , Christian Brauner , Peter Zijlstra , John Stultz , Nam Cao , Oliver Hartkopp Subject: [RESEND PATCH v2 02/19] drm/i915/request: Remove unnecessary modification of hrtimer::function Date: Thu, 31 Oct 2024 16:14:16 +0100 Message-Id: <50f865045aa672a9730343ad131543da332b1d8d.1730386209.git.namcao@linutronix.de> In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" When a request is created, the hrtimer is not initialized and only its 'function' field is set to NULL. The hrtimer is only initialized when the request is enqueued. The point of setting 'function' to NULL is that, it can be used to check whether hrtimer_try_to_cancel() should be called while retiring the request. This "trick" is unnecessary, because hrtimer_try_to_cancel() already does its own check whether the timer is armed. If the timer is not armed, hrtimer_try_to_cancel() returns 0. Fully initialize the timer when the request is created, which allows to make the hrtimer::function field private once all users of hrtimer_init() are converted to hrtimer_setup(), which requires a valid callback function to be set. Because hrtimer_try_to_cancel() returns 0 if the timer is not armed, the logic to check whether to call i915_request_put() remains equivalent. Signed-off-by: Nam Cao Cc: Jani Nikula --- drivers/gpu/drm/i915/i915_request.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_request.c b/drivers/gpu/drm/i915/i91= 5_request.c index 519e096c607c..8f62cfa23fb7 100644 --- a/drivers/gpu/drm/i915/i915_request.c +++ b/drivers/gpu/drm/i915/i915_request.c @@ -273,11 +273,6 @@ i915_request_active_engine(struct i915_request *rq, return ret; } =20 -static void __rq_init_watchdog(struct i915_request *rq) -{ - rq->watchdog.timer.function =3D NULL; -} - static enum hrtimer_restart __rq_watchdog_expired(struct hrtimer *hrtimer) { struct i915_request *rq =3D @@ -294,6 +289,14 @@ static enum hrtimer_restart __rq_watchdog_expired(stru= ct hrtimer *hrtimer) return HRTIMER_NORESTART; } =20 +static void __rq_init_watchdog(struct i915_request *rq) +{ + struct i915_request_watchdog *wdg =3D &rq->watchdog; + + hrtimer_init(&wdg->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); + wdg->timer.function =3D __rq_watchdog_expired; +} + static void __rq_arm_watchdog(struct i915_request *rq) { struct i915_request_watchdog *wdg =3D &rq->watchdog; @@ -304,8 +307,6 @@ static void __rq_arm_watchdog(struct i915_request *rq) =20 i915_request_get(rq); =20 - hrtimer_init(&wdg->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); - wdg->timer.function =3D __rq_watchdog_expired; hrtimer_start_range_ns(&wdg->timer, ns_to_ktime(ce->watchdog.timeout_us * NSEC_PER_USEC), @@ -317,7 +318,7 @@ static void __rq_cancel_watchdog(struct i915_request *r= q) { struct i915_request_watchdog *wdg =3D &rq->watchdog; =20 - if (wdg->timer.function && hrtimer_try_to_cancel(&wdg->timer) > 0) + if (hrtimer_try_to_cancel(&wdg->timer) > 0) i915_request_put(rq); } =20 --=20 2.39.5 From nobody Mon Nov 25 00:30:49 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 88E111A255A; Thu, 31 Oct 2024 15:15:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730387706; cv=none; b=kQ4WHN8d0SlVHT+rrfYPDw5hpO7CH7PdR2NycLzt7+vEWhh30qAlrIUT2LUpbyAGiPk0kTIQ85fTsAx3blB/plGQLqcgJH3Ga5CuCkNcDMdPADs1EKKkADTxE4FiUwnjK7QsoPdUj1KTX9lOlTW3lVVAVb1XrFbBd1EALALfQSc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730387706; c=relaxed/simple; bh=CACZtg7Ahs7t4V6bbE23m+iG9ROJhJ0ED5SHwYyp0Dw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=uUVSXlUCsVGsoOdM8Vsza/2JabhFzARIq+FL+YkQ+hwFZkDxeeIR4YuKyu717gcWnBQjMYMx2rp9QQLecODfv9Aar15B6mvf+EmQkRBNPUeObaM80VUa8VQV3+G//zyWsh5xxl1elVQten2H82JFEGGdkGBibOJArqF+pCmzX00= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=D8R3JnkO; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=vSyDZ/mN; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="D8R3JnkO"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="vSyDZ/mN" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730387702; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HdVqhgFUx4wGhiyBVzB1j0RExe8nGmkufQErz8orPxA=; b=D8R3JnkO+m2baGKosWMEPCCgHEh93eEj3i5YM9IrL8ArYpE8sw2m3aMJr+wEoCSXY8Sk0o cNAwkYpIWaFLG/Hq2XJiVUcS+2TwzoEBxaJdnGTgTdUNaZDYPxCUahyT1R1Q2ZLKgAtlkC RGS4x58PXmjWRlEO06mYDbfjn42Bl5gCV5yLqmk+XU+l7pzFjdQcD1DB4hvBdhkbxvKYVn VQIs9hdbp/4lysS0E9Lr73R3hrjyUE0TZ1qUF3uy/S4GxCdrvN8y8ONJx8mE8TcNJpaftx o+H+v+lYJ5bnvSf7068cGQ9ReuPpyPFB2jhD2I6tEYa4wi9D8UuYsg7tL5wujQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730387702; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HdVqhgFUx4wGhiyBVzB1j0RExe8nGmkufQErz8orPxA=; b=vSyDZ/mNZsHFwmAZ5X6uDDFZnl5blvdtESX/4yICVSJ/nHMJu3Ss4nFWwbP39h1ewJkXLG oKAz3ELATfAAFmAA== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Jani Nikula , intel-gfx@lists.freedesktop.org, Sean Christopherson , Paolo Bonzini , x86@kernel.org, Jakub Kicinski , Kalle Valo , Jens Axboe , Christian Brauner , Peter Zijlstra , John Stultz , Nam Cao , Oliver Hartkopp , kvm@vger.kernel.org Subject: [RESEND PATCH v2 03/19] KVM: x86/xen: Initialize hrtimer in kvm_xen_init_vcpu() Date: Thu, 31 Oct 2024 16:14:17 +0100 Message-Id: <9c33c7224d97d08f4fa30d3cc8687981c1d3e953.1730386209.git.namcao@linutronix.de> In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The hrtimer is initialized in the KVM_XEN_VCPU_SET_ATTR ioctl. That caused problem in the past, because the hrtimer can be initialized multiple times, which was fixed by commit af735db31285 ("KVM: x86/xen: Initialize Xen timer only once"). This commit avoids initializing the timer multiple times by checking the field 'function' of struct hrtimer to determine if it has already been initialized. This is not required and in the way to make the function field private. Move the hrtimer initialization into kvm_xen_init_vcpu() so that it will only be initialized once. Signed-off-by: Nam Cao Acked-by: Sean Christopherson Cc: Paolo Bonzini Cc: x86@kernel.org Cc: kvm@vger.kernel.org --- arch/x86/kvm/xen.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/arch/x86/kvm/xen.c b/arch/x86/kvm/xen.c index 622fe24da910..a909b817b9c0 100644 --- a/arch/x86/kvm/xen.c +++ b/arch/x86/kvm/xen.c @@ -263,13 +263,6 @@ static void kvm_xen_stop_timer(struct kvm_vcpu *vcpu) atomic_set(&vcpu->arch.xen.timer_pending, 0); } =20 -static void kvm_xen_init_timer(struct kvm_vcpu *vcpu) -{ - hrtimer_init(&vcpu->arch.xen.timer, CLOCK_MONOTONIC, - HRTIMER_MODE_ABS_HARD); - vcpu->arch.xen.timer.function =3D xen_timer_callback; -} - static void kvm_xen_update_runstate_guest(struct kvm_vcpu *v, bool atomic) { struct kvm_vcpu_xen *vx =3D &v->arch.xen; @@ -1070,9 +1063,6 @@ int kvm_xen_vcpu_set_attr(struct kvm_vcpu *vcpu, stru= ct kvm_xen_vcpu_attr *data) break; } =20 - if (!vcpu->arch.xen.timer.function) - kvm_xen_init_timer(vcpu); - /* Stop the timer (if it's running) before changing the vector */ kvm_xen_stop_timer(vcpu); vcpu->arch.xen.timer_virq =3D data->u.timer.port; @@ -2235,6 +2225,8 @@ void kvm_xen_init_vcpu(struct kvm_vcpu *vcpu) vcpu->arch.xen.poll_evtchn =3D 0; =20 timer_setup(&vcpu->arch.xen.poll_timer, cancel_evtchn_poll, 0); + hrtimer_init(&vcpu->arch.xen.timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_HAR= D); + vcpu->arch.xen.timer.function =3D xen_timer_callback; =20 kvm_gpc_init(&vcpu->arch.xen.runstate_cache, vcpu->kvm); kvm_gpc_init(&vcpu->arch.xen.runstate2_cache, vcpu->kvm); --=20 2.39.5 From nobody Mon Nov 25 00:30:49 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E00101A3BDE; Thu, 31 Oct 2024 15:15:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730387707; cv=none; b=I+HkFFoWJHYP6gkpnXLJoq34SMevOCY7vQu8YKUsAVECbYBEfGwbIFDl0EsT/TLAcJaFGKkDVZpuMQlGkT/Nxi+o7FIkaD7h03impskU59UX7pD8z+3d+tXrZf8U0nmRBemKYdudv+PVXTldUAZxzQsJj5s68hpgNuZ8DTgBkdI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730387707; c=relaxed/simple; bh=v22nMp0NCgMKpKQ34cvZP1/P6cf3rMn2mJFAvL3jUoE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=m7AuLZYDxz/MVBkL65D9YHPhwriE4fRllfjSmHB00pjbZtvnsNH7XccNE8K+49Rj+K4Hc5qo83M7qKbzyhPjKdKCGdzByNUrWRKvdIv8MbCTLcc7X9N11gGaphNKgtsVcMj4rx1ktGisgW69IdXTjvyIc4JeKWU23mZUCu+OpPk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=tJ6zgXnl; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=NKtYgqgN; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="tJ6zgXnl"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="NKtYgqgN" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730387703; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FyuxFuHZyEAgLrnvafIRcWRKTeRTsVTMh2Dczz2F9rU=; b=tJ6zgXnltAPSCcx7THHEtdYpBg/DS8NrFZ02jd33CGDpy49sS9dp6ids4gtlsFpOONmg4I zn7HjwH+7fNNKyZ9cagv6Kt1OFfBeDlDOrmth8blvN+yVy+xht6MIY+Q/B1/+zT2jzy/a9 YiMkkc2DZDsPJeuzo11TgZnctzGNyzlWwW58J/Lv6kGpv+PnU60BxSfsmV20IplsyYIg5b U6K/kLmz85Fp0mG2HKnsxIY7EwC0Qbhlo+TLxalXoz7+bRdS6BZvRqIknOLX3T5V8rYstH Nmf4KZmFGIZ3PRMD5OfEO6YII8zq0XXbIsT3x8DeaCR6Sbgaf86NjNOSd0y+lA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730387703; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FyuxFuHZyEAgLrnvafIRcWRKTeRTsVTMh2Dczz2F9rU=; b=NKtYgqgNGk4bIoUpaptCn6O7NlJj+lp7jKGQCDEoVRKabClUHDqq3vxb7ws7xpabxmSEfj Vs0PJ7aVdW/esRDA== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Jani Nikula , intel-gfx@lists.freedesktop.org, Sean Christopherson , Paolo Bonzini , x86@kernel.org, Jakub Kicinski , Kalle Valo , Jens Axboe , Christian Brauner , Peter Zijlstra , John Stultz , Nam Cao , Oliver Hartkopp , linux-wireless@vger.kernel.org Subject: [RESEND PATCH v2 04/19] wifi: rt2x00: Remove redundant hrtimer_init() Date: Thu, 31 Oct 2024 16:14:18 +0100 Message-Id: <66116057f788e18a6603d50a554417eee459e02c.1730386209.git.namcao@linutronix.de> In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" rt2x00usb_probe() executes a hrtimer_init() for txstatus_timer. Afterwards, rt2x00lib_probe_dev() is called which also initializes this txstatus_timer with the same settings. Remove the redundant hrtimer_init() call in rt2x00usb_probe(). Signed-off-by: Nam Cao Acked-by: Kalle Valo Cc: linux-wireless@vger.kernel.org --- drivers/net/wireless/ralink/rt2x00/rt2x00usb.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c b/drivers/net/w= ireless/ralink/rt2x00/rt2x00usb.c index 8fd22c69855f..a6d50149e0c3 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c @@ -823,8 +823,6 @@ int rt2x00usb_probe(struct usb_interface *usb_intf, =20 INIT_WORK(&rt2x00dev->rxdone_work, rt2x00usb_work_rxdone); INIT_WORK(&rt2x00dev->txdone_work, rt2x00usb_work_txdone); - hrtimer_init(&rt2x00dev->txstatus_timer, CLOCK_MONOTONIC, - HRTIMER_MODE_REL); =20 retval =3D rt2x00usb_alloc_reg(rt2x00dev); if (retval) --=20 2.39.5 From nobody Mon Nov 25 00:30:49 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 46AB519DFAB for ; Thu, 31 Oct 2024 15:15:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730387709; cv=none; b=qEJWbzq5xSCM37bpgbmXZSvSTyLh0VB6MBICm8g3aiw522LaY0e4eKeRvnOmaV6+ro3aj+FKPryynyjBBohKIuNp5kYaqpWmV1hb+f/7/aXAm6r07V6PcyoIggQkkNgG2RhtUxM7OyiRbDrv6ky8LzcsqPRXM1OKjPAc0lQ4Cw4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730387709; c=relaxed/simple; bh=lyvWCRoP2a1MaCIJFFS+qPNDimT8IhKEbi3bTW86r6Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=gh0jI93mQmPvxltfHt4ObCDJgfz7CJxSBapEcSQo5Tf80nmRNHRlzthKPgONRk9qXPHA17CmUU5Fg4FAdKrrzohSLabiz2DLK0y4UitEoob3R8ve3M9cZylcCuoNbTKkukU3zuRdr29q3gOggAXIkVQ2MWzslC5nBE9nBPGD75A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=yxGAz47h; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=T17HRGfN; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="yxGAz47h"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="T17HRGfN" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730387703; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sns3owJJ1g5SJOVsE11NYeiKC9zvBohYSIHK9XSQxGI=; b=yxGAz47hg+xN1wnLqYFDctZ2sn9Ujw5ytQE1byQCTKcCfxbvp2DGHiP9362f2lr543az3p gHEgizXYWPK3s0NSUu5SS+zz1h/kVrDKUNgY4XT8k9OsO22/yFCS0LH+hWxXTRfF2CqCF3 nCyFFqq0r8zU1rhVvbozVLJaMIT70alPfW/0OL2K6LSlbDSwON6WNujUAIfq6Hz9VZQCXj TlKyyaLvGs4fAFalzUFkUKB5jgHjlixFJEguZnMJOpSTLZ5Hs4rAYwmMp+rsQN1WynADDv o5vd5I7AY0nWrWZiR3Y0w1xS6VbzlQFIQDUx5jSw9GMzVIwi5zxp/Ay9x+KCtg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730387703; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sns3owJJ1g5SJOVsE11NYeiKC9zvBohYSIHK9XSQxGI=; b=T17HRGfN3sJBYQ1qOGf/HGL9R/XXGtOx7PITdK9zzn2j1JlHM0XCd+cbpxUPDYYb/qCyEg l6w7Q5w9hhyMbsBQ== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Jani Nikula , intel-gfx@lists.freedesktop.org, Sean Christopherson , Paolo Bonzini , x86@kernel.org, Jakub Kicinski , Kalle Valo , Jens Axboe , Christian Brauner , Peter Zijlstra , John Stultz , Nam Cao , Oliver Hartkopp Subject: [RESEND PATCH v2 05/19] io_uring: Remove redundant hrtimer's callback function setup Date: Thu, 31 Oct 2024 16:14:19 +0100 Message-Id: <07b28dfd5691478a2d250f379c8b90dd37f9bb9a.1730386209.git.namcao@linutronix.de> In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The IORING_OP_TIMEOUT command uses hrtimer underneath. The timer's callback function is setup in io_timeout(), and then the callback function is setup again when the timer is rearmed. Since the callback function is the same for both cases, the latter setup is redundant, therefore remove it. Signed-off-by: Nam Cao Cc: Jens Axboe Reviewed-by: Jens Axboe timeout_lock); list_add(&timeout->list, ctx->timeout_list.prev); - data->timer.function =3D io_timeout_fn; hrtimer_start(&data->timer, timespec64_to_ktime(data->ts), data->mode); spin_unlock_irq(&ctx->timeout_lock); return; --=20 2.39.5 From nobody Mon Nov 25 00:30:49 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6CBC41A2C04 for ; Thu, 31 Oct 2024 15:15:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730387710; cv=none; b=PVcHEnm45WSoGNXnmiTpkVw22ehVVP/o6dvnvakPg/G4/OtFYZHqvTFXeXmg6pJLpURFIRFOk515W5/fk6SGhZX4o/1aiIzETmeb6ZfbdgHl8un2pPGAQwdBJGmZp0AEnHWuzVf9BAhW6L3iZWZyraqFdF+myV38TEX9Y5o5E20= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730387710; c=relaxed/simple; bh=GwNNF3zqHav5VPiKUemYF0iUUltEBshOaEcOGCpXNlY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=JNY6KRK7gxCmux9PnsgVQj01Fkfsdqx74Pk0gAoFMz0e6xe6nOU9gvJHxL5Ovswt0pYhe98MXzYV/LGzzVw0MJ8j+n0bJups+ORRbXSS473zxfaD79LoN9gca4NDjFRP2AnBOyQXUfijrZMdjvJQpeDZv6pncxQMM+v9+zt0v60= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=DcsaaWBy; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=mr9QsgWy; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="DcsaaWBy"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="mr9QsgWy" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730387704; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ThkCl44V/neIjWVtl0sAlfXWNYdsrvkUEoH/3/3ZkiA=; b=DcsaaWByQ98ElkhS3oz+eKWKdWuqULhWlCPd3o0ZLc+ujYbRtAF9cUadaGeqBH0oX3SDq9 z6iDCQYezKuQL2TUq0B54/XWY7mY+kaVOdL4Z3IqRetA4y3nyc9MSeX6EJdfJ65rNJ0NNt 8VlNsMObaTY+sLUf8BVYdsI53njJfYnMMldKLNtZ+h+40EFyIm0H7lPS4q9eyXzoXY7nBY J13D5ohPZsABftu05Rkd2hmfCbEc3zdV53vBOcOiPBtlg0LbKBLnyOEYaMC3KZIYSfXpi9 TJiPb7j3CMPudXBBjh+/S6TQN1e+4F1CGdkdNphraYuyykkLp/VxLKfFcM3I9w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730387704; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ThkCl44V/neIjWVtl0sAlfXWNYdsrvkUEoH/3/3ZkiA=; b=mr9QsgWy0okEJzOvv/jH6q6vQLK+I51K4/cWwlHe/kN4khdW8PabGSN77ZeGxufGuSI2Ox j/kES5y4HVmAcmCA== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Jani Nikula , intel-gfx@lists.freedesktop.org, Sean Christopherson , Paolo Bonzini , x86@kernel.org, Jakub Kicinski , Kalle Valo , Jens Axboe , Christian Brauner , Peter Zijlstra , John Stultz , Nam Cao , Oliver Hartkopp Subject: [RESEND PATCH v2 06/19] hrtimers: Introduce hrtimer_setup() to replace hrtimer_init() Date: Thu, 31 Oct 2024 16:14:20 +0100 Message-Id: <5057c1ddbfd4b92033cd93d37fe38e6b069d5ba6.1730386209.git.namcao@linutronix.de> In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" To initialize hrtimer, hrtimer_init() needs to be called and also hrtimer::function must be set. This is error-prone and awkward to use. Introduce hrtimer_setup() which does both of these things, so that users of hrtimer can be simplified. The new setup function also has a sanity check for the provided function pointer. If NULL, a warning is emitted and a dummy callback installed. hrtimer_init() will be removed as soon as all of its users have been converted to the new function. Signed-off-by: Nam Cao --- include/linux/hrtimer.h | 2 ++ kernel/time/hrtimer.c | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index 5aa9d57528c4..bcc0715c59a8 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h @@ -228,6 +228,8 @@ static inline void hrtimer_cancel_wait_running(struct h= rtimer *timer) /* Initialize timers: */ extern void hrtimer_init(struct hrtimer *timer, clockid_t which_clock, enum hrtimer_mode mode); +extern void hrtimer_setup(struct hrtimer *timer, enum hrtimer_restart (*fu= nction)(struct hrtimer *), + clockid_t clock_id, enum hrtimer_mode mode); extern void hrtimer_init_on_stack(struct hrtimer *timer, clockid_t which_c= lock, enum hrtimer_mode mode); extern void hrtimer_init_sleeper_on_stack(struct hrtimer_sleeper *sl, diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index 4b0507cf38ea..a5ef67edcda9 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c @@ -1535,6 +1535,11 @@ static inline int hrtimer_clockid_to_base(clockid_t = clock_id) return HRTIMER_BASE_MONOTONIC; } =20 +static enum hrtimer_restart hrtimer_dummy_timeout(struct hrtimer *unused) +{ + return HRTIMER_NORESTART; +} + static void __hrtimer_init(struct hrtimer *timer, clockid_t clock_id, enum hrtimer_mode mode) { @@ -1571,6 +1576,18 @@ static void __hrtimer_init(struct hrtimer *timer, cl= ockid_t clock_id, timerqueue_init(&timer->node); } =20 +static void __hrtimer_setup(struct hrtimer *timer, + enum hrtimer_restart (*function)(struct hrtimer *), + clockid_t clock_id, enum hrtimer_mode mode) +{ + __hrtimer_init(timer, clock_id, mode); + + if (WARN_ON_ONCE(!function)) + timer->function =3D hrtimer_dummy_timeout; + else + timer->function =3D function; +} + /** * hrtimer_init - initialize a timer to the given clock * @timer: the timer to be initialized @@ -1591,6 +1608,27 @@ void hrtimer_init(struct hrtimer *timer, clockid_t c= lock_id, } EXPORT_SYMBOL_GPL(hrtimer_init); =20 +/** + * hrtimer_setup - initialize a timer to the given clock + * @timer: the timer to be initialized + * @function: the callback function + * @clock_id: the clock to be used + * @mode: The modes which are relevant for initialization: + * HRTIMER_MODE_ABS, HRTIMER_MODE_REL, HRTIMER_MODE_ABS_SOFT, + * HRTIMER_MODE_REL_SOFT + * + * The PINNED variants of the above can be handed in, + * but the PINNED bit is ignored as pinning happens + * when the hrtimer is started + */ +void hrtimer_setup(struct hrtimer *timer, enum hrtimer_restart (*function)= (struct hrtimer *), + clockid_t clock_id, enum hrtimer_mode mode) +{ + debug_init(timer, clock_id, mode); + __hrtimer_setup(timer, function, clock_id, mode); +} +EXPORT_SYMBOL_GPL(hrtimer_setup); + /** * hrtimer_init_on_stack - initialize a timer in stack memory * @timer: The timer to be initialized --=20 2.39.5 From nobody Mon Nov 25 00:30:49 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F27D41B86D5 for ; Thu, 31 Oct 2024 15:15:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730387710; cv=none; b=UaAg6kacH6vksq99tnt94Vkbfdl02r44wT7627Ov17rxJ1xLkWdW/3fQbjzTSP+ROMqlemXIRTZFQvwBeuU5UZxCoeCXqFgweFBzUjeNYby3m/EaDkr+tjWTBt8t/5zrsY1ZuA9WN7ZrN5KaoDeR8Cweg88NEReVT0pgd68a0A4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730387710; c=relaxed/simple; bh=rOgJoI5pNJFyNAVwdETx/k1ZKruBs2HuZdgKOn2HJqY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=G7MISyHYZ+qZqe8CcISFgLqppItmVUlk34WcDG8lg2pl2B+T8/C6Iux9FxYoW/1i7/N+qqB0LJLSXS4fIkTduEtnUIAe/5tMpEiKTM3ryIaMuhBMC3QOEuGgfmv+pENw478Jzc7KWZ5Zc1hehuJPQg6rwbu8fX6Wo5K58+b1shE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=AHyloqVr; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=ywC5R17G; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="AHyloqVr"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="ywC5R17G" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730387705; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2mzDkHhgj8rt6gZnZO44C9ll+sOEso58V5R/ieU+5hI=; b=AHyloqVryNyQXmmoEY9l0xxiwzVfLvZ1JoPcAKuJyS7wklsurIJy6gHNYUqq0e8eUu3xqo JVfWHig+8ANFENDntF9EuZoVnfuevKsLyMyeSihfVANhkBJYu/U/kPBfVmpJXJLA9Y3UZS 8BIbPnug0bwLAHc7G1YW54yPNOfi0uknToblDRZswRBjpXw1oxJnDHqvqup2f9TOBM8H5+ 5/MJ8AfmBKOndd9Gq9mLWCAVLuTUgEUhlYPwG4p9/M9j0JItrW7PS4InRBHg08PLH3wE7K hItd2P8Y0gCilYyGMSmFJ73tydfIcbDsVjJUybHhSxve1in4lZpr+gujn6E9qg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730387705; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2mzDkHhgj8rt6gZnZO44C9ll+sOEso58V5R/ieU+5hI=; b=ywC5R17GJElzyGjv6HcpGX2sAp0W/8joA0T9jLDp7flM+OIJwi0gAAtSngIrpubHijfOkF Cq6FkebKFwjOulDg== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Jani Nikula , intel-gfx@lists.freedesktop.org, Sean Christopherson , Paolo Bonzini , x86@kernel.org, Jakub Kicinski , Kalle Valo , Jens Axboe , Christian Brauner , Peter Zijlstra , John Stultz , Nam Cao , Oliver Hartkopp Subject: [RESEND PATCH v2 07/19] hrtimers: Introduce hrtimer_setup_on_stack() Date: Thu, 31 Oct 2024 16:14:21 +0100 Message-Id: <4b05e2ab3a82c517adf67fabc0f0cd8fe118b97c.1730386209.git.namcao@linutronix.de> In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" To initialize hrtimer on stack, hrtimer_init_on_stack() needs to be called and also hrtimer::function must be set. This is error-prone and awkward to use. Introduce hrtimer_setup_on_stack() which does both of these things, so that users of hrtimer can be simplified. The new setup function also has a sanity check for the provided function pointer. If NULL, a warning is emitted and a dummy callback installed. hrtimer_init_on_stack() will be removed as soon as all of its users have been converted to the new function. Signed-off-by: Nam Cao --- include/linux/hrtimer.h | 3 +++ kernel/time/hrtimer.c | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index bcc0715c59a8..2da513f8d66a 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h @@ -232,6 +232,9 @@ extern void hrtimer_setup(struct hrtimer *timer, enum h= rtimer_restart (*function clockid_t clock_id, enum hrtimer_mode mode); extern void hrtimer_init_on_stack(struct hrtimer *timer, clockid_t which_c= lock, enum hrtimer_mode mode); +extern void hrtimer_setup_on_stack(struct hrtimer *timer, + enum hrtimer_restart (*function)(struct hrtimer *), + clockid_t clock_id, enum hrtimer_mode mode); extern void hrtimer_init_sleeper_on_stack(struct hrtimer_sleeper *sl, clockid_t clock_id, enum hrtimer_mode mode); diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index a5ef67edcda9..daee4e27f839 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c @@ -1646,6 +1646,25 @@ void hrtimer_init_on_stack(struct hrtimer *timer, cl= ockid_t clock_id, } EXPORT_SYMBOL_GPL(hrtimer_init_on_stack); =20 +/** + * hrtimer_setup_on_stack - initialize a timer on stack memory + * @timer: The timer to be initialized + * @function: the callback function + * @clock_id: The clock to be used + * @mode: The timer mode + * + * Similar to hrtimer_setup(), except that this one must be used if struct= hrtimer is in stack + * memory. + */ +void hrtimer_setup_on_stack(struct hrtimer *timer, + enum hrtimer_restart (*function)(struct hrtimer *), + clockid_t clock_id, enum hrtimer_mode mode) +{ + debug_init_on_stack(timer, clock_id, mode); + __hrtimer_setup(timer, function, clock_id, mode); +} +EXPORT_SYMBOL_GPL(hrtimer_setup_on_stack); + /* * A timer is active, when it is enqueued into the rbtree or the * callback function is running or it's in the state of being migrated --=20 2.39.5 From nobody Mon Nov 25 00:30:49 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC5D01B5EB0 for ; Thu, 31 Oct 2024 15:15:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730387711; cv=none; b=Tp/gpNDJJZrBdAyOv+lTRrwPZ/MERSIa0S6CGdcjVvvQO+BYiiUrZdxv3fpga68lr28biDeJehYBWAkXenjAUfl0lJajAFoIXbrfJjb71nlyhqE5QAVaTNjPauNc47ud2qQcCt1M4l86vDfceY9g9n/punXwkRevLX/ZvtaNdNs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730387711; c=relaxed/simple; bh=2CY9kB6H7L5xJ90m7m3826zJ8H+R219yYNnhQ1D6tRE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=WZitFXf+7Axx7MDYR172bootK7Y2eX63FWXa+OPYRmUqVCNV8R6TpsI3+gVBzKa83zSUYsrABJaw6OVFzTMNb74+gZjDwAqI8ZN9iWB5g75GAbac5PC7n7fIduZomoM+8MAFlGrEDuAOtiAUrFO6jokgq6JKxqqFIO2Dy/p+DR8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=XzQpNSwf; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Ha0W0r5L; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="XzQpNSwf"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Ha0W0r5L" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730387705; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=C2pgxdetyjFdGMAYQNmqquyKM9VvR5M1ScNctRcZor8=; b=XzQpNSwfS1KsUnzEEkGG3Iuey3l2dvDrRTyFBryik4D+t5RyKO+mb7tTLZD9ZRyilKUuWf jte3J1gze9W005BG2id+JasCiuOVN8Gm+pdNRzFCmKRwauq5toaCjAhMhKnl+3n3H3mAW6 B6z6pd2Wo7aowmA7Fp7MnlAWij/z+Bm4httKMDT8QyMAgnh75B79HutAhcZPrm6uwCxeFN ynxeD/HDho8RIxt6s1+BJeHMiOsQ0NMv7f9XzKzWcd6L8BXy1AF5HJVyHvC2tk06QQhjz5 F9svaQyXwwsC4J8fSNKrEUJ47wCZJnhPLuJm2ATe3DyJhfEuXpAnGwABAKV6lg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730387705; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=C2pgxdetyjFdGMAYQNmqquyKM9VvR5M1ScNctRcZor8=; b=Ha0W0r5LMuvam3gSiw/Jbi7TY8QZoepcS+hye4MMw0ADw2CbjE4LANY+DtNBmeXri8s1yd 8C8tjupm9PhrieAQ== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Jani Nikula , intel-gfx@lists.freedesktop.org, Sean Christopherson , Paolo Bonzini , x86@kernel.org, Jakub Kicinski , Kalle Valo , Jens Axboe , Christian Brauner , Peter Zijlstra , John Stultz , Nam Cao , Oliver Hartkopp Subject: [RESEND PATCH v2 08/19] hrtimers: Introduce hrtimer_setup_sleeper_on_stack() Date: Thu, 31 Oct 2024 16:14:22 +0100 Message-Id: <7b5e18e6dd0ace9eaa211201528cb9dc23752454.1730386209.git.namcao@linutronix.de> In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The hrtimer_init*() API is replaced by hrtimer_setup*() variants to initialize the timer including the callback function at once. hrtimer_init_sleeper_on_stack() does not need user to setup the callback function separately, so a new variant would not be strictly necessary. Nonetheless, to keep the naming convention consistent, introduce hrtimer_setup_sleeper_on_stack(). hrtimer_init_on_stack() will be removed once all users are converted. Signed-off-by: Nam Cao --- include/linux/hrtimer.h | 2 ++ kernel/time/hrtimer.c | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index 2da513f8d66a..48872a2b4071 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h @@ -238,6 +238,8 @@ extern void hrtimer_setup_on_stack(struct hrtimer *time= r, extern void hrtimer_init_sleeper_on_stack(struct hrtimer_sleeper *sl, clockid_t clock_id, enum hrtimer_mode mode); +extern void hrtimer_setup_sleeper_on_stack(struct hrtimer_sleeper *sl, clo= ckid_t clock_id, + enum hrtimer_mode mode); =20 #ifdef CONFIG_DEBUG_OBJECTS_TIMERS extern void destroy_hrtimer_on_stack(struct hrtimer *timer); diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index daee4e27f839..1d1f5c03673c 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c @@ -2065,6 +2065,20 @@ void hrtimer_init_sleeper_on_stack(struct hrtimer_sl= eeper *sl, } EXPORT_SYMBOL_GPL(hrtimer_init_sleeper_on_stack); =20 +/** + * hrtimer_setup_sleeper_on_stack - initialize a sleeper in stack memory + * @sl: sleeper to be initialized + * @clock_id: the clock to be used + * @mode: timer mode abs/rel + */ +void hrtimer_setup_sleeper_on_stack(struct hrtimer_sleeper *sl, + clockid_t clock_id, enum hrtimer_mode mode) +{ + debug_init_on_stack(&sl->timer, clock_id, mode); + __hrtimer_init_sleeper(sl, clock_id, mode); +} +EXPORT_SYMBOL_GPL(hrtimer_setup_sleeper_on_stack); + int nanosleep_copyout(struct restart_block *restart, struct timespec64 *ts) { switch(restart->nanosleep.type) { --=20 2.39.5 From nobody Mon Nov 25 00:30:49 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 411911BC074 for ; Thu, 31 Oct 2024 15:15:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730387710; cv=none; b=Fjgt3KEbKH0LXI9fnrdgPyvpCui9McF1me5J9lA9AY1xFSfQBc1uLo88Df2xFTLvXRxDsNJhWi19k2a0ZkvOYLUa2uEooQuNj7a9IlAq33sPAaC/AO5Iv1W0GSpNWR2RNcSidzXvXYsbvcDFteLQneygHbYAwK/oXg5B1r/tC8Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730387710; c=relaxed/simple; bh=r6YtZHpm5SDAubcCWo1zoTd/sBxKKP+2uGLLpdpJ5cQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=JlFefuoOWom4lh1UDITq8RDQGbLQK3bpjJlKihaSNwQPa32v+FveDily4NOATfhd+DuFK5ifi07WSXYdqZjWxzcivNh2bUeFzaBH3pzbqQ0DQY08JialNL/2F1xErLZ7DeT3iWBROlgPBmqEU93sjcj7JhZRDY+w3VLzNW1LSLY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=OXluRfXX; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=dt2VJX4y; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="OXluRfXX"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="dt2VJX4y" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730387706; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WU0OQTP8K3HetutHRTwicBx6y0d4IYn/PVSH3V3yCms=; b=OXluRfXXeLt3edtFXLjyirTIAAVAr321b79RwSZ5xO2L6K1wgbB2mhzmJLx0eY2Zkg2pwq SEGQjyPmuA2GPkXOEPTYSnrqeWjkn46s7qTS1Kn8Szcs5GlNi90jddFuYQZqS9AqErvjjt U5Rh0d3eHN6W86mu0F3HC2/1gJ5e9tXcgMUVmyBduzW1BfeuMDOO+t1+KNtJS0H8nSc5Q3 fQEQ+cymkgs9afOdBDrFAxlVTpehr7yNxzctx1L3AvLoH58GYGlE/zj4A4hGy1xhWdtV6c E0LFJ0Z/2MUV4MbkjYh+KerclqK8Xt0+SiEzdpp5L5gOUH+Q8URTcC6oqrt3WA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730387706; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WU0OQTP8K3HetutHRTwicBx6y0d4IYn/PVSH3V3yCms=; b=dt2VJX4y7Oonm0lgdq0Gv3sFyvfZFvLpYDzXGfuTwJl/aXIr3aTCwH+cYXvOS8sOHvgwjQ mPal+9jnfMbIbCBg== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Jani Nikula , intel-gfx@lists.freedesktop.org, Sean Christopherson , Paolo Bonzini , x86@kernel.org, Jakub Kicinski , Kalle Valo , Jens Axboe , Christian Brauner , Peter Zijlstra , John Stultz , Nam Cao , Oliver Hartkopp Subject: [RESEND PATCH v2 09/19] hrtimers: Introduce hrtimer_update_function() Date: Thu, 31 Oct 2024 16:14:23 +0100 Message-Id: <20a937b0ae09ad54b5b6d86eabead7c570f1b72e.1730386209.git.namcao@linutronix.de> In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Some users of hrtimer need to change the callback function after the initial setup. They write to hrtimer::function directly. That's not safe under all circumstances as the write is lockless and a concurrent timer expiry might end up using the wrong function pointer. Introduce hrtimer_update_function(), which also performs runtime checks whether it is safe to modify the callback. This allows to make hrtimer::function private once all users are converted. Signed-off-by: Nam Cao --- include/linux/hrtimer.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index 48872a2b4071..6e026730e803 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h @@ -327,6 +327,28 @@ static inline int hrtimer_callback_running(struct hrti= mer *timer) return timer->base->running =3D=3D timer; } =20 +/** + * hrtimer_update_function - Update the timer's callback function + * @timer: Timer to update + * @function: New callback function + * + * Only safe to call if the timer is not enqueued. Can be called in the ca= llback function if the + * timer is not enqueued at the same time (see the comments above HRTIMER_= STATE_ENQUEUED). + */ +static inline void hrtimer_update_function(struct hrtimer *timer, + enum hrtimer_restart (*function)(struct hrtimer *)) +{ + guard(raw_spinlock_irqsave)(&timer->base->cpu_base->lock); + + if (WARN_ON_ONCE(hrtimer_is_queued(timer))) + return; + + if (WARN_ON_ONCE(!function)) + return; + + timer->function =3D function; +} + /* Forward a hrtimer so it expires after now: */ extern u64 hrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval); --=20 2.39.5 From nobody Mon Nov 25 00:30:49 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0CD831BD020 for ; Thu, 31 Oct 2024 15:15:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730387711; cv=none; b=Z4Fne+zBH6LmCJuLDIbl8Itbv6oM0TwBqdTVr7dH1EL1sJySoYhumCNs/e8RUCjFhYvjS/xT2H7qRWaN1d3d0r0L+L2UlxKWUKCy8U8Of/opduPTT60J7GWzawmzzI6SKmhANk/+/1VMzGIY1MnXLdy1hlYpVrx5SbRIcsnOOVQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730387711; c=relaxed/simple; bh=TPuf0LrhCx31+dfQrFbYZoYwWMWhKMazpUYH4/zyrFU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=u+5nAM9Whofl6QUHgiOMGXLbOYTg+gOLMwZfRp+YegErOYQQhskEYwTkFfxCPe5mfABdET+2aixBTYz0nqEvJ5IieHB8BQQ48gWVgvmyRnVYDhrhjyfI80xbmwiORU/aBkgxKLubAPzuAcym+dKD9MEg0p34h40rbY/Zh32wi2k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=KMuStyZL; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=JJzshGDZ; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="KMuStyZL"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="JJzshGDZ" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730387706; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pgW81mJgAIDJ6I8UWZoazeDmtDlfTTtXbZvn0v+KF3E=; b=KMuStyZLQJ87FD5gpD+CENeqH1MxgSeGxmxX04MwzhkdiAMaUzzwKOrL75g2d5vb9FeI6+ 8Q6VQ3jR14bZF4VEJuybCACjr0WEqH0zTIgve6WFfnQFlW0Jfri3+KgvWmdOBPPmYJ4kMb EGZJJBeQ6wgLbLynE39lvyN4HJ8nDilManRnc+ajH9ae7CptIam+vxMsEbK8Qx6WSunw2E VezniRzhuOWl8LHc8S+fJfhQp0eDOR0+Zsd/4+pNTnyepBcmOshe5h1Lixmv8Di1INUSwp Sx9g9F3BbVrzYvi6whsrPITcuW5Aq3Bqos+jOh8cK4RuaIQAeXdnPlbyzPKJWQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730387706; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pgW81mJgAIDJ6I8UWZoazeDmtDlfTTtXbZvn0v+KF3E=; b=JJzshGDZV2BdIrokNMSNAmQdOzpgzIqd8oF1Rv4SZJEYqIrp66dJvhczxlTyvt+t98Ybp2 aomNsunmz1ldp4Dg== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Jani Nikula , intel-gfx@lists.freedesktop.org, Sean Christopherson , Paolo Bonzini , x86@kernel.org, Jakub Kicinski , Kalle Valo , Jens Axboe , Christian Brauner , Peter Zijlstra , John Stultz , Nam Cao , Oliver Hartkopp Subject: [RESEND PATCH v2 10/19] fs/aio: Switch to use hrtimer_setup_sleeper_on_stack() Date: Thu, 31 Oct 2024 16:14:24 +0100 Message-Id: <5f10c259fa43ba2fe774de5b2cedc22f5e9cfd2d.1730386209.git.namcao@linutronix.de> In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" hrtimer_setup_sleeper_on_stack() replaces hrtimer_init_sleeper_on_stack() to keep the naming convention consistent. Convert the usage site over to it. The conversion was done with Coccinelle. Signed-off-by: Nam Cao Cc: Christian Brauner --- fs/aio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/aio.c b/fs/aio.c index e8920178b50f..a5d331f29943 100644 --- a/fs/aio.c +++ b/fs/aio.c @@ -1335,7 +1335,7 @@ static long read_events(struct kioctx *ctx, long min_= nr, long nr, if (until =3D=3D 0 || ret < 0 || ret >=3D min_nr) return ret; =20 - hrtimer_init_sleeper_on_stack(&t, CLOCK_MONOTONIC, HRTIMER_MODE_REL); + hrtimer_setup_sleeper_on_stack(&t, CLOCK_MONOTONIC, HRTIMER_MODE_REL); if (until !=3D KTIME_MAX) { hrtimer_set_expires_range_ns(&t.timer, until, current->timer_slack_ns); hrtimer_sleeper_start_expires(&t, HRTIMER_MODE_REL); --=20 2.39.5 From nobody Mon Nov 25 00:30:49 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3F3FD1BDAAE for ; Thu, 31 Oct 2024 15:15:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730387712; cv=none; b=PGNbrBOz2e/vx3r8gzNWvmRiDcvG4onLzdQK3QCkr0Rl46x/pujngQKJ9D6G2QBs7XZGLQsLQ2JfHLCdgp+fozctLIHURThS3SaTNK/IbCDMg1IEwbrx50osxD3kzccJvShaDpdd3Q8ycTVouBefLiE0x0+rkE92EHZmq5p9kqA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730387712; c=relaxed/simple; bh=Toc/w+R6FyfgS/eLMMePZ5Yd2hzg8/twjIrV45SRRwo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Ht6IaPTu/V9soFEo26qv+HPP8feQ21FtgLoHZa2wLjLtexg/PElAYjCnbC4zBhpTt99MSXe0xWER/08DwF8Gv9huwoA3zaCcfFzvpSSntUJBO+F3XSbWe+488ZHqO9bqwRA+cM48WevcknmivdgEzgAP8+YXUXFXFel0KAal794= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=d9rQyJXk; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=iJYPn13q; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="d9rQyJXk"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="iJYPn13q" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730387708; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eQ4OaVFfuzEdwAbuzRaqadqXL1D9oVVD1jPEwjjtzBI=; b=d9rQyJXk7rC9Ud2vUivz4oheHxCrS0wy8Y4I9K4/MwEyTgoXth2bQ2ofGtKZqPrFrVAIFE eBreuX1JVSmQrZD9ZDuooRfa1967UO0NZX1rARt6M96UtckeFmNYJOJm+z722maWukY9tW UPi2/iZ6ZLJoyBZ6n38jyfuc1ZfqAxYBWy6j4+X58VvSo8p2cQn9WQuvkg1qwLSg3so5Gv j/M3l8Hu5yr+9m2V8UTKPUNuID1rHZGM+AMAlpH4XdrHiXlrrAw6ksktCYwShH6mafxPFX ni31Gieao14CLn8aRp24XyT14z+KasjZBV6+OLJclicfvZX2lHjXvYqkHVTdHA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730387708; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eQ4OaVFfuzEdwAbuzRaqadqXL1D9oVVD1jPEwjjtzBI=; b=iJYPn13qrmJTzgAjFo+ik3kN94gVU4BPHiCVoai61h8kObYhmoA/rxwepH/pG8fD5GF6Pb nfIKXy/X2Yvou0DQ== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Jani Nikula , intel-gfx@lists.freedesktop.org, Sean Christopherson , Paolo Bonzini , x86@kernel.org, Jakub Kicinski , Kalle Valo , Jens Axboe , Christian Brauner , Peter Zijlstra , John Stultz , Nam Cao , Oliver Hartkopp Subject: [RESEND PATCH v2 11/19] futex: Switch to use hrtimer_setup_sleeper_on_stack() Date: Thu, 31 Oct 2024 16:14:25 +0100 Message-Id: In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" hrtimer_setup_sleeper_on_stack() replaces hrtimer_init_sleeper_on_stack() to keep the naming convention consistent. Convert the usage site over to it. The conversion was done with Coccinelle. Signed-off-by: Nam Cao Cc: Peter Zijlstra --- kernel/futex/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/futex/core.c b/kernel/futex/core.c index 136768ae2637..fb7214c7a36f 100644 --- a/kernel/futex/core.c +++ b/kernel/futex/core.c @@ -140,9 +140,9 @@ futex_setup_timer(ktime_t *time, struct hrtimer_sleeper= *timeout, if (!time) return NULL; =20 - hrtimer_init_sleeper_on_stack(timeout, (flags & FLAGS_CLOCKRT) ? - CLOCK_REALTIME : CLOCK_MONOTONIC, - HRTIMER_MODE_ABS); + hrtimer_setup_sleeper_on_stack(timeout, + (flags & FLAGS_CLOCKRT) ? CLOCK_REALTIME : CLOCK_MONOTONIC, + HRTIMER_MODE_ABS); /* * If range_ns is 0, calling hrtimer_set_expires_range_ns() is * effectively the same as calling hrtimer_set_expires(). --=20 2.39.5 From nobody Mon Nov 25 00:30:49 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3F4771BDAAF for ; Thu, 31 Oct 2024 15:15:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730387712; cv=none; b=prZ8QHO0hMt9QJoCy+UlQTgYZ5ExgmlIyazfKbF6/p7E70AUh06tK9/yQByauVsinCnHXmaFCwN8MpSjLeyBPA4VrY7ENmFzrcqPTv+wkUPeFVYyyHLQcIbxqRT4Bc6/HFWOy0fkr4PBOck5ui4rHbgMlqfhSrby2ZF0coIv45Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730387712; c=relaxed/simple; bh=FKFIN/9MgUKbjEkKjmwE7XM0N8D4YxPIPgHMEHKn0bM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=LwC2+nSH8Lmyzrolxt51/3uQYLfme+tmDfVi5Qwj6sBvR6LSlYuW8LOuJSsyyBInunXHWHzsUkhQWMDk3AXtVk4U2D7eoqviZ6zpPan9o+OegpzAy487wtsptTBMQJZMRjeGuNLxrz+zw8zykFYEDzNwcDR8JHnvD9S58YPnSEI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=bq+e+1uS; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=ElaKesmn; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="bq+e+1uS"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="ElaKesmn" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730387708; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9xCqurd8D1hnYmih39A2c6mcsRvTzJVfoQsu+HImsEA=; b=bq+e+1uSxeiSPkawLE7eQxW9kMjb3UL5exQoCQt0FM9GKq3x5htOe6XCAmIz0H3ahXu/lh y3hS0thACuf/gaqKLzVGriHu9CNhQvuCCl71PmzGKxTsPbh0Za8njj6LEqKZxyMtp+doPd INq8pdimzIg5NnNbH/TVxIfs0QX1d6jbHdYKCL1jAY5TrkgoyVolGMS5yerVudbTHDMtLi awI16ZOVSlu/nHOd6dwqswLqyytlGIkd+rK9CQz1LoXdji50ch0wlbcbidE3ZbLo6xq8Qf 6cBM5o+XMnPOfI8ZHihwZqN7si5vGcEQS4X6HsGouAHfJfwIf6xnIrMZTy+hyQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730387708; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9xCqurd8D1hnYmih39A2c6mcsRvTzJVfoQsu+HImsEA=; b=ElaKesmniCSDRRMv87u1XEUWiUT43CrILh2/yJDCZgn4GTVr+VI2MEiZshH1lWc1git8Yh ARFV+cqtSnHG/DBg== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Jani Nikula , intel-gfx@lists.freedesktop.org, Sean Christopherson , Paolo Bonzini , x86@kernel.org, Jakub Kicinski , Kalle Valo , Jens Axboe , Christian Brauner , Peter Zijlstra , John Stultz , Nam Cao , Oliver Hartkopp Subject: [RESEND PATCH v2 12/19] net: pktgen: Switch to use hrtimer_setup_sleeper_on_stack() Date: Thu, 31 Oct 2024 16:14:26 +0100 Message-Id: In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" hrtimer_setup_sleeper_on_stack() replaces hrtimer_init_sleeper_on_stack() to keep the naming convention consistent. Convert the usage site over to it. The conversion was done with Coccinelle. Signed-off-by: Nam Cao Cc: Jakub Kicinski --- net/core/pktgen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 34f68ef74b8f..7e23cacbe66e 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c @@ -2285,7 +2285,7 @@ static void spin(struct pktgen_dev *pkt_dev, ktime_t = spin_until) s64 remaining; struct hrtimer_sleeper t; =20 - hrtimer_init_sleeper_on_stack(&t, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); + hrtimer_setup_sleeper_on_stack(&t, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); hrtimer_set_expires(&t.timer, spin_until); =20 remaining =3D ktime_to_ns(hrtimer_expires_remaining(&t.timer)); --=20 2.39.5 From nobody Mon Nov 25 00:30:49 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 102DB1C2333 for ; Thu, 31 Oct 2024 15:15:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730387713; cv=none; b=rRyiC1821uxdQBMDm76WDCqSMzgMI/0Gf++cAeXWWIN4bU1Ows3Mz/s3YngtSPF41MD6mMDq+VfT1pr4oG8sFOk/uckDRZhO2f4G9alx3pEZUAmrZaoGrnGI0IpzQPD1fk8NpKObrx0nGGFVQDUtyW2sBYqyBSIrhx6CALo4Z6k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730387713; c=relaxed/simple; bh=eFjdlLDNzRXPRueQ0E62K52as5cxcIHoD+4zSwI6m9k=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=UzYVXcQ0/76gkhYupiWktgwY8psxkwtMMUROmdI193Bpm8n+14GjQpz9mk5fb2UeDhAGHgnaKT2Rr+Znks3HZHknH9/aJVDLsMN774FVYFnzDrn7H6787PqD3NUkPAABLefskXvsrDo4MtAlIPa+azAN7WqBdCC1OqbDhy2SyL8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=pW+zf7nx; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=OAUdZbzr; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="pW+zf7nx"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="OAUdZbzr" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730387709; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wSeQQ+/UoF5zygXiJ8vWE36+Ix/J13zBcX6GURu7TTA=; b=pW+zf7nxpvKL293ERZvvkwqWdm8sTJU22dfYTvgmDpLaTBAjpODBvgHjspRQUpOxT2Xkk3 wN7cUjgQB7Wzx+BfHqJpqfqnl3whMltT1B4R6JpdkAklNuv5fISyon0ClgYH1Mm8Datz0t OGuLRyqIKoCRXDm1GeLJ1z7j0HvEwG03s3jx320laE9UbmLIQUWvNk73I/RP22Wi8OO9BM bT+pgEONX7owIuipx8vPYVfYKLzOgbmi++QBfxZF208RvJjPlmzU05qTcvIbur1HpxU2Z4 mzaQYDrdNV64NzCpPI4sMWDeEl8tCiO7YirWqaL8DeR60Rrz4hRbQa/pJzrAZw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730387709; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wSeQQ+/UoF5zygXiJ8vWE36+Ix/J13zBcX6GURu7TTA=; b=OAUdZbzrqi7ivU7nui/YFiCV2Rtbq2Djbjl4fqTRc+FfLabBbIJupRYnsEzp3+vUNCOW58 ubtuPIlXxGOv9PAw== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Jani Nikula , intel-gfx@lists.freedesktop.org, Sean Christopherson , Paolo Bonzini , x86@kernel.org, Jakub Kicinski , Kalle Valo , Jens Axboe , Christian Brauner , Peter Zijlstra , John Stultz , Nam Cao , Oliver Hartkopp Subject: [RESEND PATCH v2 13/19] timers: Switch to use hrtimer_setup_sleeper_on_stack() Date: Thu, 31 Oct 2024 16:14:27 +0100 Message-Id: <299c07f0f96af8ab3a7631b47b6ca22b06b20577.1730386209.git.namcao@linutronix.de> In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" hrtimer_setup_sleeper_on_stack() replaces hrtimer_init_sleeper_on_stack() to keep the naming convention consistent. Convert the usage sites over to it. The conversion was done with Coccinelle. Signed-off-by: Nam Cao --- kernel/time/hrtimer.c | 5 ++--- kernel/time/sleep_timeout.c | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index 1d1f5c03673c..69430467a17d 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c @@ -2138,8 +2138,7 @@ static long __sched hrtimer_nanosleep_restart(struct = restart_block *restart) struct hrtimer_sleeper t; int ret; =20 - hrtimer_init_sleeper_on_stack(&t, restart->nanosleep.clockid, - HRTIMER_MODE_ABS); + hrtimer_setup_sleeper_on_stack(&t, restart->nanosleep.clockid, HRTIMER_MO= DE_ABS); hrtimer_set_expires_tv64(&t.timer, restart->nanosleep.expires); ret =3D do_nanosleep(&t, HRTIMER_MODE_ABS); destroy_hrtimer_on_stack(&t.timer); @@ -2153,7 +2152,7 @@ long hrtimer_nanosleep(ktime_t rqtp, const enum hrtim= er_mode mode, struct hrtimer_sleeper t; int ret =3D 0; =20 - hrtimer_init_sleeper_on_stack(&t, clockid, mode); + hrtimer_setup_sleeper_on_stack(&t, clockid, mode); hrtimer_set_expires_range_ns(&t.timer, rqtp, current->timer_slack_ns); ret =3D do_nanosleep(&t, mode); if (ret !=3D -ERESTART_RESTARTBLOCK) diff --git a/kernel/time/sleep_timeout.c b/kernel/time/sleep_timeout.c index 3054e5232d20..dfe939f6e4ec 100644 --- a/kernel/time/sleep_timeout.c +++ b/kernel/time/sleep_timeout.c @@ -208,7 +208,7 @@ int __sched schedule_hrtimeout_range_clock(ktime_t *exp= ires, u64 delta, return -EINTR; } =20 - hrtimer_init_sleeper_on_stack(&t, clock_id, mode); + hrtimer_setup_sleeper_on_stack(&t, clock_id, mode); hrtimer_set_expires_range_ns(&t.timer, *expires, delta); hrtimer_sleeper_start_expires(&t, mode); =20 --=20 2.39.5 From nobody Mon Nov 25 00:30:49 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AC60F1C460B for ; Thu, 31 Oct 2024 15:15:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730387713; cv=none; b=ZeymK0GSNQgerpsYfZyp/7Q/7xj81gQ/TjflGHE9o4qbt2LCDoKjAt1+G9/5e/CPhh+WByv0ByT+Sq5Nir5sA+LLJKq58RRnQgusiGCLO3W6CM0WsBhN4OMhBKegk5/HkIAbG5E/huRxXnk2xUPUCCZIfOl4TBUa7TYb8VyiuqU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730387713; c=relaxed/simple; bh=TooQOfPvH3C/Gh+3WhKo93UPT5gW3SF+TS9t69UO4Cs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=o9/+7v9m93UY/x6uouxureYigVaqE3QKN+h5dMRucmICrpsBlj/4nt35vG9HHn+BSUIoqsew/oR2wj2hX+00yhTmoP+THF7aPZo6yT4dA+VSjvhK5SthgZqSQ+8oLleT0Pm/Zc5TfsnlDnhgwDX1QgKqqCogM7i0yUYAjblESoU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=qHhcXMRk; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=6Fmlh67N; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="qHhcXMRk"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="6Fmlh67N" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730387709; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RkFsH9K81US68VRXDR1e7Cociox8KLveGt3Rudv18T4=; b=qHhcXMRkGIAVyyYdpuUyV+ZuG8WrCSNqGWopsYCuAIm1TtkxmfDoWcuyB94PlTPjwloSfK eYml+IzgdGAlHfOHVGgsmv2l/cJKvxZ23vPD76Tm2hTBNqwwg+RS8/lttQAIRwJJPJPkSH YKBEtY+jbdODgyRX43Yv6bLkC9WL0OCRd3iHOg2qFykuRRT6HbKuAevJmqW+FDLK+C7gBL Uh9yT7Ym796dzkQOWoSfVb9IbhngEisrIRjoWNte1Zp/ggcR6g/cNPmXeTelBz3ItWwfs/ rlTCk0nXejYlqWKz+F9oxId8RlxuU7PMLqyO1rRtc4y5WXUyjNfCBTeCdDqkLw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730387710; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RkFsH9K81US68VRXDR1e7Cociox8KLveGt3Rudv18T4=; b=6Fmlh67NHEOJR2ay79hOqF/tawJTHiYh26fzHue7ZDegkIeesR5omRrGKuaLci+qRX1kcG Hdia48zJrioC0lAQ== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Jani Nikula , intel-gfx@lists.freedesktop.org, Sean Christopherson , Paolo Bonzini , x86@kernel.org, Jakub Kicinski , Kalle Valo , Jens Axboe , Christian Brauner , Peter Zijlstra , John Stultz , Nam Cao , Oliver Hartkopp Subject: [RESEND PATCH v2 14/19] wait: Switch to use hrtimer_setup_sleeper_on_stack() Date: Thu, 31 Oct 2024 16:14:28 +0100 Message-Id: In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" hrtimer_setup_sleeper_on_stack() replaces hrtimer_init_sleeper_on_stack() to keep the naming convention consistent. Convert the usage site over to it. Signed-off-by: Nam Cao Cc: Peter Zijlstra --- include/linux/wait.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/wait.h b/include/linux/wait.h index 8aa3372f21a0..643b7c7bf376 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h @@ -541,8 +541,8 @@ do { \ int __ret =3D 0; \ struct hrtimer_sleeper __t; \ \ - hrtimer_init_sleeper_on_stack(&__t, CLOCK_MONOTONIC, \ - HRTIMER_MODE_REL); \ + hrtimer_setup_sleeper_on_stack(&__t, CLOCK_MONOTONIC, \ + HRTIMER_MODE_REL); \ if ((timeout) !=3D KTIME_MAX) { \ hrtimer_set_expires_range_ns(&__t.timer, timeout, \ current->timer_slack_ns); \ --=20 2.39.5 From nobody Mon Nov 25 00:30:49 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EA4F01C4617 for ; Thu, 31 Oct 2024 15:15:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730387714; cv=none; b=P4oZe3dVAP/TV1nBsWLPUZaJcKFu1N/0/EzUyLAlqjV89uFSuz0Yn1B8goT2t3sWIesUKg/ON62ij4SxYZbPh7FJzEVctciFe17NjxVOLTULochkiXhcjUu7/9b95MYuWuqGRJMVWPR79F2S+Uk3H+dXnTv/t5IAfneBxBQV8tg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730387714; c=relaxed/simple; bh=N68WOKPYMnY/Yu8RV+FhMvhsDTbZX6bh/LSorMgTpKE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=YAItLb/xV7KUyQY6fo3I7wbWUrg/9ev3EK1czcikP/HW3NgHGtFUlSsMfuZ3P8+tIZ386nXoOSuuE98WADDvrH8iFmfEx2f15cvP6iiAElek/t9VPG6YSo2VDhc5ZZ8lbBuiuJSfRmJ1yTp5g9HdjkdvvKPMsD30xoNK5Z/rRPU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Js/uY/Ju; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=jltq/pcM; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Js/uY/Ju"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="jltq/pcM" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730387710; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=agDa32oY8+hApUCXceuPV7IuaqEZ6faXr+Tzf7/xqbg=; b=Js/uY/JuQcgzX6xkvPe8TvXsgkqhxfCFt/jyNJe7m4WjLnusf+nyHTFs7q0IxJNk2Nm3Ku SXKyIHRjasevJzjcJPiokLofjH5OktMNDqou7AwQxrP7mwPcFlKBC2GnL+VAiZO+dEem8X JNFst3rH8vXsLXXU7BtWpCnbxf+8PV2LV72FODDxfW/5M/SzyRnUa222RgJw4Y1XvVJ+Js Ph3RYcCytUNtHpUrI5ExX+LTSwDS8NRCr4yFBKmun/jEjyMihldeePtEP5N7tQrBKnXDeP Whjrd96rGCeZfOeJPABFYii9XyiNTaazw/WkcMTWgLh71dhPx0cL6FbaynOIGA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730387710; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=agDa32oY8+hApUCXceuPV7IuaqEZ6faXr+Tzf7/xqbg=; b=jltq/pcMCVo4jfWlAeaqVhIuyFit+CAsi2H+ug4GjnwNN2LOMOtLp5THPCa6ewEnx6AV9g Q35tp8HT8joVEPDA== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Jani Nikula , intel-gfx@lists.freedesktop.org, Sean Christopherson , Paolo Bonzini , x86@kernel.org, Jakub Kicinski , Kalle Valo , Jens Axboe , Christian Brauner , Peter Zijlstra , John Stultz , Nam Cao , Oliver Hartkopp Subject: [RESEND PATCH v2 15/19] hrtimers: Delete hrtimer_init_sleeper_on_stack() Date: Thu, 31 Oct 2024 16:14:29 +0100 Message-Id: <52549846635c0b3a2abf82101f539efdabcd9778.1730386209.git.namcao@linutronix.de> In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" hrtimer_init_sleeper_on_stack() is now unused. Delete it. Signed-off-by: Nam Cao --- include/linux/hrtimer.h | 3 --- kernel/time/hrtimer.c | 14 -------------- 2 files changed, 17 deletions(-) diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index 6e026730e803..4e4f04b3c0c2 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h @@ -235,9 +235,6 @@ extern void hrtimer_init_on_stack(struct hrtimer *timer= , clockid_t which_clock, extern void hrtimer_setup_on_stack(struct hrtimer *timer, enum hrtimer_restart (*function)(struct hrtimer *), clockid_t clock_id, enum hrtimer_mode mode); -extern void hrtimer_init_sleeper_on_stack(struct hrtimer_sleeper *sl, - clockid_t clock_id, - enum hrtimer_mode mode); extern void hrtimer_setup_sleeper_on_stack(struct hrtimer_sleeper *sl, clo= ckid_t clock_id, enum hrtimer_mode mode); =20 diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index 69430467a17d..376b8182b72e 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c @@ -2051,20 +2051,6 @@ static void __hrtimer_init_sleeper(struct hrtimer_sl= eeper *sl, sl->task =3D current; } =20 -/** - * hrtimer_init_sleeper_on_stack - initialize a sleeper in stack memory - * @sl: sleeper to be initialized - * @clock_id: the clock to be used - * @mode: timer mode abs/rel - */ -void hrtimer_init_sleeper_on_stack(struct hrtimer_sleeper *sl, - clockid_t clock_id, enum hrtimer_mode mode) -{ - debug_init_on_stack(&sl->timer, clock_id, mode); - __hrtimer_init_sleeper(sl, clock_id, mode); -} -EXPORT_SYMBOL_GPL(hrtimer_init_sleeper_on_stack); - /** * hrtimer_setup_sleeper_on_stack - initialize a sleeper in stack memory * @sl: sleeper to be initialized --=20 2.39.5 From nobody Mon Nov 25 00:30:49 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C022C1C8317 for ; Thu, 31 Oct 2024 15:15:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730387714; cv=none; b=bVX5Qdda33IAYZ/NIIRpLbbjv3uVYOR8zgaIedMQZ2Va2WEhws5lPsJWTyWai/M0p5fQ71EjfjbxSLz+oBNj4pr+fMDkqN/PV3j52LyZukW38NN+auE3qVIA0mzL2G1x0Q52Jz3K8v04cAPsPhUGMUS8f9dw0tgaLOGKQJDHZA0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730387714; c=relaxed/simple; bh=25TeNuAsXPUFgvoNR4VhqmvPSq3ba2Pkp66s/J9P69s=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=bqvL/g1h0EMKfoatp5gDK1cWzzcymCnOdjdFAknU+Tcho465rLTEscX9frCJR/a0oZXu+8oWuDKOPPJcIV9s+5VlfjHjd51vLXs4G+GxeAZjSg65GPNxFMIqSxJL1C4nf5nHOMCGOHaZg/3JqD0xMLcoRVHUQ1VMCNBPjzkooYs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=g8u0ndCi; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=A9/e7j66; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="g8u0ndCi"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="A9/e7j66" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730387711; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=v4mSJVNkOJadieQpH/ARr3Pt6XdvliVSvqT1hoZVaV8=; b=g8u0ndCiTr3NS8ibsXO+fgCaxmKmXfdKpLn7cGH70fR0ulPkAnX5uz+SJ/eRJTIAGGKGXG gVquDGd0XkGLh2ExQppw8flgrKGeaoOvFJNeA8WMrF+y+2w17/cYK1bI+H8iI2rRl4B+or Mel1GhvFlT0+HzYapwOZUwCvmeUYj3x4/l9CwdVtB479n1veR4ItHSumcuEKyT06tryDIN GyAkczCv5/RQkwp9hezJPsO//rW7Mtd4Ej1gDNFcm94m5PY89liEo1wYcZMF6rXE0kS/sV fJ/PaFhM4vogluNq4no3g2z96E+WBIV9tcQ/8Hg35dSU2hTF8BfvcGmh2iZDHw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730387711; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=v4mSJVNkOJadieQpH/ARr3Pt6XdvliVSvqT1hoZVaV8=; b=A9/e7j66uU9LW08O+hdNrkr1AcQGQHKf4ec4M/6OUYdzN06aa0+Q3bDxwFes1yVAYlen2/ YKtXm7RpqjUwPDAA== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Jani Nikula , intel-gfx@lists.freedesktop.org, Sean Christopherson , Paolo Bonzini , x86@kernel.org, Jakub Kicinski , Kalle Valo , Jens Axboe , Christian Brauner , Peter Zijlstra , John Stultz , Nam Cao , Oliver Hartkopp Subject: [RESEND PATCH v2 16/19] sched/idle: Switch to use hrtimer_setup_on_stack() Date: Thu, 31 Oct 2024 16:14:30 +0100 Message-Id: <17f9421fed6061df4ad26a4cc91873d2c078cb0f.1730386209.git.namcao@linutronix.de> In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" hrtimer_setup_on_stack() takes the callback function pointer as argument and initializes the timer completely. Replace hrtimer_init_on_stack() and the open coded initialization of hrtimer::function with the new setup mechanism. The conversion was done with Coccinelle. Signed-off-by: Nam Cao Cc: Peter Zijlstra --- kernel/sched/idle.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c index d2f096bb274c..631e42802925 100644 --- a/kernel/sched/idle.c +++ b/kernel/sched/idle.c @@ -399,8 +399,8 @@ void play_idle_precise(u64 duration_ns, u64 latency_ns) cpuidle_use_deepest_state(latency_ns); =20 it.done =3D 0; - hrtimer_init_on_stack(&it.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD); - it.timer.function =3D idle_inject_timer_fn; + hrtimer_setup_on_stack(&it.timer, idle_inject_timer_fn, CLOCK_MONOTONIC, + HRTIMER_MODE_REL_HARD); hrtimer_start(&it.timer, ns_to_ktime(duration_ns), HRTIMER_MODE_REL_PINNED_HARD); =20 --=20 2.39.5 From nobody Mon Nov 25 00:30:49 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D6D51C9DD7 for ; Thu, 31 Oct 2024 15:15:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730387715; cv=none; b=QnHbchP9g5xu65jjghmHjmnNfzLydJ9yik2T6LxJ/RXxuIulLz99dR00Paaryp9E41uj+RPItZz3tuM1Ze5+OgM2ClYSCJgssdmg28cvwxd+Uz/WF94Cx5Ly7Chkwpj8ywM5bM4oHrajludLjR9I/Ik135mzgfX0Le2G9F9Jrtk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730387715; c=relaxed/simple; bh=A8JkiuYfdKuC28T0KIOOEpzfr4l1InScsh9qYcKJJtg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=oot1fjgCAFODVH1xcdTuNE8dQQfnCNP2ujBedprH2rP9wntcMj/1DKdfjzOt47mOM8Tzuk6ACVKulfCUzIvQSLNnNl34zaxZ0F6CBj+WYMFsPaXDHKt7nBRB+a3qUXI7ea16w6U5XGp/8552B8vvdsmBipwLVsXUH6yM97POWmE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=2k27J3wq; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=7QOgfZIu; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="2k27J3wq"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="7QOgfZIu" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730387711; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oYfjK6Ca0PZ7u6hxJjuMYHahvzL9jhDTXWFMtws/RE8=; b=2k27J3wqOQVhl9MKvgZskQoH9r0+R/+UdOyqQAvYOzy4xnayx7Hva90FcqfWzTU2Up7+XL z+Ae1TUKWy+KKqkHi/Ib2pPvSi5n6kBjw1yeVitMynA1HmNZTLwPHD03vefIBM/+Shmf1v oXGClDDPteefEyRPDzjTVrza/dMoqtt/Ikf4qGw+s3vAdV0umJo1HiXB8PbqIDSDEOb5V1 skO+vI9951uZC/BhBWOrycQD+dRQnBCZvw7rvXTAaTqik/a2q9ct1j6MpopAmCmwj+dVmH j0Whw4D4CmjButJ4OV2zy7DJ2kK02sC7p4VYCHwDaK/A9lre1VfnRNX25XdU1A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730387711; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oYfjK6Ca0PZ7u6hxJjuMYHahvzL9jhDTXWFMtws/RE8=; b=7QOgfZIusMOviCnFOXXtb31+1DxjDGaTQgD2d/m9I/g+V89vz6mSaJXN3c4JIgpGVfKIJ8 klW9pVtvT4O9KcCw== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Jani Nikula , intel-gfx@lists.freedesktop.org, Sean Christopherson , Paolo Bonzini , x86@kernel.org, Jakub Kicinski , Kalle Valo , Jens Axboe , Christian Brauner , Peter Zijlstra , John Stultz , Nam Cao , Oliver Hartkopp Subject: [RESEND PATCH v2 17/19] io_uring: Switch to use hrtimer_setup_on_stack() Date: Thu, 31 Oct 2024 16:14:31 +0100 Message-Id: In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" hrtimer_setup_on_stack() takes the callback function pointer as argument and initializes the timer completely. Replace hrtimer_init_on_stack() and the open coded initialization of hrtimer::function with the new setup mechanism. Signed-off-by: Nam Cao Cc: Jens Axboe --- io_uring/io_uring.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index feb61d68dca6..0842aa3f60e7 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -2435,13 +2435,14 @@ static int io_cqring_schedule_timeout(struct io_wai= t_queue *iowq, { ktime_t timeout; =20 - hrtimer_init_on_stack(&iowq->t, clock_id, HRTIMER_MODE_ABS); if (iowq->min_timeout) { timeout =3D ktime_add_ns(iowq->min_timeout, start_time); - iowq->t.function =3D io_cqring_min_timer_wakeup; + hrtimer_setup_on_stack(&iowq->t, io_cqring_min_timer_wakeup, clock_id, + HRTIMER_MODE_ABS); } else { timeout =3D iowq->timeout; - iowq->t.function =3D io_cqring_timer_wakeup; + hrtimer_setup_on_stack(&iowq->t, io_cqring_timer_wakeup, clock_id, + HRTIMER_MODE_ABS); } =20 hrtimer_set_expires_range_ns(&iowq->t, timeout, 0); --=20 2.39.5 From nobody Mon Nov 25 00:30:49 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 047DC1C9EC0 for ; Thu, 31 Oct 2024 15:15:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730387716; cv=none; b=iHgLx8SPA29LD2hRfDkpkmOBpNDOab5qd2M7l1OSuWTUhC56bpKfARGCuHg+K81aXGUB2Zc5ihDu2lOlJsvQqo2/Dxc8TXWyci9zG6ml7b1+PfogXPmN1z+tXZrshw/y1E0ocKi1dPNlW0bvBqJG4um03BW4179S/iztgyAjrgY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730387716; c=relaxed/simple; bh=dl9A3y/7DWwcSmaoC9X28xC0xRgkB4mTKJespZKBbGI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ihV5UgfMrjVLG7hXdyhHK2wuUmGZs61QUlZYRv9Pyy8wn4PeUM8Jq9+ll1XqNdVzz2HeKnTczeL1zuRfoEG8zd44fu4r7t2kDmjXp1JkeycNwPFYISLa77CQD8CLdvyyt9bb5OVZppwTbo6WLiHDrfH+p/DKD8+l6wgTGjDZzh4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=3oLfX19B; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=dYr0dnRr; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="3oLfX19B"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="dYr0dnRr" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730387712; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GU2XVazw0GjbHPIfXGHM1SlNEVDhVGkrGNW/ZVs0bq8=; b=3oLfX19B9bkmjYpuep2ukDT9RuM0sjRNPZ1LYWuFrCC22OqBkClmt3FGa1f0TmYHvs3Fzy Nt1TSZJJIf/FDLz9S8eYlidHGwP/eeBF87HrvPGmeC9giczGNZt2ER7L3fM8x3cLogaG4f mKdn5xQ3hkcuX7KJxwF5XCXrXPOB2Wh2Sv8I1GtVyWKK2a2iXmkEuHKpbOYYVrLqNNPkhl 9XRR/YcmKfHqnMYFa56FS6bcRu6XOyhl6++OIktbbjNKSoOag8KL0mi3Ts/lVmoNjY5ZHl I21szVK1FUyr0b7W516opP0/Bv+rBINOlXzsRMN1MjTkKahKYZuePy2m41wsSA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730387712; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GU2XVazw0GjbHPIfXGHM1SlNEVDhVGkrGNW/ZVs0bq8=; b=dYr0dnRr4PeCWO2kuEc2e2LCz/omiE1Ka36qPy0pqIZZGqW9NhLdUPz8PRZuMEClwAngpf CDGJ1gl+OGraXyBQ== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Jani Nikula , intel-gfx@lists.freedesktop.org, Sean Christopherson , Paolo Bonzini , x86@kernel.org, Jakub Kicinski , Kalle Valo , Jens Axboe , Christian Brauner , Peter Zijlstra , John Stultz , Nam Cao , Oliver Hartkopp Subject: [RESEND PATCH v2 18/19] alarmtimer: Switch to use hrtimer_setup() and hrtimer_setup_on_stack() Date: Thu, 31 Oct 2024 16:14:32 +0100 Message-Id: <2bae912336103405adcdab96b88d3ea0353b4228.1730386209.git.namcao@linutronix.de> In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" hrtimer_setup() and hrtimer_setup_on_stack() take the callback function pointer as argument and initialize the timer completely. Replace the hrtimer_init*() variants and the open coded initialization of hrtimer::function with the new setup mechanism. Switch to use the new functions. Signed-off-by: Nam Cao Cc: John Stultz --- kernel/time/alarmtimer.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c index 452d8aa2f6e0..f581868e1b3e 100644 --- a/kernel/time/alarmtimer.c +++ b/kernel/time/alarmtimer.c @@ -337,7 +337,6 @@ __alarm_init(struct alarm *alarm, enum alarmtimer_type = type, enum alarmtimer_restart (*function)(struct alarm *, ktime_t)) { timerqueue_init(&alarm->node); - alarm->timer.function =3D alarmtimer_fired; alarm->function =3D function; alarm->type =3D type; alarm->state =3D ALARMTIMER_STATE_INACTIVE; @@ -352,8 +351,8 @@ __alarm_init(struct alarm *alarm, enum alarmtimer_type = type, void alarm_init(struct alarm *alarm, enum alarmtimer_type type, enum alarmtimer_restart (*function)(struct alarm *, ktime_t)) { - hrtimer_init(&alarm->timer, alarm_bases[type].base_clockid, - HRTIMER_MODE_ABS); + hrtimer_setup(&alarm->timer, alarmtimer_fired, alarm_bases[type].base_clo= ckid, + HRTIMER_MODE_ABS); __alarm_init(alarm, type, function); } EXPORT_SYMBOL_GPL(alarm_init); @@ -816,8 +815,8 @@ static void alarm_init_on_stack(struct alarm *alarm, enum alarmtimer_type type, enum alarmtimer_restart (*function)(struct alarm *, ktime_t)) { - hrtimer_init_on_stack(&alarm->timer, alarm_bases[type].base_clockid, - HRTIMER_MODE_ABS); + hrtimer_setup_on_stack(&alarm->timer, alarmtimer_fired, alarm_bases[type]= .base_clockid, + HRTIMER_MODE_ABS); __alarm_init(alarm, type, function); } =20 --=20 2.39.5 From nobody Mon Nov 25 00:30:49 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7249E1CB307 for ; Thu, 31 Oct 2024 15:15:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730387717; cv=none; b=rm97Gnr8qTW1hg5SjNHxaFuuNKJiiGHGo5iN2l/cl0J+lYBYj2qHKscM/FtIlVXJy/vRELt3WrPN7N00WQtjppx7+t3XsHP7DlX9doKlzw5i00/1swT/NbQAGxjGQIGRIByKDbKrxH0N3syYMPEX97Bf9SNThYs8SzII3XyXXs0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730387717; c=relaxed/simple; bh=fAmxbllysH9EcW872wKMtTlLhbFGHlUzSTQmmo+32mU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=MIWyk9asLFeTO3rcM8+rMyQWYe+BSUK0QZ5r5cDKPbgFL0zRlJnosGP9X06jKjGWT33baSuxTN1LIOLvfQ6faqCIwFlFYg92RQpN6zz3Y4D6eJwnHFo/Ox9ZjtjGRyiRlaUc13L2jaxQthU3MNSyh0pkTa5xL1c6zrAk18LSCWw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=D/xG8kr+; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=D2pvWG87; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="D/xG8kr+"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="D2pvWG87" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730387713; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FyamRs/0EaIVuqQPB5WehumUy+LlGp/xnGmtDyoDFVM=; b=D/xG8kr+UzsvOcpBfyWcjyng7sjzcG0K9EcKPyWNMvYeG261TZrnXlHKGVEei6kOb1mF9g hrf9gXxIuOMPQRKyOSOVUxjL11yKt4rbweVKNokjzjIFnwVrW+5V2Cc/vuOAZ2fL4CTsCZ iccJSgXg8Wtx8tp/N4FoCAyHAXDn9cSBwesyyv6Qh0is6BA1IN5r8JG47+fdncBCpv5tHD GZtOfPE9YAEKqjwvnlpEVYJp8uihxzJnF3hTylqAqj47IkbIXhyap9W9XpR7hXpPj9b7ak gR3um/D30x2wY5n+dA4mfvE6H1WXu7ybo7KKtsESP+2NzirZT49CCRQmUMs5Pg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730387713; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FyamRs/0EaIVuqQPB5WehumUy+LlGp/xnGmtDyoDFVM=; b=D2pvWG87LT2hKQ4zyhtS4dnMNig7h3FvWA2cslB8Pl369L5ZejnCak3vfTJBRhReZzEGAU wlIlMFS825QVE4Aw== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Jani Nikula , intel-gfx@lists.freedesktop.org, Sean Christopherson , Paolo Bonzini , x86@kernel.org, Jakub Kicinski , Kalle Valo , Jens Axboe , Christian Brauner , Peter Zijlstra , John Stultz , Nam Cao , Oliver Hartkopp Subject: [RESEND PATCH v2 19/19] hrtimers: Delete hrtimer_init_on_stack() Date: Thu, 31 Oct 2024 16:14:33 +0100 Message-Id: <510ce0d2944c4a382ea51e51d03dcfb73ba0f4f7.1730386209.git.namcao@linutronix.de> In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" hrtimer_init_on_stack() is now unused. Delete it. Signed-off-by: Nam Cao --- include/linux/hrtimer.h | 2 -- kernel/time/hrtimer.c | 17 ----------------- 2 files changed, 19 deletions(-) diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index 4e4f04b3c0c2..7ef5f7ef31a9 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h @@ -230,8 +230,6 @@ extern void hrtimer_init(struct hrtimer *timer, clockid= _t which_clock, enum hrtimer_mode mode); extern void hrtimer_setup(struct hrtimer *timer, enum hrtimer_restart (*fu= nction)(struct hrtimer *), clockid_t clock_id, enum hrtimer_mode mode); -extern void hrtimer_init_on_stack(struct hrtimer *timer, clockid_t which_c= lock, - enum hrtimer_mode mode); extern void hrtimer_setup_on_stack(struct hrtimer *timer, enum hrtimer_restart (*function)(struct hrtimer *), clockid_t clock_id, enum hrtimer_mode mode); diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index 376b8182b72e..55e9ffbcd49a 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c @@ -1629,23 +1629,6 @@ void hrtimer_setup(struct hrtimer *timer, enum hrtim= er_restart (*function)(struc } EXPORT_SYMBOL_GPL(hrtimer_setup); =20 -/** - * hrtimer_init_on_stack - initialize a timer in stack memory - * @timer: The timer to be initialized - * @clock_id: The clock to be used - * @mode: The timer mode - * - * Similar to hrtimer_init(), except that this one must be used if struct = hrtimer is in stack - * memory. - */ -void hrtimer_init_on_stack(struct hrtimer *timer, clockid_t clock_id, - enum hrtimer_mode mode) -{ - debug_init_on_stack(timer, clock_id, mode); - __hrtimer_init(timer, clock_id, mode); -} -EXPORT_SYMBOL_GPL(hrtimer_init_on_stack); - /** * hrtimer_setup_on_stack - initialize a timer on stack memory * @timer: The timer to be initialized --=20 2.39.5