Re: [PATCH v11 15/15] HMM: add documentation explaining HMM internals and how to use it.

From: Jerome Glisse
Date: Thu Oct 22 2015 - 10:11:25 EST


On Wed, Oct 21, 2015 at 08:23:41PM -0700, Randy Dunlap wrote:
> Hi,
>
> Some corrections and a few questions...

Thanks for the corrections. Answer below.

> On 10/21/15 14:00, Jérôme Glisse wrote:
> > This add documentation on how HMM works and a more in depth view of how it
> > should be use by device driver writers.
> >
> > Signed-off-by: Jérôme Glisse <jglisse@xxxxxxxxxx>

[...]

> > +synchronizing device page table for range that the device driver explicitly ask
>
> ranges asks
>
> or is only one range supported?

Several ranges are supported.


[...]

> > + /* Mirror memory (in read mode) between addressA and addressB */
> > + your_hmm_event->hmm_event.start = addressA;
> > + your_hmm_event->hmm_event.end = addressB;
>
> Multiple events (ranges) can be specified?

Device driver have to make one call per range but multiple threads can make
concurrent call for different ranges.

> Is hmm_event.end (addressB) included or excluded from the range?

Forgot to copy comment from header file, start is inclusive, end is exclusive.


[...]

> > + struct hmm_pt_iter iter;
> > + hmm_pt_iter_init(&iter, &mirror->pt)
> > +
> > + /* Get pointer to HMM page table entry for a given address. */
> > + dma_addr_t *hmm_pte;
> > + hmm_pte = hmm_pt_iter_walk(&iter, &addr, &next);
>
> what are 'addr' and 'next'? (types)

unsigned long will add then to the doc, good point.

[...]


> > + /* Migrate system memory between addressA and addressB to device memory. */
> > + your_hmm_event->hmm_event.start = addressA;
> > + your_hmm_event->hmm_event.end = addressB;
>
> is hmm_event.end (addressB) inclusive and exclusive?
> i.e., is it end_of_copy + 1?
> i.e., is the size of the copy addressB - addressA or
> addressB - addressA + 1?
> i.e., is addressB = addressA + size
> or is addressB = addressA + size - 1

Exclusive last one.


> In my experience it is usually better to have a start_address and size
> instead of start_address and end_address.

I switched several time btw the 2 offer differents version of the patchset,
it is something that can be change down the road unless you have strong
feeling about it.

Cheers,
Jérôme
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/