Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp566857ybz; Fri, 24 Apr 2020 05:33:58 -0700 (PDT) X-Google-Smtp-Source: APiQypJ+6YAXwLnc9wvuPYyEJGN9byNTAqgH9DpleGjYtZ01C/GduCgZBjoJpLlOuPmeeHly+Hbj X-Received: by 2002:a50:951c:: with SMTP id u28mr6710428eda.310.1587731638446; Fri, 24 Apr 2020 05:33:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587731638; cv=none; d=google.com; s=arc-20160816; b=n9rC1spKbqQ3BY+B5cgbIMG4xAuyCODBr1qjAB35JEzyxF78uus1sC3uq9nvvmrSZ9 y0xyT3YXTxBAZ9cQjuznRalye7CVsnxzMPyuI/6a/kNg+wavsnjj7nzr95CXvQoocloD Kc7NWHPXI6RDoLdLZ5MvIYljTX+KlVOgYHdE3gZHq8FBKoMXFeitKEeWPVSrn3o4imDM aBM2ITwgM9hd7KLPccRjOo8ajiS2FV9UxbQIEjgNdJfb30M5CzXtujWyBRgkzWT9YzXD 4XvVH9Sk9No5Uk1v619Sj6h1Lq534nM62E+aqzng4YIWJvdTal/CBbgxGenFGN49wvbj IpSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=nmyzgw+Wi/lCXCvAV8cmPTSPZTkBucUv1CCrj7p78Lw=; b=jWYjIqBZWh1keG99R+vtY75BinJS4oemDKTmCTgFWejZ3iLZjtI4tKvSaKNAkQ0/BW 45rdASApLcYxEfHT93o2O4BzLkx1dktW0TmCdCdgyv3TEOseTSJx+JJRc4V8xRwHpVXQ Zm36idzvdtRFj0EUiL6YEG0XcOiKPxZ6ueEPlc4ImulRVIUWGj2TCpz/BJn0xfQjUVxy 9rAzfgz0FzRh1+Kg+1dQ9VR6LSuOON7wnvT1hwwAnOTFlG+yLRiuy0woS8N/zkWQLJnG z4LyoBzGihjb+Bt/0UG9eDK8rsuaQZnclkV6oYLOM5iICk+5548tl1np80oSezRdY76r ghHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=grzgqEbk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dm18si2812070edb.264.2020.04.24.05.33.34; Fri, 24 Apr 2020 05:33:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=grzgqEbk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728659AbgDXMbt (ORCPT + 99 others); Fri, 24 Apr 2020 08:31:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:52592 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727809AbgDXMXI (ORCPT ); Fri, 24 Apr 2020 08:23:08 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 03F2B21473; Fri, 24 Apr 2020 12:23:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587730987; bh=XJaNe5pXks9bL5KapSdiW5O2hhPV6fdgJmwFmiAry0E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=grzgqEbkD4qmlzYjJ/1Siw0m+3GIz0Fyk/lByfuOyEJ5h7CQEsN4slQhJrMdZy3eH ROb2nX2UJD37KyMR3CR3h6Gn70VKdBX8LL2EiwYym9XiD0CaHCURV2Ds4l1978nFlD hMgUJzlAc+ow1Fz5tlW7Jbx+UJ7u8JgmDsKU2xEY= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Peter Xu , Thomas Gleixner , Sasha Levin Subject: [PATCH AUTOSEL 5.6 26/38] sched/isolation: Allow "isolcpus=" to skip unknown sub-parameters Date: Fri, 24 Apr 2020 08:22:24 -0400 Message-Id: <20200424122237.9831-26-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200424122237.9831-1-sashal@kernel.org> References: <20200424122237.9831-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peter Xu [ Upstream commit 3662daf023500dc084fa3b96f68a6f46179ddc73 ] The "isolcpus=" parameter allows sub-parameters before the cpulist is specified, and if the parser detects an unknown sub-parameters the whole parameter will be ignored. This design is incompatible with itself when new sub-parameters are added. An older kernel will not recognize the new sub-parameter and will invalidate the whole parameter so the CPU isolation will not take effect. It emits a warning: isolcpus: Error, unknown flag The better and compatible way is to allow "isolcpus=" to skip unknown sub-parameters, so that even if new sub-parameters are added an older kernel will still be able to behave as usual even if with the new sub-parameter specified on the command line. Ideally this should have been there when the first sub-parameter for "isolcpus=" was introduced. Suggested-by: Thomas Gleixner Signed-off-by: Peter Xu Signed-off-by: Thomas Gleixner Link: https://lkml.kernel.org/r/20200403223517.406353-1-peterx@redhat.com Signed-off-by: Sasha Levin --- kernel/sched/isolation.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c index 008d6ac2342b7..808244f3ddd98 100644 --- a/kernel/sched/isolation.c +++ b/kernel/sched/isolation.c @@ -149,6 +149,9 @@ __setup("nohz_full=", housekeeping_nohz_full_setup); static int __init housekeeping_isolcpus_setup(char *str) { unsigned int flags = 0; + bool illegal = false; + char *par; + int len; while (isalpha(*str)) { if (!strncmp(str, "nohz,", 5)) { @@ -169,8 +172,22 @@ static int __init housekeeping_isolcpus_setup(char *str) continue; } - pr_warn("isolcpus: Error, unknown flag\n"); - return 0; + /* + * Skip unknown sub-parameter and validate that it is not + * containing an invalid character. + */ + for (par = str, len = 0; *str && *str != ','; str++, len++) { + if (!isalpha(*str) && *str != '_') + illegal = true; + } + + if (illegal) { + pr_warn("isolcpus: Invalid flag %.*s\n", len, par); + return 0; + } + + pr_info("isolcpus: Skipped unknown flag %.*s\n", len, par); + str++; } /* Default behaviour for isolcpus without flags */ -- 2.20.1