[PATCH 1/3] sbitmapq: Fix for sbitmap_queue without ws_active member

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The sbitmap_queue.ws_active member was added by kernel commit 5d2ee7122c73
("sbitmap: optimize wakeup check") at Linux 5.0.  Without the patch, on
earlier kernels the "sbitmapq" command fails with the following error:

  crash> sbitmapq ffff8f1a3611cf10

  sbitmapq: invalid structure member offset: sbitmap_queue_ws_active
            FILE: sbitmap.c  LINE: 393  FUNCTION: sbitmap_queue_context_load()

Signed-off-by: Kazuhito Hagio <k-hagio-ab@xxxxxxx>
---
 sbitmap.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sbitmap.c b/sbitmap.c
index e8ebd62fe01c..37db21d15219 100644
--- a/sbitmap.c
+++ b/sbitmap.c
@@ -325,7 +325,8 @@ static void sbitmap_queue_show(const struct sbitmap_queue_context *sqc,
 
 	fprintf(fp, "wake_batch = %u\n", sqc->wake_batch);
 	fprintf(fp, "wake_index = %d\n", sqc->wake_index);
-	fprintf(fp, "ws_active = %d\n", sqc->ws_active);
+	if (VALID_MEMBER(sbitmap_queue_ws_active)) /* 5.0 and later */
+		fprintf(fp, "ws_active = %d\n", sqc->ws_active);
 
 	sbq_wait_state_size = SIZE(sbq_wait_state);
 	wait_cnt_off = OFFSET(sbq_wait_state_wait_cnt);
@@ -380,7 +381,8 @@ static void sbitmap_queue_context_load(ulong addr, struct sbitmap_queue_context
 	sqc->wake_batch = UINT(sbitmap_queue_buf + OFFSET(sbitmap_queue_wake_batch));
 	sqc->wake_index = INT(sbitmap_queue_buf + OFFSET(sbitmap_queue_wake_index));
 	sqc->ws_addr = ULONG(sbitmap_queue_buf + OFFSET(sbitmap_queue_ws));
-	sqc->ws_active = INT(sbitmap_queue_buf + OFFSET(sbitmap_queue_ws_active));
+	if (VALID_MEMBER(sbitmap_queue_ws_active))
+		sqc->ws_active = INT(sbitmap_queue_buf + OFFSET(sbitmap_queue_ws_active));
 	if (VALID_MEMBER(sbitmap_queue_round_robin))
 		sqc->round_robin = BOOL(sbitmap_queue_buf + OFFSET(sbitmap_queue_round_robin));
 	sqc->min_shallow_depth = UINT(sbitmap_queue_buf + OFFSET(sbitmap_queue_min_shallow_depth));
-- 
2.27.0

--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/crash-utility
Contribution Guidelines: https://github.com/crash-utility/crash/wiki




[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux