On Thu, 2023-10-05 at 14:16 -0700, Dan Williams wrote: > Vishal Verma wrote: > > <..> > > + > > + rc = kstrtobool(buf, &val); > > + if (rc) > > + return rc; > > Perhaps: > > if (dev_dax->memmap_on_memory == val) > return len; > > ...and skip the check below when it is going to be a nop > > > + > > + device_lock(dax_region->dev); > > + if (!dax_region->dev->driver) { > > Is the polarity backwards here? I.e. if the device is already attached to > the kmem driver it is too late to modify memmap_on_memory policy. Hm this sounded logical until I tried it. After a reconfigure-device to devdax (i.e. detach kmem), I get the -EBUSY if I invert this check. > > > + device_unlock(dax_region->dev); > > + return -ENXIO; > > I would expect -EBUSY since disabling the device allows the property to be > set and -ENXIO implies a more permanent error. > > > + } > > + > > + dev_dax->memmap_on_memory = val; > > + > > + device_unlock(dax_region->dev); > > + return len; > > +} > > +static DEVICE_ATTR_RW(memmap_on_memory); > > This new attribute needs a new Documentation/ABI/ entry... in fact all of > these attributes need Documentation/ entries. I can help with that base > document to get things started. > > Perhaps split this sysfs ABI into its own patch and, depending on how fast > we can pull the Documentation together, start with the > region-driver-conveyed approach in the meantime. Yep I'll split this out and I can do a separate series to add the ABI docs for /sys/bus/dax, and include this new ABI in that as well. Agreed with all other comments.