All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Alex Sierra <alex.sierra@amd.com>
Cc: <jgg@nvidia.com>, <david@redhat.com>, <Felix.Kuehling@amd.com>,
	<linux-mm@kvack.org>, <rcampbell@nvidia.com>,
	<linux-ext4@vger.kernel.org>, <linux-xfs@vger.kernel.org>,
	<amd-gfx@lists.freedesktop.org>,
	<dri-devel@lists.freedesktop.org>, <hch@lst.de>,
	<jglisse@redhat.com>, <apopple@nvidia.com>, <willy@infradead.org>
Subject: Re: [PATCH v4 07/13] lib: test_hmm add ioctl to get zone device type
Date: Tue, 31 May 2022 10:31:52 -0700	[thread overview]
Message-ID: <20220531103152.6b9214cc39a87020d7d7927b@linux-foundation.org> (raw)
In-Reply-To: <20220531155629.20057-8-alex.sierra@amd.com>

On Tue, 31 May 2022 10:56:23 -0500 Alex Sierra <alex.sierra@amd.com> wrote:

> new ioctl cmd added to query zone device type. This will be
> used once the test_hmm adds zone device coherent type.
> 
> @@ -1026,6 +1027,15 @@ static int dmirror_snapshot(struct dmirror *dmirror,
>  	return ret;
>  }
>  
> +static int dmirror_get_device_type(struct dmirror *dmirror,
> +			    struct hmm_dmirror_cmd *cmd)
> +{
> +	mutex_lock(&dmirror->mutex);
> +	cmd->zone_device_type = dmirror->mdevice->zone_device_type;
> +	mutex_unlock(&dmirror->mutex);

What does the locking here do?

Presumably cmd->zone_device_type can become out of date the instant the
mutex is released, so what was the point in taking the mutex?

And does it make sense to return potentially out-of-date info to
userspace?  Perhaps this interface simply shouldn't exist?

WARNING: multiple messages have this Message-ID (diff)
From: Andrew Morton <akpm@linux-foundation.org>
To: Alex Sierra <alex.sierra@amd.com>
Cc: rcampbell@nvidia.com, willy@infradead.org, david@redhat.com,
	Felix.Kuehling@amd.com, apopple@nvidia.com,
	amd-gfx@lists.freedesktop.org, linux-xfs@vger.kernel.org,
	linux-mm@kvack.org, jglisse@redhat.com,
	dri-devel@lists.freedesktop.org, jgg@nvidia.com,
	linux-ext4@vger.kernel.org, hch@lst.de
Subject: Re: [PATCH v4 07/13] lib: test_hmm add ioctl to get zone device type
Date: Tue, 31 May 2022 10:31:52 -0700	[thread overview]
Message-ID: <20220531103152.6b9214cc39a87020d7d7927b@linux-foundation.org> (raw)
In-Reply-To: <20220531155629.20057-8-alex.sierra@amd.com>

On Tue, 31 May 2022 10:56:23 -0500 Alex Sierra <alex.sierra@amd.com> wrote:

> new ioctl cmd added to query zone device type. This will be
> used once the test_hmm adds zone device coherent type.
> 
> @@ -1026,6 +1027,15 @@ static int dmirror_snapshot(struct dmirror *dmirror,
>  	return ret;
>  }
>  
> +static int dmirror_get_device_type(struct dmirror *dmirror,
> +			    struct hmm_dmirror_cmd *cmd)
> +{
> +	mutex_lock(&dmirror->mutex);
> +	cmd->zone_device_type = dmirror->mdevice->zone_device_type;
> +	mutex_unlock(&dmirror->mutex);

What does the locking here do?

Presumably cmd->zone_device_type can become out of date the instant the
mutex is released, so what was the point in taking the mutex?

And does it make sense to return potentially out-of-date info to
userspace?  Perhaps this interface simply shouldn't exist?

  reply	other threads:[~2022-05-31 17:31 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-31 15:56 [PATCH v4 00/13] Add MEMORY_DEVICE_COHERENT for coherent device memory mapping Alex Sierra
2022-05-31 15:56 ` Alex Sierra
2022-05-31 15:56 ` [PATCH v4 01/13] mm: add zone device coherent type memory support Alex Sierra
2022-05-31 15:56   ` Alex Sierra
2022-05-31 15:56 ` [PATCH v4 02/13] mm: handling Non-LRU pages returned by vm_normal_pages Alex Sierra
2022-05-31 15:56   ` Alex Sierra
2022-05-31 15:56 ` [PATCH v4 03/13] mm: add device coherent vma selection for memory migration Alex Sierra
2022-05-31 15:56   ` Alex Sierra
2022-05-31 15:56 ` [PATCH v4 04/13] mm: remove the vma check in migrate_vma_setup() Alex Sierra
2022-05-31 15:56   ` Alex Sierra
2022-05-31 15:56 ` [PATCH v4 05/13] mm/gup: migrate device coherent pages when pinning instead of failing Alex Sierra
2022-05-31 15:56   ` Alex Sierra
2022-05-31 15:56 ` [PATCH v4 06/13] drm/amdkfd: add SPM support for SVM Alex Sierra
2022-05-31 15:56   ` Alex Sierra
2022-05-31 15:56 ` [PATCH v4 07/13] lib: test_hmm add ioctl to get zone device type Alex Sierra
2022-05-31 15:56   ` Alex Sierra
2022-05-31 17:31   ` Andrew Morton [this message]
2022-05-31 17:31     ` Andrew Morton
2022-05-31 19:19     ` Sierra Guiza, Alejandro (Alex)
2022-05-31 19:19       ` Sierra Guiza, Alejandro (Alex)
2022-05-31 15:56 ` [PATCH v4 08/13] lib: test_hmm add module param for " Alex Sierra
2022-05-31 15:56   ` Alex Sierra
2022-05-31 15:56 ` [PATCH v4 09/13] lib: add support for device coherent type in test_hmm Alex Sierra
2022-05-31 15:56   ` Alex Sierra
2022-05-31 15:56 ` [PATCH v4 10/13] tools: update hmm-test to support device coherent type Alex Sierra
2022-05-31 15:56   ` Alex Sierra
2022-05-31 15:56 ` [PATCH v4 11/13] tools: update test_hmm script to support SP config Alex Sierra
2022-05-31 15:56   ` Alex Sierra
2022-05-31 15:56 ` [PATCH v4 12/13] tools: add hmm gup tests for device coherent type Alex Sierra
2022-05-31 15:56   ` Alex Sierra
2022-05-31 15:56 ` [PATCH v4 13/13] tools: add selftests to hmm for COW in device memory Alex Sierra
2022-05-31 15:56   ` Alex Sierra

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=20220531103152.6b9214cc39a87020d7d7927b@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=Felix.Kuehling@amd.com \
    --cc=alex.sierra@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=apopple@nvidia.com \
    --cc=david@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hch@lst.de \
    --cc=jgg@nvidia.com \
    --cc=jglisse@redhat.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=rcampbell@nvidia.com \
    --cc=willy@infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.