Received: by 2002:a05:7412:2a91:b0:fc:a2b0:25d7 with SMTP id u17csp42249rdh; Tue, 13 Feb 2024 08:51:32 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCViIpwDQ89SRdaQqKzJ4rBgRX8e08prYmQmphBBy6LISzKjyy/nTM3c/D6tEhz2C7YrnKxBcWtxd4pABhs03hqynGXMJYpNc2eU2YmBdg== X-Google-Smtp-Source: AGHT+IHb2z2MlTyfwjuMoL9plOUymLS42n1199Oshj+vD8lOB59BGFJRCm9hfBRgxM8ig3wb1HM2 X-Received: by 2002:a05:620a:6606:b0:787:2378:e0e5 with SMTP id qf6-20020a05620a660600b007872378e0e5mr143071qkn.71.1707843091968; Tue, 13 Feb 2024 08:51:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707843091; cv=pass; d=google.com; s=arc-20160816; b=d6HmMjs+3tQ2jPVACpnhWl++0pYdYSosEz/6V1GINwFunEwli9p5mja98E2zIM38TS m80dXgJUj/0aO/o+KDhyKhi+qU0B9U509QBkqjNwbUb4ygx+Mqk3YN8ss6slibOshoXq UYRT6YjzJgrtX7/MrvtFdixBLHOER3712QMCpWiiQFlgnMqWuIfynMJG9ca17Fc+LeMz jBB56nt5bKfeSlda89d7bXVgt2DslNltt0BuXP2j6rbSjP+lwnwZMoZxdKO81DcvyWfl 12Oeiw+QlK5n2u3oGjrKsouTQP4QDY+XUlG/LhWByUwlLd9v/IbjXFLK+ppPZn9aaQNR o75g== 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=W8rCZ76h4ZxdDgV1qzO63Dy9I9DhB49wsplKO93pUzM=; fh=ExGP20NukeS6jqe8PSypMPrPc/q15ouKpi6pRHTo8uU=; b=NtA4vA0ITDRRjL+59bnLLtB1xbOF0pOkGaXNrwlT16VAhbc4Dcl4HQcb8XZZLL6CKB x98n8r56YOLueyPmIDd4mc4kdcANyda8/4cpEPq5yPfGgJ9ns8z3JV190/aVXBvsd7IQ KA30CY/dVf42u6oDG0NEqQV+kKf7GfGAaHJkdU0t4Up+DgsyBc6StOyOwKwabb6Gi+l0 /9o+PhlyueMr6FCimZlTzZ78hjDYiB1jpnJP+KgF8olpV3vFqJbmbJAHj6i+wv80fb/V Y+S9opLhal3MOuSRzWKGtnp1XRY2VU/A3/I8LMNleUJBGacGMIPdpGn7mm6oA8nMWWbB RuQg==; 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-63938-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63938-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Forwarded-Encrypted: i=2; AJvYcCVB7JALRIht5bchVQw/CoVyweLYYNdLEiA92JpuB0mjNkKgHhBtpvJhcc1XylUCRWKmGD4MYfjar2lyZC4P9H3qt4B2Jy2BRjTeihShUQ== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id x23-20020ae9e917000000b0078725ff3ea0si342541qkf.344.2024.02.13.08.51.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 08:51:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-63938-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-63938-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63938-linux.lists.archive=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 DE68F1C263D5 for ; Tue, 13 Feb 2024 16:50:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4EBFD5FDC7; Tue, 13 Feb 2024 16:49:23 +0000 (UTC) Received: from mail-yb1-f178.google.com (mail-yb1-f178.google.com [209.85.219.178]) (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 5DEA858124 for ; Tue, 13 Feb 2024 16:49:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707842962; cv=none; b=YgZF3vTQY/QdTbcUGvGKhb5aVZ81xm4pFlgeEgKC0NiM0yuGaLuiT0sOBdCnwCLQm/yLhlpaA4ti/c7GvL555yHPSCEiMxzdbehEOTsIq8T8aemoPzBo9eVnc+oyfKYIQNAxBW2L8cnZf1XucYyyGr7j0B9IaA1Yu2WMVaHYH+4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707842962; c=relaxed/simple; bh=t5eu94w58s/hnTAf+99KfT5+85It8b/b96Jcf315P7E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=f429QTocbFOAT6VgCII7NqYrLNoGGD5rveYia+rESbbsp+ZfXWhdYAwWpk/0A4FgJHXutUtefFqrl8Gql75CvtFhb4njKWeqTXZz5MA4sc4eWMsnN4jPfDMmfo83m+i2dVnUEO+cA4p90lWNSVcZEsGa+n6f38DJwtRPac8+HIc= 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.219.178 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-yb1-f178.google.com with SMTP id 3f1490d57ef6-dcd94fb9e4dso78700276.2 for ; Tue, 13 Feb 2024 08:49:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707842960; x=1708447760; 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=W8rCZ76h4ZxdDgV1qzO63Dy9I9DhB49wsplKO93pUzM=; b=Y4UbH0DqAGSb8mcKsaChetOdjX7GcGTRKgOvOlbg9d5MCGX75vEQmy0Ul7txm6Ve6O FnyM8ixvXJN+QktESn6i727ZgGQMJweLfMPcR/NC0EG5hhcuRQm2QXKuRmgYwoMIi0KE ra++u4/dTMx0cM52tK78GXbZvrrbp7aKUMxhN3DMGoWr06Em9LwkSiRzMCFq9XjSX9aM +C9ScEIQmVuhcvoHRYtr23PvVo5zScfXQvRscax8tJfTHvu1x6TuM0gok8jc81SkcYqH ht4ZiSnrvdf7FHUEeX+P++5sI1nq9xmKLfGZSvL9xStzeAlysYwKHVepEW3XecFq5F25 v8Zg== X-Forwarded-Encrypted: i=1; AJvYcCVNUjz34cfFO3MUWCO+rgutx7xAot3EUdUOXsnSjHCGZDbLGqS1M/f489XUNW00vW3E5z72wt/yJN3ZAGrRm52c9EahkMlIt7cj2EF8 X-Gm-Message-State: AOJu0YxjkHs13EBg9etT+8hB6JsCCH6e8gasfoQpsZEs3mxWNVeGgS75 +mtBRoMn5xQOrJY7mYmnMJkuw6V245TZxEKxDUju0z1oxT1/Cu4m X-Received: by 2002:a0d:dc02:0:b0:5e7:c9de:1ae3 with SMTP id f2-20020a0ddc02000000b005e7c9de1ae3mr9138446ywe.47.1707842960252; Tue, 13 Feb 2024 08:49:20 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWOff7WoZ/roOHHvN9ZmrHw/Rq2x32q1uEL1gcusjU1Pn0rrDwwiiswFOqXrMxByux22sn3gZRR7kKstU+a47bo91B1e1Z8j/2h5MUsvNtvf+r32RnHn8k3uZteAnWh3ElJplWHSJ9GAMu51bGsv43YzQsdyGA= Received: from costa-tp.redhat.com ([2a00:a040:1a4:9a9f:19ad:6a8:f94b:c9c]) by smtp.gmail.com with ESMTPSA id u186-20020a0dd2c3000000b00604a3e9c407sm1814332ywd.41.2024.02.13.08.49.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 08:49:19 -0800 (PST) From: Costa Shulyupin To: Thomas Gleixner , linux-kernel@vger.kernel.org Cc: Costa Shulyupin , Waiman Long , Frederic Weisbecker Subject: [PATCH v2] hrtimer: select housekeeping CPU during migration Date: Tue, 13 Feb 2024 18:46:51 +0200 Message-ID: <20240213164650.2935909-3-costa.shul@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240211135213.2518068-1-costa.shul@redhat.com> References: <20240211135213.2518068-1-costa.shul@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: 8bit 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 Signed-off-by: Costa Shulyupin Reviewed-by: Waiman Long Reviewed-by: Frederic Weisbecker --- Changes in v2: - [v1] https://lore.kernel.org/all/20240211135213.2518068-1-costa.shul@redhat.com/ - reworded and rebased on linux-next --- kernel/time/hrtimer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index edb0f821dcea..947bd6cf7105 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c @@ -2224,7 +2224,7 @@ static void migrate_hrtimer_list(struct hrtimer_clock_base *old_base, int hrtimers_cpu_dying(unsigned int dying_cpu) { struct hrtimer_cpu_base *old_base, *new_base; - int i, ncpu = cpumask_first(cpu_active_mask); + int i, ncpu = cpumask_any_and(cpu_active_mask, housekeeping(HK_TYPE_TIMER)); tick_cancel_sched_timer(dying_cpu); -- 2.43.0