linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm, dax: VMA with vm_ops->pfn_mkwrite wants to be write-notified
@ 2015-09-01 10:22 Kirill A. Shutemov
  2015-09-01 10:54 ` Boaz Harrosh
  0 siblings, 1 reply; 4+ messages in thread
From: Kirill A. Shutemov @ 2015-09-01 10:22 UTC (permalink / raw)
  To: Andrew Morton, Matthew Wilcox
  Cc: linux-mm, linux-fsdevel, linux-kernel, linux-nvdimm,
	Kirill A. Shutemov, Yigal Korman, Boaz Harrosh, Jan Kara,
	Dave Chinner

For VM_PFNMAP and VM_MIXEDMAP we use vm_ops->pfn_mkwrite instead of
vm_ops->page_mkwrite to notify abort write access. This means we want
vma->vm_page_prot to be write-protected if the VMA provides this vm_ops.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Yigal Korman <yigal@plexistor.com>
Cc: Boaz Harrosh <boaz@plexistor.com>
Cc: Matthew Wilcox <matthew.r.wilcox@intel.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Dave Chinner <david@fromorbit.com>
---
 mm/mmap.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index df6d5f07035b..3f78bceefe5a 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1498,7 +1498,8 @@ int vma_wants_writenotify(struct vm_area_struct *vma)
 		return 0;
 
 	/* The backer wishes to know when pages are first written to? */
-	if (vma->vm_ops && vma->vm_ops->page_mkwrite)
+	if (vma->vm_ops &&
+			(vma->vm_ops->page_mkwrite || vma->vm_ops->pfn_mkwrite))
 		return 1;
 
 	/* The open routine did something to the protections that pgprot_modify
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mm, dax: VMA with vm_ops->pfn_mkwrite wants to be write-notified
  2015-09-01 10:22 [PATCH] mm, dax: VMA with vm_ops->pfn_mkwrite wants to be write-notified Kirill A. Shutemov
@ 2015-09-01 10:54 ` Boaz Harrosh
  2015-09-01 11:10   ` Kirill A. Shutemov
  0 siblings, 1 reply; 4+ messages in thread
From: Boaz Harrosh @ 2015-09-01 10:54 UTC (permalink / raw)
  To: Kirill A. Shutemov, Andrew Morton, Matthew Wilcox
  Cc: linux-mm, linux-fsdevel, linux-kernel, linux-nvdimm, Yigal Korman,
	Jan Kara, Dave Chinner

On 09/01/2015 01:22 PM, Kirill A. Shutemov wrote:
> For VM_PFNMAP and VM_MIXEDMAP we use vm_ops->pfn_mkwrite instead of
> vm_ops->page_mkwrite to notify abort write access. This means we want
> vma->vm_page_prot to be write-protected if the VMA provides this vm_ops.
> 

Hi Kirill

I will test with this right away and ACK on this.

Hmm so are you saying we might be missing some buffer modifications right now.

What would be a theoretical scenario that will cause these missed events?
I would like to put a test in our test rigs that should fail today and this
patch fixes.

[In our system every modified pmem block is also RDMAed to a remote
 pmem for HA, a missed modification will make the two copies unsynced]

Thanks for catching this
Boaz

> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Cc: Yigal Korman <yigal@plexistor.com>
> Cc: Boaz Harrosh <boaz@plexistor.com>
> Cc: Matthew Wilcox <matthew.r.wilcox@intel.com>
> Cc: Jan Kara <jack@suse.cz>
> Cc: Dave Chinner <david@fromorbit.com>
> ---
>  mm/mmap.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/mm/mmap.c b/mm/mmap.c
> index df6d5f07035b..3f78bceefe5a 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -1498,7 +1498,8 @@ int vma_wants_writenotify(struct vm_area_struct *vma)
>  		return 0;
>  
>  	/* The backer wishes to know when pages are first written to? */
> -	if (vma->vm_ops && vma->vm_ops->page_mkwrite)
> +	if (vma->vm_ops &&
> +			(vma->vm_ops->page_mkwrite || vma->vm_ops->pfn_mkwrite))
>  		return 1;
>  
>  	/* The open routine did something to the protections that pgprot_modify
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mm, dax: VMA with vm_ops->pfn_mkwrite wants to be write-notified
  2015-09-01 10:54 ` Boaz Harrosh
@ 2015-09-01 11:10   ` Kirill A. Shutemov
  2015-09-01 11:21     ` Boaz Harrosh
  0 siblings, 1 reply; 4+ messages in thread
