From nobody Mon Feb 9 03:32:19 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 9FEED332EC7 for ; Thu, 13 Nov 2025 08:33:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763022828; cv=none; b=Lvt2LTanRRo+tsdAjtSAO3DUSRMsYePapwmf0L7zNODay1ppX8nkgt91U8ncWDLFsUdssUnwys+nxWVgGEIZz6stRLvD7h25kcY6ktRBdpKmeWJwUDz1Cdyzz9jQDopLk/TAgOjBZp7qi2i/7Q9QrJbSztCydAOrXHbH3Gnjews= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763022828; c=relaxed/simple; bh=h9zCLxevW0BeJp7x8zq2wJMqqzIAevv3ukM7FhMDTm8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bpiuQ6sv3Ejidw9DudVOLXj7HvcF9PVwNnE00I5v2PAu8mInkMG6ExfN39yk8SyzWKd35eBcldmcOgGHqINDpGlURQW53cf9AXhYc6qq0EKNP8DMuEbi5rW/920g7JVkiTiK2ViKs81YzGZL6lo5kJJz+cT857hpvOKsknSFSwQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=DwyWis63; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="DwyWis63" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1763022825; 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=KDOpZxu2kGvD2DA3U7iG3bEhn7Hb+BXxgRYqEsyy++I=; b=DwyWis63RgisrHl+UuRQp8R0ucZbK5O3dbu96jgKSNMVJAC2wLonr8w3b5SpdtjYF0hV7S zs6Q6D/niUart8SDgSrCLS2yZayXYK5z3KgRykjea2ycO3clsnAHA500xgj6eJtwGDmaPr HMvVb/hs1EN8EmDxwnQIl8Aa0PzRMV8= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-44-7bTVsT7tPvqAZ-e1tOB_aw-1; Thu, 13 Nov 2025 03:33:44 -0500 X-MC-Unique: 7bTVsT7tPvqAZ-e1tOB_aw-1 X-Mimecast-MFC-AGG-ID: 7bTVsT7tPvqAZ-e1tOB_aw_1763022823 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2590D19560AE; Thu, 13 Nov 2025 08:33:43 +0000 (UTC) Received: from gmonaco-thinkpadt14gen3.rmtit.csb (unknown [10.44.32.78]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 76FE31800451; Thu, 13 Nov 2025 08:33:40 +0000 (UTC) From: Gabriele Monaco To: linux-kernel@vger.kernel.org, Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Waiman Long Cc: Gabriele Monaco Subject: [PATCH v15 3/7] timers: Use scoped_guard when setting/clearing the tmigr available flag Date: Thu, 13 Nov 2025 09:33:20 +0100 Message-ID: <20251113083324.33490-4-gmonaco@redhat.com> In-Reply-To: <20251113083324.33490-1-gmonaco@redhat.com> References: <20251113083324.33490-1-gmonaco@redhat.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-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 Content-Type: text/plain; charset="utf-8" Cleanup tmigr_clear_cpu_available() and tmigr_set_cpu_available() to prepare for easier checks on the available flag. Reviewed-by: Frederic Weisbecker Signed-off-by: Gabriele Monaco Reviewed-by: Thomas Gleixner --- kernel/time/timer_migration.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/kernel/time/timer_migration.c b/kernel/time/timer_migration.c index b8f07e4f59a6..d3eb9714e692 100644 --- a/kernel/time/timer_migration.c +++ b/kernel/time/timer_migration.c @@ -1440,17 +1440,17 @@ static int tmigr_clear_cpu_available(unsigned int c= pu) u64 firstexp; =20 cpumask_clear_cpu(cpu, tmigr_available_cpumask); - raw_spin_lock_irq(&tmc->lock); - tmc->available =3D false; - WRITE_ONCE(tmc->wakeup, KTIME_MAX); + scoped_guard(raw_spinlock_irq, &tmc->lock) { + tmc->available =3D false; + WRITE_ONCE(tmc->wakeup, KTIME_MAX); =20 - /* - * CPU has to handle the local events on his own, when on the way to - * offline; Therefore nextevt value is set to KTIME_MAX - */ - firstexp =3D __tmigr_cpu_deactivate(tmc, KTIME_MAX); - trace_tmigr_cpu_unavailable(tmc); - raw_spin_unlock_irq(&tmc->lock); + /* + * CPU has to handle the local events on his own, when on the way to + * offline; Therefore nextevt value is set to KTIME_MAX + */ + firstexp =3D __tmigr_cpu_deactivate(tmc, KTIME_MAX); + trace_tmigr_cpu_unavailable(tmc); + } =20 if (firstexp !=3D KTIME_MAX) { migrator =3D cpumask_any(tmigr_available_cpumask); @@ -1469,13 +1469,13 @@ static int tmigr_set_cpu_available(unsigned int cpu) return -EINVAL; =20 cpumask_set_cpu(cpu, tmigr_available_cpumask); - raw_spin_lock_irq(&tmc->lock); - trace_tmigr_cpu_available(tmc); - tmc->idle =3D timer_base_is_idle(); - if (!tmc->idle) - __tmigr_cpu_activate(tmc); - tmc->available =3D true; - raw_spin_unlock_irq(&tmc->lock); + scoped_guard(raw_spinlock_irq, &tmc->lock) { + trace_tmigr_cpu_available(tmc); + tmc->idle =3D timer_base_is_idle(); + if (!tmc->idle) + __tmigr_cpu_activate(tmc); + tmc->available =3D true; + } return 0; } =20 --=20 2.51.1