Message ID | 20240219143301.4174966-1-costa.shul@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-71484-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1321456dyc; Mon, 19 Feb 2024 06:33:50 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXgw87VmQAssEMGzuIY9/CFxP8m5Ax3dDlNdIhGI2qElqd+lN7tSH2Wax9ArcY8rc7rnTtqOczrn3cdXJevvaQ3KGBh+A== X-Google-Smtp-Source: AGHT+IFef0rnnoFkg/yfgN0n3poO5nf9oR6yaKmiTHKbkRemTzhtcYcc7K+24rx7lpgGHtrid82k X-Received: by 2002:a05:6359:1012:b0:179:272e:54e4 with SMTP id ib18-20020a056359101200b00179272e54e4mr13615836rwb.20.1708353230024; Mon, 19 Feb 2024 06:33:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708353229; cv=pass; d=google.com; s=arc-20160816; b=kNpImxU6NeS/kNXzgwAYb23wK2RAJMstqK5xwMJDanUcvFXco6epe4//ZWsZsTXZIk 907fSh4t6eqZlr2mwcPitZo/sYimi3QZ/PNGiuyDx50xTmnKzVfxuHKHzKAKuLQtgsi8 moSpKlwlNlsFCdMglnq/ShGxadlkyfxQ+LOHMUo90125GWkRNqHbmOK8v8xnG3UYiA3P yjgOrwmD2BiXuWe3Rv95Jw3ly903z+IK3JHBcctlbBZbOdEG8tv6mwkPuPLRyRmWSqQH C7ii5bR1/icCvZCMIiepb9wtxtl75t5NuzkwaZc71SXRfP/iicCRzSwT/SbK/g8sUG2e R59w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=1/YtCpE3WL4LKQWYuWvJ5CfzUa+1tQLWgCa4kzjT15c=; fh=CqGfvN35NEsdWQJnfLZyvUFU39avL3oKufHkEtks6Yc=; b=oVIBLmd/vb3TJjoM4WXAZTwq6aDzpQnPLq/UiLGnL6wpwTKyI6fIdHPdApbQanPIzT p2564F8qs06BjjnKZgjA0Oh6nHQMhev2LDFOKLE1O9rvIuI2NhbTCyu7z50jsAeu/dLb Cd6T/FoJIhRuqIGKA05D+LVIai4q1uk1sUajJ58EvYAdMFKinXGRaowUAPF+qmGTrIVs hwVlO4RT46DcbcdaSJJgp3YzG2VswbGid6do5hEUvdb0bzOSfhV2vuxgKczb0CFpoH+b oJeoK3Uv+afS1aPj25e3qc2tsdBupN8aLK7WpUKvHdaNjupQfj8FtJ/fZNkNKIlPRGhy l69g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-71484-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71484-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id a18-20020a05620a439200b007872a3c185dsi7072660qkp.14.2024.02.19.06.33.49 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 06:33:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71484-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-71484-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71484-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id C91891C2103F for <ouuuleilei@gmail.com>; Mon, 19 Feb 2024 14:33:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 629C31E864; Mon, 19 Feb 2024 14:33:34 +0000 (UTC) Received: from mail-qt1-f175.google.com (mail-qt1-f175.google.com [209.85.160.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 64C1F32189 for <linux-kernel@vger.kernel.org>; Mon, 19 Feb 2024 14:33:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708353212; cv=none; b=ISZ8L4zq2Rsk/rEoRoKC2qXD56qVD3zBMZoKwAlX3FeoD3u6wi4aVRVA4/2i/+E86H5pJQ0A183Cxhlm/iwl8uEHnGBG9rPwM5FDmC/8fb1Y6o1awxhFM/4kGA5NBH/qM8vAowl7z3sBmhpUGzhWr5TE+jLCMI4e49cEZd60I+E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708353212; c=relaxed/simple; bh=cHR/zuNBoQ74l20sbaBy5k3+Q1djSutljUyI2PwZi14=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EjGRhufvU4QaA6UH+JJ9bwtUGCra/i+5qUgOhIGU6nfQAvTjwPlY6P2lfuSE8JcPfDKMt2kO9XgFajG4PPIy7vSh7B7/BmP5KP1CX7U7e8afNOzGvue4FpHV4BrGvC3mTAgslQ4iC53Wcer+1JVf1ALC4JmGJJgNqR51sfaUyBk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.160.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-qt1-f175.google.com with SMTP id d75a77b69052e-42a4516ec5dso31228801cf.3 for <linux-kernel@vger.kernel.org>; Mon, 19 Feb 2024 06:33:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708353209; x=1708958009; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1/YtCpE3WL4LKQWYuWvJ5CfzUa+1tQLWgCa4kzjT15c=; b=MzZudJpeNOPWIzbpHpOlLNxa/mffemOP+48Wp1rK9i7pDPjB3CoUApMjFRUHGMF57y BE3qxNR7agm1+9ngc8QgtAwM9T+bDH1KaNVXiilBaI6GNNtREh6tAQPpiSCAJQYRzmUW qm5BKpIh3UkIdr0WdKJzPekYJW9hL23pL90+MpzcmguYEVNX3kFk0GDJbjOxjAv6vQkJ B7Pa48VmgYkrX86MBmjmmp8CUhLoOX+jbzAvl5o5IszlelKsAdHtP46JP55zoRYlbJIT 8oXjXCzjiQ6Yg16/YviGA3MX6R+bS/PZbYb9cjqbPA52UE6QMAE+dLDSTjGQ7wgFBft/ uGKg== X-Forwarded-Encrypted: i=1; AJvYcCVwHgrfAA8QUtC9zJuEmXSv+vDpF3y4XooDbnu/wqBFWG8V492COE1elottDzw6IX6QNFr5J83vMvZ0ba0haAcWyxERFyyXXP7vSdwm X-Gm-Message-State: AOJu0YzCf0K8DAktXuVujZP3ssP2D79nccLovgcEAbB7Xiq/mC0g1200 BrZ0igzOOrwWrsqZjljFQmSMHC6wr8irEdUiA5mNcJ3f5tXm13Y/ X-Received: by 2002:a05:622a:1710:b0:42d:f85c:4eb2 with SMTP id h16-20020a05622a171000b0042df85c4eb2mr8720988qtk.48.1708353209471; Mon, 19 Feb 2024 06:33:29 -0800 (PST) Received: from costa-tp.redhat.com ([2a00:a040:1a4:9a9f:19ad:6a8:f94b:c9c]) by smtp.gmail.com with ESMTPSA id c21-20020ac853d5000000b0042e1950d591sm468324qtq.70.2024.02.19.06.33.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 06:33:28 -0800 (PST) From: Costa Shulyupin <costa.shul@redhat.com> To: Thomas Gleixner <tglx@linutronix.de>, linux-kernel@vger.kernel.org Cc: Costa Shulyupin <costa.shul@redhat.com>, Waiman Long <longman@redhat.com>, Frederic Weisbecker <frederic@kernel.org> Subject: [PATCH v3] hrtimer: select housekeeping CPU during migration Date: Mon, 19 Feb 2024 16:33:01 +0200 Message-ID: <20240219143301.4174966-1-costa.shul@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240213164650.2935909-3-costa.shul@redhat.com> References: <20240213164650.2935909-3-costa.shul@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790610837014934600 X-GMAIL-MSGID: 1791338196506467795 |
Series |
[v3] hrtimer: select housekeeping CPU during migration
|
|
Commit Message
Costa Shulyupin
Feb. 19, 2024, 2:33 p.m. UTC
During CPU-down hotplug, hrtimers may migrate to isolated CPUs, compromising CPU isolation. This commit addresses this issue by masking valid CPUs for hrtimers using housekeeping_cpumask(HK_TYPE_TIMER). Suggested-by: Waiman Long <longman@redhat.com> Signed-off-by: Costa Shulyupin <costa.shul@redhat.com> Reviewed-by: Waiman Long <longman@redhat.com> Reviewed-by: Frederic Weisbecker <frederic@kernel.org> --- Changes in v3: - fixed compilation errors Changes in v2: - [v1] https://lore.kernel.org/all/20240211135213.2518068-1-costa.shul@redhat.com/ - reworded and rebased on next --- kernel/time/hrtimer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Comments
Costa! On Mon, Feb 19 2024 at 16:33, Costa Shulyupin wrote: > During CPU-down hotplug, hrtimers may migrate to isolated CPUs, > compromising CPU isolation. This commit addresses this issue by > masking valid CPUs for hrtimers using housekeeping_cpumask(HK_TYPE_TIMER). Review feedback is meant to be addressed. I fixed it up for you in V2 and told you what needs to be changed and you got the fixed up version in your inbox. Feel free to ignore me, but don't expect me to mop up your stuff. Thanks, tglx
diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index edb0f821dcea..6057fe2e179b 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c @@ -38,6 +38,7 @@ #include <linux/sched/deadline.h> #include <linux/sched/nohz.h> #include <linux/sched/debug.h> +#include <linux/sched/isolation.h> #include <linux/timer.h> #include <linux/freezer.h> #include <linux/compat.h> @@ -2223,8 +2224,8 @@ static void migrate_hrtimer_list(struct hrtimer_clock_base *old_base, int hrtimers_cpu_dying(unsigned int dying_cpu) { + int i, ncpu = cpumask_any_and(cpu_active_mask, housekeeping_cpumask(HK_TYPE_TIMER)); struct hrtimer_cpu_base *old_base, *new_base; - int i, ncpu = cpumask_first(cpu_active_mask); tick_cancel_sched_timer(dying_cpu);