Skip to content

Commit

Permalink
Merge tag 'kgdb-6.14-rc1' of git://git.kernel.org/pub/scm/linux/kerne…
Browse files Browse the repository at this point in the history
…l/git/danielt/linux

Pull kgdb updates from Daniel Thompson:
 "A very small set of changes this kernel cycle.

  Two cleanups, one switches to kmap_local_page() (from kmap_atomic())
  and the other removes a bit of dead code"

* tag 'kgdb-6.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/danielt/linux:
  kdb: Remove unused flags stack
  kdb: use kmap_local_page()
  • Loading branch information
Linus Torvalds committed Jan 25, 2025
2 parents fd56e51 + 6beaa75 commit 4050577
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 24 deletions.
3 changes: 0 additions & 3 deletions include/linux/kdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,6 @@ extern const char *kdb_diemsg;

extern unsigned int kdb_flags; /* Global flags, see kdb_state for per cpu state */

extern void kdb_save_flags(void);
extern void kdb_restore_flags(void);

#define KDB_FLAG(flag) (kdb_flags & KDB_FLAG_##flag)
#define KDB_FLAG_SET(flag) ((void)(kdb_flags |= KDB_FLAG_##flag))
#define KDB_FLAG_CLEAR(flag) ((void)(kdb_flags &= ~KDB_FLAG_##flag))
Expand Down
24 changes: 3 additions & 21 deletions kernel/debug/kdb/kdb_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ int kdb_putarea_size(unsigned long addr, void *res, size_t size)

/*
* kdb_getphys - Read data from a physical address. Validate the
* address is in range, use kmap_atomic() to get data
* address is in range, use kmap_local_page() to get data
* similar to kdb_getarea() - but for phys addresses
* Inputs:
* res Pointer to the word to receive the result
Expand All @@ -324,9 +324,9 @@ static int kdb_getphys(void *res, unsigned long addr, size_t size)
if (!pfn_valid(pfn))
return 1;
page = pfn_to_page(pfn);
vaddr = kmap_atomic(page);
vaddr = kmap_local_page(page);
memcpy(res, vaddr + (addr & (PAGE_SIZE - 1)), size);
kunmap_atomic(vaddr);
kunmap_local(vaddr);

return 0;
}
Expand Down Expand Up @@ -536,21 +536,3 @@ bool kdb_task_state(const struct task_struct *p, const char *mask)

return strchr(mask, state);
}

/* Maintain a small stack of kdb_flags to allow recursion without disturbing
* the global kdb state.
*/

static int kdb_flags_stack[4], kdb_flags_index;

void kdb_save_flags(void)
{
BUG_ON(kdb_flags_index >= ARRAY_SIZE(kdb_flags_stack));
kdb_flags_stack[kdb_flags_index++] = kdb_flags;
}

void kdb_restore_flags(void)
{
BUG_ON(kdb_flags_index <= 0);
kdb_flags = kdb_flags_stack[--kdb_flags_index];
}

0 comments on commit 4050577

Please sign in to comment.