Re: [PATCH 5/5] dax: "Hotplug" persistent memory for use like normal RAM

From: Dan Williams
Date: Wed Feb 13 2019 - 11:19:20 EST


On Wed, Feb 13, 2019 at 5:07 AM Brice Goglin <Brice.Goglin@xxxxxxxx> wrote:
>
>
> Le 13/02/2019 Ã 09:43, Brice Goglin a Ãcrit :
> > Le 13/02/2019 Ã 09:24, Dan Williams a Ãcrit :
> >> On Wed, Feb 13, 2019 at 12:12 AM Brice Goglin <Brice.Goglin@xxxxxxxx> wrote:
> >>> Le 13/02/2019 Ã 01:30, Dan Williams a Ãcrit :
> >>>> On Tue, Feb 12, 2019 at 11:59 AM Brice Goglin <Brice.Goglin@xxxxxxxx> wrote:
> >>>>> # ndctl disable-region all
> >>>>> # ndctl zero-labels all
> >>>>> # ndctl enable-region region0
> >>>>> # ndctl create-namespace -r region0 -t pmem -m devdax
> >>>>> {
> >>>>> "dev":"namespace0.0",
> >>>>> "mode":"devdax",
> >>>>> "map":"dev",
> >>>>> "size":"1488.37 GiB (1598.13 GB)",
> >>>>> "uuid":"ad0096d7-3fe7-4402-b529-ad64ed0bf789",
> >>>>> "daxregion":{
> >>>>> "id":0,
> >>>>> "size":"1488.37 GiB (1598.13 GB)",
> >>>>> "align":2097152,
> >>>>> "devices":[
> >>>>> {
> >>>>> "chardev":"dax0.0",
> >>>>> "size":"1488.37 GiB (1598.13 GB)"
> >>>>> }
> >>>>> ]
> >>>>> },
> >>>>> "align":2097152
> >>>>> }
> >>>>> # ndctl enable-namespace namespace0.0
> >>>>> # echo -n dax0.0 > /sys/bus/dax/drivers/device_dax/remove_id
> >>>>> <hang>
> >>>>>
> >>>>> I tried with and without dax_pmem_compat loaded, but it doesn't help.
> >>>> I think this is due to:
> >>>>
> >>>> a9f1ffdb6a20 device-dax: Auto-bind device after successful new_id
> >>>>
> >>>> I missed that this path is also called in the remove_id path. Thanks
> >>>> for the bug report! I'll get this fixed up.
> >>> Now that remove_id is fixed, things fails later in Dave's procedure:
> >>>
> >>> # echo -n dax0.0 > /sys/bus/dax/drivers/device_dax/remove_id
> >>> # echo -n dax0.0 > /sys/bus/dax/drivers/device_dax/unbind
> >>> # echo -n dax0.0 > /sys/bus/dax/drivers/kmem/new_id
> >> In the current version of the code the bind is not necessary, so the
> >> lack of error messages here means the bind succeeded.
>
>
> It looks like "unbind" is required to make the PMEM appear as a new
> node. If I remove_id from devdax and new_id to kmem without "unbind" in
> the middle, nothing appears.
>
> Writing to "kmem/bind" didn't seem necessary.

Yes, in short:

device_dax/remove_id: not required, this driver attaches to any and
all device-dax devices by default
device_dax/unbind: required, nothing else will free the device for
kmem to attach
kmem/new_id: required, it will attach if the device is currently
unbound otherwise the device must be unbound before proceeding
kmem/bind: only required if the device was busy / attached to
device_dax when new_id was written.