Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp52144pxy; Tue, 20 Apr 2021 20:16:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSIyyA2ggKV8QaCsy7aTRLp6lUtI/WuEb2d41flntW3Mq27XBVLVFdisfAtKxhGpy9UXQT X-Received: by 2002:a63:4423:: with SMTP id r35mr20559210pga.13.1618974980307; Tue, 20 Apr 2021 20:16:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618974980; cv=none; d=google.com; s=arc-20160816; b=u6UyOKLl3WdI2eARa5O3n6VjE1FA9WMm3sVD40n4obX6dW+WDEBYvUOsS4JL/c69W0 VmD1zjdp8Vsrzt6I44zpGeZXdEp0kEHyB2OOeJYJD9QS7DAbSyqxMZ12ZmTmvbFgAuzi KdkVfecmJWKO0DH29MHQfAcjIqwaDh0K7hGiHhc9lBOXU2gZt/ALSaw7KFQhDJvvCWA1 1C5nV0hbz9aQBpoT0vtBf7HMUUyhiQfkgQepGhzPh3684NpYZwlu8m7TNUeogjNgW4Vx YcR9ohKYEd70O8Oxiz6nDWb08Mhogf0ngct2JYwkQjx1+uzTFEh7ppr/FVDaOZPW8rkG NnMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=fUnGKH/ZPQskGhid4V66jzQYmJVwxxXo93yIoVD9gfY=; b=SJFTk5xHyQbvWG02UekEdPZlZ+/Qop0afNzu2sQ59a6HNDpRcKv/ai6UB38Yr2GseK PEWqH4q7zW0jhhY9WSUqdZuMyyFRzx5DBldDeVRZUeobY1SQAVTFOgfy6+3eWqsUdBIx r9pNDxtztfF/iG+HUiqZTu9EymPZg/JpJeadfdB/v4SqZhcHtKkB2NN7fJucgXv41eEU 9dEVDVuhEaVfC0lmT3PxE+c0hfvXBxzxhf0c+IT9rexc+YHVDk7jhbdyZlGkgLdyvMOV lSbK6n5I/FQCwuIfpAptCT7BpUVObpA393xco5MOjzJmBjPEaddDuJoo58PGOCGcNXy0 EQgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Q3ljRnUL; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ca13si1087680pjb.148.2021.04.20.20.16.08; Tue, 20 Apr 2021 20:16:20 -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=@gmail.com header.s=20161025 header.b=Q3ljRnUL; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234739AbhDUDOF (ORCPT + 99 others); Tue, 20 Apr 2021 23:14:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233974AbhDUDOE (ORCPT ); Tue, 20 Apr 2021 23:14:04 -0400 Received: from mail-qt1-x829.google.com (mail-qt1-x829.google.com [IPv6:2607:f8b0:4864:20::829]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA85CC06138A; Tue, 20 Apr 2021 20:13:31 -0700 (PDT) Received: by mail-qt1-x829.google.com with SMTP id d6so12044735qtx.13; Tue, 20 Apr 2021 20:13:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fUnGKH/ZPQskGhid4V66jzQYmJVwxxXo93yIoVD9gfY=; b=Q3ljRnULwU+Y8mXeICsiUAwjkmhXss9PUwaVa6W+/xilYoh2YqF/thDOsUSijQ1QSO Mq3BnKuqtKqHdiafaMf+SimSFhOiYK4er1OhQTcAXw4lDOSUyQUB9OqzRGj8Lu6BbW3d uxbNjxDgi78Ub1GVU90N2UC+1ySiek2xwH2weTvRp+ptx1RstMK+W0tMc7m4ypicCngb nFfw9uqz1jm3j8n3UZJry47D2Y0uucfJfzsctingHKM8Lba/SucyxlOF9BPSk0APur8G dCFRQnIeN5sfKcwX4HJgfoZprPwYGAHpDqonct9Tr7nU57WauYPIlncalfCzRnc2oeV0 8DgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fUnGKH/ZPQskGhid4V66jzQYmJVwxxXo93yIoVD9gfY=; b=VtZwq8VymTN+m6/qOuXpc75FScoyJ1zDaF+nzr5u3FRM1na7dOZtcWl+5ipKit1dz0 iHIlkuWcq63lx8UMcn5ycIHzf6CyWXTaxkh3uT3vOy/ZSRZE33I6/F1guo7//ppxZ4NX qGxP72a+Fg4ly9iGEKUkNC0Ngx7KHlbOkqjxR+HhBnO7WzWM7s4ZJIWHy3nLH0fMUexQ FxGwqHSpaUHhVcgDeXwL3lF1mD71V2sPd8B52TpTuDedSdf0L72o2Zdw/Tl2wJ1wQsLK oiHA8A9bNL4pMVJvfoTzABcV9hblc4KAMSYfeDzPvooAlU7uYrt1wMx4fRf8P+6pJHNl drEQ== X-Gm-Message-State: AOAM532nRCqd6uXyIXR0aNKXTSMrv0ErDxUPEAdkvpAka9X16Rg42ZRd lVYMEVhWzErZeG7PoH7hGCi6fTga5dg= X-Received: by 2002:a05:622a:6:: with SMTP id x6mr19737161qtw.1.1618974810624; Tue, 20 Apr 2021 20:13:30 -0700 (PDT) Received: from localhost ([207.98.216.60]) by smtp.gmail.com with ESMTPSA id c5sm982652qkl.7.2021.04.20.20.13.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Apr 2021 20:13:30 -0700 (PDT) From: Yury Norov To: linux-kernel@vger.kernel.org, rcu@vger.kernel.org, linux-doc@vger.kernel.org, Andrew Morton , "Paul E. McKenney" Cc: Yury Norov , Andy Shevchenko , Joel Fernandes , Jonathan Corbet , Lai Jiangshan , Mathieu Desnoyers , Palmer Dabbelt , Paul Gortmaker , Randy Dunlap , Rasmus Villemoes , Steven Rostedt Subject: [PATCH 1/2] bitmap_parse: support 'all' semantics Date: Tue, 20 Apr 2021 20:13:25 -0700 Message-Id: <20210421031326.72816-2-yury.norov@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210421031326.72816-1-yury.norov@gmail.com> References: <20210421031326.72816-1-yury.norov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org RCU code supports an 'all' group as a special case when parsing rcu_nocbs parameter. This patch moves the 'all' support to the core bitmap_parse code, so that all bitmap users can enjoy this extension. Moving 'all' parsing to a bitmap_parse level, also allows users to pass patterns together with 'all' in regular group:pattern format Reviewed-by: Andy Shevchenko Signed-off-by: Yury Norov --- Documentation/admin-guide/kernel-parameters.rst | 5 +++++ lib/bitmap.c | 9 +++++++++ lib/test_bitmap.c | 7 +++++++ 3 files changed, 21 insertions(+) diff --git a/Documentation/admin-guide/kernel-parameters.rst b/Documentation/admin-guide/kernel-parameters.rst index 3996b54158bf..7178d9c4de7f 100644 --- a/Documentation/admin-guide/kernel-parameters.rst +++ b/Documentation/admin-guide/kernel-parameters.rst @@ -76,6 +76,11 @@ to change, such as less cores in the CPU list, then N and any ranges using N will also change. Use the same on a small 4 core system, and "16-N" becomes "16-3" and now the same boot input will be flagged as invalid (start > end). +The special case-tolerant group name "all" has a meaning of selecting all CPUs, +such that "isolcpus=all" is the equivalent of "isolcpus=0-N". + +The semantics of "N" and "all" is supported on a level of bitmaps and holds for +all users of bitmap_parse(). This document may not be entirely up to date and comprehensive. The command "modinfo -p ${modulename}" shows a current list of all parameters of a loadable diff --git a/lib/bitmap.c b/lib/bitmap.c index 74ceb02f45e3..6e29b2aae6ba 100644 --- a/lib/bitmap.c +++ b/lib/bitmap.c @@ -581,6 +581,14 @@ static const char *bitmap_parse_region(const char *str, struct region *r) { unsigned int lastbit = r->nbits - 1; + if (!strncasecmp(str, "all", 3)) { + r->start = 0; + r->end = lastbit; + str += 3; + + goto check_pattern; + } + str = bitmap_getnum(str, &r->start, lastbit); if (IS_ERR(str)) return str; @@ -595,6 +603,7 @@ static const char *bitmap_parse_region(const char *str, struct region *r) if (IS_ERR(str)) return str; +check_pattern: if (end_of_region(*str)) goto no_pattern; diff --git a/lib/test_bitmap.c b/lib/test_bitmap.c index 9cd575583180..4ea73f5aed41 100644 --- a/lib/test_bitmap.c +++ b/lib/test_bitmap.c @@ -366,6 +366,13 @@ static const struct test_bitmap_parselist parselist_tests[] __initconst = { {0, "0-31:1/3,1-31:1/3,2-31:1/3", &exp1[8 * step], 32, 0}, {0, "1-10:8/12,8-31:24/29,0-31:0/3", &exp1[9 * step], 32, 0}, + {0, "all", &exp1[8 * step], 32, 0}, + {0, "0, 1, all, ", &exp1[8 * step], 32, 0}, + {0, "all:1/2", &exp1[4 * step], 32, 0}, + {0, "ALL:1/2", &exp1[4 * step], 32, 0}, + {-EINVAL, "al", NULL, 8, 0}, + {-EINVAL, "alll", NULL, 8, 0}, + {-EINVAL, "-1", NULL, 8, 0}, {-EINVAL, "-0", NULL, 8, 0}, {-EINVAL, "10-1", NULL, 8, 0}, -- 2.25.1