On Thu, Jan 18, 2018 at 10:54 AM, Pankaj Gupta <pagupta@xxxxxxxxxx> wrote: > >> >> >> I'd like to emphasize again, that I would prefer a virtio-pmem only >> >> solution. >> >> >> >> There are architectures out there (e.g. s390x) that don't support >> >> NVDIMMs - there is no HW interface to expose any such stuff. >> >> >> >> However, with virtio-pmem, we could make it work also on architectures >> >> not having ACPI and friends. >> > >> > ACPI and virtio-only can share the same pmem driver. There are two >> > parts to this, region discovery and setting up the pmem driver. For >> > discovery you can either have an NFIT-bus defined range, or a new >> > virtio-pmem-bus define it. As far as the pmem driver itself it's >> > agnostic to how the range is discovered. >> > >> >> And in addition to discovery + setup, we need the flush via virtio. >> >> > In other words, pmem consumes 'regions' from libnvdimm and the a bus >> > provider like nfit, e820, or a new virtio-mechansim produce 'regions'. >> > >> >> That sounds good to me. I would like to see how the ACPI discovery >> variant connects to a virtio ring. >> >> The natural way for me would be: >> >> A virtio-X device supplies a memory region ("discovery") and also the >> interface for flushes for this device. So one virtio-X corresponds to >> one pmem device. No ACPI to be involved (also not on architectures that >> have ACPI) > > I agree here if we discover regions with virtio-X we don't need to worry about > NFIT ACPI. Actually, there are three ways to do it with pros and cons of these > approaches: > > 1] Existing pmem driver & virtio for region discovery: > ----------------------------------------------------- > Use existing pmem driver which is tightly coupled with concepts of namespaces, labels etc > from ACPI region discovery and re-implement these concepts with virtio so that existing > pmem driver can understand it. In addition to this, task of pmem driver to send flush command > using virtio. It's not tightly coupled. The whole point of libnvdimm is to be agnostic to ACPI, e820 or any other range discovery. The only work to do beyond identifying the address range is teaching libnvdimm to pass along a flush control interface to the pmem driver. > > 2] Existing pmem driver & ACPI NFIT for region discovery: > ---------------------------------------------------------------- > - If we use NFIT ACPI, we need to teach existing ACPI driver to add this new memory > type and teach existing pmem driver to handle this new memory type. Still we need > an asynchronous(virtio) way to send flush commands. We need virtio device/driver > or arbitrary key/value like pair just to send commands from guest to host using virtio. > > 3] New Virtio pmem driver & paravirt device: > ---------------------------------------- > Third way is new virtio pmem driver with less work to support existing features of different protocols, > and with asynchronous way of sending flush commands. > > But this needs to duplicate some of the work which existing pmem driver does but as discussed > previously we can separate common code from existing pmem driver and reuse it. > > Among these approaches I also prefer 3]. I disagree, the reason we went down this ACPI path was to limit the needless duplication of most of the pmem driver.