From mboxrd@z Thu Jan 1 00:00:00 1970 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 144328614E for ; Wed, 15 Jan 2025 14:39:49 +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=1736951991; cv=none; b=K4ZWmpUwCiYLrcuhEHDUi7SgRn++aZbi2+nWKr+MIrtohuUEiUWBWldlc9FxjxJBjM4slOQzfB/V42DqrMiEFR4JELcidsyra0mwlDsfDnI1wmGkYcdOBcJDKeNy9f8kihk7ollwjP0Al5VXWtvUWcqbWU4mbsTV8r5k8NurUMA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736951991; c=relaxed/simple; bh=qwhdIYg1kewQ4PMb7/ctfhLK1SRf7GaMBYwTznZLopI=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=oqr4kPPyq4+X5BecD+vLQ2w1i7NxZltQSca2RgiFjKDnOXQ9jAXABEEyr+VkTqzce2lqci3oiU8F9RMkvXWZiEYAEk7fUmTtiAKKpfy9P6GhcwZsGAmJhFlMgeUPzifES6TlS1b4A+gB5EhB8JyDFe3Mp4SdSU3yJUnrAYsRdb8= 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=JjH62GMU; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=DOXPUWK+; 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="JjH62GMU"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="DOXPUWK+" From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1736951988; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=8HnRYVgQTqFq5ZW3/CsG3lJ8PA3udJrInB3GjhFXlAE=; b=JjH62GMUsqrp01cLqAcj1wkonlICoF2lZtFqV3DmCaum2vTgtfAemZ0JdG2WT7CeCeuv2t oeT+9p6yWTGv7frCmNGVTd0KXNM7uPD4wfm1J7G49NW9st8ru551vH7J6CSThAS/+Il+UX W7uaWAr60PDGDtoBjlUXszTFnffK0GXZ5Q9XkR6fk0itrnF5SA/1WL2pTm+sihnX6BUrEw o+pfG8Payv4BGfpbZdrhYOqKpOBIuUIfBKqPo2yvXHKPHE52gP64uMJUd/g0VnUx1XlpGC mWtjqyfT1XY755t76HbM2OqHOBY3HVbASKw++YkVCcgZcpNkrGJp82RAq8LYkQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1736951988; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=8HnRYVgQTqFq5ZW3/CsG3lJ8PA3udJrInB3GjhFXlAE=; b=DOXPUWK+RarJYYy5JvRJ/3JTVTZEeYnvxLeWYfQwuPYb6l0pJY5UtuI7LVIc0mV0KGzd/L T6HveFAJYNIm6UBw== To: Imran Khan , anna-maria@linutronix.de, frederic@kernel.org Cc: linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] timers: WARN if add_timer_on is used with offlined cpu. In-Reply-To: <20250115134111.2703089-2-imran.f.khan@oracle.com> References: <20250115134111.2703089-1-imran.f.khan@oracle.com> <20250115134111.2703089-2-imran.f.khan@oracle.com> Date: Wed, 15 Jan 2025 15:39:47 +0100 Message-ID: <87wmewb0p8.ffs@tglx> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain On Thu, Jan 16 2025 at 00:41, Imran Khan wrote: > timer started on an offlined cpu will not fire after > its expiry time and may never fire if that cpu remains > offline. > So add a WARN_ON_ONCE in add_timer_on, to indicate > if any of its users are (wrongly) starting a timer > on an offlined cpu. > > Suggested-by: Thomas Gleixner > Signed-off-by: Imran Khan > --- > kernel/time/timer.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/kernel/time/timer.c b/kernel/time/timer.c > index a5860bf6d16f9..ec9eb58e45241 100644 > --- a/kernel/time/timer.c > +++ b/kernel/time/timer.c > @@ -1370,6 +1370,12 @@ void add_timer_on(struct timer_list *timer, int cpu) > if (!timer->function) > goto out_unlock; > > + /* > + * WARN if specified cpu is offline, because on offlined cpu > + * timer will not fire even after its expiry. > + */ > + WARN_ON_ONCE(!cpu_online(cpu)); Then why queueing the timer in the first place? Thanks, tglx