Blame SOURCES/0013-sbitmapq-Fix-for-sbitmap_queue-without-ws_active-mem.patch

1a20ba
From 9ce31a14d1083cbb2beb4a8e6eb7b88234b79a99 Mon Sep 17 00:00:00 2001
1a20ba
From: Kazuhito Hagio <k-hagio-ab@nec.com>
1a20ba
Date: Fri, 10 Jun 2022 11:49:47 +0900
1a20ba
Subject: [PATCH 13/18] sbitmapq: Fix for sbitmap_queue without ws_active
1a20ba
 member
1a20ba
1a20ba
The sbitmap_queue.ws_active member was added by kernel commit 5d2ee7122c73
1a20ba
("sbitmap: optimize wakeup check") at Linux 5.0.  Without the patch, on
1a20ba
earlier kernels the "sbitmapq" command fails with the following error:
1a20ba
1a20ba
  crash> sbitmapq ffff8f1a3611cf10
1a20ba
1a20ba
  sbitmapq: invalid structure member offset: sbitmap_queue_ws_active
1a20ba
            FILE: sbitmap.c  LINE: 393  FUNCTION: sbitmap_queue_context_load()
1a20ba
1a20ba
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
1a20ba
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
1a20ba
---
1a20ba
 sbitmap.c | 6 ++++--
1a20ba
 1 file changed, 4 insertions(+), 2 deletions(-)
1a20ba
1a20ba
diff --git a/sbitmap.c b/sbitmap.c
1a20ba
index e8ebd62fe01c..152c28e6875f 100644
1a20ba
--- a/sbitmap.c
1a20ba
+++ b/sbitmap.c
1a20ba
@@ -325,7 +325,8 @@ static void sbitmap_queue_show(const struct sbitmap_queue_context *sqc,
1a20ba
 
1a20ba
 	fprintf(fp, "wake_batch = %u\n", sqc->wake_batch);
1a20ba
 	fprintf(fp, "wake_index = %d\n", sqc->wake_index);
1a20ba
-	fprintf(fp, "ws_active = %d\n", sqc->ws_active);
1a20ba
+	if (VALID_MEMBER(sbitmap_queue_ws_active)) /* 5.0 and later */
1a20ba
+		fprintf(fp, "ws_active = %d\n", sqc->ws_active);
1a20ba
 
1a20ba
 	sbq_wait_state_size = SIZE(sbq_wait_state);
1a20ba
 	wait_cnt_off = OFFSET(sbq_wait_state_wait_cnt);
1a20ba
@@ -380,7 +381,8 @@ static void sbitmap_queue_context_load(ulong addr, struct sbitmap_queue_context
1a20ba
 	sqc->wake_batch = UINT(sbitmap_queue_buf + OFFSET(sbitmap_queue_wake_batch));
1a20ba
 	sqc->wake_index = INT(sbitmap_queue_buf + OFFSET(sbitmap_queue_wake_index));
1a20ba
 	sqc->ws_addr = ULONG(sbitmap_queue_buf + OFFSET(sbitmap_queue_ws));
1a20ba
-	sqc->ws_active = INT(sbitmap_queue_buf + OFFSET(sbitmap_queue_ws_active));
1a20ba
+	if (VALID_MEMBER(sbitmap_queue_ws_active))
1a20ba
+		sqc->ws_active = INT(sbitmap_queue_buf + OFFSET(sbitmap_queue_ws_active));
1a20ba
 	if (VALID_MEMBER(sbitmap_queue_round_robin))
1a20ba
 		sqc->round_robin = BOOL(sbitmap_queue_buf + OFFSET(sbitmap_queue_round_robin));
1a20ba
 	sqc->min_shallow_depth = UINT(sbitmap_queue_buf + OFFSET(sbitmap_queue_min_shallow_depth));
1a20ba
-- 
1a20ba
2.30.2
1a20ba