kdb: Remove the misfeature 'KDBFLAGS'

Currently, 'KDBFLAGS' is an internal variable of kdb, it is combined
by 'KDBDEBUG' and state flags. It will be shown only when 'KDBDEBUG'
is set, and the user can define an environment variable named 'KDBFLAGS'
too. These are puzzling indeed.

After communication with Daniel, it seems that 'KDBFLAGS' is a misfeature.
So let's replace 'KDBFLAGS' with 'KDBDEBUG' to just show the value we
wrote into. After this modification, we can use `md4c1 kdb_flags` instead,
to observe the state flags.

Suggested-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Wei Li <liwei391@huawei.com>
Link: https://lore.kernel.org/r/20200521072125.21103-1-liwei391@huawei.com
[daniel.thompson@linaro.org: Make kdb_flags unsigned to avoid arithmetic
right shift]
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
This commit is contained in:
Wei Li 2020-05-21 15:21:25 +08:00 committed by Daniel Thompson
parent 1b310030bb
commit c893de12e1
2 changed files with 5 additions and 5 deletions

View File

@ -125,7 +125,7 @@ extern const char *kdb_diemsg;
#define KDB_FLAG_NO_I8042 (1 << 7) /* No i8042 chip is available, do #define KDB_FLAG_NO_I8042 (1 << 7) /* No i8042 chip is available, do
* not use keyboard */ * not use keyboard */
extern int kdb_flags; /* Global flags, see kdb_state for per cpu state */ extern unsigned int kdb_flags; /* Global flags, see kdb_state for per cpu state */
extern void kdb_save_flags(void); extern void kdb_save_flags(void);
extern void kdb_restore_flags(void); extern void kdb_restore_flags(void);

View File

@ -62,7 +62,7 @@ int kdb_grep_trailing;
/* /*
* Kernel debugger state flags * Kernel debugger state flags
*/ */
int kdb_flags; unsigned int kdb_flags;
/* /*
* kdb_lock protects updates to kdb_initial_cpu. Used to * kdb_lock protects updates to kdb_initial_cpu. Used to
@ -418,8 +418,7 @@ int kdb_set(int argc, const char **argv)
argv[2]); argv[2]);
return 0; return 0;
} }
kdb_flags = (kdb_flags & kdb_flags = (kdb_flags & ~KDB_DEBUG(MASK))
~(KDB_DEBUG_FLAG_MASK << KDB_DEBUG_FLAG_SHIFT))
| (debugflags << KDB_DEBUG_FLAG_SHIFT); | (debugflags << KDB_DEBUG_FLAG_SHIFT);
return 0; return 0;
@ -2082,7 +2081,8 @@ static int kdb_env(int argc, const char **argv)
} }
if (KDB_DEBUG(MASK)) if (KDB_DEBUG(MASK))
kdb_printf("KDBFLAGS=0x%x\n", kdb_flags); kdb_printf("KDBDEBUG=0x%x\n",
(kdb_flags & KDB_DEBUG(MASK)) >> KDB_DEBUG_FLAG_SHIFT);
return 0; return 0;
} }