Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp906223lqh; Fri, 29 Mar 2024 00:02:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXTKnQPT6HY0uc5TpogkF+m8z8pNI1ibwMdfQ1Oy2lq1K6RF56/zfG1/m5GPy1afYZtWCi/IZhw/eh4fLe3RzyvTRUngI5iP6uhKAISPQ== X-Google-Smtp-Source: AGHT+IH0yCo7C3ObUVJ/OHIrodpv0+ZAvfcZ0yD6XP5UTsN3SnvZe9vosi/YnsJQaGZzezJ2b6A2 X-Received: by 2002:a05:6e02:20c5:b0:368:98c2:fcaf with SMTP id 5-20020a056e0220c500b0036898c2fcafmr1307033ilq.0.1711695732915; Fri, 29 Mar 2024 00:02:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711695732; cv=pass; d=google.com; s=arc-20160816; b=TrxnNLiSz2tAu000Msu2q3FpVEGodvRxz8+C0Lpxzs77BjXptB8G9RyuZaIrRJfV0e GZ0ZKsMaaJRkwmiEocs/nx8kik8hwUQczCR7CsZXOlPtacXq+zd56yG44F7CJDUScGYM jVmMO0vjYyRfcnUtX0MA59tMQalt9/p8TQsvi5ij7snMNyt1GvwXw/yHdjXANa8FRRTL hLzEztxUnMrww8IOLIg7VjCeRMZaGjav9N4lzSqldcgnh831ejwz+MRl5nzUmsSxvOpn U2Z3rGKfFRbT45/u1jsYGmXPpAa5kOZrUdRhFR+ZQYyeCiFTTQPS9Cwdmxik6Glf6Iwy gpFg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:sender:dkim-signature; bh=KpYQ/V/QalATcuCFjtKzuSngXyEFzjLdj1ISHAQ06Dg=; fh=dtusfvpD1rzOH0ZCKQB+cOCsSidfHGMiXlvE152rgyY=; b=Lzb+QcUkYGCAXiVxpWwcps/bKpb6WWTZLNrrx6Rv1zdsJxo5yqZbXnpZmKhlvLP1sQ mby8TF1P5YA9Fg7Q6IMYcU1zQDlsshskRekvVIUSBE7jKOWAeBooD7sl5zyNwVxXt4Rw EFbLqw78BDnSMGtIUuL3HshyG5vE1rJrGMawW3t57U9gCEKmwg4wlwQsVCu/Hmamko+L sM+tI4HJcvNFUmzPorZjilQJYeUq21ZVsTrS5lH8bi1QkNOVK7XRbFzO4UieJO4KC0uR d5D1ScaYJURCy/GKX65LKC2PYcnAhbz7IwJcPvjd//SAIh/giEg6d44X78yNyMGUMPAt c7CQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=E1WUMfvK; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-124220-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-124220-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id a7-20020a63e407000000b005cee03a1bf9si2988244pgi.448.2024.03.29.00.02.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 00:02:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-124220-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=E1WUMfvK; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-124220-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-124220-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 944F1289E22 for ; Fri, 29 Mar 2024 07:02:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1FD8F3E46D; Fri, 29 Mar 2024 07:02:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="E1WUMfvK" Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) (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 980523D0BD for ; Fri, 29 Mar 2024 07:02:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711695726; cv=none; b=r5GhD6YMJaMRWQ/DooxAqcpHh3IMOA/mDGGwd8IVWE2ANvQ5LhKEsla1l6npsarauHcdThVuUoEOQ5tNEvQV6nsAdUlTuCL0SOZtLcnGTp9lNqcN2P9ZIQJe7z/ZIbKgxPHQcEJzrqdje/UAuJWlLQX6W7IoAEEPmVlk4pgTkEY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711695726; c=relaxed/simple; bh=/T85BMWOBGyInSmentYuXLN5Xgh5VjFRGium8m9HyVg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ugTMT3Yda/ZDYcZbSjYWiX2E5CWjluI6/qWBnW3SqXfFJofwDCwmS8AAXzfSro8am9y5kEYzgq0EZC3ItC3q8IWNLyS4Si+ZilyNxEeSsTkPrcMfFHXAVc43ib4nxG1qzk/tcj+WU+5dCAtga7mcfHmKC2g+jwZnXylYT2j1Hso= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=E1WUMfvK; arc=none smtp.client-ip=209.85.208.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-56845954ffeso2482393a12.2 for ; Fri, 29 Mar 2024 00:02:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711695723; x=1712300523; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=KpYQ/V/QalATcuCFjtKzuSngXyEFzjLdj1ISHAQ06Dg=; b=E1WUMfvKse1+bzyci6xWQjg4zWx2OxIlMG6p2BueQsGxiLxAHwV2r8ZNO6A8oHA/RB jeZeQ1neBDL84YwC/cqXkVLQdlI0rIbAmteBmPvpKz33qTI3U7jAxzQK3FDdZEjP6Qlh owoXXyNWn7W4AO/38Ui3YibTyW1HeNbliOzVoOeISdLCt5cUXuAztupscNSMRW0uwvdZ cp8fr+wOe4r08sZ9OedQ/JSTmlcpYosUuBRACk1bxrYmTeObQ4h1Q3tLenX0GhmLhzDo bddIKq7wbldHN30hEZITL7WS8roHDJKxFdfRx0Hx2h0W5r9cqs+4gDul1yNJgi1TlJSL tAOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711695723; x=1712300523; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KpYQ/V/QalATcuCFjtKzuSngXyEFzjLdj1ISHAQ06Dg=; b=r051J8Us2N8kEVipFLpby5gHt6Grgr24GwmSiSlflrEx0bkEgfud59fHYSIyY4YPtR l9hihw0hOlcyUiKhvYe3SkRIpYDrbdKl9eM1l5/hUWl3mWvN4f02r5ISuEzQR4X+GA5I s31MqcmIO8CNMqyh8z0co6xFRvNkeSB8f42V2t6F4nU/CGuxguhlEqpBXeP3gLn5onpG Ce9oT/Si6JYWGjh4jAsMOUEm0OCQvsCLnpQu6Phjb0/1lWDGu+b+2aNTktpcgk6jI27G VB4RQxSvqwzmtvxPhP4YGSPYh55cpfGBPL4jeBA0fu2ZWvYGYXS/vAgM/MENUj3MhJEh xSbg== X-Forwarded-Encrypted: i=1; AJvYcCXH5CnWr2qsU9tM8e1gyBjVk2XK3XDIcMePjEmKJ0Wz6bzTsAfgphUDJcyUyOegNL8ryvldGoedWAMbCx5UgKVXo1GseVP5HQwOxpZN X-Gm-Message-State: AOJu0YwKaDMSymk0t+ZciGn/7sK6vcxOy5ypdd91PzsfCahDW65xL1Nu 59nWqBPRRgkw9/137MzNe1Wc/at5vREd5lQCf4I2igybt0ztXHfs X-Received: by 2002:a17:906:27c4:b0:a4e:2e14:f75e with SMTP id k4-20020a17090627c400b00a4e2e14f75emr689600ejc.77.1711695722438; Fri, 29 Mar 2024 00:02:02 -0700 (PDT) Received: from gmail.com (195-38-112-2.pool.digikabel.hu. [195.38.112.2]) by smtp.gmail.com with ESMTPSA id z4-20020a170906714400b00a469e55767dsm1590838ejj.214.2024.03.29.00.02.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 00:02:01 -0700 (PDT) Sender: Ingo Molnar Date: Fri, 29 Mar 2024 08:01:58 +0100 From: Ingo Molnar To: Reinette Chatre Cc: fenghua.yu@intel.com, bp@alien8.de, james.morse@arm.com, tony.luck@intel.com, peternewman@google.com, babu.moger@amd.com, tglx@linutronix.de, mingo@redhat.com, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, james.greenhalgh@arm.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] x86/resctrl: Fix uninitialized memory read when last CPU of domain goes offline Message-ID: References: <979cfd9522021aa6001f8995cd36fb56e1c9cd39.1711659804.git.reinette.chatre@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <979cfd9522021aa6001f8995cd36fb56e1c9cd39.1711659804.git.reinette.chatre@intel.com> * Reinette Chatre wrote: > diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h > index c99f26ebe7a6..4f9ef35626a7 100644 > --- a/arch/x86/kernel/cpu/resctrl/internal.h > +++ b/arch/x86/kernel/cpu/resctrl/internal.h > @@ -85,6 +85,10 @@ cpumask_any_housekeeping(const struct cpumask *mask, int exclude_cpu) > if (cpu < nr_cpu_ids && !tick_nohz_full_cpu(cpu)) > return cpu; > > + /* Only continue if tick_nohz_full_mask has been initialized. */ > + if (!tick_nohz_full_enabled()) > + return cpu; > + So we already have this a few lines up: if (!IS_ENABLED(CONFIG_NO_HZ_FULL)) return cpu; And we can combine the two checks into a single one, with the patch below, right? Untested. Thanks, Ingo ==============> Signed-off-by: Ingo Molnar arch/x86/kernel/cpu/resctrl/internal.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index c99f26ebe7a6..1a8687f8073a 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -78,7 +78,8 @@ cpumask_any_housekeeping(const struct cpumask *mask, int exclude_cpu) else cpu = cpumask_any_but(mask, exclude_cpu); - if (!IS_ENABLED(CONFIG_NO_HZ_FULL)) + /* Only continue if tick_nohz_full_mask has been initialized. */ + if (!tick_nohz_full_enabled()) return cpu; /* If the CPU picked isn't marked nohz_full nothing more needs doing. */