git: b2e2412d150c - stable/13 - geli: Add a chicken switch for unmapped I/O

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Tue, 19 Jul 2022 14:09:27 UTC
The branch stable/13 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=b2e2412d150c848e256f31f4e87f640bdcc9c016

commit b2e2412d150c848e256f31f4e87f640bdcc9c016
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2022-04-18 21:16:10 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-07-19 13:52:00 +0000

    geli: Add a chicken switch for unmapped I/O
    
    We have a report of a panic in GELI that appears to go away when
    unmapped I/O is disabled.  Add a tunable to make such investigations
    easier in the future.  No functional change intended.
    
    PR:             262894
    Reviewed by:    asomers
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit 081b4452a758dd81dcdc68ffb6f7bad901d53e3d)
---
 lib/geom/eli/geli.8  | 8 +++++++-
 sys/geom/eli/g_eli.c | 5 ++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/lib/geom/eli/geli.8 b/lib/geom/eli/geli.8
index 68018e8022cd..1ad0c684642b 100644
--- a/lib/geom/eli/geli.8
+++ b/lib/geom/eli/geli.8
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 15, 2020
+.Dd April 18, 2022
 .Dt GELI 8
 .Os
 .Sh NAME
@@ -886,6 +886,12 @@ Reports how many times we were looking up a Data Key and it was not in cache.
 This sysctl is not updated for providers that need fewer Data Keys than the limit
 specified in
 .Va kern.geom.eli.key_cache_limit .
+.Va kern.geom.eli.unmapped_io
+Enable support for unmapped I/O buffers, currently implemented only on 64-bit
+platforms.
+This is an optimization which reduces the overhead of I/O processing.
+This variable is intended for debugging purposes and must be set in
+.Pa /boot/loader.conf .
 .El
 .Sh EXIT STATUS
 Exit status is 0 on success, and 1 if the command fails.
diff --git a/sys/geom/eli/g_eli.c b/sys/geom/eli/g_eli.c
index 24b61d9f6d8e..2493fd31c7de 100644
--- a/sys/geom/eli/g_eli.c
+++ b/sys/geom/eli/g_eli.c
@@ -90,6 +90,9 @@ SYSCTL_UINT(_kern_geom_eli, OID_AUTO, threads, CTLFLAG_RWTUN, &g_eli_threads, 0,
 u_int g_eli_batch = 0;
 SYSCTL_UINT(_kern_geom_eli, OID_AUTO, batch, CTLFLAG_RWTUN, &g_eli_batch, 0,
     "Use crypto operations batching");
+static bool g_eli_unmapped_io = true;
+SYSCTL_BOOL(_kern_geom_eli, OID_AUTO, unmapped_io, CTLFLAG_RDTUN,
+    &g_eli_unmapped_io, 0, "Enable support for unmapped I/O");
 
 /*
  * Passphrase cached during boot, in order to be more user-friendly if
@@ -973,7 +976,7 @@ g_eli_create(struct gctl_req *req, struct g_class *mp, struct g_provider *bpp,
 	 */
 	pp = g_new_providerf(gp, "%s%s", bpp->name, G_ELI_SUFFIX);
 	pp->flags |= G_PF_DIRECT_SEND | G_PF_DIRECT_RECEIVE;
-	if (CRYPTO_HAS_VMPAGE) {
+	if (g_eli_unmapped_io && CRYPTO_HAS_VMPAGE) {
 		/*
 		 * On DMAP architectures we can use unmapped I/O.  But don't
 		 * use it with data integrity verification.  That code hasn't