]> git.hungrycats.org Git - linux/commitdiff
zygo: DO-NOT-UPSTREAM: lib/raid6: raid6_pq.algo= pins gen_syndrome 6.18/topics/raid6-fixes
authorZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Thu, 17 Sep 2026 17:54:43 +0000 (13:54 -0400)
committerZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Thu, 17 Sep 2026 17:54:43 +0000 (13:54 -0400)
Testing aid.  The subject is marked so it stands out in git log --oneline
and gets dropped from the series before it is submitted; it carries the
zygo: prefix the lane uses for local-only commits as well.

The boot-time benchmark decides which gen_syndrome runs, so a bug in one
variant (the x1 preload of dptr[z0-1], fatal with one data disk) shows
up only on the boots where that variant happens to win.  Let the test
rig pin it: raid6_pq.algo=avx2x1 selects that implementation without
benchmarking; an unknown or unusable name falls back to the benchmark.

It lives on this topic branch so that the pin the test rigs boot with
keeps working across rebases.  Kept here after 2026-09-17, when it
turned out that carrying it only as a per-candidate tip commit had
silently stopped working: the rebase onto v6.18.52 rebuilt the lane from
its topics, so the knob went away while both rigs' grub entries and every
build script kept passing raid6_pq.algo=avx2x1.  An unknown
<module>.<param>= is ignored without a word, so the variant was quietly
back to whatever the benchmark picked, and a raid6 pass would have
claimed a pin it was not applying.  The validation driver's preflight now
refuses to run when a tree carrying this knob boots with a pin that the
running kernel does not honour.

Assisted-by: Claude:claude-fable-5-1
lib/raid6/algos.c

index 799e0e5eac26db3d10c07e79f46537af4ec6f182..b705680baa76ada34ca3aa842316dae5e2842a3c 100644 (file)
@@ -128,6 +128,14 @@ const struct raid6_recov_calls *const raid6_recov_algos[] = {
 #define time_before(x, y) ((x) < (y))
 #endif
 
+/*
+ * Testing aid: name a gen_syndrome implementation to use instead of the
+ * boot-time benchmark winner, e.g. raid6_pq.algo=avx2x1.
+ */
+static char *raid6_algo_force;
+module_param_named(algo, raid6_algo_force, charp, 0444);
+MODULE_PARM_DESC(algo, "force this gen_syndrome implementation instead of benchmarking (testing aid)");
+
 #define RAID6_TEST_DISKS       8
 #define RAID6_TEST_DISKS_ORDER 3
 
@@ -160,6 +168,25 @@ static inline const struct raid6_calls *raid6_choose_gen(
        const struct raid6_calls *const *algo;
        const struct raid6_calls *best;
 
+       if (raid6_algo_force) {
+               for (algo = raid6_algos; *algo; algo++) {
+                       if (strcmp((*algo)->name, raid6_algo_force))
+                               continue;
+                       if ((*algo)->valid && !(*algo)->valid()) {
+                               pr_err("raid6: forced algorithm %s not usable on this CPU, benchmarking instead\n",
+                                      raid6_algo_force);
+                               break;
+                       }
+                       raid6_call = **algo;
+                       pr_info("raid6: using FORCED algorithm %s (raid6_pq.algo=)\n",
+                               (*algo)->name);
+                       return *algo;
+               }
+               if (!*algo)
+                       pr_err("raid6: forced algorithm %s not found, benchmarking instead\n",
+                              raid6_algo_force);
+       }
+
        for (bestgenperf = 0, best = NULL, algo = raid6_algos; *algo; algo++) {
                if (!best || (*algo)->priority >= best->priority) {
                        if ((*algo)->valid && !(*algo)->valid())