linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Jerome Glisse <j.glisse@gmail.com>
To: Haggai Eran <haggaie@mellanox.com>
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org,
	"Linus Torvalds" <torvalds@linux-foundation.org>,
	joro@8bytes.org, "Mel Gorman" <mgorman@suse.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Andrea Arcangeli" <aarcange@redhat.com>,
	"Johannes Weiner" <jweiner@redhat.com>,
	"Larry Woodman" <lwoodman@redhat.com>,
	"Rik van Riel" <riel@redhat.com>,
	"Dave Airlie" <airlied@redhat.com>,
	"Brendan Conoboy" <blc@redhat.com>,
	"Joe Donohue" <jdonohue@redhat.com>,
	"Duncan Poole" <dpoole@nvidia.com>,
	"Sherry Cheung" <SCheung@nvidia.com>,
	"Subhash Gutti" <sgutti@nvidia.com>,
	"John Hubbard" <jhubbard@nvidia.com>,
	"Mark Hairgrove" <mhairgrove@nvidia.com>,
	"Lucien Dunning" <ldunning@nvidia.com>,
	"Cameron Buschardt" <cabuschardt@nvidia.com>,
	"Arvind Gopalakrishnan" <arvindg@nvidia.com>,
	"Shachar Raindel" <raindel@mellanox.com>,
	"Liran Liss" <liranl@mellanox.com>,
	"Roland Dreier" <roland@purestorage.com>,
	"Ben Sander" <ben.sander@amd.com>,
	"Greg Stoner" <Greg.Stoner@amd.com>,
	"John Bridgman" <John.Bridgman@amd.com>,
	"Michael Mantor" <Michael.Mantor@amd.com>,
	"Paul Blinzer" <Paul.Blinzer@amd.com>,
	"Laurent Morichetti" <Laurent.Morichetti@amd.com>,
	"Alexander Deucher" <Alexander.Deucher@amd.com>,
	"Oded Gabbay" <Oded.Gabbay@amd.com>,
	"Jérôme Glisse" <jglisse@redhat.com>,
	"Jatin Kumar" <jakumar@nvidia.com>
Subject: Re: [PATCH 5/6] HMM: add per mirror page table.
Date: Sat, 10 Jan 2015 01:48:32 -0500	[thread overview]
Message-ID: <20150110064831.GA19689@gmail.com> (raw)
In-Reply-To: <54AE6485.60402@mellanox.com>

On Thu, Jan 08, 2015 at 01:05:41PM +0200, Haggai Eran wrote:
> On 06/01/2015 00:44, j.glisse@gmail.com wrote:
> > +	/* fence_wait() - to wait on device driver fence.
> > +	 *
> > +	 * @fence: The device driver fence struct.
> > +	 * Returns: 0 on success,-EIO on error, -EAGAIN to wait again.
> > +	 *
> > +	 * Called when hmm want to wait for all operations associated with a
> > +	 * fence to complete (including device cache flush if the event mandate
> > +	 * it).
> > +	 *
> > +	 * Device driver must free fence and associated resources if it returns
> > +	 * something else thant -EAGAIN. On -EAGAIN the fence must not be free
> > +	 * as hmm will call back again.
> > +	 *
> > +	 * Return error if scheduled operation failed or if need to wait again.
> > +	 * -EIO Some input/output error with the device.
> > +	 * -EAGAIN The fence not yet signaled, hmm reschedule waiting thread.
> > +	 *
> > +	 * All other return value trigger warning and are transformed to -EIO.
> > +	 */
> > +	int (*fence_wait)(struct hmm_fence *fence);
> 
> According to the comment, the device frees the fence struct when the
> fence_wait callback returns zero or -EIO, but the code below calls
> fence_unref after fence_wait on the same fence.

Yes comment is out of date, i wanted to simplify fence before readding
it once needed (by device memory migration).

