From nobody Mon Dec 15 21:48:43 2025 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (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 8B7CA242249 for ; Wed, 15 Jan 2025 13:41:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.165.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736948505; cv=none; b=nJ7fjPtBovBb6U3OG00V8XkWpi41eUm+BkCDeWgabZri4etQU+huJp0+2kUdbcoLQCYr3nZwHtXqJCKsR2dcyWQGudGPld56OP+AJLYLiBnh7FmKRx5x+pSopQmW+CI0YUZUBbZaLJRSi4Yrn0jOtuAqRmlY0lyKEx8V/6nGfII= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736948505; c=relaxed/simple; bh=2b8kaFsmptBxNllM469JMWLKSEf7V8y18Scf6sl0VSQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Jost38nj1tn6tB1IK6pFM4EAZ5sWClIydsR7sEwm0ljwJWsW518ojt26qcMYOQ8u4xG4bDG1UsZTvsQe0h2JmeqUsV5g8j7/BhI2/4wamXsKpwDUXQf9TojrjQWk/fagGq44iYMUcPSkO+pPcXpxKHwcXieG23P0yWGEc7ISaNM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=Eb7k6Jsm; arc=none smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="Eb7k6Jsm" Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50FCiiwW017442; Wed, 15 Jan 2025 13:41:30 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=corp-2023-11-20; bh=XMmi6 J+UHg0qAn1NtUl5Qd7nrl0fgJTdq9iw4mc3n/g=; b=Eb7k6Jsmc9tw5aqMBtOPa yHr6633JjP2a+nAJPqB3Baqpg2ItDDlZcAeOy7PYorOLnXhV9n2nxScePgcTmUD8 jCM2NRBzxAdDs+Z27gOosxc0TCh7zPf3Xg+tuashXS0DHi0HXy8mobqzeet7QQ2d R1ju/amU6ka1fQ6nflyCuOdhj/rnQHqGs76yn0e2SjKrde/pcTR0Vd9k5bzqpjxu 2WRxZI+Mv6/+WPw6iIXSxSloviKI9UOCpb6F9AA4zuKdqxsGMrSjRaGl0w8yGgvS Z1gIH2o8UcC9eYLf5D+LeBDSIXhMJDkkCrEWsbF45ivKgcRlKfbHahni3OiUkkOc Q== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 443h6syyee-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Jan 2025 13:41:30 +0000 (GMT) Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 50FCpdBn020444; Wed, 15 Jan 2025 13:41:22 GMT Received: from localhost.localdomain (dhcp-10-191-135-68.vpn.oracle.com [10.191.135.68]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 443f3fsvea-2; Wed, 15 Jan 2025 13:41:21 +0000 From: Imran Khan To: anna-maria@linutronix.de, frederic@kernel.org, tglx@linutronix.de Cc: linux-kernel@vger.kernel.org Subject: [PATCH 1/2] timers: WARN if add_timer_on is used with offlined cpu. Date: Thu, 16 Jan 2025 00:41:10 +1100 Message-Id: <20250115134111.2703089-2-imran.f.khan@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250115134111.2703089-1-imran.f.khan@oracle.com> References: <20250115134111.2703089-1-imran.f.khan@oracle.com> 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 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-15_05,2025-01-15_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 adultscore=0 spamscore=0 suspectscore=0 phishscore=0 malwarescore=0 mlxscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2411120000 definitions=main-2501150103 X-Proofpoint-GUID: CTq6MbkUVMFR24HBwmeIGWDwQ8ObVJtG X-Proofpoint-ORIG-GUID: CTq6MbkUVMFR24HBwmeIGWDwQ8ObVJtG Content-Type: text/plain; charset="utf-8" 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; =20 + /* + * WARN if specified cpu is offline, because on offlined cpu + * timer will not fire even after its expiry. + */ + WARN_ON_ONCE(!cpu_online(cpu)); + if (base !=3D new_base) { timer->flags |=3D TIMER_MIGRATING; =20 --=20 2.34.1