Blame SOURCES/0014-sbitmapq-Fix-for-sbitmap_queue-without-min_shallow_d.patch

ae0abc
From 12fe6c7cdd768f87ce6e903a2bbfb0c0591585c5 Mon Sep 17 00:00:00 2001
ae0abc
From: Kazuhito Hagio <k-hagio-ab@nec.com>
ae0abc
Date: Fri, 10 Jun 2022 11:49:47 +0900
ae0abc
Subject: [PATCH 14/15] sbitmapq: Fix for sbitmap_queue without
ae0abc
 min_shallow_depth member
ae0abc
ae0abc
The sbitmap_queue.min_shallow_depth member was added by kernel commit
ae0abc
a327553965de ("sbitmap: fix missed wakeups caused by sbitmap_queue_get_shallow()")
ae0abc
at Linux 4.18.  Without the patch, on earlier kernels the "sbitmapq"
ae0abc
command fails with the following error:
ae0abc
ae0abc
  crash> sbitmapq ffff89bb7638ee50
ae0abc
ae0abc
  sbitmapq: invalid structure member offset: sbitmap_queue_min_shallow_depth
ae0abc
            FILE: sbitmap.c  LINE: 398  FUNCTION: sbitmap_queue_context_load()
ae0abc
ae0abc
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
ae0abc
---
ae0abc
 sbitmap.c | 6 ++++--
ae0abc
 1 file changed, 4 insertions(+), 2 deletions(-)
ae0abc
ae0abc
diff --git a/sbitmap.c b/sbitmap.c
ae0abc
index c9f7209f9e3e..bb2f19e6207b 100644
ae0abc
--- a/sbitmap.c
ae0abc
+++ b/sbitmap.c
ae0abc
@@ -371,7 +371,8 @@ static void sbitmap_queue_show(const struct sbitmap_queue_context *sqc,
ae0abc
 	else if (VALID_MEMBER(sbitmap_round_robin)) /* 5.13 and later */
ae0abc
 		fprintf(fp, "round_robin = %d\n", sc->round_robin);
ae0abc
 
ae0abc
-	fprintf(fp, "min_shallow_depth = %u\n", sqc->min_shallow_depth);
ae0abc
+	if (VALID_MEMBER(sbitmap_queue_min_shallow_depth)) /* 4.18 and later */
ae0abc
+		fprintf(fp, "min_shallow_depth = %u\n", sqc->min_shallow_depth);
ae0abc
 }
ae0abc
 
ae0abc
 static void sbitmap_queue_context_load(ulong addr, struct sbitmap_queue_context *sqc)
ae0abc
@@ -395,7 +396,8 @@ static void sbitmap_queue_context_load(ulong addr, struct sbitmap_queue_context
ae0abc
 		sqc->ws_active = INT(sbitmap_queue_buf + OFFSET(sbitmap_queue_ws_active));
ae0abc
 	if (VALID_MEMBER(sbitmap_queue_round_robin))
ae0abc
 		sqc->round_robin = BOOL(sbitmap_queue_buf + OFFSET(sbitmap_queue_round_robin));
ae0abc
-	sqc->min_shallow_depth = UINT(sbitmap_queue_buf + OFFSET(sbitmap_queue_min_shallow_depth));
ae0abc
+	if (VALID_MEMBER(sbitmap_queue_min_shallow_depth))
ae0abc
+		sqc->min_shallow_depth = UINT(sbitmap_queue_buf + OFFSET(sbitmap_queue_min_shallow_depth));
ae0abc
 
ae0abc
 	FREEBUF(sbitmap_queue_buf);
ae0abc
 }
ae0abc
-- 
ae0abc
2.30.2
ae0abc