Re: [PATCH 02/22] mm: remove the struct hmm_device infrastructure

From: Jason Gunthorpe
Date: Thu Jun 13 2019 - 14:51:22 EST

On Thu, Jun 13, 2019 at 11:43:05AM +0200, Christoph Hellwig wrote:
> This code is a trivial wrapper around device model helpers, which
> should have been integrated into the driver device model usage from
> the start. Assuming it actually had users, which it never had since
> the code was added more than 1 1/2 years ago.
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>
> ---
> include/linux/hmm.h | 20 ------------
> mm/hmm.c | 80 ---------------------------------------------
> 2 files changed, 100 deletions(-)

I haven't looked in detail at this device memory stuff.. But I did
check a bit through the mailing list archives for some clue what this
was supposed to be for (wow, this is from 2016!)

The commit that added this says:
This introduce a dummy HMM device class so device driver can use it to
create hmm_device for the sole purpose of registering device memory.

Which I just can't understand at all.

If we need a 'struct device' for some 'device memory' purpose then it
probably ought to be the 'struct pci_device' holding the BAR, not a
fake device.

I also can't comprehend why a supposed fake device would need a
chardev, with a stanadrd 'hmm_deviceX' name, without also defining a
core kernel ABI for that char dev..

If this comes back it needs a proper explanation and review, with a

Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxxxx>