[PATCH v2] tools/mm: add hwpoison-panic tool
Breno Leitao
leitao at debian.org
Thu Aug 13 03:19:26 PDT 2026
Hello Miaohe,
First of all, thanks for looking at this one.
On Thu, Aug 13, 2026 at 03:32:34PM +0800, Miaohe Lin wrote:
> On 2026/8/3 19:31, Breno Leitao wrote:
> > +static int pick_kpageflags_phys_addr(uint64_t want, uint64_t *phys_addr)
> > +{
> > + uint64_t pfn = (16UL << 20) / page_size;
>
> Could we use SZ_16M macro here?
Sure, for that I will include ../../include/linux/sizes.h in the next
version.
> > +/* hard_offline_page() injects with MF_SW_SIMULATED, so unpoison is allowed. */
> > +static void unpoison_pfn(uint64_t pfn)
> > +{
> > + char path[PATH_MAX], buf[32];
> > + const char *debugfs;
> > + int fd, len;
> > +
> > + debugfs = debugfs__mount();
>
> I might be miss something but I can't find the implementation of debugfs__mount.
It is an ugly macro declared in tools/lib/api/fs/fs.h:
#define FS(name) \
const char *name##__mountpoint(void); \
const char *name##__mount(void); \
bool name##__configured(void);
And then:
FS(debugfs)
> > + if (access(INJECT_PATH, W_OK))
> > + fatal("%s not present (no MEMORY_HOTPLUG?)\n", INJECT_PATH);
>
> MEMORY_HOTPLUG?
lol. it should be MEMORY_FAILURE
I will get these points fixed and respin.
--breno
More information about the linux-riscv
mailing list