From: Kirill A. Shutemov @ 2015-09-01 11:10 UTC (permalink / raw)
  To: Boaz Harrosh
  Cc: Kirill A. Shutemov, Andrew Morton, Matthew Wilcox, linux-mm,
	linux-fsdevel, linux-kernel, linux-nvdimm, Yigal Korman, Jan Kara,
	Dave Chinner

On Tue, Sep 01, 2015 at 01:54:26PM +0300, Boaz Harrosh wrote:
> On 09/01/2015 01:22 PM, Kirill A. Shutemov wrote:
> > For VM_PFNMAP and VM_MIXEDMAP we use vm_ops->pfn_mkwrite instead of
> > vm_ops->page_mkwrite to notify abort write access. This means we want
> > vma->vm_page_prot to be write-protected if the VMA provides this vm_ops.
> > 
> 
> Hi Kirill
> 
> I will test with this right away and ACK on this.
> 
> Hmm so are you saying we might be missing some buffer modifications right now.
> 
> What would be a theoretical scenario that will cause these missed events?

On writable mapping with vm_ops->pfn_mkwrite, but without
vm_ops->page_mkwrite: read fault followed by write access to the pfn.
Writable pte will be set up on read fault and write fault will not be
generated.

I found it examining Dave's complain on generic/080:

http://lkml.kernel.org/g/20150831233803.GO3902@dastard

Although I don't think it's the reason.

> I would like to put a test in our test rigs that should fail today and this
> patch fixes.
> 
> [In our system every modified pmem block is also RDMAed to a remote
>  pmem for HA, a missed modification will make the two copies unsynced]

It shouldn't be a problem for ext2/ext4 as they provide both pfn_mkwrite
and page_mkwrite.

-- 
 Kirill A. Shutemov

--
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>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mm, dax: VMA with vm_ops->pfn_mkwrite wants to be write-notified
  2015-09-01 11:10   ` Kirill A. Shutemov
@ 2015-09-01 11:21     ` Boaz Harrosh
  0 siblings, 0 replies; 4+ messages in thread
From: Boaz Harrosh @ 2015-09-01 11:21 UTC (permalink / raw)
  To: Kirill A. Shutemov
  Cc: Kirill A. Shutemov, Andrew Morton, Matthew Wilcox, linux-mm,
	linux-fsdevel, linux-kernel, linux-nvdimm, Yigal Korman, Jan Kara,
	Dave Chinner

On 09/01/2015 02:10 PM, Kirill A. Shutemov wrote:
> On Tue, Sep 01, 2015 at 01:54:26PM +0300, Boaz Harrosh wrote:
>> On 09/01/2015 01:22 PM, Kirill A. Shutemov wrote:
>>> For VM_PFNMAP and VM_MIXEDMAP we use vm_ops->pfn_mkwrite instead of
>>> vm_ops->page_mkwrite to notify abort write access. This means we want
>>> vma->vm_page_prot to be write-protected if the VMA provides this vm_ops.
>>>
>>
>> Hi Kirill
>>
>> I will test with this right away and ACK on this.
>>
>> Hmm so are you saying we might be missing some buffer modifications right now.
>>
>> What would be a theoretical scenario that will cause these missed events?
> 
> On writable mapping with vm_ops->pfn_mkwrite, but without
> vm_ops->page_mkwrite: read fault followed by write access to the pfn.
> Writable pte will be set up on read fault and write fault will not be
> generated.
> 
> I found it examining Dave's complain on generic/080:
> 
> http://lkml.kernel.org/g/20150831233803.GO3902@dastard
> 
> Although I don't think it's the reason.
> 
>> I would like to put a test in our test rigs that should fail today and this
>> patch fixes.
>>
>> [In our system every modified pmem block is also RDMAed to a remote
>>  pmem for HA, a missed modification will make the two copies unsynced]
> 
> It shouldn't be a problem for ext2/ext4 as they provide both pfn_mkwrite
> and page_mkwrite.
> 

Ha right we have both as well, and so should xfs I think (because of the
zero pages thing, in fact any dax.c user should).

Thanks so this verifies why we could not see any such breakage.

ACK-by: Boaz Harrosh <boaz@plexistor.com>

--
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>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-09-01 11:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-01 10:22 [PATCH] mm, dax: VMA with vm_ops->pfn_mkwrite wants to be write-notified Kirill A. Shutemov
2015-09-01 10:54 ` Boaz Harrosh
2015-09-01 11:10   ` Kirill A. Shutemov
2015-09-01 11:21     ` Boaz Harrosh

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).