> 
> > +
> > +	/* fence_ref() - take a reference fence structure.
> > +	 *
> > +	 * @fence: Fence structure hmm is referencing.
> > +	 */
> > +	void (*fence_ref)(struct hmm_fence *fence);
> 
> I don't see fence_ref being called anywhere in the patchset. Is it
> actually needed?

Not right now but the page migration to device memory use it. But i
can remove it now.

I can respin to make comment match code but i would like to know where
i stand on everythings else.

Cheers,
Jerome

> 
> > +static void hmm_device_fence_wait(struct hmm_device *device,
> > +				  struct hmm_fence *fence)
> > +{
> > +	struct hmm_mirror *mirror;
> > +	int r;
> > +
> > +	if (fence == NULL)
> > +		return;
> > +
> > +	list_del_init(&fence->list);
> > +	do {
> > +		r = device->ops->fence_wait(fence);
> > +		if (r == -EAGAIN)
> > +			io_schedule();
> > +	} while (r == -EAGAIN);
> > +
> > +	mirror = fence->mirror;
> > +	device->ops->fence_unref(fence);
> > +	if (r)
> > +		hmm_mirror_release(mirror);
> > +}
> > +
> 
> Regards,
> Haggai

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2015-01-10  6:48 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-05 22:44 HMM (Heterogeneous Memory Management) v8 j.glisse
2015-01-05 22:44 ` [PATCH 1/6] mmu_notifier: add event information to address invalidation v6 j.glisse
2015-01-11 12:24   ` Oded Gabbay
2015-01-11 12:39     ` Oded Gabbay
2015-01-12 15:39     ` Jerome Glisse
2015-01-05 22:44 ` [PATCH 2/6] mmu_notifier: keep track of active invalidation ranges v3 j.glisse
2015-01-05 22:44 ` [PATCH 3/6] HMM: introduce heterogeneous memory management v2 j.glisse
2015-01-11 13:24   ` Oded Gabbay
2015-01-12 15:46     ` Jerome Glisse
2015-01-12 20:05       ` Oded Gabbay
2015-01-05 22:44 ` [PATCH 4/6] HMM: add HMM page table j.glisse
2015-01-19 16:24   ` Jerome Glisse
2015-01-05 22:44 ` [PATCH 5/6] HMM: add per mirror " j.glisse
2015-01-08 11:05   ` Haggai Eran
2015-01-10  6:48     ` Jerome Glisse [this message]
2015-01-11  5:45       ` Haggai Eran
2015-01-08 11:08   ` Haggai Eran
2015-01-05 22:44 ` [PATCH 6/6] HMM: add device page fault support j.glisse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150110064831.GA19689@gmail.com \
    --to=j.glisse@gmail.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Greg.Stoner@amd.com \
    --cc=John.Bridgman@amd.com \
    --cc=Laurent.Morichetti@amd.com \
    --cc=Michael.Mantor@amd.com \
    --cc=Oded.Gabbay@amd.com \
    --cc=Paul.Blinzer@amd.com \
    --cc=SCheung@nvidia.com \
    --cc=aarcange@redhat.com \
    --cc=airlied@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=arvindg@nvidia.com \
    --cc=ben.sander@amd.com \
    --cc=blc@redhat.com \
    --cc=cabuschardt@nvidia.com \
    --cc=dpoole@nvidia.com \
    --cc=haggaie@mellanox.com \
    --cc=hpa@zytor.com \
    --cc=jakumar@nvidia.com \
    --cc=jdonohue@redhat.com \
    --cc=jglisse@redhat.com \
    --cc=jhubbard@nvidia.com \
    --cc=joro@8bytes.org \
    --cc=jweiner@redhat.com \
    --cc=ldunning@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=liranl@mellanox.com \
    --cc=lwoodman@redhat.com \
    --cc=mgorman@suse.de \
    --cc=mhairgrove@nvidia.com \
    --cc=peterz@infradead.org \
    --cc=raindel@mellanox.com \
    --cc=riel@redhat.com \
    --cc=roland@purestorage.com \
    --cc=sgutti@nvidia.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).