linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: John Hubbard <jhubbard@nvidia.com>
To: Jerome Glisse <jglisse@redhat.com>, Matthew Wilcox <willy@infradead.org>
Cc: "Andrew Morton" <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-xfs@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	"Christian König" <christian.koenig@amd.com>,
	"Jan Kara" <jack@suse.cz>
Subject: Re: [PATCH] Initialise mmu_notifier_range correctly
Date: Wed, 2 Jan 2019 19:32:08 -0800	[thread overview]
Message-ID: <785af237-eb67-c304-595d-9080a2f48102@nvidia.com> (raw)
In-Reply-To: <20190103015654.GB15619@redhat.com>

On 1/2/19 5:56 PM, Jerome Glisse wrote:
> On Wed, Jan 02, 2019 at 04:21:26PM -0800, Matthew Wilcox wrote:
>>
>> One of the paths in follow_pte_pmd() initialised the mmu_notifier_range
>> incorrectly.
>>
>> Signed-off-by: Matthew Wilcox <willy@infradead.org>
>> Fixes: ac46d4f3c432 ("mm/mmu_notifier: use structure for invalidate_range_start/end calls v2")
>> Tested-by: Dave Chinner <dchinner@redhat.com>
> 
> Reviewed-by: Jérôme Glisse <jglisse@redhat.com>
> 
>>
>> diff --git a/mm/memory.c b/mm/memory.c
>> index 2dd2f9ab57f4..21a650368be0 100644
>> --- a/mm/memory.c
>> +++ b/mm/memory.c
>> @@ -4078,8 +4078,8 @@ static int __follow_pte_pmd(struct mm_struct *mm, unsigned long address,
>>  		goto out;
>>  
>>  	if (range) {
>> -		range->start = address & PAGE_MASK;
>> -		range->end = range->start + PAGE_SIZE;
>> +		mmu_notifier_range_init(range, mm, address & PAGE_MASK,
>> +				     (address & PAGE_MASK) + PAGE_SIZE);
>>  		mmu_notifier_invalidate_range_start(range);
>>  	}
>>  	ptep = pte_offset_map_lock(mm, pmd, address, ptlp);
> 

Looks correct to me, as well.

Having the range struct declared in separate places from the mmu_notifier_range_init()
calls is not great. But I'm not sure I see a way to make it significantly cleaner, given
that __follow_pte_pmd uses the range pointer as a way to decide to issue the mmn calls.


thanks,
-- 
John Hubbard
NVIDIA

  parent reply	other threads:[~2019-01-03  3:32 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-03  0:21 Matthew Wilcox
2019-01-03  1:56 ` Jerome Glisse
2019-01-03  1:56   ` Jerome Glisse
2019-01-03  3:32   ` John Hubbard [this message]
2019-01-03  4:18     ` Matthew Wilcox
2019-01-03 14:29       ` Jerome Glisse
2019-01-03 14:39         ` Matthew Wilcox
2019-01-03 14:39           ` Matthew Wilcox
2019-01-03 14:59           ` Jerome Glisse
2019-01-03 14:59             ` Jerome Glisse
2019-01-03 14:31 ` Jerome Glisse
2019-01-03 14:36   ` Matthew Wilcox
2019-01-03 14:43   ` Matthew Wilcox
2019-01-03 15:05     ` Jerome Glisse
2019-01-03 15:05       ` Jerome 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=785af237-eb67-c304-595d-9080a2f48102@nvidia.com \
    --to=jhubbard@nvidia.com \
    --cc=akpm@linux-foundation.org \
    --cc=christian.koenig@amd.com \
    --cc=jack@suse.cz \
    --cc=jglisse@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-xfs@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox