From patchwork Wed Nov 6 18:57:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Henrique Cerri X-Patchwork-Id: 1190622 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 477bQD3Nxwz9sPF; Thu, 7 Nov 2019 05:57:56 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1iSQV6-0001kX-Kb; Wed, 06 Nov 2019 18:57:52 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1iSQV4-0001kG-1K for kernel-team@lists.ubuntu.com; Wed, 06 Nov 2019 18:57:50 +0000 Received: from mail-qk1-f200.google.com ([209.85.222.200]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1iSQV3-00040r-Ph for kernel-team@lists.ubuntu.com; Wed, 06 Nov 2019 18:57:49 +0000 Received: by mail-qk1-f200.google.com with SMTP id a16so14271801qka.10 for ; Wed, 06 Nov 2019 10:57:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=plkTGjeidqFObmpotPOBOibAbdm6w4gUq3LbEoHjd0I=; b=h47eAys3+wumd9QcQ2sru30o4YQeO3UCLBCUYzRDBYnJNjq5/j//J7PTpJa8cANQ/t q093Bfu4Fg5cAOhL/Ekh2FXmM0x/IrfH45U2hhFBG4JbtfMJ+KvtQiRRVvT920v1MDea IfCzgf3Iwya7EumSjFc0FRnKoMo9ap2z/7rM9jUB3Nr2HYa0dVKc6VdQA23eebNSb1bo sz5f+bW4qwj1dVwaqC7EJk0JufRaxn8vHZqH5qGS4VwNWk4Zhl/WMQ9BCt+F67p/btPc bEIVb4tPTcyzzs5dwfFomuyoVQ3bSUi3TpL9pN2TrEMPeRPTMRRWX7qW7VRrblxwCJ6W lObA== X-Gm-Message-State: APjAAAWiqUXvTT3kK+9HsVujvAnUf0BAKDXimkJSzhPqRd13jQ+r2kAU mqGPip7xZrmeyQ6kQawuCANyCC0u68u+KU/dz0bRcuBeXbskyKjinsvzjwwFqDHxkragvWQtHLt ReSu4n9UDAA6ScoYi7R04E9QzmOq6qmGC3zxc9N7C X-Received: by 2002:ac8:6d31:: with SMTP id r17mr3943803qtu.28.1573066668442; Wed, 06 Nov 2019 10:57:48 -0800 (PST) X-Google-Smtp-Source: APXvYqxhC0ygnJqpCoHSGQuh+cIdI8s5kMiYBqMCTTI7/RO85isGJi4z/OrNrhFLFtEhkyqiAeN4uQ== X-Received: by 2002:ac8:6d31:: with SMTP id r17mr3943781qtu.28.1573066668139; Wed, 06 Nov 2019 10:57:48 -0800 (PST) Received: from gallifrey.lan ([2804:14c:4e6:443:946b:525b:cf5:2c60]) by smtp.gmail.com with ESMTPSA id s21sm6478841qkg.24.2019.11.06.10.57.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Nov 2019 10:57:47 -0800 (PST) From: Marcelo Henrique Cerri To: kernel-team@lists.ubuntu.com Subject: [eoan:linux-gcp][PATCH 1/2] UBUNTU: SAUCE: raid6: Add option for default PQ algorithm Date: Wed, 6 Nov 2019 15:57:38 -0300 Message-Id: <20191106185742.5835-2-marcelo.cerri@canonical.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191106185742.5835-1-marcelo.cerri@canonical.com> References: <20191106185742.5835-1-marcelo.cerri@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" BugLink: https://bugs.launchpad.net/bugs/1812728 BugLink: https://bugs.launchpad.net/bugs/1851538 Add a new config ("CONFIG_RAID6_PQ_DEFAULT_ALG_BOOL") to enable specifying a default gen() algorithm for RAID_PQ via the kernel "raid6_pq_default_alg" cmdline option. When a default algorithm is given, the raid6_pq module will skip the performance round of tests. The config CONFIG_RAID6_PQ_DEFAULT_ALG can be used to define a default value for the kernel option. Signed-off-by: Marcelo Henrique Cerri --- lib/Kconfig | 17 +++++++++++++++++ lib/raid6/algos.c | 26 ++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/lib/Kconfig b/lib/Kconfig index 4e6b1c3e4c98..dae35c80dfda 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -19,6 +19,23 @@ config RAID6_PQ_BENCHMARK Benchmark all available RAID6 PQ functions on init and choose the fastest one. +config RAID6_PQ_DEFAULT_ALG_BOOL + bool "Default RAID6 PQ algorithm" + default n + depends on RAID6_PQ + help + Allow for specifying a default algorithm via the kernel + parameter "raid6_pq_default_alg", which forces the performance + tests to be skipped. This can save between 500ms to 2s + during boot. + +config RAID6_PQ_DEFAULT_ALG + string "Default RAID6 PQ algorithm name" + default "" + depends on RAID6_PQ_DEFAULT_ALG_BOOL + help + The default algorithm name to be used by default. + config PACKING bool "Generic bitfield packing and unpacking" default n diff --git a/lib/raid6/algos.c b/lib/raid6/algos.c index 608b648261bd..67af502eada3 100644 --- a/lib/raid6/algos.c +++ b/lib/raid6/algos.c @@ -25,6 +25,12 @@ EXPORT_SYMBOL(raid6_empty_zero_page); #endif #endif +#ifdef CONFIG_RAID6_PQ_DEFAULT_ALG_BOOL +static char raid6_pq_default_alg[32] = CONFIG_RAID6_PQ_DEFAULT_ALG; +module_param_string(raid6_pq_default_alg, raid6_pq_default_alg, sizeof(raid6_pq_default_alg), 0444); +MODULE_PARM_DESC(raid6_pq_default_alg, "Default gen/xor() algorithm"); +#endif + struct raid6_calls raid6_call; EXPORT_SYMBOL_GPL(raid6_call); @@ -153,6 +159,26 @@ static inline const struct raid6_calls *raid6_choose_gen( const struct raid6_calls *const *algo; const struct raid6_calls *best; +#ifdef CONFIG_RAID6_PQ_DEFAULT_ALG_BOOL + if (strlen(raid6_pq_default_alg)) { + for (algo = raid6_algos; *algo; algo++) { + if (!strncmp(raid6_pq_default_alg, (*algo)->name, sizeof(raid6_pq_default_alg))) { + if ((*algo)->valid && !(*algo)->valid()) { + pr_info("raid6: default alg \"%s\" is invalid.\n", + raid6_pq_default_alg); + continue; + } + pr_info("raid6: using default algorithm %s gen() without performace tests.\n", + (*algo)->name); + raid6_call = **algo; + return *algo; + } + } + pr_info("raid6: default alg \"%s\" not found. Choosing the best alg as fallback...\n", + raid6_pq_default_alg); + } +#endif + for (bestgenperf = 0, bestxorperf = 0, best = NULL, algo = raid6_algos; *algo; algo++) { if (!best || (*algo)->prefer >= best->prefer) { /* 2 ^ (RAID6_TIME_JIFFIES_LG2 - 0.5) */