Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp70309lqt; Thu, 18 Apr 2024 08:41:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWYPJdajHtgl65THDQT7zeNCNmUaDs8hMXMDdYDm+bGDcqr/tjfkXPTDuLy672ebMawfemA+ahm3Z1hYRNWiKEXkiyImll4kUE3dXLvqQ== X-Google-Smtp-Source: AGHT+IGXGX4WxGay3cj5wce+g6wYGlJV9a1YdiZ0U2XMQqHjRdPj81mxpIxr5xX0Y6jubdu+8P1b X-Received: by 2002:a17:906:1dc8:b0:a52:55f5:aba5 with SMTP id v8-20020a1709061dc800b00a5255f5aba5mr2073144ejh.2.1713454867729; Thu, 18 Apr 2024 08:41:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713454867; cv=pass; d=google.com; s=arc-20160816; b=sq9qF5AOr9dSUcY4p9W6d3o1WkW5eitiLPOWxc1BnaHFLLtN/3XH6HEdQMovkeT+K9 ttsAkW/sy0A9eaYoqbK9yB/3C0NUL5jgm85+eNyCdfzRLKcX2ErKnK5v98L2eRMsO4oK lmE+2IjNSKVgMxwhoiNrncUf1rjrZNxrTcb4vW+aRw/x+leNPX6vjknlE7XSMX9ys/VM FGVsmyCebYQNZm066L6cHDf1Hr1EEGmNLamNc26xBB+q+HxzL92cMgZATpaisBLpDeR7 7QYJOAEkC42T2Fo+n7rK/LgjVHRM0CDcKLnZDCXvX1MrrOpLNWcT3JQLeVRnjnU8i1sb Z2Iw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ExOBgmV/qZI2IWOhoUpjffN1iQfc8B/ZsWxZ3lYrxnU=; fh=+xbBfZzfQ2dxivXPB50036783qQwkH8CTRdxd0/nsGc=; b=jWb9OARlGlcUPbENSze+XgdVvBq6EXhO7lkXXVm/9/+1j+Oh1tXmjsWPSs5BGhW/SQ 7y19tpv3VsE9YJZOp6P3sIA1jwqJsLYFplQ+JcuBulWPgso4HdFix7TEzUzzSHBgCch7 Ws+sOF7XK7cIqv0EGdwWjgPqLGiAKIOCr93RMKmZuEARKykWo714YVAXNmvu+FF/YhdL LIdeokastJLLQ6u1SaaNiIAg716Tz90iEfyE8XV+h6jWRR4hpLg+bqOAR0fOePu7rnDR sTS3pwF6ejf0kbyvWu34LymgU4W0jBzXa5Goqa8rNEcRzocXKdb6iZG3BUTfkrXLG9ck jGAA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qXIpS5dE; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-150414-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-150414-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id i27-20020a1709063c5b00b00a51da2a1169si1008546ejg.706.2024.04.18.08.41.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Apr 2024 08:41:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-150414-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qXIpS5dE; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-150414-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-150414-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 715C61F226CF for ; Thu, 18 Apr 2024 15:41:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3CD2B16E876; Thu, 18 Apr 2024 15:40:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qXIpS5dE" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 6548F165FD9 for ; Thu, 18 Apr 2024 15:40:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713454846; cv=none; b=uEa7CxkqXT3Q5dk3W7qTYXKXah8g57VEeRIQk4Aa/9MYK8KlApFCRXItDfZHxwIvBPLIAW1WXr28oRPev8Bv+IpBMLyw5jAbGZzs/FQfCVIyVhQr7uInm7adUdefyX2FVTIvACK6kCBRU0Yf5sKenPhNgdTheNeCFFMc7z2PYgA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713454846; c=relaxed/simple; bh=AtyV0iVTtcQ/CYk8/4oTzQreCUZEygEjlALQ+qjF7hs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=lAYMdi8BrdHDfEr05Prju2iXrGN7yTaAIhZX9Qr4qwgH29EoPUg8xS0CwUsGbujGERDTsstYmaKGMO6DvrPwLxHLmBiS5nXJSSyfvW598jUYOtJ0gVBm2/++K5QTLHhvXyH22ouF6U0uNM5LSUSlWgdHqIPufrNcu5oZoVfflbI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qXIpS5dE; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1C0EC113CC; Thu, 18 Apr 2024 15:40:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713454846; bh=AtyV0iVTtcQ/CYk8/4oTzQreCUZEygEjlALQ+qjF7hs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=qXIpS5dEMN4TnQoMStFbRplmXfetbCaS0l6jSGMblRZUes3E498ZUGd902+rIrc+r mMsdbTl4ACP8A889pV0X8vs5CtO4rfith2wpSF+V+khbHwEjizVON9p8ZM4tg7ERRI mg/NCi+MAJoaWHuhy98K9jOVp0Yh8UuMUYZRshimnJWKp1COOo9IMOJAPWeDBdey1k c8Xr3GpTvaZMnaA491xJEML556xl6DNlTI+ubaUo3ooEAmxA3eDaR114yrXDp8cN4G hcDaSwYnZhDxjyZ4t34DC3RRILRfYlg2mh78l6atZILUGxc9tQUNMm5NHwYFF6DOnK 7R5dqYMY1nJnQ== Date: Thu, 18 Apr 2024 17:40:43 +0200 From: Frederic Weisbecker To: Oleg Nesterov Cc: Nicholas Piggin , Leonardo Bras , Thomas Gleixner , Peter Zijlstra , Ingo Molnar , Tejun Heo , Lai Jiangshan , linux-kernel@vger.kernel.org, Junyao Zhao , Chris von Recklinghausen Subject: Re: [PATCH] sched/isolation: fix boot crash when maxcpus < first-housekeeping-cpu Message-ID: References: <20240130010046.2730139-2-leobras@redhat.com> <20240402105847.GA24832@redhat.com> <20240411143905.GA19288@redhat.com> <20240413141746.GA10008@redhat.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=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240413141746.GA10008@redhat.com> Le Sat, Apr 13, 2024 at 04:17:46PM +0200, Oleg Nesterov a ?crit : > housekeeping_setup() checks cpumask_intersects(present, online) to ensure > that the kernel will have at least one housekeeping CPU after smp_init(), > but this doesn't work if the maxcpus= kernel parameter limits the number > of processors available after bootup. > > For example, the kernel with "maxcpus=2 nohz_full=0-2" parameters crashes > at boot time on my virtual machine with 4 CPUs. > > Change housekeeping_setup() to use cpumask_first_and() and check that the > returned cpu number is valid and less than setup_max_cpus. > > Another corner case is "nohz_full=0" on a machine with a single CPU or > with the maxcpus=1 kernel argument. In this case non_housekeeping_mask > is empty and IIUC tick_nohz_full_setup() makes no sense. And indeed, the > kernel hits the WARN_ON(tick_nohz_full_running) in tick_sched_do_timer(). > > And how should the kernel interpret the "nohz_full=" parameter? I think > it should be silently ignored, but currently cpulist_parse() happily > returns the empty cpumask and this leads to the same problem. > > Change housekeeping_setup() to check cpumask_empty(non_housekeeping_mask) > and do nothing in this case. > > Signed-off-by: Oleg Nesterov Acked-by: Frederic Weisbecker